Split `_ob_classy_fold.c`

Rename `_ob_classy_fold.c` to `nucontmgr.c`
Rename `__GLOBAL_CONTROLLER_DATA` to `nuContData`
Rename `__copy_global_controller_data` to `nuContDataGetAll`
Split `nuContQueryRead` to it's own file
Split `nuContDataGetAll` to it's own file
This commit is contained in:
gijs 2023-10-21 17:54:44 +02:00
parent 3dab52ce7d
commit 19551728c2
9 changed files with 37 additions and 31 deletions

View File

@ -137,7 +137,6 @@ extern OSMesgQueue MQ_800E7988;
extern void (*D_800A9FE0)(s16); extern void (*D_800A9FE0)(s16);
extern OSContPad __GLOBAL_CONTROLLER_DATA[MAXCONTROLLERS];
extern OSContPad __GLOBAL_CONTROLLER_DATA_COPY[MAXCONTROLLERS]; extern OSContPad __GLOBAL_CONTROLLER_DATA_COPY[MAXCONTROLLERS];
extern u8 D_800AA040; extern u8 D_800AA040;

View File

@ -39,6 +39,7 @@ nuContCallBack = 0x800A9FF8;
nuContStatus = 0x800C4B38; // size:0x10 type:u32 nuContStatus = 0x800C4B38; // size:0x10 type:u32
nuContNum = 0x800C6D60; nuContNum = 0x800C6D60;
nuContDataLockKey = 0x800C4B30; nuContDataLockKey = 0x800C4B30;
nuContData = 0x0800C4BF0; // size:0x18
nuBoot = 0x8007F880; nuBoot = 0x8007F880;
nuScCreateScheduler = 0x80088C50; // rom:0x19050 nuScCreateScheduler = 0x80088C50; // rom:0x19050
@ -85,6 +86,7 @@ nuContMgrRemove = 0x8008A334;
nuSiCallBackRemove = 0x8008B1D0; nuSiCallBackRemove = 0x8008B1D0;
nuContDataClose = 0x8008A354; nuContDataClose = 0x8008A354;
nuContDataOpen = 0x8008A37C; nuContDataOpen = 0x8008A37C;
nuContDataGetAll = 0x8008A600;
obCurrentTime = 0x800C47D0; obCurrentTime = 0x800C47D0;
@ -989,11 +991,9 @@ __ROM_0_to_8000 = 0x800A83B8; // rom:0x387B8
romCopy_256 = 0x80074CF0; // rom:0x50F0 romCopy_256 = 0x80074CF0; // rom:0x50F0
__GLOBAL_CONTROLLER_DATA = 0x0800C4BF0; // size:0x18
__GLOBAL_CONTROLLER_DATA_COPY = 0x0800AEE78; // size:0x18 __GLOBAL_CONTROLLER_DATA_COPY = 0x0800AEE78; // size:0x18
__calls_copy_controller_data = 0x8007297C; __calls_copy_controller_data = 0x8007297C;
__copy_global_controller_data = 0x8008A600;
__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;

View File

@ -128,7 +128,9 @@ segments:
- [0x1A5B0, c, "nu/nugfxinit"] - [0x1A5B0, c, "nu/nugfxinit"]
- [0x1A660, c, "nu/nucontmgr"] - [0x1A660, c, "nu/nucontmgr"]
- [0x1A9A0, c, "nu/nucontdatalock"] - [0x1A9A0, c, "nu/nucontdatalock"]
- [0x1AA00, c, "_ob_classy_fold"] - [0x1AA00, c, "nu/nucontdatagetall"]
- [0x1AA40, c, "nu/nucontqueryread"]
- [0x1AA60, c, "_ob_proper_regret"]
- [0x1AAA0, c, "_ob_dull_silver"] - [0x1AAA0, c, "_ob_dull_silver"]
- [0x1AD10, asm] - [0x1AD10, asm]
- [0x1AFD0, asm] - [0x1AFD0, asm]

View File

@ -1,22 +0,0 @@
#include "common.h"
#include "nu/nusys.h"
void __copy_global_controller_data(OSContPad* arg0) {
nuContDataClose();
bcopy(&__GLOBAL_CONTROLLER_DATA, arg0, 0x18);
nuContDataOpen();
}
void nuContQueryRead(void) {
nuSiSendMesg(NU_CONT_QUERY_MSG, NULL);
}
void __set_fp_8008A660(void(*arg0)(s16)) {
s32 mask;
mask = osSetIntMask(OS_IM_NONE);
D_800A9FE0 = arg0;
osSetIntMask(mask);
}

11
src/_ob_proper_regret.c Normal file
View File

@ -0,0 +1,11 @@
#include "common.h"
#include "nu/nusys.h"
void __set_fp_8008A660(void(*arg0)(s16)) {
s32 mask;
mask = osSetIntMask(OS_IM_NONE);
D_800A9FE0 = arg0;
osSetIntMask(mask);
}

View File

@ -220,11 +220,11 @@ void func_8007284C(u16 __unused) {
if ((D_800AEF9A & 1) && !(D_800AEF9A & 4)) { if ((D_800AEF9A & 1) && !(D_800AEF9A & 4)) {
if (D_800AEF9A & 2) { if (D_800AEF9A & 2) {
if (__GLOBAL_CONTROLLER_DATA[0].button == 0) { if (nuContData[0].button == 0) {
D_800AEF9A = D_800AEF9A & 0xFD; D_800AEF9A = D_800AEF9A & 0xFD;
} }
} else if (__GLOBAL_CONTROLLER_DATA[0].button == pattern_a || } else if (nuContData[0].button == pattern_a ||
__GLOBAL_CONTROLLER_DATA[0].button == pattern_b) { nuContData[0].button == pattern_b) {
D_800AEF9A = D_800AEF9A | 6; D_800AEF9A = D_800AEF9A | 6;
} }
} }

View File

@ -0,0 +1,9 @@
#include "common.h"
#include "nu/nusys.h"
void nuContDataGetAll(OSContPad* contdata) {
nuContDataClose();
bcopy(&nuContData, contdata, 0x18);
nuContDataOpen();
}

View File

@ -80,7 +80,7 @@ s32 __real_read_controller(void) {
s32 __calls_read_controller_0(s16* arg0) { s32 __calls_read_controller_0(s16* arg0) {
if (nuContDataLockKey == 0) { if (nuContDataLockKey == 0) {
osRecvMesg(&nuContWaitMesgQ, NULL, 0); osRecvMesg(&nuContWaitMesgQ, NULL, 0);
__read_controller(__GLOBAL_CONTROLLER_DATA, 1); __read_controller(nuContData, 1);
if (D_800A9FE0 != NULL) { if (D_800A9FE0 != NULL) {
D_800A9FE0(*arg0); D_800A9FE0(*arg0);
} }
@ -102,7 +102,7 @@ s32 __calls_read_controller_2(s16* arg0) {
s32 var_v0; s32 var_v0;
osRecvMesg(&nuContWaitMesgQ, NULL, 0); osRecvMesg(&nuContWaitMesgQ, NULL, 0);
var_v0 = __read_controller(__GLOBAL_CONTROLLER_DATA, 0); var_v0 = __read_controller(nuContData, 0);
if (var_v0 == 0) { if (var_v0 == 0) {
if (D_800A9FE0 != NULL) { if (D_800A9FE0 != NULL) {
D_800A9FE0(*arg0); D_800A9FE0(*arg0);

7
src/nu/nucontqueryread.c Normal file
View File

@ -0,0 +1,7 @@
#include "common.h"
#include "nu/nusys.h"
void nuContQueryRead(void) {
nuSiSendMesg(NU_CONT_QUERY_MSG, NULL);
}