Commit graph

2116 commits

Author SHA1 Message Date
Alex Barney
cc886af461 Always use an all-zeros key for AES-XTS file systems (#2561) 2024-02-22 19:15:57 -05:00
gdkchan
e5f1a043a0 Enable transform feedback buffer flush (#2552) 2024-02-22 19:15:57 -05:00
Alex Barney
80c107e338 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
2024-02-22 19:15:57 -05:00
ooa113y
6d3acdac22 Improve firmware install error due to outdated keys (#2541) 2024-02-22 19:15:57 -05:00
gdkchan
7c3e533d9e Fix size of cached compute shaders (#2548)
* Fix size of cached compute shaders

* Missed one
2024-02-22 19:15:56 -05:00
gdkchan
6270bd83a2 Revert "Calculate vertex buffer sizes from index buffer (#1663)" (#2544)
This reverts commit 10d649e6d3.
2024-02-22 19:15:56 -05:00
gdkchan
2edba1931d Ensure render scale is initialized to 1 on the backend (#2543) 2024-02-22 19:15:56 -05:00
gdkchan
095c4872fb Unify GpuAccessorBase and TextureDescriptorCapableGpuAccessor (#2542)
* Unify GpuAccessorBase and TextureDescriptorCapableGpuAccessor

* Shader cache version bump
2024-02-22 19:15:56 -05:00
gdkchan
cac1363707 Workaround for cubemap view data upload bug on Intel (#2539)
* Workaround for cubemap view data upload bug on Intel

* Trigger CI
2024-02-22 19:15:56 -05:00
gdkchan
cd07042804 Workaround for Intel FrontFacing built-in variable bug (#2540) 2024-02-22 19:15:56 -05:00
riperiperi
e958e086f0 Use "Undesired" scale mode for certain textures rather than blacklisting (#2537)
* Use "Undesired" scale mode for certain textures rather than blacklisting

* Nit

Co-authored-by: gdkchan <gab.dark.100@gmail.com>

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2024-02-22 19:15:56 -05:00
gdkchan
67be830c58 Make sure attributes used on subsequent shader stages are initialized (#2538) 2024-02-22 19:15:56 -05:00
gdkchan
02f0c0fe10 Calculate vertex buffer sizes from index buffer (#1663)
* Calculate vertex buffer size from maximum index buffer index

* Increase maximum index buffer count for it to be considered profitable for counting
2024-02-22 19:15:56 -05:00
gdkchan
d90fd218b5 Do not dirty memory tracking region handles if they are partially unmapped (#2536) 2024-02-22 19:15:56 -05:00
gdkchan
3b3c5184c6 Replace BGRA and scale uniforms with a uniform block (#2496)
* Replace BGRA and scale uniforms with a uniform block

* Setting the data again on program change is no longer needed

* Optimize and resolve some warnings

* Avoid redundant support buffer updates

* Some optimizations to BindBuffers (now inlined)

* Unify render scale arrays
2024-02-22 19:15:56 -05:00
jduncanator
4c164df841 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.
2024-02-22 19:15:56 -05:00
gdkchan
c5fabb9f3b Use a new approach for shader BRX targets (#2532)
* Use a new approach for shader BRX targets

* Make shader cache actually work

* Improve the shader pattern matching a bit

* Extend LDC search to predecessor blocks, catches more cases

* Nit

* Only save the amount of constant buffer data actually used. Avoids crashes on partially mapped buffers

* Ignore Rd on predicate instructions, as they do not have a Rd register (catches more cases)
2024-02-22 19:15:56 -05:00
mpnico
fe1ff2561e 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
2024-02-22 19:15:56 -05:00
ooa113y
74e418f864 Hide UI rework/arrow key fix (#2504)
* Unbreak arrow keys

* Use bitshift for Flags instead of literal
2024-02-22 19:15:55 -05:00
emmauss
97a25f5bc4 Clamp controller sticks to circle, instead of square (#2493)
* clamp controller sticks to circle, instead of square

* fix deadzone

* addressed comments
2024-02-22 19:15:55 -05:00
gdkchan
4d56a9f322 Support non-contiguous copies on I2M and DMA engines (#2473)
* Support non-contiguous copies on I2M and DMA engines

* Vector copy should start aligned on I2M

* Nits

* Zero extend the offset
2024-02-22 19:15:55 -05:00
Caian Benedicto
dd986e1eb5 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
2024-02-22 19:15:55 -05:00
gdkchan
9a8f8569c6 Make audio disposal thread safe on all 3 backends (#2527)
* Make audio disposal thread safe on all 3 backends

* Make OpenAL more consistent with the other backends

* Remove Window.Cursor = null, and change dummy TValue to byte
2024-02-22 19:15:55 -05:00
ooa113y
c00b30a70d Implement "hide UI" option (#2411)
* Implement jduncanator method

* Rename function/button ID

* Move option to Actions menu (makes no sense while emulation is inactive...)
2024-02-22 19:15:55 -05:00
emmauss
44c19ba7ca 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
2024-02-22 19:15:55 -05:00
riperiperi
2cb8e76345 Return mapped buffer pointer directly for flush, WriteableRegion for textures (#2494)
* Return mapped buffer pointer directly for flush, WriteableRegion for textures

A few changes here to generally improve performance, even for platforms not using the persistent buffer flush.

- Texture and buffer flush now return a ReadOnlySpan<byte>. It's guaranteed that this span is pinned in memory, but it will be overwritten on the next flush from that thread, so it is expected that the data is used before calling again.
- As a result, persistent mappings no longer copy to a new array - rather the persistent map is returned directly as a Span<>. A similar host array is used for the glGet flushes instead of allocating new arrays each time.
- Texture flushes now do their layout conversion into a WriteableRegion when the texture is not MultiRange, which allows the flush to happen directly into guest memory rather than into a temporary span, then copied over. This avoids another copy when doing layout conversion.

Overall, this saves 1 data copy for buffer flush, 1 copy for linear textures with matching source/target stride, and 2 copies for block textures or linear textures with mismatching strides.

* Fix tests

* Fix array pointer for Mesa/Intel path

* Address some feedback

* Update method for getting array pointer.
2024-02-22 19:15:55 -05:00
riperiperi
965391600c Only use persistent buffers to flush on NVIDIA and Windows+AMD (#2489)
It seems like this method of flushing data is much slower on Mesa drivers, and slightly slower on Intel Windows. Have not tested Intel Mesa, but I'm assuming it is the same as AMD.

This also adds vendor detection for AMD on Unix, which counted as "Unknown" before.
2024-02-22 19:15:55 -05:00
Mary
0b0d87d748 Amadeus: DSP code generation improvements (#2460)
This improve RyuJIT codegen drastically on the DSP side.
This may reduce CPU usage of the DSP thread quite a lot.
2024-02-22 19:15:55 -05:00
Mary
49cbc31eb9 shadertools: Prepare for new target Languages and APIs (#2465)
* shadertools: Prepare for new target Langugaes and APIs

This improves shader tools command line by adding support for target
language and api.

* Address gdkchan's comments
2024-02-22 19:15:55 -05:00
riperiperi
509eb85bf6 Flush buffers and texture data through a persistent mapped buffer. (#2481)
* Use persistent buffers to flush texture data

* Flush buffers via copy to persistent buffers.

* Log error when timing out, small refactoring.
2024-02-22 19:15:55 -05:00
gdkchan
733e91cf1b Ensure that DMA copy target textures are kept alive or flushed (#2478) 2024-02-22 19:15:55 -05:00
gdkchan
56f09911b1 Do not require texture and sampler pools being initialized (#2476) 2024-02-22 19:15:54 -05:00
gdkchan
621c67fd84 Close transfer memory properly on nvservices (#2477) 2024-02-22 19:15:54 -05:00
Mary
4c1d9e9234 Revert LibHac update
Users are facing save destruction on failing extra data update apparently
2024-02-22 19:15:54 -05:00
Alex Barney
ef43dcf738 Fix the headless build since previous commit 2024-02-22 19:15:54 -05:00
Alex Barney
f85cd3627e 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.
2024-02-22 19:15:54 -05:00
gdkchan
7691e54667 Implement a fast path for I2M transfers (#2467) 2024-02-22 19:15:54 -05:00
gdkchan
e27ed8a0f2 Fix shader compilation on shaders that uses rectangle textures (#2471) 2024-02-22 19:15:54 -05:00
gdkchan
0f47a14c3e 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
2024-02-22 19:15:53 -05:00
gdkchan
0fb68dd1de Fix virtual memory allocation being out of range (#2464) 2024-02-22 19:15:53 -05:00
Ac_K
08a7474c13 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
2024-02-22 19:15:53 -05:00
gdkchan
5e538694ee Fix GetWritableRegion write-back (#2456) 2024-02-22 19:15:53 -05:00
gdkchan
0cf488acc9 Unscale textureSize when resolution scaling is used (#2441)
* Unscale textureSize when resolution scaling is used

* Fix textureSize on compute

* Flag texture size as needing res scale values too
2024-02-22 19:15:53 -05:00
gdkchan
7f80d453c5 Flush UBO updates more frequently (#2407) 2024-02-22 19:15:53 -05:00
gdkchan
b41cafa0fa Separate GPU engines and make state follow official docs (part 1/2) (#2422)
* Use DeviceState for compute and i2m

* Migrate 2D class, more comments

* Migrate DMA copy engine

* Remove now unused code

* Replace GpuState by GpuAccessorState on GpuAcessor, since compute no longer has a GpuState

* More comments

* Add logging (disabled)

* Add back i2m on 3D engine
2024-02-22 19:15:53 -05:00
Mary
d8e189cc10 frontend: Add a SDL2 headless window (#2310) 2024-02-22 19:15:53 -05:00
gdkchan
970edee484 Allow shader language and target API to be specified on the shader translator (#2402) 2024-02-22 19:15:53 -05:00
emmauss
719b2652c1 Add portable screenshot folder (#2447)
* add portable screenshot folder

* fix style

Co-authored-by: Ac_K <Acoustik666@gmail.com>

Co-authored-by: Ac_K <Acoustik666@gmail.com>
2024-02-22 19:15:53 -05:00
Ac_K
5f30ba0144 ui: Fixes GetShrinkedGamepadName (#2444)
There is a wrong condition in `GetShrinkedGamepadName` which throw an oob if the controller name is equal to the checked value. It's now fixed and shoud closes #2442 .
2024-02-22 19:15:53 -05:00
Ac_K
226c69ef15 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.
2024-02-22 19:15:53 -05:00