diff --git a/include/os.h b/include/os.h index 379f18746..c3d76dd3b 100644 --- a/include/os.h +++ b/include/os.h @@ -141,6 +141,17 @@ typedef struct { /* 0xC */ u32* text_end; } OSProf; // size = 0x10 +typedef enum { + /* 0 */ VOICE_WORD_ID_HOURS, + /* 1 */ VOICE_WORD_ID_CHEESE, + /* 2 */ VOICE_WORD_ID_WAKE_UP, + /* 3 */ VOICE_WORD_ID_SIT, + /* 4 */ VOICE_WORD_ID_MILK, + /* 5 */ VOICE_WORD_ID_HIYA, + /* 6 */ VOICE_WORD_ID_MAX, + /* -1 */ VOICE_WORD_ID_NONE = 0xFFFF +} OSVoiceWordId; + #define VOICE_STATUS_READY 0 /* stop/end */ #define VOICE_STATUS_START 1 /* Voice Undetected (no voice input) */ #define VOICE_STATUS_CANCEL 3 /* Cancel (cancel extraneous noise) */ diff --git a/include/variables.h b/include/variables.h index 06546f440..45e31a527 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1823,7 +1823,7 @@ extern UNK_PTR D_801D8B24; // extern UNK_TYPE1 D_801D8BE0; // extern u8 D_801D8E3C; // extern UNK_TYPE4 D_801D8E40; -// extern u16 D_801D8E44; +// extern u16 sTopScoreWordId; // extern UNK_TYPE1 D_801D8E48; // extern UNK_TYPE1 D_801D8E50; // extern UNK_TYPE1 D_801D8F70; 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; } } diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 1779d6a3a..98ae20bd9 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -2438,7 +2438,7 @@ 0x801D8BE0:("D_801D8BE0","UNK_TYPE1","",0x1), 0x801D8E3C:("D_801D8E3C","UNK_TYPE1","",0x1), 0x801D8E40:("D_801D8E40","UNK_TYPE4","",0x4), - 0x801D8E44:("D_801D8E44","UNK_TYPE2","",0x2), + 0x801D8E44:("sTopScoreWordId","UNK_TYPE2","",0x2), 0x801D8E48:("D_801D8E48","UNK_TYPE1","",0x1), 0x801D8E50:("D_801D8E50","UNK_TYPE1","",0x1), 0x801D8F70:("D_801D8F70","UNK_TYPE1","",0x1),