Compare commits
17 Commits
b136e35f4a
...
f03558ef48
| Author | SHA1 | Date |
|---|---|---|
|
|
f03558ef48 | |
|
|
a5a10f03cd | |
|
|
6499c2fe8f | |
|
|
92fd0c2213 | |
|
|
1fa7c6930f | |
|
|
6290ea1045 | |
|
|
5ce4b39095 | |
|
|
84c9518b4c | |
|
|
118c79854c | |
|
|
c1974f2e83 | |
|
|
7bd8d54843 | |
|
|
d1d3e1eb1c | |
|
|
2a951738a0 | |
|
|
bc821ded12 | |
|
|
9fcec8adfd | |
|
|
7ff45c1495 | |
|
|
eb3f05151b |
|
|
@ -137,12 +137,8 @@ extern OSPiHandle* CART_HANDLE;
|
||||||
extern OSMesgQueue MQ_800E7988;
|
extern OSMesgQueue MQ_800E7988;
|
||||||
|
|
||||||
extern s32 D_800C4B30;
|
extern s32 D_800C4B30;
|
||||||
extern OSMesgQueue MQ_800E9BF0;
|
|
||||||
extern u8 D_800A9FF8;
|
|
||||||
|
|
||||||
extern OSContStatus __GLOBAL_CONT_STATUS[MAXCONTROLLERS];
|
|
||||||
extern void (*D_800A9FE0)(s16);
|
extern void (*D_800A9FE0)(s16);
|
||||||
extern OSMesgQueue MQ_800C4A00;
|
|
||||||
|
|
||||||
extern OSContPad __GLOBAL_CONTROLLER_DATA[MAXCONTROLLERS];
|
extern OSContPad __GLOBAL_CONTROLLER_DATA[MAXCONTROLLERS];
|
||||||
extern OSContPad __GLOBAL_CONTROLLER_DATA_COPY[MAXCONTROLLERS];
|
extern OSContPad __GLOBAL_CONTROLLER_DATA_COPY[MAXCONTROLLERS];
|
||||||
|
|
@ -167,9 +163,6 @@ extern void __calls_osViBlack(bool black);
|
||||||
|
|
||||||
extern void __osViSwapBuffer_3(void** buffers);
|
extern void __osViSwapBuffer_3(void** buffers);
|
||||||
|
|
||||||
extern void __start_copy_global_controller_data(void);
|
|
||||||
extern void __end_copy_global_controller_data(void);
|
|
||||||
|
|
||||||
extern s32 __read_controller(OSContPad* data, u32 flags);
|
extern s32 __read_controller(OSContPad* data, u32 flags);
|
||||||
extern s32 __real_read_controller(void);
|
extern s32 __real_read_controller(void);
|
||||||
extern s32 __calls_read_controller_0(s16* arg0);
|
extern s32 __calls_read_controller_0(s16* arg0);
|
||||||
|
|
@ -177,11 +170,7 @@ extern s32 __calls_read_controller_0(s16* arg0);
|
||||||
extern void func_8008A354();
|
extern void func_8008A354();
|
||||||
extern void func_8008A37C();
|
extern void func_8008A37C();
|
||||||
|
|
||||||
extern void func_8008B130(u8*);
|
|
||||||
extern void func_8008B1D0(u8*);
|
|
||||||
|
|
||||||
extern void func_8008350C();
|
extern void func_8008350C();
|
||||||
extern void func_8008B1D0(u8*);
|
|
||||||
|
|
||||||
extern void __set_vi_mode(s32);
|
extern void __set_vi_mode(s32);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -687,6 +687,9 @@ extern OSContPad nuContData[];
|
||||||
extern u32 nuContNum; /* Number of controllers connected */
|
extern u32 nuContNum; /* Number of controllers connected */
|
||||||
extern u32 nuContDataLockKey; /* Lock Controller data. */
|
extern u32 nuContDataLockKey; /* Lock Controller data. */
|
||||||
extern OSMesgQueue nuContWaitMesgQ; /* Wait for Controller read */
|
extern OSMesgQueue nuContWaitMesgQ; /* Wait for Controller read */
|
||||||
|
extern OSMesg nuContWaitMesgBuf;
|
||||||
|
extern OSMesgQueue nuContDataMutexQ;
|
||||||
|
extern OSMesg nuContDataMutexBuf;
|
||||||
extern OSPfs nuContPfs[];
|
extern OSPfs nuContPfs[];
|
||||||
extern NUCallBackList nuContCallBack;
|
extern NUCallBackList nuContCallBack;
|
||||||
extern u16 nuContPakCompanyCode; /* Company code */
|
extern u16 nuContPakCompanyCode; /* Company code */
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,13 @@ nuStackIdle = 0x800B17A0;
|
||||||
nuPiCartHandle = 0x800E7A20;
|
nuPiCartHandle = 0x800E7A20;
|
||||||
nuPiMgrMesgQ = 0x800BE030;
|
nuPiMgrMesgQ = 0x800BE030;
|
||||||
nuPiMesgBuf = 0x800BE048;
|
nuPiMesgBuf = 0x800BE048;
|
||||||
|
nuContWaitMesgQ = 0x800C4A00;
|
||||||
|
nuContWaitMesgBuf = 0x800BE190;
|
||||||
|
nuContDataMutexQ = 0x800E9BF0;
|
||||||
|
nuContDataMutexBuf = 0x800BE194;
|
||||||
|
nuContCallBack = 0x800A9FF8;
|
||||||
|
nuContStatus = 0x800C4B38; // size:0x10 type:u32
|
||||||
|
nuContNum = 0x800C6D60;
|
||||||
|
|
||||||
nuBoot = 0x8007F880;
|
nuBoot = 0x8007F880;
|
||||||
nuScCreateScheduler = 0x80088C50; // rom:0x19050
|
nuScCreateScheduler = 0x80088C50; // rom:0x19050
|
||||||
|
|
@ -68,6 +75,14 @@ nuSiMgrStop = 0x80089D5C;
|
||||||
nuSiMgrRestart = 0x80089D7C;
|
nuSiMgrRestart = 0x80089D7C;
|
||||||
nuIdle = 0x8007F8E4;
|
nuIdle = 0x8007F8E4;
|
||||||
nuPiReadRom = 0x80089F80;
|
nuPiReadRom = 0x80089F80;
|
||||||
|
nuContQueryRead = 0x8008A640;
|
||||||
|
nuContMgrInit = 0x8008A260;
|
||||||
|
nuContDataUnLock = 0x8008A5D0;
|
||||||
|
nuSiCallBackAdd = 0x8008B130;
|
||||||
|
nuContMgrRemove = 0x8008A334;
|
||||||
|
nuSiCallBackRemove = 0x8008B1D0;
|
||||||
|
nuContDataClose = 0x8008A354;
|
||||||
|
nuContDataOpen = 0x8008A37C;
|
||||||
|
|
||||||
|
|
||||||
obCurrentTime = 0x800C47D0;
|
obCurrentTime = 0x800C47D0;
|
||||||
|
|
@ -762,7 +777,6 @@ __MENU_INDEX = 0x801BA94C;
|
||||||
|
|
||||||
__GLOBAL_WITH__inc_menu_timer = 0x8018FB20;
|
__GLOBAL_WITH__inc_menu_timer = 0x8018FB20;
|
||||||
|
|
||||||
__GLOBAL_CONT_STATUS = 0x800C4B38; // size:0x10 type:u32
|
|
||||||
|
|
||||||
__set_fp_8008A660 = 0x8008A660;
|
__set_fp_8008A660 = 0x8008A660;
|
||||||
|
|
||||||
|
|
@ -911,16 +925,12 @@ __MUS_MEM_800B1868 = 0x800B1868;
|
||||||
|
|
||||||
MQ_SWAP_BUFFER = 0x800E9BA8;
|
MQ_SWAP_BUFFER = 0x800E9BA8;
|
||||||
MQ_800E7988 = 0x800E7988;
|
MQ_800E7988 = 0x800E7988;
|
||||||
MQ_800C4A00 = 0x800C4A00;
|
|
||||||
MQ_800E9BF0 = 0x800E9BF0;
|
|
||||||
MQ_800C35A0 = 0x800C35A0;
|
MQ_800C35A0 = 0x800C35A0;
|
||||||
MQ_800AF320 = 0x800AF320;
|
MQ_800AF320 = 0x800AF320;
|
||||||
MQ_800B1880 = 0x800B1880;
|
MQ_800B1880 = 0x800B1880;
|
||||||
MQ_800E79C8 = 0x800E79C8;
|
MQ_800E79C8 = 0x800E79C8;
|
||||||
MQ_800C49E8 = 0x800C49E8;
|
MQ_800C49E8 = 0x800C49E8;
|
||||||
|
|
||||||
OSMESG_800BE190 = 0x800BE190;
|
|
||||||
OSMESG_800BE194 = 0x800BE194;
|
|
||||||
OSMESG_800B1870 = 0x800B1870;
|
OSMESG_800B1870 = 0x800B1870;
|
||||||
OSMESG_800B17D0 = 0x800B17D0;
|
OSMESG_800B17D0 = 0x800B17D0;
|
||||||
OSMESG_800B17E0 = 0x800B17E0;
|
OSMESG_800B17E0 = 0x800B17E0;
|
||||||
|
|
@ -982,8 +992,6 @@ __GLOBAL_CONTROLLER_DATA_COPY = 0x0800AEE78; // size:0x18
|
||||||
|
|
||||||
__calls_copy_controller_data = 0x8007297C;
|
__calls_copy_controller_data = 0x8007297C;
|
||||||
__copy_global_controller_data = 0x8008A600;
|
__copy_global_controller_data = 0x8008A600;
|
||||||
__start_copy_global_controller_data = 0x8008A354;
|
|
||||||
__end_copy_global_controller_data = 0x8008A37C;
|
|
||||||
__read_controller = 0x8008A3A4;
|
__read_controller = 0x8008A3A4;
|
||||||
__calls_read_controller_0 = 0x8008A47C;
|
__calls_read_controller_0 = 0x8008A47C;
|
||||||
__calls_read_controller_1 = 0x8008A508;
|
__calls_read_controller_1 = 0x8008A508;
|
||||||
|
|
@ -1007,7 +1015,6 @@ __virtual_mem_alloc = 0x80070F30;
|
||||||
|
|
||||||
obMain = 0x80071EB0;
|
obMain = 0x80071EB0;
|
||||||
obThreadMain = 0x800AF5F0;
|
obThreadMain = 0x800AF5F0;
|
||||||
obStackMain = 0x800C6D60;
|
|
||||||
|
|
||||||
entry = 0x80070C00;
|
entry = 0x80070C00;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"]
|
||||||
|
|
@ -139,7 +141,7 @@ segments:
|
||||||
- [0x1B320, asm]
|
- [0x1B320, asm]
|
||||||
- [0x1B360, asm]
|
- [0x1B360, asm]
|
||||||
- [0x1B3A0, c, "_ob_electric_zephyr"]
|
- [0x1B3A0, c, "_ob_electric_zephyr"]
|
||||||
- [0x1B3E0, c, "_ob_grumpy_island"]
|
- [0x1B3E0, c, "nu/nugfxthread"]
|
||||||
- [0x1B510, c, "_ob_painful_roll"]
|
- [0x1B510, c, "_ob_painful_roll"]
|
||||||
- [0x1B530, asm]
|
- [0x1B530, asm]
|
||||||
- [0x1B650, asm]
|
- [0x1B650, asm]
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@
|
||||||
#include "nu/nusys.h"
|
#include "nu/nusys.h"
|
||||||
|
|
||||||
void __copy_global_controller_data(OSContPad* arg0) {
|
void __copy_global_controller_data(OSContPad* arg0) {
|
||||||
__start_copy_global_controller_data();
|
nuContDataClose();
|
||||||
bcopy(&__GLOBAL_CONTROLLER_DATA, arg0, 0x18);
|
bcopy(&__GLOBAL_CONTROLLER_DATA, arg0, 0x18);
|
||||||
__end_copy_global_controller_data();
|
nuContDataOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_8008A640(void) {
|
void nuContQueryRead(void) {
|
||||||
nuSiSendMesg(0x103, 0);
|
nuSiSendMesg(NU_CONT_QUERY_MSG, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __set_fp_8008A660(void(*arg0)(s16)) {
|
void __set_fp_8008A660(void(*arg0)(s16)) {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include "nu/nusys.h"
|
||||||
|
|
||||||
void func_8008A6A0(void) {
|
void func_8008A6A0(void) {
|
||||||
func_8008B130(&D_800AA040);
|
nuSiCallBackAdd(&D_800AA040);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void func_8008A6C0(void) {
|
void func_8008A6C0(void) {
|
||||||
func_8008B1D0(&D_800AA040);
|
nuSiCallBackRemove(&D_800AA040);
|
||||||
}
|
}
|
||||||
|
|
||||||
INCLUDE_ASM(const s32, "_ob_dull_silver", func_8008A6E0);
|
INCLUDE_ASM(const s32, "_ob_dull_silver", func_8008A6E0);
|
||||||
|
|
|
||||||
|
|
@ -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);
|
|
||||||
|
|
@ -2,55 +2,47 @@
|
||||||
|
|
||||||
#include "nu/nusys.h"
|
#include "nu/nusys.h"
|
||||||
|
|
||||||
void func_8008A5D0();
|
|
||||||
void func_8008A640();
|
|
||||||
|
|
||||||
extern OSMesg OSMESG_800BE190;
|
|
||||||
extern OSMesg OSMESG_800BE194;
|
|
||||||
|
|
||||||
extern u32 obStackMain;
|
|
||||||
|
|
||||||
/* 1A660 8008A260 */
|
/* 1A660 8008A260 */
|
||||||
u8 func_8008A260(void) {
|
u8 nuContMgrInit(void) {
|
||||||
s32 var_a0;
|
s32 i;
|
||||||
s32 var_a1;
|
u8 pattern;
|
||||||
s32 var_v1;
|
u8 bitmask;
|
||||||
|
|
||||||
func_8008A5D0();
|
nuContDataUnLock();
|
||||||
osCreateMesgQueue(&MQ_800C4A00, &OSMESG_800BE190, 1);
|
osCreateMesgQueue(&nuContWaitMesgQ, &nuContWaitMesgBuf, 1);
|
||||||
osCreateMesgQueue(&MQ_800E9BF0, &OSMESG_800BE194, 1);
|
osCreateMesgQueue(&nuContDataMutexQ, &nuContDataMutexBuf, 1);
|
||||||
func_8008B130(&D_800A9FF8);
|
nuSiCallBackAdd(&nuContCallBack);
|
||||||
func_8008A640();
|
nuContQueryRead();
|
||||||
|
|
||||||
var_a0 = 1;
|
nuContNum = 0;
|
||||||
var_a1 = 0;
|
bitmask = 1;
|
||||||
var_v1 = 0;
|
pattern = 0;
|
||||||
obStackMain = 0;
|
|
||||||
for(; var_v1 < MAXCONTROLLERS; var_v1++) {
|
for (i = 0; i < NU_CONT_MAXCONTROLLERS; i++) {
|
||||||
if (__GLOBAL_CONT_STATUS[var_v1].errno == 0) {
|
if (nuContStatus[i].errno != 0) {
|
||||||
if ((__GLOBAL_CONT_STATUS[var_v1].type & CONT_TYPE_MASK) == CONT_TYPE_NORMAL) {
|
continue;
|
||||||
var_a1 |= var_a0;
|
|
||||||
obStackMain += 1;
|
|
||||||
}
|
|
||||||
var_a0 *= 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return var_a1;
|
if ((nuContStatus[i].type & CONT_TYPE_MASK) == CONT_TYPE_NORMAL) {
|
||||||
|
nuContNum++;
|
||||||
|
pattern |= bitmask;
|
||||||
|
}
|
||||||
|
bitmask <<= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return pattern;
|
||||||
|
|
||||||
void func_8008A334(void) {
|
|
||||||
func_8008B1D0(&D_800A9FF8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void __start_copy_global_controller_data(void) {
|
void nuContMgrRemove(void) {
|
||||||
osSendMesg(&MQ_800E9BF0, NULL, OS_MESG_BLOCK);
|
nuSiCallBackRemove(&nuContCallBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __end_copy_global_controller_data(void) {
|
void nuContDataClose(void) {
|
||||||
osRecvMesg(&MQ_800E9BF0, NULL, OS_MESG_BLOCK);
|
osSendMesg(&nuContDataMutexQ, NULL, OS_MESG_BLOCK);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nuContDataOpen(void) {
|
||||||
|
osRecvMesg(&nuContDataMutexQ, NULL, OS_MESG_BLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 __read_controller(OSContPad* data, u32 flags) {
|
s32 __read_controller(OSContPad* data, u32 flags) {
|
||||||
|
|
@ -77,7 +69,7 @@ s32 __real_read_controller(void) {
|
||||||
var_v0 = osContStartQuery(&nuSiMesgQ);
|
var_v0 = osContStartQuery(&nuSiMesgQ);
|
||||||
if (var_v0 == 0) {
|
if (var_v0 == 0) {
|
||||||
osRecvMesg(&nuSiMesgQ, NULL, OS_MESG_BLOCK);
|
osRecvMesg(&nuSiMesgQ, NULL, OS_MESG_BLOCK);
|
||||||
osContGetQuery(__GLOBAL_CONT_STATUS);
|
osContGetQuery(nuContStatus);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return var_v0;
|
return var_v0;
|
||||||
|
|
@ -87,12 +79,12 @@ s32 __real_read_controller(void) {
|
||||||
|
|
||||||
s32 __calls_read_controller_0(s16* arg0) {
|
s32 __calls_read_controller_0(s16* arg0) {
|
||||||
if (D_800C4B30 == 0) {
|
if (D_800C4B30 == 0) {
|
||||||
osRecvMesg(&MQ_800C4A00, NULL, 0);
|
osRecvMesg(&nuContWaitMesgQ, NULL, 0);
|
||||||
__read_controller(__GLOBAL_CONTROLLER_DATA, 1);
|
__read_controller(__GLOBAL_CONTROLLER_DATA, 1);
|
||||||
if (D_800A9FE0 != NULL) {
|
if (D_800A9FE0 != NULL) {
|
||||||
D_800A9FE0(*arg0);
|
D_800A9FE0(*arg0);
|
||||||
}
|
}
|
||||||
osSendMesg(&MQ_800C4A00, NULL, 0);
|
osSendMesg(&nuContWaitMesgQ, NULL, 0);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +101,7 @@ void __calls_read_controller_1(Arg___calls_read_controller_1* arg) {
|
||||||
s32 __calls_read_controller_2(s16* arg0) {
|
s32 __calls_read_controller_2(s16* arg0) {
|
||||||
s32 var_v0;
|
s32 var_v0;
|
||||||
|
|
||||||
osRecvMesg(&MQ_800C4A00, NULL, 0);
|
osRecvMesg(&nuContWaitMesgQ, NULL, 0);
|
||||||
var_v0 = __read_controller(__GLOBAL_CONTROLLER_DATA, 0);
|
var_v0 = __read_controller(__GLOBAL_CONTROLLER_DATA, 0);
|
||||||
if (var_v0 == 0) {
|
if (var_v0 == 0) {
|
||||||
if (D_800A9FE0 != NULL) {
|
if (D_800A9FE0 != NULL) {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ void func_8008A5A0(void) {
|
||||||
osSetIntMask(temp_v0);
|
osSetIntMask(temp_v0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_8008A5D0(void) {
|
void nuContDataUnLock(void) {
|
||||||
s32 temp_v0;
|
s32 temp_v0;
|
||||||
|
|
||||||
temp_v0 = osSetIntMask(OS_IM_NONE);
|
temp_v0 = osSetIntMask(OS_IM_NONE);
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@
|
||||||
extern OSThread nuThreadIdle;
|
extern OSThread nuThreadIdle;
|
||||||
extern u64 nuStackIdle[];
|
extern u64 nuStackIdle[];
|
||||||
|
|
||||||
extern u8 obStackMain[];
|
|
||||||
|
|
||||||
void nuIdle(void* arg);
|
void nuIdle(void* arg);
|
||||||
|
|
||||||
void nuBoot(void) {
|
void nuBoot(void) {
|
||||||
|
|
@ -23,7 +21,7 @@ void nuIdle(void* arg) {
|
||||||
|
|
||||||
osViSetSpecialFeatures(OS_VI_DIVOT_ON | OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF | OS_VI_GAMMA_DITHER_OFF);
|
osViSetSpecialFeatures(OS_VI_DIVOT_ON | OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF | OS_VI_GAMMA_DITHER_OFF);
|
||||||
|
|
||||||
osCreateThread(&obThreadMain, NU_MAIN_THREAD_ID, obMain, NULL, obStackMain, NU_MAIN_THREAD_PRI);
|
osCreateThread(&obThreadMain, NU_MAIN_THREAD_ID, obMain, NULL, &nuContNum, NU_MAIN_THREAD_PRI);
|
||||||
osStartThread(&obThreadMain);
|
osStartThread(&obThreadMain);
|
||||||
|
|
||||||
osSetThreadPri(&nuThreadIdle, NU_IDLE_THREAD_PRI);
|
osSetThreadPri(&nuThreadIdle, NU_IDLE_THREAD_PRI);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ void func_800749C0(s32); /* extern */
|
||||||
void func_800764E0(); /* extern */
|
void func_800764E0(); /* extern */
|
||||||
void func_80079380(); /* extern */
|
void func_80079380(); /* extern */
|
||||||
void func_8008A040(); /* extern */
|
void func_8008A040(); /* extern */
|
||||||
s8 func_8008A260(); /* extern */
|
|
||||||
void func_8009DAEC(); /* extern */
|
void func_8009DAEC(); /* extern */
|
||||||
void func_800E9CEC(); /* extern */
|
void func_800E9CEC(); /* extern */
|
||||||
void func_800EA714(); /* extern */
|
void func_800EA714(); /* extern */
|
||||||
|
|
|
||||||
|
|
@ -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