From db987db9f879f421f1e1153b68dc21d8adb8d0de Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Wed, 27 May 2020 17:46:59 +0100 Subject: [PATCH] Decompile flg_set data (#172) * Decompile data for flg_set * Ran formatter * Remove data/ files --- .../code/flg_set/func_8002AAB0.s | 106 ------------------ data/flg_set.bss.s | 13 --- data/flg_set.data.s | 22 ---- spec | 2 - src/code/flg_set.c | 40 +++++++ src/code/z_scene.c | 10 +- 6 files changed, 45 insertions(+), 148 deletions(-) delete mode 100644 data/flg_set.bss.s delete mode 100644 data/flg_set.data.s diff --git a/asm/non_matchings/code/flg_set/func_8002AAB0.s b/asm/non_matchings/code/flg_set/func_8002AAB0.s index a898bd350a..33f7126c14 100644 --- a/asm/non_matchings/code/flg_set/func_8002AAB0.s +++ b/asm/non_matchings/code/flg_set/func_8002AAB0.s @@ -1,110 +1,4 @@ .rdata -glabel D_80135C60 - .asciz "event_chk_inf[0]" - .balign 4 - .asciz "event_chk_inf[1]" - .balign 4 - .asciz "event_chk_inf[2]" - .balign 4 - .asciz "event_chk_inf[3]" - .balign 4 - .asciz "event_chk_inf[4]" - .balign 4 - .asciz "event_chk_inf[5]" - .balign 4 - .asciz "event_chk_inf[6]" - .balign 4 - .asciz "event_chk_inf[7]" - .balign 4 - .asciz "event_chk_inf[8]" - .balign 4 - .asciz "event_chk_inf[9]" - .balign 4 - .asciz "event_chk_inf[10]" - .balign 4 - .asciz "event_chk_inf[11]" - .balign 4 - .asciz "event_chk_inf[12]" - .balign 4 - .asciz "event_chk_inf[13]" - .balign 4 - .asciz "item_get_inf[0]" - .balign 4 - .asciz "item_get_inf[1]" - .balign 4 - .asciz "item_get_inf[2]" - .balign 4 - .asciz "item_get_inf[3]" - .balign 4 - .asciz "inf_table[0]" - .balign 4 - .asciz "inf_table[1]" - .balign 4 - .asciz "inf_table[2]" - .balign 4 - .asciz "inf_table[3]" - .balign 4 - .asciz "inf_table[4]" - .balign 4 - .asciz "inf_table[5]" - .balign 4 - .asciz "inf_table[6]" - .balign 4 - .asciz "inf_table[7]" - .balign 4 - .asciz "inf_table[8]" - .balign 4 - .asciz "inf_table[9]" - .balign 4 - .asciz "inf_table[10]" - .balign 4 - .asciz "inf_table[11]" - .balign 4 - .asciz "inf_table[12]" - .balign 4 - .asciz "inf_table[13]" - .balign 4 - .asciz "inf_table[14]" - .balign 4 - .asciz "inf_table[15]" - .balign 4 - .asciz "inf_table[16]" - .balign 4 - .asciz "inf_table[17]" - .balign 4 - .asciz "inf_table[18]" - .balign 4 - .asciz "inf_table[19]" - .balign 4 - .asciz "inf_table[20]" - .balign 4 - .asciz "inf_table[21]" - .balign 4 - .asciz "inf_table[22]" - .balign 4 - .asciz "inf_table[23]" - .balign 4 - .asciz "inf_table[24]" - .balign 4 - .asciz "inf_table[25]" - .balign 4 - .asciz "inf_table[26]" - .balign 4 - .asciz "inf_table[27]" - .balign 4 - .asciz "inf_table[28]" - .balign 4 - .asciz "inf_table[29]" - .balign 4 - .asciz "event_inf[0]" - .balign 4 - .asciz "event_inf[1]" - .balign 4 - .asciz "event_inf[2]" - .balign 4 - .asciz "event_inf[3]" - .balign 4 - glabel D_80135FD8 .asciz "../flg_set.c" .balign 4 diff --git a/data/flg_set.bss.s b/data/flg_set.bss.s deleted file mode 100644 index 9cc6fdae83..0000000000 --- a/data/flg_set.bss.s +++ /dev/null @@ -1,13 +0,0 @@ -.include "macro.inc" - -# assembler directives -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches -.set gp=64 # allow use of 64-bit general purpose registers - -.section .bss - -.balign 16 - -glabel D_8015BB90 - .space 0x10 diff --git a/data/flg_set.data.s b/data/flg_set.data.s deleted file mode 100644 index 81ef5f1b85..0000000000 --- a/data/flg_set.data.s +++ /dev/null @@ -1,22 +0,0 @@ -.include "macro.inc" - -# assembler directives -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches -.set gp=64 # allow use of 64-bit general purpose registers - -.section .data - -.balign 16 - -glabel D_80115DC0 - .incbin "baserom.z64", 0xB8CF60, 0x1A8 - -glabel D_80115F68 - .incbin "baserom.z64", 0xB8D108, 0x4 - -glabel D_80115F6C - .incbin "baserom.z64", 0xB8D10C, 0x4 - -glabel D_80115F70 - .incbin "baserom.z64", 0xB8D110, 0x10 diff --git a/spec b/spec index a12fb7f290..ba4b020dfc 100644 --- a/spec +++ b/spec @@ -288,8 +288,6 @@ beginseg include "build/data/z_effect_soft_sprite_old_init.data.o" include "build/src/code/z_effect_soft_sprite_dlftbls.o" include "build/src/code/flg_set.o" - include "build/data/flg_set.data.o" - include "build/data/flg_set.bss.o" include "build/src/code/z_DLF.o" include "build/src/code/z_actor.o" include "build/src/code/z_actor_dlftbls.o" diff --git a/src/code/flg_set.c b/src/code/flg_set.c index ada3d7cc06..45b17178b3 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -1,4 +1,44 @@ #include #include +typedef struct { + /* 0x0000 */ u16* flagsReferenced; + /* 0x0004 */ char* name; +} FlagReference; + +FlagReference D_80115DC0[53] = { + { &gSaveContext.eventChkInf[0], "event_chk_inf[0]" }, { &gSaveContext.eventChkInf[1], "event_chk_inf[1]" }, + { &gSaveContext.eventChkInf[2], "event_chk_inf[2]" }, { &gSaveContext.eventChkInf[3], "event_chk_inf[3]" }, + { &gSaveContext.eventChkInf[4], "event_chk_inf[4]" }, { &gSaveContext.eventChkInf[5], "event_chk_inf[5]" }, + { &gSaveContext.eventChkInf[6], "event_chk_inf[6]" }, { &gSaveContext.eventChkInf[7], "event_chk_inf[7]" }, + { &gSaveContext.eventChkInf[8], "event_chk_inf[8]" }, { &gSaveContext.eventChkInf[9], "event_chk_inf[9]" }, + { &gSaveContext.eventChkInf[10], "event_chk_inf[10]" }, { &gSaveContext.eventChkInf[11], "event_chk_inf[11]" }, + { &gSaveContext.eventChkInf[12], "event_chk_inf[12]" }, { &gSaveContext.eventChkInf[13], "event_chk_inf[13]" }, + { &gSaveContext.itemGetInf[0], "item_get_inf[0]" }, { &gSaveContext.itemGetInf[1], "item_get_inf[1]" }, + { &gSaveContext.itemGetInf[2], "item_get_inf[2]" }, { &gSaveContext.itemGetInf[3], "item_get_inf[3]" }, + { &gSaveContext.infTable[0], "inf_table[0]" }, { &gSaveContext.infTable[1], "inf_table[1]" }, + { &gSaveContext.infTable[2], "inf_table[2]" }, { &gSaveContext.infTable[3], "inf_table[3]" }, + { &gSaveContext.infTable[4], "inf_table[4]" }, { &gSaveContext.infTable[5], "inf_table[5]" }, + { &gSaveContext.infTable[6], "inf_table[6]" }, { &gSaveContext.infTable[7], "inf_table[7]" }, + { &gSaveContext.infTable[8], "inf_table[8]" }, { &gSaveContext.infTable[9], "inf_table[9]" }, + { &gSaveContext.infTable[10], "inf_table[10]" }, { &gSaveContext.infTable[11], "inf_table[11]" }, + { &gSaveContext.infTable[12], "inf_table[12]" }, { &gSaveContext.infTable[13], "inf_table[13]" }, + { &gSaveContext.infTable[14], "inf_table[14]" }, { &gSaveContext.infTable[15], "inf_table[15]" }, + { &gSaveContext.infTable[16], "inf_table[16]" }, { &gSaveContext.infTable[17], "inf_table[17]" }, + { &gSaveContext.infTable[18], "inf_table[18]" }, { &gSaveContext.infTable[19], "inf_table[19]" }, + { &gSaveContext.infTable[20], "inf_table[20]" }, { &gSaveContext.infTable[21], "inf_table[21]" }, + { &gSaveContext.infTable[22], "inf_table[22]" }, { &gSaveContext.infTable[23], "inf_table[23]" }, + { &gSaveContext.infTable[24], "inf_table[24]" }, { &gSaveContext.infTable[25], "inf_table[25]" }, + { &gSaveContext.infTable[26], "inf_table[26]" }, { &gSaveContext.infTable[27], "inf_table[27]" }, + { &gSaveContext.infTable[28], "inf_table[28]" }, { &gSaveContext.infTable[29], "inf_table[29]" }, + { &gSaveContext.eventInf[0], "event_inf[0]" }, { &gSaveContext.eventInf[1], "event_inf[1]" }, + { &gSaveContext.eventInf[2], "event_inf[2]" }, { &gSaveContext.eventInf[3], "event_inf[3]" }, +}; + +s32 D_80115F68 = 0; +s32 D_80115F6C = 0; +s32 D_80115F70 = 0; + +s32 D_8015BB90; + #pragma GLOBAL_ASM("asm/non_matchings/code/flg_set/func_8002AAB0.s") diff --git a/src/code/z_scene.c b/src/code/z_scene.c index b790f2e870..74859ffe43 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -292,7 +292,7 @@ void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd) { i = globalCtx->objectCtx.unk_09; firstStatus = &globalCtx->objectCtx.status[0]; status = &globalCtx->objectCtx.status[i]; - + while (i < globalCtx->objectCtx.num) { if (status->id != *objectEntry) { status2 = &globalCtx->objectCtx.status[i]; @@ -302,20 +302,20 @@ void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd) { } globalCtx->objectCtx.num = i; func_80031A28(globalCtx, &globalCtx->actorCtx); - + continue; } - + i++; k++; objectEntry++; status++; } - + if (cmd->objectList.num > OBJECT_EXCHANGE_BANK_MAX) { __assert("scene_info->object_bank.num <= OBJECT_EXCHANGE_BANK_MAX", "../z_scene.c", 705); } - + if (1) {} while (k < cmd->objectList.num) {