From 85a88d5e7c42dd2289991a20a54e80859cb99c86 Mon Sep 17 00:00:00 2001 From: sup39 Date: Fri, 14 Oct 2022 18:48:16 +0900 Subject: [PATCH] add InstantShineSelect --- NTSC-J 1.0/InstantShineSelect.txt | 19 ++++++++ src/InstantShineSelect.ld | 3 ++ src/InstantShineSelect.s | 81 +++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 NTSC-J 1.0/InstantShineSelect.txt create mode 100644 src/InstantShineSelect.ld create mode 100644 src/InstantShineSelect.s diff --git a/NTSC-J 1.0/InstantShineSelect.txt b/NTSC-J 1.0/InstantShineSelect.txt new file mode 100644 index 0000000..a2d4005 --- /dev/null +++ b/NTSC-J 1.0/InstantShineSelect.txt @@ -0,0 +1,19 @@ +$ Instant Shine Select (2022/10/14) [sup39] +C20EC424 00000011 +3CA08040 80A50D80 +28050801 40A20074 +3C60817F 38A00001 +98A300B3 98A30100 +3CA0803E 8D85600E +3C60803B 386340E8 +7C6360AE 38030001 +5400EFFE 7C630214 +5463442E 606300FF +B0650004 806D97D0 +38000000 900300DC +7FE3FB78 3D80800F +398CAB40 7D8803A6 +4E800021 3B800009 +3D80800F 398CCB28 +7D8803A6 4E800020 +2800000C 00000000 diff --git a/src/InstantShineSelect.ld b/src/InstantShineSelect.ld new file mode 100644 index 0000000..7201171 --- /dev/null +++ b/src/InstantShineSelect.ld @@ -0,0 +1,3 @@ +$$ = 0; +$C2$.Mar.changeState = 32 + TMarDirector.changeState; +.Mar.changeState.applied = 1828 + TMarDirector.changeState; diff --git a/src/InstantShineSelect.s b/src/InstantShineSelect.s new file mode 100644 index 0000000..203bf79 --- /dev/null +++ b/src/InstantShineSelect.s @@ -0,0 +1,81 @@ +.set btn, 0x801 + +.Mar.changeState: +## read button input: [M]*1 [C]*1 [btn]*2 + lis r5, JUTGamePad.mPadButton@ha + lwz r5, JUTGamePad.mPadButton@l(r5) + cmplwi r5, btn + bne+ .Mar.changeState.notActivated +## reset QFT + lis r3, 0x817F + li r5, 0x1 + stb r5, 0xB3(r3) + stb r5, 0x100(r3) +## set next area + lis r5, gpApplication+0xE@ha + ## r12=curArea, r5=&curArea + lbzu r12, gpApplication+0xE@l(r5) + lis r3, System.shineStageTable@ha + la r3, System.shineStageTable@l(r3) + lbzx r3, r3, r12 + ## +1 for >=7 + addi r0, r3, 1 + rlwinm r0, r0, 32-3, 0x1 + add r3, r3, r0 + ## <<8 as area, ep=0xff + rlwinm r3, r3, 8, 0x10, 0x17 + ori r3, r3, 0xff + ## r3=shineArea, r5+4=&nextArea + sth r3, 4(r5) +## reset coin counter + lwz r3, TFlagManager.smInstance$r13(r13) + li r0, 0 + stw r0, 0xDC(r3) +## moveStage + mr r3, r31 + lis r12, TMarDirector.moveStage@ha + la r12, TMarDirector.moveStage@l(r12) + mtlr r12 + blrl + li r28, 9 # nextState = LevelTransition + lis r12, .Mar.changeState.applied@ha + la r12, .Mar.changeState.applied@l(r12) + mtlr r12 + blr + +.Mar.changeState.notActivated: + cmplwi r0, 0xc + +#.TMarDirector.updateGameMode: +## check input +# lis r3, aInput@ha +# lhz r5, aInput@l(r3) +# cmplwi r5, btn +# bne+ .L_done +## reset QFT +# lis r3, 0x817F +# li r5, 0x1 +# stb r5, 0xB3(r3) +# stb r5, 0x100(r3) +## set next area +# lis r5, aArea@ha +# ## r12=curArea, r5=&curArea +# lbzu r12, aArea@l(r5) +# lis r3, System.shineStageTable@ha +# la r3, System.shineStageTable@l(r3) +# lbzx r3, r3, r12 +# rlwinm r3, r3, 8, 0x10, 0x17 # <<8 +# ori r3, r3, 0xff +# ## r3=shineArea, r5+4=&nextArea +# stw r3, 4(r5) +## set curArea to 0x40 to force reset coin counter +# li r3, 0x40 +# stw r3, 0(r5) +## b moveStage +# lis r3, aBL@h +# ori r3, r3, aBL@l +# mtlr r3 +# blr +#.L_done: +## original instruction +# cmpwi r0, 0x2