Clean up around `nuContRetrace`

Rename `__calls_read_controller_0` to `nuContRetrace`
Rename `D_800A9FE0` to `nuContReadFunc`
Rename `__set_fp_8008A660` to `nuContReadFuncSet`
Rename `_ob_proper_regret.c` to `nucontreadfuncset.c`
This commit is contained in:
gijs 2023-10-21 18:05:22 +02:00
parent 19551728c2
commit 30721ffd6c
6 changed files with 23 additions and 21 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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]

View File

@ -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 */

View File

@ -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 {

View File

@ -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);
}