summaryrefslogtreecommitdiff
path: root/src/fileselect.S
diff options
context:
space:
mode:
Diffstat (limited to 'src/fileselect.S')
-rw-r--r--src/fileselect.S53
1 files changed, 51 insertions, 2 deletions
diff --git a/src/fileselect.S b/src/fileselect.S
index 8e9249e..a10a474 100644
--- a/src/fileselect.S
+++ b/src/fileselect.S
@@ -263,7 +263,54 @@ DSFICopyLoop:
blt DSFICopyLoop
blr
-.align 4
+.extern SaveFileInstance
+.extern SaveFileBuffer
+.extern GetBlock__8SaveFileFi
+.global FixUpExistingSavefile
+FixUpExistingSavefile:
+ stwu r1, -0x10(r1)
+ mflr r0
+ stw r0, 0x14(r1)
+ stw r31, 0xC(r1)
+
+ li r31, 0
+fixupNextBlock:
+ lis r3, SaveFileInstance@h
+ ori r3, r3, SaveFileInstance@l
+ lwz r3, 0(r3)
+ mr r4, r31
+ bl GetBlock__8SaveFileFi
+
+ lbz r4, 2(r3)
+ clrlwi. r4, r4, 31
+ beq dontFixThisOne
+ bl DefaultSavefileInfo
+dontFixThisOne:
+
+ lis r3, SaveFileBuffer@h
+ ori r3, r3, SaveFileBuffer@l
+ addi r3, r3, 0x6A0
+ mulli r4, r31, 0x980
+ add r3, r3, r4
+ lbz r4, 2(r3)
+ clrlwi. r4, r4, 31
+ beq dontFixThisOne2
+ bl DefaultSavefileInfo
+dontFixThisOne2:
+
+ addi r31, r31, 1
+ cmpwi r31, 6
+ blt fixupNextBlock
+
+ lwz r31, 0xC(r1)
+ lwz r0, 0x14(r1)
+ mtlr r0
+ addi r1, r1, 0x10
+ blr
+
+
+#.section .ctors,4
+#.long FixUpExistingSavefile
.data
FSStateDebugStr: .string "State: %s\n"
@@ -305,8 +352,10 @@ DefaultSavefileInfoData:
.long 0xFFFF99FF,0x1FB423FF
.long 0x173714FF,0x3C9135FF
.long 0xFFFF99FF,0x1FB423FF
-.short 0x75,0x2E,0xB
+.short 0x75
+.byte 0x2E,0xB
.byte 0,1
+.byte 0,0
DefaultSavefileInfoDataEnd:
.long 0