diff options
| author | Roman971 <romanlasnier@hotmail.com> | 2020-03-22 22:19:43 +0100 |
|---|---|---|
| committer | Roman971 <romanlasnier@hotmail.com> | 2020-03-22 22:20:03 +0100 |
| commit | 8cfe7cce9f8d8abea794e67510879e751d373a87 (patch) | |
| tree | c6c46f34d3575f6dc02b98b2b5f5ad88d2b2c64e /src/libultra_boot_O2/vimgr.c | |
| parent | 251aea64ab3e6e8cd6f1d9ed34f514e656724777 (diff) | |
Format all src C files
Diffstat (limited to 'src/libultra_boot_O2/vimgr.c')
| -rw-r--r-- | src/libultra_boot_O2/vimgr.c | 86 |
1 files changed, 39 insertions, 47 deletions
diff --git a/src/libultra_boot_O2/vimgr.c b/src/libultra_boot_O2/vimgr.c index de54494f9..d2839078e 100644 --- a/src/libultra_boot_O2/vimgr.c +++ b/src/libultra_boot_O2/vimgr.c @@ -1,7 +1,6 @@ #include <global.h> -typedef struct -{ +typedef struct { u16 unk00; u8 unk02; u32 unk04; @@ -16,18 +15,16 @@ OSMesgQueue viEventQueue; OSMesg viEventBuf[6]; viMesgStruct viRetraceMsg; viMesgStruct viCounterMsg; -OSMgrArgs __osViDevMgr = {0}; +OSMgrArgs __osViDevMgr = { 0 }; u32 __additional_scanline = 0; void viMgrMain(void*); -void osCreateViManager(OSPri pri) -{ +void osCreateViManager(OSPri pri) { u32 int_disabled; OSPri newPri; OSPri currentPri; - if (!__osViDevMgr.initialized) - { + if (!__osViDevMgr.initialized) { __osTimerServicesInit(); __additional_scanline = 0; osCreateMesgQueue(&viEventQueue, viEventBuf, 5); @@ -41,8 +38,7 @@ void osCreateViManager(OSPri pri) osSetEventMesg(OS_EVENT_COUNTER, &viEventQueue, &viCounterMsg); newPri = -1; currentPri = osGetThreadPri(NULL); - if (currentPri < pri) - { + if (currentPri < pri) { newPri = currentPri; osSetThreadPri(NULL, pri); } @@ -56,19 +52,17 @@ void osCreateViManager(OSPri pri) __osViDevMgr.piDmaCallback = NULL; __osViDevMgr.epiDmaCallback = NULL; - osCreateThread(&viThread, 0, &viMgrMain, &__osViDevMgr, viThreadStack+sizeof(viThreadStack), pri); + osCreateThread(&viThread, 0, &viMgrMain, &__osViDevMgr, viThreadStack + sizeof(viThreadStack), pri); __osViInit(); osStartThread(&viThread); __osRestoreInt(int_disabled); - if (newPri != -1) - { + if (newPri != -1) { osSetThreadPri(NULL, newPri); } } } -void viMgrMain(void* vargs) -{ +void viMgrMain(void* vargs) { OSMgrArgs* args; static u16 viRetrace; u32 addTime; @@ -77,49 +71,47 @@ void viMgrMain(void* vargs) temp = 0; mesg = NULL; - viRetrace = __osViGetCurrentContext()->retraceCount; - if (viRetrace == 0) + viRetrace = __osViGetCurrentContext()->retraceCount; + if (viRetrace == 0) { viRetrace = 1; + } args = (OSMgrArgs*)vargs; - while (1) - { + while (1) { osRecvMesg(args->eventQueue, (OSMesg)&mesg, OS_MESG_BLOCK); - switch (mesg->unk00) - { - case 13: - __osViSwapContext(); - viRetrace--; - if (!viRetrace) - { - OSViContext* ctx = __osViGetCurrentContext(); - if (ctx->mq) - osSendMesg(ctx->mq, ctx->msg, OS_MESG_NOBLOCK); - viRetrace = ctx->retraceCount; - } + switch (mesg->unk00) { + case 13: + __osViSwapContext(); + viRetrace--; + if (!viRetrace) { + OSViContext* ctx = __osViGetCurrentContext(); + if (ctx->mq) { + osSendMesg(ctx->mq, ctx->msg, OS_MESG_NOBLOCK); + } + viRetrace = ctx->retraceCount; + } - __osViIntrCount++; + __osViIntrCount++; - // block optimized out since temp is always 0, - // but it changes register allocation and ordering for __osCurrentTime - if (temp != 0) - { - addTime = osGetCount(); - __osCurrentTime = addTime; - temp = 0; - } + // block optimized out since temp is always 0, + // but it changes register allocation and ordering for __osCurrentTime + if (temp != 0) { + addTime = osGetCount(); + __osCurrentTime = addTime; + temp = 0; + } - addTime = __osBaseCounter; - __osBaseCounter = osGetCount(); - addTime = __osBaseCounter - addTime; - __osCurrentTime = __osCurrentTime + addTime; + addTime = __osBaseCounter; + __osBaseCounter = osGetCount(); + addTime = __osBaseCounter - addTime; + __osCurrentTime = __osCurrentTime + addTime; - break; + break; - case 14: - __osTimerInterrupt(); - break; + case 14: + __osTimerInterrupt(); + break; } } } |
