* IPC refactor part 3 + 4: New server HIPC message processor with source generator based serialization
* Make types match on calls to AlignUp/AlignDown
* Formatting
* Address some PR feedback
* Move BitfieldExtensions to Ryujinx.Common.Utilities and consolidate implementations
* Rename Reader/Writer to SpanReader/SpanWriter and move to Ryujinx.Common.Memory
* Implement EventType
* Address more PR feedback
* Log request processing errors since they are not normal
* Rename waitable to multiwait and add missing lock
* PR feedback
* Ac_K PR feedback
* Replace Array.Clear(x, 0, x.Length) with Array.Clear(x)
* Use DateTime.UnixEpoch field
* Replace SHA256.ComputeHash calls with static SHA256.HashData call
More performant and avoids the need to initialize a SHA256 instance.
* Make all structs readonly when applicable. It should reduce amount of needless defensive copies
* Make structs with trivial boilerplate equality code record structs
* Remove unnecessary readonly modifiers from TextureCreateInfo
* Make BitMap structs readonly too
* 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.
This PR implements/stubs some missing calls introduced in recent firmware (13.0.0).
- `acc:u0 InitializeApplicationInfoV2` needed by ACNH.
- `aoc:u NotifyMountAddOnContent/NotifyUnmountAddOnContent/CheckAddOnContentMountStatus` checked by RE. Needed by ACNH.
- `IPurchaseEventManager PopPurchasedProductInfo` needed by Dying Light.
Now ACNH 2.0 update is fully playable, and Dying Light can boot further:
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.
* account: Fix wrong condition in TrySelectUserWithoutInteraction
Since the implementation of User Profiles, we can get more than one profile stored. This PR fixes a wrong condition in `TrySelectUserWithoutInteraction`.
Closes#2320
* Some cleanup
* 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
* Rename CommandAttribute as CommandHIpcAttribute to prepare for 12.x changes
* Implement inital support for TIPC and adds SM command ids
* *Ipc to *ipc
* Missed a ref in last commit...
* CommandAttributeTIpc to CommandAttributeTipc
* Addresses comment and fixes some bugs around
TIPC doesn't have any padding requirements as buffer C isn't a thing
Fix for RegisterService inverting two argument only on TIPC
* account: Adds Account Manager
In a way to have Custom User Profiles merged in master faster, this PR adds a `AccountManager` class (based on `AccountUtils` class) and the following changes have been made:
- Adds a "default profile values" which were the old hardcoded ones.
- The image profile is moved to the Account service folder.
- The hardcoded UserId for the savedata is now using the `AccountManager` last opened one.
- The DeviceId in Mii service is changed to the right value (checked by REd sys:set call).
* Fix csproj
* Addresses gdkchan's comments
* Fix UserProfile fields
* Fix mii GetDeviceId()
* Update Ryujinx.HLE.csproj
* hos/gui: Add a check of NCA program index in titleid
This add a check to `ApplicationLoader` for the last 2 digits of the game TitleId who seems to be the NCA program index.
We currently return the last index, instead of the lower one.
Same check is added to ApplicationLibrary in the UI.
I've cleaned up both file too.
* hle: implement partial relaunch logic
TODO: make the emulator auto relauch.
* Handle auto relaunch
* hle: Unify update usage system
* hle: Implement support of multi programs in update system
* Add some documentation
* Address rip's comment
Co-authored-by: Ac_K <Acoustik666@gmail.com>
* account: Implement IManagerForApplication calls and IAsyncContext
This implement:
- IManagerForApplication::EnsureIdTokenCacheAsync (accordingly to RE) but the Async task is stubbed.
- IAsyncContext interface (accordingly to RE).
- IManagerForApplication::LoadIdTokenCache (checked with RE, and stubbed).
I've tried some games but now they needs some `sfdnsres` calls, some other boots and crashes with other issues.
Maybe we should disable the connection somewhere to lets the game think we are offline. I have done many attempts, without success, but since the code is here now, it's better than nothing.
(I've cleaned up `using` of IGeneralService too)
Closes#629 and closes#630
* change AccountId
* Fix gdkchan's comments
* use CompletedTask
* 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 a new physical memory manager and replace DeviceMemory
* Proper generic constraints
* Fix debug build
* Add memory tests
* New CPU memory manager and general code cleanup
* Remove host memory management from CPU project, use Ryujinx.Memory instead
* Fix tests
* Document exceptions on MemoryBlock
* Fix leak on unix memory allocation
* Proper disposal of some objects on tests
* Fix JitCache not being set as initialized
* GetRef without checks for 8-bits and 16-bits CAS
* Add MemoryBlock destructor
* Throw in separate method to improve codegen
* Address PR feedback
* QueryModified improvements
* Fix memory write tracking not marking all pages as modified in some cases
* Simplify MarkRegionAsModified
* Remove XML doc for ghost param
* Add back optimization to avoid useless buffer updates
* Add Ryujinx.Cpu project, move MemoryManager there and remove MemoryBlockWrapper
* Some nits
* Do not perform address translation when size is 0
* Address PR feedback and format NativeInterface class
* Remove ghost parameter description
* Update Ryujinx.Cpu to .NET Core 3.1
* Address PR feedback
* Fix build
* Return a well defined value for GetPhysicalAddress with invalid VA, and do not return unmapped ranges as modified
* Typo
InternetRequestDenied (I can't find a better name) was taken from Switchbrew (switchbrew.org/wiki/Error_codes)
Regarding this error, SwitchBrew notes: "IsAnyInternetRequestAccepted with the output from GetClientId returned false."
* Implement mii:u and mii:e entirely
Co-authored-by: AcK77 <Acoustik666@gmail.com>
This commit implement the mii service accurately.
This is based on Ac_k work but was polished and updated to 7.x.
Please note that the following calls are partially implemented:
- Convert: Used to convert from old console format (Wii/Wii U/3ds)
- Import and Export: this is shouldn't be accesible in production mode.
* Remove some debug leftovers
* Make it possible to load an arbitrary mii database from a Switch
* Address gdk's comments
* Reduce visibility of all the Mii code
* Address Ac_K's comments
* Remove the StructLayout of DatabaseSessionMetadata
* Add a missing line return in DatabaseSessionMetadata
* Misc fixes and style changes
* Fix some issues from last commit
* Fix database server metadata UpdateCounter in MarkDirty (Thanks Moose for the catch)
* MountCounter should only be incremented when no error is reported
* Fix FixDatabase
Co-authored-by: Alex Barney <thealexbarney@gmail.com>
* 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
* 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>
* Refactoring HOS folder structure
Refactoring HOS folder structure:
- Added some subfolders when needed (Following structure decided in private).
- Added some `Types` folders when needed.
- Little cleanup here and there.
- Add services placeholders for every HOS services (close#766 and #753).
* Remove Types namespaces