summaryrefslogtreecommitdiff
path: root/src/replay.S
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2013-01-31 04:17:37 +0100
committerTreeki <treeki@gmail.com>2013-01-31 04:17:37 +0100
commitb9f9eeb73d6e3f4ebbd5d45c5997f73478425779 (patch)
tree4f25550df84b7cb77601c699d7ce4d4858a2f9f9 /src/replay.S
parent26f0eac040ac5cdbd2dd57ef8fb56c54066f40d1 (diff)
downloadkamek-b9f9eeb73d6e3f4ebbd5d45c5997f73478425779.tar.gz
kamek-b9f9eeb73d6e3f4ebbd5d45c5997f73478425779.zip
add replays as an on/off thing
Diffstat (limited to 'src/replay.S')
-rw-r--r--src/replay.S71
1 files changed, 63 insertions, 8 deletions
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