Use new "out-of-bounds" BSS workaround for gasdamge.c

This commit is contained in:
nocato 2024-02-12 22:13:06 +01:00
parent 3975c75dc3
commit 9d5aba7678
2 changed files with 11 additions and 8 deletions

View File

@ -85,7 +85,11 @@ from collections import defaultdict
# We don't have any explanation for this, so let's just artifically
# trim the last few bytes in overlays that exhibit this behavior for now.
BSS_HACK = defaultdict(int, {
's11c_lhs.bin': 4 # in s11c function at 0x800ce014 accesses 0x800d32dc which is just outside the overlay
's11c_lhs.bin': 4, # in s11c function at 0x800ce014 accesses 0x800d32dc which is just outside the overlay
# issues with gasdamge.c BSS
's02c_lhs.bin': 4,
's02d_lhs.bin': 4,
's02e_lhs.bin': 4,
})
def get_bss_adjustment(lhs):

View File

@ -14,8 +14,7 @@ typedef struct GasDamgeWork {
int field_40;
} GasDamgeWork;
// FIXME: this BSS variable is outside of overlay bounds???
int SECTION("overlay.bss") s02c_dword_800E3F40[0];
int SECTION("overlay.bss") s02c_dword_800E3F40;
extern short GM_O2_800ABA34;
@ -30,7 +29,7 @@ void GasDamageAct_800E1348(GasDamgeWork *work)
int divisor;
int field_40;
if (s02c_dword_800E3F40[0] != 0)
if (s02c_dword_800E3F40 != 0)
{
if (GM_CurrentItemId == ITEM_GASMASK)
{
@ -51,9 +50,9 @@ void GasDamageAct_800E1348(GasDamgeWork *work)
work->field_30 = temp_a0_2 & 0xFFF;
}
}
temp_a1 = s02c_dword_800E3F40[0];
temp_a1 = s02c_dword_800E3F40;
if (!(s02c_dword_800E3F40[0] & 2))
if (!(s02c_dword_800E3F40 & 2))
{
field_3C = work->field_3C;
field_40 = work->field_40;
@ -70,12 +69,12 @@ void GasDamageAct_800E1348(GasDamgeWork *work)
GM_O2_800ABA34 = 0x400;
}
}
s02c_dword_800E3F40[0] = 0;
s02c_dword_800E3F40 = 0;
}
void GasDamageDie_800E147C(GasDamgeWork *work)
{
s02c_dword_800E3F40[0] = 0;
s02c_dword_800E3F40 = 0;
}
int GasDamageGetResources_800E1488(GasDamgeWork *work, int arg0, int arg1)