* Start refactoring kernel a bit and import some changes from kernel decoupling PR
* kernel: Put output always at the start in Syscall functions
* kernel: Rewrite GetThreadContext3 to use a structure and to be accurate
* kernel: make KernelTransfer use generic types and simplify
* Fix some warning and do not use getters on MemoryInfo
* Address gdkchan's comment
* GetThreadContext3: use correct pause flag
* 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>
* bsd: Revamp API and make socket abstract
This part of the code was really ancient and needed some love.
As such this commit aims at separating the socket core logic from the IClient class and make it uses more modern APIs to read/write/parse data.
* Address gdkchan's comment
* Move TryConvertSocketOption to WinSockHelper
* Allow reusing old fds and add missing locks around SocketInternal and ShutdownAllSockets
* bsd: ton of changes
- Make sockets per process
- Implement eventfds
- Rework Poll for support of eventfds
- Handle protocol auto selection by type (used by gRPC)
- Handle IPv6 socket creation
* Address most of gdkchan comments
* Fix inverted read logic for BSD socket read
* bsd: Make Poll abstract via IBsdSocketPollManager
* bsd: Improve naming of everything
* Fix build issue from last commit (missed to save on VC)
* Switch BsdContext registry to a concurrent dictionary
* bsd: Implement socket creation flags logic and the non blocking flag
* Remove unused enum from previous commit
* bsd: Fix poll logic when 0 fds are present for a given poll manager and when timeout is very small (or 0)
* Address gdkchan's comment
* friend: Stub IsFriendListCacheAvailable and EnsureFriendListAvailable
This PR stubs IsFriendListCacheAvailable and EnsureFriendListAvailable call of friend service which close#2896.
Sadly, Super Bomberman R Online is still stuck on the loading screen and keep calling `TryPopFromFriendInvitationStorageChannel`, probably because another issue somewhere.
* Add FW version
* Apply suggestions from gdkchan
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* Update IFriendService.cs
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
This PR stub `SetMediaPlaybackStateForApplication` of the am service. Accordingly to gdkchan it's needed by the Youtube app. This is checked by RE aswell.
While I'm looking to the code, I've found some syntax issue, and a little inconsistencie between `ActivateNpad` and `ActivateNpadWithRevision`. Nothing more.
* Add the ability to toggle mute in the status bar.
* Add the ability to toggle mute in the status bar.
* Formatting fixes
* Add hotkey (F2) to mute
* Add default hotkey to config.json
* Add ability to change volume via slider.
* Fix Headless
* Fix SDL2 Problem : Credits to d3xMachina
* Remove unnecessary work
* Address gdk comments
* Toggling with Hotkey now properly restores volume to original level.
* Toggling with Hotkey now properly restores volume to original level.
* Update UI to show Volume % instead of Muted/Unmuted
* Clean up the volume ui a bit.
* Undo unintentionally committed code.
* Implement AudRen Support
* Restore intiial volume level in function definition.
* Finalize UI
* Finalize UI
* Use clamp for bounds check
* Use Math.Clamp for volume in soundio
* Address comments by gdkchan
* Address remaining comments
* Fix missing semicolon
* Address remaining gdkchan comment
* Fix comment
* Change /* to //
* Allow volume slider to change volume immediately.
Also force label text to cast to int to prevent decimals from showing in status bar
* Remove blank line
* Undo setting of volume level when "Cancel" is pressed.
* Fix allignment for settings window code
The .NET 6 changes ended up causing a difference in the way we deserialise and would end up deserializing wrongly.
This commit fixes it by resoring previous behaviour while still fixing the illink warning that caused that change in the first place
* infra: Migrate to .NET 6
* Rollback version naming change
* Workaround .NET 6 ZipArchive API issues
* ci: Switch to VS 2022 for AppVeyor
CI is now ready for .NET 6
* Suppress WebClient warning in DoUpdateWithMultipleThreads
* Attempt to workaround System.Drawing.Common changes on 6.0.0
* Change keyboard rendering from System.Drawing to ImageSharp
* Make the software keyboard renderer multithreaded
* Bump ImageSharp version to 1.0.4 to fix a bug in Image.Load
* Add fallback fonts to the keyboard renderer
* Fix warnings
* Address caian's comment
* Clean up linux workaround as it's uneeded now
* Update readme
Co-authored-by: Caian Benedicto <caianbene@gmail.com>
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:
* Remove comment from code.
* Added needed RegisterInfo for TODO.
* Forgot to add two words...
* Stop being tired and fixed the one issue.
* Removing suggested line from GDKchan.
* GDK seems to have been incorrect?
* Update Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* Remove a bit of unsafety around
* Regenerate StructArrayHelpers with a max element value of 256
* hle: remove unsafe marker from all struct that had it
* hle: make SoftwareKeyboardRenderer.TryCopyTo safe
* hle: remove unsafety in NpadDevice and remove AllowUnsafeBlocks from csproj
* Revert "Regenerate StructArrayHelpers with a max element value of 256"
This reverts commit f32a6e5be0.
* Introduce ByteArray of various size and use that instead of ArrayXXX to avoid stackoverflow in .NET runtime type resolution
* Use ByteArray more
* Add some missing spaces on Pack = 1 for various structs
* Fix broken logic for TryCopyTo
* Address gdkchan's comment
* Address gdkchan's comment
* 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
* Fixup channel submit IOCTL syncpoint parameters
The current arguments worked by happenstance as games only ever submit
one syncpoint and request one fence back, if a game were to do something
other than this then the arguments would've been parsed entirely wrong.
* Address feedback
* Fix race when EventWait is called and a wait is done on the CPU
* This is useless now
* Fix EventSignal
* Ensure the signal belongs to the current fence, to avoid stale signals
It seems that certain games (Link's Awakening, Xenoblade DE) had their fences reached already when posting framebuffers, so the signal that a frame was ready would go out _before_ the frame was enqueued, and the render loop would fail to dequeue anything and "skip" a frame.
This was resulting in their performance lowering dramatically after some loading transitions, as a frame signal would be consumed and presentation would be one frame behind.
It's possible this might have eventually caused deadlocks in these games or others, if it happened twice.
* spl: Implement IGeneralInterface GetConfig
This PR implement the GetConfig call of the spl service. This is currently needed for some homebrews which currently needs Ignore Missing Service to boot. Now it's fixed.
Implementation was done using Atmosphère code and REing too.
* Addresses gdkchan feedback
This PR stubs and implements some clkrst call because they are used to overclock the Switch hardware and it's pointless in our case as we emulate the system.
Everything was done checked by RE.
Fixes#2686
This PR stubs some irs service calls which are needed to get some games playable or at least bootable since we don't support IR data throught real JoyCon for now.
- Stubs `IIrSensorServer` `StopImageProcessor`, `RunMomentProcessor`, `RunClusteringProcessor`, `RunImageTransferProcessor`, `GetImageTransferProcessorState`, `RunTeraPluginProcessor`. All calls are a bit checked by RE.
Closes#2267, #2248, #2126
Night Vision and SpyAlarm are now bootable (but still unplayable due to the lack of the IR data):
* vi: Unify resolutions values and accurate implementation of them.
To continue what was made in #2618, I've REd `vi` service a bit. Now values and checks related to displays are more accurate.
- `am` GetDefaultDisplayResolution / GetDefaultDisplayResolutionChangeEvent have more informations on what the service does.
- `vi:u/vi:m/vi:s` GetDisplayService are now accurate.
- `IApplicationDisplay` GetRelayService, GetSystemDisplayService, GetManagerDisplayService, GetIndirectDisplayTransactionService, ListDisplays, OpenDisplay, OpenDefaultDisplay, CloseDisplay, GetDisplayResolution are now properly implemented.
- Some other calls are cleaned or have extra checks accordingly to RE.
Additionnaly, `IFriendService` have some wrong aligned things, and `pm:info` service placeholder was missing.
* just use _openedDisplayInfo.Remove()
* use context.Memory.Fill()
* fix some casting
* remove unneeded comment
* cleanup
* uses TryAdd
* displayId > ulong
* GetDisplayResolution > ulong
* UL
* 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
* hle: Simplify ServiceNotImplementedException
This removes the need to pass in whether the command is a Tipc command or a Hipc command to the exception constructor.
* hle: Use the IPC Message type to determine command type
This allows differentiating between Tipc and Hipc commands when invoking a handler that supports handling both Tipc and Hipc commands.
* First working vibration implementation
* Fix Infinite Rumble in SDL2Mouse
* Stop ignoring one vibValues every 2
* Remove RumbleInfinity as suggested
* Reworked all the vibration handle / calculation
* Revert HidVibrationDevicePosition changes
* Add UI to enable and tune rumble
* Remove some stub logs
* Add PlayerIndex in rumble debug log
* Fix all requested changes
* Implements hid::GetVibrationDeviceInfo
* Better implements HidVibrationValue.Equals/GetHashCode
* Added requested changes from code review
* Last fixes from review
* Update configuration file version for rebase
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.
* 3D engine now uses DeviceState too, plus new state modification tracking
* Remove old methods code
* Remove GpuState and friends
* Optimize DeviceState, force inline some functions
* This change was not supposed to go in
* Proper channel initialization
* Optimize state read/write methods even more
* Fix debug build
* Do not dirty state if the write is redundant
* The YControl register should dirty either the viewport or front face state too, to update the host origin
* Avoid redundant vertex buffer updates
* Move state and get rid of the Ryujinx.Graphics.Gpu.State namespace
* Comments and nits
* Fix rebase
* PR feedback
* Move changed = false to improve codegen
* PR feedback
* Carry RyuJIT a bit more
This PR implement `CreateApplicationAndRequestToStart` call, result code is checked by RE.
Now we can restart a guest program by itself. This is needed by SSBU when you changes the game language.
NOTE: This currently don't works using OpenAL backend due to another issue.
Closes#2108
For a strange reason `IPInterfaceProperties.IsDynamicDnsEnabled` returns a `PlatformNotSupported` exception in Linux.
This PR fixes this issue with a `try/catch` and set the value to false. Closes#2415.
* aoc: Fixes some inconsistencies
This PR fixes an wrong returned value (introduced in #2414) which cause some DLC not recognized in some games like Super Robot War T.
Additionnally to that, I've removed the EventHandle check too, because it could cause some issues, but sadly it doesn't do the job so I reverted the changes. It should fix Diablo III: Eternal Collection.
* Fix loop
* Revert TitleLanguage change
* write only available ids
* Make GPU memory manager a member of GPU channel
* Move physical memory instance to the memory manager, and the caches to the physical memory
* PR feedback
* 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>