* aoc/am: Cleanup aoc service and stub am calls
This PR implement aoc call `GetAddOnContentListChangedEventWithProcessId` (Closes#2408) and `CreateContentsServiceManager`. Additionnally, a big cleanup (checked by RE on latest firmware) is made on the whole service. I've added `CountAddOnContent`, `ListAddOnContent` and `GetAddonContentBaseId` for games which require version `1.0.0-6.2.0` too.
Am service call `ReportUserIsActive` is stubbed (checked by RE, closes#2413).
Since some logic in the service (aoc) which handle the DLCs has been changed, it could be nice to have some testing to be sure there is no regression.
* Remove wrong check
* Addresses gdkchan feedback
* Fix GetAddOnContentLostErrorCode
* fix null pid in services
* Add missing comment
* remove leftover comment
* no name: Mii Editor applet support
* addresses gdkchan feedback
* Fix comment
* Bypass MountCounter of MiiDatabaseManager
* Fix GetSettingsPlatformRegion
* Disable Applet Menu for unsupported firmwares
This PR stubs caps service call `GetAlbumFileList0AafeAruidDeprecated` and `GetAlbumFileList3AaeAruid` (Closes#2035, Closes#2401), both are checked by RE.
This avoid using "ignore missing services" when you want to play World of Light in Super Smash Bros Ultimate.
* Ground work for separate GPU channels
* Rename TextureManager to TextureCache
* Decouple texture bindings management from the texture cache
* Rename BufferManager to BufferCache
* Decouple buffer bindings management from the buffer cache
* More comments and proper disposal
* PR feedback
* Force host state update on channel switch
* Typo
* PR feedback
* Missing using
* settings: Implement GetDeviceNickName and SetDeviceNickName
This PR implement `set` and `sys:set` calls : `GetDeviceNickName` and `SetDeviceNickName` accordingly to RE.
I've cleaned up both services a bit and `SystemStateMgr` class too.
Closes#2110
* Addresses gdkchan_s feedback
* nfc/nfp: Implement ISystemManager and ISystem
This PR add permission levels for `nfc` and `nfp` services:
- `nfc`: `CreateUserInterface` and `CreateSystemInterface` are implemented.
- `INfc`: `Initialize` and `IsNfcEnabled` calls are stubbed.
- `nfp`: `CreateDebugInterface` and `CreateSystemInterface` are implemented.
- `INfp`: `GetRegisterInfo2` for `IDebug` and `ISystem` are implemented.
* Addresses gdkchan feedback
* 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
* Stub two services
Stubs IHidServer::IsFirmwareUpdateAvailableForSixAxisSensor and IIrSensorServer::CheckFirmwareVersion
* Apply suggestions from code review
Also changed PackedMcuVersion to be two shorts instead of two bytes, because that's its actual type
* Apply new code review suggestions
Degroup field from previous assignation + Add padding after SixAxisSensorHandle
* Refactoring of KMemoryManager class
* Replace some trivial uses of DRAM address with VA
* Get rid of GetDramAddressFromVa
* Abstracting more operations on derived page table class
* Run auto-format on KPageTableBase
* Managed to make TryConvertVaToPa private, few uses remains now
* Implement guest physical pages ref counting, remove manual freeing
* Make DoMmuOperation private and call new abstract methods only from the base class
* Pass pages count rather than size on Map/UnmapMemory
* Change memory managers to take host pointers
* Fix a guest memory leak and simplify KPageTable
* Expose new methods for host range query and mapping
* Some refactoring of MapPagesFromClientProcess to allow proper page ref counting and mapping without KPageLists
* Remove more uses of AddVaRangeToPageList, now only one remains (shared memory page checking)
* Add a SharedMemoryStorage class, will be useful for host mapping
* Sayonara AddVaRangeToPageList, you served us well
* Start to implement host memory mapping (WIP)
* Support memory tracking through host exception handling
* Fix some access violations from HLE service guest memory access and CPU
* Fix memory tracking
* Fix mapping list bugs, including a race and a error adding mapping ranges
* Simple page table for memory tracking
* Simple "volatile" region handle mode
* Update UBOs directly (experimental, rough)
* Fix the overlap check
* Only set non-modified buffers as volatile
* Fix some memory tracking issues
* Fix possible race in MapBufferFromClientProcess (block list updates were not locked)
* Write uniform update to memory immediately, only defer the buffer set.
* Fix some memory tracking issues
* Pass correct pages count on shared memory unmap
* Armeilleure Signal Handler v1 + Unix changes
Unix currently behaves like windows, rather than remapping physical
* Actually check if the host platform is unix
* Fix decommit on linux.
* Implement windows 10 placeholder shared memory, fix a buffer issue.
* Make PTC version something that will never match with master
* Remove testing variable for block count
* Add reference count for memory manager, fix dispose
Can still deadlock with OpenAL
* Add address validation, use page table for mapped check, add docs
Might clean up the page table traversing routines.
* Implement batched mapping/tracking.
* Move documentation, fix tests.
* Cleanup uniform buffer update stuff.
* Remove unnecessary assignment.
* Add unsafe host mapped memory switch
On by default. Would be good to turn this off for untrusted code (homebrew, exefs mods) and give the user the option to turn it on manually, though that requires some UI work.
* Remove C# exception handlers
They have issues due to current .NET limitations, so the meilleure one fully replaces them for now.
* Fix MapPhysicalMemory on the software MemoryManager.
* Null check for GetHostAddress, docs
* Add configuration for setting memory manager mode (not in UI yet)
* Add config to UI
* Fix type mismatch on Unix signal handler code emit
* Fix 6GB DRAM mode.
The size can be greater than `uint.MaxValue` when the DRAM is >4GB.
* Address some feedback.
* More detailed error if backing memory cannot be mapped.
* SetLastError on all OS functions for consistency
* Force pages dirty with UBO update instead of setting them directly.
Seems to be much faster across a few games. Need retesting.
* Rebase, configuration rework, fix mem tracking regression
* Fix race in FreePages
* Set memory managers null after decrementing ref count
* Remove readonly keyword, as this is now modified.
* Use a local variable for the signal handler rather than a register.
* Fix bug with buffer resize, and index/uniform buffer binding.
Should fix flickering in games.
* Add InvalidAccessHandler to MemoryTracking
Doesn't do anything yet
* Call invalid access handler on unmapped read/write.
Same rules as the regular memory manager.
* Make unsafe mapped memory its own MemoryManagerType
* Move FlushUboDirty into UpdateState.
* Buffer dirty cache, rather than ubo cache
Much cleaner, may be reusable for Inline2Memory updates.
* This doesn't return anything anymore.
* Add sigaction remove methods, correct a few function signatures.
* Return empty list of physical regions for size 0.
* Also on AddressSpaceManager
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
This PR addresses the following issues:
- SM was previously instancied once and reused on all sessions. This
could cause inconsistency on the service initialization.
- TIPC replies were not matching what is generated on hardware.
* hid: Rewrite shared memory management
This entirely rewrite our ancient (and original) HID shared memory
interface to be more usable and accurate.
HID update logics were updated to reflect those changes but should work
still the same way it previously did.
This need heavy testing just in case to avoid possible regressions.
* Silence warnings
* Address gdkchan's comments
* Address Ac_K's comments
* Address one missing nit
* 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
* Surface Flinger: Fix an oversight when closing a layer
As the title say.
I also took the liberty of changing the logic on how we select the
current layer being rendered to make it more explicit when opening and
creating layers.
NOTE: Found by Ac_k.
* check for RenderLayerId and not the dictionary size
This fix a possible race condition between the time you create a layer and set the one currently used for rendering
This PR stub ILibraryAppletAccessor (20) RequestExit call which is needed by Monster Hunter Rise when you press "Private Policy" at the beginning.
The game try to run the `WebApplet` which is already partially stubbed, then call `RequestExit` to know when the applet exits. If the call does nothing, the game just hang forever. If you signals the event, you can interracts with the menu again.
* misc: Add credit to AmiiboAPI properly and fix a warning disable
This PR adds a properly credit to AmiiboAPI which is used in our Amiibo emulation in the Readme and in the about window.
I've changed a wrong warning code added in a recent PR too.
* Update README.md
* Fix aligment
* caps: Implement SaveScreenShot calls and cleanup
This PR implement:
- caps:u IAlbumApplicationService (32) SetShimLibraryVersion
- caps:c IAlbumControlService (33) SetShimLibraryVersion
- caps:su IScreenShotApplicationService (32) SetShimLibraryVersion
- caps:su IScreenShotApplicationService (203/205/210) SaveScreenShotEx0/SaveScreenShotEx1/SaveScreenShotEx2
ImageSharp is used to save the raw screenshot data as a JPG file following what the service does.
All screenshots are save in: `%AppData%\Ryujinx\sdcard\Nintendo\Album` folder. (as example a screenshot file path will be `%AppData%\Ryujinx\sdcard\Nintendo\Album\2021\03\26\2021032601020300-0123456789ABCDEF0123456789ABCDEF.jpg`
This is needed by Animal Crossing: New Horizon where screenshots looks like this:
And this is needed in Monster Hunter Rise but screenshots are currently empty due to another issue.
* remove useless comment
* Addresses gdkchan feedback
* Addresses gdkchan feedback 2
* remove useless comment 2
* Fix nits
* am/ectx: Implement SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled and add service placeholder
This PR implements `am` service call `SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled` (closes#2028) accordingly to RE and adds placeholder for the `ectx` service. Both were added in 11.0.0+ firmware and are needed to boots games which needs this version.
Some games are now playable/bootable:
* Remove unused warning
* sfdnsres: Cleanup service and implements some calls
This PR is a big cleanup to our current implementation of `sfdnsres` service.
Additionnaly to that, some calls and fix have been done by @Thog (PRd with approval, thanks to her).
- Implementation of `GetAddrInfoRequest` (Fixes#637).
- Partial implementation of `GetHostByNameRequestWithOptions`, `GetHostByAddrRequestWithOptions` and `GetAddrInfoRequestWithOptions` (Fixes#642, Fixes#1233).
A DNS Blacklist have been done by @riperiperi (which is currently used in LDN build, then that reduces code differences between the LDN build and master.
Now a lot of games are playable or are blocked to the menu because it needs online service:
Co-Authored-By: Mary <1760003+Thog@users.noreply.github.com>
Co-Authored-By: riperiperi <6294155+riperiperi@users.noreply.github.com>
* Addressed gdkchan's comments
* IPAddress[] to IEnumerable
* Nits
Co-authored-by: Mary <1760003+Thog@users.noreply.github.com>
Co-authored-by: riperiperi <6294155+riperiperi@users.noreply.github.com>
This PR remove the IIpcService.cs interface usage which isn't needed anymore since the interface is only used by IpcService class. We can use it directly.
I happened to notice this when checking Ryu's IPC structures. After double checking with RE it seems the current check is incorrect so use the correct member to fix that.
* Haydn: Part 1
Based on my reverse of audio 11.0.0.
As always, core implementation under LGPLv3 for the same reasons as for Amadeus.
This place the bases of a more flexible audio system while making audout & audin accurate.
This have the following improvements:
- Complete reimplementation of audout and audin.
- Audin currently only have a dummy backend.
- Dramatically reduce CPU usage by up to 50% in common cases (SoundIO and OpenAL).
- Audio Renderer now can output to 5.1 devices when supported.
- Audio Renderer init its backend on demand instead of keeping two up all the time.
- All backends implementation are now in their own project.
- Ryujinx.Audio.Renderer was renamed Ryujinx.Audio and was refactored because of this.
As a note, games having issues with OpenAL haven't improved and will not
because of OpenAL design (stopping when buffers finish playing causing
possible audio "pops" when buffers are very small).
* Update for latest hexkyz's edits on Switchbrew
* audren: Rollback channel configuration changes
* Address gdkchan's comments
* Fix typo in OpenAL backend driver
* Address last comments
* Fix a nit
* Address gdkchan's comments
This PR fix an issue introduced on last IPC rewrite PRs where some returned buffer size have to be explicit now.
`GetClientId` without an explicit buffer size return some garbage to the guest and then `nifm` service crashes because of a wrong ClientId. It's fixed now.
Horizon Chase Turbo and Doom regression are fixed now. (Probably some other games too)
* Added IsUserSystemClockAutomaticCorrectionEnabled
This is used when a game want to check if you game is synced with a server
* Update ISystemSettingsServer.cs
* Implemented OpenDataStorageWithProgramIndex
* Update IFileSystemProxy.cs
* Commited that file on accidant
* Update IFileSystemProxy.cs
* Revert "Merge branch 'master' of https://github.com/Joshi234/Ryujinx"
This reverts commit 375f430455, reversing
changes made to 672e2c8f7d.
* Revert "Update IFileSystemProxy.cs"
This reverts commit 672e2c8f7d.
* Update IFileSystemProxy.cs
* Update ISystemSettingsServer.cs
* removed accidantel addition of IFileSystemProxy.OpenDataStorageWithProgramIndex
* Update Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs
Co-authored-by: Ac_K <Acoustik666@gmail.com>
* Update Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs
Co-authored-by: Ac_K <Acoustik666@gmail.com>
* Fix formating and add missing stub
* Update ISystemSettingsServer.cs
* Update ISystemSettingsServer.cs
Co-authored-by: Ac_K <Acoustik666@gmail.com>
* Add background mode configuration to SoftwareKeyboardApplet
* Add placeholder text generator for Software Keyboard in background mode
* Add stub for GetIndirectLayerImageMap
* Fix default state of DecidedCancel response
* Add GUI text input to Software Keyboard in background mode
* Fix graphical glitch when Inline Software Keyboard appears
* Improve readability of InlineResponses class
* Improve code styling and fix compiler warnings
* Replace ServiceDisplay log class by ServiceVi
* Replace static readonly by const
* Add proper finalization to the keyboard applet in inline mode
* Rename constants to start with uppercase
* Fix inline keyboard not working with some games
* Improve code readability
* Fix code styling
* pctl: Stub IsFreeCommunicationAvailable
This PR stub call IsFreeCommunicationAvailable since it's the same as call CheckFreeCommunicationPermission without a sets of an internal field.
I've fixed a wrong logic found while I'm checked the call by RE.
This fix#1883.
* Fix comments
This PR fixes a regression introduced in #1741. The actual implementation do the assumption of fences always exist and then registering the callback.
Homebrews may not use fences, so the code crashes when it try to register the callback.
* Interrupt GPU command processing when a frame's fence is reached.
* Accumulate times rather than %s
* Accurate timer for vsync
Spin wait for the last .667ms of a frame. Avoids issues caused by signalling 16ms vsync. (periodic stutters in smo)
* Use event wait for better timing.
* Fix lazy wait
Windows doesn't seem to want to do 1ms consistently, so force a spin if we're less than 2ms.
* A bit more efficiency on frame waits.
Should now wait the remainder 0.6667 instead of 1.6667 sometimes (odd waits above 1ms are reliable, unlike 1ms waits)
* Better swap interval 0 solution
737 fps without breaking a sweat. Downside: Vsync can no longer be disabled on games that use the event heavily (link's awakening - which is ok since it breaks anyways)
* Fix comment.
* Address Comments.
* am/gui: Implement Wake-up message.
This implement the ability to send a Wake-up (Resume) message to the guest.
Sometime games needs to Sleep and Wake-up the switch to unlock some ingame features.
* Address gdkchan feedback
* Implement TreeMap from scratch.
Begin implementation of MemoryBlockManager
* Implement GetFreePosition using MemoryBlocks
* Implementation of Memory Management using a Tree.
Still some issues to work around, but promising thus far.
* Resolved invalid mapping issue.
Performance appears promising.
* Add tick metrics
* Use the logger instead
* Use debug loggin instead of info.
* Remove unnecessary code. Add descriptions of added functions.
* Improve memory allocation even further. As well as improve speed of position fetching.
* Add TreeDictionary to Ryujinx Commons
Removed Unnecessary Usigns
* Add a Performance Profiler + Improve ReserveFixed
* Begin transition to allocation in nvdrv
* Create singleton nvmemallocator
* Moved Allocation into Nv Related Files
As requested by gdkchan, any allocation of memory has been moved into the driver files.
Mapping remains in the GPU MemoryManager.
* Remove unnecessary usings
* Add missing descriptions
* Correct descriptions
* Fix formatting.
* Remove unnecessary whitespace
* Formatting / Convention Updates
* Changes / Fixes
Made syntax and convention changes as requested by gdkchan.
Fixed an issue where IsRegionUsed would return the wrong boolean.
Fixed an issue where GetFreePosition was asked for an address instead of a size.
* Undo commenting of Assert in shader cache
* Update Ryujinx.Common/Collections/TreeDictionary.cs
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* Resolved many suggestions
* Implement Improved TreeDictionary
Based off of Pseudo code and custom implementations.
* Rename _set to _dictionary
* Remove unused code
* Remove unused code.
* Remove unnecessary MapLow function.
* Resolve data-structure based issues
* Make adjustments to memory management.
Deactive de-allocation for now, it causes more harm than good.
* Minor refactorings + Re-implement deallocation
Also cleaned up unnecessary code.
* Add Tests for TreeDictionary
* Update data structure to properly balance the tree
* Experimental Implementation:
1. Reduce Time to Next Node to O(1) Runtime
2. Reduce While Loop Ct To 2 (In Most Cases)
* Address issues w/ Deallocating Memory
* Final Build
+ Fully Implement Dictionary Interface for new Data Structure
+ Cover All Memory Allocation Edge Cases, particularly w/ Games that De-Allocate a lot.
* Minor Corrections
Give TreeDictionary its own count (do not depend on inner dictionary)
Properly remove adjacent allocations
* Add AsList
* Fix bug where internal dictionary wasn't being updated w/ new node for overwritten key.
* Address comments in review.
* Fix issue where block wouldn't break out (Fixes UE4 issues)
* Update descriptions
* Update descriptions
* Reduce Node visibility to protect TreeDictionary Integrity + Remove usage of struct.
* Update tests to use new TreeDictionary implementation.
* Remove usage of dictionary in TreeDictionary
* Refactoring / Renaming
* Remove unneeded memoryblock class.
* Add space for while
* Add space for if
* Formatting / descriptions
* Clarified some descriptions
* Reduce visibility of memory allocator
* Edit method names to make more sense as memory blocks are no longer in use.
* Make names consistent.
* Protect against npe when sucessorof is called against keys that don't exist. (Not in use by memory manager, this is for other prs that might use this data structure)
* Possible edge-case resolve
* Update Ryujinx.Common/Collections/TreeDictionary.cs
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* Update Ryujinx.HLE/HOS/Services/Nv/NvMemoryAllocator.cs
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* Reduce # of unnecessary duplicate variables / Reduce visibility of variables only internally used.
* Rename count to _count
* Update Description of Add method.
* Fix copypasta
* Address comments
* Address comments
* Remove whitespace
* Address comments, condense variables.
* Consolidate vars
* Fix whitespace.
* Nit
* Fix exception msg
* Fix arrayIndex check
* Fix arrayIndex check + indexer
* Remove whitespace from cast
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* Rewrite scheduler context switch code
* Fix race in UnmapIpcRestorePermission
* Fix thread exit issue that could leave the scheduler in a invalid state
* Change context switch method to not wait on guest thread, remove spin wait, use SignalAndWait to pass control
* Remove multi-core setting (it is always on now)
* Re-enable assert
* Remove multicore from default config and schema
* Fix race in KTimeManager
This implement IApplicationFunctions GetHealthWarningDisappearedSystemEvent call which is needed by Mario Kart 8 in Chinese version. Call was checked by RE.
We still have to determine where to signals some AM events.
Thanks to Kakasita on our Discord to reported this and confirm this works fine!
* Make sure to not leak copy handles passed in request
Following last gdkchan's PR this make sure to close copy handles that
are passed by guest when it should.
* fix comment copy pasta
* IPC refactor part 2: Use ReplyAndReceive on HLE services and remove special handling from kernel
* Fix for applet transfer memory + some nits
* Keep handles if possible to avoid server handle table exhaustion
* Fix IPC ZeroFill bug
* am: Correctly implement CreateManagedDisplayLayer and implement CreateManagedDisplaySeparableLayer
CreateManagedDisplaySeparableLayer is requires since 10.x+ when appletResourceUserId != 0
* Make it exit properly
* Make ServiceNotImplementedException show the full message again
* Allow yielding execution to avoid starving other threads
* Only wait if active
* Merge IVirtualMemoryManager and IAddressSpaceManager
* Fix Ro loading data from the wrong process
Co-authored-by: Thog <me@thog.eu>
* audout: Implement GetAudioOutBufferCount, GetAudioOutPlayedSampleCount and FlushAudioOutBuffers
This PR implement audout service calls:
- GetAudioOutBufferCount
- GetAudioOutPlayedSampleCount
- FlushAudioOutBuffers
The RE calls just give some hints about no extra checks.
Since we use a totally different implementation because of our backend, I can't do something better for now.
SetAudioOutVolume and GetAudioOutVolume are fixed too by set/get the volume of the current opened track, previous implementation was wrong.
This fix#1133, fix#1258 and fix#1519.
Thanks to @jduncanator for this help during the implementation and all his precious advices.
* Fix some debug leftovers
* Address jD feedback
This PR fix an issue I've made in #1688 which is enabled VR as default.
It could cause rendering issues in games when VR mode isn't used, as users have reported in Smash:
* am/lbl/hid/pctl: Enabled VR Rendering
This PR enable VR rendering on games which support it through the Toy-Con VR Goggles.
Please remember Ryujinx currently don't support console SixAxis sensor and for now, in some games, the view can't be moved.
Everything is implemented accordingly to RE:
- am: ICommonStateGetter: SetVrModeEnabled, BeginVrModeEx, EndVrModeEx.
- lbl: ILblController: SetBrightnessReflectionDelayLevel, GetBrightnessReflectionDelayLevel, SetCurrentAmbientLightSensorMapping, GetCurrentAmbientLightSensorMapping, SetCurrentBrightnessSettingForVrMode, GetCurrentBrightnessSettingForVrMode, EnableVrMode, DisableVrMode, IsVrModeEnabled.
- pctl: IParentalControlService: ConfirmStereoVisionPermission, ConfirmStereoVisionRestrictionConfigurable, GetStereoVisionRestriction, SetStereoVisionRestriction, ResetConfirmedStereoVisionPermission, IsStereoVisionPermitted.
- hid: IHidServer: ResetSevenSixAxisSensorTimestamp is stubbed because we don't support console SixAxisSensor for now.
Maybe we could add a setting later to enable or disable VR. But I think it's fine to keep this always available since you have to enable it in games.
* Fix permission flag check
* Address gdkchan feedback
* apm: Refactoring/Unstub service
This PR implement some IPC calls of apm service:
- nn::apm::IManager is fully implemented.
- nn::apm::ISession is fully implemented (close#1633).
- nn::apm::ISystemManager is partially implemented.
nn::appletAE::ICommonStateGetter have some calls which are just a layer of apm IPC calls. What we did in some calls was wrong, it's fixed now!
Everything is checked with RE.
* abstract Apm *Server as Thog requested
* abstract ISession and fix other classes
* Address gdkchan feedback
* Fix class
* Fix Logging
* fix stalling when server is offline
* add retry timer to fail server connections, fix alt slot number
* fix alt slot key issue
* fix crash when saving controller config with empty fields
* code fixes
* add index check in motion hid update, made HandleResponse async
Co-authored-by: Emmanuel <nhv3@localhost.localdomain>
This fix a mistake I made during my original reimplementation of SurfaceFlinger by disabling async buffer.
This fix a memory corruption on Super Mario All-Stars 3D (Super Mario Sunshine & Super
Mario Galaxy now go ingame).
Thanks to @gdkchan for tracing the memory corruption.
* Return "NotAvailable" when no UserChannel data is present.
* Return ObjectInvalid for undefined parameter kinds.
* No need to specify which, there's only one.
* Just works as a literal string.
* Changes to allow explicit management of service threads
* Remove now unused code
* Remove ThreadCounter, its no longer needed
* Allow and use separate server per service, also fix exit issues
* New policy change: PTC version now uses PR number
* 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>
This project wasn't really used by anyone and isn't worth mantaining.
This commit remove the profiler entirely from Ryujinx and remove the associated CI tasks.
* Clean up and update readme
THis clean up and improve the README a bit.
* Apply suggestions from code review
Co-authored-by: EmulationFanatic <62343878+EmulationFanatic@users.noreply.github.com>
Co-authored-by: EmulationFanatic <62343878+EmulationFanatic@users.noreply.github.com>
* Initial commit
Enable proper LED patterns
Toggle Hotkeys only on focus
Ignore Handheld on Docked mode
Remove PrimaryController
Validate NpadIdType
Rewrite NpadDevices to process config in update loop
Cleanup
* Notify in log periodically when no matched controllers
* Remove duplicate StructArrayHelpers in favor of Common.Memory
Fix struct padding CS0169 warns in Touchscreen
* Remove GTK markup from Controller Applet
Use IList instead of List
Explicit list capacity in 1ms loop
Fix formatting
* Restrict ControllerWindow to show valid controller types
Add selected player name to ControllerWindow title
* ControllerWindow: Fix controller type initial value
NpadDevices: Simplify default battery charge
* Address AcK's comments
Use explicit types and fix formatting
* Remove HashSet for SupportedPlayers
Fixes potential exceptions due to race
* Fix ControllerSupportArg struct packing
Also comes with two revisions of struct for 4/8 players max.
* 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
Changes:
Implement software surround downmixing (fix#796).
Fix a crash when no audio renderer were created when stopping emulation.
NOTE: This PR also disable support of 5.1 surround on the OpenAL backend as we cannot detect if the hardware directly support it. (the downmixing applied by OpenAL on Windows is terribly slow)
* Amadeus: Final Act
This is my requiem, I present to you Amadeus, a complete reimplementation of the Audio Renderer!
This reimplementation is based on my reversing of every version of the audio system module that I carried for the past 10 months.
This supports every revision (at the time of writing REV1 to REV8 included) and all features proposed by the Audio Renderer on real hardware.
Because this component could be used outside an emulation context, and to avoid possible "inspirations" not crediting the project, I decided to license the Ryujinx.Audio.Renderer project under LGPLv3.
- FE3H voices in videos and chapter intro are not present.
- Games that use two audio renderer **at the same time** are probably going to have issues right now **until we rewrite the audio output interface** (Crash Team Racing is the only known game to use two renderer at the same time).
- Persona 5 Scrambler now goes ingame but audio is garbage. This is caused by the fact that the game engine is syncing audio and video in a really aggressive way. This will disappears the day this game run at full speed.
* Make timing more precise when sleeping on Windows
Improve precision to a 1ms resolution on Windows NT based OS.
This is used to avoid having totally erratic timings and unify all
Windows users to the same resolution.
NOTE: This is only active when emulation is running.
* 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 SwKbd GUI
* Relocate UI handler to Emu Context from Config
Also create a common interface for UI handlers in the context and specialize for Gtk
Add basic input length validation in InputDialog
* Add Transfer Memory support to AppletCreator
Read Initial Text for SwKbd using Transfer Memory
* Improve InputDialog widget
Improve length validation
Has extra label to show validition info
Handle potential errors and log them
* Misc improvements
* Improve string validation
* Improve error handling
* Remove tuple in struct
* Address formatting nits
* Add proper Cancel functionality
Also handle GUI errors in UI handler
* Address jD's comments
* Fix _uiHandler init
* Address AcK's comments
* friend: Implement GetPlayHistoryRegistrationKey
This implement IServiceCreator::GetPlayHistoryRegistrationKey call accordingly to RE.
Close#1110
* Fix comments
* Fix guid and comment some codes
* Improve guid casting and remove unused vars
* ns/nim: Stub eShop related calls
As we aren't able to process purchase on the eShop throught the emulator, I have:
- Stub IPurchaseEventManager::SetDefaultDeliveryTarget (with RE check).
- Implement IPurchaseEventManager::GetPurchasedEventReadableHandle (with RE check).
As we can't do any eShop async call throught the emulator, I have:
- Stub IShopServiceAccessServerInterface::CreateServerInterface
- Stub IShopServiceAccessServer::CreateAccessorInterface
- Stub IShopServiceAccessor::IShopServiceAsync
Close#1084 and #1322
* fix handle copy
* Fix align
* Fix readonly event
* Add new structures from official docs, start migrating GPFifo
* Finish migration to new GPFifo processor
* Implement fast constant buffer data upload
* Migrate to new GPFifo class
* XML docs
This implement GetIndirectLayerImageRequiredMemoryInfo call from vi service, accordingly to RE.
Thanks to Thog and gdkchan for helping me to understand some GPU things.
Close#942
* Add multiple calls to am service
This implement/stub some am calls:
- SetAutoSleepDisabled
- IsAutoSleepDisabled
- SetAlbumImageTakenNotificationEnabled
- EnableApplicationCrashReport
- GetPreviousProgramIndex
- NeedsToExitProcess
- RequestForAppletToGetForeground
- GetIndirectLayerConsumerHandle
All checked by RE.
Additionnaly to that, there is some cleanup here and there.
Fix#1387, #1324, #1165, #1163, #1065
* Fix casting
* Thread safe assign
* Initial NVDEC and VIC implementation
* Update FFmpeg.AutoGen to 4.3.0
* Add nvdec dependencies for Windows
* Unify some VP9 structures
* Rename VP9 structure fields
* Improvements to Video API
* XML docs for Common.Memory
* Remove now unused or redundant overloads from MemoryAccessor
* NVDEC UV surface read/write scalar paths
* Add FIXME comments about hacky things/stuff that will need to be fixed in the future
* Cleaned up VP9 memory allocation
* Remove some debug logs
* Rename some VP9 structs
* Remove unused struct
* No need to compile Ryujinx.Graphics.Host1x with unsafe anymore
* Name AsyncWorkQueue threads to make debugging easier
* Make Vp9PictureInfo a ref struct
* LayoutConverter no longer needs the depth argument (broken by rebase)
* Pooling of VP9 buffers, plus fix a memory leak on VP9
* Really wish VS could rename projects properly...
* Address feedback
* Remove using
* Catch OperationCanceledException
* Add licensing informations
* Add THIRDPARTY.md to release too
Co-authored-by: Thog <me@thog.eu>
* 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
* prepo: Update implementation for 10.x changes
On 10.x, Nintendo changed yet another time the prepo SaveReport &
SaveReportWithUser command ids.
This PR add support for command 10104 & 10105 and update naming of the
old variants to match switchbrew.
* Fix misalign and remove a ToString
* Address jD's comment
* Fix compilation warnings and use new LibHac APIs for executable loading
* Migrate NSO loader to the new reader and fix kip loader
* Fix CS0162 restore
* Remove extra return lines
* Address Moose's comment
* 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
* Stubbed ImportServerPki
* thought it might be nice to name this variable properly
* i really need to name variables better
* Change Var
Co-authored-by: Thog <thog@protonmail.com>
* Change .ReadBytes(5) to IPC send buffer
Co-authored-by: Thog <thog@protonmail.com>
* Add description comment
Co-authored-by: Thog <thog@protonmail.com>
* fix build issue
* Resolve final suggestion
Co-authored-by: Thog <thog@protonmail.com>
* uhh
* it should work now shut up
* aligned variables just look so much nicer :)
* better variable alignment
* aligned
Co-authored-by: Thog <thog@protonmail.com>
* SurfaceFlinger: fix some bugs
This fixes some bugs in the current implementation and make it closer to
the real implementation.
* Fix align of some variables
* pctl: refactoring IParentalControlServiceFactory and IParentalControlService call
Our previous implementation was totally guessed. Now it's implemented according to RE, even if it's stubbed because we will not support Parental Control for now.
* unknownFlag > permissionFlag
* nvdrv: Partially implementation of GetStatus
This implement GetStatus call according to RE.
Since we don't handle tranfert memory on the initialize of the service, it's fine sets fields at 0 for now.
Tested on Undertale.
Fix#635
* Fix struct
The error code was taken from Switchbrew (https://switchbrew.org/wiki/Error_codes)
Even if TimeServiceNotInitialized's "description" is 0, the result "value" of "(0 << ErrorCodeShift) | ModuleId" is 0x74 so it is not the same as "Success" (0)
* am: Implement GetFriendInvitationStorageChannelEvent
This implement GetFriendInvitationStorageChannelEvent according to RE, needed by Streets of Rage 4
* Fix handle name
* add GetNotificationStorageChannelEvent
* Add two error codes to Mii
The two errors added are InvalidDatabaseSignatureValue and InvalidDatabaseEntryCount, which were taken from Switchbrew (https://switchbrew.org/wiki/Error_codes)
* Fix typo
* Remove unnecessary empty line
* Add various result codes to Loader
The error codes were taken from Switchbrew (switchbrew.org/wiki/Error_codes)
For the last 9 errors, Switchbrew says: ACID/ACI0 don't match for descriptor (descriptor)
* Fix typo
* 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
* Add various error codes to BCAT
The error codes were taken from Switchbrew (switchbrew.org/wiki/Error_codes)
As for InternetRequestDenied, it seems that this error is common for multiple services like Account for example
I already added this error code in Account in PR #1182
* Add some results codes from Libhac and keep names consistent
* nvservice: add a lock to NvHostEvent
* Disable surface flinger release fence and readd infinite timeout
* FenceAction: Add a timeout of 1 seconds as this shouldn't wait forever anyuway
* surfaceflinger: remove leftovers from the release fence
* Don't allow infinite timeout on syncpoint while printing all timeout for better debugging
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."
* nvservices: mitigate abort with heavy load on the GPU processing thread.
This should fix Mario Tennis and LM3 regressions with syncpoints.
NOTE: Mario Tennis seems to have another issue related to the texture
cache that happens randomly when starting a match.
PS: Also add a debug logger for all known ioctl call to facilitate
debugging and add a missing UpdateMin in EventSignal.
* Address LDj3SNuD's comment
* Address gdkchan's comment
This implement the rendering information output informations of
RequestUpdate.
This is needed by some games to keep track of the count of update on the
DSP.
* Add support for dynamic docking/undocking
As SurfaceFlinger is now working more accurately, we can now support
dynamic configuration of docking mode :)
* Simplify a bt the code
* Fix import ordering
* Remove unused argument
This invalidate the GraphicBuffer on the consumer side when
SetPreallocatedBuffer is called on a buffer slot.
This fix rendering issues on games with a dynamic resolution like Yoshi
Crafted World.
* Rewrite SurfaceFlinger
Reimplement accurately SurfaceFlinger (based on my 8.1.0 reversing of it)
TODO: support swap interval properly and reintroduce disabled "game vsync" support.
* Some fixes for SetBufferCount
* uncomment a test from last commit
* SurfaceFlinger: don't free the graphic buffer in SetBufferCount
* SurfaceFlinger: Implement swap interval correctly
* SurfaceFlinger: Reintegrate Game VSync toggle
* SurfaceFlinger: do not push a fence on buffer release on the consumer side
* Revert "SurfaceFlinger: do not push a fence on buffer release on the consumer side"
This reverts commit 586b52b0bfab2d11f361f4b59ab7b7141020bbad.
* Make the game vsync toggle work dynamically again
* Unregister producer's Binder object when closing layer
* Address ripinperi's comments
* Add a timeout on syncpoint wait operation
Syncpoint aren't supposed to be waited on for more than a second.
This effectively workaround issues caused by not having a channel
scheduling in place yet.
PS: Also introduce Android WaitForever warning about fence being not
signaled for 3s
* Fix a print of previous commit
* Address Ac_K's comments
* Address gdkchan's comments
* Address final comments
* Implement GPU syncpoints
This adds support for GPU syncpoints on the GPU backend & nvservices.
Everything that was implemented here is based on my researches,
hardware testing of the GM20B and reversing of nvservices (8.1.0).
Thanks to @fincs for the informations about some behaviours of the pusher
and for the initial informations about syncpoints.
* syncpoint: address gdkchan's comments
* Add some missing logic to handle SubmitGpfifo correctly
* Handle the NV event API correctly
* evnt => hostEvent
* Finish addressing gdkchan's comments
* nvservices: write the output buffer even when an error is returned
* dma pusher: Implemnet prefetch barrier
lso fix when the commands should be prefetch.
* Partially fix prefetch barrier
* Add a missing syncpoint check in QueryEvent of NvHostSyncPt
* Address Ac_K's comments and fix GetSyncpoint for ChannelResourcePolicy == Channel
* fix SyncptWait & SyncptWaitEx cmds logic
* Address ripinperi's comments
* Address gdkchan's comments
* Move user event management to the control channel
* Fix mm implementation, nvdec works again
* Address ripinperi's comments
* Address gdkchan's comments
* Implement nvhost-ctrl close accurately + make nvservices dispose channels when stopping the emulator
* Fix typo in MultiMediaOperationType
* Use libhac for loading NSOs and KIPs
* Fix formatting
* Refactor KIP and NSO executables for libhac
* Fix up formatting
* Remove Ryujinx.HLE.Loaders.Compression
* Remove reference to Ryujinx.HLE.Loaders.Compression in NxStaticObject.cs
* Remove reference to Ryujinx.HLE.Loaders.Compression in KernelInitialProcess.cs
* Rename classes in Ryujinx.HLE.Loaders.Executables
* Fix space alignment
* Fix up formatting
* Delete old HLE.Input
* Add new HLE Input.
git shows Hid.cs as modified because of the same name. It is new.
* Change HID Service
* Change Ryujinx UI to reflect new Input
* Add basic ControllerApplet
* Add DebugPad
Should fix Kirby Star Allies
* Address Ac_K's comments
* Moved all of HLE.Input to Services.Hid
* Separated all structs and enums each to a file
* Removed vars
* Made some naming changes to align with switchbrew
* Added official joycon colors
As an aside, fixed a mistake in touchscreen headers and added checks to
important SharedMem structs at init time.
* Further address Ac_K's comments
* Addressed gdkchan's and some more Ac_K's comments
* Address AcK's review comments
* Address AcK's second review comments
* Replace missed Marshal.SizeOf and address gdkchan's comments
* 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
* prepo: Implement RequestImmediateTransmission and GetTransmissionStatus
This implement RequestImmediateTransmission and GetTransmissionStatus of the prepo service accurately to RE.
Since we don't use reports, I've explained what the calls do in the real service.
Close#958
* fix comment
It seems MsgPack.Cli incorrectly converts some unicode control characters directly to JSON literal Unicode strings (eg. '\1'). As these are invalid, pretty printing the JSON report fails.
This removes pretty printing, pending a proper implementation, and tidies up MsgPack deserialization.
This implement `GetRegionCode` accordingly to RE. I've added a setting in the GUI and a field in the Configuration file with a way to update the Configuration file if needed.
REV8 only added changes on performance buffer and wavebuffer dsp command
generation.
As we don't support any of those, we can just increment the revision
number for now.
* Implement some calls of ISelfController
This PR implement some calls of ISelfController:
- EnterFatalSection
- LeaveFatalSection
- GetAccumulatedSuspendedTickValue (close#937)
According to RE of the 8.1.0 am service.
* thread safe increment/decrement
* Fix thread safe
* remove unused using
* 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>
* Implement GetCurrentIpConfigInfo
This is needed by Rocket League.
Also fix GetCurrentIpConfigInfo to not return ipv6 addresses
* Address Ac_K comment
* Stub the application copyright framebuffer api
As we currently don't support multi layers on vi/nvnflinger, this PR
implement a stub of this API.
* Address Cyuubi's comments
* Add IPC checks and comments for future reversing
Co-authored-by: Ac_K <Acoustik666@gmail.com>
Co-authored-by: Ac_K <Acoustik666@gmail.com>
* Implement IDeliveryCacheProgressService in bcat
This stub IDeliveryCacheProgressService IPC interface as we don't plan
to support cache delivery.
* Address jd's comments
* Address jd's comment correctly
* Address gdk's comments