diff options
author | Treeki <treeki@gmail.com> | 2012-10-01 04:23:06 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-10-01 04:23:06 +0200 |
commit | c6c8bdfaf7c5462104290154f815a11f32a6b7cc (patch) | |
tree | 213e3b01b37f388e116858e63fa2e748c7c592a1 /src/fileselect.S | |
parent | 1db72b5e45cc25eb183817f05a2ee631d8fff837 (diff) | |
download | kamek-c6c8bdfaf7c5462104290154f815a11f32a6b7cc.tar.gz kamek-c6c8bdfaf7c5462104290154f815a11f32a6b7cc.zip |
fuck I have spent SO LONG on fixing this bug
Diffstat (limited to '')
-rw-r--r-- | src/fileselect.S | 53 |
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 |