diff options
| author | engineer124 <engineer124engineer124@gmail.com> | 2021-11-07 21:24:58 +1100 |
|---|---|---|
| committer | engineer124 <engineer124engineer124@gmail.com> | 2021-11-07 21:24:58 +1100 |
| commit | 3c76274078fb3226d8b2327f080eeceebf08f403 (patch) | |
| tree | 28afa87e0a88442b92b6e82d82c1f4d8cc7156ae /src | |
| parent | a3ee28e897500cf6b9ca4d8edcb47e10a802ac43 (diff) | |
Add docs from n64devkit
Diffstat (limited to 'src')
| -rw-r--r-- | src/libultra/voice/voicecheckresult.c | 14 | ||||
| -rw-r--r-- | src/libultra/voice/voicecleardictionary.c | 23 | ||||
| -rw-r--r-- | src/libultra/voice/voicecontrolgain.c | 16 | ||||
| -rw-r--r-- | src/libultra/voice/voicestartreaddata.c | 24 |
4 files changed, 39 insertions, 38 deletions
diff --git a/src/libultra/voice/voicecheckresult.c b/src/libultra/voice/voicecheckresult.c index a20c88461..97af48094 100644 --- a/src/libultra/voice/voicecheckresult.c +++ b/src/libultra/voice/voicecheckresult.c @@ -1,21 +1,21 @@ #include "global.h" s32 __osVoiceCheckResult(OSVoiceHandle* hd, u8* status) { - s32 phi_v1; + s32 errorCode; u8 sp20[2]; - if (phi_v1 = __osVoiceGetStatus(hd->mq, hd->port, status), phi_v1 == 0) { + if (errorCode = __osVoiceGetStatus(hd->mq, hd->port, status), errorCode == 0) { if (*status & 1) { - phi_v1 = 0xF; - } else if (phi_v1 = __osVoiceContRead2(hd->mq, hd->port, 0, sp20), phi_v1 == 0) { + errorCode = 0xF; + } else if (errorCode = __osVoiceContRead2(hd->mq, hd->port, 0, sp20), errorCode == 0) { hd->status = sp20[0] & 7; if (sp20[0] & 0x40) { - phi_v1 = 0xF; + errorCode = 0xF; } else { - phi_v1 = sp20[1] << 8; + errorCode = sp20[1] << 8; } } } - return phi_v1; + return errorCode; } diff --git a/src/libultra/voice/voicecleardictionary.c b/src/libultra/voice/voicecleardictionary.c index 4de1eef59..92114809d 100644 --- a/src/libultra/voice/voicecleardictionary.c +++ b/src/libultra/voice/voicecleardictionary.c @@ -5,11 +5,11 @@ s32 osVoiceClearDictionary(OSVoiceHandle* hd, u8 words) { u8* registration_word; u8 status; s32 sp24; - s32 temp_v0; + s32 errorCode; - temp_v0 = __osVoiceGetStatus(hd->mq, hd->port, &status); - if (temp_v0 != 0) { - return temp_v0; + errorCode = __osVoiceGetStatus(hd->mq, hd->port, &status); + if (errorCode != 0) { + return errorCode; } registration_word = &sp24; @@ -20,14 +20,15 @@ s32 osVoiceClearDictionary(OSVoiceHandle* hd, u8 words) { sp24 = 0x2000000; registration_word[2] = words; - temp_v0 = __osVoiceContWrite4(hd->mq, hd->port, 0, registration_word); - if (temp_v0 != 0) { - return temp_v0; + errorCode = __osVoiceContWrite4(hd->mq, hd->port, 0, registration_word); + if (errorCode != 0) { + return errorCode; } - temp_v0 = __osVoiceCheckResult(hd, &status); - if ((temp_v0 & 0xFF00) != 0) { - temp_v0 = 5; + errorCode = __osVoiceCheckResult(hd, &status); + if ((errorCode & 0xFF00) != 0) { + errorCode = 5; } - return temp_v0; + + return errorCode; } diff --git a/src/libultra/voice/voicecontrolgain.c b/src/libultra/voice/voicecontrolgain.c index cfca63fbb..b0a66284a 100644 --- a/src/libultra/voice/voicecontrolgain.c +++ b/src/libultra/voice/voicecontrolgain.c @@ -4,7 +4,7 @@ extern u8 D_80098180[]; // Adjusts the input gain of the Voice Recognition System s32 osVoiceControlGain(OSVoiceHandle* hd, s32 analog, s32 digital) { - s32 ret; + s32 errorCode; u8 phi_a2; @@ -14,9 +14,9 @@ s32 osVoiceControlGain(OSVoiceHandle* hd, s32 analog, s32 digital) { phi_a2 = 0x98; } - ret = __osVoiceSetADConverter(hd->mq, hd->port, phi_a2, hd); - if (ret != 0) { - return ret; + errorCode = __osVoiceSetADConverter(hd->mq, hd->port, phi_a2, hd); + if (errorCode != 0) { + return errorCode; } if (!((digital < 8) && (digital >= 0))){ @@ -30,10 +30,10 @@ s32 osVoiceControlGain(OSVoiceHandle* hd, s32 analog, s32 digital) { return 5; } - ret = __osVoiceSetADConverter(hd->mq, hd->port, phi_a2, hd); - if (ret != 0) { - return ret; + errorCode = __osVoiceSetADConverter(hd->mq, hd->port, phi_a2, hd); + if (errorCode != 0) { + return errorCode; } - return ret; + return errorCode; } diff --git a/src/libultra/voice/voicestartreaddata.c b/src/libultra/voice/voicestartreaddata.c index e0e696749..88c77dc2c 100644 --- a/src/libultra/voice/voicestartreaddata.c +++ b/src/libultra/voice/voicestartreaddata.c @@ -2,16 +2,16 @@ // Start voice recognition by the Voice Recognition System s32 osVoiceStartReadData(OSVoiceHandle* hd) { - s32 ret; - u8 sp2B; + s32 errorCode; + u8 status; s32 sp24; - ret = __osVoiceGetStatus(hd->mq, hd->port, &sp2B); - if (ret != 0) { - return ret; + errorCode = __osVoiceGetStatus(hd->mq, hd->port, &status); + if (errorCode != 0) { + return errorCode; } - if ((sp2B & 2) != 0) { + if (status & 2) { return 0xF; } @@ -20,17 +20,17 @@ s32 osVoiceStartReadData(OSVoiceHandle* hd) { } sp24 = 0x5000000; - ret = __osVoiceContWrite4(hd->mq, hd->port, 0, &sp24); + errorCode = __osVoiceContWrite4(hd->mq, hd->port, 0, &sp24); - if (ret == 0) { - ret = __osVoiceCheckResult(hd, &sp2B); + if (errorCode == 0) { + errorCode = __osVoiceCheckResult(hd, &status); - if ((ret & 0xFF00) != 0) { - ret = 5; + if (errorCode & 0xFF00) { + errorCode = 5; } else { hd->mode = 1; } } - return ret; + return errorCode; } |
