mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-27 06:50:35 +00:00
Decompile SEL func_801B3F94 + refactor (#855)
Started off as a dedupe, but DRA func_80102E04 and SEL func_801B3F94 ended up being slightly different. Also refactored some symbols.
This commit is contained in:
parent
ea6fd198dd
commit
77b385286a
@ -177,8 +177,6 @@ g_GfxEquipIcon = 0x800C53C8;
|
||||
g_PalEquipIcon = 0x800D8978;
|
||||
D_800DB3B0 = 0x800DB454;
|
||||
D_800DBFFC = 0x800DBFFC; // ignore:true
|
||||
aXXVQ = 0x800DCC60;
|
||||
aAxearmor = 0x800DCC6C;
|
||||
aErrorStep = 0x800E1954;
|
||||
aAtariNuki = 0x800E19C0;
|
||||
aLightTimer02x = 0x800E1D64;
|
||||
@ -253,8 +251,8 @@ DrawRichterHudSubweapon = 0x801009E0;
|
||||
func_801025F4 = 0x80102484;
|
||||
func_801027C4 = 0x80102654;
|
||||
func_80102CD8 = 0x80102B68;
|
||||
func_80102DEC = 0x80102C7C;
|
||||
func_80102E04 = 0x80102C94;
|
||||
MemCardSetPort = 0x80102C7C;
|
||||
MemCardInitAndFormat = 0x80102C94;
|
||||
func_80102EB8 = 0x80102D48;
|
||||
HandleSaveMenu = 0x801030C8;
|
||||
func_80103EAC = 0x80103CF4;
|
||||
@ -542,13 +540,13 @@ D_80137E40 = 0x80137A14;
|
||||
D_80137E44 = 0x80137A18;
|
||||
D_80137E48 = 0x80137A1C;
|
||||
D_80137E4C = 0x80137A20;
|
||||
D_80137E50 = 0x80137A24;
|
||||
g_MemCardRetryCount = 0x80137A24;
|
||||
D_80137E54 = 0x80137A28;
|
||||
D_80137E58 = 0x80137A2C;
|
||||
D_80137E5C = 0x80137A30;
|
||||
D_80137E60 = 0x80137A34;
|
||||
D_80137E64 = 0x80137A38;
|
||||
D_80137E68 = 0x80137A3C;
|
||||
g_MemCardRStep = 0x80137A38;
|
||||
g_MemCardRStepSub = 0x80137A3C;
|
||||
D_80137E6C = 0x80137A40;
|
||||
g_CdCallback = 0x80137B2C;
|
||||
g_CdLoc = 0x80137B30;
|
||||
|
@ -187,6 +187,8 @@ IsRelicActive = 0x800FE3A8;
|
||||
HandleDamage = 0x800FE97C;
|
||||
HandleTransformationMP = 0x800FEEA4;
|
||||
DrawRichterHudSubweapon = 0x80100B50;
|
||||
MemCardSetPort = 0x80102DEC;
|
||||
MemCardInitAndFormat = 0x80102E04;
|
||||
HandleSaveMenu = 0x80103238;
|
||||
DestroyEntity = 0x80106590;
|
||||
DestroyEntities = 0x801065F4;
|
||||
@ -274,6 +276,9 @@ g_NewPlayerStatsTotal = 0x80137938;
|
||||
g_ServantPrevious = 0x8013795C;
|
||||
g_DisplayHP = 0x8013796C;
|
||||
g_HealingMailTimer = 0x80137998;
|
||||
g_MemCardRetryCount = 0x80137E50;
|
||||
g_MemCardRStep = 0x80137E64;
|
||||
g_MemCardRStepSub = 0x80137E68;
|
||||
g_CdCallback = 0x80137F58;
|
||||
g_CdLoc = 0x80137F5C;
|
||||
g_Cd = 0x80137F60;
|
||||
|
@ -16,16 +16,15 @@ MemcardReadFile = 0x801B884C;
|
||||
MemcardWriteFile = 0x801B88F4;
|
||||
MemcardClose = 0x801B8A10;
|
||||
func_800E9880 = 0x801B8A8C;
|
||||
MemcardFormat = 0x801B8D24;
|
||||
StoreSaveData = 0x801B8E20;
|
||||
LoadSaveData = 0x801B94BC;
|
||||
MakeMemcardPath = 0x801B9698;
|
||||
StreamNextVlc = 0x801B988C;
|
||||
func_801BAB70 = 0x801BAB70;
|
||||
DecDCTvlc = 0x801BABA4;
|
||||
g_memCardRStep = 0x801BAFEC;
|
||||
g_memCardRStepSub = 0x801BAFF0;
|
||||
g_memCardRetryCount = 0x801BAFF8;
|
||||
g_MemCardRStep = 0x801BAFEC;
|
||||
g_MemCardRStepSub = 0x801BAFF0;
|
||||
g_MemCardRetryCount = 0x801BAFF8;
|
||||
g_MemcardRetryCount = 0x801BC2F8;
|
||||
g_MemcardFd = 0x801BC2FC;
|
||||
g_Dialogue = 0x801BC354;
|
||||
|
@ -208,28 +208,26 @@ void func_80102D70(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_80102DEC(s32 context) {
|
||||
D_80137E64 = 0;
|
||||
D_80137E68 = context;
|
||||
void MemCardSetPort(s32 nPort) {
|
||||
g_MemCardRStep = 0;
|
||||
g_MemCardRStepSub = nPort;
|
||||
}
|
||||
|
||||
s32 func_80102E04(void) {
|
||||
u32 new_var2 = D_80137E68;
|
||||
s32 temp_s0 = D_80137E64;
|
||||
s32 MemCardInitAndFormat(void) {
|
||||
u32 nPort = g_MemCardRStepSub;
|
||||
s32 state = g_MemCardRStep;
|
||||
|
||||
switch (temp_s0) {
|
||||
switch (state) {
|
||||
case 0:
|
||||
MemcardInit();
|
||||
D_80137E50 = 4;
|
||||
D_80137E64++;
|
||||
g_MemCardRetryCount = 4;
|
||||
g_MemCardRStep++;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (MemcardFormat(new_var2, 0) != temp_s0) {
|
||||
D_80137E50 = D_80137E50 - 1;
|
||||
if (D_80137E50 == -1) {
|
||||
temp_s0 = -1;
|
||||
return temp_s0;
|
||||
if (MemcardFormat(nPort, 0) != 1) {
|
||||
if (--g_MemCardRetryCount == -1) {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return 1;
|
||||
|
@ -5,7 +5,6 @@
|
||||
// Note: Including this as part of the previous file (62D70.c) caused
|
||||
// four 00 bytes to be added to the rodata at 0x3CDC0; this indicates
|
||||
// that this function should be the start of this new file.
|
||||
|
||||
void func_80103ED4(void) {
|
||||
char saveFile[32];
|
||||
s32 memCardClose;
|
||||
@ -15,7 +14,7 @@ void func_80103ED4(void) {
|
||||
switch (D_80137E4C) {
|
||||
case 0:
|
||||
MemcardInit();
|
||||
D_80137E50 = 4;
|
||||
g_MemCardRetryCount = 4;
|
||||
D_80137E4C++;
|
||||
return;
|
||||
case 1:
|
||||
@ -25,13 +24,13 @@ void func_80103ED4(void) {
|
||||
return;
|
||||
}
|
||||
if (case1_state == -1) {
|
||||
if (--D_80137E50 == -1) {
|
||||
if (--g_MemCardRetryCount == -1) {
|
||||
D_80137E4C = 7;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (case1_state == -3) {
|
||||
if (--D_80137E50 == -1) {
|
||||
if (--g_MemCardRetryCount == -1) {
|
||||
D_80137E4C = 8;
|
||||
}
|
||||
return;
|
||||
@ -45,7 +44,7 @@ void func_80103ED4(void) {
|
||||
return;
|
||||
case 2:
|
||||
if (MemcardParse(D_80097924, 0) >= 0) {
|
||||
D_80137E50 = 10;
|
||||
g_MemCardRetryCount = 10;
|
||||
if (D_8006C378 >= 0) {
|
||||
i = 0;
|
||||
if (D_80137E54 == 2) {
|
||||
@ -102,12 +101,12 @@ void func_80103ED4(void) {
|
||||
// in the save-select screen.
|
||||
StoreSaveData(g_Pix, D_8006C378, rand() & 0xF);
|
||||
if (MemcardWriteFile(D_80097924, 0, saveFile, g_Pix, 1, i) != 0) {
|
||||
if (--D_80137E50 == -1) {
|
||||
if (--g_MemCardRetryCount == -1) {
|
||||
D_80137E4C = 0;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
D_80137E50 = 10;
|
||||
g_MemCardRetryCount = 10;
|
||||
D_80137E4C++;
|
||||
return;
|
||||
}
|
||||
@ -118,7 +117,7 @@ void func_80103ED4(void) {
|
||||
return;
|
||||
}
|
||||
if (memCardClose == -3) {
|
||||
if (--D_80137E50 != -1) {
|
||||
if (--g_MemCardRetryCount != -1) {
|
||||
D_80137E4C--;
|
||||
return;
|
||||
}
|
||||
|
@ -676,13 +676,13 @@ extern s32 D_80137E40;
|
||||
extern s32 D_80137E44;
|
||||
extern s32 D_80137E48;
|
||||
extern s32 D_80137E4C;
|
||||
extern s32 D_80137E50;
|
||||
extern s32 g_MemCardRetryCount;
|
||||
extern s32 D_80137E54;
|
||||
extern s32 D_80137E58;
|
||||
extern s32 D_80137E5C;
|
||||
extern s32 D_80137E60; // most likely part of the g_Cd struct
|
||||
extern s32 D_80137E64; // most likely part of the g_Cd struct
|
||||
extern s32 D_80137E68; // most likely part of the g_Cd struct
|
||||
extern s32 g_MemCardRStep;
|
||||
extern s32 g_MemCardRStepSub;
|
||||
extern s32 D_80137E6C;
|
||||
extern s32 D_80137F6C; // most likely part of the g_Cd struct
|
||||
extern void* D_80137F7C;
|
||||
@ -945,7 +945,6 @@ void func_800FF0A0(s32 arg0);
|
||||
bool func_8010183C(s32 arg0);
|
||||
s32 func_801025F4(void);
|
||||
void func_80102CD8(s32);
|
||||
void func_80102DEC(s32 arg0);
|
||||
void func_80103EAC(void);
|
||||
void DestroyEntity(Entity*);
|
||||
void DestroyEntities(s16 startIndex);
|
||||
|
@ -381,13 +381,13 @@ s32 D_80137E40;
|
||||
s32 D_80137E44;
|
||||
s32 D_80137E48;
|
||||
s32 D_80137E4C;
|
||||
s32 D_80137E50;
|
||||
s32 g_MemCardRetryCount;
|
||||
s32 D_80137E54;
|
||||
s32 D_80137E58;
|
||||
s32 D_80137E5C;
|
||||
s32 D_80137E60;
|
||||
s32 D_80137E64;
|
||||
s32 D_80137E68;
|
||||
s32 g_MemCardRStep;
|
||||
s32 g_MemCardRStepSub;
|
||||
s32 D_80137E6C;
|
||||
s32 D_80137F6C;
|
||||
|
||||
|
@ -823,7 +823,7 @@ void Update(void) {
|
||||
if (g_pads[0].tapped & PAD_TRIANGLE) {
|
||||
g_api.PlaySfx(0x633);
|
||||
func_801ACBE4(GFX_UNK_6, 8);
|
||||
func_801B3F7C(0);
|
||||
MemCardSetPort(0);
|
||||
D_8003C9A4++;
|
||||
} else {
|
||||
if (g_pads[0].tapped & PAD_CROSS) {
|
||||
@ -835,7 +835,7 @@ void Update(void) {
|
||||
case 514:
|
||||
func_801ADF94(0x80, 0);
|
||||
D_800978C4 = 0;
|
||||
temp_v0 = func_801B3F94();
|
||||
temp_v0 = MemCardInitAndFormat();
|
||||
if (temp_v0 != 0) {
|
||||
D_800978C4 = 1;
|
||||
}
|
||||
@ -885,7 +885,7 @@ void Update(void) {
|
||||
if (g_pads[0].tapped & PAD_TRIANGLE) {
|
||||
g_api.PlaySfx(0x633);
|
||||
func_801ACBE4(GFX_UNK_6, 8);
|
||||
func_801B3F7C(1);
|
||||
MemCardSetPort(1);
|
||||
D_8003C9A4++;
|
||||
} else {
|
||||
if (g_pads[0].tapped & 0x40) {
|
||||
@ -897,7 +897,7 @@ void Update(void) {
|
||||
case 530:
|
||||
func_801ADF94(0x80, 0);
|
||||
D_800978C4 = 0;
|
||||
temp_v0 = func_801B3F94();
|
||||
temp_v0 = MemCardInitAndFormat();
|
||||
if (temp_v0 != 0) {
|
||||
D_800978C4 = 1;
|
||||
}
|
||||
@ -1453,7 +1453,7 @@ void func_801B3120(void) {
|
||||
s32 i;
|
||||
s32 n;
|
||||
|
||||
g_memCardRStep = 0;
|
||||
g_MemCardRStep = 0;
|
||||
i = 0;
|
||||
n = -1;
|
||||
var_v0 = g_SaveSummary;
|
||||
@ -1470,8 +1470,8 @@ void func_801B3120(void) {
|
||||
INCLUDE_ASM("asm/us/st/sel/nonmatchings/2EED8", func_801B3164);
|
||||
|
||||
void func_801B367C(s32 arg0) {
|
||||
g_memCardRStep = 0;
|
||||
g_memCardRStepSub = arg0;
|
||||
g_MemCardRStep = 0;
|
||||
g_MemCardRStepSub = arg0;
|
||||
}
|
||||
|
||||
s32 TryLoadSaveData(void) {
|
||||
@ -1481,39 +1481,39 @@ s32 TryLoadSaveData(void) {
|
||||
s32 temp_v0;
|
||||
s32 blockId;
|
||||
|
||||
FntPrint(D_801A7AF8, g_memCardRStep, g_memCardRStepSub);
|
||||
FntPrint(D_801A7B08, g_memCardRetryCount);
|
||||
FntPrint(D_801A7AF8, g_MemCardRStep, g_MemCardRStepSub);
|
||||
FntPrint(D_801A7B08, g_MemCardRetryCount);
|
||||
|
||||
nPort = g_memCardRStepSub / 15;
|
||||
nSlot = g_memCardRStepSub % 15;
|
||||
nPort = g_MemCardRStepSub / 15;
|
||||
nSlot = g_MemCardRStepSub % 15;
|
||||
blockId = g_SaveSummary[nPort].slot[nSlot];
|
||||
switch (g_memCardRStep) {
|
||||
switch (g_MemCardRStep) {
|
||||
case 0:
|
||||
MemcardInit();
|
||||
g_memCardRetryCount = 10;
|
||||
g_memCardRStep = 3;
|
||||
g_MemCardRetryCount = 10;
|
||||
g_MemCardRStep = 3;
|
||||
break;
|
||||
case 3:
|
||||
MakeMemcardPath(saveFile, blockId);
|
||||
if (MemcardReadFile(nPort, 0, saveFile, g_Pix[0], 1) != 0) {
|
||||
g_memCardRetryCount--;
|
||||
if (g_memCardRetryCount != -1) {
|
||||
g_MemCardRetryCount--;
|
||||
if (g_MemCardRetryCount != -1) {
|
||||
return 0;
|
||||
}
|
||||
temp_v0 = -1;
|
||||
return temp_v0;
|
||||
}
|
||||
g_memCardRStep++;
|
||||
g_MemCardRStep++;
|
||||
break;
|
||||
case 4:
|
||||
temp_v0 = MemcardClose(nPort);
|
||||
if (temp_v0 != 0) {
|
||||
if (temp_v0 == -3) {
|
||||
g_memCardRetryCount--;
|
||||
if (g_memCardRetryCount == -1) {
|
||||
g_MemCardRetryCount--;
|
||||
if (g_MemCardRetryCount == -1) {
|
||||
return -1;
|
||||
} else {
|
||||
g_memCardRStep--;
|
||||
g_MemCardRStep--;
|
||||
do {
|
||||
return 0;
|
||||
} while (0); // FAKE!
|
||||
@ -1536,7 +1536,7 @@ INCLUDE_ASM("asm/us/st/sel/nonmatchings/2EED8", func_801B38B4);
|
||||
void func_801B3A54(s32 arg0, s32 arg1) {
|
||||
char pad[0x20];
|
||||
|
||||
g_memCardRStep = 0;
|
||||
g_MemCardRStep = 0;
|
||||
D_801BAFFC = arg0;
|
||||
D_801BB000 = arg1;
|
||||
D_801BB004 = arg0;
|
||||
@ -1547,8 +1547,8 @@ void func_801B3A54(s32 arg0, s32 arg1) {
|
||||
INCLUDE_ASM("asm/us/st/sel/nonmatchings/2EED8", func_801B3A94);
|
||||
|
||||
void func_801B3E14(s32 arg0) {
|
||||
g_memCardRStep = 0;
|
||||
g_memCardRStepSub = arg0;
|
||||
g_MemCardRStep = 0;
|
||||
g_MemCardRStepSub = arg0;
|
||||
}
|
||||
|
||||
s32 func_801B3E2C(void) {
|
||||
@ -1557,19 +1557,19 @@ s32 func_801B3E2C(void) {
|
||||
s32 blockId;
|
||||
s32 port;
|
||||
|
||||
port = g_memCardRStepSub / 15;
|
||||
slot = g_memCardRStepSub % 15;
|
||||
port = g_MemCardRStepSub / 15;
|
||||
slot = g_MemCardRStepSub % 15;
|
||||
blockId = g_SaveSummary[port].slot[slot];
|
||||
switch (g_memCardRStep) {
|
||||
switch (g_MemCardRStep) {
|
||||
case 0:
|
||||
MemcardInit(slot, blockId);
|
||||
g_memCardRetryCount = 10;
|
||||
g_memCardRStep++;
|
||||
g_MemCardRetryCount = 10;
|
||||
g_MemCardRStep++;
|
||||
break;
|
||||
case 1:
|
||||
MakeMemcardPath(path, blockId);
|
||||
if (MemcardEraseFile(port, 0, path)) {
|
||||
if (--g_memCardRetryCount == -1) {
|
||||
if (--g_MemCardRetryCount == -1) {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@ -1581,12 +1581,36 @@ s32 func_801B3E2C(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void func_801B3F7C(s32 arg0) {
|
||||
g_memCardRStep = 0;
|
||||
g_memCardRStepSub = arg0;
|
||||
void MemCardSetPort(s32 port) {
|
||||
g_MemCardRStep = 0;
|
||||
g_MemCardRStepSub = port;
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/sel/nonmatchings/2EED8", func_801B3F94);
|
||||
s32 MemCardInitAndFormat(void) {
|
||||
int dummy[8];
|
||||
u32 nPort = g_MemCardRStepSub;
|
||||
s32 state = g_MemCardRStep;
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
MemcardInit();
|
||||
g_MemCardRetryCount = 5;
|
||||
g_MemCardRStep++;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (MemcardFormat(nPort, 0) != 1) {
|
||||
if (--g_MemCardRetryCount == -1) {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void InitRoomEntities(s32 objLayoutId) {
|
||||
switch (D_8003C9A4) {
|
||||
|
@ -168,9 +168,9 @@ extern s32 D_801BAFDC;
|
||||
extern s32 D_801BAFE0;
|
||||
extern u32 D_801BAFE4;
|
||||
extern s32 D_801BAFE8;
|
||||
extern s32 g_memCardRStep;
|
||||
extern s32 g_memCardRStepSub; // rstep sub
|
||||
extern s32 g_memCardRetryCount;
|
||||
extern s32 g_MemCardRStep;
|
||||
extern s32 g_MemCardRStepSub; // rstep sub
|
||||
extern s32 g_MemCardRetryCount;
|
||||
extern s32 D_801BAFFC;
|
||||
extern s32 D_801BB000;
|
||||
extern s32 D_801BB004;
|
||||
|
Loading…
Reference in New Issue
Block a user