diff options
| author | cadmic <cadmic24@gmail.com> | 2025-01-10 09:47:55 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-10 18:47:55 +0100 |
| commit | e4ad4e5eeefd27fe67b7f29fbac884a7d8a986d2 (patch) | |
| tree | 20579a049afeedd10a8a74f7e333798fa90c0835 /src/boot | |
| parent | 26f91bd3bb51bcac0dc06f21f345beedfe663bcb (diff) | |
[iQue] Match remaining src/boot files (#2417)
* [iQue] Match remaining src/boot files
* Fix debug ROM
* Use -funsigned-char
* Sort ique before gc in LNx macros
Diffstat (limited to 'src/boot')
| -rw-r--r-- | src/boot/is_debug_ique.c | 8 | ||||
| -rw-r--r-- | src/boot/z_locale.c | 10 | ||||
| -rw-r--r-- | src/boot/z_std_dma.c | 91 |
3 files changed, 60 insertions, 49 deletions
diff --git a/src/boot/is_debug_ique.c b/src/boot/is_debug_ique.c new file mode 100644 index 000000000..a78fef823 --- /dev/null +++ b/src/boot/is_debug_ique.c @@ -0,0 +1,8 @@ +void osSyncPrintfUnused() { +} + +void osSyncPrintf() { +} + +void rmonPrintf() { +} diff --git a/src/boot/z_locale.c b/src/boot/z_locale.c index 35580e381..f320f1e0f 100644 --- a/src/boot/z_locale.c +++ b/src/boot/z_locale.c @@ -7,7 +7,7 @@ s32 gCurrentRegion = 0; void Locale_Init(void) { -#if PLATFORM_N64 +#if !PLATFORM_GC ALIGNED(4) u8 regionInfo[4]; u8 countryCode; @@ -24,6 +24,7 @@ void Locale_Init(void) { countryCode = sCartInfo.countryCode; #endif +#if !PLATFORM_IQUE switch (countryCode) { case 'J': // "NTSC-J (Japan)" gCurrentRegion = REGION_JP; @@ -40,13 +41,16 @@ void Locale_Init(void) { PRINTF_COLOR_ERROR(); PRINTF(T("z_locale_init: 日本用かアメリカ用か判別できません\n", "z_locale_init: Can't tell if it's for Japan or America\n")); - LogUtils_HungupThread("../z_locale.c", LN4(86, 92, 101, 118, UNK_LINE)); - PRINTF_RST(); + LogUtils_HungupThread("../z_locale.c", LN4(86, 92, 101, UNK_LINE, 118)); + PRINTF(VT_RST); break; } PRINTF(T("z_locale_init:日本用かアメリカ用か3コンで判断させる\n", "z_locale_init: Determine whether it is for Japan or America using 3 controls\n")); +#else + gCurrentRegion = REGION_US; +#endif } void Locale_ResetRegion(void) { diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index ea934a497..0326a1cb6 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -53,11 +53,20 @@ const char* sDmaMgrFileNames[] = { #include "tables/dmadata_table.h" }; +#undef DEFINE_DMA_ENTRY + #endif -#undef DEFINE_DMA_ENTRY +#define SET_IOMSG(ioMsg, queue, rom, ram, buffSize) \ + do { \ + (ioMsg).hdr.pri = OS_MESG_PRI_NORMAL; \ + (ioMsg).hdr.retQueue = (queue); \ + (ioMsg).devAddr = (rom); \ + (ioMsg).dramAddr = (ram); \ + (ioMsg).size = (buffSize); \ + } while (0) -#if PLATFORM_N64 || DEBUG_FEATURES +#if !PLATFORM_GC || DEBUG_FEATURES /** * Compares `str1` and `str2`. * @@ -103,6 +112,9 @@ s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size) { OSMesg msg; s32 ret; size_t buffSize = gDmaMgrDmaBuffSize; +#if DEBUG_FEATURES + UNUSED s32 pad; +#endif if (buffSize == 0) { buffSize = DMAMGR_DEFAULT_BUFSIZE; @@ -116,13 +128,7 @@ s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size) { // The system avoids large DMAs as these would stall the PI for too long, potentially causing issues with // audio. To allow audio to continue to DMA whenever it needs to, other DMAs are split into manageable chunks. - if (1) {} // Necessary to match - - ioMsg.hdr.pri = OS_MESG_PRI_NORMAL; - ioMsg.hdr.retQueue = &queue; - ioMsg.devAddr = rom; - ioMsg.dramAddr = ram; - ioMsg.size = buffSize; + SET_IOMSG(ioMsg, &queue, rom, ram, buffSize); if (gDmaMgrVerbose == 10) { PRINTF(T("%10lld ノーマルDMA %08x %08x %08x (%d)\n", "%10lld Normal DMA %08x %08x %08x (%d)\n"), @@ -151,15 +157,9 @@ s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size) { ram = (u8*)ram + buffSize; } - if (1) { // Also necessary to match - s32 pad[2]; - } + SET_IOMSG(ioMsg, &queue, rom, ram, size); - ioMsg.hdr.pri = OS_MESG_PRI_NORMAL; - ioMsg.hdr.retQueue = &queue; - ioMsg.devAddr = rom; - ioMsg.dramAddr = ram; - ioMsg.size = size; + { UNUSED s32 pad2; } if (gDmaMgrVerbose == 10) { PRINTF(T("%10lld ノーマルDMA %08x %08x %08x (%d)\n", "%10lld Normal DMA %08x %08x %08x (%d)\n"), @@ -242,11 +242,7 @@ void DmaMgr_DmaFromDriveRom(void* ram, uintptr_t rom, size_t size) { osInvalDCache(ram, size); osCreateMesgQueue(&queue, &msg, 1); - ioMsg.hdr.retQueue = &queue; - ioMsg.hdr.pri = OS_MESG_PRI_NORMAL; - ioMsg.devAddr = rom; - ioMsg.dramAddr = ram; - ioMsg.size = size; + SET_IOMSG(ioMsg, &queue, rom, ram, size); handle->transferInfo.cmdType = 2; osEPiStartDma(handle, &ioMsg, OS_READ); @@ -350,7 +346,7 @@ const char* DmaMgr_GetFileName(uintptr_t vrom) { return ret; #elif PLATFORM_GC return ""; -#elif PLATFORM_N64 +#else return "??"; #endif } @@ -380,19 +376,16 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { if (vrom >= iter->file.vromStart && vrom < iter->file.vromEnd) { // Found the region this request falls into -#if PLATFORM_N64 - // Based on the MM Debug ROM, these strings are part of the condition for the empty if statement below, - // as `... && DmaMgr_StrCmp("", "kanji") != 0 && DmaMgr_StrCmp("", "link_animetion") != 0` - (void)""; - (void)"kanji"; - (void)""; - (void)"link_animetion"; -#endif - if (0) { - // The string is defined in .rodata of debug builds but not used, suggesting a debug print is here - // but was optimized out in some way. - PRINTF("DMA ROM:%08X RAM:%08X SIZE:%08X %s\n", vrom, ram, size, filename); +#if !PLATFORM_GC + // Based on the MM Debug ROM, these strings are part of the condition for the empty if statement below + if (DmaMgr_StrCmp("", "kanji") != 0 && DmaMgr_StrCmp("", "link_animetion") != 0) +#endif + { + // The string is defined in .rodata of debug builds but not used, suggesting a debug print is here + // but was optimized out in some way. + PRINTF("DMA ROM:%08X RAM:%08X SIZE:%08X %s\n", vrom, ram, size, filename); + } } if (iter->romEnd == 0) { @@ -405,10 +398,10 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { DMA_ERROR(req, filename, "Segment Alignment Error", T("セグメント境界をまたがってDMA転送することはできません", "DMA transfers cannot cross segment boundaries"), - "../z_std_dma.c", LN3(575, 578, 726)); + "../z_std_dma.c", LN3(575, 578, 595, 726)); } - DmaMgr_DmaRomToRam(iter->romStart + (vrom - iter->file.vromStart), ram, size); + DmaMgr_DmaRomToRam(iter->romStart + vrom - iter->file.vromStart, ram, size); found = true; if (0) { @@ -417,16 +410,16 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { } else { // File is compressed. Files that are stored compressed must be loaded into RAM all at once. - romStart = iter->romStart; romSize = iter->romEnd - iter->romStart; + romStart = iter->romStart; - if (vrom != iter->file.vromStart) { + if (iter->file.vromStart != vrom) { // Error, requested vrom is not the start of a file DMA_ERROR(req, filename, "Can't Transfer Segment", T("圧縮されたセグメントの途中からはDMA転送することはできません", "DMA transfer cannot be performed from the middle of a compressed segment"), - "../z_std_dma.c", LN3(595, 598, 746)); + "../z_std_dma.c", LN3(595, 598, 615, 746)); } if (size != iter->file.vromEnd - iter->file.vromStart) { @@ -435,7 +428,7 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { DMA_ERROR(req, filename, "Can't Transfer Segment", T("圧縮されたセグメントの一部だけをDMA転送することはできません", "It is not possible to DMA only part of a compressed segment"), - "../z_std_dma.c", LN3(601, 604, 752)); + "../z_std_dma.c", LN3(601, 604, 621, 752)); } // Reduce the thread priority and decompress the file, the decompression routine handles the DMA @@ -458,7 +451,7 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { break; } -#if PLATFORM_N64 +#if !PLATFORM_GC if (i != 0) { i += 4; } @@ -475,11 +468,12 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { DMA_ERROR(req, NULL, "DATA DON'T EXIST", T("該当するデータが存在しません", "Corresponding data does not exist"), "../z_std_dma.c", - LN3(621, 624, 771)); + LN3(621, 624, 641, 771)); return; } else { // ROM is uncompressed, allow arbitrary DMA even if the region is not marked in the filesystem - DmaMgr_DmaRomToRam(vrom, ram, size); + romStart = vrom; + DmaMgr_DmaRomToRam(romStart, ram, size); if (0) { PRINTF(T("No Press ROM:%08X RAM:%08X SIZE:%08X (非公式)\n", @@ -540,6 +534,10 @@ s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, OSMesg msg) { static s32 sDmaMgrQueueFullLogged = 0; +#if PLATFORM_IQUE + PRINTF("dmacopy_bg(%x, %x, %x, %x, %x, %x, %x)\n", req, ram, vrom, size, unk, queue, msg); +#endif + #if DEBUG_FEATURES if ((ram == NULL) || (osMemSize < OS_K0_TO_PHYSICAL(ram) + size) || (vrom & 1) || (vrom > 0x4000000) || (size == 0) || (size & 1)) { @@ -614,9 +612,10 @@ void DmaMgr_Init(void) { // DMA the dma data table to RAM DmaMgr_DmaRomToRam((uintptr_t)_dmadataSegmentRomStart, _dmadataSegmentStart, (u32)(_dmadataSegmentRomEnd - _dmadataSegmentRomStart)); - PRINTF("dma_rom_ad[]\n"); #if DEBUG_FEATURES + PRINTF("dma_rom_ad[]\n"); + name = sDmaMgrFileNames; iter = gDmaDataTable; idx = 0; @@ -647,7 +646,7 @@ void DmaMgr_Init(void) { PRINTF("_bootSegmentRomStart(%08x) != dma_rom_ad[0].rom_b(%08x)\n", _bootSegmentRomStart, gDmaDataTable[0].file.vromEnd); //! @bug The main code file where fault.c resides is not yet loaded - Fault_AddHungupAndCrash("../z_std_dma.c", LN3(837, 840, 1055)); + Fault_AddHungupAndCrash("../z_std_dma.c", LN3(837, 840, 859, 1055)); } // Start the DMA manager |
