From 5b086ce5e3e4a65482a5399ca00931300d2e2c28 Mon Sep 17 00:00:00 2001 From: Robin Avery Date: Mon, 22 Jun 2026 17:30:46 -0400 Subject: [PATCH] Improve data matching --- config/GALE01/splits.txt | 28 ++- config/GALE01/symbols.txt | 55 +++-- configure.py | 1 + src/melee/ft/chara/ftLink/ftLk_Init.c | 3 +- src/melee/ft/chara/ftLink/ftLk_Init.h | 1 + src/melee/ft/chara/ftPurin/ftPr_Init.c | 2 +- src/melee/ft/chara/ft_459A.h | 47 ++++ src/melee/ft/forward.h | 1 + src/melee/ft/ft_0852.c | 1 + src/melee/ft/ft_0852.h | 4 - src/melee/ft/ftdata.c | 200 +++------------- src/melee/ft/ftdata.h | 12 +- src/melee/ft/types.h | 4 +- src/melee/if/textdraw.c | 32 +-- src/melee/if/textlib.c | 312 +++---------------------- src/melee/if/textlib.h | 2 - src/melee/if/types.h | 1 + src/melee/ty/toy.c | 247 ++++++++++++++++++++ src/melee/ty/toy.h | 1 - src/melee/ty/tylist.c | 82 +++---- src/melee/ty/tylist.h | 7 +- src/melee/ty/tylist.static.h | 92 ++++++++ src/melee/ty/types.h | 35 --- src/melee/vi/vi1201v1.c | 14 +- src/melee/vi/vi1201v2.c | 7 + 25 files changed, 605 insertions(+), 586 deletions(-) create mode 100644 src/melee/ft/chara/ft_459A.h create mode 100644 src/melee/ty/tylist.static.h diff --git a/config/GALE01/splits.txt b/config/GALE01/splits.txt index 1b14106494..c4126ff356 100644 --- a/config/GALE01/splits.txt +++ b/config/GALE01/splits.txt @@ -767,6 +767,9 @@ melee/ft/ftdevice.c: .sdata start:0x804D3C18 end:0x804D3C20 .sbss start:0x804D6570 end:0x804D6580 +melee/ft/ft_459A.c: + .bss start:0x80459A98 end:0x8045A6C0 + melee/ft/chara/ftCommon/ftCo_Bury.c: .text start:0x800C0874 end:0x800C15F4 .data start:0x803C6BA0 end:0x803C6BD8 @@ -4343,28 +4346,32 @@ melee/if/soundtest.c: .text start:0x802FF7DC end:0x80301E44 .data start:0x803F9F28 end:0x803FDC20 .sdata start:0x804D5850 end:0x804D5A40 - .sbss start:0x804D6DA8 end:0x804D6F2C melee/if/textdraw.c: - .text start:0x80301E44 end:0x80302834 - .rodata start:0x803B8790 end:0x803B8810 - .data start:0x803FDC20 end:0x803FDD18 + .text start:0x80301E44 end:0x803029B4 + .rodata start:0x803B8790 end:0x803B87A8 + .data start:0x803FDC20 end:0x803FDC80 .bss start:0x804A1FD8 end:0x804A2688 + .sbss start:0x804D6E18 end:0x804D6E40 + .sdata2 start:0x804DDC58 end:0x804DDC88 melee/if/textlib.c: - .text start:0x80302834 end:0x80305058 - .bss start:0x804A2688 end:0x804A2EA8 + .text start:0x803029B4 end:0x80304870 + .rodata start:0x803B87A8 end:0x803B8844 + .bss start:0x804A2688 end:0x804A26B8 melee/ty/toy.c: - .text start:0x80305058 end:0x803124BC - .rodata start:0x803B8810 end:0x803B8958 + .text start:0x80304870 end:0x803124BC + .rodata start:0x803B8844 end:0x803B8958 .data start:0x803FDD18 end:0x803FE880 + .bss start:0x804A26B8 end:0x804A284C .sdata start:0x804D5A40 end:0x804D5A78 .sdata2 start:0x804DDCC8 end:0x804DDE28 melee/ty/tylist.c: .text start:0x803124BC end:0x80314AA8 .data start:0x803FE880 end:0x803FEA10 + .bss start:0x804A284C end:0x804A2D98 .sdata start:0x804D5A78 end:0x804D5A90 .sdata2 start:0x804DDE28 end:0x804DDEA0 @@ -4372,6 +4379,7 @@ melee/ty/tyfigupon.c: .text start:0x80314AA8 end:0x803182D4 .rodata start:0x803B8958 end:0x803B8988 .data start:0x803FEA10 end:0x803FEFF0 + .bss start:0x804A2D98 end:0x804A2E98 .sdata start:0x804D5A90 end:0x804D5AA8 .sdata2 start:0x804DDEA0 end:0x804DDF70 @@ -4379,8 +4387,8 @@ melee/ty/tydisplay.c: .text start:0x803182D4 end:0x8031C99C .rodata start:0x803B8988 end:0x803B8B90 .data start:0x803FEFF0 end:0x803FFDA0 + .bss start:0x804A2E98 end:0x804A2EA8 .sdata start:0x804D5AA8 end:0x804D5AC8 - .sbss start:0x804D6F2C end:0x804D6F30 .sdata2 start:0x804DDF70 end:0x804DE040 melee/vi/vi.c: @@ -4397,7 +4405,7 @@ melee/vi/vi0401.c: .text start:0x8031D020 end:0x8031D6E4 .data start:0x80400038 end:0x80400088 .sdata start:0x804D5AC8 end:0x804D5AD8 - .sbss start:0x804D6F3C end:0x804D6F68 + .sbss start:0x804D6F48 end:0x804D6F68 .sdata2 start:0x804DE050 end:0x804DE058 melee/vi/vi0402.c: diff --git a/config/GALE01/symbols.txt b/config/GALE01/symbols.txt index 7ce8e08f19..aa5da745b8 100644 --- a/config/GALE01/symbols.txt +++ b/config/GALE01/symbols.txt @@ -20196,9 +20196,9 @@ it_803B8730 = .rodata:0x803B8730; // type:object size:0xC scope:global data:4byt @208 = .rodata:0x803B8780; // type:object size:0x10 scope:local data:4byte un_803B8790 = .rodata:0x803B8790; // type:object size:0xC scope:global data:4byte un_803B879C = .rodata:0x803B879C; // type:object size:0xC scope:global data:4byte -un_803B87A8 = .rodata:0x803B87A8; // type:object size:0x34 scope:global data:4byte -un_803B87DC = .rodata:0x803B87DC; // type:object size:0x34 scope:global data:4byte -un_803B8810 = .rodata:0x803B8810; // type:object size:0x34 scope:global data:4byte +un_803B87A8 = .rodata:0x803B87A8; // type:object size:0x34 scope:global data:short +un_803B87DC = .rodata:0x803B87DC; // type:object size:0x34 scope:global data:short +un_803B8810 = .rodata:0x803B8810; // type:object size:0x34 scope:global data:short un_803B8844 = .rodata:0x803B8844; // type:object size:0x14 scope:global data:4byte un_803B8858 = .rodata:0x803B8858; // type:object size:0xC scope:global data:4byte un_803B8864 = .rodata:0x803B8864; // type:object size:0x38 scope:global data:4byte @@ -21195,7 +21195,8 @@ ftLk_Init_AnimDatFilename = .data:0x803C8224; // type:object size:0xB scope:glob @231 = .data:0x803C8284; // type:object size:0x1B scope:local data:string ftLk_Init_DemoMotionFilenames = .data:0x803C82A0; // type:object size:0x10 scope:global ftLk_Init_CostumeStrings = .data:0x803C82B0; // type:object size:0x3C scope:global -ftLk_Init_803C82EC = .data:0x803C82EC; // type:object size:0x7C scope:global +ftLk_Init_803C82EC = .data:0x803C82EC; // type:object size:0x18 scope:global +pad = .data:0x803C8304; // type:object size:0x64 scope:local ftKb_Init_MotionStateTable = .data:0x803C8368; // type:object size:0x1960 scope:global ftKb_Init_803C9CC8 = .data:0x803C9CC8; // type:object size:0x108 scope:global ftKb_Init_803C9DD0 = .data:0x803C9DD0; // type:object size:0x84 scope:global @@ -24669,17 +24670,27 @@ un_803FE604 = .data:0x803FE604; // type:object size:0x14 scope:global un_803FE618 = .data:0x803FE618; // type:object size:0x4C scope:global un_803FE664 = .data:0x803FE664; // type:object size:0x14 scope:global un_803FE678 = .data:0x803FE678; // type:object size:0xF8 scope:global -str_TyDataf_dat = .data:0x803FE770; // type:object size:0xC scope:global data:string -str_tyModelFileTbl = .data:0x803FE77C; // type:object size:0x10 scope:global data:string -str_tyModelFileUsTbl = .data:0x803FE78C; // type:object size:0x14 scope:global data:string -un_803FE7A0 = .data:0x803FE7A0; // type:object size:0xF scope:global data:string -un_803FE7B0 = .data:0x803FE7B0; // type:object size:0x10 scope:global data:string -un_803FE7C0 = .data:0x803FE7C0; // type:object size:0x22 scope:global data:string -un_803FE7E4 = .data:0x803FE7E4; // type:object size:0x9C scope:global -un_803FE880 = .data:0x803FE880; // type:object size:0x50 scope:global -un_803FE8D0 = .data:0x803FE8D0; // type:object size:0x1D scope:global data:string -un_803FE8F0 = .data:0x803FE8F0; // type:object size:0x9 scope:global data:string -un_803FE8FC = .data:0x803FE8FC; // type:object size:0x114 scope:global +str_TyDataf_dat = .data:0x803FE770; // type:object size:0xC scope:local data:string +str_tyModelFileTbl = .data:0x803FE77C; // type:object size:0x10 scope:local data:string +str_tyModelFileUsTbl = .data:0x803FE78C; // type:object size:0x14 scope:local data:string +un_803FE7A0 = .data:0x803FE7A0; // type:object size:0xF scope:local data:string +un_803FE7B0 = .data:0x803FE7B0; // type:object size:0x10 scope:local data:string +un_803FE7C0 = .data:0x803FE7C0; // type:object size:0x22 scope:local data:string +un_803FE7E4 = .data:0x803FE7E4; // type:object size:0x9C scope:local data:string +lbl_803FE880 = .data:0x803FE880; // type:object size:0x11 scope:local data:string +lbl_803FE894 = .data:0x803FE894; // type:object size:0x12 scope:local data:string +lbl_803FE8A8 = .data:0x803FE8A8; // type:object size:0x13 scope:local data:string +lbl_803FE8BC = .data:0x803FE8BC; // type:object size:0x13 scope:local data:string +un_803FE8D0 = .data:0x803FE8D0; // type:object size:0x1D scope:local data:string +un_803FE8F0 = .data:0x803FE8F0; // type:object size:0x9 scope:local data:string +lbl_803FE8FC = .data:0x803FE8FC; // type:object size:0x2D scope:local data:string +lbl_803FE92C = .data:0x803FE92C; // type:object size:0x1F scope:local data:string +lbl_803FE94C = .data:0x803FE94C; // type:object size:0x1C scope:local data:string +lbl_803FE968 = .data:0x803FE968; // type:object size:0x24 scope:local data:string +lbl_803FE98C = .data:0x803FE98C; // type:object size:0x1F scope:local data:string +lbl_803FE9AC = .data:0x803FE9AC; // type:object size:0x1E scope:local data:string +lbl_803FE9CC = .data:0x803FE9CC; // type:object size:0x22 scope:local data:string +lbl_803FE9F0 = .data:0x803FE9F0; // type:object size:0x19 scope:local data:string un_803FEA10 = .data:0x803FEA10; // type:object size:0xE0 scope:local jumptable_803FEAF0 = .data:0x803FEAF0; // type:object size:0x28 scope:local lbl_803FEB18 = .data:0x803FEB18; // type:object size:0x24 @@ -25995,7 +26006,7 @@ un_804A1F10 = .bss:0x804A1F10; // type:object size:0x34 scope:global data:4byte un_804A1F48 = .bss:0x804A1F48; // type:object size:0x10 scope:global data:2byte un_804A1F58 = .bss:0x804A1F58; // type:object size:0x80 scope:global data:4byte un_804A1FD8 = .bss:0x804A1FD8; // type:object size:0x6B0 scope:global -un_804A2688 = .bss:0x804A2688; // type:object size:0x30 scope:global +un_804A2688 = .bss:0x804A2688; // type:object size:0x2C scope:global un_804A26B8 = .bss:0x804A26B8; // type:object size:0xC scope:global align:4 data:float un_804A26C4 = .bss:0x804A26C4; // type:object size:0x8C scope:global un_804A2750 = .bss:0x804A2750; // type:object size:0xFC scope:global @@ -28363,7 +28374,7 @@ mnCount_804D6C70 = .sbss:0x804D6C70; // type:object size:0x8 scope:global data:4 mnInfo_804D6C78 = .sbss:0x804D6C78; // type:object size:0x8 scope:global data:4byte mnInfoBonus_804D6C80 = .sbss:0x804D6C80; // type:object size:0x8 scope:global data:byte mnGallery_804D6C88 = .sbss:0x804D6C88; // type:object size:0x4 scope:global data:4byte -mnGallery_804D6C8C = .sbss:0x804D6C8C; // type:object size:0x4 scope:global data:4byte +rate_table = .sbss:0x804D6C8C; // type:object size:0x4 scope:local data:4byte mnStageSel_804D6C90 = .sbss:0x804D6C90; // type:object size:0x4 scope:global data:4byte mnStageSel_804D6C94 = .sbss:0x804D6C94; // type:object size:0x4 scope:global data:4byte mnStageSel_804D6C98 = .sbss:0x804D6C98; // type:object size:0x4 scope:global data:4byte @@ -28462,15 +28473,15 @@ un_804D6E08 = .sbss:0x804D6E08; // type:object size:0x4 scope:global data:4byte un_804D6E0C = .sbss:0x804D6E0C; // type:object size:0x4 scope:global data:4byte un_804D6E10 = .sbss:0x804D6E10; // type:object size:0x4 scope:global data:4byte un_804D6E14 = .sbss:0x804D6E14; // type:object size:0x4 scope:global data:4byte -un_804D6E18 = .sbss:0x804D6E18; // type:object size:0x4 scope:global data:4byte -un_804D6E1C = .sbss:0x804D6E1C; // type:object size:0x4 scope:global data:4byte +devtext_drawlist = .sbss:0x804D6E18; // type:object size:0x4 scope:global data:4byte +devtext_gobj = .sbss:0x804D6E1C; // type:object size:0x4 scope:global data:4byte un_804D6E20 = .sbss:0x804D6E20; // type:object size:0x4 scope:global data:4byte un_804D6E24 = .sbss:0x804D6E24; // type:object size:0x4 scope:global data:4byte un_804D6E28 = .sbss:0x804D6E28; // type:object size:0x4 scope:global data:4byte un_804D6E2C = .sbss:0x804D6E2C; // type:object size:0x4 scope:global data:4byte un_804D6E30 = .sbss:0x804D6E30; // type:object size:0x4 scope:global data:4byte un_804D6E34 = .sbss:0x804D6E34; // type:object size:0x4 scope:global data:4byte -un_804D6E38 = .sbss:0x804D6E38; // type:object size:0x8 scope:global data:4byte +devtext_poolhead = .sbss:0x804D6E38; // type:object size:0x4 scope:global data:4byte un_804D6E40 = .sbss:0x804D6E40; // type:object size:0x4 scope:global data:4byte un_804D6E44 = .sbss:0x804D6E44; // type:object size:0x4 scope:global data:4byte un_804D6E48 = .sbss:0x804D6E48; // type:object size:0x4 scope:global data:4byte @@ -28576,7 +28587,7 @@ un_804D6FF8 = .sbss:0x804D6FF8; // type:object size:0x4 scope:global data:4byte un_804D6FFC = .sbss:0x804D6FFC; // type:object size:0x1 scope:global data:byte un_804D6FFD = .sbss:0x804D6FFD; // type:object size:0x1 scope:global data:byte un_804D7000 = .sbss:0x804D7000; // type:object size:0x4 scope:global data:4byte -un_804D7004 = .sbss:0x804D7004; // type:object size:0xC scope:global data:byte +un_804D7004 = .sbss:0x804D7004; // type:object size:0x4 scope:global data:byte un_804D7010 = .sbss:0x804D7010; // type:object size:0x4 scope:global data:4byte un_804D7014 = .sbss:0x804D7014; // type:object size:0x4 scope:global data:4byte un_804D7018 = .sbss:0x804D7018; // type:object size:0x4 scope:global data:4byte @@ -28587,7 +28598,7 @@ un_804D7028 = .sbss:0x804D7028; // type:object size:0x4 scope:global data:4byte un_804D702C = .sbss:0x804D702C; // type:object size:0x4 scope:global data:4byte un_804D7030 = .sbss:0x804D7030; // type:object size:0x4 scope:global data:4byte un_804D7034 = .sbss:0x804D7034; // type:object size:0x4 scope:global data:4byte -un_804D7038 = .sbss:0x804D7038; // type:object size:0x8 scope:global data:byte +un_804D7038 = .sbss:0x804D7038; // type:object size:0x4 scope:global data:byte un_804D7040 = .sbss:0x804D7040; // type:object size:0x4 scope:global data:4byte un_804D7044 = .sbss:0x804D7044; // type:object size:0x4 scope:global data:4byte un_804D7048 = .sbss:0x804D7048; // type:object size:0x4 scope:global data:4byte diff --git a/configure.py b/configure.py index fab503796c..307900f7f4 100755 --- a/configure.py +++ b/configure.py @@ -631,6 +631,7 @@ def MatchingFor(*versions): Object(Matching, "melee/ft/ftmaterial.c"), Object(Matching, "melee/ft/ftcolanim.c"), Object(Matching, "melee/ft/ftdevice.c"), + Object(NonMatching, "melee/ft/ft_459A.c"), Object(NonMatching, "melee/ft/chara/ftCommon/ftCo_Bury.c"), Object(Matching, "melee/ft/chara/ftCommon/ftCo_FlyReflect.c"), Object(Matching, "melee/ft/chara/ftCommon/ftCo_PassiveWall.c"), diff --git a/src/melee/ft/chara/ftLink/ftLk_Init.c b/src/melee/ft/chara/ftLink/ftLk_Init.c index 76acc7d167..92ef2a7e15 100644 --- a/src/melee/ft/chara/ftLink/ftLk_Init.c +++ b/src/melee/ft/chara/ftLink/ftLk_Init.c @@ -294,7 +294,8 @@ Fighter_CostumeStrings ftLk_Init_CostumeStrings[] = { { ftLk_Init_803C81E0, ftLk_Init_803C81EC, ftLk_Init_803C8204 }, }; -int ftLk_Init_803C82EC[31] = { 0 }; +/* 3C82EC */ UnkCostumeStruct ftLk_Init_803C82EC = { 0 }; +/* 3C8304 */ static int pad[25] = { 0 }; bool ftLk_Init_BoomerangExists(HSD_GObj* gobj) { diff --git a/src/melee/ft/chara/ftLink/ftLk_Init.h b/src/melee/ft/chara/ftLink/ftLk_Init.h index a1b5d908d8..45a0b9acfa 100644 --- a/src/melee/ft/chara/ftLink/ftLk_Init.h +++ b/src/melee/ft/chara/ftLink/ftLk_Init.h @@ -32,5 +32,6 @@ /* 3C8224 */ extern char ftLk_Init_AnimDatFilename[]; /* 3C82A0 */ extern Fighter_DemoStrings ftLk_Init_DemoMotionFilenames; /* 3C82B0 */ extern Fighter_CostumeStrings ftLk_Init_CostumeStrings[]; +/* 3C82EC */ extern UnkCostumeStruct ftLk_Init_803C82EC; #endif diff --git a/src/melee/ft/chara/ftPurin/ftPr_Init.c b/src/melee/ft/chara/ftPurin/ftPr_Init.c index 45bbad031d..1fb246f991 100644 --- a/src/melee/ft/chara/ftPurin/ftPr_Init.c +++ b/src/melee/ft/chara/ftPurin/ftPr_Init.c @@ -14,10 +14,10 @@ #include "forward.h" #include "ft/fighter.h" -#include "ft/ft_0852.h" #include "ft/ft_0877.h" #include "ft/ftanim.h" #include "ft/ftcamera.h" +#include "ft/ftdata.h" #include "ft/ftdynamics.h" #include "ft/ftparts.h" #include "ft/types.h" diff --git a/src/melee/ft/chara/ft_459A.h b/src/melee/ft/chara/ft_459A.h new file mode 100644 index 0000000000..00e477568c --- /dev/null +++ b/src/melee/ft/chara/ft_459A.h @@ -0,0 +1,47 @@ +/** @file + * Each of these belong in their respective character file. They are all in + * .bss, except for Link's, which is initialized to zero and so appears in + * .data. See #CostumeListsForeachCharacter to determine indices. They are of + * variable size, but the data is used uniformly across all characters, so the + * first 0x18 bytes are probably used by #UnkCostumeStruct and then the rest is + * character-specific .bss data used elsewhere. + */ +#ifndef GALE01_4599F0 +#define GALE01_4599F0 + +#include "ft/forward.h" + +/* 4599F0 */ extern UnkCostumeStruct lbl_804599F0; +/* 459A98 */ extern UnkCostumeStruct ft_80459A98; +/* 459B28 */ extern UnkCostumeStruct ft_80459B28; +/* 459C10 */ extern UnkCostumeStruct ft_80459C10; +/* 459CA0 */ extern UnkCostumeStruct ft_80459CA0; +/* 459D18 */ extern UnkCostumeStruct ft_80459D18; +/* 459D90 */ extern UnkCostumeStruct ft_80459D90; +/* 459DF0 */ extern UnkCostumeStruct ft_80459DF0; +/* 459E68 */ extern UnkCostumeStruct ft_80459E68; +/* 459EC8 */ extern UnkCostumeStruct ft_80459EC8; +/* 459F28 */ extern UnkCostumeStruct ft_80459F28; +/* 459F88 */ extern UnkCostumeStruct ft_80459F88; +/* 45A000 */ extern UnkCostumeStruct ft_8045A000; +/* 45A090 */ extern UnkCostumeStruct ft_8045A090; +/* 45A0F0 */ extern UnkCostumeStruct ft_8045A0F0; +/* 45A168 */ extern UnkCostumeStruct ft_8045A168; +/* 45A1F8 */ extern UnkCostumeStruct ft_8045A1F8; +/* 45A270 */ extern UnkCostumeStruct ft_8045A270; +/* 45A2D0 */ extern UnkCostumeStruct ft_8045A2D0; +/* 45A330 */ extern UnkCostumeStruct ft_8045A330; +/* 45A3A8 */ extern UnkCostumeStruct ft_8045A3A8; +/* 45A420 */ extern UnkCostumeStruct ft_8045A420; +/* 45A480 */ extern UnkCostumeStruct ft_8045A480; +/* 45A4E0 */ extern UnkCostumeStruct ft_8045A4E0; +/* 45A540 */ extern UnkCostumeStruct ft_8045A540; +/* 45A5B8 */ extern UnkCostumeStruct ft_8045A5B8; +/* 45A630 */ extern UnkCostumeStruct ft_8045A630; +/* 45A648 */ extern UnkCostumeStruct ft_8045A648; +/* 45A660 */ extern UnkCostumeStruct ft_8045A660; +/* 45A678 */ extern UnkCostumeStruct ft_8045A678; +/* 45A690 */ extern UnkCostumeStruct ft_8045A690; +/* 45A6A8 */ extern UnkCostumeStruct ft_8045A6A8; + +#endif diff --git a/src/melee/ft/forward.h b/src/melee/ft/forward.h index 6e1d53f7e3..da84a3ad6b 100644 --- a/src/melee/ft/forward.h +++ b/src/melee/ft/forward.h @@ -42,6 +42,7 @@ typedef struct IKState IKState; typedef struct KirbyHatStruct KirbyHatStruct; typedef struct MotionState MotionState; typedef struct TempS TempS; +typedef struct UnkCostumeStruct UnkCostumeStruct; typedef struct UnkFloat6_Camera UnkFloat6_Camera; typedef struct UnkPlBonusBits UnkPlBonusBits; typedef u32 MotionFlags; diff --git a/src/melee/ft/ft_0852.c b/src/melee/ft/ft_0852.c index fa36b9ea99..a548ef2f52 100644 --- a/src/melee/ft/ft_0852.c +++ b/src/melee/ft/ft_0852.c @@ -2,6 +2,7 @@ #include "ft/forward.h" +#include "ft/ftdata.h" #include "ft/inlines.h" #include "ft/types.h" diff --git a/src/melee/ft/ft_0852.h b/src/melee/ft/ft_0852.h index 448f91c98d..94ff8c5687 100644 --- a/src/melee/ft/ft_0852.h +++ b/src/melee/ft/ft_0852.h @@ -20,8 +20,4 @@ extern int ft_8045996C[FTKIND_MAX]; /* 0852B0 */ void ft_800852B0(void); /* 08549C */ void ft_8008549C(void); -extern struct UnkCostumeList CostumeListsForeachCharacter[FTKIND_MAX]; -extern struct ftData_UnkCountStruct ftData_Table_Unk0[FTKIND_MAX]; -extern struct ftData_UnkCountStruct ftData_UnkIntPairs[FTKIND_MAX]; - #endif diff --git a/src/melee/ft/ftdata.c b/src/melee/ft/ftdata.c index ee3b29aca9..0a833ea171 100644 --- a/src/melee/ft/ftdata.c +++ b/src/melee/ft/ftdata.c @@ -1,6 +1,7 @@ #include "ftdata.h" #include "ft_0877.h" +#include "ft_459A.h" #include @@ -134,173 +135,40 @@ extern int ft_8045996C[FTKIND_MAX]; -/* 4599F0 */ extern UnkCostumeStruct lbl_804599F0; -/* 459A98 */ extern UnkCostumeStruct ft_80459A98; -/* 459B28 */ extern UnkCostumeStruct ft_80459B28; -/* 459C10 */ extern UnkCostumeStruct ft_80459C10; -/* 459CA0 */ extern UnkCostumeStruct ft_80459CA0; -/* 45A090 */ extern UnkCostumeStruct ft_8045A090; -/* 3C82EC */ extern UnkCostumeStruct ftLk_Init_803C82EC; -/* 459D18 */ extern UnkCostumeStruct ft_80459D18; -/* 459D90 */ extern UnkCostumeStruct ft_80459D90; -/* 459DF0 */ extern UnkCostumeStruct ft_80459DF0; -/* 459E68 */ extern UnkCostumeStruct ft_80459E68; -/* 459EC8 */ extern UnkCostumeStruct ft_80459EC8; -/* 459F28 */ extern UnkCostumeStruct ft_80459F28; -/* 459F88 */ extern UnkCostumeStruct ft_80459F88; -/* 45A000 */ extern UnkCostumeStruct ft_8045A000; -/* 45A0F0 */ extern UnkCostumeStruct ft_8045A0F0; -/* 45A168 */ extern UnkCostumeStruct ft_8045A168; -/* 45A1F8 */ extern UnkCostumeStruct ft_8045A1F8; -/* 45A270 */ extern UnkCostumeStruct ft_8045A270; -/* 45A2D0 */ extern UnkCostumeStruct ft_8045A2D0; -/* 45A330 */ extern UnkCostumeStruct ft_8045A330; -/* 45A3A8 */ extern UnkCostumeStruct ft_8045A3A8; -/* 45A420 */ extern UnkCostumeStruct ft_8045A420; -/* 45A480 */ extern UnkCostumeStruct ft_8045A480; -/* 45A4E0 */ extern UnkCostumeStruct ft_8045A4E0; -/* 45A540 */ extern UnkCostumeStruct ft_8045A540; -/* 45A5B8 */ extern UnkCostumeStruct ft_8045A5B8; -/* 45A630 */ extern UnkCostumeStruct ft_8045A630; -/* 45A648 */ extern UnkCostumeStruct ft_8045A648; -/* 45A660 */ extern UnkCostumeStruct ft_8045A660; -/* 45A678 */ extern UnkCostumeStruct ft_8045A678; -/* 45A690 */ extern UnkCostumeStruct ft_8045A690; -/* 45A6A8 */ extern UnkCostumeStruct ft_8045A6A8; - /* 3C0EC0 */ struct UnkCostumeList CostumeListsForeachCharacter[FTKIND_MAX] = { - { - &lbl_804599F0, - 5, - }, - { - &ft_80459B28, - 4, - }, - { - &ft_80459A98, - 6, - }, - { - &ft_80459CA0, - 5, - }, - { - &ft_80459C10, - 6, - }, - { - &ft_8045A090, - 4, - }, - { - &ftLk_Init_803C82EC, - 5, - }, - { - &ft_80459D18, - 5, - }, - { - &ft_80459D90, - 4, - }, - { - &ft_80459DF0, - 5, - }, - { - &ft_80459E68, - 4, - }, - { - &ft_80459EC8, - 4, - }, - { - &ft_80459F28, - 4, - }, - { - &ft_80459F88, - 5, - }, - { - &ft_8045A000, - 6, - }, - { - &ft_8045A1F8, - 5, - }, - { - &ft_8045A2D0, - 4, - }, - { - &ft_8045A270, - 4, - }, - { - &ft_8045A0F0, - 5, - }, - { - &ft_8045A168, - 5, - }, - { - &ft_8045A330, - 5, - }, - { - &ft_8045A3A8, - 5, - }, - { - &ft_8045A420, - 4, - }, - { - &ft_8045A480, - 4, - }, - { - &ft_8045A4E0, - 4, - }, - { - &ft_8045A540, - 5, - }, - { - &ft_8045A5B8, - 5, - }, - { - &ft_8045A690, - 1, - }, - { - &ft_8045A6A8, - 1, - }, - { - &ft_8045A630, - 1, - }, - { - &ft_8045A648, - 1, - }, - { - &ft_8045A660, - 1, - }, - { - &ft_8045A678, - 1, - }, + { &lbl_804599F0, 5 }, // Mario + { &ft_80459B28, 4 }, // Fox + { &ft_80459A98, 6 }, // Captain + { &ft_80459CA0, 5 }, // Donkey + { &ft_80459C10, 6 }, // Kirby + { &ft_8045A090, 4 }, // Koopa + { &ftLk_Init_803C82EC, 5 }, // Link + { &ft_80459D18, 5 }, // Seak + { &ft_80459D90, 4 }, // Ness + { &ft_80459DF0, 5 }, // Peach + { &ft_80459E68, 4 }, // Popo + { &ft_80459EC8, 4 }, // Nana + { &ft_80459F28, 4 }, // Pikachu + { &ft_80459F88, 5 }, // Samus + { &ft_8045A000, 6 }, // Yoshi + { &ft_8045A1F8, 5 }, // Purin + { &ft_8045A2D0, 4 }, // Mewtwo + { &ft_8045A270, 4 }, // Luigi + { &ft_8045A0F0, 5 }, // Mars + { &ft_8045A168, 5 }, // Zelda + { &ft_8045A330, 5 }, // CLink + { &ft_8045A3A8, 5 }, // DrMario + { &ft_8045A420, 4 }, // Falco + { &ft_8045A480, 4 }, // Pichu + { &ft_8045A4E0, 4 }, // GameWatch + { &ft_8045A540, 5 }, // Ganon + { &ft_8045A5B8, 5 }, // Emblem + { &ft_8045A690, 1 }, // MasterH + { &ft_8045A6A8, 1 }, // CrezyH + { &ft_8045A630, 1 }, // Boy + { &ft_8045A648, 1 }, // Girl + { &ft_8045A660, 1 }, // GKoops + { &ft_8045A678, 1 } // Sandbag }; ftData_UnkCountStruct ftData_Table_Unk0[FTKIND_MAX] = { diff --git a/src/melee/ft/ftdata.h b/src/melee/ft/ftdata.h index 7fbbff2127..29d79802a8 100644 --- a/src/melee/ft/ftdata.h +++ b/src/melee/ft/ftdata.h @@ -10,10 +10,6 @@ #include -extern HSD_GObjEvent ftData_SpecialN[FTKIND_MAX]; -extern HSD_GObjEvent ftData_SpecialLw[FTKIND_MAX]; -extern HSD_GObjEvent ftData_SpecialHi[FTKIND_MAX]; - /* 085560 */ void ftData_80085560(int idx, int increment); /* 0855C8 */ void ftData_800855C8(FighterKind kind, u8 color); /* 08572C */ void ftData_8008572C(FighterKind); @@ -30,7 +26,12 @@ extern HSD_GObjEvent ftData_SpecialHi[FTKIND_MAX]; /* 085FD4 */ struct ftData_80085FD4_ret* ftData_80085FD4(Fighter* fp, FtMotionId msid); /* 086060 */ Fighter* ftData_80086060(Fighter* arg0); +/* 3C0EC0 */ extern struct UnkCostumeList + CostumeListsForeachCharacter[FTKIND_MAX]; +/* 3C0FC8 */ extern struct ftData_UnkCountStruct ftData_Table_Unk0[FTKIND_MAX]; /* 3C10D0 */ extern Event ftData_Table_Unk1[FTKIND_MAX]; +/* 3C10D0 */ extern struct ftData_UnkCountStruct + ftData_UnkIntPairs[FTKIND_MAX]; /* 3C1154 */ extern HSD_GObjEvent ftData_OnLoad[FTKIND_MAX]; /* 3C11D8 */ extern HSD_GObjEvent ftData_OnDeath[FTKIND_MAX]; /* 3C125C */ extern HSD_GObjEvent ftData_OnUserDataRemove[FTKIND_MAX]; @@ -39,6 +40,9 @@ extern HSD_GObjEvent ftData_SpecialHi[FTKIND_MAX]; /* 3C14F0 */ extern HSD_GObjEvent ftData_SpecialAirLw[FTKIND_MAX]; /* 3C1574 */ extern HSD_GObjEvent ftData_SpecialAirS[FTKIND_MAX]; /* 3C15F8 */ extern HSD_GObjEvent ftData_SpecialAirN[FTKIND_MAX]; +/* 3C167C */ extern HSD_GObjEvent ftData_SpecialN[FTKIND_MAX]; +/* 3C1700 */ extern HSD_GObjEvent ftData_SpecialLw[FTKIND_MAX]; +/* 3C1784 */ extern HSD_GObjEvent ftData_SpecialHi[FTKIND_MAX]; /* 3C1808 */ extern HSD_GObjEvent ftData_OnAbsorb[FTKIND_MAX]; /* 3C188C */ extern Fighter_ItemEvent ftData_OnItemPickupExt[FTKIND_MAX]; /* 3C1DB4 */ extern HSD_GObjEvent ftData_UnkMotionStates3[FTKIND_MAX]; diff --git a/src/melee/ft/types.h b/src/melee/ft/types.h index 28e3d47d78..0d5b48b9da 100644 --- a/src/melee/ft/types.h +++ b/src/melee/ft/types.h @@ -841,14 +841,14 @@ typedef struct itPickup { /* +20 */ Vec4 air_light_offset; } itPickup; -typedef struct { +struct UnkCostumeStruct { /* +0 */ HSD_Joint* joint; /* +4 */ HSD_MatAnimJoint* x4; /* +8 */ u32 pad_x8; // Probably a pointer. /* +C */ u32 pad_xC; /* +10 */ u32 pad_x10; /* +14 */ HSD_Archive* x14_archive; -} UnkCostumeStruct; +}; struct UnkCostumeList { UnkCostumeStruct* costume_list; diff --git a/src/melee/if/textdraw.c b/src/melee/if/textdraw.c index 3447189983..169bb0ef0d 100644 --- a/src/melee/if/textdraw.c +++ b/src/melee/if/textdraw.c @@ -1,5 +1,7 @@ #include "textdraw.h" +#include "platform.h" + #include "if/types.h" #include @@ -52,21 +54,25 @@ }; /// .bss -/* 4A1FD8 */ static DevText devtext_pool[32]; + +/// @note Not necessarily a struct but definitely 0x6B0 unallocated. +/// #DevText is definitely size 0x34 based on #DevText_InitPool. +/* 4A1FD8 */ struct DevText_Pool { + struct DevText entries[32]; + char pad[0x6B0 - 0x680]; +} devtext_pool; +STATIC_ASSERT(sizeof(struct DevText_Pool) == 0x6B0); /// .sbss -/* 4D6E18 */ static DevText* un_804D6E18; -#define devtext_drawlist un_804D6E18 -/* 4D6E1C */ static HSD_GObj* un_804D6E1C; -#define devtext_gobj un_804D6E1C +/* 4D6E18 */ static DevText* devtext_drawlist; +/* 4D6E1C */ static HSD_GObj* devtext_gobj; /* 4D6E20 */ static HSD_CObj* devtext_cobj; /* 4D6E24 */ static int devtext_setup_classifier; /* 4D6E28 */ static int devtext_setup_p_link; /* 4D6E2C */ static int devtext_setup_priority; /* 4D6E30 */ static int devtext_setup_gx_link; /* 4D6E34 */ static int devtext_setup_render_priority; -/* 4D6E38 */ static DevText* un_804D6E38; -#define devtext_poolhead un_804D6E38 +/* 4D6E38 */ static DevText* devtext_poolhead; int DevText_StrLen(char* str) { @@ -121,15 +127,15 @@ HSD_GObj* DevText_GetGObj(void) #pragma dont_inline on void DevText_InitPool(void) { - DevText* text = devtext_pool; + DevText* text = devtext_pool.entries; int i; - devtext_pool[0].prev = NULL; + devtext_pool.entries[0].prev = NULL; for (i = 0; i < 31; i++) { - devtext_pool[i + 1].prev = &devtext_pool[i]; - devtext_pool[i].next = &devtext_pool[i + 1]; + devtext_pool.entries[i + 1].prev = &devtext_pool.entries[i]; + devtext_pool.entries[i].next = &devtext_pool.entries[i + 1]; } - devtext_pool[31].next = NULL; - devtext_poolhead = devtext_pool; + devtext_pool.entries[31].next = NULL; + devtext_poolhead = devtext_pool.entries; devtext_drawlist = NULL; } #pragma pop diff --git a/src/melee/if/textlib.c b/src/melee/if/textlib.c index dc2eadf46d..8c5dd1e5fa 100644 --- a/src/melee/if/textlib.c +++ b/src/melee/if/textlib.c @@ -1,15 +1,13 @@ #include "textlib.h" +#include "platform.h" + #include "baselib/controller.h" #include "baselib/debug.h" -#include "dolphin/os.h" -#include "gm/gm_unsplit.h" -#include "gm/gmmain_lib.h" #include "if/textdraw.h" #include "if/types.h" #include "lb/lb_00B0.h" #include "lb/lbaudio_ax.h" -#include "lb/lblanguage.h" #include "ty/toy.h" #include @@ -31,9 +29,13 @@ #include #include +struct unk_series { + s16 values[26]; +}; + /// ? -/* 4D6E18 */ extern DevText* un_804D6E18; -/* 4D6E38 */ extern DevText* un_804D6E38; +/* 4D6E18 */ extern DevText* devtext_drawlist; +/* 4D6E38 */ extern DevText* devtext_poolhead; /* 4DDC88 */ extern GXColor un_804DDC88; /* 4DDC8C */ extern GXColor un_804DDC8C; /* 4DDC90 */ extern GXColor un_804DDC90; @@ -41,16 +43,11 @@ /* 4DDC98 */ extern GXColor un_804DDC98; /* 4DDC9C */ extern f32 un_804DDC9C; /* 4DDCA0 */ extern f32 un_804DDCA0; -unsigned short un_804A26B8[1000]; -unsigned short un_804A284C[1000]; + short* un_804D6EB4; struct un_80304138_objalloc_t* un_804D6E40; struct un_80304138_objalloc_t_x8* un_804D6E48; -struct idk { - short idk[26]; -} un_803B8810; -struct idk un_803B87DC; -struct idk un_803B87A8; + unsigned char un_804D6E4C; /// .bss @@ -72,7 +69,7 @@ GXColor un_804D5A14 = { 0xA0, 0xA0, 0xFF, 0xFF }; static inline DevText* find_by_id(char id) { DevText* text; - for (text = un_804D6E18; text != NULL; text = text->next) { + for (text = devtext_drawlist; text != NULL; text = text->next) { if (text->id == id) { return text; } @@ -90,9 +87,9 @@ DevText* DevText_Create(char id, int x, int y, int w, int h, char* buf) if ((text = find_by_id(id))) { return NULL; } - text = un_804D6E38; + text = devtext_poolhead; if (text != NULL) { - un_804D6E38 = text->next; + devtext_poolhead = text->next; } else { text = NULL; } @@ -1012,297 +1009,64 @@ bool un_80304510(void) bool un_803045A0(void) { - struct idk sp = un_803B87A8; + s16 sp[] = { + 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, + 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, + }; unsigned int i; unsigned int count = 0; - for (i = 0; i < 26; i++) { - if (un_803048C0(sp.idk[i])) { + for (i = 0; i < ARRAY_SIZE(sp); i++) { + if (un_803048C0(sp[i])) { count++; } } - if (count == 26) { + if (count == ARRAY_SIZE(sp)) { return 1; } else { return 0; } } +/// @todo Duplicate code of #un_803045A0 with different data bool un_80304690(void) { - struct idk sp = un_803B87DC; + s16 sp[] = { + 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, + 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, + }; + unsigned int i; unsigned int count = 0; - for (i = 0; i < 26; i++) { - if (un_803048C0(sp.idk[i])) { + for (i = 0; i < ARRAY_SIZE(sp); i++) { + if (un_803048C0(sp[i])) { count++; } } - if (count == 26) { + if (count == ARRAY_SIZE(sp)) { return 1; } else { return 0; } } +/// @todo Duplicate code of #un_803045A0 with different data bool un_80304780(void) { - struct idk sp = un_803B8810; + s16 sp[] = { + 2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, + 41, 44, 47, 50, 53, 56, 59, 62, 65, 68, 71, 74, 77, + }; + unsigned int i; unsigned int count = 0; - for (i = 0; i < 26; i++) { - if (un_803048C0(sp.idk[i])) { + for (i = 0; i < ARRAY_SIZE(sp); i++) { + if (un_803048C0(sp[i])) { count++; } } - if (count == 26) { + if (count == ARRAY_SIZE(sp)) { return 1; } else { return 0; } } - -int un_GetTrophyTotal(void) -{ - if (gm_8016B498() || gm_801A4310() == GM_TOY_LOTTERY) { - return (short) un_804A284C[0x258 / 2]; - } else { - return *gmMainLib_8015CC90(); - } -} - -inline static unsigned short* idk(void) -{ - if (gm_8016B498() || gm_801A4310() == GM_TOY_LOTTERY) { - return &un_804A284C[5]; - } else { - return gmMainLib_8015CC78(); - } -} - -int un_803048C0(int arg0) -{ - return idk()[arg0] & 0xFF; -} - -bool un_80304924(int arg0) -{ - return idk()[arg0] & 0x8000; -} - -void un_80304988(int arg0) -{ - unsigned short* v = idk(); - v[arg0] = v[arg0] ^ 0x8000; -} - -bool un_803049F4(int arg0) -{ - return idk()[arg0] & 0x4000; -} - -void un_80304A58(int arg0) -{ - unsigned short* v = idk(); - if (un_803049F4(arg0)) { - v[arg0] = v[arg0] ^ 0x4000; - } -} - -bool un_80304B0C(int arg0) -{ - unsigned short* v; - unsigned short s; - if (gm_8016B498() || gm_801A4310() == GM_TOY_LOTTERY) { - s = un_804A284C[3] | un_804A284C[4]; - v = &s; - } else { - v = gmMainLib_8015CC84(); - } - if (*v & (1 << arg0)) { - return 1; - } else { - return 0; - } -} - -int un_80304B94(int option) -{ - int res; - switch (option) { - case 0: - if (lbLang_IsSettingJP()) { - res = 0x4; - } else { - res = 0x4; - } - break; - case 1: - if (lbLang_IsSettingJP()) { - res = 0xA; - } else { - res = 0xA; - } - break; - case 2: - if (lbLang_IsSettingJP()) { - res = 0x11; - } else { - res = 0x10; - } - break; - case 3: - if (lbLang_IsSettingJP()) { - res = 0x17; - } else { - res = 0x17; - } - break; - case 4: - if (lbLang_IsSettingJP()) { - res = 0xC; - } else { - res = 0xC; - } - break; - case 5: - if (lbLang_IsSettingJP()) { - res = 0x48; - } else { - res = 0x48; - } - break; - case 6: - if (lbLang_IsSettingJP()) { - res = 0x1B; - } else { - res = 0x1B; - } - break; - case 7: - if (lbLang_IsSettingJP()) { - res = 0x7E; - } else { - res = 0x7E; - } - break; - case 8: - if (lbLang_IsSettingJP()) { - res = 0x2; - } else { - res = 0x2; - } - break; - } - return res; -} - -bool un_80304CC8(int arg0) -{ - short* v = un_804D6EB4; - if (lbLang_IsSettingUS()) { - for (; *v != -1; v++) { - if (*v == arg0) { - return 0; - } - } - } - return 1; -} - -inline static unsigned short* un_80304D30_idk(void) -{ - if (gm_8016B498() || gm_801A4310() == GM_TOY_LOTTERY) { - return &un_804A26B8[0xCF]; - } else { - return gmMainLib_8015CC78(); - } -} - -inline static int un_80304D30_48C0(int arg0) -{ - return un_80304D30_idk()[arg0] & 0xFF; -} - -inline static bool un_80304D30_4B0C(int arg0) -{ - unsigned short* v; - unsigned short s; - if (gm_8016B498() || gm_801A4310() == GM_TOY_LOTTERY) { - s = un_804A26B8[0xCD] | un_804A26B8[0xCE]; - v = &s; - } else { - v = gmMainLib_8015CC84(); - } - if (*v & (1 << arg0)) { - return 1; - } else { - return 0; - } -} - -int un_80304D30(void) -{ - int i; - int x; - int count; - int count2; - int idk; - int* qwe; - int sp14[36 / 4]; - PAD_STACK(4); - if (un_80304470()) { - return 0; - } - memzero(sp14, 36); - count = 0; - for (i = 0; i < 0x125; i++) { - if (un_80304CC8(i)) { - if (un_80304D30_48C0(i)) { - x = un_803060BC(i, 6); - sp14[x]++; - if (x != 8 && x != 1) { - count++; - } - } - } - } - - idk = 6; - qwe = &sp14[6]; - while (idk != 0) { - if (idk > (unsigned int) 2 && *qwe != 0 && *qwe == un_80304B94(idk)) { - for (i = 0; i < idk; i++) { - if (1 < (unsigned int) i && i != 3) { - if (!un_80304D30_4B0C(i)) { - ((unsigned char*) un_804A26B8)[0x194] = 2; - un_80305918(i, 0, 0); - } - } - } - i = idk + 1; - while (un_80304B94(i) == 0) { - i++; - } - if (4 <= i && i <= 6) { - if (!un_80304D30_4B0C(i)) { - ((unsigned char*) un_804A26B8)[0x194] = 2; - un_80305918(i, 0, 0); - break; - } - } - break; - } - idk--; - qwe--; - } - - count2 = 0; - for (i = 0; i < 8; i++) { - if (x != 8 && x != 1) { - if (un_80304D30_4B0C(i)) { - count2 += un_80304B94(i); - } - } - } - return count2 - count; -} diff --git a/src/melee/if/textlib.h b/src/melee/if/textlib.h index 5c2edff0cb..97ae934ffe 100644 --- a/src/melee/if/textlib.h +++ b/src/melee/if/textlib.h @@ -62,7 +62,5 @@ /* 304B94 */ int un_80304B94(int); /* 304CC8 */ bool un_80304CC8(int); /* 304D30 */ int un_80304D30(void); -/* 4A26B8 */ extern unsigned short un_804A26B8[1000]; -/* 4A284C */ extern unsigned short un_804A284C[1000]; #endif diff --git a/src/melee/if/types.h b/src/melee/if/types.h index 21d187e0c7..4d125a94ed 100644 --- a/src/melee/if/types.h +++ b/src/melee/if/types.h @@ -156,6 +156,7 @@ struct DevText { /* +2C */ struct DevText* prev; /* +30 */ struct DevText* next; }; +STATIC_ASSERT(sizeof(struct DevText) == 0x34); struct un_804D6EF4_t { /* +0x00 */ u32 x00; diff --git a/src/melee/ty/toy.c b/src/melee/ty/toy.c index c561fcbbd9..46b40b17e8 100644 --- a/src/melee/ty/toy.c +++ b/src/melee/ty/toy.c @@ -1,6 +1,7 @@ #include "toy.h" #include "stddef.h" +#include "tylist.h" #include "baselib/cobj.h" #include "baselib/controller.h" @@ -295,6 +296,252 @@ typedef struct { void* x14; } Ty25Entry; +int un_GetTrophyTotal(void) +{ + if (gm_8016B498() || gm_801A4310() == GM_TOY_LOTTERY) { + return (short) un_804A284C[0x258 / 2]; + } else { + return *gmMainLib_8015CC90(); + } +} + +inline static unsigned short* idk(void) +{ + if (gm_8016B498() || gm_801A4310() == GM_TOY_LOTTERY) { + return &un_804A284C[5]; + } else { + return gmMainLib_8015CC78(); + } +} + +int un_803048C0(int arg0) +{ + return idk()[arg0] & 0xFF; +} + +bool un_80304924(int arg0) +{ + return idk()[arg0] & 0x8000; +} + +void un_80304988(int arg0) +{ + unsigned short* v = idk(); + v[arg0] = v[arg0] ^ 0x8000; +} + +bool un_803049F4(int arg0) +{ + return idk()[arg0] & 0x4000; +} + +void un_80304A58(int arg0) +{ + unsigned short* v = idk(); + if (un_803049F4(arg0)) { + v[arg0] = v[arg0] ^ 0x4000; + } +} + +bool un_80304B0C(int arg0) +{ + unsigned short* v; + unsigned short s; + if (gm_8016B498() || gm_801A4310() == GM_TOY_LOTTERY) { + s = un_804A284C[3] | un_804A284C[4]; + v = &s; + } else { + v = gmMainLib_8015CC84(); + } + if (*v & (1 << arg0)) { + return 1; + } else { + return 0; + } +} + +int un_80304B94(int option) +{ + int res; + switch (option) { + case 0: + if (lbLang_IsSettingJP()) { + res = 0x4; + } else { + res = 0x4; + } + break; + case 1: + if (lbLang_IsSettingJP()) { + res = 0xA; + } else { + res = 0xA; + } + break; + case 2: + if (lbLang_IsSettingJP()) { + res = 0x11; + } else { + res = 0x10; + } + break; + case 3: + if (lbLang_IsSettingJP()) { + res = 0x17; + } else { + res = 0x17; + } + break; + case 4: + if (lbLang_IsSettingJP()) { + res = 0xC; + } else { + res = 0xC; + } + break; + case 5: + if (lbLang_IsSettingJP()) { + res = 0x48; + } else { + res = 0x48; + } + break; + case 6: + if (lbLang_IsSettingJP()) { + res = 0x1B; + } else { + res = 0x1B; + } + break; + case 7: + if (lbLang_IsSettingJP()) { + res = 0x7E; + } else { + res = 0x7E; + } + break; + case 8: + if (lbLang_IsSettingJP()) { + res = 0x2; + } else { + res = 0x2; + } + break; + } + return res; +} + +bool un_80304CC8(int arg0) +{ + short* v = un_804D6EB4; + if (lbLang_IsSettingUS()) { + for (; *v != -1; v++) { + if (*v == arg0) { + return 0; + } + } + } + return 1; +} + +inline static unsigned short* un_80304D30_idk(void) +{ + if (gm_8016B498() || gm_801A4310() == GM_TOY_LOTTERY) { + return &un_804A26B8[0xCF]; + } else { + return gmMainLib_8015CC78(); + } +} + +inline static int un_80304D30_48C0(int arg0) +{ + return un_80304D30_idk()[arg0] & 0xFF; +} + +inline static bool un_80304D30_4B0C(int arg0) +{ + unsigned short* v; + unsigned short s; + if (gm_8016B498() || gm_801A4310() == GM_TOY_LOTTERY) { + s = un_804A26B8[0xCD] | un_804A26B8[0xCE]; + v = &s; + } else { + v = gmMainLib_8015CC84(); + } + if (*v & (1 << arg0)) { + return 1; + } else { + return 0; + } +} + +int un_80304D30(void) +{ + int i; + int x; + int count; + int count2; + int idk; + int* qwe; + int sp14[36 / 4]; + PAD_STACK(4); + if (un_80304470()) { + return 0; + } + memzero(sp14, 36); + count = 0; + for (i = 0; i < 0x125; i++) { + if (un_80304CC8(i)) { + if (un_80304D30_48C0(i)) { + x = un_803060BC(i, 6); + sp14[x]++; + if (x != 8 && x != 1) { + count++; + } + } + } + } + + idk = 6; + qwe = &sp14[6]; + while (idk != 0) { + if (idk > (unsigned int) 2 && *qwe != 0 && *qwe == un_80304B94(idk)) { + for (i = 0; i < idk; i++) { + if (1 < (unsigned int) i && i != 3) { + if (!un_80304D30_4B0C(i)) { + ((unsigned char*) un_804A26B8)[0x194] = 2; + un_80305918(i, 0, 0); + } + } + } + i = idk + 1; + while (un_80304B94(i) == 0) { + i++; + } + if (4 <= i && i <= 6) { + if (!un_80304D30_4B0C(i)) { + ((unsigned char*) un_804A26B8)[0x194] = 2; + un_80305918(i, 0, 0); + break; + } + } + break; + } + idk--; + qwe--; + } + + count2 = 0; + for (i = 0; i < 8; i++) { + if (x != 8 && x != 1) { + if (un_80304D30_4B0C(i)) { + count2 += un_80304B94(i); + } + } + } + return count2 - count; +} + s32 un_80305058(s32 arg0, s32 arg1, s32 arg2, f32 farg0) { s32 obtained_arr[293]; diff --git a/src/melee/ty/toy.h b/src/melee/ty/toy.h index fad4800feb..5c8ad3581b 100644 --- a/src/melee/ty/toy.h +++ b/src/melee/ty/toy.h @@ -89,7 +89,6 @@ /* 4D6E6C */ extern void* un_804D6E6C; /* 4D6EF4 */ extern struct un_804D6EF4_t* un_804D6EF4; -/* 4A2AC0 */ extern char un_804A2AC0[]; /* 4D6EDC */ extern s16* un_804D6EDC; /* 3FE8D0 */ extern char un_803FE8D0[]; /* 3FE880 */ extern char un_803FE880[]; diff --git a/src/melee/ty/tylist.c b/src/melee/ty/tylist.c index 92771b1133..ef9fdf5bd0 100644 --- a/src/melee/ty/tylist.c +++ b/src/melee/ty/tylist.c @@ -1,7 +1,8 @@ -#include "tylist.h" - +#include "platform.h" #include "stddef.h" +#include "tylist.static.h" + #include "gm/gmmain_lib.h" #include "if/textlib.h" #include "lb/lb_00B0.h" @@ -30,27 +31,24 @@ #include #include -typedef struct { - u8 pad[0x28]; - HSD_CObj* cobj; -} TyListData; - -typedef struct { - u8 pad[0x4E8]; - u8* digits; -} SisFontData; - -typedef struct { - HSD_GObj* gobj; - u8 pad[0x4C]; - void* data; -} TyArchiveData; - -typedef struct { - u8 pad[0x20]; - u32 x20; - s32 x24; -} TyListWaitData; +/// @todo .data order hack +static void order_data(void) +{ + (void) "Pos : %f, %f,%f\n"; + (void) "WinSize = %f, %f\n"; + (void) "WinScale = %f, %f\n"; + (void) "FontSize = %f, %f\n"; + (void) "ToyFigureListMarkN_Top_joint"; + (void) "tylist.c"; + (void) "*** Can't Get Public Address!(tyList Model)\n"; + (void) "ToyFigurePanel_listpos01_joint"; + (void) "ToyFigureListBase_Top_joint"; + (void) "ToyFigureListBase_Top_matanim_joint"; + (void) "ToyFigureListBaseend_Top_joint"; + (void) "ToyFigureListCursor_Top_joint"; + (void) "*** BG data aren't being loaded!\n"; + (void) "ScMenFigure_scene_lights"; +} void un_803124BC(void) { @@ -237,7 +235,7 @@ typedef struct TyListRow { void un_80312904(void* arg0, s8 arg1) { - TyListState* state = (TyListState*) un_804A2AC0; + TyListState* state = (TyListState*) &un_804A2AC0; TyListRow* row = (TyListRow*) arg0; f32 f30; f32 f29; @@ -457,7 +455,7 @@ void un_80312E88(TyListArg* arg, float delta) } ptr = arg; - data = un_804A2AC0; + data = (char*) &un_804A2AC0; i = 0; loop: if ((jobj = ptr->jobjs[0]) == NULL) { @@ -600,7 +598,7 @@ void un_80313358(TyListState* state, s8 arg2, s8 arg3, s8 arg4) extern s32 un_804D6EE8; void un_80313464(TyListArg* arg) { - char* data = un_804A2AC0; + char* data = (char*) &un_804A2AC0; s32 val; PAD_STACK(24); @@ -661,11 +659,11 @@ HSD_JObj* un_80313508(void* parent, void* symbol, float x, float y, float z) void un_80313774(void) { - TyListState* state = (TyListState*) un_804A2AC0; + TyListState* state = (TyListState*) &un_804A2AC0; TyModeState* mode = (TyModeState*) un_804A284C; ToyGlobalsS_* disp = un_804D6EE0; TyArchiveData* archive = un_804D6ED8; - s8* state_tail = (s8*) &state->gobj_2AC; + s8* state_tail = (s8*) M2C_FIELD(&state, HSD_GObj**, 0x2AC); char* strs = un_803FE880; TyListArg* entry; HSD_JObj* root_jobj; @@ -790,7 +788,7 @@ void un_80312BAC(TyListState* state, s8 arg1); void fn_80313BD8(HSD_GObj* gobj) { - TyListState* state = (TyListState*) un_804A2AC0; + TyListState* state = (TyListState*) &un_804A2AC0; s32 i; TyListArg* p; s8* g = ((s8*) state) + 0x2AC; @@ -981,7 +979,7 @@ void fn_80313BD8(HSD_GObj* gobj) lbAudioAx_80024030(2); HSD_JObjSetTranslateY(state->x288, p->x30); } - un_80312904(p, state->x2B8); + un_80312904(p, M2C_FIELD(state, s8*, 0x2B8)); } g[0xD] = g[0xC]; return; @@ -1019,23 +1017,17 @@ void fn_80313BD8(HSD_GObj* gobj) } } -typedef struct TyListArchive { - /* 0x00 */ HSD_JObj** x0; - /* 0x04 */ u8 pad_4[0x18 - 0x4]; - /* 0x18 */ HSD_JObj* jobjs[3]; -} TyListArchive; - -void fn_8031438C(HSD_GObj* arg0) +void fn_8031438C(HSD_GObj* gobj) { - TyListState* state = (TyListState*) un_804A2AC0; - TyListGobjEntry* entry = (TyListGobjEntry*) &state->gobj_2AC; + TyListState* state = &un_804A2AC0; + TyListGobjEntry* entry = M2C_FIELD(state, TyListGobjEntry**, 0x2AC); TyListArchive* archive = un_804D6ED8; s32 i; HSD_Text* new_var; PAD_STACK(0x18); - if (state->x2C2 != 0) { + if (M2C_FIELD(state, s8*, 0x2C2) != 0) { if (entry->x16 > 1) { for (i = 0; i < 3; i++) { if (i == (s8) state->x29B) { @@ -1067,7 +1059,7 @@ void fn_8031438C(HSD_GObj* arg0) return; } - HSD_GObjProc_8038FED4(arg0); + HSD_GObjProc_8038FED4(gobj); HSD_GObj_SetupProc(entry->x0, fn_80313BD8, 0); HSD_GObj_80390CD4(entry->x0); } @@ -1148,7 +1140,7 @@ void un_8031457C(void) void un_803147C4(void) { - char* data = un_804A2AC0; + char* data = (char*) &un_804A2AC0; char* strs = un_803FE880; TyArchiveData* archive; LightList** jobj; @@ -1186,13 +1178,13 @@ void un_803147C4(void) void un_803148E4(s32 arg0) { - TyListState* state = (TyListState*) un_804A2AC0; - TyListGobjEntry* entry = (TyListGobjEntry*) &state->gobj_2AC; + TyListState* state = (TyListState*) &un_804A2AC0; + TyListGobjEntry* entry = M2C_FIELD(state, TyListGobjEntry**, 0x2AC); TyArchiveData* archive; HSD_GObj** gobj_2C4; PAD_STACK(8); - gobj_2C4 = &state->gobj_2C4; + gobj_2C4 = M2C_FIELD(state, HSD_GObj***, 0x2C4); archive = un_804D6ED8; if (un_GetTrophyTotal() != 0) { diff --git a/src/melee/ty/tylist.h b/src/melee/ty/tylist.h index b02a6cfa46..c6d482c8ef 100644 --- a/src/melee/ty/tylist.h +++ b/src/melee/ty/tylist.h @@ -9,18 +9,13 @@ #include struct TyListArg; -struct TyListState; /* 3124BC */ void un_803124BC(void); /* 31263C */ void un_8031263C(void); /* 3127D4 */ void un_803127D4(void); /* 312834 */ char* un_80312834(char* buf, u32 num); /* 312904 */ void un_80312904(void*, s8); -/* 312BAC */ void un_80312BAC(struct TyListState* state, s8 arg1); /* 312E88 */ void un_80312E88(struct TyListArg* arg, float delta); -/* 31305C */ s32 un_8031305C(void* a, struct TyListState* state, s8 movedFlag); -/* 313358 */ void un_80313358(struct TyListState* state, s8 arg2, s8 arg3, - s8 arg4); /* 313464 */ void un_80313464(struct TyListArg* arg); /* 313508 */ HSD_JObj* un_80313508(void* parent, void* symbol, float x, float y, float z); @@ -45,5 +40,7 @@ struct TyListState; /* 4D6EC8 */ extern void* un_804D6EC8; /* 4D6ECC */ extern void* un_804D6ECC; /* 4D6ED0 */ extern void* un_804D6ED0; +/* 4A26B8 */ extern unsigned short un_804A26B8[1000]; +/* 4A284C */ extern unsigned short un_804A284C[302]; #endif diff --git a/src/melee/ty/tylist.static.h b/src/melee/ty/tylist.static.h new file mode 100644 index 0000000000..c148495617 --- /dev/null +++ b/src/melee/ty/tylist.static.h @@ -0,0 +1,92 @@ +#include "platform.h" +#include "tylist.h" + +#include "ty/types.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Trophy list UI state. Size: 0x2D8 bytes. */ +typedef struct TyListState { + /* 0x000 */ TyListArg entries[12]; /* 12 * 0x34 = 0x270 */ + /* 0x270 */ struct TyListArg* x270; + /* 0x274 */ struct TyListArg* x274; + /* 0x278 */ struct TyListArg* x278; + /* 0x27C */ struct HSD_GObj* gobj; + /* 0x280 */ u8 pad_280[0x8]; + /* 0x288 */ struct HSD_JObj* x288; + /* 0x28C */ struct HSD_JObj* jobj; + /* 0x290 */ struct HSD_Text* x290; + /* 0x294 */ u8 pad_294[4]; + /* 0x298 */ s16 selectedIdx; + /* 0x29A */ s8 entryCount; + /* 0x29B */ u8 x29B; + /* 0x29C */ u8 x29C; + /* 0x29D */ u8 pad_29D; + /* 0x29E */ u8 x29E; + /* 0x29F */ u8 x29F; + /* 0x2A0 */ u8 pad_2A0; + /* 0x2A1 */ s8 x2A1; + /* 0x2A2 */ u8 pad_2A2[2]; + /* 0x2A4 */ float x2A4; + /* 0x2A8 */ float x2A8; + // /* 0x2AC */ struct HSD_GObj* gobj_2AC; + // /* 0x2B0 */ struct HSD_GObj* gobj_2B0; + // /* 0x2B4 */ u8 pad_2B4[4]; + // /* 0x2B8 */ u8 x2B8; + // /* 0x2B9 */ u8 pad_2B9[9]; + // /* 0x2C2 */ s8 x2C2; + // /* 0x2C3 */ u8 pad_2C3; + // /* 0x2C4 */ struct HSD_GObj* gobj_2C4; +} TyListState; +STATIC_ASSERT(sizeof(struct TyListState) == 0x2AC); + +typedef struct { + u8 pad[0x28]; + HSD_CObj* cobj; +} TyListData; + +typedef struct { + u8 pad[0x4E8]; + u8* digits; +} SisFontData; + +typedef struct { + HSD_GObj* gobj; + u8 pad[0x4C]; + void* data; +} TyArchiveData; + +typedef struct { + u8 pad[0x20]; + u32 x20; + s32 x24; +} TyListWaitData; + +typedef struct TyListArchive { + /* 0x00 */ HSD_JObj** x0; + /* 0x04 */ u8 pad_4[0x18 - 0x4]; + /* 0x18 */ HSD_JObj* jobjs[3]; +} TyListArchive; + +/* 312BAC */ static void un_80312BAC(struct TyListState* state, s8 arg1); +/* 31305C */ static s32 un_8031305C(void* a, struct TyListState* state, + s8 movedFlag); +/* 313358 */ static void un_80313358(struct TyListState* state, s8 arg2, + s8 arg3, s8 arg4); +/* 4A284C */ unsigned short un_804A284C[302]; +/* 4A2AC0 */ TyListState un_804A2AC0; diff --git a/src/melee/ty/types.h b/src/melee/ty/types.h index 849d9fd53c..5cb086bb9b 100644 --- a/src/melee/ty/types.h +++ b/src/melee/ty/types.h @@ -73,41 +73,6 @@ typedef struct TyListArg { /* 0x30 */ float x30; } TyListArg; -/* Trophy list UI state. Size: 0x2D8 bytes. */ -typedef struct TyListState { - /* 0x000 */ TyListArg entries[12]; /* 12 * 0x34 = 0x270 */ - /* 0x270 */ struct TyListArg* x270; - /* 0x274 */ struct TyListArg* x274; - /* 0x278 */ struct TyListArg* x278; - /* 0x27C */ struct HSD_GObj* gobj; - /* 0x280 */ u8 pad_280[0x8]; - /* 0x288 */ struct HSD_JObj* x288; - /* 0x28C */ struct HSD_JObj* jobj; - /* 0x290 */ struct HSD_Text* x290; - /* 0x294 */ u8 pad_294[4]; - /* 0x298 */ s16 selectedIdx; - /* 0x29A */ s8 entryCount; - /* 0x29B */ u8 x29B; - /* 0x29C */ u8 x29C; - /* 0x29D */ u8 pad_29D; - /* 0x29E */ u8 x29E; - /* 0x29F */ u8 x29F; - /* 0x2A0 */ u8 pad_2A0; - /* 0x2A1 */ s8 x2A1; - /* 0x2A2 */ u8 pad_2A2[2]; - /* 0x2A4 */ float x2A4; - /* 0x2A8 */ float x2A8; - /* 0x2AC */ struct HSD_GObj* gobj_2AC; - /* 0x2B0 */ struct HSD_GObj* gobj_2B0; - /* 0x2B4 */ u8 pad_2B4[4]; - /* 0x2B8 */ u8 x2B8; - /* 0x2B9 */ u8 pad_2B9[9]; - /* 0x2C2 */ s8 x2C2; - /* 0x2C3 */ u8 pad_2C3; - /* 0x2C4 */ struct HSD_GObj* gobj_2C4; - /* 0x2C8 */ u8 pad_2C8[0x10]; -} TyListState; - struct Toy { /* +0 */ char pad_0[0x4]; /* +4 */ int x4; diff --git a/src/melee/vi/vi1201v1.c b/src/melee/vi/vi1201v1.c index 837b4d6249..e2496990b9 100644 --- a/src/melee/vi/vi1201v1.c +++ b/src/melee/vi/vi1201v1.c @@ -8,7 +8,6 @@ #include "ef/efasync.h" #include "ef/eflib.h" #include "ef/efsync.h" -#include "ft/ft_0C31.h" #include "ft/ftdemo.h" #include "gm/gm_1601.h" #include "gm/gm_unsplit.h" @@ -70,6 +69,13 @@ void un_8031F9B4(HSD_GObj* gobj) HSD_JObjAnimAll(GET_JOBJ(gobj)); } +/// @todo .sdata2 order hack +static void order_sdata2(void) +{ + (void) 0.55f; + (void) 1.0f; +} + void un_8031F9D8(CharacterKind char_index, int costume_id) { PAD_STACK(16); @@ -182,6 +188,12 @@ static inline void un_8031FD18_SetupScene(void) Ground_801C0378(0x40); } +/// @todo .data order hack +static void order_data(void) +{ + (void) "!(jobj->flags & JOBJ_USE_QUATERNION)"; +} + void un_8031FD18_OnEnter(void* arg) { u8* input = arg; diff --git a/src/melee/vi/vi1201v2.c b/src/melee/vi/vi1201v2.c index 0251bdfd4d..bd0320f804 100644 --- a/src/melee/vi/vi1201v2.c +++ b/src/melee/vi/vi1201v2.c @@ -48,6 +48,13 @@ typedef struct un_80400304_t { char stand_scene[0x0C]; } un_80400304_t; +/// @todo .sdata2 order hack +static void order_sdata2(void) +{ + (void) 0.55f; + (void) 1.0f; +} + Vec3 un_804002F8 = { 0.0f, 0.0f, 0.0f }; un_80400304_t un_80400304 = { { 0.0f, 0.0f, 0.0f }, "!(jobj->flags & JOBJ_USE_QUATERNION)",