From 2cf5cc58f5b625c95f09e36acbfdc3f3b9fcbaf5 Mon Sep 17 00:00:00 2001 From: Ryan Myers Date: Fri, 29 Oct 2021 10:32:44 -0400 Subject: [PATCH] More warning fixes, and a few hardcoded values using the proper defines --- src/thread0_epc.c | 8 ++++---- src/thread30.c | 2 +- src/unknown_06B2B0.c | 2 +- src/unknown_078050.c | 4 ++-- src/video.c | 16 +++++++++------- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/thread0_epc.c b/src/thread0_epc.c index c8b104b2..5377c506 100644 --- a/src/thread0_epc.c +++ b/src/thread0_epc.c @@ -125,7 +125,7 @@ void thread0_Main(s32 arg0) { // Has regalloc issues while (1) { while (1) { - osRecvMesg(&D_80129790, &sp34, 1); + osRecvMesg(&D_80129790, &sp34, OS_MESG_BLOCK); if (!(get_filtered_cheats() & CHEAT_EPC_LOCK_UP_DISPLAY)) { continue; } @@ -160,7 +160,7 @@ void func_800B7144(void) { OSThread *node = __osGetActiveQueue(); while (node->priority != -1) { if ((node->priority > 0) && (node->priority < 128)) { - osStopThread(&node->next); + osStopThread((OSThread *)&node->next); } node = node->tlnext; } @@ -218,7 +218,7 @@ s32 func_800B76DC(void) { s32 controllerIndex = 0; u8 *sp420[256]; u8 *sp220[128]; - u8 *dataFromControllerPak[128]; + u8 dataFromControllerPak[512]; if (D_800E3020 != -1) { return D_800E3020; @@ -226,7 +226,7 @@ s32 func_800B76DC(void) { D_800E3020 = 0; if ((func_800758DC(controllerIndex) == 0) && //Rumble pack check? (func_800764E8(controllerIndex, &D_800E8EF4, &D_800E8EFC, &fileNum) == 0) && - (read_data_from_controller_pak(controllerIndex, fileNum, &dataFromControllerPak, + (read_data_from_controller_pak(controllerIndex, fileNum, (u8 *)&dataFromControllerPak, sizeof(dataFromControllerPak) * MAXCONTROLLERS) == 0)) { bcopy(&dataFromControllerPak, &gEpcInfo, sizeof(dataFromControllerPak) - 80); //Why less 80 (0x50)? bcopy(&sp220, &D_801299B0, sizeof(sp220)); diff --git a/src/thread30.c b/src/thread30.c index 4478a4c4..814a52d0 100644 --- a/src/thread30.c +++ b/src/thread30.c @@ -102,7 +102,7 @@ void thread30(void *arg) { while (TRUE) { // Wait for a signal from the main thread do { - osRecvMesg(&gThread30MesgQueue, &mesg, 1); + osRecvMesg(&gThread30MesgQueue, &mesg, OS_MESG_BLOCK); } while (mesg != (OSMesg)OS_MESG_TYPE_LOOPBACK); // -1 means there won't be any racers loaded. load_level_for_menu(gThread30LevelIdToLoad, -1, gThread30CutsceneIdToLoad); diff --git a/src/unknown_06B2B0.c b/src/unknown_06B2B0.c index 04c19d7e..2319bdf7 100644 --- a/src/unknown_06B2B0.c +++ b/src/unknown_06B2B0.c @@ -1773,7 +1773,7 @@ s8 func_8006EAB0(void) { s32 func_8006EAC0(void) { if (D_80123560[0] == 0) { - D_80123560[0] = (s32)((osRecvMesg(&D_80123548, NULL, 0) + 1) != 0); + D_80123560[0] = (s32)((osRecvMesg(&D_80123548, NULL, OS_MESG_NOBLOCK) + 1) != 0); } return D_80123560[0]; } diff --git a/src/unknown_078050.c b/src/unknown_078050.c index 107d0bf1..f4818b9b 100644 --- a/src/unknown_078050.c +++ b/src/unknown_078050.c @@ -177,7 +177,7 @@ s32 func_80077A54(void) { if (D_800DE4DC == 0) { return 0; } - osRecvMesg(&D_80125ED8, &sp1C, 1); + osRecvMesg(&D_80125ED8, &sp1C, OS_MESG_BLOCK); D_800DE4DC = 0; return sp1C[1]; } @@ -314,7 +314,7 @@ void func_800787F0(void) { GLOBAL_ASM("asm/non_matchings/unknown_078050/func_800787FC.s") -void func_80078AAC(u32 arg0) { +void func_80078AAC(void *arg0) { D_800DE4D0.ptr = arg0; } diff --git a/src/video.c b/src/video.c index 7e970e1a..6754b9ce 100644 --- a/src/video.c +++ b/src/video.c @@ -208,19 +208,21 @@ void init_framebuffer(s32 index) { } gVideoFbWidths[index] = gVideoModeResolutions[gVideoModeIndex & 7].width; gVideoFbHeights[index] = gVideoModeResolutions[gVideoModeIndex & 7].height; + // TODO: All of the gVideoFramebuffers values are suspicious and probably not the right code. + // The 0x3F is coincidentally sizeof(gVideoModeResolutions) - 1, but that might just be a coincidence if (gVideoModeIndex >= 2) { gVideoFramebuffers[index] = allocate_from_main_pool_safe((HIGH_RES_SCREEN_WIDTH * HIGH_RES_SCREEN_HEIGHT * 2) + 0x30, COLOR_TAG_WHITE); - gVideoFramebuffers[index] = ((s32)gVideoFramebuffers[index] + 0x3F) & ~0x3F; + gVideoFramebuffers[index] = (u16 *)(((s32)gVideoFramebuffers[index] + 0x3F) & ~0x3F); if (gVideoDepthBuffer == NULL) { gVideoDepthBuffer = allocate_from_main_pool_safe((HIGH_RES_SCREEN_WIDTH * HIGH_RES_SCREEN_HEIGHT * 2) + 0x30, COLOR_TAG_WHITE); - gVideoDepthBuffer = ((s32)gVideoDepthBuffer + 0x3F) & ~0x3F; + gVideoDepthBuffer = (u16 *)(((s32)gVideoDepthBuffer + 0x3F) & ~0x3F); } } else { gVideoFramebuffers[index] = allocate_from_main_pool_safe((gVideoFbWidths[index] * gVideoFbHeights[index] * 2) + 0x30, COLOR_TAG_WHITE); - gVideoFramebuffers[index] = ((s32)gVideoFramebuffers[index] + 0x3F) & ~0x3F; + gVideoFramebuffers[index] = (u16 *)(((s32)gVideoFramebuffers[index] + 0x3F) & ~0x3F); if (gVideoDepthBuffer == NULL) { gVideoDepthBuffer = allocate_from_main_pool_safe((gVideoFbWidths[index] * gVideoFbHeights[index] * 2) + 0x30, COLOR_TAG_WHITE); - gVideoDepthBuffer = ((s32)gVideoDepthBuffer + 0x3F) & ~0x3F; + gVideoDepthBuffer = (u16 *)(((s32)gVideoDepthBuffer + 0x3F) & ~0x3F); } } } @@ -245,7 +247,7 @@ s32 func_8007A98C(s32 arg0) { if (arg0 != 8) { swap_framebuffers(); } - while (osRecvMesg(&D_801261A0, NULL, 0) != -1) { + while (osRecvMesg(&D_801261A0, NULL, OS_MESG_NOBLOCK) != -1) { s0 += 1; s0 &= 0xFF; } @@ -265,12 +267,12 @@ s32 func_8007A98C(s32 arg0) { } } while (s0 < D_80126309) { - osRecvMesg(&D_801261A0, NULL, 1); + osRecvMesg(&D_801261A0, NULL, OS_MESG_BLOCK); s0 += 1; s0 &= 0xFF; } osViSwapBuffer(gVideoLastFramebuffer); - osRecvMesg(&D_801261A0, NULL, 1); + osRecvMesg(&D_801261A0, NULL, OS_MESG_BLOCK); return s0; } #else