diff options
| author | engineer124 <engineer124engineer124@gmail.com> | 2021-11-07 23:04:02 +1100 |
|---|---|---|
| committer | engineer124 <engineer124engineer124@gmail.com> | 2021-11-07 23:04:02 +1100 |
| commit | 11a86e2246aa4ca9161f0bc5fad5beffb341d187 (patch) | |
| tree | c6cbaea7201c0d2a06b76e7c0da4a1ed8a9229a0 /src | |
| parent | 3c76274078fb3226d8b2327f080eeceebf08f403 (diff) | |
WIP on osVoiceGetReadData
Diffstat (limited to 'src')
| -rw-r--r-- | src/libultra/voice/voicegetreaddata.c | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/src/libultra/voice/voicegetreaddata.c b/src/libultra/voice/voicegetreaddata.c index c0987c151..0bba3bac0 100644 --- a/src/libultra/voice/voicegetreaddata.c +++ b/src/libultra/voice/voicegetreaddata.c @@ -1,4 +1,121 @@ #include "global.h" // Gets voice recognition result from the Voice Recognition System +#ifdef NON_EQUIVALENT +s32 osVoiceGetReadData(OSVoiceHandle* hd, OSVoiceData* result) { + s32 errorCode; + u8 new_var; + u8 temp_t9; + u8 sp38[40]; + s32 i; + + switch (hd->mode) { + case 1: + errorCode = __osVoiceGetStatus(hd->mq, hd->port, &sp38[39]); + if (errorCode != 0) { + return errorCode; + } + + if (sp38[39] & 1) { + return 0xC; + } + + errorCode = __osVoiceContRead2(hd->mq, hd->port, 0, sp38); + if (errorCode != 0) { + return errorCode; + } + + temp_t9 = sp38[0] & 7; + hd->status = temp_t9; + D_8009CF60 = temp_t9; + if ((temp_t9 != 0) && (temp_t9 != 7)) { + return 0xC; + } + case 2: + hd->mode = 2; + + errorCode = __osVoiceGetStatus(hd->mq, hd->port, &sp38[39]); + if (errorCode != 0) { + return errorCode; + } + + if (0) {} + if (sp38[39] & 2) { + return 0xF; + } + + sp38[1] = 0x600; + errorCode = __osVoiceContWrite4(hd->mq, hd->port, 0, sp38); + if (errorCode != 0) { + return errorCode; + } + + case 3: + hd->mode = 3; + + errorCode = __osVoiceGetStatus(hd->mq, hd->port, &sp38[39]); + if (errorCode != 0) { + return errorCode; + } + + if (sp38[39] & 1) { + return 0xF; + } + + errorCode = __osVoiceContRead36(hd->mq, hd->port, 0, sp38); + if (errorCode != 0) { + return errorCode; + } + + result->warning = (sp38[5] << 8) + sp38[4]; + result->answer_num = sp38[6]; + result->voice_level = (sp38[9] << 8) + sp38[8]; + result->voice_sn = (sp38[11] << 8) + sp38[10]; + result->voice_time = (sp38[13] << 8) + sp38[12]; + + new_var = 4; + for (i = 0; i < 5; i++) { + result->answer[i] = (sp38[15 + new_var*i] << 8) + sp38[14 + new_var*i]; + result->distance[i] = (sp38[17 + new_var*i] << 8) + sp38[16 + new_var*i]; + } + + if (result->answer[0] == 0x7FFF) { + result->answer_num = 0; + } + + hd->status = sp38[34] & 7; + if ((D_8009CF60 == 0) || (hd->status == 0)) { + break; + } + case 4: + hd->mode = 4; + + errorCode = __osVoiceGetStatus(hd->mq, hd->port, &sp38[39]); + if (errorCode != 0) { + return errorCode; + } + + if (sp38[39] & 1) { + return 0xF; + } + + errorCode = __osVoiceContRead2(hd->mq, hd->port, 0, sp38); + if (errorCode != 0) { + return errorCode; + } + + hd->status = sp38[0] & 7; + if ((sp38[0] & 7) != 0) { + return 0xF; + } + + break; + default: + return 5; + } + hd->mode = 0; + return errorCode; +} +#else #pragma GLOBAL_ASM("asm/non_matchings/boot/voicegetreaddata/osVoiceGetReadData.s") +#endif |
