Rename a couple files and split them into their own
Rename `_ob_icy_coast.c` to `nusimgr.c` Add decompiled `nuPiInit` to `nupiinit.c` Add decompiled `nuPiReadRom` to `nupireadrom.c`
This commit is contained in:
parent
a5a10f03cd
commit
f03558ef48
|
|
@ -121,7 +121,9 @@ segments:
|
||||||
- [0x19EB0, c, "nu/nugfxsetcfb"]
|
- [0x19EB0, c, "nu/nugfxsetcfb"]
|
||||||
- [0x19FC0, c, "nu/nugfxdisplayoff"]
|
- [0x19FC0, c, "nu/nugfxdisplayoff"]
|
||||||
- [0x1A050, c, "nu/nugfxdisplayon"]
|
- [0x1A050, c, "nu/nugfxdisplayon"]
|
||||||
- [0x1A060, c, "_ob_icy_coast"]
|
- [0x1A060, c, "nu/nusimgr"]
|
||||||
|
- [0x1A340, c, "nu/nupiinit"]
|
||||||
|
- [0x1A380, c, "nu/nupireadrom"]
|
||||||
- [0x1A4F0, c, "rom_copy"]
|
- [0x1A4F0, c, "rom_copy"]
|
||||||
- [0x1A5B0, c, "nu/nugfxinit"]
|
- [0x1A5B0, c, "nu/nugfxinit"]
|
||||||
- [0x1A660, c, "_ob_prized_reading"]
|
- [0x1A660, c, "_ob_prized_reading"]
|
||||||
|
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
#include "common.h"
|
|
||||||
|
|
||||||
#include "nu/nusys.h"
|
|
||||||
#include "os_pi.h"
|
|
||||||
|
|
||||||
void nuSiMgrThread(void* arg);
|
|
||||||
|
|
||||||
/* 1A060 80089C60 */
|
|
||||||
u8 nuSiMgrInit(void) {
|
|
||||||
u8 pattern;
|
|
||||||
OSContStatus status[NU_CONT_MAXCONTROLLERS];
|
|
||||||
|
|
||||||
osCreateMesgQueue(&nuSiMesgQ, nuSiMesgBuf, NU_SC_MAX_MESGS);
|
|
||||||
osSetEventMesg(OS_EVENT_SI, &nuSiMesgQ, NULL);
|
|
||||||
|
|
||||||
osContInit(&nuSiMesgQ, &pattern, status);
|
|
||||||
|
|
||||||
osCreateThread(&siMgrThread, 5, nuSiMgrThread, NULL, &nuPiMgrMesgQ, NU_SI_THREAD_PRI);
|
|
||||||
osStartThread(&siMgrThread);
|
|
||||||
|
|
||||||
return pattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
s32 nuSiSendMesg(NUScMsg mesg, void* dataPtr) {
|
|
||||||
OSMesgQueue rtnMesgQ;
|
|
||||||
NUSiCommonMesg siCommonMesg;
|
|
||||||
OSMesg sp38; // maybe this is part of the struct?
|
|
||||||
|
|
||||||
siCommonMesg.mesg = mesg;
|
|
||||||
siCommonMesg.dataPtr = dataPtr;
|
|
||||||
siCommonMesg.rtnMesgQ = &rtnMesgQ;
|
|
||||||
|
|
||||||
osCreateMesgQueue(&rtnMesgQ, &sp38, 1);
|
|
||||||
osSendMesg(&MQ_800E7988, &siCommonMesg, OS_MESG_BLOCK);
|
|
||||||
osRecvMesg(&rtnMesgQ, NULL, OS_MESG_BLOCK);
|
|
||||||
|
|
||||||
return siCommonMesg.error;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nuSiMgrStop(void) {
|
|
||||||
nuSiSendMesg(NU_SI_STOP_MGR_MSG, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nuSiMgrRestart(void) {
|
|
||||||
osStartThread(&siMgrThread);
|
|
||||||
}
|
|
||||||
|
|
||||||
INCLUDE_ASM(const s32, "_ob_icy_coast", nuSiMgrThread);
|
|
||||||
|
|
||||||
void nuPiInit(void) {
|
|
||||||
osCreatePiManager(OS_PRIORITY_PIMGR, &nuPiMgrMesgQ, nuPiMesgBuf, NU_PI_MESG_NUM);
|
|
||||||
nuPiCartHandle = osCartRomInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 1A380 80089F80 */
|
|
||||||
void nuPiReadRom(void *src, void *dst, u32 size) {
|
|
||||||
OSIoMesg ioMesg;
|
|
||||||
OSMesg mesg;
|
|
||||||
OSMesgQueue queue;
|
|
||||||
u32 mesgSize;
|
|
||||||
|
|
||||||
osCreateMesgQueue(&queue, &mesg, 1);
|
|
||||||
|
|
||||||
ioMesg.hdr.pri = 0;
|
|
||||||
ioMesg.hdr.retQueue = &queue;
|
|
||||||
osInvalDCache(dst, size);
|
|
||||||
while (size != 0) {
|
|
||||||
mesgSize = size;
|
|
||||||
if (mesgSize > MAX_BYTES_TO_READ) {
|
|
||||||
mesgSize = MAX_BYTES_TO_READ;
|
|
||||||
}
|
|
||||||
|
|
||||||
ioMesg.devAddr = (u32)src;
|
|
||||||
ioMesg.dramAddr = dst;
|
|
||||||
ioMesg.size = mesgSize;
|
|
||||||
// Start the DMA transfer
|
|
||||||
osEPiStartDma(nuPiCartHandle, &ioMesg, OS_READ);
|
|
||||||
// Wait for the DMA transfer to complete
|
|
||||||
osRecvMesg(&queue, &mesg, OS_MESG_BLOCK);
|
|
||||||
|
|
||||||
src += mesgSize;
|
|
||||||
dst += mesgSize;
|
|
||||||
size -= mesgSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
INCLUDE_ASM(const s32, "_ob_icy_coast", func_8008A040);
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#include "nu/nusys.h"
|
||||||
|
|
||||||
|
void nuPiInit(void) {
|
||||||
|
osCreatePiManager(OS_PRIORITY_PIMGR, &nuPiMgrMesgQ, nuPiMesgBuf, NU_PI_MESG_NUM);
|
||||||
|
nuPiCartHandle = osCartRomInit();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#include "nu/nusys.h"
|
||||||
|
|
||||||
|
/* 1A380 80089F80 */
|
||||||
|
void nuPiReadRom(void *src, void *dst, u32 size) {
|
||||||
|
OSIoMesg ioMesg;
|
||||||
|
OSMesg mesg;
|
||||||
|
OSMesgQueue queue;
|
||||||
|
u32 mesgSize;
|
||||||
|
|
||||||
|
osCreateMesgQueue(&queue, &mesg, 1);
|
||||||
|
|
||||||
|
ioMesg.hdr.pri = 0;
|
||||||
|
ioMesg.hdr.retQueue = &queue;
|
||||||
|
osInvalDCache(dst, size);
|
||||||
|
while (size != 0) {
|
||||||
|
mesgSize = size;
|
||||||
|
if (mesgSize > MAX_BYTES_TO_READ) {
|
||||||
|
mesgSize = MAX_BYTES_TO_READ;
|
||||||
|
}
|
||||||
|
|
||||||
|
ioMesg.devAddr = (u32)src;
|
||||||
|
ioMesg.dramAddr = dst;
|
||||||
|
ioMesg.size = mesgSize;
|
||||||
|
// Start the DMA transfer
|
||||||
|
osEPiStartDma(nuPiCartHandle, &ioMesg, OS_READ);
|
||||||
|
// Wait for the DMA transfer to complete
|
||||||
|
osRecvMesg(&queue, &mesg, OS_MESG_BLOCK);
|
||||||
|
|
||||||
|
src += mesgSize;
|
||||||
|
dst += mesgSize;
|
||||||
|
size -= mesgSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
INCLUDE_ASM(const s32, "nu/nupireadrom", func_8008A040);
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#include "nu/nusys.h"
|
||||||
|
#include "os_pi.h"
|
||||||
|
|
||||||
|
void nuSiMgrThread(void* arg);
|
||||||
|
|
||||||
|
/* 1A060 80089C60 */
|
||||||
|
u8 nuSiMgrInit(void) {
|
||||||
|
u8 pattern;
|
||||||
|
OSContStatus status[NU_CONT_MAXCONTROLLERS];
|
||||||
|
|
||||||
|
osCreateMesgQueue(&nuSiMesgQ, nuSiMesgBuf, NU_SC_MAX_MESGS);
|
||||||
|
osSetEventMesg(OS_EVENT_SI, &nuSiMesgQ, NULL);
|
||||||
|
|
||||||
|
osContInit(&nuSiMesgQ, &pattern, status);
|
||||||
|
|
||||||
|
osCreateThread(&siMgrThread, 5, nuSiMgrThread, NULL, &nuPiMgrMesgQ, NU_SI_THREAD_PRI);
|
||||||
|
osStartThread(&siMgrThread);
|
||||||
|
|
||||||
|
return pattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 nuSiSendMesg(NUScMsg mesg, void* dataPtr) {
|
||||||
|
OSMesgQueue rtnMesgQ;
|
||||||
|
NUSiCommonMesg siCommonMesg;
|
||||||
|
OSMesg sp38;
|
||||||
|
|
||||||
|
siCommonMesg.mesg = mesg;
|
||||||
|
siCommonMesg.dataPtr = dataPtr;
|
||||||
|
siCommonMesg.rtnMesgQ = &rtnMesgQ;
|
||||||
|
|
||||||
|
osCreateMesgQueue(&rtnMesgQ, &sp38, 1);
|
||||||
|
osSendMesg(&MQ_800E7988, &siCommonMesg, OS_MESG_BLOCK);
|
||||||
|
osRecvMesg(&rtnMesgQ, NULL, OS_MESG_BLOCK);
|
||||||
|
|
||||||
|
return siCommonMesg.error;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nuSiMgrStop(void) {
|
||||||
|
nuSiSendMesg(NU_SI_STOP_MGR_MSG, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nuSiMgrRestart(void) {
|
||||||
|
osStartThread(&siMgrThread);
|
||||||
|
}
|
||||||
|
|
||||||
|
INCLUDE_ASM(const s32, "nu/nusimgr", nuSiMgrThread);
|
||||||
Loading…
Reference in New Issue