aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/FileSystem
AgeCommit message (Collapse)Author
2023-04-27Move solution and projects to srcTSR Berry
2023-03-31HLE: Refactoring of ApplicationLoader (#4480)Ac_K
* HLE: Refactoring of ApplicationLoader * Fix SDL2 Headless * Addresses gdkchan feedback * Fixes LoadUnpackedNca RomFS loading * remove useless casting * Cleanup and fixe empty application name * Remove ProcessInfo * Fixes typo * ActiveProcess to ActiveApplication * Update check * Clean using. * Use the correct filepath when loading Homebrew.npdm * Fix NRE in ProcessResult if MetaLoader is null * Add more checks for valid processId & return success * Add missing logging statement for npdm error * Return result for LoadKip() * Move error logging out of PFS load extension method This avoids logging "Could not find Main NCA" followed by "Loading main..." when trying to start hbl. * Fix GUIs not checking load results * Fix style and formatting issues * Fix formatting and wording * gtk: Refactor LoadApplication() --------- Co-authored-by: TSR Berry <20988865+TSRBerry@users.noreply.github.com>
2023-03-17Reducing memory allocations (#4537)jhorv
* add RecyclableMemoryStream dependency and MemoryStreamManager * organize BinaryReader/BinaryWriter extensions * add StreamExtensions to reduce need for BinaryWriter * simple replacments of MemoryStream with RecyclableMemoryStream * add write ReadOnlySequence<byte> support to IVirtualMemoryManager * avoid 0-length array creation * rework IpcMessage and related types to greatly reduce memory allocation by using RecylableMemoryStream, keeping streams around longer, avoiding their creation when possible, and avoiding creation of BinaryReader and BinaryWriter when possible * reduce LINQ-induced memory allocations with custom methods to query KPriorityQueue * use RecyclableMemoryStream in StreamUtils, and use StreamUtils in EmbeddedResources * add constants for nanosecond/millisecond conversions * code formatting * XML doc adjustments * fix: StreamExtension.WriteByte not writing non-zero values for lengths <= 16 * XML Doc improvements. Implement StreamExtensions.WriteByte() block writes for large-enough count values. * add copyless path for StreamExtension.Write(ReadOnlySpan<int>) * add default implementation of IVirtualMemoryManager.Write(ulong, ReadOnlySequence<byte>); remove previous explicit implementations * code style fixes * remove LINQ completely from KScheduler/KPriorityQueue by implementing a custom struct-based enumerator
2023-03-01Update LibHac to 0.18.0 (#4414)Steveice10
* Update LibHac to 0.18.0 * Change instance of AsBytes(CreateReadOnlySpan(...)) to AsReadOnlyByteSpan(...)
2023-02-08Replace BitConverter.ToString(bytes).Replace("-", "") with ↵Berkan Diler
Convert.ToHexString(bytes) (#4382)
2023-01-18Optimize string memory usage. Use Spans and StringBuilders where possible ↵Andrey Sukharev
(#3933) * Optimize string memory usage. Use ReadOnlySpan<char> and StringBuilder where possible. * Fix copypaste error * Code generator review fixes * Use if statement instead of switch * Code style fixes Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Another code style fix * Styling fix Co-authored-by: Mary-nyan <thog@protonmail.com> * Styling fix Co-authored-by: gdkchan <gab.dark.100@gmail.com> Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Co-authored-by: Mary-nyan <thog@protonmail.com> Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2023-01-18HOS: Load RomFs by pid (#4301)Ac_K
We currently loading only one RomFs at a time, which could be wrong if one day we want to load more than one guest at time. This PR fixes that by loading romfs by pid.
2022-12-07hle: Do not add disabled AoC item to the list (#4044)Ac_K
* hle: Do not add disabled AoC item to the list We currently add all AoC items to a list in `ContentManager` and the enable check is only done when FS service ask for the data. Which is wrong. It causes an issue in MK8D which doesn't boot even if you have disabled a not updated DLC. I've fixed it by not adding the disabled AoC item to the list, I've removed some duplicate code too. There is still an edge case because we currently don't check the AoC Item version, but that should be fixed later since now MK8D throw an error if the DLC isn't updated. * remove useless "enabled"
2022-11-23Update to LibHac 0.17.0 (#3878)Alex Barney
* Update to LibHac 0.17.0 * Don't clear SD card saves when starting the emulator This was an old workaround for errors that happened when a user's SD card encryption seed changed. SD card saves have been unencrypted for over a year, so we should be fine to remove the workaround.
2022-11-09infra: Migrate to .NET 7 (#3795)Mary-nyan
* Update readme to mention .NET 7 * infra: Migrate to .NET 7 .NET 7 is still in preview but this prepare for the release coming up next month. * Use Random.Shared in CreateRandom * Move UInt128Utils.cs to Ryujinx.Common project * Fix inverted parameters in System.UInt128 constructor * Fix Visual Studio complains on Ryujinx.Graphics.Vic * time: Fix missing alignment enforcement in SystemClockContext Fixes at least Smash * time: Fix missing alignment enforcement in SteadyClockContext Fix games (like recent version of Smash) using time shared memory * Switch to .NET 7.0.100 release * Enable Tiered PGO * Ensure CreateId validity requirements are meet when doing random generation Also enforce correct packing layout for other Mii structures. This fix a Mario Kart 8 crashes related to the default Miis.
2022-08-17Removed extra semicolons. (#3594)Nicholas Rodine
2022-03-22hle: Some cleanup (#3210)Ac_K
* hle: Some cleanup This PR cleaned up a bit the HLE folder and the VirtualFileSystem one, since we use LibHac, we can use some class of it directly instead of duplicate things. The "Content" of VFS folder is removed since it should be handled in the NCM service directly. A larger cleanup should be done later since there is still be duplicated code here and there. * Fix Headless.SDL2 * Addresses gdkchan feedback
2022-02-13Use Enum and Delegate.CreateDelegate generic overloads (#3111)Berkan Diler
* Use Enum generic overloads * Remove EnumExtensions.cs * Use Delegate.CreateDelegate generic overloads
2022-02-02Try to ensure save data always has a valid owner ID (#3057)Alex Barney
- Run the extra data fix in FixExtraData on non-system saves that have no owner ID. - Set the owner ID in the dummy application control property if an application doesn't have a proper one available.
2022-01-13ssl: Implement SSL connectivity (#2961)Mary
* implement certain servicessl functions * ssl: Implement more of SSL connection and abstract it This adds support to non blocking SSL operations and unlink the SSL implementation from the IPC logic. * Rename SslDefaultSocketConnection to SslManagedSocketConnection * Fix regression on Pokemon TV * Address gdkchan's comment * Simplify value read from previous commit * ssl: some changes - Implement builtin certificates parsing and retrieving - Fix issues with SSL version handling - Improve managed SSL socket error handling - Ensure to only return a certificate on DoHandshake when actually requested * Add missing BuiltInCertificateManager initialization call * Address gdkchan's comment * Address Ack's comment Co-authored-by: InvoxiPlayGames <webmaster@invoxiplaygames.uk>
2022-01-12Update to LibHac 0.15.0 (#2986)Alex Barney
2021-12-23Update to LibHac v0.14.3 (#2925)Alex Barney
* Update to LibHac v0.14.3 * Fix loading NCAs that don't have a data partition
2021-10-24hle: Improve safety (#2778)Mary
* timezone: Make timezone implementation safe * hle: Do not use TrimEnd to parse ASCII strings This adds an util that handle reading an ASCII string in a safe way. Previously it was possible to read malformed data that could cause various undefined behaviours in multiple services. * hid: Remove an useless unsafe modifier on keyboard update * Address gdkchan's comment * Address gdkchan's comment
2021-09-15hos: Cleanup the project (#2634)Ac_K
* hos: Cleanup the project Since a lot of changes has been done on the HOS project, there are some leftover here and there, or class just used in one service, things at wrong places, and more. This PR fixes that, additionnally to that, I've realigned some vars because I though it make the code more readable. * Address gdkchan feedback * addresses Thog feedback * Revert ElfSymbol
2021-08-26Bugfix LibHac update to 0.13.3 and remove SD card workaround (#2579)Alex Barney
2021-08-20Clean the SD card save directory when opening the emulator (#2564)Alex Barney
Cleans "sdcard:/Nintendo/save" and deletes "sdcard:/save" when opening the emulator. Works around invalid encryption when keys or the SD card encryption seed are changed.
2021-08-17Always use an all-zeros key for AES-XTS file systems (#2561)Alex Barney
2021-08-12Update to LibHac 0.13.1 (#2475)Alex Barney
* Update to LibHac 0.13.1 * Recreate directories for indexed saves if they're missing on emulator start
2021-07-13Revert LibHac updateMary
Users are facing save destruction on failing extra data update apparently
2021-07-13Update to LibHac 0.13.1 (#2328)Alex Barney
Update the LibHac dependency to version 0.13.1. This brings a ton of improvements and changes such as: - Refactor `FsSrv` to match the official refactoring done in FS. - Change how the `Horizon` and `HorizonClient` classes are handled. Each client created represents a different process with its own process ID and client state. - Add FS access control to handle permissions for FS service method calls. - Add FS program registry to keep track of the program ID, location and permissions of each process. - Add FS program index map info manager to track the program IDs and indexes of multi-application programs. - Add all FS IPC interfaces. - Rewrite `Fs.Fsa` code to be more accurate. - Rewrite a lot of `FsSrv` code to be more accurate. - Extend directory save data to store `SaveDataExtraData` - Extend directory save data to lock the save directory to allow only one accessor at a time. - Improve waiting and retrying when encountering access issues in `LocalFileSystem` and `DirectorySaveDataFileSystem`. - More `IFileSystemProxy` methods should work now. - Probably a bunch more stuff. On the Ryujinx side: - Forward most `IFileSystemProxy` methods to LibHac. - Register programs and program index map info when launching an application. - Remove hacks and workarounds for missing LibHac functionality. - Recreate missing save data extra data found on emulator startup. - Create system save data that wasn't indexed correctly on an older LibHac version. `FsSrv` now enforces access control for each process. When a process tries to open a save data file system, FS reads the save's extra data to determine who the save owner is and if the caller has permission to open the save data. Previously-created save data did not have extra data created when the save was created. With access control checks in place, this means that processes with no permissions (most games) wouldn't be able to access their own save data. The extra data can be partially created from data in the save data indexer, which should be enough for access control purposes.
2021-05-16misc: Move configuration management to the Ryujinx project (#2269)Mary
* Decouple configuration from Ryujinx.HLE and Ryujinx.Input * Move Configuration to the Ryujinx project
2021-04-24HLE: Fix integer sign inconcistency accross the codebase (#2222)Mary
* Make all title id instances unsigned * Replace address and size with ulong instead of signed types Long overdue change. Also change some logics here and there to optimize with the new memory manager. * Address Ac_K's comments * Remove uneeded cast all around * Fixes some others misalignment
2021-03-15Implement friendlier portable mode (#1885)mageven
* Implement friendlier portable mode * Remove first run dialog * Disable updates in portable mode for now * Convert relative custom paths to absolute ones Also, fix a regression when custom path doesn't exist
2021-01-26Initial Setup: Reload keys before verifying firmware (#1955)mageven
* Initial Setup: Reload keys before verifying firmware Also, display the NoKeys dialog if keyset is empty when verifying firmware. * LoadApplications: Remove the lone debug log and print the error directly
2021-01-11Only attempt to import common tickets. (#1886)Steven Smith
2020-09-01Update to LibHac 0.12.0 (#1485)Alex Barney
* Update to LibHac 0.12.0 * Auto-formatting. Fixed a bug in SetApplicationCopyrightImage
2020-08-30Allow launching with custom data directories (#1505)mageven
* Allow launching with custom data directories Don't load alternate keys when using custom directory * Address gdkchan's comments * Misc fixes to log levels Added more enabled log levels by default Moved successful config updation to Notice as 1. It's not a warning 2. Warnings could've been disabled by the config load and hence message would be lost
2020-08-04Improved Logger (#1292)mageven
* Logger class changes only Now compile-time checking is possible with the help of Nullable Value types. * Misc formatting * Manual optimizations PrintGuestLog PrintGuestStackTrace Surfaceflinger DequeueBuffer * Reduce SendVibrationXX log level to Debug * Add Notice log level This level is always enabled and used to print system info, etc... Also, rewrite LogColor to switch expression as colors are static * Unify unhandled exception event handlers * Print enabled LogLevels during init * Re-add App Exit disposes in proper order nit: switch case spacing * Revert PrintGuestStackTrace to Info logs due to #1407 PrintGuestStackTrace is now called in some critical error handlers so revert to old behavior as KThread isn't part of Guest. * Batch replace Logger statements
2020-07-09Implement modding support (#1249)mageven
* Implement Modding Support * Executables: Rewrite to use contiguous mem and Spans * Reorder ExeFs, Npdm, ControlData and SaveData calls After discussion with gdkchan, it was decided it's best to call LoadExeFs after all other loads are done as it starts the guest process. * Build RomFs manually instead of Layering FS Layered FS approach has considerable latency when building the final romfs. So, we manually replace files in a single romfs instance. * Add RomFs modding via storage file * Fix and cleanup MemPatch * Add dynamically loaded NRO patching * Support exefs file replacement * Rewrite ModLoader to use mods-search architecture * Disable PPTC when exefs patches are detected Disable PPTC on exefs replacements too * Rewrite ModLoader, again * Increased maintainability and matches Atmosphere closely * Creates base mods structure if it doesn't exist * Add Exefs partition replacement * IPSwitch: Fix nsobid parsing * Move mod logs to new LogClass * Allow custom suffixes to title dirs again * Address nits * Add a per-App "Open Mods Directory" context menu item Creates the path if not present. * Normalize tooltips verbiage * Use LocalStorage and remove unused namespaces
2020-06-23Import DLC title key from ticket when loading into content manager (#1318)Xpl0itR
2020-06-23Implement dlc management window (#1313)Xpl0itR
* Implement dlc management window * reduce repetition * Implement per NCA toggling of DLC rather than per container
2020-06-20Implement aoc:u and support loading AddOnContent (#1221)mageven
* Initial rebased AddOnContent support * Fix bounds calculation * Use existing GameCard in VFS per Xpl0itR's suggestion + Add dummy IPurchaseEventManager per AcK's suggestion * Support multiple containers * Add option to selectively disable addons * Import tickets from AOC FS * Load all nsps in base directory automatically * Revert LoadNsp renaming Removes conflicts with Mods PR. Not much is lost, old names were fine. * Address AcK's comments * Address Thog's comments Dispose opened nsp files Fix potential bug by clearing metadata on load
2020-05-15Refactor out Application details from Horizon (#1236)mageven
* Initial Application refactor * Misc typo and access modifier fixes * Clean unused namespaces * Address gdkchan's comments * Move ticket reading to common method * Change IParentalControlService to use ApplicationLoader.ControlData
2020-03-30Reduce requirements for running homebrew (#1053)Thog
* Reduce requirements for running homebrews This commit change the following behaviours: - TimeZoneBinary system archive isn't required until guest code call LoadTimeZoneRule. - Fonts system archives aren't requred until a "pl:u" IPC call is made. - Custom font support was dropped. - TimeZoneBinary missing message is now an error and not a warning. * Address comments
2020-03-25Add IMultiCommitManager (#1011)Alex Barney
* Update LibHac * Add IMultiCommitManager * Updates * Delete NuGet.Config * Add command version
2020-03-10Insert the SD card by default (#968)Alex Barney
2020-03-03Add support for cache storage (#936)Alex Barney
* Update LibHac * Run EnsureApplicationCacheStorage when launching a game * Add new FS commands
2020-02-02Fix inconsistencies with UserId (#906)Thog
* Fix inconsistencies with UserId The account user id isn't an UUID. This PR adds a new UserId type with the correct value ordering to avoid mismatch with LibHac's Uid. This also fix an hardcoded value of the UserId. As the userid has been invalid for quite some time (and to avoid forcing users to their recreate saves), the userid has been changed to "00000000000000010000000000000000". Also implement a stub for IApplicationFunctions::GetSaveDataSize. (see the sources for the reason) Fix #626 * Address jd's & Ac_k's comments
2020-01-24Make VirtualFileSystem only instanciable once (#901)Thog
This fix a regression caused by #888 on temporary saves for SNES Online. (and probably other games)
2020-01-21Keep the GUI alive when closing a game (#888)Thog
* Keep the GUI alive when closing a game Make HLE.Switch init when starting a game and dispose it when closing the GlScreen. This also make HLE in charge of disposing the audio and gpu backend. * Address Ac_k's comments * Make sure to dispose the Discord module and use GTK quit method Also update Discord Precense when closing a game. * Make sure to dispose MainWindow * Address gdk's comments
2020-01-13Fix race condition in ContentManager (#884)Thog
* Fix race condition in ContentManager This fix a race condition happening since #791 when trying to load a game via command line. * Address gdk's comments * Ensure to dispose the FileStream and not the IStorage
2020-01-12System firmware installer (#791)emmauss
* firmware installer * Add directory installation option and fix 9.x support for directory * Fix missing system font error while installing for the first time * Address code style comments * Create and use InvalidFirmwarePackageException * Fix LDj3SNuD's comments * addressed alex's comments * add label to status bar to show current firmware version Co-authored-by: Thog <thog@protonmail.com>
2020-01-05Rename "RyuFs" directory to "Ryujinx" and use the same savedata system the ↵Alex Barney
Switch uses (#801) * Use savedata FS commands from LibHac * Add EnsureSaveData. Use ApplicationControlProperty struct * Add a function to migrate to the new directory layout * LibHac update * Change backup structure * Don't create UI files in the save path * Update RyuFs paths * Add GetProgramIndexForAccessLog Ryujinx only runs one program at a time, so always return values reflecting that * Load control NCA when loading from an NSP * Skip over UI stats when exiting * Set TitleName and TitleId in more cases. Fix TitleID naming style * Completely comment out GUI play stats code * rebase * Update LibHac * Update LibHac * Revert UI changes * Do migration automatically at startup * Rename RyuFs directory to Ryujinx * Update RyuFs text * Store savedata paths in the GUI * Make "Open Save Directory" work * Use a dummy NACP in EnsureSaveData if one is not loaded * Remove manual migration button * Respond to feedback * Don't read the installer config to get a version string * Delete nuget.config * Exclude 'sdcard' and 'bis' during migration Co-authored-by: Thog <thog@protonmail.com>
2019-10-17Update to LibHac 0.6.0 (#792)Alex Barney
* Update to LibHac 0.6.0 * Create an IFileSystemProxy object from LibHac * Rename rc -> result * Alignment and spacing * Result formatting * Spacing * Sort usings
2019-10-08Update time implementation to 9.0.0 (#783)Thomas Guillemard
* Fix 9.0.0 related services bindings This was wrong because of a mistake on switchbrew. * Fix wronog cmdid for ISteadyClock::GetTestOffset/SetTestOffset * Update ClockCore logics to 9.0.0 Also apply 9.0.0 permissions and comment time:u, and time:a (as those are going to be moved) * Move every clocks instances + timezone to a global manager * Start implementing time:m Also prepare the skeleton of the shared memory * Implement SystemClockContextUpdateCallback and co * Update StaticService to 9.0.0 * Update ISystemClock to 9.0.0 * Rename IStaticService and add glue's IStaticService * Implement psc's ITimeZoneService * Integrate psc layer into glue for TimeZoneService * Rename TimeZoneManagerForPsc => TimeZoneManager * Use correct TimeZoneService interface for both StaticService implementations * Accurately implement time shared memory operations * Fix two critical flaws in TimeZone logic The first one was the month range being different fron Nintendo one (0-11 instead of 1-12) The other flaw was a bad incrementation order during days & months computation. * Follow Nintendo's abort logic for TimeManager * Avoid crashing when timezone sysarchive isn't present * Update Readme * Address comments * Correctly align fields in ISystemClock * Fix code style and some typos * Improve timezone system archive warning/error messages * Rearrange using definitions in Horizon.cs * Address comments