From 1ede43f7ac6c4eaaab4a1590f77a9c8f714808aa Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 19:55:04 +1100 Subject: [PATCH] Import bss --- include/os.h | 11 +++++++ spec | 1 - src/boot_O2_g3/idle.c | 1 + src/code/audio/code_801A51F0.c | 59 ++++++++++++++++++---------------- src/libultra/flash/osFlash.c | 1 + tools/disasm/variables.txt | 3 +- 6 files changed, 46 insertions(+), 30 deletions(-) diff --git a/include/os.h b/include/os.h index 82e1ac013..f894c2077 100644 --- a/include/os.h +++ b/include/os.h @@ -150,4 +150,15 @@ typedef struct { /* 0x14 */ u16 distance[5]; /* Distance value */ } OSVoiceData; // size = 0x20 +typedef struct { + /* 0x00 */ u8* unk_00; + /* 0x04 */ s8 unk_04; + /* 0x08 */ OSVoiceData* unk_08; + /* 0x0C */ u16 unk_0C; + /* 0x0E */ u16 unk_0E; + /* 0x10 */ u16 unk_10; + /* 0x12 */ u16 unk_12; + /* 0x14 */ u16 unk_14; +} OSVoiceUnk; // size = 0x18 + #endif diff --git a/spec b/spec index 8ba7c36ea..a1c57f47f 100644 --- a/spec +++ b/spec @@ -660,7 +660,6 @@ beginseg include "build/data/code/code_801D55B0.data.o" include "build/src/code/audio/code_801A4EB0.o" include "build/src/code/audio/code_801A51F0.o" - include "build/data/code/code_801A51F0.bss.o" pad_text include "build/src/code/code_801A5BD0.o" include "build/data/code/code_801A5BD0.bss.o" diff --git a/src/boot_O2_g3/idle.c b/src/boot_O2_g3/idle.c index 4f9146530..4fe22534c 100644 --- a/src/boot_O2_g3/idle.c +++ b/src/boot_O2_g3/idle.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" u8 D_80096B20 = 1; diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index acff8dba6..cd89ba4df 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -3,25 +3,25 @@ // internal voice functions u8* func_801A5A1C(s8* arg0); -typedef struct { - /* 0x00 */ u8* unk_00; - /* 0x04 */ s8 unk_04; - /* 0x08 */ OSVoiceData* unk_08; - /* 0x0C */ u16 unk_0C; - /* 0x0E */ u16 unk_0E; - /* 0x10 */ u16 unk_10; - /* 0x12 */ u16 unk_12; - /* 0x14 */ u16 unk_14; -} OSVoiceUnk; // size = 0x18 +// BSS +OSVoiceUnk D_801FD5A0; +OSVoiceHandle D_801FD5B8; +OSVoiceData D_801FD5C8; +OSVoiceData D_801FD5E8; +u8 D_801FD608[8]; -extern OSVoiceUnk D_801FD5A0; -extern OSVoiceHandle D_801FD5B8; -extern OSVoiceData D_801FD5C8; -extern OSVoiceData D_801FD5E8; -extern u8 D_801FD610[]; -extern s8 D_801FD5A4; -extern u8 D_801FD5C4; +// Maybe all the same? +// u8 D_801FD610[0x11B0]; +u8 D_801FD610[0x100]; +u8 D_801FD710[0x1B0]; +u8 D_801FD8C0[0x240]; +u8 D_801FDB00[0x600]; +u8 D_801FE100[0x3C0]; +u8 D_801FE4C0[0x180]; +u8 D_801FE640[0x90]; +u8 D_801FE6D0[0xF0]; +// Data s8 D_801D8E50[] = "aa\0AA\0ii\0II\0uu\0UU\0ee\0EE\0oo\0OO\0KA\0GA\0KI\0GI\0KU\0GU\0KE\0GE\0KO\0GO\0SA\0ZA\0SI\0ZI\0SU\0ZU\0SE\0ZE\0SO" "\0ZO\0TA\0DA\0TI\0DI\0tu\0TU\0DU\0TE\0DE\0TO\0DO\0NA\0NI\0NU\0NE\0NO\0HA\0BA\0PA\0HI\0BI\0PI\0HU\0BU\0PU\0HE\0BE\0" @@ -197,13 +197,13 @@ s32 func_801A54D0(u16 arg0) { errorCode = osVoiceStopReadData(&D_801FD5B8); PadMgr_UnlockSerialMesgQueue(msgQ); - if ((errorCode == 0) || (D_801FD5A4 == 0)) { + if ((errorCode == 0) || (D_801FD5A0.unk_04 == 0)) { msgQ = PadMgr_LockSerialMesgQueue(); errorCode = osVoiceMaskDictionary(&D_801FD5B8, D_801FD608, ((sp22 - 1) / 8) + 1); PadMgr_UnlockSerialMesgQueue(msgQ); } - D_801FD5A4 = 0; + D_801FD5A0.unk_04 = 0; } return errorCode; @@ -241,30 +241,33 @@ s32 func_801A5680(u16 arg0) { errorCode = osVoiceStopReadData(&D_801FD5B8); PadMgr_UnlockSerialMesgQueue(msgQ); - if ((errorCode == 0) || (D_801FD5A4 == 0)) { + if ((errorCode == 0) || (D_801FD5A0.unk_04 == 0)) { msgQ = PadMgr_LockSerialMesgQueue(); errorCode = osVoiceMaskDictionary(&D_801FD5B8, D_801FD608, ((sp22 - 1) / 8) + 1); PadMgr_UnlockSerialMesgQueue(msgQ); } - D_801FD5A4 = 0; + D_801FD5A0.unk_04 = 0; } return errorCode; } +// #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5808.s") s32 func_801A5808(void) { s32 errorCode = 0; s32 ret; OSMesgQueue* msgQ; + if (1) {} + switch (D_801FD5A0.unk_04) { case 0: msgQ = PadMgr_LockSerialMesgQueue(); errorCode = osVoiceStartReadData(&D_801FD5B8); PadMgr_UnlockSerialMesgQueue(msgQ); - D_801FD5A4 = 1; + D_801FD5A0.unk_04 = 1; break; case 1: msgQ = PadMgr_LockSerialMesgQueue(); @@ -272,9 +275,9 @@ s32 func_801A5808(void) { PadMgr_UnlockSerialMesgQueue(msgQ); if (func_801A51F0(errorCode) == 0) { - switch (D_801FD5C4) { + switch (D_801FD5B8.status) { case 0: - D_801FD5A4 = 2; + D_801FD5A0.unk_04 = 2; break; case 1: case 2: @@ -284,7 +287,7 @@ s32 func_801A5808(void) { case 6: break; case 7: - D_801FD5A4 = 2; + D_801FD5A0.unk_04 = 2; break; } } @@ -303,11 +306,13 @@ s32 func_801A5808(void) { errorCode = osVoiceStartReadData(&D_801FD5B8); PadMgr_UnlockSerialMesgQueue(msgQ); - D_801FD5A4 = 1; + D_801FD5A0.unk_04 = 1; break; } - return func_801A51F0(errorCode); + ret = func_801A51F0(errorCode); + + return ret; } void func_801A5A10(void) { diff --git a/src/libultra/flash/osFlash.c b/src/libultra/flash/osFlash.c index bf3044029..cf90bc75b 100644 --- a/src/libultra/flash/osFlash.c +++ b/src/libultra/flash/osFlash.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "ultra64.h" #include "global.h" diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index b320e233f..4a4937eb7 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -4419,8 +4419,7 @@ 0x801FD533:("D_801FD533","UNK_TYPE1","",0x1), 0x801FD590:("D_801FD590","UNK_TYPE1","",0x1), 0x801FD598:("D_801FD598","UNK_TYPE1","",0x1), - 0x801FD5A0:("D_801FD5A0","UNK_TYPE1","",0x1), - 0x801FD5A4:("D_801FD5A4","UNK_TYPE1","",0x1), + 0x801FD5A0:("D_801FD5A0","u8","0x18",0x1), 0x801FD5B8:("D_801FD5B8","UNK_TYPE1","",0x1), 0x801FD5C4:("D_801FD5C4","UNK_TYPE1","",0x1), 0x801FD5C8:("D_801FD5C8","UNK_TYPE1","",0x1),