Commit graph

2317 commits

Author SHA1 Message Date
riperiperi
646d4dd5c7
Fix deadlock for GPU counter report when 0 draws are done (#3019)
This fixes a rare bug where reporting a counter for a region containing 0 draws could deadlock the GPU. If this write overlaps with a tracking action, then the GPU could end up waiting on something that it's meant to do in the future, so it would just get stuck.

Before, this reported immediately and wrote the result to guest memory (tracked) from the backend thread.

The backend thread cannot be allowed to trigger read actions that wait on the GPU, as it will end up waiting on itself, and never advancing.

In the case of backend multithreading's `SyncMap`, it would try to wait for a backend sync object that does not yet exist, as the sync object would exist according to the GPU and tracking, but it has not yet been created by the backend (and never will be, since it's stuck).

The fix is to queue the 0 draw event just like any other, its _bufferMap value is just forced to 0.

This affects games that use Conditional Rendering: SMO, Splatoon 2, MK8. Was generally indicated by a red message in log saying that the query result timed out after 5000 tries, but not always the cause.
2022-01-21 19:19:15 -03:00
gdkchan
f0824fde9f
Add host CPU memory barriers for DMB/DSB and ordered load/store (#3015)
* Add host CPU memory barriers for DMB/DSB and ordered load/store

* PPTC version bump

* Revert to old barrier order
2022-01-21 12:47:34 -03:00
gdkchan
7e967d796c
Stop using glTransformFeedbackVaryings and use explicit layout on the shader (#3012)
* Stop using glTransformFeedbackVarying and use explicit layout on the shader

* This is no longer needed

* Shader cache version bump

* Fix gl_PerVertex output for tessellation control shaders
2022-01-21 12:35:21 -03:00
gdkchan
0e59573f2b
Add capability for BGRA formats (#3011) 2022-01-20 08:37:21 -03:00
sharmander
60f7cba30a
Implement FCVTNS (Scalar GP) (#2953)
* Implement FCVTNS (Scalar GP)

* Update Ptc Version
2022-01-19 22:21:44 -03:00
Ayato (Shahil)
b27183b806
Readme overhaul (#2988)
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Address gdk feedback

* Address suggestion

Co-authored-by: Luke Warner <65521430+LukeWarnut@users.noreply.github.com>

* Address suggestion

Co-authored-by: Luke Warner <65521430+LukeWarnut@users.noreply.github.com>

* Address suggestion

Co-authored-by: Luke Warner <65521430+LukeWarnut@users.noreply.github.com>

* Address suggestion

Co-authored-by: Luke Warner <65521430+LukeWarnut@users.noreply.github.com>

* Address suggestion

Co-authored-by: Luke Warner <65521430+LukeWarnut@users.noreply.github.com>

* Update suggestion

Co-authored-by: SS <74042715+choppymaster@users.noreply.github.com>

* Update suggestion

Co-authored-by: SS <74042715+choppymaster@users.noreply.github.com>

* Update suggestion

Co-authored-by: SS <74042715+choppymaster@users.noreply.github.com>

* Update suggestion

Co-authored-by: SS <74042715+choppymaster@users.noreply.github.com>

* Update suggestion

Co-authored-by: SS <74042715+choppymaster@users.noreply.github.com>

* Address suggestion

Co-authored-by: SS <74042715+choppymaster@users.noreply.github.com>

* Address suggestion

Co-authored-by: SS <74042715+choppymaster@users.noreply.github.com>

* Address suggestion

Co-authored-by: SS <74042715+choppymaster@users.noreply.github.com>

* Address suggestion

Co-authored-by: SS <74042715+choppymaster@users.noreply.github.com>

* Update README.md

* Update README.md

Co-authored-by: Luke Warner <65521430+LukeWarnut@users.noreply.github.com>
Co-authored-by: SS <74042715+choppymaster@users.noreply.github.com>
2022-01-18 22:43:12 +01:00
gdkchan
fb853f13e9
Scale scissor used for clears (#3002) 2022-01-16 20:23:00 -03:00
Mary
929a97d432
kernel: Fix deadlock when pinning in interrupt handler (#2999)
* kernel: Fix deadlock when pinning in interrupt handler

This fix a deadlock on DoDonPachi Resurrection when starting a new game

* Address gdkchan's comment
2022-01-16 13:21:44 +01:00
gdkchan
bd215e447d
Fix return type mismatch on 32-bit titles (#3000) 2022-01-16 08:39:43 -03:00
Mary
3fa7ef21b4
ssl: Implement SSL connectivity (#2961)
* 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>
2022-01-13 23:29:04 +01:00
Mary
366fe2dbb2
bsd: Revamp API and make socket abstract (#2960)
* 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
2022-01-12 19:31:08 +01:00
Mary
d300a5a45b
sfdnsres: Fix serialization issues (#2992)
* sfdnsres: Fix serialization issues

Fix a crash on Monster Hunter Rise

* Address gdkchan's comments

* Address gdkchan's comments
2022-01-12 17:43:00 +01:00
Alex Barney
f4bbc019b9
Update to LibHac 0.15.0 (#2986) 2022-01-12 12:22:19 +01:00
gdkchan
6e0799580f
Fix render target clear when sizes mismatch (#2994) 2022-01-11 20:15:17 +01:00
riperiperi
ef24c8983d
Fix adjacent 3d texture slices being detected as Incompatible Overlaps (#2993)
This fixes some regressions caused by #2971 which caused rendered 3D texture data to be lost for most slices. Fixes issues with Xenoblade 2's colour grading, probably a ton of other games.

This also removes the check from TextureCache, making it the tiniest bit smaller (any win is a win here).
2022-01-11 09:37:40 +01:00
Mary
275275f7ac
account: Rework LoadIdTokenCache to auto generate a random JWT token (#2991)
This improve correctness of that call while possibly spoofing possible recognizable patterns.
2022-01-11 09:22:20 +01:00
Mary
e32a19520b
sfdnsres: Block communication attempt with NPLN servers (#2990)
Seen on Monster Hunter Rise.
2022-01-11 08:58:57 +01:00
gdkchan
7f6b3d234a
Implement IMUL, PCNT and CONT shader instructions, fix FFMA32I and HFMA32I (#2972)
* Implement IMUL shader instruction

* Implement PCNT/CONT instruction and fix FFMA32I

* Add HFMA232I to the table

* Shader cache version bump

* No Rc on Ffma32i
2022-01-10 12:08:00 -03:00
gdkchan
952c6e4d45
Fix sampled multisample image size (#2984) 2022-01-10 08:45:25 +01:00
riperiperi
cda659955c
Texture Sync, incompatible overlap handling, data flush improvements. (#2971)
* Initial test for texture sync

* WIP new texture flushing setup

* Improve rules for incompatible overlaps

Fixes a lot of issues with Unreal Engine games. Still a few minor issues (some caused by dma fast path?) Needs docs and cleanup.

* Cleanup, improvements

Improve rules for fast DMA

* Small tweak to group together flushes of overlapping handles.

* Fixes, flush overlapping texture data for ASTC and BC4/5 compressed textures.

Fixes the new Life is Strange game.

* Flush overlaps before init data, fix 3d texture size/overlap stuff

* Fix 3D Textures, faster single layer flush

Note: nosy people can no longer merge this with Vulkan. (unless they are nosy enough to implement the new backend methods)

* Remove unused method

* Minor cleanup

* More cleanup

* Use the More Fun and Hopefully No Driver Bugs method for getting compressed tex too

This one's for metro

* Address feedback, ASTC+ETC to FormatClass

* Change offset to use Span slice rather than IntPtr Add

* Fix this too
2022-01-09 13:28:48 -03:00
gdkchan
4864648e72
Return error on DNS resolution when guest internet access is disabled (#2983)
* Return error on DNS resolution when guest internet access is disabled

* Log DNS lookup calls
2022-01-08 20:18:09 -03:00
riperiperi
79adba4402
Add support for render scale to vertex stage. (#2763)
* Add support for render scale to vertex stage.

Occasionally games read off textureSize on the vertex stage to inform the fragment shader what size a texture is without querying in there. Scales were not present in the vertex shader to correct the sizes, so games were providing the raw upscaled texture size to the fragment shader, which was incorrect.

One downside is that the fragment and vertex support buffer description must be identical, so the full size scales array must be defined when used. I don't think this will have an impact though. Another is that the fragment texture count must be updated when vertex shader textures are used. I'd like to correct this so that the update is folded into the update for the scales.

Also cleans up a bunch of things, like it making no sense to call CommitRenderScale for each stage.

Fixes render scale causing a weird offset bloom in Super Mario Party and Clubhouse Games. Clubhouse Games still has a pixelated look in a number of its games due to something else it does in the shader.

* Split out support buffer update, lazy updates.

* Commit support buffer before compute dispatch

* Remove unnecessary qualifier.

* Address Feedback
2022-01-08 14:48:48 -03:00
sharmander
e5f7ff1eee
CPU - Implement FCVTMS (Vector) (#2937)
* Add FCVTMS_V Implementation to Armeilleure

* Fix opcode designation

* Add tests

* Amend Ptc version

* Fix OpCode / Tests

* Create Math.Floor helper method + Update implementation

* Address gdk comments

* Re-address gdk comments

* Update ARMeilleure/Decoders/OpCodeTable.cs

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

* Update Tests to use 2S (4S) and 2D

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2022-01-04 16:45:28 -03:00
Mary
60f03cb78a
sfdnsres: Implement NSD resolution (#2962)
This fix a missing implementation usage of NSD on IResolver when
requested on GetAddrInfoRequest* and GetHostByNameRequest*.
2022-01-03 22:12:50 +01:00
Emmanuel Hansen
e24be5edfc
fix build id case issue for enabled cheats (#2970) 2022-01-03 21:28:57 +01:00
MutantAura
686757105c
Implement analog stick range modifier (#2783)
* adjust position vector + GUI

* remove brackets

* Update configuration

* Update ConfigurationFileFormat.cs

* rebase + review changes

* spacing

* revert deletion

* fix profile loading

* spacing

* comment spacing
2022-01-03 12:49:29 +01:00
Ac_K
16c649934f
ffmpeg: Add extra checks and error messages (#2951)
* ffmpeg: Add extra checks and error messages

This PR adds some checks and logging error messages related to the ffmpeg context creation, that will prevent users to open issues because they don't have the correct packages installed.
Close #2762

* Update FFmpegContext.cs
2022-01-03 12:38:21 +01:00
Emmanuel Hansen
e98abf1820
Add Cheat Manager (#2964)
* add cheatmanager

* use modloader to load cheats for manager

* addressed nits
2022-01-03 09:39:43 +01:00
Mary
dc8a1d5cba
misc: Improve DNS blacklist for Nintendo servers (#2963)
This blocks more that have been seen in the wild
2022-01-03 08:57:03 +01:00
gdkchan
15131d4350
Force crop when presentation cached texture size mismatches (#2957) 2021-12-31 12:00:42 -03:00
gdkchan
c05c8e09d4
Add support for the R4G4 texture format (#2956) 2021-12-30 17:10:54 +01:00
gdkchan
1485780d90
Fix A1B5G5R5 format for good (#2955) 2021-12-30 14:00:34 +01:00
Ac_K
b4f8ae7a75
friend: Stub IsFriendListCacheAvailable and EnsureFriendListAvailable (#2949)
* 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>
2021-12-30 11:42:22 +01:00
Ac_K
512cce6ed3
am: Stub SetMediaPlaybackStateForApplication (#2952)
This PR stub `SetMediaPlaybackStateForApplication` of the am service. Accordingly to gdkchan it's needed by the Youtube app. This is checked by RE aswell.
2021-12-30 11:25:46 +01:00
Mary
e96ef6d532
kernel: Implement thread pinning support (#2840)
* kernel: Implement Thread pinning support

This commit adds support for 8.x thread pinning changes and implement SynchronizePreemptionState syscall.

Based on kernel 13.x reverse.

* Address gdkchan's comment

* kernel: fix missing critical section leave in SetActivity

Fix Unity games

* Implement missing bits on the interrupt handler and inline update pinning function as it cannot be generic

* Fix some bugs in SetActivity and SetCoreAndAffinityMask

* Address gdkchan's comments
2021-12-30 10:55:06 +01:00
gdkchan
8544b1445b
Improve SocketOption handling (#2946) 2021-12-29 15:04:38 +01:00
Ac_K
322c14ee31
hid: A little cleanup (#2950)
While I'm looking to the code, I've found some syntax issue, and a little inconsistencie between `ActivateNpad` and `ActivateNpadWithRevision`. Nothing more.
2021-12-29 14:49:10 +01:00
gdkchan
ef39b2ebdd
Flip scissor box when the YNegate bit is set (#2941)
* Flip scissor box when the YNegate bit is set

* Flip scissor based on screen scissor state, account for negative scissor Y

* No need for abs when we already know the value is negative
2021-12-28 08:37:23 -03:00
gdkchan
6dacc4c577
Fix GetHostByNameRequestWithOptions and GetHostByAddrRequestWithOptions (#2943) 2021-12-28 08:22:58 -03:00
gdkchan
f65d01b5d3
Use minimum stream sample count on SDL2 audio backend (#2948) 2021-12-27 18:25:21 -03:00
gdkchan
ac57dd5d75
Fix wrong title language (#2933)
* Fix wrong title language

* Sort
2021-12-27 18:10:49 -03:00
gdkchan
a87f7f2029
Fix DMA copy fast path line size when xCount < stride (#2942) 2021-12-26 13:05:26 -03:00
sharmander
7c7bf30ad3
Fix missing default value of audio volume. (#2939) 2021-12-26 12:54:26 -03:00
gdkchan
451673ada5
Fix I2M texture copies when line length is not a multiple of 4 (#2938)
* Fix I2M texture copies when line length is not a multiple of 4

* Do not copy padding bytes for 1D copies

* Nit
2021-12-26 12:39:07 -03:00
gdkchan
0b1185284c
Fix GetAddrInfoWithOptions and some sockets issues (#2936)
* Fix GetAddrInfoWithOptions and some sockets issues

* Was not supposed to remove this log
2021-12-26 15:17:13 +01:00
gdkchan
c0056546e7
Fix bug causing an audio buffer to be enqueued more than once (#2940) 2021-12-26 14:48:18 +01:00
Mary
0205b1d7f6 Revert "sdl2: Update to Ryujinx.SDL2-CS 2.0.19 (#2907)"
This reverts commit 5dae02cfcb.
2021-12-24 00:03:23 +01:00
gdkchan
a438a4bc16
Remove PortRemoteClosed warning (#2928) 2021-12-23 14:43:30 -03:00
Mary
3aa22a1408
misc: Update SPB to 0.0.4-build17 (#2903)
Update to a new SPB version targeting .NET 6.
2021-12-23 14:31:06 -03:00
Mary
5dae02cfcb
sdl2: Update to Ryujinx.SDL2-CS 2.0.19 (#2907) 2021-12-23 14:11:32 -03:00