Match voiceinit.c

This commit is contained in:
engineer124
2021-11-08 00:27:05 +11:00
parent 09a4326856
commit 5aa43d1c29
3 changed files with 60 additions and 5 deletions
+2 -2
View File
@@ -382,8 +382,8 @@ void guRotateF(float mf[4][4], f32 a, f32 x, f32 y, f32 z);
void guRotate(Mtx* m, f32 a, f32 x, f32 y, f32 z);
void __osSetGlobalIntMask(u32 mask);
s32 osVoiceInit(OSMesgQueue* siMessageQ, OSVoiceHandle* hd, s32 channel);
// void __osContChannelReset(void);
s32 __osVoiceSetADConverter(OSMesgQueue* mq, s32 port, u8 arg2, OSVoiceHandle* hd);
s32 __osContChannelReset(OSMesgQueue* mq, s32 count);
s32 __osVoiceSetADConverter(OSMesgQueue* mq, s32 port, u8 arg2);
s32 osAiSetFrequency(u32 frequency);
s32 __osContRamRead(OSMesgQueue* mq, s32 channel, u16 address, u8* buffer);
// void __osVoiceContWrite20(void);
+2 -2
View File
@@ -14,7 +14,7 @@ s32 osVoiceControlGain(OSVoiceHandle* hd, s32 analog, s32 digital) {
phi_a2 = 0x98;
}
errorCode = __osVoiceSetADConverter(hd->mq, hd->port, phi_a2, hd);
errorCode = __osVoiceSetADConverter(hd->mq, hd->port, phi_a2);
if (errorCode != 0) {
return errorCode;
}
@@ -30,7 +30,7 @@ s32 osVoiceControlGain(OSVoiceHandle* hd, s32 analog, s32 digital) {
return 5;
}
errorCode = __osVoiceSetADConverter(hd->mq, hd->port, phi_a2, hd);
errorCode = __osVoiceSetADConverter(hd->mq, hd->port, phi_a2);
if (errorCode != 0) {
return errorCode;
}
+56 -1
View File
@@ -1,4 +1,59 @@
#include "global.h"
extern u8 D_80097FA0;
extern u8 D_80097FA5;
// Initializes Voice Recognition System control structure and hardware
#pragma GLOBAL_ASM("asm/non_matchings/boot/voiceinit/osVoiceInit.s")
s32 osVoiceInit(OSMesgQueue* siMessageQ, OSVoiceHandle* hd, s32 channel) {
s32 errorCode;
u8* phi_s0;
u8 sp37 = 0;
s32 sp30;
s32 pad;
hd->port = channel;
hd->mq = siMessageQ;
hd->mode = 0;
errorCode = __osVoiceGetStatus(siMessageQ, channel, &sp37);
if (errorCode != 0) {
return errorCode;
}
if (__osContChannelReset(siMessageQ, channel) != 0) {
return 4;
}
for (phi_s0 = &D_80097FA0;;) {
errorCode = __osVoiceSetADConverter(siMessageQ, channel, *phi_s0);
phi_s0++;
if (errorCode != 0) {
return errorCode;
}
if (phi_s0 == &D_80097FA5) {
errorCode = __osVoiceGetStatus(siMessageQ, channel, &sp37);
if (errorCode != 0) {
return errorCode;
}
if ((sp37 & 2) != 0) {
return 0xF;
}
sp30 = 0x100;
errorCode = __osVoiceContWrite4(siMessageQ, channel, 0, &sp30);
if (errorCode != 0) {
return errorCode;
}
errorCode = __osVoiceCheckResult(hd, &sp37);
if (errorCode & 0xFF00) {
errorCode = 5;
}
return errorCode;
}
}
}