-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patches for Resident Evil 2/3 audio issues #9308
Conversation
I added two new strings when updating the patch editor UI. Let me know if anything else is required to make then properly localizable.
|
What you've already done (adding a call to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me other than one comment, though I haven't looked at the DolphinQt part in detail.
You're welcome to combine those commits down into one, since the 2nd commit doesn't make much sense in the resulting history. We try to do the commits right during the PR so we can refer to them later if necessary (instead of squashing during the merge). To squash those commits into one before continuing; you can use the following commands (replace
The first command makes sure you get the latest commits from |
I can give it a shot, but I'm a bit perplexed... how is that preferable to a squash merge on PR completion? |
It makes no difference for your PR, but other (larger) ones would make it more difficult in finding problems after the fact when all we have is a single squashed commit (without the detailed info of every single commit). |
The squash merge doesn't result in a merge commit getting added. |
4561aba
to
5b03f0a
Compare
Now enabled by default. |
5b03f0a
to
dabfe2b
Compare
c31bdeb
to
4a5d089
Compare
7d12be6
to
533c66b
Compare
The last update to this PR fixed a pretty nasty heap corruption bug in the existing code. All it takes to reproduce is to add patch entries until the internal std::vector<> is reallocated, then go back and edit any of the entries that were already there. I can put that fix in a separate PR if there is still any hesitation about this change. |
f283d1b
to
a7f0fb3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code and approach LGTM, but I haven't tested the patches since I don't have any of these games.
@JMC47 If you haven't tested the patches, please do so. In particular, if Resident Evil 2 has some way to return to the main menu (even if it's only when you beat the game), please test that the patch continues working correctly after that.
These games are erroneously zeroing buffers before they can be fully copied to ARAM by DMA. The responsible memset() calls are followed by a call to DVDRead() which issues dcbi instructions that effectively cancel the memset() on real hardware. Because Dolphin lacks dcache emulation, the effects of the memset() calls are observed, which causes missing audio. In a comment on the original bug, phire noted that the issue can be corrected by simply nop'ing out the offending memset() calls. Because the games dynamically load different .rel executables based on the character and/or language, the addresses of these calls can vary. To deal generally with the problem of code being dynamically loaded to fixed, known addresses, the patch engine is extended to support conditional patches which require a match against a known value. This sort of thing is already achievable with Action Replay/Gecko codes, but their use depends on enabling cheats globally in Dolphin, which is not a prerequisite shared by patches. Patches are included for every region, character, and language combination. They are enabled by default. The end result is an approximation of the games' behavior on real hardware without the associated complexity of proper dcache emulation. https://bugs.dolphin-emu.org/issues/9840
This code was storing references to patch entries which could move around in memory if a patch was erased from the middle of a vector or if the vector itself was reallocated. Instead, NewPatchDialog maintains a separate copy of the patch entries which are committed back to the patch if the user accepts the changes.
a7f0fb3
to
f4c579e
Compare
Tested Resident Evil 2 NTSC/PAL/NTSC-J and swapped modes multiple times. Note that in single core, Resident Evil 3 hangs after the first area, but that is unrelated to these codes. LGTM. |
Oh yeah, forgot to note - if these codes are used in older versions of Dolphins, they will make the game crash. Not sure if there's anything that can be done about it but is worth mentioning. |
I'm not hearing any issues on that build. A few questions:
|
Dolphin 5.0 wouldn't be appropriate to use for a comparison, since it contains the ARAM DMA timing hack which avoids the audio issue in these two games. |
Good point. I noticed the progress report actually included a sample of the original bug, so I just linked that for comparison. |
No worries! Glad that's all it was. |
These games are erroneously zeroing buffers before they can be fully copied to ARAM by DMA. The responsible memset() calls are followed by a call to DVDRead() which issues dcbi instructions that effectively cancel the memset() on real hardware. Because Dolphin lacks dcache emulation, the effects of the memset() calls are observed, which causes missing audio.
In a comment on the original bug, phire noted that the issue can be corrected by simply nop'ing out the offending memset() calls. Because the games dynamically load different .rel executables based on the character and/or language, the addresses of these calls can vary.
To deal generally with the problem of dynamic code being loaded to fixed, known addresses, the patch engine is extended to support conditional patches which require a match against a known value. This sort of thing is already achievable with Action Replay codes, but their use depends on enabling cheats globally in Dolphin, which is not a prerequisite shared by patches.
Patches are included for every region, character, and language combination.
The end result is an approximation of the games' behavior on real hardware without the associated complexity of proper dcache emulation.
https://bugs.dolphin-emu.org/issues/9840