Voice progress

This commit is contained in:
engineer124
2021-10-03 16:29:33 +11:00
parent 1921997a60
commit d70906fee7
5 changed files with 97 additions and 10 deletions
+7 -7
View File
@@ -355,11 +355,11 @@ void guLookAtHiliteF(float mf[4][4], LookAt* l, Hilite* h, f32 xEye, f32 yEye, f
void guLookAtHilite(Mtx* m, LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp, f32 xl1, f32 yl1, f32 zl1, f32 xl2, f32 yl2, f32 zl2, s32 twidth, s32 theight);
s32 _Printf(PrintCallback pfn, void* arg, const char* fmt, va_list ap);
void _Putfld(_Pft* px, va_list* pap, u8 code, u8* ac);
// void osVoiceClearDictionary(void);
s32 osVoiceClearDictionary(OSVoiceHandle* hd, u8 words);
void osUnmapTLBAll(void);
s32 osEPiStartDma(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction);
// void __osVoiceContRead2(void);
// void __osVoiceContDataCrc(void);
s32 __osVoiceContRead2(OSMesgQueue* mq, s32 port, s32, u8 dst[2]);
u8 __osVoiceContDataCrc(u8* data, u32 arg1);
const char* strchr(const char* __s, s32 __c);
size_t strlen(const char* __s);
void* memcpy(void* __dest, const void* __src, size_t __n);
@@ -388,7 +388,7 @@ OSTime osGetTime(void);
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);
// void osVoiceInit(void);
s32 osVoiceInit(OSMesgQueue* siMessageQ, OSVoiceHandle* hd, s32 channel);
// void __osContChannelReset(void);
// void __osVoiceSetADConverter(void);
s32 osAiSetFrequency(u32 frequency);
@@ -418,7 +418,7 @@ f32 __cosf(f32 __x);
void osViSetSpecialFeatures(u32 func);
s16 coss(u16 x);
void osSetTime(OSTime ticks);
// void osVoiceStopReadData(void);
s32 osVoiceStopReadData(OSVoiceHandle* hd);
void osViSetEvent(OSMesgQueue* mq, OSMesg m, u32 retraceCount);
s32 osPfsIsPlug(OSMesgQueue* queue, u8* pattern);
// void __osPfsRequestData(void);
@@ -473,11 +473,11 @@ float __ll_to_f(long long l);
double __ull_to_d(unsigned long long l);
float __ull_to_f(unsigned long long l);
// void osVoiceCheckWord(void);
// void osVoiceControlGain(void);
s32 osVoiceControlGain(OSVoiceHandle *hd, s32 analog, s32 digital);
// void osVoiceStartReadData(void);
void* osViGetCurrentFramebuffer(void);
s32 __osSpSetPc(void* data);
// void __osVoiceContWrite4(void);
// s32 __osVoiceContWrite4(OSMesgQueue* hd, s32 arg1, s32 arg2, OSVoiceData* voiceData);
void __osGetHWIntrRoutine(s32 idx, OSMesgQueue** outQueue, OSMesg* outMsg);
// void __osSetHWIntrRoutine(void);
u32 __osGetWatchLo(void);
+10
View File
@@ -131,4 +131,14 @@ typedef struct {
/* 0xC */ u8 status;
} OSVoiceHandle; // size = 0x10
typedef struct {
/* 0x00 */ u16 warning; /* Warning */
/* 0x02 */ u16 answer_num; /* Candidate number (0~5) */
/* 0x04 */ u16 voice_level; /* Voice input level */
/* 0x06 */ u16 voice_sn; /* Relative voice level */
/* 0x08 */ u16 voice_time; /* Voice input time */
/* 0x0A */ u16 answer[5]; /* Candidate word number */
/* 0x14 */ u16 distance[5]; /* Distance value */
} OSVoiceData; // size = 0x20
#endif
+19 -1
View File
@@ -1,3 +1,21 @@
#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/boot/voicecheckresult/__osVoiceCheckResult.s")
s32 __osVoiceCheckResult(OSVoiceHandle* handle, u8* status) {
s32 phi_v1;
u8 sp20[2];
if (phi_v1 = __osVoiceGetStatus(handle->mq, handle->port, status), phi_v1 == 0) {
if (*status & 1) {
phi_v1 = 0xF;
} else if (phi_v1 = __osVoiceContRead2(handle->mq, handle->port, 0, sp20), phi_v1 == 0) {
handle->status = sp20[0] & 7;
if (sp20[0] & 0x40) {
phi_v1 = 0xF;
} else {
phi_v1 = sp20[1] << 8;
}
}
}
return phi_v1;
}
+30 -1
View File
@@ -1,4 +1,33 @@
#include "global.h"
// Initializes Voice Recognition System word registration dictionary
#pragma GLOBAL_ASM("asm/non_matchings/boot/voicecleardictionary/osVoiceClearDictionary.s")
s32 osVoiceClearDictionary(OSVoiceHandle* hd, u8 words) {
u8* registration_word;
u8 status;
s32 sp24;
s32 temp_v0;
temp_v0 = __osVoiceGetStatus(hd->mq, hd->port, &status);
if (temp_v0 != 0) {
return temp_v0;
}
registration_word = &sp24;
if (status & 2) {
return 0xF;
}
sp24 = 0x2000000;
registration_word[2] = words;
temp_v0 = __osVoiceContWrite4(hd->mq, hd->port, 0, registration_word);
if (temp_v0 != 0) {
return temp_v0;
}
temp_v0 = __osVoiceCheckResult(hd, &status);
if ((temp_v0 & 0xFF00) != 0) {
temp_v0 = 5;
}
return temp_v0;
}
+31 -1
View File
@@ -1,3 +1,33 @@
#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/boot/voicecrc/__osVoiceContDataCrc.s")
u8 __osVoiceContDataCrc(u8* data, u32 arg1) {
u32 bit;
u32 byte;
u32 ret = 0;
for (byte = arg1; byte > 0; byte--) {
for (bit = 0x80; bit > 0; bit >>= 1) {
ret <<= 1;
if (*data & bit) {
if (ret & 0x100) {
ret ^= 0x84;
} else {
ret++;
}
} else if (ret & 0x100) {
ret ^= 0x85;
}
}
data++;
}
do {
ret <<= 1;
if (ret & 0x100) {
ret ^= 0x85;
}
byte++;
} while (byte < 8);
return ret;
}