From 7b95bd11d14025d1a420e1cdcb7184b4b93b9ae7 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Tue, 9 Nov 2021 23:34:44 +1100 Subject: [PATCH] Add small amount of docs --- src/libultra/io/contreaddata.c | 4 ++-- src/libultra/io/controller.c | 4 ++-- src/libultra/io/motor.c | 2 +- src/libultra/voice/voicecontread2.c | 10 +++++----- src/libultra/voice/voicegetstatus.c | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/libultra/io/contreaddata.c b/src/libultra/io/contreaddata.c index 035663486..8fb925876 100644 --- a/src/libultra/io/contreaddata.c +++ b/src/libultra/io/contreaddata.c @@ -43,11 +43,11 @@ void __osPackReadData() { int i; ptr = (u8*)__osContPifRam.ramarray; - for (i = 0; i < 0xF; i++) { + for (i = 0; i < ARRAY_COUNT(__osContPifRam.ramarray); i++) { __osContPifRam.ramarray[i] = 0; } - __osContPifRam.pifstatus = 1; + __osContPifRam.pifstatus = CONT_CMD_READ_BUTTON; readformat.dummy = 255; readformat.txsize = 1; readformat.rxsize = 4; diff --git a/src/libultra/io/controller.c b/src/libultra/io/controller.c index 21e376d58..548d3e257 100644 --- a/src/libultra/io/controller.c +++ b/src/libultra/io/controller.c @@ -74,11 +74,11 @@ void __osPackRequestData(u8 cmd) { __OSContRequesFormat requestformat; int i; - for (i = 0; i < 0xF; i++) { + for (i = 0; i < ARRAY_COUNT(__osContPifRam.ramarray); i++) { __osContPifRam.ramarray[i] = 0; } - __osContPifRam.pifstatus = 1; + __osContPifRam.pifstatus = CONT_CMD_READ_BUTTON; ptr = (u8*)__osContPifRam.ramarray; requestformat.dummy = 255; requestformat.txsize = 1; diff --git a/src/libultra/io/motor.c b/src/libultra/io/motor.c index 4c0bfb67a..9db4bdb4c 100644 --- a/src/libultra/io/motor.c +++ b/src/libultra/io/motor.c @@ -20,7 +20,7 @@ s32 __osMotorAccess(OSPfs* pfs, u32 vibrate) { } __osSiGetAccess(); - osPifBuffers[pfs->channel].pifstatus = 1; + osPifBuffers[pfs->channel].pifstatus = CONT_CMD_READ_BUTTON; buf += pfs->channel; for (i = 0; i < BLOCKSIZE; i++) { ((__OSContRamReadFormat*)buf)->data[i] = vibrate; diff --git a/src/libultra/voice/voicecontread2.c b/src/libultra/voice/voicecontread2.c index 8e70d4dee..e1d260372 100644 --- a/src/libultra/voice/voicecontread2.c +++ b/src/libultra/voice/voicecontread2.c @@ -4,9 +4,9 @@ extern s32 D_80097FB0; s32 __osVoiceContRead2(OSMesgQueue* mq, s32 port, u16 arg2, u8* dst) { u8* ptr; - u8 sp63; + u8 status; s32 errorCode; - s32 var = 2; + s32 retryCount = 2; s32 i; __osSiGetAccess(); @@ -23,7 +23,7 @@ s32 __osVoiceContRead2(OSMesgQueue* mq, s32 port, u16 arg2, u8* dst) { ; } - __osPfsPifRam.pifstatus = 1; + __osPfsPifRam.pifstatus = CONT_CMD_READ_BUTTON; ptr[0] = 0xFF; ptr[1] = 3; @@ -47,7 +47,7 @@ s32 __osVoiceContRead2(OSMesgQueue* mq, s32 port, u16 arg2, u8* dst) { if (errorCode == 0) { if (ptr[8] != __osVoiceContDataCrc(&ptr[6], 2)) { - errorCode = __osVoiceGetStatus(mq, port, &sp63); + errorCode = __osVoiceGetStatus(mq, port, &status); if (errorCode != 0) { break; } @@ -60,7 +60,7 @@ s32 __osVoiceContRead2(OSMesgQueue* mq, s32 port, u16 arg2, u8* dst) { errorCode = CONT_ERR_NO_CONTROLLER; } - } while ((errorCode == CONT_ERR_CONTRFAIL) && (var-- >= 0)); + } while ((errorCode == CONT_ERR_CONTRFAIL) && (retryCount-- >= 0)); __osSiRelAccess(); diff --git a/src/libultra/voice/voicegetstatus.c b/src/libultra/voice/voicegetstatus.c index 7946b4904..e11dcb954 100644 --- a/src/libultra/voice/voicegetstatus.c +++ b/src/libultra/voice/voicegetstatus.c @@ -6,7 +6,7 @@ s32 __osVoiceGetStatus(OSMesgQueue* mq, s32 port, u8* status) { s32 errorCode = 0; s32 i; u8* ptr = (u8*)&__osContPifRam; - s32 var = 2; + s32 retryCount = 2; __osSiGetAccess(); @@ -51,7 +51,7 @@ s32 __osVoiceGetStatus(OSMesgQueue* mq, s32 port, u8* status) { } else { errorCode = CONT_ERR_CONTRFAIL; } - } while ((errorCode == CONT_ERR_CONTRFAIL) && (var-- >= 0)); + } while ((errorCode == CONT_ERR_CONTRFAIL) && (retryCount-- >= 0)); __osSiRelAccess();