* 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
- 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.
* 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>
* 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
* 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
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.
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.
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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>
* 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>
* Update to LibHac 0.6.0
* Create an IFileSystemProxy object from LibHac
* Rename rc -> result
* Alignment and spacing
* Result formatting
* Spacing
* Sort usings
* 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
* Implement basic support of SystemSaveData and Cleanup IFileSystemProxy
- Implement `OpenSystemSaveData` as a `IFileSystem` in `SaveHelper`:
On real device, system saves data are stored encrypted, and we can't create an empty system save data for now. That's why if a user put his own dump of system save in `RyuFs\nand\system\save\`, we extract content in associated folder and open it as a `IFileSystem`. If the system save data don't exist, a folder is created.
- Cleanup `IFileSystemProxy` by adding a Helper class.
- Implement `GetSavePath` in `VirtualFileSystem` and remove `GetGameSavePath` in `SaveHelper`.
* remove the forgotten I
* Fix align
* Added GUI to Ryujinx
* Updated to use Glade
Also added scrollbar and default dark theme
* Added support for loading icon from .nro files and cleaned up the code a bit
* Added General Settings Menu (read-only for now) and moved some functionality from MainMenu.cs to ApplicationLibrary.cs
* Added custom GUI theme support and changed the defualt theme to one I just wrote
* Added GTK to process path, fixed a bug and minor edits
* some more edits and a bug fix
* general settings menu is now fully functional. also fixed the bug where ryujinx crashes when it trys to load an invalid gamedir
* big rewrite
* aesthetic changes to General Settings menu
* Added Control Settings
one day done feature :P
* minor changes
* 1st wave of changes
* 2nd wave of changes
* 3rd wave of changes
* Cleanup settings ui
* minor edits
* new about window added, still needs styling
* added spin button for new option and tooltips to settings
* Game icons and names are now shown in the games list
* add nuget package which contains gtk dependencies
* requested changes have been changed
* put CreateGameWindow on a new thread and stopped destroying the main menu when a game loads
* fixed bug that allowed a user to attempt to load multiple games at a time which causes a crash
* Added LastPlayed and TimePlayed columns to the game list
* Did some testing and fixed some bugs
Im not happy with one of the fixes so i will do it properly an upcoming commit
* did some more bug testing and fixed another 2 bugs
* caught an exception when ryujinx tries to load non-homebrew as homebrew
* Large changes
Rewrote ApplicationLibrary.cs (added comments too) so any devs reading it wont get eye cancer, also its probably more efficient now. Added 2 new columns (Developer name and application version) to the game list and wrote the logic for it. Ryujinx now loads NRO's TitleName and TitleID from the NACP file instead of the default NPDM. I also killed a lot of bugs
* Moved Files
moved ApplicationLibrary.cs to Ryujinx.HLE as that is a better place for it. Moved contents of GUI folder to Ui folder and changed the namespaces of the gui files from Ryujinx to Ryujinx.Ui
* Added 'Open Ryujinx Folder' button to the file menu and did some small fixes
* New features
* updated nuget package with missing dlls and changed emmauss' requested changes
* fixed some minor issues
* all requested changes marked as resolved have been changed
* gdkchan's requested changes
* fixed an issue with settings window getting chopped on small res
* fixed 2 problems caused by rebase
* changed the default theme
* applied Thog's patch to fix issue on linux
* fixed issue caused by rebase
* added update check button that runs ryujinx-updater
* reads version info from installer and displays it in about menu
* changes completed
* requested changes changed
* fixed issue with default theme
* fixed a bug and completed requested changes
* added more tooltips and changed some text
* Clean up ITimeZoneService
Add error codes and simplify parsing
* Add accurate timezone logic
TOOD: LoadTimeZoneRule and location name cmds.
* Integrate the new TimeZone logic
* SCREAMING_UNIX_CASE => PascalCase
* Address comments
* Reduce use of pointer in the LoadTimeZoneRule logic
* Address comments
* Realign tzIfStream logic in LoadTimeZoneRule
* Address gdk's comments
* Refactor the friend namespace and UInt128
This commit also:
- Fix GetFriendsList arguments ordering.
- Add GetFriendListIds.
- Expose the permission level of the port instance.
- InvalidUUID => InvalidArgument
* friend: add all cmds as commments
* add Friend structure layout
* Rename FriendErr to FriendError
* Accurately implement INotificationService
* Fix singleton lock of NotificationEventHandler
* Address comments
* Add comments for IDaemonSuspendSessionService cmds
* Explicitly define the Charset when needed
Also make "Nickname" a string
* Address gdk's comments
* Fix typos
* Remove unneeded using statements
* Enforce var style more
* Remove redundant qualifiers
* Fix some indentation
* Disable naming warnings on files with external enum names
* Fix build
* Mass find & replace for comments with no spacing
* Standardize todo capitalization and for/if spacing
* It compiles
* Print correct name when loading an exefs
* Use DirectorySaveDataFileSystem for savedata
* Handle more errors in IFileSystem
* Remove structs replaced by LibHac structs
* Fix alignment
* Fix alignment again
* Fix IFile and IFileSystem IPC
* Alignment
* Use released libhac version
* Make it possibles to load hb-loader and hb-menu
One issue remains with hb-menu homebrew icons because of SIMD issues
(libjpeg-turbo related) and netloader doesn't work.
* Implement GetApplicationControlData
* Fix shared fonts for NSO/NRO
* Add homebrew NRO romfs support
This readd the NRO support by parsing the ASET header
* Address comments about HomebrewRomFs
* override Dispose in homebrew romfs stream
* Use a struct for file timestamp
* Simplify positional increments in GetApplicationControlData
* Address comments
* improve readability of the memory permission check in SetProcessMemoryPermission
* Fix previous broken check
* Add address space checks in SetProcessMemoryPermission