mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-14 11:00:41 +00:00
[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
This commit is contained in:
parent
26f91bd3bb
commit
e4ad4e5eee
13 changed files with 83 additions and 70 deletions
|
@ -53,11 +53,20 @@ const char* sDmaMgrFileNames[] = {
|
|||
#include "tables/dmadata_table.h"
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#undef DEFINE_DMA_ENTRY
|
||||
|
||||
#if PLATFORM_N64 || DEBUG_FEATURES
|
||||
#endif
|
||||
|
||||
#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_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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue