diff options
-rw-r--r-- | fileselect.yaml | 1 | ||||
-rwxr-xr-x | include/game.h | 12 | ||||
-rw-r--r-- | kamek_pal.x | 1 | ||||
-rw-r--r-- | src/fileselect.S | 53 |
4 files changed, 61 insertions, 6 deletions
diff --git a/fileselect.yaml b/fileselect.yaml index eb8c107..67bc621 100644 --- a/fileselect.yaml +++ b/fileselect.yaml @@ -148,6 +148,7 @@ hooks: - {name: DFNiceWorldName, type: branch_insn, branch_type: bl, src_addr_pal: 0x8077DA10, target_func: 'DFNiceWorldName'} - {name: DefaultSavefileInfo, type: branch_insn, branch_type: b, src_addr_pal: 0x800CE100, target_func: 'DefaultSavefileInfo'} + - {name: FixUpExistingSavefile, type: branch_insn, branch_type: b, src_addr_pal: 0x800CF900, target_func: 'FixUpExistingSavefile'} # - {name: FSDebugStates, type: add_func_pointer, src_addr_pal: 0x80943E38, target_func: 'FSDebugStates'} diff --git a/include/game.h b/include/game.h index 91dd77a..1e0c484 100755 --- a/include/game.h +++ b/include/game.h @@ -170,7 +170,7 @@ bool IsWideScreen(); // All of these are set by "SetWorldCompleteionBitfield" (I didn't name it)
// at 801028D0. It's called by ScStage so it doesn't depend on Nintendo maps.
-#define SAVE_BIT_EXISTS_MAYBE 1
+#define SAVE_BIT_NEW 1
// Controls whether you can QUICK SAVE or not.
// Set if 8-Castle is complete.
@@ -190,6 +190,8 @@ bool IsWideScreen(); // Set when, well... EVERYTHING is done.
#define SAVE_BIT_EVERYTHING_TRULY_DONE 0x20
+#define SAVE_BIT_NO_SUPER_GUIDE 0x40
+
class SaveFirstBlock {
public:
@@ -243,9 +245,11 @@ public: GXColor fsTextColours[2]; // 0x720
GXColor fsHintColours[2]; // 0x728
GXColor hudTextColours[2]; // 0x730
- s16 hudHintH, hudHintS, hudHintL; // 0x738
- u8 currentMapMusic; // 0x73E
- u8 newerWorldID; // 0x73F
+ s16 hudHintH; // 0x738
+ s8 hudHintS, hudHintL; // 0x73A
+ u8 currentMapMusic; // 0x73C
+ u8 newerWorldID; // 0x73D
+ // Pretty much full up here...
};
};
u8 toad_location[10]; // 0x742
diff --git a/kamek_pal.x b/kamek_pal.x index 78ff6bf..9dbc49a 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -986,6 +986,7 @@ SECTIONS { ArchiveHeap = 0x8042A72C; DVDClass = 0x8042A318; GameMgrP = 0x8042A25C; + SaveFileBuffer = 0x8035DFC0; SaveFileInstance = 0x8042A320; SaveHandlerInstance = 0x8042A298; RemoconMng = 0x8042A230; 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 |