Skip to content
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

Merged
merged 2 commits into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Data/Sys/GameSettings/GHAE08.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# GHAE08 - Resident Evil 2

[OnFrame]
# Work around a game bug that causes background sounds to be zeroed during load.
# The bug was masked on real hardware by dcache. This patch fully fixes the bug
# and should also work on real hardware. Dolphin doesn't emulate dcache because
# the performance hit would be huge.
$Fix audio issues
# main.dol
0x800339E4:dword:0x60000000
# leon.rel
0x8055ACBC:dword:0x60000000:0x4BAA8445
# claire.rel
0x8055AB54:dword:0x60000000:0x4BAA85AD
[OnFrame_Enabled]
$Fix audio issues
16 changes: 16 additions & 0 deletions Data/Sys/GameSettings/GHAJ08.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# GHAJ08 - Biohazard 2

[OnFrame]
# Work around a game bug that causes background sounds to be zeroed during load.
# The bug was masked on real hardware by dcache. This patch fully fixes the bug
# and should also work on real hardware. Dolphin doesn't emulate dcache because
# the performance hit would be huge.
$Fix audio issues
# main.dol
0x80065FFC:dword:0x60000000
# leon.rel
0x805C5CC4:dword:0x60000000:0x4BA3D43D
# claire.rel
0x805C5BFC:dword:0x60000000:0x4BA3D505
[OnFrame_Enabled]
$Fix audio issues
32 changes: 32 additions & 0 deletions Data/Sys/GameSettings/GHAP08.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# GHAP08 - Resident Evil 2

[OnFrame]
# Work around a game bug that causes background sounds to be zeroed during load.
# The bug was masked on real hardware by dcache. This patch fully fixes the bug
# and should also work on real hardware. Dolphin doesn't emulate dcache because
# the performance hit would be huge.
$Fix audio issues
# main.dol
0x80033D60:dword:0x60000000
# leon.rel
0x8055C5F8:dword:0x60000000:0x4BAA6B09
# claire.rel
0x8055C490:dword:0x60000000:0x4BAA6C71
# leon_g.rel
0x8055C3B8:dword:0x60000000:0x4BAA6D49
# claire_g.rel
0x8055C328:dword:0x60000000:0x4BAA6DD9
# leon_f.rel
0x8055D188:dword:0x60000000:0x4BAA5F79
# claire_f.rel
0x8055D068:dword:0x60000000:0x4BAA6099
# leon_s.rel
0x8055D100:dword:0x60000000:0x4BAA6001
# claire_s.rel
0x8055D064:dword:0x60000000:0x4BAA609D
# leon_i.rel
0x8055CFDC:dword:0x60000000:0x4BAA6125
# claire_i.rel
0x8055CEBC:dword:0x60000000:0x4BAA6245
[OnFrame_Enabled]
$Fix audio issues
12 changes: 12 additions & 0 deletions Data/Sys/GameSettings/GLEE08.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# GLEE08 - Resident Evil 3: Nemesis

[OnFrame]
# Work around a game bug that causes background sounds to be zeroed during load.
# The bug was masked on real hardware by dcache. This patch fully fixes the bug
# and should also work on real hardware. Dolphin doesn't emulate dcache because
# the performance hit would be huge.
$Fix audio issues
# main.dol
0x80150E94:dword:0x60000000
[OnFrame_Enabled]
$Fix audio issues
12 changes: 12 additions & 0 deletions Data/Sys/GameSettings/GLEJ08.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# GLEJ08 - BioHazard 3: Last Escape

[OnFrame]
# Work around a game bug that causes background sounds to be zeroed during load.
# The bug was masked on real hardware by dcache. This patch fully fixes the bug
# and should also work on real hardware. Dolphin doesn't emulate dcache because
# the performance hit would be huge.
$Fix audio issues
# main.dol
0x8015110C:dword:0x60000000
[OnFrame_Enabled]
$Fix audio issues
20 changes: 20 additions & 0 deletions Data/Sys/GameSettings/GLEP08.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# GLEP08 - Resident Evil 3: Nemesis

[OnFrame]
# Work around a game bug that causes background sounds to be zeroed during load.
# The bug was masked on real hardware by dcache. This patch fully fixes the bug
# and should also work on real hardware. Dolphin doesn't emulate dcache because
# the performance hit would be huge.
$Fix audio issues
# eng.rel
0x8058C174:dword:0x60000000:0x4BA76F8D
# ger.rel
0x8058CE40:dword:0x60000000:0x4BA762C1
# fra.rel
0x8058D03C:dword:0x60000000:0x4BA760C5
# spa.rel
0x8058D024:dword:0x60000000:0x4BA760DD
# ita.rel
0x8058CEA4:dword:0x60000000:0x4BA7625D
[OnFrame_Enabled]
$Fix audio issues
15 changes: 12 additions & 3 deletions Source/Core/Core/PatchEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ void LoadPatchSection(const std::string& section, std::vector<Patch>& patches, I
bool success = true;
success &= TryParse(items[0], &pE.address);
success &= TryParse(items[2], &pE.value);
if (items.size() >= 4)
{
success &= TryParse(items[3], &pE.comparand);
pE.conditional = true;
}

const auto iter =
std::find(s_patch_type_strings.begin(), s_patch_type_strings.end(), items[1]);
Expand Down Expand Up @@ -184,16 +189,20 @@ static void ApplyPatches(const std::vector<Patch>& patches)
{
u32 addr = entry.address;
u32 value = entry.value;
u32 comparand = entry.comparand;
switch (entry.type)
{
case PatchType::Patch8Bit:
PowerPC::HostWrite_U8(static_cast<u8>(value), addr);
if (!entry.conditional || PowerPC::HostRead_U8(addr) == static_cast<u8>(comparand))
PowerPC::HostWrite_U8(static_cast<u8>(value), addr);
break;
case PatchType::Patch16Bit:
PowerPC::HostWrite_U16(static_cast<u16>(value), addr);
if (!entry.conditional || PowerPC::HostRead_U16(addr) == static_cast<u16>(comparand))
PowerPC::HostWrite_U16(static_cast<u16>(value), addr);
break;
case PatchType::Patch32Bit:
PowerPC::HostWrite_U32(value, addr);
if (!entry.conditional || PowerPC::HostRead_U32(addr) == comparand)
PowerPC::HostWrite_U32(value, addr);
break;
default:
// unknown patchtype
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/Core/PatchEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ struct PatchEntry
PatchType type = PatchType::Patch8Bit;
u32 address = 0;
u32 value = 0;
u32 comparand = 0;
bool conditional = false;
};

struct Patch
Expand Down
Loading