Fix dmaMesg's being an array of 1

This commit is contained in:
Ryan Myers
2021-12-02 21:48:48 -05:00
parent e49832bf03
commit ab5a54d446
2 changed files with 5 additions and 4 deletions
+1
View File
@@ -90,6 +90,7 @@ void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgC
OSMesgQueue *osPiGetCmdQueue(void);
s32 osPiWriteIo(uintptr_t devAddr, u32 data);
s32 osPiReadIo(uintptr_t devAddr, u32 *data);
s32 osPiRawReadIo(u32 devAddr, u32 *data);
s32 osPiRawStartDma(s32 dir, u32 cart_addr, void *dram_addr, size_t size);
s32 osEPiRawStartDma(OSPiHandle *piHandle, s32 dir, u32 cart_addr, void *dram_addr, size_t size);
+4 -4
View File
@@ -11,7 +11,7 @@
/************ .bss ************/
OSIoMesg gAssetsDmaIoMesg;
OSMesg gDmaMesgBuf[1]; //Seems to only work as an array of 1 for some reason.
OSMesg gDmaMesg;
OSMesgQueue gDmaMesgQueue;
OSMesg gPIMesgBuf[16];
OSMesgQueue gPIMesgQueue;
@@ -25,7 +25,7 @@ extern u8 __ASSETS_LUT_START, __ASSETS_LUT_END; // __ASSETS_LUT_START = 0xECB60,
void func_80076BA0(void) {
u32 assetTableSize;
osCreateMesgQueue(&gPIMesgQueue, gPIMesgBuf, ARRAY_COUNT(gPIMesgBuf));
osCreateMesgQueue(&gDmaMesgQueue, gDmaMesgBuf, ARRAY_COUNT(gDmaMesgBuf));
osCreateMesgQueue(&gDmaMesgQueue, &gDmaMesg, 1);
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);
@@ -175,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 dmaMesgBuf[1]; //Seems to only work as an array of 1 for some reason.
OSMesg dmaMesg;
s32 numBytesToDMA;
osInvalDCache(ramAddress, numBytes);
@@ -185,7 +185,7 @@ void dmacopy(u32 romOffset, u32 ramAddress, s32 numBytes) {
numBytesToDMA = numBytes;
}
osPiStartDma(&gAssetsDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, romOffset, ramAddress, numBytesToDMA, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, dmaMesgBuf, ARRAY_COUNT(dmaMesgBuf));
osRecvMesg(&gDmaMesgQueue, &dmaMesg, 1);
numBytes -= numBytesToDMA;
romOffset += numBytesToDMA;
ramAddress += numBytesToDMA;