From eb4ea01b3e0303fa66b6ecb36f4ef38ef23dcb5e Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Tue, 9 Feb 2021 03:20:27 +0900 Subject: [PATCH] cleanup --- .../os/nusys/code_3B4A0/nuContRmbForceStop.s | 12 -------- .../nusys/code_3B4A0/nuContRmbForceStopEnd.s | 12 -------- .../os/nusys/nuContRmbMgr/nuContRmbMgrInit.s | 29 ------------------- .../{nuGfxThread.s => nuGfxThread2.s} | 2 +- .../os/nusys/nuGfxThread/nuGfxThreadStart.s | 4 +-- src/os/nusys/code_3B4A0.c | 11 +++++-- src/os/nusys/nuGfxThread.c | 13 +++++++-- tools/m2ctx.py | 2 +- tools/symbol_addrs.txt | 2 +- 9 files changed, 24 insertions(+), 63 deletions(-) delete mode 100644 asm/nonmatchings/os/nusys/code_3B4A0/nuContRmbForceStop.s delete mode 100644 asm/nonmatchings/os/nusys/code_3B4A0/nuContRmbForceStopEnd.s delete mode 100644 asm/nonmatchings/os/nusys/nuContRmbMgr/nuContRmbMgrInit.s rename asm/nonmatchings/os/nusys/nuGfxThread/{nuGfxThread.s => nuGfxThread2.s} (99%) diff --git a/asm/nonmatchings/os/nusys/code_3B4A0/nuContRmbForceStop.s b/asm/nonmatchings/os/nusys/code_3B4A0/nuContRmbForceStop.s deleted file mode 100644 index 019133c2c1..0000000000 --- a/asm/nonmatchings/os/nusys/code_3B4A0/nuContRmbForceStop.s +++ /dev/null @@ -1,12 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel nuContRmbForceStop -/* 3B4A0 800600A0 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 3B4A4 800600A4 24040304 */ addiu $a0, $zero, 0x304 -/* 3B4A8 800600A8 AFBF0010 */ sw $ra, 0x10($sp) -/* 3B4AC 800600AC 0C00B3CA */ jal nuSiSendMesg -/* 3B4B0 800600B0 0000282D */ daddu $a1, $zero, $zero -/* 3B4B4 800600B4 8FBF0010 */ lw $ra, 0x10($sp) -/* 3B4B8 800600B8 03E00008 */ jr $ra -/* 3B4BC 800600BC 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/os/nusys/code_3B4A0/nuContRmbForceStopEnd.s b/asm/nonmatchings/os/nusys/code_3B4A0/nuContRmbForceStopEnd.s deleted file mode 100644 index 767887e1f8..0000000000 --- a/asm/nonmatchings/os/nusys/code_3B4A0/nuContRmbForceStopEnd.s +++ /dev/null @@ -1,12 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel nuContRmbForceStopEnd -/* 3B4C0 800600C0 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 3B4C4 800600C4 24040305 */ addiu $a0, $zero, 0x305 -/* 3B4C8 800600C8 AFBF0010 */ sw $ra, 0x10($sp) -/* 3B4CC 800600CC 0C00B3CA */ jal nuSiSendMesg -/* 3B4D0 800600D0 0000282D */ daddu $a1, $zero, $zero -/* 3B4D4 800600D4 8FBF0010 */ lw $ra, 0x10($sp) -/* 3B4D8 800600D8 03E00008 */ jr $ra -/* 3B4DC 800600DC 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/os/nusys/nuContRmbMgr/nuContRmbMgrInit.s b/asm/nonmatchings/os/nusys/nuContRmbMgr/nuContRmbMgrInit.s deleted file mode 100644 index 501fb72843..0000000000 --- a/asm/nonmatchings/os/nusys/nuContRmbMgr/nuContRmbMgrInit.s +++ /dev/null @@ -1,29 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel nuContRmbMgrInit -/* 3B08C 8005FC8C 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 3B090 8005FC90 AFBF0010 */ sw $ra, 0x10($sp) -/* 3B094 8005FC94 0000202D */ daddu $a0, $zero, $zero -/* 3B098 8005FC98 24050002 */ addiu $a1, $zero, 2 -/* 3B09C 8005FC9C 0080182D */ daddu $v1, $a0, $zero -.L8005FCA0: -/* 3B0A0 8005FCA0 3C01800B */ lui $at, 0x800b -/* 3B0A4 8005FCA4 00230821 */ addu $at, $at, $v1 -/* 3B0A8 8005FCA8 A0251D46 */ sb $a1, 0x1d46($at) -/* 3B0AC 8005FCAC 3C01800B */ lui $at, 0x800b -/* 3B0B0 8005FCB0 00230821 */ addu $at, $at, $v1 -/* 3B0B4 8005FCB4 A0201D47 */ sb $zero, 0x1d47($at) -/* 3B0B8 8005FCB8 3C01800B */ lui $at, 0x800b -/* 3B0BC 8005FCBC 00230821 */ addu $at, $at, $v1 -/* 3B0C0 8005FCC0 A4241D44 */ sh $a0, 0x1d44($at) -/* 3B0C4 8005FCC4 24840001 */ addiu $a0, $a0, 1 -/* 3B0C8 8005FCC8 2C820004 */ sltiu $v0, $a0, 4 -/* 3B0CC 8005FCCC 1440FFF4 */ bnez $v0, .L8005FCA0 -/* 3B0D0 8005FCD0 2463000A */ addiu $v1, $v1, 0xa -/* 3B0D4 8005FCD4 3C048009 */ lui $a0, %hi(nuContRmbCallBack) -/* 3B0D8 8005FCD8 0C0180FC */ jal nuSiCallBackAdd -/* 3B0DC 8005FCDC 24843D00 */ addiu $a0, $a0, %lo(nuContRmbCallBack) -/* 3B0E0 8005FCE0 8FBF0010 */ lw $ra, 0x10($sp) -/* 3B0E4 8005FCE4 03E00008 */ jr $ra -/* 3B0E8 8005FCE8 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/os/nusys/nuGfxThread/nuGfxThread.s b/asm/nonmatchings/os/nusys/nuGfxThread/nuGfxThread2.s similarity index 99% rename from asm/nonmatchings/os/nusys/nuGfxThread/nuGfxThread.s rename to asm/nonmatchings/os/nusys/nuGfxThread/nuGfxThread2.s index 59f2f20ab2..d656ea144f 100644 --- a/asm/nonmatchings/os/nusys/nuGfxThread/nuGfxThread.s +++ b/asm/nonmatchings/os/nusys/nuGfxThread/nuGfxThread2.s @@ -1,7 +1,7 @@ .set noat # allow manual use of $at .set noreorder # don't insert nops after branches -glabel nuGfxThread +glabel nuGfxThread2 /* 3B648 80060248 27BDFFC8 */ addiu $sp, $sp, -0x38 /* 3B64C 8006024C AFB00028 */ sw $s0, 0x28($sp) /* 3B650 80060250 3C10800B */ lui $s0, %hi(D_800B42F0) diff --git a/asm/nonmatchings/os/nusys/nuGfxThread/nuGfxThreadStart.s b/asm/nonmatchings/os/nusys/nuGfxThread/nuGfxThreadStart.s index 23a0118128..9580de2f7a 100644 --- a/asm/nonmatchings/os/nusys/nuGfxThread/nuGfxThreadStart.s +++ b/asm/nonmatchings/os/nusys/nuGfxThread/nuGfxThreadStart.s @@ -12,8 +12,8 @@ glabel nuGfxThreadStart /* 3B60C 8006020C AFA20010 */ sw $v0, 0x10($sp) /* 3B610 80060210 24020032 */ addiu $v0, $zero, 0x32 /* 3B614 80060214 24050004 */ addiu $a1, $zero, 4 -/* 3B618 80060218 3C068006 */ lui $a2, %hi(nuGfxThread) -/* 3B61C 8006021C 24C60248 */ addiu $a2, $a2, %lo(nuGfxThread) +/* 3B618 80060218 3C068006 */ lui $a2, %hi(nuGfxThread2) +/* 3B61C 8006021C 24C60248 */ addiu $a2, $a2, %lo(nuGfxThread2) /* 3B620 80060220 0000382D */ daddu $a3, $zero, $zero /* 3B624 80060224 AFBF001C */ sw $ra, 0x1c($sp) /* 3B628 80060228 0C019798 */ jal osCreateThread diff --git a/src/os/nusys/code_3B4A0.c b/src/os/nusys/code_3B4A0.c index a89294ebbe..91ac185c0c 100644 --- a/src/os/nusys/code_3B4A0.c +++ b/src/os/nusys/code_3B4A0.c @@ -1,7 +1,12 @@ #include "common.h" +#include "nu/nusys.h" -INCLUDE_ASM(s32, "os/nusys/code_3B4A0", nuContRmbForceStop); +void nuContRmbForceStop(void) { + nuSiSendMesg(NU_CONT_RMB_FORCESTOP_MSG, NULL); +} -INCLUDE_ASM(s32, "os/nusys/code_3B4A0", nuContRmbForceStopEnd); +void nuContRmbForceStopEnd(void) { + nuSiSendMesg(NU_CONT_RMB_FORCESTOPEND_MSG, NULL); +} -INCLUDE_ASM(s32, "os/nusys/code_3B4A0", nuPiReadRomOverlay); +INCLUDE_ASM(void, "os/nusys/code_3B4A0", nuPiReadRomOverlay, NUPiOverlaySegment* segment); diff --git a/src/os/nusys/nuGfxThread.c b/src/os/nusys/nuGfxThread.c index eaa6d8a345..c9233554d4 100644 --- a/src/os/nusys/nuGfxThread.c +++ b/src/os/nusys/nuGfxThread.c @@ -1,5 +1,14 @@ #include "common.h" +#include "nu/nusys.h" -INCLUDE_ASM(s32, "os/nusys/nuGfxThread", nuGfxThreadStart); +void nuGfxThread2(void); -INCLUDE_ASM(s32, "os/nusys/nuGfxThread", nuGfxThread); +extern s32 D_800AE6D0; +extern OSThread D_800B1B90; + +void nuGfxThreadStart(void) { + osCreateThread(&D_800B1B90, 4, nuGfxThread2, NULL, &D_800AE6D0, NU_GFX_THREAD_PRI); + osStartThread(&D_800B1B90); +} + +INCLUDE_ASM(void, "os/nusys/nuGfxThread", nuGfxThread2); diff --git a/tools/m2ctx.py b/tools/m2ctx.py index 59821b9c5c..d77e76447b 100755 --- a/tools/m2ctx.py +++ b/tools/m2ctx.py @@ -26,7 +26,7 @@ def get_c_file(directory): def import_c_file(in_file): in_file = os.path.relpath(in_file, root_dir) - cpp_command = ["gcc", "-E", "-P", "-Iinclude", "-Isrc", "-D_LANGUAGE_C", "-ffreestanding", "-DF3DEX_GBI_2", in_file] + cpp_command = ["gcc", "-E", "-P", "-Iinclude", "-Isrc", "-Ibuild/include" ,"-D_LANGUAGE_C", "-ffreestanding", "-DF3DEX_GBI_2", in_file] try: return subprocess.check_output(cpp_command, cwd=root_dir, encoding="utf-8") except subprocess.CalledProcessError: diff --git a/tools/symbol_addrs.txt b/tools/symbol_addrs.txt index 2daca346a4..1c9bc61972 100644 --- a/tools/symbol_addrs.txt +++ b/tools/symbol_addrs.txt @@ -324,7 +324,7 @@ nuContRmbForceStop = 0x800600A0; // type:func rom:0x3B4A0 nuContRmbForceStopEnd = 0x800600C0; // type:func rom:0x3B4C0 nuPiReadRomOverlay = 0x800600E0; // type:func rom:0x3B4E0 nuGfxThreadStart = 0x800601F0; // type:func rom:0x3B5F0 -nuGfxThread = 0x80060248; // type:func rom:0x3B648 +nuGfxThread2 = 0x80060248; // type:func rom:0x3B648 nuGfxSwapCfbFuncSet = 0x80060310; // type:func rom:0x3B710 nuGfxSwapCfb = 0x80060350; // type:func rom:0x3B750 nuGfxRetraceWait = 0x80060370; // type:func rom:0x3B770