From 1ba2815d09ff320a9a3723070495a2e344b2b910 Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Sun, 26 Apr 2026 07:47:19 -0700 Subject: [PATCH] [n64-jp-1.1] z_std_dma (#1879) --- src/boot/z_std_dma.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index aa26c0b09f..6b121ce3bd 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -108,7 +108,13 @@ end: * @return 0 if the IO Message was successfully put on the OS PI command queue, < 0 otherwise */ s32 DmaMgr_AudioDmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) { - return osEPiStartDma(pihandle, mb, direction); + s32 ret = osEPiStartDma(pihandle, mb, direction); + + if (ret != 0) { + PRINTF("OOPS!!\n"); + } + + return ret; } DmaEntry* DmaMgr_FindDmaEntry(uintptr_t vrom) { @@ -171,7 +177,11 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { // only part of their content loaded into RAM, so DMA only the requested region. if (entry->file.vromEnd < (vrom + size)) { // Error, vrom + size ends up in a different file than it started in +#if MM_VERSION >= N64_US Fault_AddHungupAndCrash("../z_std_dma.c", 499); +#else + Fault_AddHungupAndCrash("../z_std_dma.c", 496); +#endif } DmaMgr_DmaRomToRam((entry->romStart + vrom) - entry->file.vromStart, ram, size); } else { @@ -182,12 +192,20 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { if (vrom != entry->file.vromStart) { // Error, requested vrom is not the start of a file +#if MM_VERSION >= N64_US Fault_AddHungupAndCrash("../z_std_dma.c", 518); +#else + Fault_AddHungupAndCrash("../z_std_dma.c", 515); +#endif } if (size != (entry->file.vromEnd - entry->file.vromStart)) { // Error, only part of the file was requested +#if MM_VERSION >= N64_US Fault_AddHungupAndCrash("../z_std_dma.c", 525); +#else + Fault_AddHungupAndCrash("../z_std_dma.c", 522); +#endif } // Reduce the thread priority and decompress the file, the decompression routine handles the DMA @@ -198,7 +216,11 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { } } else { // Error, invalid index +#if MM_VERSION >= N64_US Fault_AddHungupAndCrash("../z_std_dma.c", 558); +#else + Fault_AddHungupAndCrash("../z_std_dma.c", 555); +#endif } } @@ -206,6 +228,8 @@ void DmaMgr_ThreadEntry(void* arg) { OSMesg msg; DmaRequest* req; + PRINTF(T("DMAマネージャスレッド実行開始\n", "DMA manager thread execution start\n")); + while (true) { // Wait for DMA Requests to arrive from other threads osRecvMesg(&sDmaMgrMsgQueue, &msg, OS_MESG_BLOCK); @@ -223,6 +247,8 @@ void DmaMgr_ThreadEntry(void* arg) { osSendMesg(req->notifyQueue, req->notifyMsg, OS_MESG_NOBLOCK); } } + + PRINTF(T("DMAマネージャスレッド実行終了\n", "DMA manager thread execution end\n")); } /**