mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-27 23:36:22 +00:00
Minor cleanups in z_std_dma.c and yaz0.c (#1269)
* Cleanup dma and yaz0 functions using pointers for ram Also includes a minor cleanup of yaz0 names to better fit their purpose * Run formatter * Additional cleanups on dma and yaz0 functions
This commit is contained in:
parent
73ba138f54
commit
a33965c1d0
11 changed files with 100 additions and 101 deletions
|
@ -22,23 +22,23 @@ void Idle_ThreadEntry(void* arg);
|
||||||
void ViConfig_UpdateVi(u32 black);
|
void ViConfig_UpdateVi(u32 black);
|
||||||
void ViConfig_UpdateBlack(void);
|
void ViConfig_UpdateBlack(void);
|
||||||
s32 DmaMgr_CompareName(const char* name1, const char* name2);
|
s32 DmaMgr_CompareName(const char* name1, const char* name2);
|
||||||
s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size);
|
s32 DmaMgr_DmaRomToRam(u32 rom, void* ram, u32 size);
|
||||||
s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction);
|
s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction);
|
||||||
void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, const char* errorDesc);
|
void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, const char* errorDesc);
|
||||||
const char* DmaMgr_GetFileNameImpl(u32 vrom);
|
const char* DmaMgr_GetFileNameImpl(u32 vrom);
|
||||||
const char* DmaMgr_GetFileName(u32 vrom);
|
const char* DmaMgr_GetFileName(u32 vrom);
|
||||||
void DmaMgr_ProcessMsg(DmaRequest* req);
|
void DmaMgr_ProcessMsg(DmaRequest* req);
|
||||||
void DmaMgr_ThreadEntry(void* arg);
|
void DmaMgr_ThreadEntry(void* arg);
|
||||||
s32 DmaMgr_SendRequestImpl(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk, OSMesgQueue* queue, OSMesg msg);
|
s32 DmaMgr_SendRequestImpl(DmaRequest* req, void* ram, u32 vrom, u32 size, u32 unk, OSMesgQueue* queue, OSMesg msg);
|
||||||
s32 DmaMgr_SendRequest0(u32 ram, u32 vrom, u32 size);
|
s32 DmaMgr_SendRequest0(void* ram, u32 vrom, u32 size);
|
||||||
void DmaMgr_Init(void);
|
void DmaMgr_Init(void);
|
||||||
s32 DmaMgr_SendRequest2(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk5, OSMesgQueue* queue, OSMesg msg,
|
s32 DmaMgr_SendRequest2(DmaRequest* req, void* ram, u32 vrom, u32 size, u32 unk5, OSMesgQueue* queue, OSMesg msg,
|
||||||
const char* file, s32 line);
|
const char* file, s32 line);
|
||||||
s32 DmaMgr_SendRequest1(void* ram0, u32 vrom, u32 size, const char* file, s32 line);
|
s32 DmaMgr_SendRequest1(void* ram, u32 vrom, u32 size, const char* file, s32 line);
|
||||||
void* Yaz0_FirstDMA(void);
|
void* Yaz0_FirstDMA(void);
|
||||||
void* Yaz0_NextDMA(void* curSrcPos);
|
void* Yaz0_NextDMA(u8* curSrcPos);
|
||||||
void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst);
|
void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst);
|
||||||
void Yaz0_Decompress(u32 romStart, void* dst, u32 size);
|
void Yaz0_Decompress(u32 romStart, u8* dst, u32 size);
|
||||||
void Locale_Init(void);
|
void Locale_Init(void);
|
||||||
void Locale_ResetRegion(void);
|
void Locale_ResetRegion(void);
|
||||||
u32 func_80001F48(void);
|
u32 func_80001F48(void);
|
||||||
|
|
|
@ -539,7 +539,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x0000 */ View view;
|
/* 0x0000 */ View view;
|
||||||
/* 0x0128 */ Font font;
|
/* 0x0128 */ Font font;
|
||||||
/* 0xE2B0 */ void* textboxSegment; // original name: "fukidashiSegment"
|
/* 0xE2B0 */ u8* textboxSegment; // original name: "fukidashiSegment"
|
||||||
/* 0xE2B4 */ char unk_E2B4[0x4];
|
/* 0xE2B4 */ char unk_E2B4[0x4];
|
||||||
/* 0xE2B8 */ OcarinaStaff* ocarinaStaff; // original name : "info"
|
/* 0xE2B8 */ OcarinaStaff* ocarinaStaff; // original name : "info"
|
||||||
/* 0xE2BC */ char unk_E2BC[0x3C];
|
/* 0xE2BC */ char unk_E2BC[0x3C];
|
||||||
|
@ -1531,7 +1531,7 @@ typedef struct {
|
||||||
/* 0x04 */ u32 decSize;
|
/* 0x04 */ u32 decSize;
|
||||||
/* 0x08 */ u32 compInfoOffset; // only used in mio0
|
/* 0x08 */ u32 compInfoOffset; // only used in mio0
|
||||||
/* 0x0C */ u32 uncompDataOffset; // only used in mio0
|
/* 0x0C */ u32 uncompDataOffset; // only used in mio0
|
||||||
/* 0x10 */ u32 data[1];
|
/* 0x10 */ u8 data[1];
|
||||||
} Yaz0Header; // size = 0x10 ("data" is not part of the header)
|
} Yaz0Header; // size = 0x10 ("data" is not part of the header)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
u8 sYaz0DataBuffer[0x400];
|
u8 sYaz0DataBuffer[0x400];
|
||||||
u32 sYaz0CurDataEnd;
|
u8* sYaz0DataBufferEnd;
|
||||||
u32 sYaz0CurRomStart;
|
u32 sYaz0CurRomStart;
|
||||||
u32 sYaz0CurSize;
|
u32 sYaz0CurSize;
|
||||||
u32 sYaz0MaxPtr;
|
u8* sYaz0MaxPtr;
|
||||||
|
|
||||||
void* Yaz0_FirstDMA(void) {
|
void* Yaz0_FirstDMA(void) {
|
||||||
u32 pad0;
|
s32 pad[2];
|
||||||
u32 pad1;
|
|
||||||
u32 dmaSize;
|
u32 dmaSize;
|
||||||
u32 curSize;
|
u32 bufferSize;
|
||||||
|
|
||||||
sYaz0MaxPtr = sYaz0CurDataEnd - 0x19;
|
sYaz0MaxPtr = sYaz0DataBufferEnd - 0x19;
|
||||||
|
|
||||||
curSize = sYaz0CurDataEnd - (u32)sYaz0DataBuffer;
|
bufferSize = sYaz0DataBufferEnd - sYaz0DataBuffer;
|
||||||
dmaSize = (curSize > sYaz0CurSize) ? sYaz0CurSize : curSize;
|
dmaSize = (bufferSize > sYaz0CurSize) ? sYaz0CurSize : bufferSize;
|
||||||
|
|
||||||
DmaMgr_DmaRomToRam(sYaz0CurRomStart, sYaz0DataBuffer, dmaSize);
|
DmaMgr_DmaRomToRam(sYaz0CurRomStart, sYaz0DataBuffer, dmaSize);
|
||||||
sYaz0CurRomStart += dmaSize;
|
sYaz0CurRomStart += dmaSize;
|
||||||
|
@ -23,26 +22,26 @@ void* Yaz0_FirstDMA(void) {
|
||||||
return sYaz0DataBuffer;
|
return sYaz0DataBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Yaz0_NextDMA(void* curSrcPos) {
|
void* Yaz0_NextDMA(u8* curSrcPos) {
|
||||||
u8* dst;
|
u8* dst;
|
||||||
u32 restSize;
|
u32 restSize;
|
||||||
u32 dmaSize;
|
u32 dmaSize;
|
||||||
|
|
||||||
restSize = sYaz0CurDataEnd - (u32)curSrcPos;
|
restSize = sYaz0DataBufferEnd - curSrcPos;
|
||||||
dst = (restSize & 7) ? (sYaz0DataBuffer - (restSize & 7)) + 8 : sYaz0DataBuffer;
|
dst = (restSize & 7) ? (sYaz0DataBuffer - (restSize & 7)) + 8 : sYaz0DataBuffer;
|
||||||
|
|
||||||
bcopy(curSrcPos, dst, restSize);
|
bcopy(curSrcPos, dst, restSize);
|
||||||
dmaSize = (sYaz0CurDataEnd - (u32)dst) - restSize;
|
dmaSize = (sYaz0DataBufferEnd - dst) - restSize;
|
||||||
if (sYaz0CurSize < dmaSize) {
|
if (sYaz0CurSize < dmaSize) {
|
||||||
dmaSize = sYaz0CurSize;
|
dmaSize = sYaz0CurSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dmaSize != 0) {
|
if (dmaSize != 0) {
|
||||||
DmaMgr_DmaRomToRam(sYaz0CurRomStart, (u32)dst + restSize, dmaSize);
|
DmaMgr_DmaRomToRam(sYaz0CurRomStart, dst + restSize, dmaSize);
|
||||||
sYaz0CurRomStart += dmaSize;
|
sYaz0CurRomStart += dmaSize;
|
||||||
sYaz0CurSize -= dmaSize;
|
sYaz0CurSize -= dmaSize;
|
||||||
if (!sYaz0CurSize) {
|
if (sYaz0CurSize == 0) {
|
||||||
sYaz0MaxPtr = (u32)dst + restSize + dmaSize;
|
sYaz0MaxPtr = dst + restSize + dmaSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +50,7 @@ void* Yaz0_NextDMA(void* curSrcPos) {
|
||||||
|
|
||||||
void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst) {
|
void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst) {
|
||||||
u32 bitIdx = 0;
|
u32 bitIdx = 0;
|
||||||
u8* src = (u8*)hdr->data;
|
u8* src = hdr->data;
|
||||||
u8* dstEnd = dst + hdr->decSize;
|
u8* dstEnd = dst + hdr->decSize;
|
||||||
u32 chunkHeader;
|
u32 chunkHeader;
|
||||||
u32 nibble;
|
u32 nibble;
|
||||||
|
@ -61,7 +60,7 @@ void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst) {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (bitIdx == 0) {
|
if (bitIdx == 0) {
|
||||||
if ((sYaz0MaxPtr < (u32)src) && (sYaz0CurSize != 0)) {
|
if ((sYaz0MaxPtr < src) && (sYaz0CurSize != 0)) {
|
||||||
src = Yaz0_NextDMA(src);
|
src = Yaz0_NextDMA(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,9 +92,9 @@ void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst) {
|
||||||
} while (dst != dstEnd);
|
} while (dst != dstEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Yaz0_Decompress(u32 romStart, void* dst, u32 size) {
|
void Yaz0_Decompress(u32 romStart, u8* dst, u32 size) {
|
||||||
sYaz0CurRomStart = romStart;
|
sYaz0CurRomStart = romStart;
|
||||||
sYaz0CurSize = size;
|
sYaz0CurSize = size;
|
||||||
sYaz0CurDataEnd = sYaz0DataBuffer + sizeof(sYaz0DataBuffer);
|
sYaz0DataBufferEnd = sYaz0DataBuffer + sizeof(sYaz0DataBuffer);
|
||||||
Yaz0_DecompressImpl(Yaz0_FirstDMA(), dst);
|
Yaz0_DecompressImpl(Yaz0_FirstDMA(), dst);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ const char* sDmaMgrFileNames[] = {
|
||||||
#undef DEFINE_DMA_ENTRY
|
#undef DEFINE_DMA_ENTRY
|
||||||
|
|
||||||
s32 DmaMgr_CompareName(const char* name1, const char* name2) {
|
s32 DmaMgr_CompareName(const char* name1, const char* name2) {
|
||||||
while (*name1 != 0u) {
|
while (*name1 != '\0') {
|
||||||
if (*name1 > *name2) {
|
if (*name1 > *name2) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -36,14 +36,14 @@ s32 DmaMgr_CompareName(const char* name1, const char* name2) {
|
||||||
name2++;
|
name2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*name2 > 0) {
|
if (*name2 > '\0') {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size) {
|
s32 DmaMgr_DmaRomToRam(u32 rom, void* ram, u32 size) {
|
||||||
OSIoMesg ioMsg;
|
OSIoMesg ioMsg;
|
||||||
OSMesgQueue queue;
|
OSMesgQueue queue;
|
||||||
OSMesg msg;
|
OSMesg msg;
|
||||||
|
@ -55,8 +55,8 @@ s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size) {
|
||||||
buffSize = 0x2000;
|
buffSize = 0x2000;
|
||||||
}
|
}
|
||||||
|
|
||||||
osInvalICache((void*)ram, size);
|
osInvalICache(ram, size);
|
||||||
osInvalDCache((void*)ram, size);
|
osInvalDCache(ram, size);
|
||||||
osCreateMesgQueue(&queue, &msg, 1);
|
osCreateMesgQueue(&queue, &msg, 1);
|
||||||
|
|
||||||
while (size > buffSize) {
|
while (size > buffSize) {
|
||||||
|
@ -65,7 +65,7 @@ s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size) {
|
||||||
ioMsg.hdr.pri = OS_MESG_PRI_NORMAL;
|
ioMsg.hdr.pri = OS_MESG_PRI_NORMAL;
|
||||||
ioMsg.hdr.retQueue = &queue;
|
ioMsg.hdr.retQueue = &queue;
|
||||||
ioMsg.devAddr = rom;
|
ioMsg.devAddr = rom;
|
||||||
ioMsg.dramAddr = (void*)ram;
|
ioMsg.dramAddr = ram;
|
||||||
ioMsg.size = buffSize;
|
ioMsg.size = buffSize;
|
||||||
|
|
||||||
if (gDmaMgrVerbose == 10) {
|
if (gDmaMgrVerbose == 10) {
|
||||||
|
@ -74,7 +74,7 @@ s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = osEPiStartDma(gCartHandle, &ioMsg, OS_READ);
|
ret = osEPiStartDma(gCartHandle, &ioMsg, OS_READ);
|
||||||
if (ret) {
|
if (ret != 0) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +90,8 @@ s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
size -= buffSize;
|
size -= buffSize;
|
||||||
rom += buffSize;
|
rom = rom + buffSize;
|
||||||
ram += buffSize;
|
ram = (u8*)ram + buffSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1) {} // Also necessary to match
|
if (1) {} // Also necessary to match
|
||||||
|
@ -99,7 +99,7 @@ s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size) {
|
||||||
ioMsg.hdr.pri = OS_MESG_PRI_NORMAL;
|
ioMsg.hdr.pri = OS_MESG_PRI_NORMAL;
|
||||||
ioMsg.hdr.retQueue = &queue;
|
ioMsg.hdr.retQueue = &queue;
|
||||||
ioMsg.devAddr = rom;
|
ioMsg.devAddr = rom;
|
||||||
ioMsg.dramAddr = (void*)ram;
|
ioMsg.dramAddr = ram;
|
||||||
ioMsg.size = size;
|
ioMsg.size = size;
|
||||||
|
|
||||||
if (gDmaMgrVerbose == 10) {
|
if (gDmaMgrVerbose == 10) {
|
||||||
|
@ -108,7 +108,7 @@ s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = osEPiStartDma(gCartHandle, &ioMsg, OS_READ);
|
ret = osEPiStartDma(gCartHandle, &ioMsg, OS_READ);
|
||||||
if (ret) {
|
if (ret != 0) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,8 +118,8 @@ s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
osInvalICache((void*)ram, size);
|
osInvalICache(ram, size);
|
||||||
osInvalDCache((void*)ram, size);
|
osInvalDCache(ram, size);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -137,26 +137,26 @@ s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = osEPiStartDma(pihandle, mb, direction);
|
ret = osEPiStartDma(pihandle, mb, direction);
|
||||||
if (ret) {
|
if (ret != 0) {
|
||||||
osSyncPrintf("OOPS!!\n");
|
osSyncPrintf("OOPS!!\n");
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DmaMgr_DmaFromDriveRom(u32 ram, u32 rom, u32 size) {
|
void DmaMgr_DmaFromDriveRom(void* ram, u32 rom, u32 size) {
|
||||||
OSPiHandle* handle = osDriveRomInit();
|
OSPiHandle* handle = osDriveRomInit();
|
||||||
OSMesgQueue queue;
|
OSMesgQueue queue;
|
||||||
OSMesg msg;
|
OSMesg msg;
|
||||||
OSIoMesg ioMsg;
|
OSIoMesg ioMsg;
|
||||||
|
|
||||||
osInvalICache((void*)ram, size);
|
osInvalICache(ram, size);
|
||||||
osInvalDCache((void*)ram, size);
|
osInvalDCache(ram, size);
|
||||||
osCreateMesgQueue(&queue, &msg, 1);
|
osCreateMesgQueue(&queue, &msg, 1);
|
||||||
|
|
||||||
ioMsg.hdr.retQueue = &queue;
|
ioMsg.hdr.retQueue = &queue;
|
||||||
ioMsg.hdr.pri = OS_MESG_PRI_NORMAL;
|
ioMsg.hdr.pri = OS_MESG_PRI_NORMAL;
|
||||||
ioMsg.devAddr = rom;
|
ioMsg.devAddr = rom;
|
||||||
ioMsg.dramAddr = (void*)ram;
|
ioMsg.dramAddr = ram;
|
||||||
ioMsg.size = size;
|
ioMsg.size = size;
|
||||||
handle->transferInfo.cmdType = 2;
|
handle->transferInfo.cmdType = 2;
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ void DmaMgr_DmaFromDriveRom(u32 ram, u32 rom, u32 size) {
|
||||||
|
|
||||||
void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, const char* errorDesc) {
|
void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, const char* errorDesc) {
|
||||||
u32 vrom = req->vromAddr;
|
u32 vrom = req->vromAddr;
|
||||||
u32 ram = (u32)req->dramAddr;
|
void* ram = req->dramAddr;
|
||||||
u32 size = req->size;
|
u32 size = req->size;
|
||||||
char buff1[80];
|
char buff1[80];
|
||||||
char buff2[80];
|
char buff2[80];
|
||||||
|
@ -177,17 +177,17 @@ void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, cons
|
||||||
errorDesc != NULL ? errorDesc : (errorName != NULL ? errorName : "???"), vrom, ram, size,
|
errorDesc != NULL ? errorDesc : (errorName != NULL ? errorName : "???"), vrom, ram, size,
|
||||||
file != NULL ? file : "???");
|
file != NULL ? file : "???");
|
||||||
|
|
||||||
if (req->filename) {
|
if (req->filename != NULL) {
|
||||||
osSyncPrintf("DMA ERROR: %s %d", req->filename, req->line);
|
osSyncPrintf("DMA ERROR: %s %d", req->filename, req->line);
|
||||||
} else if (sDmaMgrCurFileName) {
|
} else if (sDmaMgrCurFileName != NULL) {
|
||||||
osSyncPrintf("DMA ERROR: %s %d", sDmaMgrCurFileName, sDmaMgrCurFileLine);
|
osSyncPrintf("DMA ERROR: %s %d", sDmaMgrCurFileName, sDmaMgrCurFileLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
osSyncPrintf(VT_RST);
|
osSyncPrintf(VT_RST);
|
||||||
|
|
||||||
if (req->filename) {
|
if (req->filename != NULL) {
|
||||||
sprintf(buff1, "DMA ERROR: %s %d", req->filename, req->line);
|
sprintf(buff1, "DMA ERROR: %s %d", req->filename, req->line);
|
||||||
} else if (sDmaMgrCurFileName) {
|
} else if (sDmaMgrCurFileName != NULL) {
|
||||||
sprintf(buff1, "DMA ERROR: %s %d", sDmaMgrCurFileName, sDmaMgrCurFileLine);
|
sprintf(buff1, "DMA ERROR: %s %d", sDmaMgrCurFileName, sDmaMgrCurFileLine);
|
||||||
} else {
|
} else {
|
||||||
sprintf(buff1, "DMA ERROR: %s", errorName != NULL ? errorName : "???");
|
sprintf(buff1, "DMA ERROR: %s", errorName != NULL ? errorName : "???");
|
||||||
|
@ -201,7 +201,7 @@ const char* DmaMgr_GetFileNameImpl(u32 vrom) {
|
||||||
DmaEntry* iter = gDmaDataTable;
|
DmaEntry* iter = gDmaDataTable;
|
||||||
const char** name = sDmaMgrFileNames;
|
const char** name = sDmaMgrFileNames;
|
||||||
|
|
||||||
while (iter->vromEnd) {
|
while (iter->vromEnd != 0) {
|
||||||
if (vrom >= iter->vromStart && vrom < iter->vromEnd) {
|
if (vrom >= iter->vromStart && vrom < iter->vromEnd) {
|
||||||
return *name;
|
return *name;
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ void DmaMgr_ProcessMsg(DmaRequest* req) {
|
||||||
filename = DmaMgr_GetFileName(vrom);
|
filename = DmaMgr_GetFileName(vrom);
|
||||||
iter = gDmaDataTable;
|
iter = gDmaDataTable;
|
||||||
|
|
||||||
while (iter->vromEnd) {
|
while (iter->vromEnd != 0) {
|
||||||
if (vrom >= iter->vromStart && vrom < iter->vromEnd) {
|
if (vrom >= iter->vromStart && vrom < iter->vromEnd) {
|
||||||
if (1) {} // Necessary to match
|
if (1) {} // Necessary to match
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ void DmaMgr_ProcessMsg(DmaRequest* req) {
|
||||||
"セグメント境界をまたがってDMA転送することはできません");
|
"セグメント境界をまたがってDMA転送することはできません");
|
||||||
}
|
}
|
||||||
|
|
||||||
DmaMgr_DmaRomToRam(iter->romStart + (vrom - iter->vromStart), (u32)ram, size);
|
DmaMgr_DmaRomToRam(iter->romStart + (vrom - iter->vromStart), ram, size);
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
|
@ -301,7 +301,7 @@ void DmaMgr_ProcessMsg(DmaRequest* req) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DmaMgr_DmaRomToRam(vrom, (u32)ram, size);
|
DmaMgr_DmaRomToRam(vrom, ram, size);
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
osSyncPrintf("No Press ROM:%08X RAM:%08X SIZE:%08X (非公式)\n", vrom, ram, size);
|
osSyncPrintf("No Press ROM:%08X RAM:%08X SIZE:%08X (非公式)\n", vrom, ram, size);
|
||||||
|
@ -326,7 +326,7 @@ void DmaMgr_ThreadEntry(void* arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DmaMgr_ProcessMsg(req);
|
DmaMgr_ProcessMsg(req);
|
||||||
if (req->notifyQueue) {
|
if (req->notifyQueue != NULL) {
|
||||||
osSendMesg(req->notifyQueue, req->notifyMsg, OS_MESG_NOBLOCK);
|
osSendMesg(req->notifyQueue, req->notifyMsg, OS_MESG_NOBLOCK);
|
||||||
if (0) {
|
if (0) {
|
||||||
osSyncPrintf("osSendMesg: dmap=%08x, mq=%08x, m=%08x \n", req, req->notifyQueue, req->notifyMsg);
|
osSyncPrintf("osSendMesg: dmap=%08x, mq=%08x, m=%08x \n", req, req->notifyQueue, req->notifyMsg);
|
||||||
|
@ -336,17 +336,17 @@ void DmaMgr_ThreadEntry(void* arg) {
|
||||||
osSyncPrintf("DMAマネージャスレッド実行終了\n");
|
osSyncPrintf("DMAマネージャスレッド実行終了\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 DmaMgr_SendRequestImpl(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk, OSMesgQueue* queue, OSMesg msg) {
|
s32 DmaMgr_SendRequestImpl(DmaRequest* req, void* ram, u32 vrom, u32 size, u32 unk, OSMesgQueue* queue, OSMesg msg) {
|
||||||
static s32 sDmaMgrQueueFullLogged = 0;
|
static s32 sDmaMgrQueueFullLogged = 0;
|
||||||
|
|
||||||
if ((1 && (ram == 0)) || (osMemSize < ram + size + 0x80000000) || (vrom & 1) || (vrom > 0x4000000) || (size == 0) ||
|
if ((1 && (ram == NULL)) || (osMemSize < OS_K0_TO_PHYSICAL(ram) + size) || (vrom & 1) || (vrom > 0x4000000) ||
|
||||||
(size & 1)) {
|
(size == 0) || (size & 1)) {
|
||||||
//! @bug `req` is passed to `DmaMgr_Error` without rom, ram and size being set
|
//! @bug `req` is passed to `DmaMgr_Error` without rom, ram and size being set
|
||||||
DmaMgr_Error(req, NULL, "ILLIGAL DMA-FUNCTION CALL", "パラメータ異常です");
|
DmaMgr_Error(req, NULL, "ILLIGAL DMA-FUNCTION CALL", "パラメータ異常です");
|
||||||
}
|
}
|
||||||
|
|
||||||
req->vromAddr = vrom;
|
req->vromAddr = vrom;
|
||||||
req->dramAddr = (void*)ram;
|
req->dramAddr = ram;
|
||||||
req->size = size;
|
req->size = size;
|
||||||
req->unk_14 = 0;
|
req->unk_14 = 0;
|
||||||
req->notifyQueue = queue;
|
req->notifyQueue = queue;
|
||||||
|
@ -366,7 +366,7 @@ s32 DmaMgr_SendRequestImpl(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 DmaMgr_SendRequest0(u32 ram, u32 vrom, u32 size) {
|
s32 DmaMgr_SendRequest0(void* ram, u32 vrom, u32 size) {
|
||||||
DmaRequest req;
|
DmaRequest req;
|
||||||
OSMesgQueue queue;
|
OSMesgQueue queue;
|
||||||
OSMesg msg;
|
OSMesg msg;
|
||||||
|
@ -387,7 +387,7 @@ void DmaMgr_Init(void) {
|
||||||
s32 idx;
|
s32 idx;
|
||||||
DmaEntry* iter;
|
DmaEntry* iter;
|
||||||
|
|
||||||
DmaMgr_DmaRomToRam((u32)_dmadataSegmentRomStart, (u32)_dmadataSegmentStart,
|
DmaMgr_DmaRomToRam((u32)_dmadataSegmentRomStart, _dmadataSegmentStart,
|
||||||
(u32)(_dmadataSegmentRomEnd - _dmadataSegmentRomStart));
|
(u32)(_dmadataSegmentRomEnd - _dmadataSegmentRomStart));
|
||||||
osSyncPrintf("dma_rom_ad[]\n");
|
osSyncPrintf("dma_rom_ad[]\n");
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ void DmaMgr_Init(void) {
|
||||||
idx++;
|
idx++;
|
||||||
iter++;
|
iter++;
|
||||||
|
|
||||||
if (name) {
|
if (name != NULL) {
|
||||||
name++;
|
name++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -427,19 +427,19 @@ void DmaMgr_Init(void) {
|
||||||
osStartThread(&sDmaMgrThread);
|
osStartThread(&sDmaMgrThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 DmaMgr_SendRequest2(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk5, OSMesgQueue* queue, OSMesg msg,
|
s32 DmaMgr_SendRequest2(DmaRequest* req, void* ram, u32 vrom, u32 size, u32 unk5, OSMesgQueue* queue, OSMesg msg,
|
||||||
const char* file, s32 line) {
|
const char* file, s32 line) {
|
||||||
req->filename = file;
|
req->filename = file;
|
||||||
req->line = line;
|
req->line = line;
|
||||||
return DmaMgr_SendRequestImpl(req, ram, vrom, size, unk5, queue, msg);
|
return DmaMgr_SendRequestImpl(req, ram, vrom, size, unk5, queue, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 DmaMgr_SendRequest1(void* ram0, u32 vrom, u32 size, const char* file, s32 line) {
|
s32 DmaMgr_SendRequest1(void* ram, u32 vrom, u32 size, const char* file, s32 line) {
|
||||||
DmaRequest req;
|
DmaRequest req;
|
||||||
s32 ret;
|
s32 ret;
|
||||||
OSMesgQueue queue;
|
OSMesgQueue queue;
|
||||||
OSMesg msg;
|
OSMesg msg;
|
||||||
u32 ram = (u32)ram0;
|
s32 pad;
|
||||||
|
|
||||||
req.filename = file;
|
req.filename = file;
|
||||||
req.line = line;
|
req.line = line;
|
||||||
|
|
|
@ -30,10 +30,10 @@ void Font_LoadMessageBoxIcon(Font* font, u16 icon) {
|
||||||
* the font buffer.
|
* the font buffer.
|
||||||
*/
|
*/
|
||||||
void Font_LoadOrderedFont(Font* font) {
|
void Font_LoadOrderedFont(Font* font) {
|
||||||
|
u8* fontBuf;
|
||||||
|
s32 fontStatic;
|
||||||
s32 len;
|
s32 len;
|
||||||
s32 jj;
|
s32 jj;
|
||||||
s32 fontStatic;
|
|
||||||
u32 fontBuf;
|
|
||||||
s32 codePointIndex;
|
s32 codePointIndex;
|
||||||
s32 fontBufIndex;
|
s32 fontBufIndex;
|
||||||
s32 offset;
|
s32 offset;
|
||||||
|
|
|
@ -708,7 +708,7 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon
|
||||||
size = gNormalSkyFiles[newSkybox1Index].file.vromEnd - gNormalSkyFiles[newSkybox1Index].file.vromStart;
|
size = gNormalSkyFiles[newSkybox1Index].file.vromEnd - gNormalSkyFiles[newSkybox1Index].file.vromStart;
|
||||||
|
|
||||||
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
||||||
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u32)skyboxCtx->staticSegments[0],
|
DmaMgr_SendRequest2(&envCtx->dmaRequest, skyboxCtx->staticSegments[0],
|
||||||
gNormalSkyFiles[newSkybox1Index].file.vromStart, size, 0, &envCtx->loadQueue, NULL,
|
gNormalSkyFiles[newSkybox1Index].file.vromStart, size, 0, &envCtx->loadQueue, NULL,
|
||||||
"../z_kankyo.c", 1264);
|
"../z_kankyo.c", 1264);
|
||||||
envCtx->skybox1Index = newSkybox1Index;
|
envCtx->skybox1Index = newSkybox1Index;
|
||||||
|
@ -719,7 +719,7 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon
|
||||||
size = gNormalSkyFiles[newSkybox2Index].file.vromEnd - gNormalSkyFiles[newSkybox2Index].file.vromStart;
|
size = gNormalSkyFiles[newSkybox2Index].file.vromEnd - gNormalSkyFiles[newSkybox2Index].file.vromStart;
|
||||||
|
|
||||||
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
||||||
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u32)skyboxCtx->staticSegments[1],
|
DmaMgr_SendRequest2(&envCtx->dmaRequest, skyboxCtx->staticSegments[1],
|
||||||
gNormalSkyFiles[newSkybox2Index].file.vromStart, size, 0, &envCtx->loadQueue, NULL,
|
gNormalSkyFiles[newSkybox2Index].file.vromStart, size, 0, &envCtx->loadQueue, NULL,
|
||||||
"../z_kankyo.c", 1281);
|
"../z_kankyo.c", 1281);
|
||||||
envCtx->skybox2Index = newSkybox2Index;
|
envCtx->skybox2Index = newSkybox2Index;
|
||||||
|
@ -733,14 +733,14 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon
|
||||||
gNormalSkyFiles[newSkybox1Index].palette.vromStart;
|
gNormalSkyFiles[newSkybox1Index].palette.vromStart;
|
||||||
|
|
||||||
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
||||||
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u32)skyboxCtx->palettes,
|
DmaMgr_SendRequest2(&envCtx->dmaRequest, skyboxCtx->palettes,
|
||||||
gNormalSkyFiles[newSkybox1Index].palette.vromStart, size, 0, &envCtx->loadQueue,
|
gNormalSkyFiles[newSkybox1Index].palette.vromStart, size, 0, &envCtx->loadQueue,
|
||||||
NULL, "../z_kankyo.c", 1307);
|
NULL, "../z_kankyo.c", 1307);
|
||||||
} else {
|
} else {
|
||||||
size = gNormalSkyFiles[newSkybox1Index].palette.vromEnd -
|
size = gNormalSkyFiles[newSkybox1Index].palette.vromEnd -
|
||||||
gNormalSkyFiles[newSkybox1Index].palette.vromStart;
|
gNormalSkyFiles[newSkybox1Index].palette.vromStart;
|
||||||
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
||||||
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u32)skyboxCtx->palettes + size,
|
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u8*)skyboxCtx->palettes + size,
|
||||||
gNormalSkyFiles[newSkybox1Index].palette.vromStart, size, 0, &envCtx->loadQueue,
|
gNormalSkyFiles[newSkybox1Index].palette.vromStart, size, 0, &envCtx->loadQueue,
|
||||||
NULL, "../z_kankyo.c", 1320);
|
NULL, "../z_kankyo.c", 1320);
|
||||||
}
|
}
|
||||||
|
@ -754,14 +754,14 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon
|
||||||
gNormalSkyFiles[newSkybox2Index].palette.vromStart;
|
gNormalSkyFiles[newSkybox2Index].palette.vromStart;
|
||||||
|
|
||||||
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
||||||
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u32)skyboxCtx->palettes,
|
DmaMgr_SendRequest2(&envCtx->dmaRequest, skyboxCtx->palettes,
|
||||||
gNormalSkyFiles[newSkybox2Index].palette.vromStart, size, 0, &envCtx->loadQueue,
|
gNormalSkyFiles[newSkybox2Index].palette.vromStart, size, 0, &envCtx->loadQueue,
|
||||||
NULL, "../z_kankyo.c", 1342);
|
NULL, "../z_kankyo.c", 1342);
|
||||||
} else {
|
} else {
|
||||||
size = gNormalSkyFiles[newSkybox2Index].palette.vromEnd -
|
size = gNormalSkyFiles[newSkybox2Index].palette.vromEnd -
|
||||||
gNormalSkyFiles[newSkybox2Index].palette.vromStart;
|
gNormalSkyFiles[newSkybox2Index].palette.vromStart;
|
||||||
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
osCreateMesgQueue(&envCtx->loadQueue, &envCtx->loadMsg, 1);
|
||||||
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u32)skyboxCtx->palettes + size,
|
DmaMgr_SendRequest2(&envCtx->dmaRequest, (u8*)skyboxCtx->palettes + size,
|
||||||
gNormalSkyFiles[newSkybox2Index].palette.vromStart, size, 0, &envCtx->loadQueue,
|
gNormalSkyFiles[newSkybox2Index].palette.vromStart, size, 0, &envCtx->loadQueue,
|
||||||
NULL, "../z_kankyo.c", 1355);
|
NULL, "../z_kankyo.c", 1355);
|
||||||
}
|
}
|
||||||
|
|
|
@ -755,12 +755,12 @@ u16 Message_DrawItemIcon(PlayState* play, u16 itemId, Gfx** p, u16 i) {
|
||||||
gDPSetPrimColor(gfx++, 0, 0, 255, 255, 255, msgCtx->textColorAlpha);
|
gDPSetPrimColor(gfx++, 0, 0, 255, 255, 255, msgCtx->textColorAlpha);
|
||||||
|
|
||||||
if (itemId >= ITEM_MEDALLION_FOREST) {
|
if (itemId >= ITEM_MEDALLION_FOREST) {
|
||||||
gDPLoadTextureBlock(gfx++, (u32)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, G_IM_FMT_RGBA, G_IM_SIZ_32b,
|
gDPLoadTextureBlock(gfx++, msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, G_IM_FMT_RGBA, G_IM_SIZ_32b, 24,
|
||||||
24, 24, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
24, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
||||||
G_TX_NOLOD, G_TX_NOLOD);
|
G_TX_NOLOD, G_TX_NOLOD);
|
||||||
} else {
|
} else {
|
||||||
gDPLoadTextureBlock(gfx++, (u32)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, G_IM_FMT_RGBA, G_IM_SIZ_32b,
|
gDPLoadTextureBlock(gfx++, msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32,
|
||||||
32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
||||||
G_TX_NOLOD, G_TX_NOLOD);
|
G_TX_NOLOD, G_TX_NOLOD);
|
||||||
}
|
}
|
||||||
gSPTextureRectangle(gfx++, (msgCtx->textPosX + R_TEXTBOX_ICON_XPOS) << 2, R_TEXTBOX_ICON_YPOS << 2,
|
gSPTextureRectangle(gfx++, (msgCtx->textPosX + R_TEXTBOX_ICON_XPOS) << 2, R_TEXTBOX_ICON_YPOS << 2,
|
||||||
|
@ -1010,9 +1010,9 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
||||||
sTextboxBackgroundBackPrimColors[msgCtx->textboxBackgroundBackColorIdx][2],
|
sTextboxBackgroundBackPrimColors[msgCtx->textboxBackgroundBackColorIdx][2],
|
||||||
msgCtx->textColorAlpha);
|
msgCtx->textColorAlpha);
|
||||||
|
|
||||||
gDPLoadTextureBlock_4b(gfx++, (u32)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, G_IM_FMT_I, 96, 48,
|
gDPLoadTextureBlock_4b(gfx++, msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE, G_IM_FMT_I, 96, 48, 0,
|
||||||
0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
|
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
||||||
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
G_TX_NOLOD, G_TX_NOLOD);
|
||||||
gSPTextureRectangle(
|
gSPTextureRectangle(
|
||||||
gfx++, (msgCtx->textPosX + 1) << 2,
|
gfx++, (msgCtx->textPosX + 1) << 2,
|
||||||
(R_TEXTBOX_BG_YPOS + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx]) << 2,
|
(R_TEXTBOX_BG_YPOS + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx]) << 2,
|
||||||
|
@ -1020,8 +1020,8 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
||||||
(R_TEXTBOX_BG_YPOS + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx] + 48) << 2,
|
(R_TEXTBOX_BG_YPOS + sTextboxBackgroundYOffsets[msgCtx->textboxBackgroundYOffsetIdx] + 48) << 2,
|
||||||
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||||
|
|
||||||
gDPLoadTextureBlock_4b(gfx++, (u32)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE + 0x900, G_IM_FMT_I,
|
gDPLoadTextureBlock_4b(gfx++, msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE + 0x900, G_IM_FMT_I, 96,
|
||||||
96, 48, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
|
48, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
|
||||||
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||||
gSPTextureRectangle(
|
gSPTextureRectangle(
|
||||||
gfx++, (msgCtx->textPosX + 96 + 1) << 2,
|
gfx++, (msgCtx->textPosX + 96 + 1) << 2,
|
||||||
|
@ -1036,15 +1036,15 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
|
||||||
sTextboxBackgroundForePrimColors[msgCtx->textboxBackgroundForeColorIdx][2],
|
sTextboxBackgroundForePrimColors[msgCtx->textboxBackgroundForeColorIdx][2],
|
||||||
msgCtx->textColorAlpha);
|
msgCtx->textColorAlpha);
|
||||||
|
|
||||||
gDPLoadTextureBlock_4b(gfx++, ((u32)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE), G_IM_FMT_I, 96,
|
gDPLoadTextureBlock_4b(gfx++, (msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE), G_IM_FMT_I, 96, 48, 0,
|
||||||
48, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
|
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
|
||||||
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
G_TX_NOLOD, G_TX_NOLOD);
|
||||||
gSPTextureRectangle(gfx++, msgCtx->textPosX << 2, R_TEXTBOX_BG_YPOS << 2, (msgCtx->textPosX + 96) << 2,
|
gSPTextureRectangle(gfx++, msgCtx->textPosX << 2, R_TEXTBOX_BG_YPOS << 2, (msgCtx->textPosX + 96) << 2,
|
||||||
(R_TEXTBOX_BG_YPOS + 48) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
(R_TEXTBOX_BG_YPOS + 48) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||||
|
|
||||||
gDPLoadTextureBlock_4b(gfx++, ((u32)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE + 0x900),
|
gDPLoadTextureBlock_4b(gfx++, (msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE + 0x900), G_IM_FMT_I,
|
||||||
G_IM_FMT_I, 96, 48, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
|
96, 48, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
|
||||||
G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||||
gSPTextureRectangle(gfx++, (msgCtx->textPosX + 96) << 2, R_TEXTBOX_BG_YPOS << 2,
|
gSPTextureRectangle(gfx++, (msgCtx->textPosX + 96) << 2, R_TEXTBOX_BG_YPOS << 2,
|
||||||
(msgCtx->textPosX + 192) << 2, (R_TEXTBOX_BG_YPOS + 48) << 2, G_TX_RENDERTILE, 0, 0,
|
(msgCtx->textPosX + 192) << 2, (R_TEXTBOX_BG_YPOS + 48) << 2, G_TX_RENDERTILE, 0, 0,
|
||||||
1 << 10, 1 << 10);
|
1 << 10, 1 << 10);
|
||||||
|
@ -1167,7 +1167,7 @@ void Message_LoadItemIcon(PlayState* play, u16 itemId, s16 y) {
|
||||||
R_TEXTBOX_ICON_XPOS = R_TEXT_INIT_XPOS - sIconItem32XOffsets[gSaveContext.language];
|
R_TEXTBOX_ICON_XPOS = R_TEXT_INIT_XPOS - sIconItem32XOffsets[gSaveContext.language];
|
||||||
R_TEXTBOX_ICON_YPOS = y + 6;
|
R_TEXTBOX_ICON_YPOS = y + 6;
|
||||||
R_TEXTBOX_ICON_SIZE = 32;
|
R_TEXTBOX_ICON_SIZE = 32;
|
||||||
DmaMgr_SendRequest1((u32)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
|
DmaMgr_SendRequest1(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
|
||||||
(u32)_icon_item_staticSegmentRomStart + (itemId * 0x1000), 0x1000, "../z_message_PAL.c",
|
(u32)_icon_item_staticSegmentRomStart + (itemId * 0x1000), 0x1000, "../z_message_PAL.c",
|
||||||
1473);
|
1473);
|
||||||
// "Item 32-0"
|
// "Item 32-0"
|
||||||
|
@ -1176,7 +1176,7 @@ void Message_LoadItemIcon(PlayState* play, u16 itemId, s16 y) {
|
||||||
R_TEXTBOX_ICON_XPOS = R_TEXT_INIT_XPOS - sIconItem24XOffsets[gSaveContext.language];
|
R_TEXTBOX_ICON_XPOS = R_TEXT_INIT_XPOS - sIconItem24XOffsets[gSaveContext.language];
|
||||||
R_TEXTBOX_ICON_YPOS = y + 10;
|
R_TEXTBOX_ICON_YPOS = y + 10;
|
||||||
R_TEXTBOX_ICON_SIZE = 24;
|
R_TEXTBOX_ICON_SIZE = 24;
|
||||||
DmaMgr_SendRequest1((u32)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
|
DmaMgr_SendRequest1(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
|
||||||
(u32)_icon_item_24_staticSegmentRomStart + (itemId - ITEM_MEDALLION_FOREST) * 0x900, 0x900,
|
(u32)_icon_item_24_staticSegmentRomStart + (itemId - ITEM_MEDALLION_FOREST) * 0x900, 0x900,
|
||||||
"../z_message_PAL.c", 1482);
|
"../z_message_PAL.c", 1482);
|
||||||
// "Item 24"
|
// "Item 24"
|
||||||
|
@ -1535,10 +1535,10 @@ void Message_Decode(PlayState* play) {
|
||||||
msgCtx->textboxBackgroundBackColorIdx = font->msgBuf[msgCtx->msgBufPos + 2] & 0xF;
|
msgCtx->textboxBackgroundBackColorIdx = font->msgBuf[msgCtx->msgBufPos + 2] & 0xF;
|
||||||
msgCtx->textboxBackgroundYOffsetIdx = (font->msgBuf[msgCtx->msgBufPos + 3] & 0xF0) >> 4;
|
msgCtx->textboxBackgroundYOffsetIdx = (font->msgBuf[msgCtx->msgBufPos + 3] & 0xF0) >> 4;
|
||||||
msgCtx->textboxBackgroundUnkArg = font->msgBuf[msgCtx->msgBufPos + 3] & 0xF;
|
msgCtx->textboxBackgroundUnkArg = font->msgBuf[msgCtx->msgBufPos + 3] & 0xF;
|
||||||
DmaMgr_SendRequest1((u32)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
|
DmaMgr_SendRequest1(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE,
|
||||||
(u32)_message_texture_staticSegmentRomStart + msgCtx->textboxBackgroundIdx * 0x900,
|
(u32)_message_texture_staticSegmentRomStart + msgCtx->textboxBackgroundIdx * 0x900,
|
||||||
0x900, "../z_message_PAL.c", 1830);
|
0x900, "../z_message_PAL.c", 1830);
|
||||||
DmaMgr_SendRequest1((u32)msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE + 0x900,
|
DmaMgr_SendRequest1(msgCtx->textboxSegment + MESSAGE_STATIC_TEX_SIZE + 0x900,
|
||||||
(u32)_message_texture_staticSegmentRomStart +
|
(u32)_message_texture_staticSegmentRomStart +
|
||||||
(msgCtx->textboxBackgroundIdx + 1) * 0x900,
|
(msgCtx->textboxBackgroundIdx + 1) * 0x900,
|
||||||
0x900, "../z_message_PAL.c", 1834);
|
0x900, "../z_message_PAL.c", 1834);
|
||||||
|
|
|
@ -414,7 +414,7 @@ void Play_Init(GameState* thisx) {
|
||||||
if (dREG(95) != 0) {
|
if (dREG(95) != 0) {
|
||||||
D_8012D1F0 = D_801614D0;
|
D_8012D1F0 = D_801614D0;
|
||||||
osSyncPrintf("\nkawauso_data=[%x]", D_8012D1F0);
|
osSyncPrintf("\nkawauso_data=[%x]", D_8012D1F0);
|
||||||
DmaMgr_DmaRomToRam(0x03FEB000, (u32)D_8012D1F0, sizeof(D_801614D0));
|
DmaMgr_DmaRomToRam(0x03FEB000, D_8012D1F0, sizeof(D_801614D0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -838,10 +838,10 @@ void AnimationContext_SetLoadFrame(PlayState* play, LinkAnimationHeader* animati
|
||||||
|
|
||||||
if (entry != NULL) {
|
if (entry != NULL) {
|
||||||
LinkAnimationHeader* linkAnimHeader = SEGMENTED_TO_VIRTUAL(animation);
|
LinkAnimationHeader* linkAnimHeader = SEGMENTED_TO_VIRTUAL(animation);
|
||||||
u32 ram = frameTable;
|
s32 pad;
|
||||||
|
|
||||||
osCreateMesgQueue(&entry->data.load.msgQueue, &entry->data.load.msg, 1);
|
osCreateMesgQueue(&entry->data.load.msgQueue, &entry->data.load.msg, 1);
|
||||||
DmaMgr_SendRequest2(&entry->data.load.req, ram,
|
DmaMgr_SendRequest2(&entry->data.load.req, frameTable,
|
||||||
LINK_ANIMATION_OFFSET(linkAnimHeader->segment, ((sizeof(Vec3s) * limbCount + 2) * frame)),
|
LINK_ANIMATION_OFFSET(linkAnimHeader->segment, ((sizeof(Vec3s) * limbCount + 2) * frame)),
|
||||||
sizeof(Vec3s) * limbCount + 2, 0, &entry->data.load.msgQueue, NULL, "../z_skelanime.c",
|
sizeof(Vec3s) * limbCount + 2, 0, &entry->data.load.msgQueue, NULL, "../z_skelanime.c",
|
||||||
2004);
|
2004);
|
||||||
|
|
|
@ -430,7 +430,7 @@ void Skybox_Setup(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) {
|
||||||
|
|
||||||
DmaMgr_SendRequest1(skyboxCtx->palettes, gNormalSkyFiles[skybox1Index].palette.vromStart, size,
|
DmaMgr_SendRequest1(skyboxCtx->palettes, gNormalSkyFiles[skybox1Index].palette.vromStart, size,
|
||||||
"../z_vr_box.c", 1075);
|
"../z_vr_box.c", 1075);
|
||||||
DmaMgr_SendRequest1((u32)skyboxCtx->palettes + size, gNormalSkyFiles[skybox2Index].palette.vromStart,
|
DmaMgr_SendRequest1((u8*)skyboxCtx->palettes + size, gNormalSkyFiles[skybox2Index].palette.vromStart,
|
||||||
size, "../z_vr_box.c", 1077);
|
size, "../z_vr_box.c", 1077);
|
||||||
} else {
|
} else {
|
||||||
size = gNormalSkyFiles[skybox1Index].palette.vromEnd - gNormalSkyFiles[skybox1Index].palette.vromStart;
|
size = gNormalSkyFiles[skybox1Index].palette.vromEnd - gNormalSkyFiles[skybox1Index].palette.vromStart;
|
||||||
|
@ -441,7 +441,7 @@ void Skybox_Setup(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) {
|
||||||
|
|
||||||
DmaMgr_SendRequest1(skyboxCtx->palettes, gNormalSkyFiles[skybox2Index].palette.vromStart, size,
|
DmaMgr_SendRequest1(skyboxCtx->palettes, gNormalSkyFiles[skybox2Index].palette.vromStart, size,
|
||||||
"../z_vr_box.c", 1088);
|
"../z_vr_box.c", 1088);
|
||||||
DmaMgr_SendRequest1((u32)skyboxCtx->palettes + size, gNormalSkyFiles[skybox1Index].palette.vromStart,
|
DmaMgr_SendRequest1((u8*)skyboxCtx->palettes + size, gNormalSkyFiles[skybox1Index].palette.vromStart,
|
||||||
size, "../z_vr_box.c", 1090);
|
size, "../z_vr_box.c", 1090);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -486,7 +486,7 @@ void Skybox_Setup(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) {
|
||||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1171);
|
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1171);
|
||||||
|
|
||||||
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1173);
|
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1173);
|
||||||
DmaMgr_SendRequest1((u32)skyboxCtx->palettes + size, start, size, "../z_vr_box.c", 1175);
|
DmaMgr_SendRequest1((u8*)skyboxCtx->palettes + size, start, size, "../z_vr_box.c", 1175);
|
||||||
break;
|
break;
|
||||||
case SKYBOX_MARKET_ADULT:
|
case SKYBOX_MARKET_ADULT:
|
||||||
skyboxCtx->unk_140 = 1;
|
skyboxCtx->unk_140 = 1;
|
||||||
|
@ -531,7 +531,7 @@ void Skybox_Setup(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) {
|
||||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1212);
|
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1212);
|
||||||
|
|
||||||
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1214);
|
DmaMgr_SendRequest1(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1214);
|
||||||
DmaMgr_SendRequest1((u32)skyboxCtx->palettes + size, _vr_holy1_pal_staticSegmentRomStart, size,
|
DmaMgr_SendRequest1((u8*)skyboxCtx->palettes + size, _vr_holy1_pal_staticSegmentRomStart, size,
|
||||||
"../z_vr_box.c", 1216);
|
"../z_vr_box.c", 1216);
|
||||||
break;
|
break;
|
||||||
case SKYBOX_HOUSE_LINK:
|
case SKYBOX_HOUSE_LINK:
|
||||||
|
|
|
@ -4860,8 +4860,8 @@ void func_8083AE40(Player* this, s16 objectId) {
|
||||||
LOG_HEX("size", size, "../z_player.c", 9090);
|
LOG_HEX("size", size, "../z_player.c", 9090);
|
||||||
ASSERT(size <= 1024 * 8, "size <= 1024 * 8", "../z_player.c", 9091);
|
ASSERT(size <= 1024 * 8, "size <= 1024 * 8", "../z_player.c", 9091);
|
||||||
|
|
||||||
DmaMgr_SendRequest2(&this->giObjectDmaRequest, (u32)this->giObjectSegment, gObjectTable[objectId].vromStart,
|
DmaMgr_SendRequest2(&this->giObjectDmaRequest, this->giObjectSegment, gObjectTable[objectId].vromStart, size, 0,
|
||||||
size, 0, &this->giObjectLoadQueue, NULL, "../z_player.c", 9099);
|
&this->giObjectLoadQueue, NULL, "../z_player.c", 9099);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue