sudachi-emu / sudachi

Sudachi is a Nintendo Switch emulator for Android, Linux, macOS and Windows, written in C++
GNU General Public License v3.0
1.39k stars 82 forks source link

WIP: I may have a bug fix ready for Diablo 3 and some other games. #104

Open mateomaui opened 3 weeks ago

mateomaui commented 3 weeks ago

I've identified a problem that started back in EA 3835, where changes to the audio sink code for determining latency (and the least latent audio sink) created video/rendering/framerate stuttering issues in Diablo 3 when SDL is selected as the audio engine. It didn't exist before 3835 and still exists in 4176.

I've reverted that code to the version used in EA-3833, using the last version EA 4176, and the stuttering issues with SDL selected have disappeared for me. cubeb still has stutter issues, but that was the case for pre-3835 versions before the code changes were put in place.

I've also noticed that TOTK and RDR also seem to have benefited from the change. There was a time when TOTK was non-shader-building stutter free, then somewhere along the line it started having microstutters and microglitches again. Our hero in RDR seemed like he had a caffeine habit that made him jittery. Those problems in both games seemed to have cleared up.

You can see the commit that caused the regression here:

https://git.suyu.dev/suyu/suyu/commit/39c8ddcda281e5f5b125c78b55741e39a50ff254?style=split&whitespace=show-all&show-outdated=

And the fixes I made to a fork of your branch that should fix it the same as for my copy of 4176:

https://github.com/sudachi-emu/sudachi/compare/main...mateomaui:sudachi:diablo3fix

The only downside I can see to this reversion is that everyone has to be sure to manually select the proper audio engine for their device, and not rely on auto-select.... although that's not much of a change since it seems like both the new and the old auto-selection do not work properly to begin with. For me cubeb has a higher latency and causes stuttering in a few games, and that will always happen regardless of the version I use if I don't manually select SDL for the global setting.

Either way, the change I've made seems to fix problems for a few games and doesn't seem to introduce new ones except needing to manually select an audio engine.

mateomaui commented 1 week ago

Well, I was able to compile the current sudachi version without the translation flag improperly set, but unfortunately Diablo 3 doesn't load (before my changes are applied). The loading bar will appear for a few seconds and then immediately quit back to the games list, so there's no way to test a "before" state for the moment (using current keys and firmware 17.0.1, both with and without DLC and updates.)

I see from a different issue submitted 2 weeks ago that someone is in the game on Android (though it is crashing at various events), so I will keep making attempts to see if I can get the current state to load, or checkout prior commits to see if one lets it through.

Meanwhile, the microstutters I've had on TOTK and RDR do seem to be gone now in a compile with the fix. I don't know if those are a common issue, or if it's my older hardware, So it may be worth doing this revert for that alone.

I'll update if I figure out what's going on with D3.

mateomaui commented 1 week ago

Making a note that the first commit where D3 doesn't load is here (quits to the game list after a few seconds of progress bar):

https://github.com/sudachi-emu/sudachi/commit/0f2a1f3f04c2ca309030cffe70e9108f2f01a502 - "Added (incomplete) stubs to allow for booting the v18.0.0 firmware"

Have made a new branch from the linked commit, will be going through to see if anything can be corrected or commented out (etc) that lets D3 load again.

(The prior commit "Actually renamed Android module" loads D3 normally, and all subsequent commits quit the same for D3.)