diff options
author | Treeki <treeki@gmail.com> | 2013-01-31 04:17:37 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2013-01-31 04:17:37 +0100 |
commit | b9f9eeb73d6e3f4ebbd5d45c5997f73478425779 (patch) | |
tree | 4f25550df84b7cb77601c699d7ce4d4858a2f9f9 /src | |
parent | 26f0eac040ac5cdbd2dd57ef8fb56c54066f40d1 (diff) | |
download | kamek-b9f9eeb73d6e3f4ebbd5d45c5997f73478425779.tar.gz kamek-b9f9eeb73d6e3f4ebbd5d45c5997f73478425779.zip |
add replays as an on/off thing
Diffstat (limited to 'src')
-rw-r--r-- | src/koopatlas/starcoin.cpp | 12 | ||||
-rw-r--r-- | src/replay.S | 71 |
2 files changed, 73 insertions, 10 deletions
diff --git a/src/koopatlas/starcoin.cpp b/src/koopatlas/starcoin.cpp index a0def97..a7a019a 100644 --- a/src/koopatlas/starcoin.cpp +++ b/src/koopatlas/starcoin.cpp @@ -373,6 +373,7 @@ static const int secretCode[] = { static const int secretCodeButtons = WPAD_UP|WPAD_DOWN|WPAD_LEFT|WPAD_RIGHT|WPAD_ONE|WPAD_TWO; static int secretCodeIndex = 0; extern bool enableDebugMode; +extern u8 isReplayEnabled; void dWMStarCoin_c::beginState_ShowWait() { visible = true; @@ -413,8 +414,15 @@ void dWMStarCoin_c::executeState_Wait() { if (secretCode[secretCodeIndex] == 0) { secretCodeIndex = 0; MapSoundPlayer(SoundRelatedClass, SE_VOC_MA_THANK_YOU, 1); - enableDebugMode = !enableDebugMode; - OSReport("Debug mode toggled!\n"); + //enableDebugMode = !enableDebugMode; + //OSReport("Debug mode toggled!\n"); + if (isReplayEnabled != 100) { + isReplayEnabled = 100; + OSReport("Replay Recording enabled!\n"); + } else { + isReplayEnabled = 0; + OSReport("Replay Recording disabled!\n"); + } } return; } else { diff --git a/src/replay.S b/src/replay.S index 89868cf..b4345dc 100644 --- a/src/replay.S +++ b/src/replay.S @@ -1,5 +1,7 @@ # Fucking Nintendo, how do they work +.extern isReplayEnabled + .extern IOS_Open .extern IOS_Close .extern IOS_Read @@ -34,6 +36,8 @@ .extern WiimotePtr1 .extern Player_ID .extern RandomSeed +.extern dontSkipReplayPrepare +.extern doSkipReplayPrepare .set sp, 1 @@ -46,14 +50,14 @@ .global replayEnd .global replayRecord -.global luigiOverride -luigiOverride: - #blr - lis r3, Player_ID@h - ori r3, r3, Player_ID@l - li r4, 1 - stw r4, 0(r3) - blr +#.global luigiOverride +#luigiOverride: +# #blr +# lis r3, Player_ID@h +# ori r3, r3, Player_ID@l +# li r4, 1 +# stw r4, 0(r3) +# blr .global getAndSaveRandomSeed getAndSaveRandomSeed: # b from 8091F930 @@ -77,6 +81,12 @@ getAndSaveRandomSeed: # b from 8091F930 replayStart: # b from 809246E0 + lis r3, isReplayEnabled@h + ori r3, r3, isReplayEnabled@l + lbz r3, 0(r3) + cmpwi r3, 100 + bne justSkipReplayStart + bl OSGetTime lis r5, replayTime@h ori r5, r5, replayTime@l @@ -262,6 +272,7 @@ startNextReplay: blt replayStartLoop # and done! +justSkipReplayStart: li r3, 1 b continueFromReplayHookStart # 809246E4 @@ -387,6 +398,12 @@ done_flag_8: replayEnd: # bl from 80102238 + lis r4, isReplayEnabled@h + ori r4, r4, isReplayEnabled@l + lbz r4, 0(r4) + cmpwi r4, 100 + bnelr + stwu sp, -0x20(sp) mflr r0 stw r0, 0x24(sp) @@ -490,6 +507,12 @@ justLeave: replayRecord: + lis r3, isReplayEnabled@h + ori r3, r3, isReplayEnabled@l + lbz r3, 0(r3) + cmpwi r3, 100 + bnelr + # fun shit. stwu sp, -0x10(sp) mflr r0 @@ -656,6 +679,38 @@ leaveRecordLoop: blr + +.global ChooseReplayStateIfNeeded +ChooseReplayStateIfNeeded: + lis r5, isReplayEnabled@h + ori r5, r5, isReplayEnabled@l + lbz r5, 0(r5) + cmpwi r5, 100 + beq useReplayState + lis r4, Crsin_EffectResWaitProc@h + ori r4, r4, Crsin_EffectResWaitProc@l + blr +useReplayState: + lis r4, Crsin_ReplayResWaitProc@h + ori r4, r4, Crsin_ReplayResWaitProc@l + blr + +.extern Crsin_EffectResWaitProc +.extern Crsin_ReplayResWaitProc + +.global SkipReplayPrepareIfNeeded +SkipReplayPrepareIfNeeded: + mr r24, r3 + lis r5, isReplayEnabled@h + ori r5, r5, isReplayEnabled@l + lbz r5, 0(r5) + cmpwi r5, 100 + beq yesSkipIt + b dontSkipReplayPrepare +yesSkipIt: + b doSkipReplayPrepare + + .data replayFlags: .short 1, 1, 1, 1 |