Commit graph

490 commits

Author SHA1 Message Date
VocalFan
02d786a086
Nickname! - Init Amiibos with Profile's name! (#2804)
* 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>
2021-11-15 20:03:17 -03:00
gdkchan
81e9b86cdb
Ensure syncpoints are released and event handles closed on channel close (#2812) 2021-11-04 20:27:21 -03:00
Mary
f41687f4c1
hle: Make Ryujinx.HLE project entirely safe (#2789)
* 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
2021-11-01 19:38:13 -03:00
gdkchan
e48530e9d9
When waiting on CPU, do not return a time out error from EventWait (#2780)
* When waiting on CPU, do not return a time out error from EventWait

* And while I'm at it...
2021-11-01 19:10:02 -03:00
gdkchan
a7a40a77f2
Add support for the brazilian portuguese language code (#2792)
* Add support for the brazilian portuguese language code

* Fix error applet message
2021-10-28 23:06:45 +02:00
Mary
5c66a36ed6
kernel: Fix inverted condition on permission check of SetMemoryPermission syscall (#2777)
* kernel: Fix inverted condition on permission check of SetMemoryPermission syscall

* Fix condition for real..
2021-10-24 20:00:31 -03:00
Mary
51fa1b2cb0
hle: Improve safety (#2778)
* timezone: Make timezone implementation safe

* hle: Do not use TrimEnd to parse ASCII strings

This adds an util that handle reading an ASCII string in a safe way.
Previously it was possible to read malformed data that could cause
various undefined behaviours in multiple services.

* hid: Remove an useless unsafe modifier on keyboard update

* Address gdkchan's comment

* Address gdkchan's comment
2021-10-24 19:13:20 -03:00
Mary
b4dc33efc2
kernel: Clear pages allocated with SetHeapSize (#2776)
* kernel: Clear pages allocated with SetHeapSize

Before this commit, all new pages allocated by SetHeapSize were not
cleared by the kernel.

This would cause undefined data to be pass to the userland and possibly
resulting in weird memory corruption.

This commit also add support for custom fill heap and ipc value (that is also
supported by the official kernel)

* Remove dots at the end of KPageTableBase.MapPages new documentation

* Remove unused _stackFillValue
2021-10-24 18:52:59 -03:00
Billy Laws
8c4e4ab3b3
Fixup channel submit IOCTL syncpoint parameters (#2774)
* 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
2021-10-24 18:34:44 -03:00
Mary
dc837c0042
kernel: Add resource limit related syscalls (#2773)
* kernel: Add resource limit related syscalls

This commit implements all resource limit related syscalls.

* Fix register mapping being wrong for SetResourceLimitLimitValue

* Address gdkchan's comment
2021-10-24 01:40:13 +02:00
Mary
c94d47cc40
kernel: Implement SetMemoryPermission syscall (#2772)
* kernel: Implement SetMemoryPermission syscall

This commit implement the SetMemoryPermission syscall accurately.
This also fix KMemoryPermission not being an unsigned 32 bits type and
add the "DontCare" bit (used by shared memory, currently unused in
Ryujinx)

* Update MemoryPermission mask

* Address gdkchan's comments

* Fix a nit

* Address gdkchan's comment
2021-10-24 01:24:49 +02:00
Mary
e7e65ccbc9
kernel: Add missing address space check in SetMemoryAttribute syscall (#2771) 2021-10-24 01:07:41 +02:00
gdkchan
0d174cbd45
EventWait should not signal the event when it returns Success (#2739)
* 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
2021-10-19 17:25:32 -03:00
Caian Benedicto
1b81653478
Fix regression with foreground software keyboard (#2732) 2021-10-13 12:20:48 -03:00
riperiperi
a2c6cd5132
Enqueue frame before signalling the frame is ready. (#2722)
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.
2021-10-12 23:29:50 +02:00
Ac_K
0510fde25a
spl: Implement IGeneralInterface GetConfig (#2705)
* 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
2021-10-12 22:15:55 +02:00
Caian Benedicto
380b95bc59
Inline software keyboard without input pop up dialog (#2180)
* Initial implementation

* Refactor dynamic text input keys out to facilitate configuration via UI

* Fix code styling

* Add per applet indirect layer handles

* Remove static functions from SoftwareKeyboardRenderer

* Remove inline keyboard reset delay

* Remove inline keyboard V2 responses

* Add inline keyboard soft-lock recovering

* Add comments

* Forward accept and cancel key names to the keyboard and add soft-lock prevention line

* Add dummy window to handle paste events

* Rework inline keyboard state machine and graphics

* Implement IHostUiHandler interfaces on headless WindowBase class

* Add inline keyboard assets

* Fix coding style

* Fix coding style

* Change mode cycling shortcut to F6

* Fix invalid calc size error in games using extended calc

* Remove unnecessary namespaces
2021-10-12 21:54:21 +02:00
gdkchan
11b437eafc
Fix DisplayInfo struct (#2708) 2021-10-05 12:38:44 -03:00
Ac_K
33dc4c9ce4
clkrst: Stub/Implement IClkrstManager and IClkrstSession calls (#2692)
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
2021-09-29 01:03:35 +02:00
gdkchan
f4f496cb48
NVDEC (H264): Use separate contexts per channel and decode frames in DTS order (#2671)
* Use separate NVDEC contexts per channel (for FFMPEG)

* Remove NVDEC -> VIC frame override hack

* Add missing bottom_field_pic_order_in_frame_present_flag

* Make FFMPEG logging static

* nit: Remove empty lines

* New FFMPEG decoding approach -- call h264_decode_frame directly, trim surface cache to reduce memory usage

* Fix case

* Silence warnings

* PR feedback

* Per-decoder rather than per-codec ownership of surfaces on the cache
2021-09-29 00:43:40 +02:00
Ac_K
79c854dd2e
irs: Stub some service calls (#2665)
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):
2021-09-29 00:10:10 +02:00
Mary
32c09af71a amadeus: Fix regression from #2654 on ListAudioDeviceName 2021-09-19 13:42:16 +02:00
Ac_K
40d1acd198
vi: Unify resolutions values and accurate implementation of them. (#2640)
* 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
2021-09-19 12:57:39 +02:00
Mary
e17eb7bfaf
amadeus: Update to REV10 (#2654)
* amadeus: Update to REV10

This implements all the changes made with REV10 on 13.0.0.

* Address Ack's comment

* Address gdkchan's comment
2021-09-19 12:29:19 +02:00
mpnico
fe9d5a1981
Fix problems added by Pause (#2645)
* Disable Pause/Resume menu instead of trying to hide them

* Fix Resume menu being active before renderer starts

* Fix emulator not being able to close properly
2021-09-18 14:31:44 +02:00
Ac_K
5d08e9b495
hos: Cleanup the project (#2634)
* hos: Cleanup the project

Since a lot of changes has been done on the HOS project, there are some leftover here and there, or class just used in one service, things at wrong places, and more.
This PR fixes that, additionnally to that, I've realigned some vars because I though it make the code more readable.

* Address gdkchan feedback

* addresses Thog feedback

* Revert ElfSymbol
2021-09-15 01:24:49 +02:00
gdkchan
016fc64b3d
Implement GetVaRegions on nvservices (#2621)
* Implement GetVaRegions on nvservices

* This would just result in 0
2021-09-11 22:39:02 +02:00
gdkchan
a4089fc878
Report 1080p resolution when in docked mode (#2618) 2021-09-11 22:24:10 +02:00
mpnico
117e32a6ff
Implement a "Pause Emulation" option & hotkey (#2428)
* Add a "Pause Emulation" option and hotkey

Closes Ryujinx#1604

* Refactoring how pause is handled

* Applied suggested changes from review

* Applied suggested fixes

* Pass correct suspend type to threads for suspend/resume

* Fix NRE after stoping emulation

* Removing SimulateWakeUpMessage call after resuming emulation

* Skip suspending non game process

* Pause the tickCounter in the ExecutionContext

* Refactoring tickCounter pause/resume as suggested

* Fix Config migration to add pause hotkey

* Fixed pausing only application threads

* Fix exiting emulator while paused

* Avoid pause/resume while already paused/resumed

* Cleanup unused code

* Avoid restarting audio if stopping emulation while in pause.

* Added suggested changes

* Fix ConfigurationState
2021-09-11 22:08:25 +02:00
Alex Barney
32cad88cc6
Bugfix LibHac update to 0.13.3 and remove SD card workaround (#2579) 2021-08-26 23:18:49 +02:00
Alex Barney
5e99bff7de
Ignore exceptions when cleaning the SD card saves (#2576) 2021-08-21 01:03:17 +02:00
Alex Barney
e0af248e6f
Clean the SD card save directory when opening the emulator (#2564)
Cleans "sdcard:/Nintendo/save" and deletes "sdcard:/save" when opening the emulator.

Works around invalid encryption when keys or the SD card encryption seed are changed.
2021-08-20 13:36:14 -07:00
Alex Barney
dadc0e59da
Update to LibHac 0.13.1 (#2475)
* Update to LibHac 0.13.1

* Recreate directories for indexed saves if they're missing on emulator start
2021-08-12 23:56:24 +02:00
jduncanator
b5b7e23fc4
hle: Tidy-up ServiceNotImplementedException (#2535)
* 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.
2021-08-11 21:16:42 +02:00
mpnico
70f79e689b
Implement vibrations (#2468)
* 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
2021-08-05 00:39:40 +02:00
Caian Benedicto
ff8849671a
Update TamperMachine and disable write-to-code prevention (#2506)
* Enable write to memory and improve logging

* Update tamper machine opcodes and improve reporting

* Add Else support

* Add missing private statement
2021-08-04 22:05:17 +02:00
emmauss
8c7986eb58
Ensure right joycon motion data is set (#2488)
* motion fix

* mirror motion data on right joycon in pair mode when using native motion source

* fix

* addressed comments
2021-07-24 01:01:36 +02:00
gdkchan
9d688e37d6
Close transfer memory properly on nvservices (#2477) 2021-07-14 14:09:00 -03:00
Mary
208ba1dde2 Revert LibHac update
Users are facing save destruction on failing extra data update apparently
2021-07-13 16:48:54 +02:00
Alex Barney
19afb3209c
Update to LibHac 0.13.1 (#2328)
Update the LibHac dependency to version 0.13.1. This brings a ton of improvements and changes such as:
- Refactor `FsSrv` to match the official refactoring done in FS.
- Change how the `Horizon` and `HorizonClient` classes are handled. Each client created represents a different process with its own process ID and client state.
- Add FS access control to handle permissions for FS service method calls.
- Add FS program registry to keep track of the program ID, location and permissions of each process.
- Add FS program index map info manager to track the program IDs and indexes of multi-application programs.
- Add all FS IPC interfaces.
- Rewrite `Fs.Fsa` code to be more accurate.
- Rewrite a lot of `FsSrv` code to be more accurate.
- Extend directory save data to store `SaveDataExtraData`
- Extend directory save data to lock the save directory to allow only one accessor at a time.
- Improve waiting and retrying when encountering access issues in `LocalFileSystem` and `DirectorySaveDataFileSystem`.
- More `IFileSystemProxy` methods should work now.
- Probably a bunch more stuff.

On the Ryujinx side:
- Forward most `IFileSystemProxy` methods to LibHac.
- Register programs and program index map info when launching an application.
- Remove hacks and workarounds for missing LibHac functionality.
- Recreate missing save data extra data found on emulator startup.
- Create system save data that wasn't indexed correctly on an older LibHac version.

`FsSrv` now enforces access control for each process. When a process tries to open a save data file system, FS reads the save's extra data to determine who the save owner is and if the caller has permission to open the save data. Previously-created save data did not have extra data created when the save was created.
With access control checks in place, this means that processes with no permissions (most games) wouldn't be able to access their own save data. The extra data can be partially created from data in the save data indexer, which should be enough for access control purposes.
2021-07-13 01:19:28 -07:00
gdkchan
40b21cc3c4
Separate GPU engines (part 2/2) (#2440)
* 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
2021-07-11 17:20:40 -03:00
gdkchan
b5190f1681
Fix virtual memory allocation being out of range (#2464) 2021-07-11 16:24:31 -03:00
Ac_K
0d841c8d51
am: Implement CreateApplicationAndRequestToStart (#2448)
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
2021-07-10 23:37:29 +02:00
Ac_K
242e51c7f5
nifm: Fixes IsDynamicDnsEnabled not supported (#2443)
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.
2021-07-06 20:41:11 +02:00
Ac_K
b72f7de405
aoc: Fixes some inconsistencies (#2434)
* 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
2021-07-06 20:17:06 +02:00
Billy Laws
ddb8351375
Implement 12.0.0 hwopus functions (#2410)
Based off of my RE of 12.0.2 audio services, the newly added parameter can be safely ignored due to ryu not using fixed-size I/O buffers.
2021-07-06 19:49:51 +02:00
Ac_K
f4078ae267
aoc: Fix wrong check (#2427)
This PR fixes a wrong check added in #2414 which made Pokémon crash.
2021-06-29 22:52:17 +02:00
Mary
00ce9eea62
Fix disposing of IPC sessions server at emulation stop (#2334) 2021-06-29 19:37:13 +02:00
gdkchan
fbb4019ed5
Initial support for separate GPU address spaces (#2394)
* 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
2021-06-29 19:32:02 +02:00
Ac_K
8cc872fb60
aoc/am: Cleanup aoc service and stub am calls (#2414)
* 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
2021-06-29 18:57:06 +02:00