mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-18 05:44:53 +00:00
Message Queues, Threads, and surroundings cleanup (#1178)
* message queues, threads, and surroundings cleanup * Format, make the formatter prefer clang-format-11 if found * Fix __osThreadTail type * Q -> Queue, thread defines renamed * Reformat, add missing NULL * Suggested changes and further casting cleanup * Reformat * padmgr name fixes
This commit is contained in:
parent
9984c267d9
commit
7068ad3703
45 changed files with 311 additions and 296 deletions
|
@ -67,7 +67,7 @@ AudioTask* func_800E5000(void) {
|
|||
}
|
||||
}
|
||||
|
||||
osSendMesg(gAudioContext.taskStartQueueP, gAudioContext.totalTaskCnt, OS_MESG_NOBLOCK);
|
||||
osSendMesg(gAudioContext.taskStartQueueP, (OSMesg)gAudioContext.totalTaskCnt, OS_MESG_NOBLOCK);
|
||||
gAudioContext.rspTaskIdx ^= 1;
|
||||
gAudioContext.curAIBufIdx++;
|
||||
gAudioContext.curAIBufIdx %= 3;
|
||||
|
@ -99,7 +99,7 @@ AudioTask* func_800E5000(void) {
|
|||
}
|
||||
}
|
||||
|
||||
sp48 = gAudioContext.currAudioFrameDmaQueue.validCount;
|
||||
sp48 = MQ_GET_COUNT(&gAudioContext.currAudioFrameDmaQueue);
|
||||
if (sp48 != 0) {
|
||||
for (i = 0; i < sp48; i++) {
|
||||
osRecvMesg(&gAudioContext.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK);
|
||||
|
@ -114,7 +114,8 @@ AudioTask* func_800E5000(void) {
|
|||
if (gAudioContext.resetStatus != 0) {
|
||||
if (AudioHeap_ResetStep() == 0) {
|
||||
if (gAudioContext.resetStatus == 0) {
|
||||
osSendMesg(gAudioContext.audioResetQueueP, gAudioContext.audioResetSpecIdToLoad, OS_MESG_NOBLOCK);
|
||||
osSendMesg(gAudioContext.audioResetQueueP, (OSMesg)(u32)gAudioContext.audioResetSpecIdToLoad,
|
||||
OS_MESG_NOBLOCK);
|
||||
}
|
||||
|
||||
sWaitingAudioTask = NULL;
|
||||
|
@ -171,7 +172,7 @@ AudioTask* func_800E5000(void) {
|
|||
gWaveSamples[8] = (s16*)(((u8*)func_800E4FE0) + (gAudioContext.audioRandom & 0xFFF0));
|
||||
|
||||
index = gAudioContext.rspTaskIdx;
|
||||
gAudioContext.currTask->taskQueue = NULL;
|
||||
gAudioContext.currTask->msgQueue = NULL;
|
||||
gAudioContext.currTask->unk_44 = NULL;
|
||||
|
||||
task = &gAudioContext.currTask->task.t;
|
||||
|
@ -348,11 +349,12 @@ void Audio_InitMesgQueuesInternal(void) {
|
|||
gAudioContext.taskStartQueueP = &gAudioContext.taskStartQueue;
|
||||
gAudioContext.cmdProcQueueP = &gAudioContext.cmdProcQueue;
|
||||
gAudioContext.audioResetQueueP = &gAudioContext.audioResetQueue;
|
||||
osCreateMesgQueue(gAudioContext.taskStartQueueP, gAudioContext.taskStartMsgs,
|
||||
ARRAY_COUNT(gAudioContext.taskStartMsgs));
|
||||
osCreateMesgQueue(gAudioContext.cmdProcQueueP, gAudioContext.cmdProcMsgs, ARRAY_COUNT(gAudioContext.cmdProcMsgs));
|
||||
osCreateMesgQueue(gAudioContext.audioResetQueueP, gAudioContext.audioResetMesgs,
|
||||
ARRAY_COUNT(gAudioContext.audioResetMesgs));
|
||||
osCreateMesgQueue(gAudioContext.taskStartQueueP, gAudioContext.taskStartMsgBuf,
|
||||
ARRAY_COUNT(gAudioContext.taskStartMsgBuf));
|
||||
osCreateMesgQueue(gAudioContext.cmdProcQueueP, gAudioContext.cmdProcMsgBuf,
|
||||
ARRAY_COUNT(gAudioContext.cmdProcMsgBuf));
|
||||
osCreateMesgQueue(gAudioContext.audioResetQueueP, gAudioContext.audioResetMsgBuf,
|
||||
ARRAY_COUNT(gAudioContext.audioResetMsgBuf));
|
||||
}
|
||||
|
||||
void Audio_QueueCmd(u32 opArgs, void** data) {
|
||||
|
@ -398,7 +400,7 @@ s32 Audio_ScheduleProcessCmds(void) {
|
|||
|
||||
ret =
|
||||
osSendMesg(gAudioContext.cmdProcQueueP,
|
||||
(void*)(((gAudioContext.cmdRdPos & 0xFF) << 8) | (gAudioContext.cmdWrPos & 0xFF)), OS_MESG_NOBLOCK);
|
||||
(OSMesg)(((gAudioContext.cmdRdPos & 0xFF) << 8) | (gAudioContext.cmdWrPos & 0xFF)), OS_MESG_NOBLOCK);
|
||||
if (ret != -1) {
|
||||
gAudioContext.cmdRdPos = gAudioContext.cmdWrPos;
|
||||
ret = 0;
|
||||
|
@ -514,7 +516,7 @@ s32 func_800E5EDC(void) {
|
|||
void func_800E5F34(void) {
|
||||
// macro?
|
||||
// clang-format off
|
||||
s32 chk = -1; s32 sp28; do {} while (osRecvMesg(gAudioContext.audioResetQueueP, (OSMesg*)&sp28, OS_MESG_NOBLOCK) != chk);
|
||||
s32 chk = -1; OSMesg msg; do {} while (osRecvMesg(gAudioContext.audioResetQueueP, &msg, OS_MESG_NOBLOCK) != chk);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue