From 1329f3aeaa71452c56ea222e26f32c0899d6188e Mon Sep 17 00:00:00 2001 From: engineer124 Date: Wed, 10 Nov 2021 00:03:48 +1100 Subject: docs, but maybe a little carried away --- src/code/z_vr_box.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/code') diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index 9e949beac..724bc5971 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -103,7 +103,7 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy SEGMENT_ROM_START(d2_cloud_static), size, 0, &skyboxCtx->loadQueue, NULL); } - osRecvMesg(&skyboxCtx->loadQueue, NULL, 1); + osRecvMesg(&skyboxCtx->loadQueue, NULL, OS_MESG_BLOCK); osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1); if (globalCtx->envCtx.unk_11 == 0) { @@ -120,7 +120,7 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy SEGMENT_ROM_START(d2_cloud_static), size, 0, &skyboxCtx->loadQueue, NULL); } - osRecvMesg(&skyboxCtx->loadQueue, NULL, 1); + osRecvMesg(&skyboxCtx->loadQueue, NULL, OS_MESG_BLOCK); osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1); size = SEGMENT_ROM_SIZE(d2_fine_pal_static); @@ -129,7 +129,7 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy DmaMgr_SendRequestImpl(&skyboxCtx->unk1C8, skyboxCtx->skyboxPaletteStaticSegment, SEGMENT_ROM_START(d2_fine_pal_static), size, 0, &skyboxCtx->loadQueue, NULL); - osRecvMesg(&skyboxCtx->loadQueue, NULL, 1); + osRecvMesg(&skyboxCtx->loadQueue, NULL, OS_MESG_BLOCK); } } -- cgit v1.2.3 From 158dede3f68891fcf1643af65a9e77b242931432 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 13:47:50 +1100 Subject: Properly split voice files from code --- src/code/code_8019AF00.c | 16 ---------------- src/code/code_801A4EB0.c | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 16 deletions(-) create mode 100644 src/code/code_801A4EB0.c (limited to 'src/code') diff --git a/src/code/code_8019AF00.c b/src/code/code_8019AF00.c index 8f0d129ad..227384d0a 100644 --- a/src/code/code_8019AF00.c +++ b/src/code/code_8019AF00.c @@ -411,19 +411,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4DF4.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4E64.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4EB0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4EB8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4FD8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A5080.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A50C0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A5100.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A510C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A5118.s") diff --git a/src/code/code_801A4EB0.c b/src/code/code_801A4EB0.c new file mode 100644 index 000000000..d3461c8f5 --- /dev/null +++ b/src/code/code_801A4EB0.c @@ -0,0 +1,17 @@ +#include "global.h" + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4EB0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4EB8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4FD8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5080.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A50C0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5100.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A510C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5118.s") -- cgit v1.2.3 From 98ea63ce9fc3e15ae1376fb28df76360baee4267 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 13:54:59 +1100 Subject: Use proper flags for voice files --- src/code/audio/code_801A4EB0.c | 17 +++++++++++++++++ src/code/audio/code_801A51F0.c | 42 ++++++++++++++++++++++++++++++++++++++++++ src/code/code_801A4EB0.c | 17 ----------------- src/code/code_801A51F0.c | 42 ------------------------------------------ 4 files changed, 59 insertions(+), 59 deletions(-) create mode 100644 src/code/audio/code_801A4EB0.c create mode 100644 src/code/audio/code_801A51F0.c delete mode 100644 src/code/code_801A4EB0.c delete mode 100644 src/code/code_801A51F0.c (limited to 'src/code') diff --git a/src/code/audio/code_801A4EB0.c b/src/code/audio/code_801A4EB0.c new file mode 100644 index 000000000..d3461c8f5 --- /dev/null +++ b/src/code/audio/code_801A4EB0.c @@ -0,0 +1,17 @@ +#include "global.h" + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4EB0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4EB8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4FD8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5080.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A50C0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5100.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A510C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5118.s") diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c new file mode 100644 index 000000000..6a40bf23a --- /dev/null +++ b/src/code/audio/code_801A51F0.c @@ -0,0 +1,42 @@ +#include "global.h" + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/D_801E0EC0.s") + +UNK_TYPE func_801A51F0(UNK_TYPE arg0) { + switch (arg0) { + case 1: + case 4: + case 5: + case 11: + case 13: + case 14: + case 15: + return -1; + default: + return 0; + } +} + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5228.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5390.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A53DC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A53E8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A541C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5488.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A54C4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A54D0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5680.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5808.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5A10.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5A1C.s") diff --git a/src/code/code_801A4EB0.c b/src/code/code_801A4EB0.c deleted file mode 100644 index d3461c8f5..000000000 --- a/src/code/code_801A4EB0.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4EB0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4EB8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4FD8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5080.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A50C0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5100.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A510C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5118.s") diff --git a/src/code/code_801A51F0.c b/src/code/code_801A51F0.c deleted file mode 100644 index 6a40bf23a..000000000 --- a/src/code/code_801A51F0.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/D_801E0EC0.s") - -UNK_TYPE func_801A51F0(UNK_TYPE arg0) { - switch (arg0) { - case 1: - case 4: - case 5: - case 11: - case 13: - case 14: - case 15: - return -1; - default: - return 0; - } -} - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5228.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5390.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A53DC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A53E8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A541C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5488.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A54C4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A54D0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5680.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5808.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5A10.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5A1C.s") -- cgit v1.2.3 From b640bac998439d58fcaf55e1480efbfbf24c208b Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 14:01:05 +1100 Subject: Add basic docs for func_801A5AF0 --- src/code/audio/code_801A51F0.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index 6a40bf23a..10c47ffa7 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -1,16 +1,26 @@ #include "global.h" +/* +char D_801E0EC0[] = "Error %d\n" +char D_801E0ECC[] = "NAI_VRS:osVoiceClearDictionary %d\n" +char D_801E0EF0[] = "NAI_VRS:dict error! (%d-%d %s)\n" +char D_801E0F10[] = "NAI_VRS:Ina_SetVruGain Error!\n" +char D_801E0F30[] = "NAI_VRS:mask on %d\n" +char D_801E0F48[] = "NAI_VRS:mask off %d\n" +char D_801E0F60[] = "NAI_VRS:answer No.:%d Dist:%d Warn:%04X Level:%5d SN:%5d (Num:%d)\n" +char D_801E0FA4[] = "NAI_VRS:error !! (ANS_MAX:%d DIST:%d WARNING:%04X LEVEL:%5d SN:%5d)\n" +*/ #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/D_801E0EC0.s") -UNK_TYPE func_801A51F0(UNK_TYPE arg0) { - switch (arg0) { - case 1: - case 4: - case 5: - case 11: - case 13: - case 14: - case 15: +s32 func_801A51F0(s32 errorCode) { + switch (errorCode) { + case CONT_ERR_NO_CONTROLLER: + case CONT_ERR_CONTRFAIL: + case CONT_ERR_INVALID: + case CONT_ERR_DEVICE: + case CONT_ERR_VOICE_MEMORY: + case CONT_ERR_VOICE_WORD: + case CONT_ERR_VOICE_NO_RESPONSE: return -1; default: return 0; -- cgit v1.2.3 From 133cb7a74c17bc3c709d7ace464ad397f0afb39e Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 14:11:58 +1100 Subject: Import Voice Data --- src/code/audio/code_801A51F0.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/code') diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index 10c47ffa7..76200ac90 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -1,5 +1,17 @@ #include "global.h" +char 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" + "PE\0HO\0BO\0PO\0MA\0MI\0MU\0ME\0MO\0ya\0YA\0yu\0YU\0yo\0YO\0RA\0RI\0RU\0RE\0RO\0wa\0WA\0WI\0WE\0WO\0NN\0VU\0ka\0ke" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; + +char D_801D8F70[] = "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\0" + "HI\0BI\0PI\0HU\0BU\0PU\0HE\0BE\0PE\0HO\0BO\0PO\0MA\0MI\0 " + "\0MU\0ME\0MO\0ya\0YA\0yu\0YU\0yo\0YO\0RA\0RI\0RU\0RE\0RO\0wa\0WA\0WI\0WE\0WO\0NN\0VU\0ka\0ke\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; + /* char D_801E0EC0[] = "Error %d\n" char D_801E0ECC[] = "NAI_VRS:osVoiceClearDictionary %d\n" -- cgit v1.2.3 From e42e0c607c9697e4ecce53205b9b60e3b0db8482 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 14:26:20 +1100 Subject: Update matching functions in code_801A51F0 from audio WIP --- src/code/audio/code_801A51F0.c | 75 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 68 insertions(+), 7 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index 76200ac90..20ae5b8e3 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -1,5 +1,23 @@ #include "global.h" +// padmgr functions +s32 func_80175008(); +void func_8017506C(s32); + +typedef struct { + /* 0x00 */ u8* unk_00; + /* 0x04 */ u8 unk_04; + /* 0x08 */ s32 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 + +extern OSVoiceUnk D_801FD5A0; +extern OSVoiceHandle D_801FD5B8; + char 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" @@ -41,17 +59,58 @@ s32 func_801A51F0(s32 errorCode) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5228.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5390.s") +s32 func_801A5390(void) { + s32 temp_t6; + s32 sp18; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A53DC.s") + temp_t6 = D_801FD5A0.unk_08; + D_801FD5A0.unk_08 = 0; + sp18 = func_80175008(); + osVoiceStartReadData(&D_801FD5B8); + func_8017506C(sp18); + return temp_t6; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A53E8.s") +s32 func_801A53DC(void) { + return D_801FD5A0.unk_00; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A541C.s") +void func_801A53E8(u16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4) { + D_801FD5A0.unk_0C = arg0; + D_801FD5A0.unk_0E = arg1; + D_801FD5A0.unk_10 = arg2; + D_801FD5A0.unk_12 = arg3; + D_801FD5A0.unk_14 = arg4; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5488.s") +void func_801A541C(s32 analog, s32 digital) { + s32 sp1C; + s32 sp18; + + if (D_801FD5A0.unk_00 != 0) { + sp18 = func_80175008(); + sp1C = osVoiceControlGain(&D_801FD5B8, analog, digital); + func_8017506C(sp18); + if (sp1C != 0) { + func_801A51F0(sp1C); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A54C4.s") +s32 func_801A5488(u8* word) { + s32 sp1C; + s32 sp18; + s32 temp_v0; + + sp18 = func_80175008(); + sp1C = osVoiceCheckWord(word); + func_8017506C(sp18); + return sp1C; +} + +UNK_PTR func_801A54C4(void) { + return &D_801FD608; +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A54D0.s") @@ -59,6 +118,8 @@ s32 func_801A51F0(s32 errorCode) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5808.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5A10.s") +void func_801A5A10(void) { + D_801FD5A0.unk_00 = 0; +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5A1C.s") -- cgit v1.2.3 From d8bc20f1097ace6dc12f90dde65de00f48c3693b Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 14:29:32 +1100 Subject: Update matching functions in code_801A4EB0 from audio WIP --- src/code/audio/code_801A4EB0.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A4EB0.c b/src/code/audio/code_801A4EB0.c index d3461c8f5..441a70472 100644 --- a/src/code/audio/code_801A4EB0.c +++ b/src/code/audio/code_801A4EB0.c @@ -1,17 +1,33 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4EB0.s") +void func_801A5680(u16 arg0); +void func_801A54D0(u16 arg0); + +void func_801A4EB0(void) { +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4EB8.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4FD8.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5080.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A50C0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5100.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A510C.s") +void func_801A5080(u16 arg0) { + if ((D_801D8E3C != 0) && (arg0 < 6)) { + func_801A5680(arg0); + } +} + +void func_801A50C0(u16 arg0) { + if ((D_801D8E3C != 0) && (arg0 < 6)) { + func_801A54D0(arg0); + } +} + +u16 func_801A5100(void) { + return D_801D8E44; +} + +u8 func_801A510C(void) { + return D_801D8E3C; +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5118.s") -- cgit v1.2.3 From eecc39d5c723a10f6695eee2c18cb849e36b2361 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 16:07:59 +1100 Subject: Match func_801A5A1C --- src/code/audio/code_801A51F0.c | 44 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index 20ae5b8e3..91a827bfa 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -17,14 +17,15 @@ typedef struct { extern OSVoiceUnk D_801FD5A0; extern OSVoiceHandle D_801FD5B8; +extern u8 D_801FD610[]; -char D_801D8E50[] = +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" "PE\0HO\0BO\0PO\0MA\0MI\0MU\0ME\0MO\0ya\0YA\0yu\0YU\0yo\0YO\0RA\0RI\0RU\0RE\0RO\0wa\0WA\0WI\0WE\0WO\0NN\0VU\0ka\0ke" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; -char D_801D8F70[] = "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" +s8 D_801D8F70[] = "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\0" "HI\0BI\0PI\0HU\0BU\0PU\0HE\0BE\0PE\0HO\0BO\0PO\0MA\0MI\0 " "\0MU\0ME\0MO\0ya\0YA\0yu\0YU\0yo\0YO\0RA\0RI\0RU\0RE\0RO\0wa\0WA\0WI\0WE\0WO\0NN\0VU\0ka\0ke\0\0\0" @@ -122,4 +123,41 @@ void func_801A5A10(void) { D_801FD5A0.unk_00 = 0; } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5A1C.s") +u8* func_801A5A1C(s8* arg0) { + u8* new_var1; + u8 i; + u8 j; + u8 temp_t6; + u8 temp_t8; + u8* new_var2; + u8 len = strlen(arg0); + + for (j = 0, i = 0; i < len; i += 2) { + + temp_t8 = arg0[i]; + temp_t6 = arg0[i + 1]; + + new_var1 = &temp_t8; + new_var2 = &temp_t6; + + if (temp_t8 == 0x83) { + D_801FD610[j++] = D_801D8F70[3 * (temp_t6 - 0x40)]; + D_801FD610[j++] = D_801D8F70[3 * (temp_t6 - 0x40) + 1]; + } else if (temp_t8 == 0x82) { + D_801FD610[j++] = D_801D8E50[3 * (temp_t6 - 0x9F)]; + D_801FD610[j++] = D_801D8E50[3 * (temp_t6 - 0x9F) + 1]; + } else if (temp_t8 == 0x81 && temp_t6 == 0x5B) { + D_801FD610[j++] = 0x2D; + D_801FD610[j++] = 0x2D; + } else { + D_801FD610[j++] = 0x20; + D_801FD610[j++] = 0x20; + } + } + + D_801FD610[i] = 0; + + return D_801FD610; + +} + -- cgit v1.2.3 From 8a9e49a8896dc120447765ad9527cc270f02a80c Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 16:26:50 +1100 Subject: Match func_801A5228 --- src/code/audio/code_801A51F0.c | 55 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 5 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index 91a827bfa..7dd3a523a 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -4,6 +4,9 @@ s32 func_80175008(); void func_8017506C(s32); +// internal voice functions +u8* func_801A5A1C(s8* arg0); + typedef struct { /* 0x00 */ u8* unk_00; /* 0x04 */ u8 unk_04; @@ -58,7 +61,49 @@ s32 func_801A51F0(s32 errorCode) { } } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5228.s") +s32 func_801A5228(u8* arg0) { + s32 temp_s2; + s32 errorCode; + u8 temp_s1; + u8 i; + u32 indexTemp; + s32 index; + + D_801FD5A0.unk_04 = 0; + D_801FD5A0.unk_08 = 0; + D_801FD5A0.unk_0C = 1000; + D_801FD5A0.unk_0E = 5; + D_801FD5A0.unk_10 = 0; + D_801FD5A0.unk_00 = arg0; + + temp_s1 = arg0[600]; + temp_s2 = func_80175008(); + errorCode = osVoiceClearDictionary(&D_801FD5B8, temp_s1); + func_8017506C(temp_s2); + + if (errorCode != 0) { + return errorCode; + } + + for (i = 0; i < (((temp_s1 - 1) / 8) + 1); i++) { + D_801FD608[i] = 0; + + } + + for (i = 0; i < temp_s1; i++) { + temp_s2 = func_80175008(); + indexTemp = i; + index = indexTemp * 30; + errorCode = osVoiceSetWord(&D_801FD5B8, &arg0[index]); + func_8017506C(temp_s2); + + if (func_801A51F0(errorCode) != 0) { + func_801A5A1C(&arg0[index]); + } + } + + return errorCode; +} s32 func_801A5390(void) { s32 temp_t6; @@ -124,12 +169,12 @@ void func_801A5A10(void) { } u8* func_801A5A1C(s8* arg0) { - u8* new_var1; + u8* indexTemp1; u8 i; u8 j; u8 temp_t6; u8 temp_t8; - u8* new_var2; + u8* index; u8 len = strlen(arg0); for (j = 0, i = 0; i < len; i += 2) { @@ -137,8 +182,8 @@ u8* func_801A5A1C(s8* arg0) { temp_t8 = arg0[i]; temp_t6 = arg0[i + 1]; - new_var1 = &temp_t8; - new_var2 = &temp_t6; + indexTemp1 = &temp_t8; + index = &temp_t6; if (temp_t8 == 0x83) { D_801FD610[j++] = D_801D8F70[3 * (temp_t6 - 0x40)]; -- cgit v1.2.3 From aafe1b4e153972568c68ae0e0e8158e6c9c2367d Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 17:02:28 +1100 Subject: Match func_801A54D0 --- src/code/audio/code_801A51F0.c | 47 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index 7dd3a523a..23a3e03e8 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -21,6 +21,7 @@ typedef struct { extern OSVoiceUnk D_801FD5A0; extern OSVoiceHandle D_801FD5B8; extern u8 D_801FD610[]; +extern s8 D_801FD5A4; 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" @@ -158,7 +159,51 @@ UNK_PTR func_801A54C4(void) { return &D_801FD608; } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A54D0.s") +s32 func_801A54D0(u16 arg0) { + s32 errorCode; + u8 phi_t0; + u8 sp22; + u8 i; + s32 sp1C; + + phi_t0 = true; + if (D_801FD5A0.unk_00 != 0) { + sp22 = D_801FD5A0.unk_00[0x258]; + } else { + sp22 = 0x14; + phi_t0 = false; + } + + if (arg0 == 0xFFFF) { + for (i = 0; i < sp22; i++) { + D_801FD608[i / 8] |= 1 << (i % 8); + } + } else { + if (D_801FD608[arg0 / 8] & (1 << (arg0 % 8))) { + phi_t0 = false; + } else { + D_801FD608[arg0 / 8] |= (1 << (arg0 % 8)); + } + } + + if (phi_t0) { + sp1C = func_80175008(); + errorCode = osVoiceStopReadData(&D_801FD5B8); + func_8017506C(sp1C); + + if ((errorCode == 0) || (D_801FD5A4 == 0)) { + sp1C = func_80175008(); + errorCode = osVoiceMaskDictionary(&D_801FD5B8, D_801FD608, ((sp22 - 1) / 8) + 1); + func_8017506C(sp1C); + } + + D_801FD5A4 = 0; + } + + return errorCode; +} + + #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5680.s") -- cgit v1.2.3 From b1cfaaff8b914101b0b52a9e14f4eeb937c9a971 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 17:13:14 +1100 Subject: Doc padmgr functions used --- src/code/audio/code_801A51F0.c | 52 +++++++++++++++++++++++------------------- src/code/padmgr.c | 4 ++-- 2 files changed, 30 insertions(+), 26 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index 23a3e03e8..bcbf50bd7 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -1,9 +1,5 @@ #include "global.h" -// padmgr functions -s32 func_80175008(); -void func_8017506C(s32); - // internal voice functions u8* func_801A5A1C(s8* arg0); @@ -63,7 +59,7 @@ s32 func_801A51F0(s32 errorCode) { } s32 func_801A5228(u8* arg0) { - s32 temp_s2; + OSMesgQueue* msgQ; s32 errorCode; u8 temp_s1; u8 i; @@ -78,9 +74,10 @@ s32 func_801A5228(u8* arg0) { D_801FD5A0.unk_00 = arg0; temp_s1 = arg0[600]; - temp_s2 = func_80175008(); + + msgQ = PadMgr_LockSerialMesgQueue(); errorCode = osVoiceClearDictionary(&D_801FD5B8, temp_s1); - func_8017506C(temp_s2); + PadMgr_UnlockSerialMesgQueue(msgQ); if (errorCode != 0) { return errorCode; @@ -92,11 +89,12 @@ s32 func_801A5228(u8* arg0) { } for (i = 0; i < temp_s1; i++) { - temp_s2 = func_80175008(); + + msgQ = PadMgr_LockSerialMesgQueue(); indexTemp = i; index = indexTemp * 30; errorCode = osVoiceSetWord(&D_801FD5B8, &arg0[index]); - func_8017506C(temp_s2); + PadMgr_UnlockSerialMesgQueue(msgQ); if (func_801A51F0(errorCode) != 0) { func_801A5A1C(&arg0[index]); @@ -108,13 +106,15 @@ s32 func_801A5228(u8* arg0) { s32 func_801A5390(void) { s32 temp_t6; - s32 sp18; + OSMesgQueue* msgQ; temp_t6 = D_801FD5A0.unk_08; D_801FD5A0.unk_08 = 0; - sp18 = func_80175008(); + + msgQ = PadMgr_LockSerialMesgQueue(); osVoiceStartReadData(&D_801FD5B8); - func_8017506C(sp18); + PadMgr_UnlockSerialMesgQueue(msgQ); + return temp_t6; } @@ -132,12 +132,14 @@ void func_801A53E8(u16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4) { void func_801A541C(s32 analog, s32 digital) { s32 sp1C; - s32 sp18; + OSMesgQueue* msgQ; if (D_801FD5A0.unk_00 != 0) { - sp18 = func_80175008(); + + msgQ = PadMgr_LockSerialMesgQueue(); sp1C = osVoiceControlGain(&D_801FD5B8, analog, digital); - func_8017506C(sp18); + PadMgr_UnlockSerialMesgQueue(msgQ); + if (sp1C != 0) { func_801A51F0(sp1C); } @@ -146,12 +148,13 @@ void func_801A541C(s32 analog, s32 digital) { s32 func_801A5488(u8* word) { s32 sp1C; - s32 sp18; + OSMesgQueue* msgQ; s32 temp_v0; - sp18 = func_80175008(); + msgQ = PadMgr_LockSerialMesgQueue(); sp1C = osVoiceCheckWord(word); - func_8017506C(sp18); + PadMgr_UnlockSerialMesgQueue(msgQ); + return sp1C; } @@ -164,7 +167,7 @@ s32 func_801A54D0(u16 arg0) { u8 phi_t0; u8 sp22; u8 i; - s32 sp1C; + OSMesgQueue* msgQ; phi_t0 = true; if (D_801FD5A0.unk_00 != 0) { @@ -187,16 +190,17 @@ s32 func_801A54D0(u16 arg0) { } if (phi_t0) { - sp1C = func_80175008(); + msgQ = PadMgr_LockSerialMesgQueue(); errorCode = osVoiceStopReadData(&D_801FD5B8); - func_8017506C(sp1C); + PadMgr_UnlockSerialMesgQueue(msgQ); if ((errorCode == 0) || (D_801FD5A4 == 0)) { - sp1C = func_80175008(); + + msgQ = PadMgr_LockSerialMesgQueue(); errorCode = osVoiceMaskDictionary(&D_801FD5B8, D_801FD608, ((sp22 - 1) / 8) + 1); - func_8017506C(sp1C); + PadMgr_UnlockSerialMesgQueue(msgQ); } - + D_801FD5A4 = 0; } diff --git a/src/code/padmgr.c b/src/code/padmgr.c index 0d539126a..dbe85053c 100644 --- a/src/code/padmgr.c +++ b/src/code/padmgr.c @@ -13,11 +13,11 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/Padmgr_GetEventCallback.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/func_80175008.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/PadMgr_LockSerialMesgQueue.s") #pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/Padmgr_SetEventCallback.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/func_8017506C.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/PadMgr_UnlockSerialMesgQueue.s") #pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/Padmgr_Lock.s") -- cgit v1.2.3 From 1d30e8ba6b2afa82ef703f9f4e5121caf02106e1 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 18:07:32 +1100 Subject: Match func_801A5680, it's near identical to func_801A54D0 --- src/code/audio/code_801A51F0.c | 43 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index bcbf50bd7..bb2fd4dc1 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -195,7 +195,6 @@ s32 func_801A54D0(u16 arg0) { PadMgr_UnlockSerialMesgQueue(msgQ); if ((errorCode == 0) || (D_801FD5A4 == 0)) { - msgQ = PadMgr_LockSerialMesgQueue(); errorCode = osVoiceMaskDictionary(&D_801FD5B8, D_801FD608, ((sp22 - 1) / 8) + 1); PadMgr_UnlockSerialMesgQueue(msgQ); @@ -207,9 +206,49 @@ s32 func_801A54D0(u16 arg0) { return errorCode; } +s32 func_801A5680(u16 arg0) { + s32 errorCode; + u8 phi_a3; + u8 sp22; + u8 i; + OSMesgQueue* msgQ; + + phi_a3 = true; + if (D_801FD5A0.unk_00 != 0) { + sp22 = D_801FD5A0.unk_00[0x258]; + } else { + sp22 = 0x14; + phi_a3 = false; + } + + if (arg0 == 0xFFFF) { + for (i = 0; i < (((sp22 - 1) / 8) + 1); i++) { + D_801FD608[i] = 0; + } + } else { + if (!(D_801FD608[arg0 / 8] & (1 << (arg0 % 8)))) { + phi_a3 = false; + } else { + D_801FD608[arg0 / 8] &= (1 << (arg0 % 8)) ^ 0xFF; + } + } + + if (phi_a3) { + msgQ = PadMgr_LockSerialMesgQueue(); + errorCode = osVoiceStopReadData(&D_801FD5B8); + PadMgr_UnlockSerialMesgQueue(msgQ); + if ((errorCode == 0) || (D_801FD5A4 == 0)) { + msgQ = PadMgr_LockSerialMesgQueue(); + errorCode = osVoiceMaskDictionary(&D_801FD5B8, D_801FD608, ((sp22 - 1) / 8) + 1); + PadMgr_UnlockSerialMesgQueue(msgQ); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5680.s") + D_801FD5A4 = 0; + } + + return errorCode; +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5808.s") -- cgit v1.2.3 From 7ac4c334eb7cac1b38fe47db5022c35d4296c180 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 18:41:16 +1100 Subject: code_801A51F0 OK --- src/code/audio/code_801A51F0.c | 80 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 69 insertions(+), 11 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index bb2fd4dc1..2bc4a9950 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -5,8 +5,8 @@ u8* func_801A5A1C(s8* arg0); typedef struct { /* 0x00 */ u8* unk_00; - /* 0x04 */ u8 unk_04; - /* 0x08 */ s32 unk_08; + /* 0x04 */ s8 unk_04; + /* 0x08 */ OSVoiceData* unk_08; /* 0x0C */ u16 unk_0C; /* 0x0E */ u16 unk_0E; /* 0x10 */ u16 unk_10; @@ -16,8 +16,11 @@ typedef struct { 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; 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" @@ -67,7 +70,7 @@ s32 func_801A5228(u8* arg0) { s32 index; D_801FD5A0.unk_04 = 0; - D_801FD5A0.unk_08 = 0; + D_801FD5A0.unk_08 = NULL; D_801FD5A0.unk_0C = 1000; D_801FD5A0.unk_0E = 5; D_801FD5A0.unk_10 = 0; @@ -104,12 +107,12 @@ s32 func_801A5228(u8* arg0) { return errorCode; } -s32 func_801A5390(void) { - s32 temp_t6; +OSVoiceData* func_801A5390(void) { + OSVoiceData* temp_t6; OSMesgQueue* msgQ; temp_t6 = D_801FD5A0.unk_08; - D_801FD5A0.unk_08 = 0; + D_801FD5A0.unk_08 = NULL; msgQ = PadMgr_LockSerialMesgQueue(); osVoiceStartReadData(&D_801FD5B8); @@ -171,9 +174,9 @@ s32 func_801A54D0(u16 arg0) { phi_t0 = true; if (D_801FD5A0.unk_00 != 0) { - sp22 = D_801FD5A0.unk_00[0x258]; + sp22 = D_801FD5A0.unk_00[600]; } else { - sp22 = 0x14; + sp22 = 20; phi_t0 = false; } @@ -215,9 +218,9 @@ s32 func_801A5680(u16 arg0) { phi_a3 = true; if (D_801FD5A0.unk_00 != 0) { - sp22 = D_801FD5A0.unk_00[0x258]; + sp22 = D_801FD5A0.unk_00[600]; } else { - sp22 = 0x14; + sp22 = 20; phi_a3 = false; } @@ -250,7 +253,62 @@ s32 func_801A5680(u16 arg0) { return errorCode; } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5808.s") +void func_801A5808(void) { + s32 errorCode = 0; + s32 pad; + OSMesgQueue* msgQ; + + switch (D_801FD5A0.unk_04) { + case 0: + msgQ = PadMgr_LockSerialMesgQueue(); + errorCode = osVoiceStartReadData(&D_801FD5B8); + PadMgr_UnlockSerialMesgQueue(msgQ); + + D_801FD5A4 = 1; + break; + case 1: + msgQ = PadMgr_LockSerialMesgQueue(); + errorCode = osVoiceGetReadData(&D_801FD5B8, &D_801FD5C8); + PadMgr_UnlockSerialMesgQueue(msgQ); + + if (func_801A51F0(errorCode) == 0) { + switch (D_801FD5C4) { + case 0: + D_801FD5A4 = 2; + break; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + case 7: + D_801FD5A4 = 2; + break; + } + } + break; + case 2: + if (((D_801FD5C8.warning & D_801FD5A0.unk_10) == 0) && (D_801FD5A0.unk_0E >= D_801FD5C8.answer_num) && (D_801FD5A0.unk_0C >= D_801FD5C8.distance[0]) && (D_801FD5C8.voice_level >= D_801FD5A0.unk_12) && (D_801FD5C8.voice_sn >= D_801FD5A0.unk_14)) { + D_801FD5E8 = D_801FD5C8; + D_801FD5A0.unk_08 = &D_801FD5E8; + } + + msgQ = PadMgr_LockSerialMesgQueue(); + osVoiceStopReadData(&D_801FD5B8); + PadMgr_UnlockSerialMesgQueue(msgQ); + + msgQ = PadMgr_LockSerialMesgQueue(); + errorCode = osVoiceStartReadData(&D_801FD5B8); + PadMgr_UnlockSerialMesgQueue(msgQ); + + D_801FD5A4 = 1; + break; + } + + func_801A51F0(errorCode); +} void func_801A5A10(void) { D_801FD5A0.unk_00 = 0; -- cgit v1.2.3 From 11275cf1b48cefc5d432ff9e5e74ea53d66efe8b Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 19:10:21 +1100 Subject: Match func_801A4EB8 --- src/code/audio/code_801A4EB0.c | 40 +++++++++++++++++++++++++++++++++++++++- src/code/audio/code_801A51F0.c | 4 ++-- 2 files changed, 41 insertions(+), 3 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A4EB0.c b/src/code/audio/code_801A4EB0.c index 441a70472..03d71c4b9 100644 --- a/src/code/audio/code_801A4EB0.c +++ b/src/code/audio/code_801A4EB0.c @@ -1,12 +1,50 @@ #include "global.h" +s32 func_801A5228(u8* arg0); +void func_801A53E8(u16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); + void func_801A5680(u16 arg0); void func_801A54D0(u16 arg0); +u8* func_801A54C4(void); + +extern u8 D_801D8BE0; +extern OSVoiceHandle D_801FD5B8; void func_801A4EB0(void) { } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4EB8.s") +void func_801A4EB8(void) { + u8* new_var; + OSMesgQueue* msgQ; + s32 index; + u8 sp38[1]; + u8 i; + + if (D_801D8E3C != 0) { + msgQ = PadMgr_LockSerialMesgQueue(); + osVoiceStopReadData(&D_801FD5B8); + PadMgr_UnlockSerialMesgQueue(msgQ); + } + + new_var = func_801A54C4(); + + for (i = 0; i < 1; i++) { + sp38[i] = new_var[i]; + } + + if (func_801A5228(&D_801D8BE0) == 0) { + for (i = 0; i < 6; i++) { + index = i / 8; + if (((sp38[index] >> (i % 8)) & 1) == 1) { + func_801A54D0(i); + } + + } + + func_801A53E8(0x320, 2, 0x400, 0x1F4, 0x7D0); + D_801D8E3C = 1; + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4FD8.s") diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index 2bc4a9950..03e186283 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -161,8 +161,8 @@ s32 func_801A5488(u8* word) { return sp1C; } -UNK_PTR func_801A54C4(void) { - return &D_801FD608; +u8* func_801A54C4(void) { + return D_801FD608; } s32 func_801A54D0(u16 arg0) { -- cgit v1.2.3 From 716de8820ef3b9006013e6ce45bbaeede3a58934 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 19:13:53 +1100 Subject: Match func_801A4FD8 (mips2c got it matching directly) --- src/code/audio/code_801A4EB0.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A4EB0.c b/src/code/audio/code_801A4EB0.c index 03d71c4b9..ee4c9f4e6 100644 --- a/src/code/audio/code_801A4EB0.c +++ b/src/code/audio/code_801A4EB0.c @@ -1,8 +1,11 @@ #include "global.h" +void func_801A5080(u16 arg0); + s32 func_801A5228(u8* arg0); void func_801A53E8(u16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); + void func_801A5680(u16 arg0); void func_801A54D0(u16 arg0); u8* func_801A54C4(void); @@ -46,7 +49,26 @@ void func_801A4EB8(void) { } } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4FD8.s") +void func_801A4FD8(void) { + s32 sp24; + OSMesgQueue* msgQ; + + func_801A54D0(0xFFFF); + if (D_801D8E3C != 0) { + msgQ = PadMgr_LockSerialMesgQueue(); + osVoiceStopReadData(&D_801FD5B8); + PadMgr_UnlockSerialMesgQueue(msgQ); + + sp24 = func_801A5228(&D_801D8BE0); + func_801A54D0(0xFFFF); + if (sp24 == 0) { + func_801A53E8(0x320, 2, 0x400, 0x1F4, 0x7D0); + D_801D8E3C = 1; + } + func_801A5080(5); + func_801A5080(1); + } +} void func_801A5080(u16 arg0) { if ((D_801D8E3C != 0) && (arg0 < 6)) { -- cgit v1.2.3 From 957bc0b65f7e4f6010610058660065f05ded310b Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 19:23:33 +1100 Subject: code_801A4EB0 & all of voice, OK --- src/code/audio/code_801A4EB0.c | 33 ++++++++++++++++++++++++++++++--- src/code/audio/code_801A51F0.c | 6 +++--- 2 files changed, 33 insertions(+), 6 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A4EB0.c b/src/code/audio/code_801A4EB0.c index ee4c9f4e6..bb496ad5c 100644 --- a/src/code/audio/code_801A4EB0.c +++ b/src/code/audio/code_801A4EB0.c @@ -4,14 +4,16 @@ void func_801A5080(u16 arg0); s32 func_801A5228(u8* arg0); void func_801A53E8(u16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); - - +s32 func_801A5808(void); +OSVoiceData* func_801A5390(void); void func_801A5680(u16 arg0); void func_801A54D0(u16 arg0); u8* func_801A54C4(void); extern u8 D_801D8BE0; extern OSVoiceHandle D_801FD5B8; +extern OSVoiceData* D_801D8E40; +extern u8 D_801D8E48; void func_801A4EB0(void) { } @@ -90,4 +92,29 @@ u8 func_801A510C(void) { return D_801D8E3C; } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5118.s") +void func_801A5118(void) { + if (D_801D8E3C & 2) { + D_801D8E3C &= 1; + func_801A4EB8(); + } + + if (D_801D8E3C != 0) { + if (func_801A5808() != 0) { + D_801D8E48++; + if (D_801D8E48 == 0xA) { + D_801D8E3C = 0; + D_801D8E44 = 0xFFFF; + return; + } + } else { + D_801D8E48 = 0; + } + + D_801D8E40 = func_801A5390(); + if (D_801D8E40 != 0) { + D_801D8E44 = D_801D8E40->answer[0]; + } else { + D_801D8E44 = 0xFFFF; + } + } +} diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index 03e186283..acff8dba6 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -253,9 +253,9 @@ s32 func_801A5680(u16 arg0) { return errorCode; } -void func_801A5808(void) { +s32 func_801A5808(void) { s32 errorCode = 0; - s32 pad; + s32 ret; OSMesgQueue* msgQ; switch (D_801FD5A0.unk_04) { @@ -307,7 +307,7 @@ void func_801A5808(void) { break; } - func_801A51F0(errorCode); + return func_801A51F0(errorCode); } void func_801A5A10(void) { -- cgit v1.2.3 From 1ede43f7ac6c4eaaab4a1590f77a9c8f714808aa Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 19:55:04 +1100 Subject: Import bss --- src/code/audio/code_801A51F0.c | 63 +++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 29 deletions(-) (limited to 'src/code') 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 - -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; - +// BSS +OSVoiceUnk D_801FD5A0; +OSVoiceHandle D_801FD5B8; +OSVoiceData D_801FD5C8; +OSVoiceData D_801FD5E8; +u8 D_801FD608[8]; + +// 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) { -- cgit v1.2.3 From 35297dfa170ba9c8c5cf549bc30777a97f7f5518 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 20:03:00 +1100 Subject: Better match for func_801A5A1C --- src/code/audio/code_801A51F0.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index cd89ba4df..cdb443307 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -253,7 +253,6 @@ s32 func_801A5680(u16 arg0) { return errorCode; } -// #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5808.s") s32 func_801A5808(void) { s32 errorCode = 0; s32 ret; @@ -320,29 +319,22 @@ void func_801A5A10(void) { } u8* func_801A5A1C(s8* arg0) { - u8* indexTemp1; u8 i; u8 j; - u8 temp_t6; - u8 temp_t8; - u8* index; u8 len = strlen(arg0); + u8 temp_t8[2]; for (j = 0, i = 0; i < len; i += 2) { - - temp_t8 = arg0[i]; - temp_t6 = arg0[i + 1]; - - indexTemp1 = &temp_t8; - index = &temp_t6; - - if (temp_t8 == 0x83) { - D_801FD610[j++] = D_801D8F70[3 * (temp_t6 - 0x40)]; - D_801FD610[j++] = D_801D8F70[3 * (temp_t6 - 0x40) + 1]; - } else if (temp_t8 == 0x82) { - D_801FD610[j++] = D_801D8E50[3 * (temp_t6 - 0x9F)]; - D_801FD610[j++] = D_801D8E50[3 * (temp_t6 - 0x9F) + 1]; - } else if (temp_t8 == 0x81 && temp_t6 == 0x5B) { + temp_t8[0] = arg0[i]; + temp_t8[1] = arg0[i + 1]; + + if (temp_t8[0] == 0x83) { + D_801FD610[j++] = D_801D8F70[3 * (temp_t8[1] - 0x40)]; + D_801FD610[j++] = D_801D8F70[3 * (temp_t8[1] - 0x40) + 1]; + } else if (temp_t8[0] == 0x82) { + D_801FD610[j++] = D_801D8E50[3 * (temp_t8[1] - 0x9F)]; + D_801FD610[j++] = D_801D8E50[3 * (temp_t8[1] - 0x9F) + 1]; + } else if (temp_t8[0] == 0x81 && temp_t8[1] == 0x5B) { D_801FD610[j++] = 0x2D; D_801FD610[j++] = 0x2D; } else { -- cgit v1.2.3 From 97d720e788a3c762c09cb6a337629662bcdd4a36 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 20:05:29 +1100 Subject: format --- src/code/audio/code_801A4EB0.c | 3 +-- src/code/audio/code_801A51F0.c | 39 +++++++++++++++++++-------------------- 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A4EB0.c b/src/code/audio/code_801A4EB0.c index bb496ad5c..4863a68a5 100644 --- a/src/code/audio/code_801A4EB0.c +++ b/src/code/audio/code_801A4EB0.c @@ -43,7 +43,6 @@ void func_801A4EB8(void) { if (((sp38[index] >> (i % 8)) & 1) == 1) { func_801A54D0(i); } - } func_801A53E8(0x320, 2, 0x400, 0x1F4, 0x7D0); @@ -97,7 +96,7 @@ void func_801A5118(void) { D_801D8E3C &= 1; func_801A4EB8(); } - + if (D_801D8E3C != 0) { if (func_801A5808() != 0) { D_801D8E48++; diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index cdb443307..18bf8bcb7 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -12,7 +12,7 @@ u8 D_801FD608[8]; // Maybe all the same? // u8 D_801FD610[0x11B0]; -u8 D_801FD610[0x100]; +u8 D_801FD610[0x100]; u8 D_801FD710[0x1B0]; u8 D_801FD8C0[0x240]; u8 D_801FDB00[0x600]; @@ -29,10 +29,10 @@ s8 D_801D8E50[] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; s8 D_801D8F70[] = "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\0" - "HI\0BI\0PI\0HU\0BU\0PU\0HE\0BE\0PE\0HO\0BO\0PO\0MA\0MI\0 " - "\0MU\0ME\0MO\0ya\0YA\0yu\0YU\0yo\0YO\0RA\0RI\0RU\0RE\0RO\0wa\0WA\0WI\0WE\0WO\0NN\0VU\0ka\0ke\0\0\0" - "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; + "\0ZU\0SE\0ZE\0SO\0ZO\0TA\0DA\0TI\0DI\0tu\0TU\0DU\0TE\0DE\0TO\0DO\0NA\0NI\0NU\0NE\0NO\0HA\0BA\0PA\0" + "HI\0BI\0PI\0HU\0BU\0PU\0HE\0BE\0PE\0HO\0BO\0PO\0MA\0MI\0 " + "\0MU\0ME\0MO\0ya\0YA\0yu\0YU\0yo\0YO\0RA\0RI\0RU\0RE\0RO\0wa\0WA\0WI\0WE\0WO\0NN\0VU\0ka\0ke\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; /* char D_801E0EC0[] = "Error %d\n" @@ -75,7 +75,7 @@ s32 func_801A5228(u8* arg0) { D_801FD5A0.unk_0E = 5; D_801FD5A0.unk_10 = 0; D_801FD5A0.unk_00 = arg0; - + temp_s1 = arg0[600]; msgQ = PadMgr_LockSerialMesgQueue(); @@ -84,11 +84,10 @@ s32 func_801A5228(u8* arg0) { if (errorCode != 0) { return errorCode; - } + } for (i = 0; i < (((temp_s1 - 1) / 8) + 1); i++) { D_801FD608[i] = 0; - } for (i = 0; i < temp_s1; i++) { @@ -98,7 +97,7 @@ s32 func_801A5228(u8* arg0) { index = indexTemp * 30; errorCode = osVoiceSetWord(&D_801FD5B8, &arg0[index]); PadMgr_UnlockSerialMesgQueue(msgQ); - + if (func_801A51F0(errorCode) != 0) { func_801A5A1C(&arg0[index]); } @@ -171,7 +170,7 @@ s32 func_801A54D0(u16 arg0) { u8 sp22; u8 i; OSMesgQueue* msgQ; - + phi_t0 = true; if (D_801FD5A0.unk_00 != 0) { sp22 = D_801FD5A0.unk_00[600]; @@ -191,7 +190,7 @@ s32 func_801A54D0(u16 arg0) { D_801FD608[arg0 / 8] |= (1 << (arg0 % 8)); } } - + if (phi_t0) { msgQ = PadMgr_LockSerialMesgQueue(); errorCode = osVoiceStopReadData(&D_801FD5B8); @@ -205,7 +204,7 @@ s32 func_801A54D0(u16 arg0) { D_801FD5A0.unk_04 = 0; } - + return errorCode; } @@ -215,7 +214,7 @@ s32 func_801A5680(u16 arg0) { u8 sp22; u8 i; OSMesgQueue* msgQ; - + phi_a3 = true; if (D_801FD5A0.unk_00 != 0) { sp22 = D_801FD5A0.unk_00[600]; @@ -235,7 +234,7 @@ s32 func_801A5680(u16 arg0) { D_801FD608[arg0 / 8] &= (1 << (arg0 % 8)) ^ 0xFF; } } - + if (phi_a3) { msgQ = PadMgr_LockSerialMesgQueue(); errorCode = osVoiceStopReadData(&D_801FD5B8); @@ -249,7 +248,7 @@ s32 func_801A5680(u16 arg0) { D_801FD5A0.unk_04 = 0; } - + return errorCode; } @@ -292,7 +291,9 @@ s32 func_801A5808(void) { } break; case 2: - if (((D_801FD5C8.warning & D_801FD5A0.unk_10) == 0) && (D_801FD5A0.unk_0E >= D_801FD5C8.answer_num) && (D_801FD5A0.unk_0C >= D_801FD5C8.distance[0]) && (D_801FD5C8.voice_level >= D_801FD5A0.unk_12) && (D_801FD5C8.voice_sn >= D_801FD5A0.unk_14)) { + if (((D_801FD5C8.warning & D_801FD5A0.unk_10) == 0) && (D_801FD5A0.unk_0E >= D_801FD5C8.answer_num) && + (D_801FD5A0.unk_0C >= D_801FD5C8.distance[0]) && (D_801FD5C8.voice_level >= D_801FD5A0.unk_12) && + (D_801FD5C8.voice_sn >= D_801FD5A0.unk_14)) { D_801FD5E8 = D_801FD5C8; D_801FD5A0.unk_08 = &D_801FD5E8; } @@ -300,7 +301,7 @@ s32 func_801A5808(void) { msgQ = PadMgr_LockSerialMesgQueue(); osVoiceStopReadData(&D_801FD5B8); PadMgr_UnlockSerialMesgQueue(msgQ); - + msgQ = PadMgr_LockSerialMesgQueue(); errorCode = osVoiceStartReadData(&D_801FD5B8); PadMgr_UnlockSerialMesgQueue(msgQ); @@ -342,10 +343,8 @@ u8* func_801A5A1C(s8* arg0) { D_801FD610[j++] = 0x20; } } - + D_801FD610[i] = 0; return D_801FD610; - } - -- cgit v1.2.3 From e488020b458779d8ece659451a696f19ae1949fc Mon Sep 17 00:00:00 2001 From: engineer124 Date: Thu, 11 Nov 2021 22:18:44 +1100 Subject: Cleanup --- src/code/audio/code_801A4EB0.c | 22 +++++---- src/code/audio/code_801A51F0.c | 101 ++++++++++++++++++++++++++--------------- 2 files changed, 79 insertions(+), 44 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A4EB0.c b/src/code/audio/code_801A4EB0.c index 4863a68a5..62b88449b 100644 --- a/src/code/audio/code_801A4EB0.c +++ b/src/code/audio/code_801A4EB0.c @@ -6,8 +6,8 @@ s32 func_801A5228(u8* arg0); void func_801A53E8(u16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); s32 func_801A5808(void); OSVoiceData* func_801A5390(void); -void func_801A5680(u16 arg0); -void func_801A54D0(u16 arg0); +s32 func_801A5680(u16 arg0); +s32 func_801A54D0(u16 arg0); u8* func_801A54C4(void); extern u8 D_801D8BE0; @@ -45,13 +45,14 @@ void func_801A4EB8(void) { } } - func_801A53E8(0x320, 2, 0x400, 0x1F4, 0x7D0); + func_801A53E8(800, 2, VOICE_WARN_TOO_SMALL, 500, 2000); D_801D8E3C = 1; } } +// Used externally in code_8019AF00 void func_801A4FD8(void) { - s32 sp24; + s32 errorCode; OSMesgQueue* msgQ; func_801A54D0(0xFFFF); @@ -60,12 +61,13 @@ void func_801A4FD8(void) { osVoiceStopReadData(&D_801FD5B8); PadMgr_UnlockSerialMesgQueue(msgQ); - sp24 = func_801A5228(&D_801D8BE0); + errorCode = func_801A5228(&D_801D8BE0); func_801A54D0(0xFFFF); - if (sp24 == 0) { - func_801A53E8(0x320, 2, 0x400, 0x1F4, 0x7D0); + if (errorCode == 0) { + func_801A53E8(800, 2, VOICE_WARN_TOO_SMALL, 500, 2000); D_801D8E3C = 1; } + func_801A5080(5); func_801A5080(1); } @@ -77,20 +79,24 @@ void func_801A5080(u16 arg0) { } } +// Unused void func_801A50C0(u16 arg0) { if ((D_801D8E3C != 0) && (arg0 < 6)) { func_801A54D0(arg0); } } +// Used externally in many files u16 func_801A5100(void) { return D_801D8E44; } +// Unused u8 func_801A510C(void) { return D_801D8E3C; } +// Used externally in Audio_Update (code_8019AF00) void func_801A5118(void) { if (D_801D8E3C & 2) { D_801D8E3C &= 1; @@ -100,7 +106,7 @@ void func_801A5118(void) { if (D_801D8E3C != 0) { if (func_801A5808() != 0) { D_801D8E48++; - if (D_801D8E48 == 0xA) { + if (D_801D8E48 == 10) { D_801D8E3C = 0; D_801D8E44 = 0xFFFF; return; diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index 18bf8bcb7..8227f6b4a 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -12,7 +12,7 @@ u8 D_801FD608[8]; // Maybe all the same? // u8 D_801FD610[0x11B0]; -u8 D_801FD610[0x100]; +char D_801FD610[0x100]; u8 D_801FD710[0x1B0]; u8 D_801FD8C0[0x240]; u8 D_801FDB00[0x600]; @@ -22,17 +22,43 @@ 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" - "PE\0HO\0BO\0PO\0MA\0MI\0MU\0ME\0MO\0ya\0YA\0yu\0YU\0yo\0YO\0RA\0RI\0RU\0RE\0RO\0wa\0WA\0WI\0WE\0WO\0NN\0VU\0ka\0ke" - "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; - -s8 D_801D8F70[] = "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\0" - "HI\0BI\0PI\0HU\0BU\0PU\0HE\0BE\0PE\0HO\0BO\0PO\0MA\0MI\0 " - "\0MU\0ME\0MO\0ya\0YA\0yu\0YU\0yo\0YO\0RA\0RI\0RU\0RE\0RO\0wa\0WA\0WI\0WE\0WO\0NN\0VU\0ka\0ke\0\0\0" - "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; +s8 D_801D8E50[] = { + 'a', 'a', '\0', 'A', 'A', '\0', 'i', 'i', '\0', 'I', 'I', '\0', 'u', 'u', '\0', 'U', 'U', '\0', + 'e', 'e', '\0', 'E', 'E', '\0', 'o', 'o', '\0', 'O', 'O', '\0', 'K', 'A', '\0', 'G', 'A', '\0', + 'K', 'I', '\0', 'G', 'I', '\0', 'K', 'U', '\0', 'G', 'U', '\0', 'K', 'E', '\0', 'G', 'E', '\0', + 'K', 'O', '\0', 'G', 'O', '\0', 'S', 'A', '\0', 'Z', 'A', '\0', 'S', 'I', '\0', 'Z', 'I', '\0', + 'S', 'U', '\0', 'Z', 'U', '\0', 'S', 'E', '\0', 'Z', 'E', '\0', 'S', 'O', '\0', 'Z', 'O', '\0', + 'T', 'A', '\0', 'D', 'A', '\0', 'T', 'I', '\0', 'D', 'I', '\0', 't', 'u', '\0', 'T', 'U', '\0', + 'D', 'U', '\0', 'T', 'E', '\0', 'D', 'E', '\0', 'T', 'O', '\0', 'D', 'O', '\0', 'N', 'A', '\0', + 'N', 'I', '\0', 'N', 'U', '\0', 'N', 'E', '\0', 'N', 'O', '\0', 'H', 'A', '\0', 'B', 'A', '\0', + 'P', 'A', '\0', 'H', 'I', '\0', 'B', 'I', '\0', 'P', 'I', '\0', 'H', 'U', '\0', 'B', 'U', '\0', + 'P', 'U', '\0', 'H', 'E', '\0', 'B', 'E', '\0', 'P', 'E', '\0', 'H', 'O', '\0', 'B', 'O', '\0', + 'P', 'O', '\0', 'M', 'A', '\0', 'M', 'I', '\0', 'M', 'U', '\0', 'M', 'E', '\0', 'M', 'O', '\0', + 'y', 'a', '\0', 'Y', 'A', '\0', 'y', 'u', '\0', 'Y', 'U', '\0', 'y', 'o', '\0', 'Y', 'O', '\0', + 'R', 'A', '\0', 'R', 'I', '\0', 'R', 'U', '\0', 'R', 'E', '\0', 'R', 'O', '\0', 'w', 'a', '\0', + 'W', 'A', '\0', 'W', 'I', '\0', 'W', 'E', '\0', 'W', 'O', '\0', 'N', 'N', '\0', 'V', 'U', '\0', + 'k', 'a', '\0', 'k', 'e', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', +}; + +s8 D_801D8F70[] = { + 'a', 'a', '\0', 'A', 'A', '\0', 'i', 'i', '\0', 'I', 'I', '\0', 'u', 'u', '\0', 'U', 'U', '\0', + 'e', 'e', '\0', 'E', 'E', '\0', 'o', 'o', '\0', 'O', 'O', '\0', 'K', 'A', '\0', 'G', 'A', '\0', + 'K', 'I', '\0', 'G', 'I', '\0', 'K', 'U', '\0', 'G', 'U', '\0', 'K', 'E', '\0', 'G', 'E', '\0', + 'K', 'O', '\0', 'G', 'O', '\0', 'S', 'A', '\0', 'Z', 'A', '\0', 'S', 'I', '\0', 'Z', 'I', '\0', + 'S', 'U', '\0', 'Z', 'U', '\0', 'S', 'E', '\0', 'Z', 'E', '\0', 'S', 'O', '\0', 'Z', 'O', '\0', + 'T', 'A', '\0', 'D', 'A', '\0', 'T', 'I', '\0', 'D', 'I', '\0', 't', 'u', '\0', 'T', 'U', '\0', + 'D', 'U', '\0', 'T', 'E', '\0', 'D', 'E', '\0', 'T', 'O', '\0', 'D', 'O', '\0', 'N', 'A', '\0', + 'N', 'I', '\0', 'N', 'U', '\0', 'N', 'E', '\0', 'N', 'O', '\0', 'H', 'A', '\0', 'B', 'A', '\0', + 'P', 'A', '\0', 'H', 'I', '\0', 'B', 'I', '\0', 'P', 'I', '\0', 'H', 'U', '\0', 'B', 'U', '\0', + 'P', 'U', '\0', 'H', 'E', '\0', 'B', 'E', '\0', 'P', 'E', '\0', 'H', 'O', '\0', 'B', 'O', '\0', + 'P', 'O', '\0', 'M', 'A', '\0', 'M', 'I', '\0', ' ', ' ', '\0', 'M', 'U', '\0', 'M', 'E', '\0', + 'M', 'O', '\0', 'y', 'a', '\0', 'Y', 'A', '\0', 'y', 'u', '\0', 'Y', 'U', '\0', 'y', 'o', '\0', + 'Y', 'O', '\0', 'R', 'A', '\0', 'R', 'I', '\0', 'R', 'U', '\0', 'R', 'E', '\0', 'R', 'O', '\0', + 'w', 'a', '\0', 'W', 'A', '\0', 'W', 'I', '\0', 'W', 'E', '\0', 'W', 'O', '\0', 'N', 'N', '\0', + 'V', 'U', '\0', 'k', 'a', '\0', 'k', 'e', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', +}; /* char D_801E0EC0[] = "Error %d\n" @@ -120,6 +146,7 @@ OSVoiceData* func_801A5390(void) { return temp_t6; } +// Unused s32 func_801A53DC(void) { return D_801FD5A0.unk_00; } @@ -132,32 +159,33 @@ void func_801A53E8(u16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4) { D_801FD5A0.unk_14 = arg4; } -void func_801A541C(s32 analog, s32 digital) { - s32 sp1C; +// Unused +// Could have a return? or be void return? +s32 func_801A541C(s32 analog, s32 digital) { + s32 errorCode; OSMesgQueue* msgQ; - if (D_801FD5A0.unk_00 != 0) { - + if (D_801FD5A0.unk_00 != NULL) { msgQ = PadMgr_LockSerialMesgQueue(); - sp1C = osVoiceControlGain(&D_801FD5B8, analog, digital); + errorCode = osVoiceControlGain(&D_801FD5B8, analog, digital); PadMgr_UnlockSerialMesgQueue(msgQ); - if (sp1C != 0) { - func_801A51F0(sp1C); + if (errorCode != 0) { + func_801A51F0(errorCode); } } } +// Unused s32 func_801A5488(u8* word) { - s32 sp1C; + s32 errorCode; OSMesgQueue* msgQ; - s32 temp_v0; msgQ = PadMgr_LockSerialMesgQueue(); - sp1C = osVoiceCheckWord(word); + errorCode = osVoiceCheckWord(word); PadMgr_UnlockSerialMesgQueue(msgQ); - return sp1C; + return errorCode; } u8* func_801A54C4(void) { @@ -172,7 +200,7 @@ s32 func_801A54D0(u16 arg0) { OSMesgQueue* msgQ; phi_t0 = true; - if (D_801FD5A0.unk_00 != 0) { + if (D_801FD5A0.unk_00 != NULL) { sp22 = D_801FD5A0.unk_00[600]; } else { sp22 = 20; @@ -216,7 +244,7 @@ s32 func_801A5680(u16 arg0) { OSMesgQueue* msgQ; phi_a3 = true; - if (D_801FD5A0.unk_00 != 0) { + if (D_801FD5A0.unk_00 != NULL) { sp22 = D_801FD5A0.unk_00[600]; } else { sp22 = 20; @@ -274,17 +302,17 @@ s32 func_801A5808(void) { if (func_801A51F0(errorCode) == 0) { switch (D_801FD5B8.status) { - case 0: + case VOICE_STATUS_READY: D_801FD5A0.unk_04 = 2; break; - case 1: + case VOICE_STATUS_START: case 2: - case 3: + case VOICE_STATUS_CANCEL: case 4: - case 5: + case VOICE_STATUS_BUSY: case 6: break; - case 7: + case VOICE_STATUS_END: D_801FD5A0.unk_04 = 2; break; } @@ -315,8 +343,9 @@ s32 func_801A5808(void) { return ret; } +// Unused void func_801A5A10(void) { - D_801FD5A0.unk_00 = 0; + D_801FD5A0.unk_00 = NULL; } u8* func_801A5A1C(s8* arg0) { @@ -336,15 +365,15 @@ u8* func_801A5A1C(s8* arg0) { D_801FD610[j++] = D_801D8E50[3 * (temp_t8[1] - 0x9F)]; D_801FD610[j++] = D_801D8E50[3 * (temp_t8[1] - 0x9F) + 1]; } else if (temp_t8[0] == 0x81 && temp_t8[1] == 0x5B) { - D_801FD610[j++] = 0x2D; - D_801FD610[j++] = 0x2D; + D_801FD610[j++] = '-'; + D_801FD610[j++] = '-'; } else { - D_801FD610[j++] = 0x20; - D_801FD610[j++] = 0x20; + D_801FD610[j++] = ' '; + D_801FD610[j++] = ' '; } } - D_801FD610[i] = 0; + D_801FD610[i] = '\0'; return D_801FD610; } -- cgit v1.2.3 From 12164233fa5db4fbd0ac5d62a4542720ea53d814 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Fri, 12 Nov 2021 01:49:17 +1100 Subject: Clean up dictionary --- src/code/audio/code_801A51F0.c | 56 ++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 38 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index 8227f6b4a..1d519758d 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -22,42 +22,22 @@ u8 D_801FE640[0x90]; u8 D_801FE6D0[0xF0]; // Data -s8 D_801D8E50[] = { - 'a', 'a', '\0', 'A', 'A', '\0', 'i', 'i', '\0', 'I', 'I', '\0', 'u', 'u', '\0', 'U', 'U', '\0', - 'e', 'e', '\0', 'E', 'E', '\0', 'o', 'o', '\0', 'O', 'O', '\0', 'K', 'A', '\0', 'G', 'A', '\0', - 'K', 'I', '\0', 'G', 'I', '\0', 'K', 'U', '\0', 'G', 'U', '\0', 'K', 'E', '\0', 'G', 'E', '\0', - 'K', 'O', '\0', 'G', 'O', '\0', 'S', 'A', '\0', 'Z', 'A', '\0', 'S', 'I', '\0', 'Z', 'I', '\0', - 'S', 'U', '\0', 'Z', 'U', '\0', 'S', 'E', '\0', 'Z', 'E', '\0', 'S', 'O', '\0', 'Z', 'O', '\0', - 'T', 'A', '\0', 'D', 'A', '\0', 'T', 'I', '\0', 'D', 'I', '\0', 't', 'u', '\0', 'T', 'U', '\0', - 'D', 'U', '\0', 'T', 'E', '\0', 'D', 'E', '\0', 'T', 'O', '\0', 'D', 'O', '\0', 'N', 'A', '\0', - 'N', 'I', '\0', 'N', 'U', '\0', 'N', 'E', '\0', 'N', 'O', '\0', 'H', 'A', '\0', 'B', 'A', '\0', - 'P', 'A', '\0', 'H', 'I', '\0', 'B', 'I', '\0', 'P', 'I', '\0', 'H', 'U', '\0', 'B', 'U', '\0', - 'P', 'U', '\0', 'H', 'E', '\0', 'B', 'E', '\0', 'P', 'E', '\0', 'H', 'O', '\0', 'B', 'O', '\0', - 'P', 'O', '\0', 'M', 'A', '\0', 'M', 'I', '\0', 'M', 'U', '\0', 'M', 'E', '\0', 'M', 'O', '\0', - 'y', 'a', '\0', 'Y', 'A', '\0', 'y', 'u', '\0', 'Y', 'U', '\0', 'y', 'o', '\0', 'Y', 'O', '\0', - 'R', 'A', '\0', 'R', 'I', '\0', 'R', 'U', '\0', 'R', 'E', '\0', 'R', 'O', '\0', 'w', 'a', '\0', - 'W', 'A', '\0', 'W', 'I', '\0', 'W', 'E', '\0', 'W', 'O', '\0', 'N', 'N', '\0', 'V', 'U', '\0', - 'k', 'a', '\0', 'k', 'e', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', - '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', +s8 D_801D8E50[96][3] = { + "aa", "AA", "ii", "II", "uu", "UU", "ee", "EE", "oo", "OO", "KA", "GA", "KI", "GI", "KU", "GU", + "KE", "GE", "KO", "GO", "SA", "ZA", "SI", "ZI", "SU", "ZU", "SE", "ZE", "SO", "ZO", "TA", "DA", + "TI", "DI", "tu", "TU", "DU", "TE", "DE", "TO", "DO", "NA", "NI", "NU", "NE", "NO", "HA", "BA", + "PA", "HI", "BI", "PI", "HU", "BU", "PU", "HE", "BE", "PE", "HO", "BO", "PO", "MA", "MI", "MU", + "ME", "MO", "ya", "YA", "yu", "YU", "yo", "YO", "RA", "RI", "RU", "RE", "RO", "wa", "WA", "WI", + "WE", "WO", "NN", "VU", "ka", "ke", "", "", "", "", "", "", "", "", "", "", }; -s8 D_801D8F70[] = { - 'a', 'a', '\0', 'A', 'A', '\0', 'i', 'i', '\0', 'I', 'I', '\0', 'u', 'u', '\0', 'U', 'U', '\0', - 'e', 'e', '\0', 'E', 'E', '\0', 'o', 'o', '\0', 'O', 'O', '\0', 'K', 'A', '\0', 'G', 'A', '\0', - 'K', 'I', '\0', 'G', 'I', '\0', 'K', 'U', '\0', 'G', 'U', '\0', 'K', 'E', '\0', 'G', 'E', '\0', - 'K', 'O', '\0', 'G', 'O', '\0', 'S', 'A', '\0', 'Z', 'A', '\0', 'S', 'I', '\0', 'Z', 'I', '\0', - 'S', 'U', '\0', 'Z', 'U', '\0', 'S', 'E', '\0', 'Z', 'E', '\0', 'S', 'O', '\0', 'Z', 'O', '\0', - 'T', 'A', '\0', 'D', 'A', '\0', 'T', 'I', '\0', 'D', 'I', '\0', 't', 'u', '\0', 'T', 'U', '\0', - 'D', 'U', '\0', 'T', 'E', '\0', 'D', 'E', '\0', 'T', 'O', '\0', 'D', 'O', '\0', 'N', 'A', '\0', - 'N', 'I', '\0', 'N', 'U', '\0', 'N', 'E', '\0', 'N', 'O', '\0', 'H', 'A', '\0', 'B', 'A', '\0', - 'P', 'A', '\0', 'H', 'I', '\0', 'B', 'I', '\0', 'P', 'I', '\0', 'H', 'U', '\0', 'B', 'U', '\0', - 'P', 'U', '\0', 'H', 'E', '\0', 'B', 'E', '\0', 'P', 'E', '\0', 'H', 'O', '\0', 'B', 'O', '\0', - 'P', 'O', '\0', 'M', 'A', '\0', 'M', 'I', '\0', ' ', ' ', '\0', 'M', 'U', '\0', 'M', 'E', '\0', - 'M', 'O', '\0', 'y', 'a', '\0', 'Y', 'A', '\0', 'y', 'u', '\0', 'Y', 'U', '\0', 'y', 'o', '\0', - 'Y', 'O', '\0', 'R', 'A', '\0', 'R', 'I', '\0', 'R', 'U', '\0', 'R', 'E', '\0', 'R', 'O', '\0', - 'w', 'a', '\0', 'W', 'A', '\0', 'W', 'I', '\0', 'W', 'E', '\0', 'W', 'O', '\0', 'N', 'N', '\0', - 'V', 'U', '\0', 'k', 'a', '\0', 'k', 'e', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', - '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', +s8 D_801D8F70[96][3] = { + "aa", "AA", "ii", "II", "uu", "UU", "ee", "EE", "oo", "OO", "KA", "GA", "KI", "GI", "KU", "GU", + "KE", "GE", "KO", "GO", "SA", "ZA", "SI", "ZI", "SU", "ZU", "SE", "ZE", "SO", "ZO", "TA", "DA", + "TI", "DI", "tu", "TU", "DU", "TE", "DE", "TO", "DO", "NA", "NI", "NU", "NE", "NO", "HA", "BA", + "PA", "HI", "BI", "PI", "HU", "BU", "PU", "HE", "BE", "PE", "HO", "BO", "PO", "MA", "MI", " ", + "MU", "ME", "MO", "ya", "YA", "yu", "YU", "yo", "YO", "RA", "RI", "RU", "RE", "RO", "wa", "WA", + "WI", "WE", "WO", "NN", "VU", "ka", "ke", "", "", "", "", "", "", "", "", "", }; /* @@ -359,11 +339,11 @@ u8* func_801A5A1C(s8* arg0) { temp_t8[1] = arg0[i + 1]; if (temp_t8[0] == 0x83) { - D_801FD610[j++] = D_801D8F70[3 * (temp_t8[1] - 0x40)]; - D_801FD610[j++] = D_801D8F70[3 * (temp_t8[1] - 0x40) + 1]; + D_801FD610[j++] = D_801D8F70[temp_t8[1] - 0x40][0]; + D_801FD610[j++] = D_801D8F70[temp_t8[1] - 0x40][1]; } else if (temp_t8[0] == 0x82) { - D_801FD610[j++] = D_801D8E50[3 * (temp_t8[1] - 0x9F)]; - D_801FD610[j++] = D_801D8E50[3 * (temp_t8[1] - 0x9F) + 1]; + D_801FD610[j++] = D_801D8E50[temp_t8[1] - 0x9F][0]; + D_801FD610[j++] = D_801D8E50[temp_t8[1] - 0x9F][1]; } else if (temp_t8[0] == 0x81 && temp_t8[1] == 0x5B) { D_801FD610[j++] = '-'; D_801FD610[j++] = '-'; -- cgit v1.2.3 From cb5d51579bdd289d980ace13500d17b13cfcd38f Mon Sep 17 00:00:00 2001 From: engineer124 Date: Fri, 12 Nov 2021 12:33:06 +1100 Subject: Introduce OSVoiceDictionary --- src/code/audio/code_801A4EB0.c | 4 +- src/code/audio/code_801A51F0.c | 93 ++++++++++++++++++++---------------------- 2 files changed, 46 insertions(+), 51 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A4EB0.c b/src/code/audio/code_801A4EB0.c index 62b88449b..bc08e9f77 100644 --- a/src/code/audio/code_801A4EB0.c +++ b/src/code/audio/code_801A4EB0.c @@ -2,7 +2,7 @@ void func_801A5080(u16 arg0); -s32 func_801A5228(u8* arg0); +s32 func_801A5228(OSVoiceDictionary* dict); void func_801A53E8(u16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); s32 func_801A5808(void); OSVoiceData* func_801A5390(void); @@ -10,7 +10,7 @@ s32 func_801A5680(u16 arg0); s32 func_801A54D0(u16 arg0); u8* func_801A54C4(void); -extern u8 D_801D8BE0; +extern OSVoiceDictionary D_801D8BE0; extern OSVoiceHandle D_801FD5B8; extern OSVoiceData* D_801D8E40; extern u8 D_801D8E48; diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index 1d519758d..ff0e2b6da 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -67,45 +67,40 @@ s32 func_801A51F0(s32 errorCode) { } } -s32 func_801A5228(u8* arg0) { +s32 func_801A5228(OSVoiceDictionary* dict) { OSMesgQueue* msgQ; s32 errorCode; - u8 temp_s1; + u8 numWords; u8 i; - u32 indexTemp; - s32 index; D_801FD5A0.unk_04 = 0; - D_801FD5A0.unk_08 = NULL; + D_801FD5A0.data = NULL; D_801FD5A0.unk_0C = 1000; D_801FD5A0.unk_0E = 5; D_801FD5A0.unk_10 = 0; - D_801FD5A0.unk_00 = arg0; + D_801FD5A0.dict = dict; - temp_s1 = arg0[600]; + numWords = dict->numWords; msgQ = PadMgr_LockSerialMesgQueue(); - errorCode = osVoiceClearDictionary(&D_801FD5B8, temp_s1); + errorCode = osVoiceClearDictionary(&D_801FD5B8, numWords); PadMgr_UnlockSerialMesgQueue(msgQ); if (errorCode != 0) { return errorCode; } - for (i = 0; i < (((temp_s1 - 1) / 8) + 1); i++) { + for (i = 0; i < (((numWords - 1) / 8) + 1); i++) { D_801FD608[i] = 0; } - for (i = 0; i < temp_s1; i++) { - + for (i = 0; i < numWords; i++) { msgQ = PadMgr_LockSerialMesgQueue(); - indexTemp = i; - index = indexTemp * 30; - errorCode = osVoiceSetWord(&D_801FD5B8, &arg0[index]); + errorCode = osVoiceSetWord(&D_801FD5B8, &dict->words[i]); PadMgr_UnlockSerialMesgQueue(msgQ); if (func_801A51F0(errorCode) != 0) { - func_801A5A1C(&arg0[index]); + func_801A5A1C(&dict->words[i]); } } @@ -116,8 +111,8 @@ OSVoiceData* func_801A5390(void) { OSVoiceData* temp_t6; OSMesgQueue* msgQ; - temp_t6 = D_801FD5A0.unk_08; - D_801FD5A0.unk_08 = NULL; + temp_t6 = D_801FD5A0.data; + D_801FD5A0.data = NULL; msgQ = PadMgr_LockSerialMesgQueue(); osVoiceStartReadData(&D_801FD5B8); @@ -127,8 +122,8 @@ OSVoiceData* func_801A5390(void) { } // Unused -s32 func_801A53DC(void) { - return D_801FD5A0.unk_00; +OSVoiceDictionary* func_801A53DC(void) { + return D_801FD5A0.dict; } void func_801A53E8(u16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4) { @@ -145,7 +140,7 @@ s32 func_801A541C(s32 analog, s32 digital) { s32 errorCode; OSMesgQueue* msgQ; - if (D_801FD5A0.unk_00 != NULL) { + if (D_801FD5A0.dict != NULL) { msgQ = PadMgr_LockSerialMesgQueue(); errorCode = osVoiceControlGain(&D_801FD5B8, analog, digital); PadMgr_UnlockSerialMesgQueue(msgQ); @@ -175,20 +170,20 @@ u8* func_801A54C4(void) { s32 func_801A54D0(u16 arg0) { s32 errorCode; u8 phi_t0; - u8 sp22; + u8 numWords; u8 i; OSMesgQueue* msgQ; phi_t0 = true; - if (D_801FD5A0.unk_00 != NULL) { - sp22 = D_801FD5A0.unk_00[600]; + if (D_801FD5A0.dict != NULL) { + numWords = D_801FD5A0.dict->numWords; } else { - sp22 = 20; + numWords = 20; phi_t0 = false; } if (arg0 == 0xFFFF) { - for (i = 0; i < sp22; i++) { + for (i = 0; i < numWords; i++) { D_801FD608[i / 8] |= 1 << (i % 8); } } else { @@ -206,7 +201,7 @@ s32 func_801A54D0(u16 arg0) { if ((errorCode == 0) || (D_801FD5A0.unk_04 == 0)) { msgQ = PadMgr_LockSerialMesgQueue(); - errorCode = osVoiceMaskDictionary(&D_801FD5B8, D_801FD608, ((sp22 - 1) / 8) + 1); + errorCode = osVoiceMaskDictionary(&D_801FD5B8, D_801FD608, ((numWords - 1) / 8) + 1); PadMgr_UnlockSerialMesgQueue(msgQ); } @@ -219,20 +214,20 @@ s32 func_801A54D0(u16 arg0) { s32 func_801A5680(u16 arg0) { s32 errorCode; u8 phi_a3; - u8 sp22; + u8 numWords; u8 i; OSMesgQueue* msgQ; phi_a3 = true; - if (D_801FD5A0.unk_00 != NULL) { - sp22 = D_801FD5A0.unk_00[600]; + if (D_801FD5A0.dict != NULL) { + numWords = D_801FD5A0.dict->numWords; } else { - sp22 = 20; + numWords = 20; phi_a3 = false; } if (arg0 == 0xFFFF) { - for (i = 0; i < (((sp22 - 1) / 8) + 1); i++) { + for (i = 0; i < (((numWords - 1) / 8) + 1); i++) { D_801FD608[i] = 0; } } else { @@ -250,7 +245,7 @@ s32 func_801A5680(u16 arg0) { if ((errorCode == 0) || (D_801FD5A0.unk_04 == 0)) { msgQ = PadMgr_LockSerialMesgQueue(); - errorCode = osVoiceMaskDictionary(&D_801FD5B8, D_801FD608, ((sp22 - 1) / 8) + 1); + errorCode = osVoiceMaskDictionary(&D_801FD5B8, D_801FD608, ((numWords - 1) / 8) + 1); PadMgr_UnlockSerialMesgQueue(msgQ); } @@ -303,7 +298,7 @@ s32 func_801A5808(void) { (D_801FD5A0.unk_0C >= D_801FD5C8.distance[0]) && (D_801FD5C8.voice_level >= D_801FD5A0.unk_12) && (D_801FD5C8.voice_sn >= D_801FD5A0.unk_14)) { D_801FD5E8 = D_801FD5C8; - D_801FD5A0.unk_08 = &D_801FD5E8; + D_801FD5A0.data = &D_801FD5E8; } msgQ = PadMgr_LockSerialMesgQueue(); @@ -325,26 +320,26 @@ s32 func_801A5808(void) { // Unused void func_801A5A10(void) { - D_801FD5A0.unk_00 = NULL; + D_801FD5A0.dict = NULL; } -u8* func_801A5A1C(s8* arg0) { +u8* func_801A5A1C(s8* word) { u8 i; u8 j; - u8 len = strlen(arg0); - u8 temp_t8[2]; - - for (j = 0, i = 0; i < len; i += 2) { - temp_t8[0] = arg0[i]; - temp_t8[1] = arg0[i + 1]; - - if (temp_t8[0] == 0x83) { - D_801FD610[j++] = D_801D8F70[temp_t8[1] - 0x40][0]; - D_801FD610[j++] = D_801D8F70[temp_t8[1] - 0x40][1]; - } else if (temp_t8[0] == 0x82) { - D_801FD610[j++] = D_801D8E50[temp_t8[1] - 0x9F][0]; - D_801FD610[j++] = D_801D8E50[temp_t8[1] - 0x9F][1]; - } else if (temp_t8[0] == 0x81 && temp_t8[1] == 0x5B) { + u8 numSyllables = strlen(word); // technically twice the num of syllables + u8 syllable[2]; + + for (j = 0, i = 0; i < numSyllables; i += 2) { + syllable[0] = word[i]; + syllable[1] = word[i + 1]; + + if (syllable[0] == 0x83) { + D_801FD610[j++] = D_801D8F70[syllable[1] - 0x40][0]; + D_801FD610[j++] = D_801D8F70[syllable[1] - 0x40][1]; + } else if (syllable[0] == 0x82) { + D_801FD610[j++] = D_801D8E50[syllable[1] - 0x9F][0]; + D_801FD610[j++] = D_801D8E50[syllable[1] - 0x9F][1]; + } else if (syllable[0] == 0x81 && syllable[1] == 0x5B) { D_801FD610[j++] = '-'; D_801FD610[j++] = '-'; } else { -- cgit v1.2.3 From 418b4718b88d30c94c129243067e366de3dbe8ca Mon Sep 17 00:00:00 2001 From: engineer124 Date: Fri, 12 Nov 2021 13:25:34 +1100 Subject: More voice docs --- src/code/audio/code_801A4EB0.c | 8 +-- src/code/audio/code_801A51F0.c | 108 ++++++++++++++++++++--------------------- 2 files changed, 57 insertions(+), 59 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A4EB0.c b/src/code/audio/code_801A4EB0.c index bc08e9f77..cdc5be6fb 100644 --- a/src/code/audio/code_801A4EB0.c +++ b/src/code/audio/code_801A4EB0.c @@ -3,7 +3,7 @@ void func_801A5080(u16 arg0); s32 func_801A5228(OSVoiceDictionary* dict); -void func_801A53E8(u16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); +void func_801A53E8(u16 distance, u16 answerNum, u16 warning, u16 voiceLevel, u16 voiceRelLevel); s32 func_801A5808(void); OSVoiceData* func_801A5390(void); s32 func_801A5680(u16 arg0); @@ -11,7 +11,7 @@ s32 func_801A54D0(u16 arg0); u8* func_801A54C4(void); extern OSVoiceDictionary D_801D8BE0; -extern OSVoiceHandle D_801FD5B8; +extern OSVoiceHandle sVoiceHandle; extern OSVoiceData* D_801D8E40; extern u8 D_801D8E48; @@ -27,7 +27,7 @@ void func_801A4EB8(void) { if (D_801D8E3C != 0) { msgQ = PadMgr_LockSerialMesgQueue(); - osVoiceStopReadData(&D_801FD5B8); + osVoiceStopReadData(&sVoiceHandle); PadMgr_UnlockSerialMesgQueue(msgQ); } @@ -58,7 +58,7 @@ void func_801A4FD8(void) { func_801A54D0(0xFFFF); if (D_801D8E3C != 0) { msgQ = PadMgr_LockSerialMesgQueue(); - osVoiceStopReadData(&D_801FD5B8); + osVoiceStopReadData(&sVoiceHandle); PadMgr_UnlockSerialMesgQueue(msgQ); errorCode = func_801A5228(&D_801D8BE0); diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index ff0e2b6da..325a28399 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -1,14 +1,14 @@ #include "global.h" // internal voice functions -u8* func_801A5A1C(s8* arg0); +u8* func_801A5A1C(s8* word); // BSS OSVoiceUnk D_801FD5A0; -OSVoiceHandle D_801FD5B8; -OSVoiceData D_801FD5C8; -OSVoiceData D_801FD5E8; -u8 D_801FD608[8]; +OSVoiceHandle sVoiceHandle; +OSVoiceData D_801FD5C8; // Intermediate Voice Data during processsing? +OSVoiceData D_801FD5E8; // Best Match Voice Data? +u8 sVoiceMaskPattern[8]; // Maybe all the same? // u8 D_801FD610[0x11B0]; @@ -73,17 +73,17 @@ s32 func_801A5228(OSVoiceDictionary* dict) { u8 numWords; u8 i; - D_801FD5A0.unk_04 = 0; + D_801FD5A0.mode = 0; D_801FD5A0.data = NULL; - D_801FD5A0.unk_0C = 1000; - D_801FD5A0.unk_0E = 5; - D_801FD5A0.unk_10 = 0; + D_801FD5A0.distance = 1000; + D_801FD5A0.answerNum = 5; + D_801FD5A0.warning = 0; D_801FD5A0.dict = dict; numWords = dict->numWords; msgQ = PadMgr_LockSerialMesgQueue(); - errorCode = osVoiceClearDictionary(&D_801FD5B8, numWords); + errorCode = osVoiceClearDictionary(&sVoiceHandle, numWords); PadMgr_UnlockSerialMesgQueue(msgQ); if (errorCode != 0) { @@ -91,12 +91,12 @@ s32 func_801A5228(OSVoiceDictionary* dict) { } for (i = 0; i < (((numWords - 1) / 8) + 1); i++) { - D_801FD608[i] = 0; + sVoiceMaskPattern[i] = 0; } for (i = 0; i < numWords; i++) { msgQ = PadMgr_LockSerialMesgQueue(); - errorCode = osVoiceSetWord(&D_801FD5B8, &dict->words[i]); + errorCode = osVoiceSetWord(&sVoiceHandle, &dict->words[i]); PadMgr_UnlockSerialMesgQueue(msgQ); if (func_801A51F0(errorCode) != 0) { @@ -108,17 +108,17 @@ s32 func_801A5228(OSVoiceDictionary* dict) { } OSVoiceData* func_801A5390(void) { - OSVoiceData* temp_t6; + OSVoiceData* voiceData; OSMesgQueue* msgQ; - temp_t6 = D_801FD5A0.data; + voiceData = D_801FD5A0.data; D_801FD5A0.data = NULL; msgQ = PadMgr_LockSerialMesgQueue(); - osVoiceStartReadData(&D_801FD5B8); + osVoiceStartReadData(&sVoiceHandle); PadMgr_UnlockSerialMesgQueue(msgQ); - return temp_t6; + return voiceData; } // Unused @@ -126,12 +126,12 @@ OSVoiceDictionary* func_801A53DC(void) { return D_801FD5A0.dict; } -void func_801A53E8(u16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4) { - D_801FD5A0.unk_0C = arg0; - D_801FD5A0.unk_0E = arg1; - D_801FD5A0.unk_10 = arg2; - D_801FD5A0.unk_12 = arg3; - D_801FD5A0.unk_14 = arg4; +void func_801A53E8(u16 distance, u16 answerNum, u16 warning, u16 voiceLevel, u16 voiceRelLevel) { + D_801FD5A0.distance = distance; + D_801FD5A0.answerNum = answerNum; + D_801FD5A0.warning = warning; + D_801FD5A0.voiceLevel = voiceLevel; + D_801FD5A0.voiceRelLevel = voiceRelLevel; } // Unused @@ -142,7 +142,7 @@ s32 func_801A541C(s32 analog, s32 digital) { if (D_801FD5A0.dict != NULL) { msgQ = PadMgr_LockSerialMesgQueue(); - errorCode = osVoiceControlGain(&D_801FD5B8, analog, digital); + errorCode = osVoiceControlGain(&sVoiceHandle, analog, digital); PadMgr_UnlockSerialMesgQueue(msgQ); if (errorCode != 0) { @@ -164,17 +164,16 @@ s32 func_801A5488(u8* word) { } u8* func_801A54C4(void) { - return D_801FD608; + return sVoiceMaskPattern; } s32 func_801A54D0(u16 arg0) { s32 errorCode; - u8 phi_t0; + u8 phi_t0 = true; u8 numWords; u8 i; OSMesgQueue* msgQ; - phi_t0 = true; if (D_801FD5A0.dict != NULL) { numWords = D_801FD5A0.dict->numWords; } else { @@ -184,28 +183,28 @@ s32 func_801A54D0(u16 arg0) { if (arg0 == 0xFFFF) { for (i = 0; i < numWords; i++) { - D_801FD608[i / 8] |= 1 << (i % 8); + sVoiceMaskPattern[i / 8] |= 1 << (i % 8); } } else { - if (D_801FD608[arg0 / 8] & (1 << (arg0 % 8))) { + if (sVoiceMaskPattern[arg0 / 8] & (1 << (arg0 % 8))) { phi_t0 = false; } else { - D_801FD608[arg0 / 8] |= (1 << (arg0 % 8)); + sVoiceMaskPattern[arg0 / 8] |= (1 << (arg0 % 8)); } } if (phi_t0) { msgQ = PadMgr_LockSerialMesgQueue(); - errorCode = osVoiceStopReadData(&D_801FD5B8); + errorCode = osVoiceStopReadData(&sVoiceHandle); PadMgr_UnlockSerialMesgQueue(msgQ); - if ((errorCode == 0) || (D_801FD5A0.unk_04 == 0)) { + if ((errorCode == 0) || (D_801FD5A0.mode == 0)) { msgQ = PadMgr_LockSerialMesgQueue(); - errorCode = osVoiceMaskDictionary(&D_801FD5B8, D_801FD608, ((numWords - 1) / 8) + 1); + errorCode = osVoiceMaskDictionary(&sVoiceHandle, sVoiceMaskPattern, ((numWords - 1) / 8) + 1); PadMgr_UnlockSerialMesgQueue(msgQ); } - D_801FD5A0.unk_04 = 0; + D_801FD5A0.mode = 0; } return errorCode; @@ -213,12 +212,11 @@ s32 func_801A54D0(u16 arg0) { s32 func_801A5680(u16 arg0) { s32 errorCode; - u8 phi_a3; + u8 phi_a3 = true; u8 numWords; u8 i; OSMesgQueue* msgQ; - phi_a3 = true; if (D_801FD5A0.dict != NULL) { numWords = D_801FD5A0.dict->numWords; } else { @@ -228,28 +226,28 @@ s32 func_801A5680(u16 arg0) { if (arg0 == 0xFFFF) { for (i = 0; i < (((numWords - 1) / 8) + 1); i++) { - D_801FD608[i] = 0; + sVoiceMaskPattern[i] = 0; } } else { - if (!(D_801FD608[arg0 / 8] & (1 << (arg0 % 8)))) { + if (!(sVoiceMaskPattern[arg0 / 8] & (1 << (arg0 % 8)))) { phi_a3 = false; } else { - D_801FD608[arg0 / 8] &= (1 << (arg0 % 8)) ^ 0xFF; + sVoiceMaskPattern[arg0 / 8] &= (1 << (arg0 % 8)) ^ 0xFF; } } if (phi_a3) { msgQ = PadMgr_LockSerialMesgQueue(); - errorCode = osVoiceStopReadData(&D_801FD5B8); + errorCode = osVoiceStopReadData(&sVoiceHandle); PadMgr_UnlockSerialMesgQueue(msgQ); - if ((errorCode == 0) || (D_801FD5A0.unk_04 == 0)) { + if ((errorCode == 0) || (D_801FD5A0.mode == 0)) { msgQ = PadMgr_LockSerialMesgQueue(); - errorCode = osVoiceMaskDictionary(&D_801FD5B8, D_801FD608, ((numWords - 1) / 8) + 1); + errorCode = osVoiceMaskDictionary(&sVoiceHandle, sVoiceMaskPattern, ((numWords - 1) / 8) + 1); PadMgr_UnlockSerialMesgQueue(msgQ); } - D_801FD5A0.unk_04 = 0; + D_801FD5A0.mode = 0; } return errorCode; @@ -262,23 +260,23 @@ s32 func_801A5808(void) { if (1) {} - switch (D_801FD5A0.unk_04) { + switch (D_801FD5A0.mode) { case 0: msgQ = PadMgr_LockSerialMesgQueue(); - errorCode = osVoiceStartReadData(&D_801FD5B8); + errorCode = osVoiceStartReadData(&sVoiceHandle); PadMgr_UnlockSerialMesgQueue(msgQ); - D_801FD5A0.unk_04 = 1; + D_801FD5A0.mode = 1; break; case 1: msgQ = PadMgr_LockSerialMesgQueue(); - errorCode = osVoiceGetReadData(&D_801FD5B8, &D_801FD5C8); + errorCode = osVoiceGetReadData(&sVoiceHandle, &D_801FD5C8); PadMgr_UnlockSerialMesgQueue(msgQ); if (func_801A51F0(errorCode) == 0) { - switch (D_801FD5B8.status) { + switch (sVoiceHandle.status) { case VOICE_STATUS_READY: - D_801FD5A0.unk_04 = 2; + D_801FD5A0.mode = 2; break; case VOICE_STATUS_START: case 2: @@ -288,28 +286,28 @@ s32 func_801A5808(void) { case 6: break; case VOICE_STATUS_END: - D_801FD5A0.unk_04 = 2; + D_801FD5A0.mode = 2; break; } } break; case 2: - if (((D_801FD5C8.warning & D_801FD5A0.unk_10) == 0) && (D_801FD5A0.unk_0E >= D_801FD5C8.answer_num) && - (D_801FD5A0.unk_0C >= D_801FD5C8.distance[0]) && (D_801FD5C8.voice_level >= D_801FD5A0.unk_12) && - (D_801FD5C8.voice_sn >= D_801FD5A0.unk_14)) { + if (((D_801FD5C8.warning & D_801FD5A0.warning) == 0) && (D_801FD5A0.answerNum >= D_801FD5C8.answerNum) && + (D_801FD5A0.distance >= D_801FD5C8.distance[0]) && (D_801FD5C8.voiceLevel >= D_801FD5A0.voiceLevel) && + (D_801FD5C8.voiceRelLevel >= D_801FD5A0.voiceRelLevel)) { D_801FD5E8 = D_801FD5C8; D_801FD5A0.data = &D_801FD5E8; } msgQ = PadMgr_LockSerialMesgQueue(); - osVoiceStopReadData(&D_801FD5B8); + osVoiceStopReadData(&sVoiceHandle); PadMgr_UnlockSerialMesgQueue(msgQ); msgQ = PadMgr_LockSerialMesgQueue(); - errorCode = osVoiceStartReadData(&D_801FD5B8); + errorCode = osVoiceStartReadData(&sVoiceHandle); PadMgr_UnlockSerialMesgQueue(msgQ); - D_801FD5A0.unk_04 = 1; + D_801FD5A0.mode = 1; break; } -- cgit v1.2.3 From 3ab4bf67bd0becf1466b2cc2a63afbd19babeed1 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Fri, 12 Nov 2021 17:02:01 +1100 Subject: Fix bss --- src/code/audio/code_801A51F0.c | 12 +----------- src/code/code_801A5BD0.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 11 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index 325a28399..41ef0f98e 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -9,17 +9,7 @@ OSVoiceHandle sVoiceHandle; OSVoiceData D_801FD5C8; // Intermediate Voice Data during processsing? OSVoiceData D_801FD5E8; // Best Match Voice Data? u8 sVoiceMaskPattern[8]; - -// Maybe all the same? -// u8 D_801FD610[0x11B0]; -char 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]; +char D_801FD610[256]; // Data s8 D_801D8E50[96][3] = { diff --git a/src/code/code_801A5BD0.c b/src/code/code_801A5BD0.c index 32889dcb8..8e9eafe64 100644 --- a/src/code/code_801A5BD0.c +++ b/src/code/code_801A5BD0.c @@ -1,5 +1,36 @@ #include "global.h" +typedef struct { + /* 0x00 */ f32* posX; + /* 0x04 */ f32* posY; + /* 0x08 */ f32* posZ; + /* 0x0C */ f32* freqScale; + /* 0x10 */ f32* vol; + /* 0x14 */ s8* reverbAdd; + /* 0x18 */ f32 dist; + /* 0x1C */ u32 priority; // lower is more prioritized + /* 0x20 */ u16 sfxParams; + /* 0x22 */ u16 sfxId; + /* 0x25 */ u8 sfxUnk01; + /* 0x24 */ u8 sfxImportance; + /* 0x26 */ u8 state; // uses SfxState enum + /* 0x27 */ u8 freshness; + /* 0x28 */ u8 prev; + /* 0x29 */ u8 next; + /* 0x2A */ u8 channelIdx; + /* 0x2B */ u8 unk_2F; + /* 0x2C */ u8 token; +} SoundBankEntry; // size = 0x30 + +// gSoundBank +SoundBankEntry D_801FD710[9]; +SoundBankEntry D_801FD8C0[12]; +SoundBankEntry D_801FDB00[32]; +SoundBankEntry D_801FE100[20]; +SoundBankEntry D_801FE4C0[8]; +SoundBankEntry D_801FE640[3]; +SoundBankEntry D_801FE6D0[5]; + #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A5BD0.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A5C28.s") -- cgit v1.2.3 From c527da691689f1f7b0b900cdcef3333e03b84ee0 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Fri, 12 Nov 2021 22:10:26 +1100 Subject: Import code_801A4EB0 data --- src/code/audio/code_801A4EB0.c | 33 +++++++++++++++++++++++++++++---- src/code/code_801A5BD0.c | 38 +++++++++++++++++++------------------- 2 files changed, 48 insertions(+), 23 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A4EB0.c b/src/code/audio/code_801A4EB0.c index cdc5be6fb..9136477c1 100644 --- a/src/code/audio/code_801A4EB0.c +++ b/src/code/audio/code_801A4EB0.c @@ -1,7 +1,6 @@ #include "global.h" void func_801A5080(u16 arg0); - s32 func_801A5228(OSVoiceDictionary* dict); void func_801A53E8(u16 distance, u16 answerNum, u16 warning, u16 voiceLevel, u16 voiceRelLevel); s32 func_801A5808(void); @@ -10,10 +9,36 @@ s32 func_801A5680(u16 arg0); s32 func_801A54D0(u16 arg0); u8* func_801A54C4(void); -extern OSVoiceDictionary D_801D8BE0; extern OSVoiceHandle sVoiceHandle; -extern OSVoiceData* D_801D8E40; -extern u8 D_801D8E48; + +OSVoiceDictionary D_801D8BE0 = { + { + // "アトナンジカン" - "atonanjikan" - "How many hours" + { 0x83, 0x41, 0x83, 0x67, 0x83, 0x69, 0x83, 0x93, 0x83, 0x57, 0x83, 0x4A, 0x83, 0x93 }, + + // "ハイチーズ" - "haichīzu" - "say cheese" + { 0x83, 0x6E, 0x83, 0x43, 0x83, 0x60, 0x81, 0x5B, 0x83, 0x59 }, + + // "オキロー" - "okirō" - "wake up" + { 0x83, 0x49, 0x83, 0x4C, 0x83, 0x8D, 0x81, 0x5B }, + + // "オスワリ" - "osuwari" - "sit" + { 0x83, 0x49, 0x83, 0x58, 0x83, 0x8F, 0x83, 0x8A }, + + // "ミルク" - "miruku" - "milk" + { 0x83, 0x7E, 0x83, 0x8B, 0x83, 0x4E }, + + // "ハイヤー" - "haiyā" - "hiya!" + { 0x83, 0x6E, 0x83, 0x43, 0x83, 0x84, 0x81, 0x5B }, + }, + + 6, // number of words +}; + +u8 D_801D8E3C = 0; +OSVoiceData* D_801D8E40 = NULL; +u16 D_801D8E44 = 0xFFFF; +u8 D_801D8E48 = 0; void func_801A4EB0(void) { } diff --git a/src/code/code_801A5BD0.c b/src/code/code_801A5BD0.c index 8e9eafe64..0cafa50b1 100644 --- a/src/code/code_801A5BD0.c +++ b/src/code/code_801A5BD0.c @@ -1,25 +1,25 @@ #include "global.h" typedef struct { - /* 0x00 */ f32* posX; - /* 0x04 */ f32* posY; - /* 0x08 */ f32* posZ; - /* 0x0C */ f32* freqScale; - /* 0x10 */ f32* vol; - /* 0x14 */ s8* reverbAdd; - /* 0x18 */ f32 dist; - /* 0x1C */ u32 priority; // lower is more prioritized - /* 0x20 */ u16 sfxParams; - /* 0x22 */ u16 sfxId; - /* 0x25 */ u8 sfxUnk01; - /* 0x24 */ u8 sfxImportance; - /* 0x26 */ u8 state; // uses SfxState enum - /* 0x27 */ u8 freshness; - /* 0x28 */ u8 prev; - /* 0x29 */ u8 next; - /* 0x2A */ u8 channelIdx; - /* 0x2B */ u8 unk_2F; - /* 0x2C */ u8 token; + /* 0x00 */ f32* posX; + /* 0x04 */ f32* posY; + /* 0x08 */ f32* posZ; + /* 0x0C */ f32* freqScale; + /* 0x10 */ f32* vol; + /* 0x14 */ s8* reverbAdd; + /* 0x18 */ f32 dist; + /* 0x1C */ u32 priority; // lower is more prioritized + /* 0x20 */ u16 sfxParams; + /* 0x22 */ u16 sfxId; + /* 0x25 */ u8 sfxUnk01; + /* 0x24 */ u8 sfxImportance; + /* 0x26 */ u8 state; // uses SfxState enum + /* 0x27 */ u8 freshness; + /* 0x28 */ u8 prev; + /* 0x29 */ u8 next; + /* 0x2A */ u8 channelIdx; + /* 0x2B */ u8 unk_2F; + /* 0x2C */ u8 token; } SoundBankEntry; // size = 0x30 // gSoundBank -- cgit v1.2.3 From e84fd1d1393ef755e4b3bfb8377021b2d5eae117 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Fri, 12 Nov 2021 22:39:59 +1100 Subject: Introduce Word Id enum --- src/code/audio/code_801A4EB0.c | 34 +++++++++++++++++----------------- src/code/audio/code_801A51F0.c | 16 ++++++++-------- 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A4EB0.c b/src/code/audio/code_801A4EB0.c index 9136477c1..32b1dbc6c 100644 --- a/src/code/audio/code_801A4EB0.c +++ b/src/code/audio/code_801A4EB0.c @@ -5,8 +5,8 @@ s32 func_801A5228(OSVoiceDictionary* dict); void func_801A53E8(u16 distance, u16 answerNum, u16 warning, u16 voiceLevel, u16 voiceRelLevel); s32 func_801A5808(void); OSVoiceData* func_801A5390(void); -s32 func_801A5680(u16 arg0); -s32 func_801A54D0(u16 arg0); +s32 func_801A5680(u16 wordId); +s32 func_801A54D0(u16 wordId); u8* func_801A54C4(void); extern OSVoiceHandle sVoiceHandle; @@ -32,12 +32,12 @@ OSVoiceDictionary D_801D8BE0 = { { 0x83, 0x6E, 0x83, 0x43, 0x83, 0x84, 0x81, 0x5B }, }, - 6, // number of words + VOICE_WORD_ID_MAX, // number of words }; u8 D_801D8E3C = 0; OSVoiceData* D_801D8E40 = NULL; -u16 D_801D8E44 = 0xFFFF; +u16 sTopScoreWordId = VOICE_WORD_ID_NONE; u8 D_801D8E48 = 0; void func_801A4EB0(void) { @@ -63,7 +63,7 @@ void func_801A4EB8(void) { } if (func_801A5228(&D_801D8BE0) == 0) { - for (i = 0; i < 6; i++) { + for (i = 0; i < VOICE_WORD_ID_MAX; i++) { index = i / 8; if (((sp38[index] >> (i % 8)) & 1) == 1) { func_801A54D0(i); @@ -80,14 +80,14 @@ void func_801A4FD8(void) { s32 errorCode; OSMesgQueue* msgQ; - func_801A54D0(0xFFFF); + func_801A54D0(VOICE_WORD_ID_NONE); if (D_801D8E3C != 0) { msgQ = PadMgr_LockSerialMesgQueue(); osVoiceStopReadData(&sVoiceHandle); PadMgr_UnlockSerialMesgQueue(msgQ); errorCode = func_801A5228(&D_801D8BE0); - func_801A54D0(0xFFFF); + func_801A54D0(VOICE_WORD_ID_NONE); if (errorCode == 0) { func_801A53E8(800, 2, VOICE_WARN_TOO_SMALL, 500, 2000); D_801D8E3C = 1; @@ -98,22 +98,22 @@ void func_801A4FD8(void) { } } -void func_801A5080(u16 arg0) { - if ((D_801D8E3C != 0) && (arg0 < 6)) { - func_801A5680(arg0); +void func_801A5080(u16 wordId) { + if ((D_801D8E3C != 0) && (wordId < VOICE_WORD_ID_MAX)) { + func_801A5680(wordId); } } // Unused -void func_801A50C0(u16 arg0) { - if ((D_801D8E3C != 0) && (arg0 < 6)) { - func_801A54D0(arg0); +void func_801A50C0(u16 wordId) { + if ((D_801D8E3C != 0) && (wordId < VOICE_WORD_ID_MAX)) { + func_801A54D0(wordId); } } // Used externally in many files u16 func_801A5100(void) { - return D_801D8E44; + return sTopScoreWordId; } // Unused @@ -133,7 +133,7 @@ void func_801A5118(void) { D_801D8E48++; if (D_801D8E48 == 10) { D_801D8E3C = 0; - D_801D8E44 = 0xFFFF; + sTopScoreWordId = VOICE_WORD_ID_NONE; return; } } else { @@ -142,9 +142,9 @@ void func_801A5118(void) { D_801D8E40 = func_801A5390(); if (D_801D8E40 != 0) { - D_801D8E44 = D_801D8E40->answer[0]; + sTopScoreWordId = D_801D8E40->answer[0]; } else { - D_801D8E44 = 0xFFFF; + sTopScoreWordId = VOICE_WORD_ID_NONE; } } } diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index 41ef0f98e..c5d7bafb4 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -157,7 +157,7 @@ u8* func_801A54C4(void) { return sVoiceMaskPattern; } -s32 func_801A54D0(u16 arg0) { +s32 func_801A54D0(u16 wordId) { s32 errorCode; u8 phi_t0 = true; u8 numWords; @@ -171,15 +171,15 @@ s32 func_801A54D0(u16 arg0) { phi_t0 = false; } - if (arg0 == 0xFFFF) { + if (wordId == VOICE_WORD_ID_NONE) { for (i = 0; i < numWords; i++) { sVoiceMaskPattern[i / 8] |= 1 << (i % 8); } } else { - if (sVoiceMaskPattern[arg0 / 8] & (1 << (arg0 % 8))) { + if (sVoiceMaskPattern[wordId / 8] & (1 << (wordId % 8))) { phi_t0 = false; } else { - sVoiceMaskPattern[arg0 / 8] |= (1 << (arg0 % 8)); + sVoiceMaskPattern[wordId / 8] |= (1 << (wordId % 8)); } } @@ -200,7 +200,7 @@ s32 func_801A54D0(u16 arg0) { return errorCode; } -s32 func_801A5680(u16 arg0) { +s32 func_801A5680(u16 wordId) { s32 errorCode; u8 phi_a3 = true; u8 numWords; @@ -214,15 +214,15 @@ s32 func_801A5680(u16 arg0) { phi_a3 = false; } - if (arg0 == 0xFFFF) { + if (wordId == VOICE_WORD_ID_NONE) { for (i = 0; i < (((numWords - 1) / 8) + 1); i++) { sVoiceMaskPattern[i] = 0; } } else { - if (!(sVoiceMaskPattern[arg0 / 8] & (1 << (arg0 % 8)))) { + if (!(sVoiceMaskPattern[wordId / 8] & (1 << (wordId % 8)))) { phi_a3 = false; } else { - sVoiceMaskPattern[arg0 / 8] &= (1 << (arg0 % 8)) ^ 0xFF; + sVoiceMaskPattern[wordId / 8] &= (1 << (wordId % 8)) ^ 0xFF; } } -- cgit v1.2.3 From 0ca2818b8f5a17bc12b7376ae283f2736874cc80 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Fri, 12 Nov 2021 23:45:01 +1100 Subject: Dictionary: u8 -> u16 --- src/code/audio/code_801A4EB0.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A4EB0.c b/src/code/audio/code_801A4EB0.c index 32b1dbc6c..0712d4761 100644 --- a/src/code/audio/code_801A4EB0.c +++ b/src/code/audio/code_801A4EB0.c @@ -14,22 +14,22 @@ extern OSVoiceHandle sVoiceHandle; OSVoiceDictionary D_801D8BE0 = { { // "アトナンジカン" - "atonanjikan" - "How many hours" - { 0x83, 0x41, 0x83, 0x67, 0x83, 0x69, 0x83, 0x93, 0x83, 0x57, 0x83, 0x4A, 0x83, 0x93 }, + { 0x8341, 0x8367, 0x8369, 0x8393, 0x8357, 0x834A, 0x8393 }, // "ハイチーズ" - "haichīzu" - "say cheese" - { 0x83, 0x6E, 0x83, 0x43, 0x83, 0x60, 0x81, 0x5B, 0x83, 0x59 }, + { 0x836E, 0x8343, 0x8360, 0x815B, 0x8359 }, // "オキロー" - "okirō" - "wake up" - { 0x83, 0x49, 0x83, 0x4C, 0x83, 0x8D, 0x81, 0x5B }, + { 0x8349, 0x834C, 0x838D, 0x815B }, // "オスワリ" - "osuwari" - "sit" - { 0x83, 0x49, 0x83, 0x58, 0x83, 0x8F, 0x83, 0x8A }, + { 0x8349, 0x8358, 0x838F, 0x838A }, // "ミルク" - "miruku" - "milk" - { 0x83, 0x7E, 0x83, 0x8B, 0x83, 0x4E }, + { 0x837E, 0x838B, 0x834E }, // "ハイヤー" - "haiyā" - "hiya!" - { 0x83, 0x6E, 0x83, 0x43, 0x83, 0x84, 0x81, 0x5B }, + { 0x836E, 0x8343, 0x8384, 0x815B }, }, VOICE_WORD_ID_MAX, // number of words -- cgit v1.2.3 From 85b280f68aacfcd8d5ec3f269eaf4fc0c2131c08 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Sat, 13 Nov 2021 15:03:26 +1100 Subject: Fill in bgm enums --- src/code/code_8019AF00.c | 2 +- src/code/z_game_over.c | 2 +- src/code/z_scene.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/code') diff --git a/src/code/code_8019AF00.c b/src/code/code_8019AF00.c index 8f0d129ad..32934a82c 100644 --- a/src/code/code_8019AF00.c +++ b/src/code/code_8019AF00.c @@ -296,7 +296,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2D54.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2DE0.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_IsSequencePlaying.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2E54.s") diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index c510c1974..edbf79ed7 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -66,7 +66,7 @@ void GameOver_Update(GlobalContext* globalCtx) { gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND; break; case GAMEOVER_DEATH_FADE_OUT: - if (func_801A8A50(1) != 32) { + if (func_801A8A50(1) != NA_BGM_GAME_OVER) { func_80169F78(globalCtx); if (gSaveContext.respawnFlag != -7) { gSaveContext.respawnFlag = -6; diff --git a/src/code/z_scene.c b/src/code/z_scene.c index dd158ac07..406685f85 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -449,7 +449,7 @@ void Scene_HeaderCmdSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->soundCtx.seqIndex = cmd->soundSettings.musicSeq; globalCtx->soundCtx.nightSeqIndex = cmd->soundSettings.nighttimeSFX; - if (gSaveContext.seqIndex == 0xFF || func_801A8A50(0) == 0x57) { + if (gSaveContext.seqIndex == 0xFF || func_801A8A50(0) == NA_BGM_FINAL_HOURS) { audio_setBGM(cmd->soundSettings.bgmId); } } -- cgit v1.2.3 From b7160a2efc3c08cccffb7e99c2e9b1f5c6410e03 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Mon, 15 Nov 2021 16:25:05 +1100 Subject: import rodata --- src/code/audio/code_801A51F0.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/code') diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c index c5d7bafb4..d5afc3858 100644 --- a/src/code/audio/code_801A51F0.c +++ b/src/code/audio/code_801A51F0.c @@ -30,17 +30,14 @@ s8 D_801D8F70[96][3] = { "WI", "WE", "WO", "NN", "VU", "ka", "ke", "", "", "", "", "", "", "", "", "", }; -/* -char D_801E0EC0[] = "Error %d\n" -char D_801E0ECC[] = "NAI_VRS:osVoiceClearDictionary %d\n" -char D_801E0EF0[] = "NAI_VRS:dict error! (%d-%d %s)\n" -char D_801E0F10[] = "NAI_VRS:Ina_SetVruGain Error!\n" -char D_801E0F30[] = "NAI_VRS:mask on %d\n" -char D_801E0F48[] = "NAI_VRS:mask off %d\n" -char D_801E0F60[] = "NAI_VRS:answer No.:%d Dist:%d Warn:%04X Level:%5d SN:%5d (Num:%d)\n" -char D_801E0FA4[] = "NAI_VRS:error !! (ANS_MAX:%d DIST:%d WARNING:%04X LEVEL:%5d SN:%5d)\n" -*/ -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/D_801E0EC0.s") +const char D_801E0EC0[] = "Error %d\n"; +const char D_801E0ECC[] = "NAI_VRS:osVoiceClearDictionary %d\n"; +const char D_801E0EF0[] = "NAI_VRS:dict error! (%d-%d %s)\n"; +const char D_801E0F10[] = "NAI_VRS:Ina_SetVruGain Error!\n"; +const char D_801E0F30[] = "NAI_VRS:mask on %d\n"; +const char D_801E0F48[] = "NAI_VRS:mask off %d\n"; +const char D_801E0F60[] = "NAI_VRS:answer No.:%d Dist:%d Warn:%04X Level:%5d SN:%5d (Num:%d)\n"; +const char D_801E0FA4[] = "NAI_VRS:error !! (ANS_MAX:%d DIST:%d WARNING:%04X LEVEL:%5d SN:%5d)\n"; s32 func_801A51F0(s32 errorCode) { switch (errorCode) { -- cgit v1.2.3 From 597907c50a26fde27e5d1fdd08898312a1e0082f Mon Sep 17 00:00:00 2001 From: engineer124 Date: Wed, 17 Nov 2021 16:25:34 +1100 Subject: Fix bss reordering --- src/code/sched.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/code') diff --git a/src/code/sched.c b/src/code/sched.c index 927a48f66..5f9cdf236 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #define RSP_DONE_MSG 667 -- cgit v1.2.3 From 4e0ce6c70a07a7cca0c41367f02de6ed2bf3f186 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Wed, 17 Nov 2021 16:28:15 +1100 Subject: Fix bss file split --- src/code/code_801A5BD0.c | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'src/code') diff --git a/src/code/code_801A5BD0.c b/src/code/code_801A5BD0.c index 0cafa50b1..32889dcb8 100644 --- a/src/code/code_801A5BD0.c +++ b/src/code/code_801A5BD0.c @@ -1,36 +1,5 @@ #include "global.h" -typedef struct { - /* 0x00 */ f32* posX; - /* 0x04 */ f32* posY; - /* 0x08 */ f32* posZ; - /* 0x0C */ f32* freqScale; - /* 0x10 */ f32* vol; - /* 0x14 */ s8* reverbAdd; - /* 0x18 */ f32 dist; - /* 0x1C */ u32 priority; // lower is more prioritized - /* 0x20 */ u16 sfxParams; - /* 0x22 */ u16 sfxId; - /* 0x25 */ u8 sfxUnk01; - /* 0x24 */ u8 sfxImportance; - /* 0x26 */ u8 state; // uses SfxState enum - /* 0x27 */ u8 freshness; - /* 0x28 */ u8 prev; - /* 0x29 */ u8 next; - /* 0x2A */ u8 channelIdx; - /* 0x2B */ u8 unk_2F; - /* 0x2C */ u8 token; -} SoundBankEntry; // size = 0x30 - -// gSoundBank -SoundBankEntry D_801FD710[9]; -SoundBankEntry D_801FD8C0[12]; -SoundBankEntry D_801FDB00[32]; -SoundBankEntry D_801FE100[20]; -SoundBankEntry D_801FE4C0[8]; -SoundBankEntry D_801FE640[3]; -SoundBankEntry D_801FE6D0[5]; - #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A5BD0.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A5C28.s") -- cgit v1.2.3 From a0882f3fd3c05dcc920629007ad63ffc391798b6 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Fri, 19 Nov 2021 22:36:18 +1100 Subject: Another bgm function found! --- src/code/z_common_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/code') diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index 88fa3e103..89a161b45 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -7,7 +7,7 @@ void SaveContext_Init(void) { gSaveContext.playerForm = 0; gSaveContext.seqIndex = 0xFF; gSaveContext.nightSeqIndex = 0xFF; - gSaveContext.unk_3F46 = 0; + gSaveContext.unk_3F46 = NA_BGM_GENERAL_SFX; gSaveContext.nextCutsceneIndex = 0xFFEF; gSaveContext.cutsceneTrigger = 0; gSaveContext.unk_3F4D = 0; -- cgit v1.2.3 From 5cc0ff2d6413e56b3f4825c903c2b5a1a7b4e937 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Fri, 19 Nov 2021 22:45:36 +1100 Subject: Add bgm's to `gSaveContext.seqIndex` --- src/code/z_common_data.c | 2 +- src/code/z_game_over.c | 2 +- src/code/z_scene.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/code') diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index 89a161b45..26fd324a7 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -5,7 +5,7 @@ SaveContext gSaveContext; void SaveContext_Init(void) { bzero(&gSaveContext, sizeof(gSaveContext)); gSaveContext.playerForm = 0; - gSaveContext.seqIndex = 0xFF; + gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; gSaveContext.nightSeqIndex = 0xFF; gSaveContext.unk_3F46 = NA_BGM_GENERAL_SFX; gSaveContext.nextCutsceneIndex = 0xFFEF; diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index edbf79ed7..979b28cba 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -45,7 +45,7 @@ void GameOver_Update(GlobalContext* globalCtx) { gSaveContext.unk_3DC0 = 2000; gSaveContext.naviTimer = 0; - gSaveContext.seqIndex = 0xFF; + gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; gSaveContext.nightSeqIndex = 0xFF; gSaveContext.eventInf[0] = 0; gSaveContext.eventInf[1] = 0; diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 406685f85..293a9762d 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -449,7 +449,7 @@ void Scene_HeaderCmdSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->soundCtx.seqIndex = cmd->soundSettings.musicSeq; globalCtx->soundCtx.nightSeqIndex = cmd->soundSettings.nighttimeSFX; - if (gSaveContext.seqIndex == 0xFF || func_801A8A50(0) == NA_BGM_FINAL_HOURS) { + if (gSaveContext.seqIndex == (u8)NA_BGM_DISABLED || func_801A8A50(0) == NA_BGM_FINAL_HOURS) { audio_setBGM(cmd->soundSettings.bgmId); } } -- cgit v1.2.3 From 5194d2be8bf1c2c97446f67710f0ea2a992871e6 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Tue, 13 Jun 2023 11:32:00 +1000 Subject: cleanup --- src/code/padmgr.c | 1 + src/code/z_parameter.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/code') diff --git a/src/code/padmgr.c b/src/code/padmgr.c index a04a14f57..f8e164c39 100644 --- a/src/code/padmgr.c +++ b/src/code/padmgr.c @@ -31,6 +31,7 @@ * done while waiting for this operation to complete. */ #include "global.h" +#include "z64voice.h" #include "io/controller.h" #include "ultra64/motor.h" diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index e63c9d8e5..d3718d55d 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1,6 +1,7 @@ #include "global.h" #include "z64snap.h" #include "z64view.h" +#include "z64voice.h" #include "interface/parameter_static/parameter_static.h" #include "interface/do_action_static/do_action_static.h" #include "misc/story_static/story_static.h" @@ -2166,7 +2167,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { if (gSaveContext.save.cutsceneIndex < 0xFFF0) { gSaveContext.hudVisibilityForceButtonAlphasByStatus = false; if ((player->stateFlags1 & PLAYER_STATE1_800000) || CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01) || - (!(CHECK_EVENTINF(EVENTINF_41)) && (play->unk_1887C >= 2))) { + (!CHECK_EVENTINF(EVENTINF_41) && (play->unk_1887C >= 2))) { // Riding Epona OR Honey & Darling minigame OR Horseback balloon minigame OR related to swamp boat // (non-minigame?) if ((player->stateFlags1 & PLAYER_STATE1_800000) && (player->currentMask == PLAYER_MASK_BLAST) && @@ -2239,8 +2240,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && (Cutscene_GetSceneLayer(play) != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); - } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && - (CHECK_EVENTINF(EVENTINF_35))) { + } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && CHECK_EVENTINF(EVENTINF_35)) { Interface_SetHudVisibility(HUD_VISIBILITY_B_MINIMAP); } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_82_08) && (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE)) { @@ -2328,9 +2328,10 @@ void Interface_UpdateButtonsPart1(PlayState* play) { interfaceCtx->unk_222 = interfaceCtx->unk_224 = 0; restoreHudVisibility = true; sPictoState = PICTO_BOX_STATE_OFF; - } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || (func_801A5100() == 1)) { - if (!(CHECK_EVENTINF(EVENTINF_41)) || - ((CHECK_EVENTINF(EVENTINF_41)) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE))) { + } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || + (AudioVoice_GetWord() == VOICE_WORD_ID_CHEESE)) { + if (!CHECK_EVENTINF(EVENTINF_41) || + (CHECK_EVENTINF(EVENTINF_41) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE))) { play_sound(NA_SE_SY_CAMERA_SHUTTER); SREG(89) = 1; play->haltAllActors = true; @@ -4078,7 +4079,7 @@ void Interface_DrawBButtonIcons(PlayState* play) { (play->sceneId != SCENE_BOWLING) && ((gSaveContext.minigameStatus != MINIGAME_STATUS_ACTIVE) || (gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 0))) && - ((gSaveContext.minigameStatus != MINIGAME_STATUS_ACTIVE) || !(CHECK_EVENTINF(EVENTINF_35))) && + ((gSaveContext.minigameStatus != MINIGAME_STATUS_ACTIVE) || !CHECK_EVENTINF(EVENTINF_35)) && (!CHECK_WEEKEVENTREG(WEEKEVENTREG_31_80) || (play->unk_1887C != 100))) { Interface_DrawAmmoCount(play, EQUIP_SLOT_B, interfaceCtx->bAlpha); } -- cgit v1.2.3