diff --git a/include/common.h b/include/common.h index 674f72a..f144cb4 100644 --- a/include/common.h +++ b/include/common.h @@ -135,8 +135,6 @@ extern OSPiHandle* CART_HANDLE; extern OSMesgQueue MQ_800E7988; -extern void (*D_800A9FE0)(s16); - extern OSContPad __GLOBAL_CONTROLLER_DATA_COPY[MAXCONTROLLERS]; extern u8 D_800AA040; @@ -161,7 +159,6 @@ extern void __osViSwapBuffer_3(void** buffers); extern s32 __read_controller(OSContPad* data, u32 flags); extern s32 __real_read_controller(void); -extern s32 __calls_read_controller_0(s16* arg0); extern void func_8008A354(); extern void func_8008A37C(); diff --git a/linker_scripts/symbols/addr.txt b/linker_scripts/symbols/addr.txt index 6e83779..f35530d 100644 --- a/linker_scripts/symbols/addr.txt +++ b/linker_scripts/symbols/addr.txt @@ -40,6 +40,7 @@ nuContStatus = 0x800C4B38; // size:0x10 type:u32 nuContNum = 0x800C6D60; nuContDataLockKey = 0x800C4B30; nuContData = 0x0800C4BF0; // size:0x18 +nuContReadFunc = 0x800A9FE0; nuBoot = 0x8007F880; nuScCreateScheduler = 0x80088C50; // rom:0x19050 @@ -87,6 +88,8 @@ nuSiCallBackRemove = 0x8008B1D0; nuContDataClose = 0x8008A354; nuContDataOpen = 0x8008A37C; nuContDataGetAll = 0x8008A600; +nuContRetrace = 0x8008A47C; +nuContReadFuncSet = 0x8008A660; obCurrentTime = 0x800C47D0; @@ -782,7 +785,6 @@ __MENU_INDEX = 0x801BA94C; __GLOBAL_WITH__inc_menu_timer = 0x8018FB20; -__set_fp_8008A660 = 0x8008A660; __osSetTimerIntr = 0x80094F70; __osInsertTimer = 0x80094FD0; @@ -995,7 +997,6 @@ __GLOBAL_CONTROLLER_DATA_COPY = 0x0800AEE78; // size:0x18 __calls_copy_controller_data = 0x8007297C; __read_controller = 0x8008A3A4; -__calls_read_controller_0 = 0x8008A47C; __calls_read_controller_1 = 0x8008A508; __calls_read_controller_2 = 0x8008A528; diff --git a/splat.yaml b/splat.yaml index ea820f3..c787740 100644 --- a/splat.yaml +++ b/splat.yaml @@ -130,7 +130,7 @@ segments: - [0x1A9A0, c, "nu/nucontdatalock"] - [0x1AA00, c, "nu/nucontdatagetall"] - [0x1AA40, c, "nu/nucontqueryread"] - - [0x1AA60, c, "_ob_proper_regret"] + - [0x1AA60, c, "nu/nucontreadfuncset"] - [0x1AAA0, c, "_ob_dull_silver"] - [0x1AD10, asm] - [0x1AFD0, asm] diff --git a/src/main.c b/src/main.c index 1036501..f9c03c5 100644 --- a/src/main.c +++ b/src/main.c @@ -19,7 +19,6 @@ void __calls_copy_controller_data(); /* extern */ void __calls_loads_overlay_array(); /* extern */ void __calls_osViSwapBuffer_8007307C(void**); /* extern */ void __initialize_song_mem(); /* extern */ -void __set_fp_8008A660(void(*)(u16)); /* extern */ void __set_obPtrPtrDisplayList(Gfx**); /* extern */ void func_80070C60(s32*, s32); /* extern */ void func_80072710(); /* extern */ diff --git a/src/nu/nucontmgr.c b/src/nu/nucontmgr.c index 1e8c8f6..06854ea 100644 --- a/src/nu/nucontmgr.c +++ b/src/nu/nucontmgr.c @@ -76,17 +76,22 @@ s32 __real_read_controller(void) { } } - -s32 __calls_read_controller_0(s16* arg0) { - if (nuContDataLockKey == 0) { - osRecvMesg(&nuContWaitMesgQ, NULL, 0); - __read_controller(nuContData, 1); - if (D_800A9FE0 != NULL) { - D_800A9FE0(*arg0); - } - osSendMesg(&nuContWaitMesgQ, NULL, 0); +s32 nuContRetrace(NUSiCommonMesg* mesg) { + if(nuContDataLockKey) { + return NU_SI_CALLBACK_CONTINUE; } - return 0; + + osRecvMesg(&nuContWaitMesgQ, NULL, OS_MESG_NOBLOCK); + + __read_controller(nuContData, 1); + + if(nuContReadFunc != NULL) { + nuContReadFunc(mesg->mesg); + } + + osSendMesg(&nuContWaitMesgQ, NULL, OS_MESG_NOBLOCK); + + return NU_SI_CALLBACK_CONTINUE; } typedef struct { @@ -104,8 +109,8 @@ s32 __calls_read_controller_2(s16* arg0) { osRecvMesg(&nuContWaitMesgQ, NULL, 0); var_v0 = __read_controller(nuContData, 0); if (var_v0 == 0) { - if (D_800A9FE0 != NULL) { - D_800A9FE0(*arg0); + if (nuContReadFunc != NULL) { + nuContReadFunc(*arg0); } return 0; } else { diff --git a/src/_ob_proper_regret.c b/src/nu/nucontreadfuncset.c similarity index 62% rename from src/_ob_proper_regret.c rename to src/nu/nucontreadfuncset.c index 0a2d02f..fe0bc7a 100644 --- a/src/_ob_proper_regret.c +++ b/src/nu/nucontreadfuncset.c @@ -2,10 +2,10 @@ #include "nu/nusys.h" -void __set_fp_8008A660(void(*arg0)(s16)) { +void nuContReadFuncSet(NUContReadFunc func) { s32 mask; mask = osSetIntMask(OS_IM_NONE); - D_800A9FE0 = arg0; + nuContReadFunc = func; osSetIntMask(mask); }