From 22ceb9893ba02ac2b046044e2bb07a725d89fcb0 Mon Sep 17 00:00:00 2001 From: sup39 Date: Wed, 2 Nov 2022 21:37:04 +0900 Subject: [PATCH] add ResetTRailBlockPosition --- NTSC-J 1.0/ResetTRailBlockPosition.txt | 18 ++++++++++ src/ResetTRailBlockPosition.ld | 2 ++ src/ResetTRailBlockPosition.s | 50 ++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 NTSC-J 1.0/ResetTRailBlockPosition.txt create mode 100644 src/ResetTRailBlockPosition.ld create mode 100644 src/ResetTRailBlockPosition.s diff --git a/NTSC-J 1.0/ResetTRailBlockPosition.txt b/NTSC-J 1.0/ResetTRailBlockPosition.txt new file mode 100644 index 0000000..93351f6 --- /dev/null +++ b/NTSC-J 1.0/ResetTRailBlockPosition.txt @@ -0,0 +1,18 @@ +$ Reset TRailBlock Position (v0.1, 2022/11/02) [sup39] +C21C7E48 00000010 +3C808040 A0840D50 +28040022 40A20068 +7FC3F378 81830000 +818C0168 7D8803A6 +4E800021 E0030118 +F003015C F0030168 +80030120 90030164 +90030170 387E0174 +3D808009 618C42B0 +7D8803A6 4E800021 +807E0138 80830004 +1C840044 38840008 +80630000 80630004 +7C63202E 5460D7BC +901E0140 800101B4 +60000000 00000000 diff --git a/src/ResetTRailBlockPosition.ld b/src/ResetTRailBlockPosition.ld new file mode 100644 index 0000000..e1a0003 --- /dev/null +++ b/src/ResetTRailBlockPosition.ld @@ -0,0 +1,2 @@ +$$ = 0; +$C2$.control = 0x801c7e48; diff --git a/src/ResetTRailBlockPosition.s b/src/ResetTRailBlockPosition.s new file mode 100644 index 0000000..919afeb --- /dev/null +++ b/src/ResetTRailBlockPosition.s @@ -0,0 +1,50 @@ +.include "./macros.s" + +.set $btn, 0x22 # R+Right +.set btn, mPadStatus + +.control: +## check button + lis r4, btn@ha + lhz r4, btn@l(r4) + cmplwi r4, $btn + bne+ .done +## resetPosition + mr r3, r30 + lwz r12, 0(r3) # vt + lwz r12, 0x168(r12) # resetPosition + mtlr r12 + blrl +## reset mtx + #lfs f1, 0x118(r30) + #lfs f2, 0x11c(r30) + #lfs f3, 0x120(r30) + psq_l f0, 0x118(r3), 0, gqr0 + psq_st f0, 0x15C(r3), 0, gqr0 + psq_st f0, 0x168(r3), 0, gqr0 + lwz r0, 0x120(r3) + stw r0, 0x164(r3) + stw r0, 0x170(r3) + addi r3, r30, 0x174 + li32 r12, PSMTXIdentity + mtlr r12 + blrl +## set x140 flag +### r3 = graph + lwz r3, 0x138(r30) +### r4 = (cur index)*0x44 + 8 + lwz r4, 0x4(r3) + mulli r4, r4, 0x44 + addi r4, r4, 8 +### r3 = web + lwz r3, 0(r3) +### r3 = &railnode[0] + lwz r3, 4(r3) +### r3 = node flag + lwzx r3, r3, r4 +### r0 = r3&128 ? 2 : 0 + rlwinm r0, r3, 32-6, 0x2 + stw r0, 0x140(r30) +.done: +## orig + lwz r0, 0x1b4(r1)