Emulator Issues #9840
closedResident Evil 2, Resident Evil 3: Nemesis Audio Issues
0%
Description
Game Name?
Resident Evil 2 - GHAE08
Resident Evil 3: Nemesis - GLEE08
MD5 Hash? (right click the game in the game list, properties, info tab, MD5 Hash: Compute)
Resident Evil 2 - ee2967ed8ccda671999a5151f2026723
Resident Evil 3 - 428abf23e4c06dbfcbd3cea2fa577385
What's the problem? Describe what went wrong.
In areas with multiple music tracks, the game's streaming audio system causes issues in Dolphin. We removed the ARAM-DMA hack because it was causing issues in other games, so now audio is broken. Note, this only affects areas with two or more music tracks; areas with a single music track (ambiance counts as a music track) there are no issues.
What steps will reproduce the problem?
The first area of Resident Evil 2: Leons story has fire and music, and thus is a perfect reproduction spot. The music will cut in and then overwrite itself and die. Then it'll do it again every 5 or 6 seconds.
If you copy and paste this into your browser you should be able to hear the issue first hand
Which versions of Dolphin did you test on? Does using an older version of Dolphin solve your issue? If yes, which versions of Dolphin used to work?
Before 5.0-560 everything seems to work fine. That is the start of the regression, the removal of the ARAM-DMA hack.
What are your PC specifications? (CPU, GPU, Operating System, more)
Intel Core i5-3570K @ 3.4GHz
NVIDIA GeForce GTX 1070
Windows 10
Is there any other relevant information? (e.g. logs, screenshots,
configuration files)
Nope.
Files
Updated by JosJuice over 8 years ago
- Has duplicate Emulator Issues #9778: Resident Evil 2/3 Audio Issues added
Updated by JosJuice over 7 years ago
- Has duplicate Emulator Issues #10558: RE 3 Nemesis sounds cut bug added
Updated by Chopin about 7 years ago
It's been quite a few years since the games Resident Evil 2/3 bug at the sound level.
Can we hope for the resolution of the problem soon?
Because since Dolphin manages the Wii I feel that the GameCube is a little left out ...
Updated by Helios about 7 years ago
It's a blocker so we can't release another stable until the blocker status is either removed or it's fixed.
Beyond that, Dolphin is an unpaid OSS project so nobody can be forced to work on anything they don't feel like.
Updated by Chopin about 7 years ago
I understand that Dolphin is free and developers are not paid. Besides, I love Dolphin and I thank the developers of all hearts but I just note that despite the frequent updates, the GameCube seems to be abandoned and I find it a shame.
Especially on a very old version, this bug was fixed I conclude that the solution is not very far ...
Updated by Helios about 7 years ago
GC isn't abandoned. This is just a bug nobody feels like looking into right now.
The Wii and GC are mostly the same hardware as far as the user is concerned. Most "Wii" fixes are applicable to GC games as well.
And if you think we focus more on Wii, don't look at our emulated wiimote code that has sat for years ;)
Updated by Chopin about 7 years ago
Oki oki, I want to believe you. It's just the impression I got.
I cross my fingers so that it unlocks quickly because I love RE 2/3 on GC :)
Updated by JMC4789 about 7 years ago
The reason why this no longer works is because it never actually worked correctly. We removed a hack (that was breaking other games...) in hopes that the correct behavior would be found eventually. We're fairly certain what the cause is, but, there may not be an easy way to implement that without destroying performance.
Updated by Chopin about 7 years ago
Ok, why not set up a manually activated hack? I know it's a case by case but we would have at least one solution until the problem is really fixed.
Updated by Chopin almost 7 years ago
Do not dream :)
For my trip, it's been a long time since I believe in it anymore
Updated by JMC4789 almost 7 years ago
A per-game hack will have to be added for this, but, my attempt to add it back in failed because some of the functionality used only for the hack was removed later on.
Someone with remedial coding knowledge could re-add the hack though.
Updated by niccop almost 7 years ago
So apparently it's a difficult problem to solve, that's sad. Anyway, we can only wait. :/
Updated by Anonymous over 6 years ago
Hello,
Apparently 1 line fixes this:
GenerateDSPInterrupt(INT_ARAM);
in Do_ARAM_DMA() just after s_dspState.DMAState = 1;
Maybe real hardware do interrupt at start and end of ARAM DMA transfer (or when DMAState changes 1 -> 0 or 0 -> 1)?
Dunno what above fix breaks ...
Updated by wesleyspipes over 6 years ago
Nucleoprotein wrote:
Hello,
Apparently 1 line fixes this:
GenerateDSPInterrupt(INT_ARAM);
in Do_ARAM_DMA() just after s_dspState.DMAState = 1;
Maybe real hardware do interrupt at start and end of ARAM DMA transfer (or when DMAState changes 1 -> 0 or 0 -> 1)?
Dunno what above fix breaks ...
What are the next steps to possibly incorporating this? Can you provide a test build? Maybe start off making this a per game hack for now?
Updated by Lyle.Tafoya almost 6 years ago
Nucleoprotein wrote:
Hello,
Apparently 1 line fixes this:
GenerateDSPInterrupt(INT_ARAM);
in Do_ARAM_DMA() just after s_dspState.DMAState = 1;
Maybe real hardware do interrupt at start and end of ARAM DMA transfer (or when DMAState changes 1 -> 0 or 0 -> 1)?
Dunno what above fix breaks ...
I just compiled dolphin from source with this change applied to DSP.cpp and now the music in Resident Evil 2 works correctly. Are there any negative implications to this patch? What does the Dolphin team require for this to get merged in? Has anyone submitted a formal pull request?
Updated by JMC4789 almost 6 years ago
- File ARAM_interrupt_test.dol ARAM_interrupt_test.dol added
We decided to make a hardware test to check this change.
This hack is 100% wrong, and not a real fix. Sorry. The interrupt is confirmed to fire at the end.
I've uploaded the test in case you want to confirm. On console, 99.99999999998553% of the xfer has happened by the time the interrupt fires.
Master vs Dolphin times - total xfer time for hw: 6607823, dolphin: 6722226. Meanwhile with the hack, it ends up 0.02% of the transfer time.
Credit to Booto for writing the test!
Updated by SilandaUK almost 6 years ago
Lyle.Tafoya wrote:
Nucleoprotein wrote:
Hello,
Apparently 1 line fixes this:
GenerateDSPInterrupt(INT_ARAM);
in Do_ARAM_DMA() just after s_dspState.DMAState = 1;
Maybe real hardware do interrupt at start and end of ARAM DMA transfer (or when DMAState changes 1 -> 0 or 0 -> 1)?
Dunno what above fix breaks ...I just compiled dolphin from source with this change applied to DSP.cpp and now the music in Resident Evil 2 works correctly. Are there any negative implications to this patch? What does the Dolphin team require for this to get merged in? Has anyone submitted a formal pull request?
It's worth being aware that although the hack works fine for Resident Evil 2+3, it can break other games. P.N.03 being one. I added the hack to my builds as a config file option which defaults to off because of this.
Updated by JMC4789 almost 6 years ago
Or we could put our efforts together to try to fix this in a way that doesn't require any hacks...
Even a game-patch would be better at this point.
Updated by phire almost 6 years ago
The interesting thing is just how instant the interrupt has to be.
According to JMC4789's tests: Anything 13 cycles or less works. Anything longer than 13 cycles is broken.
I've been doing some de-compiling of RE2 and it looks like the only thing that happens within approximately 13 cycles of triggering the DMA copy is re-enabling interrupts (the sdk DMA's code disables interrupts while it's setting up the DMA transfer).
One theory is that dolphin has a bug which causes DMA interrupts that are scheduled while interrupts are disabled to be delayed for a very long time, which means the instant dma hack actually delays the interrupt timing.
Another theory is that a previous dolphin bug has corrupted a game data structure somewhere, and the early interrupt is somehow 'uncorrupting' the data structure.
More testing is required.
Updated by phire almost 6 years ago
Nope, it turns out skid_au was right. It is dcache related.
There is a bug in the routine the game uses to upload the music to ARAM.
It reads the music off the disk in 40KB chunks, and then uses an SDK function which DMAs it to ARAM in 4KB chunks.
But it never waits for the ARAM DMA to finish before it starts reading the next 40KB chunk to the same buffer in memory. This shouldn't really be an issue, ARAM dma is much faster than the DVD drive and should complete long before the DI DMA overwrites it.
However, the game developer decided to memset the 40KB buffer before calling DVDRead(). Who knows why the developer decided to do this, it will be overwritten anyway.
why is dolphin broken?
Because dolphin receives the first ARAM DMA request, copies 1000 bytes into ARAM. But the game wipes the buffer (or at least the first 2000 bytes) before second ARAM dma request comes (its the ARAM DMA interrupt handler which initiates the next DMA transfer)
Why does the instant ARAM dma hack fix it?
Because dolphin now completes all 10 ARAM DMA copies before the game can memset the buffer.
Why does this work on hardware?
Because the SDK's DVDRead function calls dcacheInvalidate on the buffer before sending off the DVD request. The buffer is only 40KB, so it's more or less guaranteed to still be in L2 cache, even though the dcacheInvalidate doesn't immediately follow the memset call.
Because the buffer is invalided, the memset buffer never makes it to main ram. ARAM DMA reads out of main ram and completes long before the DVD read completes.
Updated by phire almost 6 years ago
Here is a patch for GHAE08:
I only expect it to work for Leon's Story and it might fail depending on how you navigate thorugh the menu before selecting Leon's story
[OnFrame_Enabled]
$fix dcache issue
[OnFrame]
$fix dcache issue
0x8055ACBC:dword:0x7C000378
Updated by shatteredlites almost 6 years ago
phire wrote:
Here is a patch for GHAE08:
I only expect it to work for Leon's Story and it might fail depending on how you navigate thorugh the menu before selecting Leon's story
[OnFrame_Enabled]
$fix dcache issue
[OnFrame]
$fix dcache issue
0x8055ACBC:dword:0x7C000378
yep only leons story, didn't try very much just made sure the opening area played. Claire on the other hand still breaks
Updated by Anonymous almost 6 years ago
Thanks @phire for explaining problem.
As dcache emulation I think will not happen soon (or never?), we can expect any hack/game patch to be implemented in official builds?
Updated by Murgatroide over 5 years ago
Nucleoprotein wrote:
Thanks @phire for explaining problem.
As dcache emulation I think will not happen soon (or never?), we can expect any hack/game patch to be implemented in official builds?
phire wrote:
Here is a patch for GHAE08:
I only expect it to work for Leon's Story and it might fail depending on how you navigate thorugh the menu before selecting Leon's story
[OnFrame_Enabled]
$fix dcache issue
[OnFrame]
$fix dcache issue
0x8055ACBC:dword:0x7C00
shatteredlites wrote:
phire wrote:
Here is a patch for GHAE08:
I only expect it to work for Leon's Story and it might fail depending on how you navigate thorugh the menu before selecting Leon's story
[OnFrame_Enabled]
$fix dcache issue
[OnFrame]
$fix dcache issue
0x8055ACBC:dword:0x7C000378yep only leons story, didn't try very much just made sure the opening area played. Claire on the other hand still breaks
excuse me, would somebody be so kind to tell me how and where i have to use the patch before mentioned.
Updated by venom_sina almost 5 years ago
Hey. Sorry total noob here.
Is there a way to return the ARAM-DMA hack as a check/uncheck feature (something like Enable Dual Core) or it will mess up the entire code?
I play RE2 and RE3 a lot and I want to use the new features that is in those newer builds. So if that is possible can we have that feature back?
Thanks in advance and have a nice day!
Updated by leoetlino about 4 years ago
- Status changed from Accepted to Fixed
- Fixed in set to 5.0-13452
The ARAM DMA hack will not come back because it is a hack.
Instead, https://github.com/dolphin-emu/dolphin/pull/9308 works around the issue by patching the game to remove the need for accurate dcache emulation which would probably be prohibitively expensive.