From 0098119fedeba1c8a2e6ceeb434d604eeb1fe6a7 Mon Sep 17 00:00:00 2001 From: Ryan Myers Date: Thu, 28 Oct 2021 17:41:53 -0400 Subject: [PATCH] Fix warnings, and name variables --- src/asset_loading.c | 27 +++++++++++++-------------- src/unknown_06B2B0.c | 6 ++++-- src/video.c | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/asset_loading.c b/src/asset_loading.c index 730b95d4..52e30871 100644 --- a/src/asset_loading.c +++ b/src/asset_loading.c @@ -10,12 +10,11 @@ /************ .bss ************/ -OSIoMesg D_80124200; -OSMesg D_80124218; -OSMesgQueue D_80124220; -OSMesg D_80124238; -s32 D_80124240[14]; -OSMesgQueue D_80124278; +OSIoMesg gAssetsDmaIoMesg; +OSMesg gDmaMesgBuf[1]; +OSMesgQueue gDmaMesgQueue; +OSMesg gPIMesgBuf[16]; +OSMesgQueue gPIMesgQueue; s32 *gAssetsLookupTable; /*******************************/ @@ -25,13 +24,13 @@ extern u8 __ASSETS_LUT_START, __ASSETS_LUT_END; // __ASSETS_LUT_START = 0xECB60, void func_80076BA0(void) { u32 assetTableSize; - osCreateMesgQueue(&D_80124278, &D_80124238, 16); - osCreateMesgQueue(&D_80124220, &D_80124218, 1); - osCreatePiManager((OSPri)150, &D_80124278, &D_80124238, 16); + osCreateMesgQueue(&gPIMesgQueue, gPIMesgBuf, ARRAY_COUNT(gPIMesgBuf)); + osCreateMesgQueue(&gDmaMesgQueue, gDmaMesgBuf, ARRAY_COUNT(gDmaMesgBuf)); + osCreatePiManager((OSPri)150, &gPIMesgQueue, gPIMesgBuf, ARRAY_COUNT(gPIMesgBuf)); assetTableSize = &__ASSETS_LUT_END - &__ASSETS_LUT_START; gAssetsLookupTable = (s32 *)allocate_from_main_pool_safe(assetTableSize, COLOR_TAG_GRAY); - func_80071478(gAssetsLookupTable); - dmacopy(&__ASSETS_LUT_START, gAssetsLookupTable, assetTableSize); + func_80071478((u8 *)gAssetsLookupTable); + dmacopy((u32)&__ASSETS_LUT_START, (u32)gAssetsLookupTable, (s32)assetTableSize); } /** @@ -176,7 +175,7 @@ s32 get_size_of_asset_section(u32 assetIndex) { * Copies data from the game cartridge to a ram address. */ void dmacopy(u32 romOffset, u32 ramAddress, s32 numBytes) { - OSMesg *sp4C; + OSMesg dmaMesgBuf[1]; s32 numBytesToDMA; osInvalDCache(ramAddress, numBytes); @@ -185,8 +184,8 @@ void dmacopy(u32 romOffset, u32 ramAddress, s32 numBytes) { if (numBytes < numBytesToDMA) { numBytesToDMA = numBytes; } - osPiStartDma(&D_80124200, 0, 0, romOffset, ramAddress, numBytesToDMA, &D_80124220); - osRecvMesg(&D_80124220, &sp4C, 1); + osPiStartDma(&gAssetsDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, romOffset, ramAddress, numBytesToDMA, &gDmaMesgQueue); + osRecvMesg(&gDmaMesgQueue, dmaMesgBuf, ARRAY_COUNT(dmaMesgBuf)); numBytes -= numBytesToDMA; romOffset += numBytesToDMA; ramAddress += numBytesToDMA; diff --git a/src/unknown_06B2B0.c b/src/unknown_06B2B0.c index 95595428..04c19d7e 100644 --- a/src/unknown_06B2B0.c +++ b/src/unknown_06B2B0.c @@ -167,8 +167,10 @@ s32 gCurrNumHudMatPerPlayer; s32 gCurrNumHudTrisPerPlayer; s32 gCurrNumHudVertsPerPlayer; OSScClient *D_80123538[3]; -OSMesg *D_80123544; +OSMesg D_80123544[1]; OSMesgQueue *D_80123548; +// These values are almost definitely the values in the OSMesgQueue above +// I just haven't figured out how to do it properly yet. s32 D_8012354C; s32 D_80123550[4]; s32 D_80123560[8]; @@ -845,7 +847,7 @@ void func_8006C3E0(void) { func_80075B18(); func_80081218(); create_and_start_thread30(); - osCreateMesgQueue(&D_80123548, &D_80123544, 1); + osCreateMesgQueue(&D_80123548, D_80123544, ARRAY_COUNT(D_80123544)); osScAddClient(&D_80121260, &D_80123538, &D_80123548, 3); D_80123560[0] = 0; D_80123504 = 0; diff --git a/src/video.c b/src/video.c index 6bc1a715..7e970e1a 100644 --- a/src/video.c +++ b/src/video.c @@ -82,7 +82,7 @@ void init_video(s32 videoModeIndex, OSSched *sc) { init_framebuffer(1); gVideoCurrFbIndex = 1; swap_framebuffers(); - osCreateMesgQueue((OSMesgQueue *)&D_801261A0, (OSMesg *)&D_80126180, 8); + osCreateMesgQueue((OSMesgQueue *)&D_801261A0, D_80126180, ARRAY_COUNT(D_80126180)); osScAddClient(sc, &D_80126310, (OSMesgQueue *)&D_801261A0, 2); init_vi_settings(); D_801262D0 = 12;