Compare commits

...

21 Commits

Author SHA1 Message Date
gijs a59d54c56d Disable SHIFT-JIS decoding for now 2023-11-24 13:15:16 +01:00
gijs 78f2f49b70 Change addr names which are now considered errors in `splat` 2023-11-24 13:12:53 +01:00
gijs 9bad233fb4 Update `splat` 2023-11-24 13:09:11 +01:00
gijs 119ba26445 Move `func_8008A354` and `func_8008A37C` closer to `nuContReadDataImpl` 2023-10-22 13:49:54 +02:00
gijs 0d150f7271 Clean up `nuContQueryImpl` 2023-10-22 13:48:26 +02:00
gijs 1f79bf2bb2 Rename `__real_read_controller` to `nuContQueryImpl` 2023-10-22 13:47:25 +02:00
gijs 07265b8744 Clean up `nuContReadImpl` 2023-10-22 13:46:17 +02:00
gijs c71a4b27ee Clean up `nuContReadNWImpl` 2023-10-22 13:45:36 +02:00
gijs 7bd27f68e3 Rename `__calls_read_controller_2` to `nuContReadNWImpl` 2023-10-22 13:40:27 +02:00
gijs 7da0c3f44d Rename `__calls_read_controller_1` to `nuContReadImpl` 2023-10-22 13:39:22 +02:00
gijs c37f5f48fd Rename `nuContRetrace` to `nuContRetraceImpl` 2023-10-22 13:36:37 +02:00
gijs 496a52b76c Rename `__read_controller` to `nuContReadDataImpl` 2023-10-22 13:36:08 +02:00
gijs dc44ec0dfb Clean up `addr.txt`: `nuContPak` symbols 2023-10-22 12:59:40 +02:00
gijs 4b68acc1bf Rename `nuContPakFileFread` to `nuContPakFileOpenJis` 2023-10-22 12:59:01 +02:00
gijs ba6bc84aba Decompile `nuContPakCodeSet` 2023-10-22 12:56:04 +02:00
gijs c02b0f0685 Rename `func_8008AE40` to `nuContPakCodeSet` 2023-10-22 12:52:50 +02:00
gijs 9dafb4f418 Rename `1AD10` to `nucontpakconv.c` 2023-10-22 12:49:23 +02:00
gijs f89ed6df1a Rename `func_8008A910` to `nuContPakJisToN64` and `func_8008AA5C` to `nuContPakN64ToJis`
Not sure about both of these but they were missing so far
2023-10-22 12:47:51 +02:00
gijs d68db110f1 Rename `func_8008AD60` to `nuContPakFileFread`
Add `nucontpakfilefread.c`
2023-10-22 12:42:35 +02:00
gijs e493592fc2 Decompile `nuContPakRepairId` 2023-10-22 12:37:41 +02:00
gijs 7a27f83401 Clean up `nuContPakFileState` 2023-10-22 12:35:55 +02:00
10 changed files with 85 additions and 78 deletions

View File

@ -159,12 +159,6 @@ extern void __calls_osViBlack(bool black);
extern void __osViSwapBuffer_3(void** buffers); extern void __osViSwapBuffer_3(void** buffers);
extern s32 __read_controller(OSContPad* data, u32 flags);
extern s32 __real_read_controller(void);
extern void func_8008A354();
extern void func_8008A37C();
extern void func_8008350C(); extern void func_8008350C();
extern void __set_vi_mode(s32); extern void __set_vi_mode(s32);

View File

@ -96,28 +96,39 @@ nuSiCallBackRemove = 0x8008B1D0;
nuContDataClose = 0x8008A354; nuContDataClose = 0x8008A354;
nuContDataOpen = 0x8008A37C; nuContDataOpen = 0x8008A37C;
nuContDataGetAll = 0x8008A600; nuContDataGetAll = 0x8008A600;
nuContRetrace = 0x8008A47C; nuContRetraceImpl = 0x8008A47C;
nuContReadFuncSet = 0x8008A660; nuContReadFuncSet = 0x8008A660;
nuContPakMgrInit = 0x8008A6A0; nuContPakMgrInit = 0x8008A6A0;
nuContPakMgrRemove = 0x8008A6C0; nuContPakMgrRemove = 0x8008A6C0;
nuContPakOpen = 0x8008ABD0;
nuContPakOpenImpl = 0x8008A6E0; nuContPakOpenImpl = 0x8008A6E0;
nuContPakGetFree = 0x8008AC30;
nuContPakGetFreeImpl = 0x8008A730; nuContPakGetFreeImpl = 0x8008A730;
nuContPakFileReadWrite = 0x8008AE90;
nuContPakFileReadWriteImpl = 0x8008A758; nuContPakFileReadWriteImpl = 0x8008A758;
nuContPakFileOpen = 0x8008ACA0;
nuContPakFileOpenImpl = 0x8008A798; nuContPakFileOpenImpl = 0x8008A798;
nuContPakFileDelete = 0x8008AEE0;
nuContPakFileDeleteImpl = 0x8008A850; nuContPakFileDeleteImpl = 0x8008A850;
nuContPakFileState = 0x8008AF20;
nuContPakFileStateImpl = 0x8008A890; nuContPakFileStateImpl = 0x8008A890;
nuContPakFileNumImpl = 0x8008A8BC; nuContPakFileNumImpl = 0x8008A8BC;
nuContPakRepairId = 0x8008AC70;
nuContPakRepairIdImpl = 0x8008A8E8; nuContPakRepairIdImpl = 0x8008A8E8;
nuContPakCodeSet = 0x8008AE40;
nuContPakJisToN64 = 0x8008A910;
nuContPakN64ToJis = 0x8008AA5C;
nuContPakOpen = 0x8008ABD0;
nuContPakGetFree = 0x8008AC30;
nuContPakFileReadWrite = 0x8008AE90;
nuContPakFileOpen = 0x8008ACA0;
nuContPakFileOpenJis = 0x8008AD60;
nuContPakFileDelete = 0x8008AEE0;
nuContPakFileState = 0x8008AF20;
nuContPakRepairId = 0x8008AC70;
nuContReadDataImpl = 0x8008A3A4;
nuContReadImpl = 0x8008A508;
nuContReadNWImpl = 0x8008A528;
nuContQueryImpl = 0x8008A42C;
obUnpackThreadStart = 0x8007ABAC; obUnpackThreadStart = 0x8007ABAC;
obThreadUnpackProc = 0x800AF0D0; // size:0x1B0 obThreadUnpackProc = 0x800AF0D0; // size:0x1B0
@ -157,8 +168,6 @@ osPfsNumFiles = 0x80096A90; // rom:0x26E90
osAiSetNextBuffer = 0x8008C550; // rom:0x1C950 osAiSetNextBuffer = 0x8008C550; // rom:0x1C950
__osAiDeviceBusy = 0x80099BC0; // rom:0x29FC0 __osAiDeviceBusy = 0x80099BC0; // rom:0x29FC0
__OVERLAY_INFO_8018F330 = 0x8018F330; // size:0x14
__OVERLAY_INFO_8018F344 = 0x8018F344; // size:0x14
__OVERLAY_INFO_8018F330 = 0x8018F330; // size:0x14 __OVERLAY_INFO_8018F330 = 0x8018F330; // size:0x14
__OVERLAY_INFO_8018F344 = 0x8018F344; // size:0x14 __OVERLAY_INFO_8018F344 = 0x8018F344; // size:0x14
__OVERLAY_INFO_8018FC1C = 0x8018FC1C; // size:0x14 __OVERLAY_INFO_8018FC1C = 0x8018FC1C; // size:0x14
@ -508,8 +517,6 @@ obElementNameFlameBane = 0x801876F0; // rom:0x5D5F0 type:asciz
//obAbilityNameMirageSlash = 0x80187BB8; // type:asciz rom:0x5DAB8 size:13 //obAbilityNameMirageSlash = 0x80187BB8; // type:asciz rom:0x5DAB8 size:13
//obAbilityNameFatalDance = 0x80187BC8; // type:asciz rom:0x5DAC8 size:12 //obAbilityNameFatalDance = 0x80187BC8; // type:asciz rom:0x5DAC8 size:12
D_80187BD4 = 0x80187BD4; // rom:0x5DAD4 type:u32
// TODO: Figure this out // TODO: Figure this out
FP_CLASS_GET_ITEM_0 = 0x80186FD4; // rom:0x5CED4 size:16 type:u32 FP_CLASS_GET_ITEM_0 = 0x80186FD4; // rom:0x5CED4 size:16 type:u32
FP_CLASS_GET_ITEM_1 = 0x8018B494; // rom:0x61394 size:16 type:u32 FP_CLASS_GET_ITEM_1 = 0x8018B494; // rom:0x61394 size:16 type:u32
@ -731,26 +738,21 @@ __loads_overlay_array = 0x800761E4;
__get_overlay_index = 0x80076430; __get_overlay_index = 0x80076430;
__calls_loads_overlay_array = 0x80075BC0; __calls_loads_overlay_array = 0x80075BC0;
D_800A81C0 = 0x800A81C0; // size:0x30
__add_0x594284 = 0x8009DD28; __add_0x594284 = 0x8009DD28;
__log_lha_error = 0x8007BB90; __log_lha_error = 0x8007BB90;
__osPiTable = 0x800AA41C; // rom:0x3A81C __osPiTable = 0x800AA41C; // rom:0x3A81C
osEPiLinkHandle = 0x8008BCE0l // rom:0x1C0E0 osEPiLinkHandle = 0x8008BCE0; // rom:0x1C0E0
CartRomHandle = 0x800C4C50; // size:0x2A CartRomHandle = 0x800C4C50; // size:0x2A
osCartRomInit = 0x8008BD30; osCartRomInit = 0x8008BD30;
D_800A81C0 = 0x800A81C0; // size:0x30 D_800A81C0 = 0x800A81C0; // size:0x30
D_800C4BBC = 0x800C4BBC; // size:0x8 D_800C4BBC = 0x800C4BBC; // size:0x8
D_800AEFE0 = 0x800AEFE0; // size:0x8
D_80197168 = 0x80197168; // size:0x10 D_80197168 = 0x80197168; // size:0x10
D_800E7D90 = 0x800E7D90; // size:0x58 D_800E7D90 = 0x800E7D90; // size:0x58
D_800E7DE8 = 0x800E7DE8; // size:0x58 D_800E7DE8 = 0x800E7DE8; // size:0x58
D_800AEFE0 = 0x800AEFE0; // size:0x8
D_800E82C8 = 0x800E82C8; // size:0x3F0 type:u8 D_800E82C8 = 0x800E82C8; // size:0x3F0 type:u8
D_800C4C10 = 0x800C4C10; // size:0xC type:u8 D_800C4C10 = 0x800C4C10; // size:0xC type:u8
@ -784,7 +786,6 @@ ldigs = 0x800ABC30; // type:asciz
udigs = 0x800ABC44; // type:asciz udigs = 0x800ABC44; // type:asciz
_Litob = 0x8009B670; _Litob = 0x8009B670;
__osSiRawWriteIo = 0x
__osFinalrom = 0x800E82C0; // type:u32 __osFinalrom = 0x800E82C0; // type:u32
osViClock = 0x800ABAC8; // type:s32 osViClock = 0x800ABAC8; // type:s32
__OSGlobalIntMask = 0x800ABAD0; // type:u32 __OSGlobalIntMask = 0x800ABAD0; // type:u32
@ -815,10 +816,6 @@ __resets_menu_timer = 0x8019B2E0; // rom:0x1D17E0
__calls_resets_menu_timer = 0x80177A1C; // rom:0x4D91C __calls_resets_menu_timer = 0x80177A1C; // rom:0x4D91C
__MENU_INDEX = 0x801BA94C; __MENU_INDEX = 0x801BA94C;
__GLOBAL_WITH__inc_menu_timer = 0x8018FB20;
__osSetTimerIntr = 0x80094F70; __osSetTimerIntr = 0x80094F70;
__osInsertTimer = 0x80094FD0; __osInsertTimer = 0x80094FD0;
osSetTime = 0x80094D20; osSetTime = 0x80094D20;
@ -945,7 +942,6 @@ osViModeNtscLan1 = 0x800AB960;
osUnmapTLBAll = 0x8009AB00; osUnmapTLBAll = 0x8009AB00;
osMapTLBRdb = 0x8009AAA0; osMapTLBRdb = 0x8009AAA0;
__real_read_controller = 0x8008A42C;
__calls_romCopy_8009DA50 = 0x8009DA50; __calls_romCopy_8009DA50 = 0x8009DA50;
__calls_romCopy_8009DAF4 = 0x8009DAF4; __calls_romCopy_8009DAF4 = 0x8009DAF4;
__calls_romCopy_8009DBB8 = 0x8009DBB8; __calls_romCopy_8009DBB8 = 0x8009DBB8;
@ -964,13 +960,11 @@ __MUS_MEM_800B1868 = 0x800B1868;
MQ_SWAP_BUFFER = 0x800E9BA8; MQ_SWAP_BUFFER = 0x800E9BA8;
MQ_800E7988 = 0x800E7988; MQ_800E7988 = 0x800E7988;
MQ_800C35A0 = 0x800C35A0;
obUnpackQueue = 0x800AF320; obUnpackQueue = 0x800AF320;
MQ_800B1880 = 0x800B1880; MQ_800B1880 = 0x800B1880;
MQ_800E79C8 = 0x800E79C8; MQ_800E79C8 = 0x800E79C8;
MQ_800C49E8 = 0x800C49E8; MQ_800C49E8 = 0x800C49E8;
OSMESG_800B1870 = 0x800B1870;
OSMESG_800B17D0 = 0x800B17D0; OSMESG_800B17D0 = 0x800B17D0;
OSMESG_800B17E0 = 0x800B17E0; OSMESG_800B17E0 = 0x800B17E0;
OSMESG_800B9C58 = 0x800B9C58; OSMESG_800B9C58 = 0x800B9C58;
@ -1028,9 +1022,6 @@ romCopy_256 = 0x80074CF0; // rom:0x50F0
__GLOBAL_CONTROLLER_DATA_COPY = 0x0800AEE78; // size:0x18 __GLOBAL_CONTROLLER_DATA_COPY = 0x0800AEE78; // size:0x18
__calls_copy_controller_data = 0x8007297C; __calls_copy_controller_data = 0x8007297C;
__read_controller = 0x8008A3A4;
__calls_read_controller_1 = 0x8008A508;
__calls_read_controller_2 = 0x8008A528;
STR_CRC_error = 0x800AE2A0; STR_CRC_error = 0x800AE2A0;
__file_open = 0x8007F4E4; // rom:0xF8E4 __file_open = 0x8007F4E4; // rom:0xF8E4
@ -1228,7 +1219,6 @@ __osDpDeviceBusy = 0x8009C350;
siAccessBuf = 0x800C35A0; siAccessBuf = 0x800C35A0;
__osSiRawStartDma = 0x800946C0;
__osSiRawStartDma = 0x800946C0; __osSiRawStartDma = 0x800946C0;
__osSiRelAccess = 0x80094830; __osSiRelAccess = 0x80094830;
__osSiGetAccess = 0x800947C4; __osSiGetAccess = 0x800947C4;

View File

@ -22,8 +22,8 @@ options:
# src_path: src # src_path: src
# build_path: build # build_path: build
extensions_path: tools/splat_ext extensions_path: tools/splat_ext
string_encoding: SHIFT-JIS # string_encoding: SHIFT-JIS
data_string_encoding: SHIFT-JIS # data_string_encoding: SHIFT-JIS
# mips_abi_float_regs: o32 # mips_abi_float_regs: o32
# section_order: [".text", ".data", "rodata", ".bss"] # section_order: [".text", ".data", "rodata", ".bss"]
# auto_all_sections: [".data", "rodata", ".bss"] # auto_all_sections: [".data", "rodata", ".bss"]
@ -132,13 +132,13 @@ segments:
- [0x1AA40, c, "nu/nucontqueryread"] - [0x1AA40, c, "nu/nucontqueryread"]
- [0x1AA60, c, "nu/nucontreadfuncset"] - [0x1AA60, c, "nu/nucontreadfuncset"]
- [0x1AAA0, c, "nu/nucontpakmgr"] - [0x1AAA0, c, "nu/nucontpakmgr"]
- [0x1AD10, asm] - [0x1AD10, c, "nu/nucontpakconv"]
- [0x1AFD0, c, "nu/nucontpakopen"] - [0x1AFD0, c, "nu/nucontpakopen"]
- [0x1B030, c, "nu/nucontpakgetfree"] - [0x1B030, c, "nu/nucontpakgetfree"]
- [0x1B070, c, "nu/nucontpakrepairid"] - [0x1B070, c, "nu/nucontpakrepairid"]
- [0x1B0A0, c, "nu/nucontpakfileopen"] - [0x1B0A0, c, "nu/nucontpakfileopen"]
- [0x1B160, asm] - [0x1B160, c, "nu/nucontpakfileopenjis"]
- [0x1B240, asm] - [0x1B240, c, "nu/nucontpakcodeset"]
- [0x1B290, c, "nu/nucontpakfilereadwrite"] - [0x1B290, c, "nu/nucontpakfilereadwrite"]
- [0x1B2E0, c, "nu/nucontpakfiledelete"] - [0x1B2E0, c, "nu/nucontpakfiledelete"]
- [0x1B320, c, "nu/nucontpakfilestate"] - [0x1B320, c, "nu/nucontpakfilestate"]

View File

@ -45,7 +45,10 @@ void nuContDataOpen(void) {
osRecvMesg(&nuContDataMutexQ, NULL, OS_MESG_BLOCK); osRecvMesg(&nuContDataMutexQ, NULL, OS_MESG_BLOCK);
} }
s32 __read_controller(OSContPad* data, u32 flags) { extern void func_8008A354();
extern void func_8008A37C();
s32 nuContReadDataImpl(OSContPad* data, u32 flags) {
s32 res; s32 res;
res = osContStartReadData(&nuSiMesgQ); res = osContStartReadData(&nuSiMesgQ);
@ -63,27 +66,27 @@ s32 __read_controller(OSContPad* data, u32 flags) {
return 0; return 0;
} }
s32 __real_read_controller(void) { s32 nuContQueryImpl(NUSiCommonMesg* mesg) {
s32 var_v0; s32 ret = osContStartQuery(&nuSiMesgQ);
if (ret != 0) {
return ret;
}
var_v0 = osContStartQuery(&nuSiMesgQ);
if (var_v0 == 0) {
osRecvMesg(&nuSiMesgQ, NULL, OS_MESG_BLOCK); osRecvMesg(&nuSiMesgQ, NULL, OS_MESG_BLOCK);
osContGetQuery(nuContStatus); osContGetQuery(nuContStatus);
return 0;
} else { return ret;
return var_v0;
}
} }
s32 nuContRetrace(NUSiCommonMesg* mesg) { s32 nuContRetraceImpl(NUSiCommonMesg* mesg) {
if(nuContDataLockKey) { if(nuContDataLockKey) {
return NU_SI_CALLBACK_CONTINUE; return NU_SI_CALLBACK_CONTINUE;
} }
osRecvMesg(&nuContWaitMesgQ, NULL, OS_MESG_NOBLOCK); osRecvMesg(&nuContWaitMesgQ, NULL, OS_MESG_NOBLOCK);
__read_controller(nuContData, 1); nuContReadDataImpl(nuContData, 1);
if(nuContReadFunc != NULL) { if(nuContReadFunc != NULL) {
nuContReadFunc(mesg->mesg); nuContReadFunc(mesg->mesg);
@ -94,27 +97,24 @@ s32 nuContRetrace(NUSiCommonMesg* mesg) {
return NU_SI_CALLBACK_CONTINUE; return NU_SI_CALLBACK_CONTINUE;
} }
typedef struct { void nuContReadImpl(NUSiCommonMesg* mesg) {
/* 0x0 */ u8 field_0x0[0xc]; nuContReadDataImpl((OSContPad*)mesg->dataPtr, 0);
/* 0xC */ OSContPad* data;
} Arg___calls_read_controller_1;
void __calls_read_controller_1(Arg___calls_read_controller_1* arg) {
__read_controller(arg->data, 0);
} }
s32 __calls_read_controller_2(s16* arg0) { s32 nuContReadNWImpl(NUSiCommonMesg* mesg) {
s32 var_v0; s32 rtn;
osRecvMesg(&nuContWaitMesgQ, NULL, 0); osRecvMesg(&nuContWaitMesgQ, NULL, OS_MESG_NOBLOCK);
var_v0 = __read_controller(nuContData, 0);
if (var_v0 == 0) { rtn = nuContReadDataImpl(nuContData, 0);
if (nuContReadFunc != NULL) { if (rtn) {
nuContReadFunc(*arg0); return rtn;
} }
return 0;
} else { if(nuContReadFunc != NULL) {
return var_v0; (*nuContReadFunc)(mesg->mesg);
} }
return rtn;
} }

View File

@ -0,0 +1,9 @@
#include "common.h"
#include "nu/nusys.h"
/* 1B240 8008AE40 */
void nuContPakCodeSet(u8* companyCode, u8* gameCode) {
bcopy(companyCode, &nuContPakCompanyCode, 2);
bcopy(gameCode, &nuContPakGameCode, 4);
}

5
src/nu/nucontpakconv.c Normal file
View File

@ -0,0 +1,5 @@
#include "common.h"
INCLUDE_ASM(const s32, "nu/nucontpakconv", nuContPakJisToN64);
INCLUDE_ASM(const s32, "nu/nucontpakconv", nuContPakN64ToJis);

View File

@ -0,0 +1,3 @@
#include "common.h"
INCLUDE_ASM(const s32, "nu/nucontpakfileopenjis", nuContPakFileOpenJis);

View File

@ -4,12 +4,12 @@
/* 1B320 8008AF20 */ /* 1B320 8008AF20 */
s32 nuContPakFileState(NUContPakFile* file, OSPfsState* state) { s32 nuContPakFileState(NUContPakFile* file, OSPfsState* state) {
NUContPakFileStateMesg sp10; NUContPakFileStateMesg mesg;
sp10.file = file; mesg.file = file;
sp10.state = state; mesg.state = state;
file->error = nuSiSendMesg(0x206, &sp10); file->error = nuSiSendMesg(NU_CONT_PAK_FILESTATE_MSG, &mesg);
return file->error; return file->error;
} }

View File

@ -1,3 +1,9 @@
#include "common.h" #include "common.h"
INCLUDE_ASM(const s32, "nu/nucontpakrepairid", nuContPakRepairId); #include "nu/nusys.h"
/* 1B070 8008AC70 */
s32 nuContPakRepairId(NUContPakFile* file) {
return file->error = nuSiSendMesg(NU_CONT_PAK_REPAIRID_MSG, file);
}

@ -1 +1 @@
Subproject commit 63d16cf283597284200f9a7093bb94b5877c4365 Subproject commit 7b365e1f0c25b0dc64bec1e5b7bf694bf252b3fc