mirror of
https://github.com/pmret/papermario.git
synced 2024-11-09 12:32:38 +01:00
match nuContRmbMgr.c
This commit is contained in:
parent
398fa6c695
commit
bbac3d905b
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
@ -31,6 +31,14 @@
|
||||
},
|
||||
"files.associations": {
|
||||
"*.h": "c",
|
||||
"random": "c"
|
||||
"random": "c",
|
||||
"array": "c",
|
||||
"deque": "c",
|
||||
"string": "c",
|
||||
"unordered_map": "c",
|
||||
"vector": "c",
|
||||
"string_view": "c",
|
||||
"initializer_list": "c",
|
||||
"ranges": "c"
|
||||
},
|
||||
}
|
||||
|
6
asm/data/code_1060_len_310.rodata.s
Normal file
6
asm/data/code_1060_len_310.rodata.s
Normal file
@ -0,0 +1,6 @@
|
||||
.include "macro.inc"
|
||||
|
||||
.section .rodata
|
||||
|
||||
glabel D_80097D30
|
||||
.ascii "File:%s Line:%d %s \n\0\0\0"
|
File diff suppressed because one or more lines are too long
192
asm/data/code_6F110.data.s
Normal file
192
asm/data/code_6F110.data.s
Normal file
File diff suppressed because one or more lines are too long
@ -1,10 +0,0 @@
|
||||
.include "macro.inc"
|
||||
|
||||
.section .rodata
|
||||
|
||||
glabel D_80097D30
|
||||
.ascii "File:%s Line:%d %s
|
||||
\0\0\0"
|
||||
|
||||
glabel jtbl_80097D48
|
||||
.word L800270B4_24B4, L800270E4_24E4, L8002710C_250C, L80027134_2534, L80027168_2568, 0
|
@ -1,6 +1,13 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
.section .rodata
|
||||
|
||||
glabel jtbl_80097D48
|
||||
.word L800270B4_24B4, L800270E4_24E4, L8002710C_250C, L80027134_2534, L80027168_2568, 0
|
||||
|
||||
.section .text
|
||||
|
||||
glabel func_80027088
|
||||
/* 2488 80027088 27BDFFE8 */ addiu $sp, $sp, -0x18
|
||||
/* 248C 8002708C 0080282D */ daddu $a1, $a0, $zero
|
||||
|
44
asm/nonmatchings/code_42e0_len_1f60/func_80029860.s
generated
44
asm/nonmatchings/code_42e0_len_1f60/func_80029860.s
generated
@ -1,44 +0,0 @@
|
||||
.set noat # allow manual use of $at
|
||||
.set noreorder # don't insert nops after branches
|
||||
|
||||
glabel func_80029860
|
||||
/* 4C60 80029860 27BDFFA0 */ addiu $sp, $sp, -0x60
|
||||
/* 4C64 80029864 AFB20050 */ sw $s2, 0x50($sp)
|
||||
/* 4C68 80029868 0080902D */ daddu $s2, $a0, $zero
|
||||
/* 4C6C 8002986C AFB40058 */ sw $s4, 0x58($sp)
|
||||
/* 4C70 80029870 00A0A02D */ daddu $s4, $a1, $zero
|
||||
/* 4C74 80029874 AFB30054 */ sw $s3, 0x54($sp)
|
||||
/* 4C78 80029878 00C0982D */ daddu $s3, $a2, $zero
|
||||
/* 4C7C 8002987C 0260282D */ daddu $a1, $s3, $zero
|
||||
/* 4C80 80029880 AFBF005C */ sw $ra, 0x5c($sp)
|
||||
/* 4C84 80029884 AFB1004C */ sw $s1, 0x4c($sp)
|
||||
/* 4C88 80029888 0C018614 */ jal osWritebackDCache
|
||||
/* 4C8C 8002988C AFB00048 */ sw $s0, 0x48($sp)
|
||||
/* 4C90 80029890 27B00028 */ addiu $s0, $sp, 0x28
|
||||
/* 4C94 80029894 0200202D */ daddu $a0, $s0, $zero
|
||||
/* 4C98 80029898 27B10040 */ addiu $s1, $sp, 0x40
|
||||
/* 4C9C 8002989C 0220282D */ daddu $a1, $s1, $zero
|
||||
/* 4CA0 800298A0 0C019560 */ jal osCreateMesgQueue
|
||||
/* 4CA4 800298A4 24060001 */ addiu $a2, $zero, 1
|
||||
/* 4CA8 800298A8 27A50010 */ addiu $a1, $sp, 0x10
|
||||
/* 4CAC 800298AC 3C04800A */ lui $a0, %hi(carthandle)
|
||||
/* 4CB0 800298B0 8C84A638 */ lw $a0, %lo(carthandle)($a0)
|
||||
/* 4CB4 800298B4 24060001 */ addiu $a2, $zero, 1
|
||||
/* 4CB8 800298B8 A3A00012 */ sb $zero, 0x12($sp)
|
||||
/* 4CBC 800298BC AFB00014 */ sw $s0, 0x14($sp)
|
||||
/* 4CC0 800298C0 AFB20018 */ sw $s2, 0x18($sp)
|
||||
/* 4CC4 800298C4 AFB4001C */ sw $s4, 0x1c($sp)
|
||||
/* 4CC8 800298C8 0C018388 */ jal osEPiStartDma
|
||||
/* 4CCC 800298CC AFB30020 */ sw $s3, 0x20($sp)
|
||||
/* 4CD0 800298D0 0200202D */ daddu $a0, $s0, $zero
|
||||
/* 4CD4 800298D4 0220282D */ daddu $a1, $s1, $zero
|
||||
/* 4CD8 800298D8 0C0195BC */ jal osRecvMesg
|
||||
/* 4CDC 800298DC 24060001 */ addiu $a2, $zero, 1
|
||||
/* 4CE0 800298E0 8FBF005C */ lw $ra, 0x5c($sp)
|
||||
/* 4CE4 800298E4 8FB40058 */ lw $s4, 0x58($sp)
|
||||
/* 4CE8 800298E8 8FB30054 */ lw $s3, 0x54($sp)
|
||||
/* 4CEC 800298EC 8FB20050 */ lw $s2, 0x50($sp)
|
||||
/* 4CF0 800298F0 8FB1004C */ lw $s1, 0x4c($sp)
|
||||
/* 4CF4 800298F4 8FB00048 */ lw $s0, 0x48($sp)
|
||||
/* 4CF8 800298F8 03E00008 */ jr $ra
|
||||
/* 4CFC 800298FC 27BD0060 */ addiu $sp, $sp, 0x60
|
10
configure.py
10
configure.py
@ -379,18 +379,20 @@ async def main():
|
||||
msg_files.extend(glob(d + "/**/*.msg", recursive=True))
|
||||
for msg_file in msg_files:
|
||||
n.build(
|
||||
f"$builddir/{msg_file}.bin",
|
||||
f"$builddir/{msg_file.split('/', 1)[1]}.bin",
|
||||
"msg",
|
||||
msg_file,
|
||||
implicit="tools/msg/parse_compile.py",
|
||||
)
|
||||
msg_headers = [add_generated_header(f"$builddir/include/{msg_file.split('/', 1)[1]}.h") for msg_file in msg_files]
|
||||
msg_bins = list(set([f"$builddir/{msg_file.split('/', 1)[1]}.bin" for msg_file in msg_files]))
|
||||
n.build(
|
||||
"$builddir/msg.bin",
|
||||
"msg_combine",
|
||||
[f"$builddir/{msg_file}.bin" for msg_file in msg_files],
|
||||
msg_bins,
|
||||
implicit="tools/msg/combine.py",
|
||||
implicit_outputs=[add_generated_header(f"$builddir/include/{msg_file.split('/', 1)[1]}.h") for msg_file in msg_files],
|
||||
variables={ "msg_combine_headers": [f"{msg_file}.h" for msg_file in msg_files] }
|
||||
implicit_outputs=msg_headers,
|
||||
variables={ "msg_combine_headers": msg_headers }
|
||||
)
|
||||
n.build("$builddir/msg.o", "bin", "$builddir/msg.bin")
|
||||
|
||||
|
@ -4,5 +4,5 @@ def apply(config, args):
|
||||
config['baseimg'] = 'baserom.z64'
|
||||
config['myimg'] = 'papermario.z64'
|
||||
config['mapfile'] = 'build/papermario.map'
|
||||
config['source_directories'] = ['.']
|
||||
config['source_directories'] = ['src', 'asm', 'include', 'assets']
|
||||
config['make_command'] = ['ninja']
|
||||
|
@ -38,6 +38,7 @@ void func_80070550(s32, f32, f32, f32, f32, f32, s32, s32);
|
||||
void func_802E263C(Entity* entity);
|
||||
|
||||
void step_game_loop(void);
|
||||
s32 resume_all_group(s32 groupFlags);
|
||||
|
||||
void create_shadow_callback(Shadow* entity);
|
||||
void func_802E10F4(Entity* entity);
|
||||
@ -176,7 +177,7 @@ void func_80137DA4(s32, f32);
|
||||
void func_80137DC0(s32, f32*, f32*);
|
||||
s32 func_80137E10(s32, u8, u8, u8);
|
||||
void func_80137E4C(s32, s32, s32, s32);
|
||||
s32 rand_int(s32);
|
||||
//s32 rand_int(s32);
|
||||
void sort_items(void);
|
||||
s32 is_ability_active(s32 arg0);
|
||||
f32 update_lerp(Easing easing, f32 start, f32 end, s32 elapsed, s32 duration);
|
||||
|
@ -1,8 +1,6 @@
|
||||
#include "common.h"
|
||||
#include "stdlib/stdarg.h"
|
||||
|
||||
extern const char D_80097D30[];
|
||||
|
||||
u32 func_80025D74(void* arg0, const unsigned char* str, s32 count);
|
||||
|
||||
void func_80025C60(void) {
|
||||
@ -81,7 +79,9 @@ u32 func_80025D74(void* arg0, const unsigned char* str, s32 count) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern const char D_80097D30[]; // "File:%s Line:%d %s \n\0\0\0"
|
||||
|
||||
void func_80025F44(char* arg0, char* file, s32 line, char* arg3) {
|
||||
func_80025CFC(&D_80097D30, file, line, arg0);
|
||||
func_80025CFC(D_80097D30, file, line, arg0);
|
||||
PANIC();
|
||||
}
|
||||
|
@ -110,7 +110,42 @@ void load_engine_data(void) {
|
||||
INCLUDE_ASM(s32, "code_1b40_len_20b0", load_engine_data);
|
||||
#endif
|
||||
|
||||
//weird ordering issue
|
||||
#ifdef NON_MATCHING
|
||||
void func_80027088(s32 arg0) {
|
||||
switch (arg0) {
|
||||
case 0:
|
||||
D_8009A5D8 = arg0;
|
||||
*D_8009A650 &= ~0xF00;
|
||||
resume_all_group(3);
|
||||
break;
|
||||
case 1:
|
||||
D_8009A5D8 = arg0;
|
||||
*D_8009A650 &= ~0xE00;
|
||||
*D_8009A650 |= 0x100;
|
||||
suspend_all_group(1);
|
||||
break;
|
||||
case 2:
|
||||
D_8009A5D8 = arg0;
|
||||
*D_8009A650 &= ~0xC00;
|
||||
*D_8009A650 |= 0x300;
|
||||
suspend_all_group(2);
|
||||
break;
|
||||
case 3:
|
||||
D_8009A5D8 = arg0;
|
||||
*D_8009A650 &= ~0x800;
|
||||
*D_8009A650 |= 0x700;
|
||||
suspend_all_group(2);
|
||||
break;
|
||||
case 4:
|
||||
D_8009A5D8 = arg0;
|
||||
*D_8009A650 |= 0xF00;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(void, "code_1b40_len_20b0", func_80027088, s32 arg0);
|
||||
#endif
|
||||
|
||||
s32 func_80027190(void) {
|
||||
return D_8009A5D8;
|
||||
|
@ -191,7 +191,23 @@ s32 func_800297D4(s32 romStart, s32 romEnd, void* vramDest) {
|
||||
return length;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(void, "code_42e0_len_1f60", func_80029860, s32 romStart, s32 vramDest, s32 length);
|
||||
void func_80029860(s32 dramAddr, s32 devAddr, s32 size) {
|
||||
OSIoMesg osIoMesg;
|
||||
OSMesg osMesg;
|
||||
OSMesgQueue osMesgQueue;
|
||||
|
||||
osWritebackDCache(dramAddr, size);
|
||||
osCreateMesgQueue(&osMesgQueue, &osMesg, 1);
|
||||
|
||||
osIoMesg.hdr.pri = 0;
|
||||
osIoMesg.hdr.retQueue = &osMesgQueue;
|
||||
osIoMesg.dramAddr = dramAddr;
|
||||
osIoMesg.devAddr = devAddr;
|
||||
osIoMesg.size = size;
|
||||
|
||||
osEPiStartDma(carthandle, &osIoMesg, 1);
|
||||
osRecvMesg(&osMesgQueue, &osMesg, 1);
|
||||
}
|
||||
|
||||
s32 _advance_rng(void) {
|
||||
s32* rngVal = &gRandSeed;
|
||||
@ -229,7 +245,31 @@ s32 func_80029994(s32 arg0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Issue with the negation at the beginning
|
||||
#ifdef NON_MATCHING
|
||||
s32 rand_int(s32 arg0) {
|
||||
s32 ret;
|
||||
|
||||
if (arg0 < 0) {
|
||||
arg0 = -arg0;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
if (arg0 != 0) {
|
||||
if (arg0 == 1) {
|
||||
return (func_80029994(1000) < 501) ^ 1;
|
||||
}
|
||||
if (arg0 != 100) {
|
||||
return func_80029994(arg0);
|
||||
}
|
||||
ret = func_80029994(1009) / 10;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(s32, "code_42e0_len_1f60", rand_int, s32 arg0);
|
||||
#endif
|
||||
|
||||
f32 signF(f32 val) {
|
||||
f32 sign;
|
||||
@ -348,8 +388,31 @@ f32 cos_deg(f32 angle) {
|
||||
|
||||
INCLUDE_ASM(f32, "code_42e0_len_1f60", update_lerp, Easing easing, f32 start, f32 end, s32 elapsed, s32 duration);
|
||||
|
||||
INCLUDE_ASM(s32, "code_42e0_len_1f60", func_8002A904);
|
||||
//void func_8002A904(u8 arg0, u8 arg1, u8 arg2, u8 arg3, u16 arg4, u16 arg5, u16 arg6, u16 arg7);
|
||||
INCLUDE_ASM(void, "code_42e0_len_1f60", func_8002A904, u8 arg0, u8 arg1, u8 arg2, u8 arg3, u16 arg4, u16 arg5, u16 arg6, u16 arg7);
|
||||
|
||||
INCLUDE_ASM(s32, "code_42e0_len_1f60", func_8002AAC4);
|
||||
// void func_8002AAC4(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u16 arg4, u16 arg5, u16 arg6, u16 arg7) {
|
||||
// s16 phi_t0;
|
||||
// s16 phi_t1;
|
||||
// s16 phi_t2;
|
||||
// s16 phi_t3;
|
||||
|
||||
// phi_t0 = arg0;
|
||||
// phi_t2 = arg2;
|
||||
// if (arg2 < arg0) {
|
||||
// phi_t0 = arg2;
|
||||
// phi_t2 = arg0;
|
||||
// }
|
||||
|
||||
// phi_t1 = arg1;
|
||||
// phi_t3 = arg3;
|
||||
// if (arg3 < arg1) {
|
||||
// phi_t1 = arg3;
|
||||
// phi_t3 = arg1;
|
||||
// }
|
||||
|
||||
// func_8002A904(arg4, arg5, arg6, arg7, phi_t0, phi_t1, phi_t2, phi_t3);
|
||||
// }
|
||||
|
||||
INCLUDE_ASM(s32, "code_42e0_len_1f60", func_8002AB5C);
|
||||
|
@ -1,7 +0,0 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "os/code_7e40_len_3f0", nuGfxTaskMgr);
|
||||
|
||||
INCLUDE_ASM(s32, "os/code_7e40_len_3f0", nuGfxTaskMgrInit);
|
||||
|
||||
INCLUDE_ASM(s32, "os/code_7e40_len_3f0", nuGfxTaskStart);
|
7
src/os/nusys/code_7e40_len_3f0.c
Normal file
7
src/os/nusys/code_7e40_len_3f0.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "os/nusys/code_7e40_len_3f0", nuGfxTaskMgr);
|
||||
|
||||
INCLUDE_ASM(s32, "os/nusys/code_7e40_len_3f0", nuGfxTaskMgrInit);
|
||||
|
||||
INCLUDE_ASM(s32, "os/nusys/code_7e40_len_3f0", nuGfxTaskStart);
|
@ -1,6 +1,19 @@
|
||||
#include "common.h"
|
||||
#include "nu/nusys.h"
|
||||
|
||||
s32 contRmbRetrace(NUSiCommonMesg* mesg);
|
||||
s32 contRmbCheckMesg(NUSiCommonMesg* mesg);
|
||||
s32 contRmbStartMesg(NUSiCommonMesg* mesg);
|
||||
s32 contRmbStopMesg(NUSiCommonMesg* mesg);
|
||||
s32 contRmbForceStopMesg(NUSiCommonMesg* mesg);
|
||||
s32 contRmbForceStopEndMesg(NUSiCommonMesg* mesg);
|
||||
|
||||
u32 nuContRmbSearchTime = 300;
|
||||
|
||||
s32 D_80093CE4[] = { contRmbRetrace, contRmbCheckMesg, contRmbStartMesg, contRmbStopMesg, contRmbForceStopMesg, contRmbForceStopEndMesg, NULL};
|
||||
|
||||
NUCallBackList nuContRmbCallBack = {.next = NULL, .func = D_80093CE4, .majorNo = 0x300, .funcNum = 0};
|
||||
|
||||
s32 contRmbControl(NUContRmbCtl* rmbCtl, u32 contNo) {
|
||||
s32 ret = 0;
|
||||
u32 cnt;
|
||||
@ -93,8 +106,6 @@ s32 contRmbRetrace(NUSiCommonMesg* mesg) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// Will match when data is decompiled.
|
||||
void nuContRmbMgrInit(void) {
|
||||
u32 i;
|
||||
|
||||
@ -106,9 +117,6 @@ void nuContRmbMgrInit(void) {
|
||||
|
||||
nuSiCallBackAdd(&nuContRmbCallBack);
|
||||
}
|
||||
#else
|
||||
INCLUDE_ASM(void, "os/nusys/nuContRmbMgr", nuContRmbMgrInit);
|
||||
#endif
|
||||
|
||||
void nuContRmbMgrRemove(void) {
|
||||
nuSiCallBackRemove(&nuContRmbCallBack);
|
||||
|
@ -41,7 +41,7 @@ segments:
|
||||
- [0x6240, c, code_6240_len_c00]
|
||||
- [0x6e40, c, code_6e40_len_500]
|
||||
- [0x7340, c, code_7340_len_b00]
|
||||
- [0x7e40, c, os/code_7e40_len_3f0]
|
||||
- [0x7e40, c, os/nusys/code_7e40_len_3f0]
|
||||
- [0x8230, c, os/nusys/nuSiMgr]
|
||||
- [0x8560, c]
|
||||
- [0x8800, c]
|
||||
@ -242,9 +242,12 @@ segments:
|
||||
- [0x542E0, data, code_31650]
|
||||
- [0x6B450, .data, world/world]
|
||||
- [0x6EAC0, data] # has scripts
|
||||
- [0x6F0E0, .data, os/nusys/nuContRmbMgr]
|
||||
- [0x6F110, data] # has scripts?
|
||||
- [0x70E30, .data, battle/battle]
|
||||
- [0x71430, data]
|
||||
- [0x73130, rodata]
|
||||
- [0x73130, rodata, code_1060_len_310]
|
||||
- [0x73148, .rodata, code_1b40_len_20b0]
|
||||
- [0x73160, .rodata, code_42e0_len_1f60]
|
||||
- [0x73200, rodata]
|
||||
- [0x73DA0, .rodata, world/world]
|
||||
|
Loading…
Reference in New Issue
Block a user