From 823281291bf046a9c10159d8e2c72de38fa4643c Mon Sep 17 00:00:00 2001 From: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> Date: Mon, 9 Aug 2021 04:01:51 +0100 Subject: [PATCH] Script fixes, Type 1 cylinders fixed, rename `main` (#256) * Fix actor_symbols.py * Temporary fix to rename_sym.sh * Fix the few Type1 cylinders * Rename main -> Main * chmod rename_global_asm, fix asm in rename_syms * Format --- include/functions.h | 2 +- src/boot_O2_g3/idle.c | 2 +- src/code/main.c | 2 +- .../actors/ovl_En_Akindonuts/z_en_akindonuts.c | 6 +++--- src/overlays/actors/ovl_En_Fz/z_en_fz.c | 18 +++++++++--------- src/overlays/actors/ovl_En_Gb2/z_en_gb2.c | 6 +++--- src/overlays/actors/ovl_En_Ms/z_en_ms.c | 6 +++--- .../actors/ovl_En_Scopenuts/z_en_scopenuts.c | 6 +++--- .../actors/ovl_En_Sellnuts/z_en_sellnuts.c | 6 +++--- tools/disasm/functions.txt | 2 +- tools/overlayhelpers/actor_symbols.py | 4 ++-- tools/rename_global_asm.py | 0 tools/rename_sym.sh | 2 +- 13 files changed, 31 insertions(+), 31 deletions(-) mode change 100644 => 100755 tools/rename_global_asm.py diff --git a/include/functions.h b/include/functions.h index feb78ecaa0..831aa96e1a 100644 --- a/include/functions.h +++ b/include/functions.h @@ -3329,7 +3329,7 @@ void func_80174AA0(ListAlloc* alloc); // void func_80174AB4(void); // void func_80174B20(void); void func_80174BA0(ListAlloc* alloc); -void main(void* arg); +void Main(void* arg); // u32 Padmgr_GetControllerBitmask(void); // void func_80174F24(void); // void func_80174F44(void); diff --git a/src/boot_O2_g3/idle.c b/src/boot_O2_g3/idle.c index 734c1ef54a..41a074a026 100644 --- a/src/boot_O2_g3/idle.c +++ b/src/boot_O2_g3/idle.c @@ -70,7 +70,7 @@ void Main_ThreadEntry(void* arg) { IrqMgr_Init(&gIrqMgr, &sIrqMgrStackInfo, Z_PRIORITY_IRQMGR, 1); DmaMgr_Start(); Idle_InitCodeAndMemory(); - main(arg); + Main(arg); DmaMgr_Stop(); } diff --git a/src/code/main.c b/src/code/main.c index 499f0f929d..59471ea199 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -1,3 +1,3 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/main/main.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/main/Main.s") diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index 44abc76845..abbc3dfea0 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -22,9 +22,9 @@ const ActorInit En_Akindonuts_InitVars = { (ActorFunc)EnAkindonuts_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80BF02F0 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_HIT_PLAYER, COLSHAPE_JNTSPH, }, +// static ColliderCylinderInitType1 sCylinderInit = { +static ColliderCylinderInitType1 D_80BF02F0 = { + { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, COLSHAPE_CYLINDER, }, { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, { 27, 32, 0, { 0, 0, 0 } }, }; diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index bde15b5c4a..abf79af801 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -22,23 +22,23 @@ const ActorInit En_Fz_InitVars = { (ActorFunc)EnFz_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_809346F8 = { - { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_HIT_PLAYER, COLSHAPE_JNTSPH, }, +// static ColliderCylinderInitType1 sCylinderInit = { +static ColliderCylinderInitType1 D_809346F8 = { + { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, COLSHAPE_CYLINDER, }, { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x00 }, { 0xF7CFEFDD, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, { 30, 80, 0, { 0, 0, 0 } }, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80934724 = { - { COLTYPE_METAL, AT_NONE, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_NONE, OC2_HIT_PLAYER, COLSHAPE_JNTSPH, }, +// static ColliderCylinderInitType1 sCylinderInit = { +static ColliderCylinderInitType1 D_80934724 = { + { COLTYPE_METAL, AT_NONE, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_NONE, COLSHAPE_CYLINDER, }, { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x00 }, { 0x00001022, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, { 35, 80, 0, { 0, 0, 0 } }, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80934750 = { - { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_NONE, OC1_NONE, OC2_HIT_PLAYER, COLSHAPE_JNTSPH, }, +// static ColliderCylinderInitType1 sCylinderInit = { +static ColliderCylinderInitType1 D_80934750 = { + { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_NONE, OC1_NONE, COLSHAPE_CYLINDER, }, { ELEMTYPE_UNK0, { 0x20000000, 0x02, 0x04 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_NONE, }, { 20, 30, -15, { 0, 0, 0 } }, }; diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c index eff11c7fb6..c1f3b53bd2 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -40,9 +40,9 @@ const ActorInit En_Gb2_InitVars = { (ActorFunc)EnGb2_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80B11A40 = { - { COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_ALL, OC2_HIT_PLAYER, COLSHAPE_JNTSPH, }, +// static ColliderCylinderInitType1 sCylinderInit = { +static ColliderCylinderInitType1 D_80B11A40 = { + { COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_ALL, COLSHAPE_CYLINDER, }, { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, }, { 40, 75, 0, { 0, 0, 0 } }, }; diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index 6753b3543d..3126b899ba 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -22,9 +22,9 @@ const ActorInit En_Ms_InitVars = { (ActorFunc)EnMs_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80952BA0 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_HIT_PLAYER, COLSHAPE_JNTSPH, }, +// static ColliderCylinderInitType1 sCylinderInit = { +static ColliderCylinderInitType1 D_80952BA0 = { + { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, COLSHAPE_CYLINDER, }, { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, { 22, 37, 0, { 0, 0, 0 } }, }; diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index 6da1c791f4..ee45a01dbb 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -22,9 +22,9 @@ const ActorInit En_Scopenuts_InitVars = { (ActorFunc)EnScopenuts_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80BCCB40 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_HIT_PLAYER, COLSHAPE_JNTSPH, }, +// static ColliderCylinderInitType1 sCylinderInit = { +static ColliderCylinderInitType1 D_80BCCB40 = { + { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, COLSHAPE_CYLINDER, }, { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, { 27, 32, 0, { 0, 0, 0 } }, }; diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index 976114f6db..b4d19a58fa 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -22,9 +22,9 @@ const ActorInit En_Sellnuts_InitVars = { (ActorFunc)EnSellnuts_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80ADD964 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_HIT_PLAYER, COLSHAPE_JNTSPH, }, +// static ColliderCylinderInitType1 sCylinderInit = { +static ColliderCylinderInitType1 D_80ADD964 = { + { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, COLSHAPE_CYLINDER, }, { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, { 27, 32, 0, { 0, 0, 0 } }, }; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index dc2f20aefc..6378b880c8 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -3163,7 +3163,7 @@ 0x80174AB4:("func_80174AB4",), 0x80174B20:("func_80174B20",), 0x80174BA0:("func_80174BA0",), - 0x80174BF0:("main",), + 0x80174BF0:("Main",), 0x80174F10:("Padmgr_GetControllerBitmask",), 0x80174F24:("func_80174F24",), 0x80174F44:("func_80174F44",), diff --git a/tools/overlayhelpers/actor_symbols.py b/tools/overlayhelpers/actor_symbols.py index 75621fafdd..88aa8aa402 100755 --- a/tools/overlayhelpers/actor_symbols.py +++ b/tools/overlayhelpers/actor_symbols.py @@ -731,10 +731,10 @@ def resolve_symbol(address): for entry in actor_tbl: if address >= 0x80000000: if entry[3] <= address < entry[4]: - return repo + "baserom/overlays" + os.sep + entry[0], address - entry[3] + return repo + "baserom" + os.sep + entry[0], address - entry[3] else: if entry[1] <= address < entry[2]: - return repo + "baserom/overlays" + os.sep + entry[0], address - entry[1] + return repo + "baserom" + os.sep + entry[0], address - entry[1] else: raise RuntimeError('Symbol not found in actor overlay table file ranges. Are you sure the file is an actor overlay?') diff --git a/tools/rename_global_asm.py b/tools/rename_global_asm.py old mode 100644 new mode 100755 diff --git a/tools/rename_sym.sh b/tools/rename_sym.sh index 9781ae3b72..e68966ca7a 100755 --- a/tools/rename_sym.sh +++ b/tools/rename_sym.sh @@ -10,4 +10,4 @@ fi #echo "Replace $1 with $2?" #read -grep -rl "$1" asm/**/*.asm src/**/*.{c,h} include/**/*.h tables/*.txt undef.txt | xargs sed -i "s/\b$1\b/$2/g" \ No newline at end of file +grep -rl "$1" asm/**/*.s src/**/*.{c,h} include/**/*.h tools/disasm/functions.txt tools/disasm/variables.txt | xargs sed -i "s/\b$1\b/$2/g" \ No newline at end of file