summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-10-01 04:23:06 +0200
committerTreeki <treeki@gmail.com>2012-10-01 04:23:06 +0200
commitc6c8bdfaf7c5462104290154f815a11f32a6b7cc (patch)
tree213e3b01b37f388e116858e63fa2e748c7c592a1
parent1db72b5e45cc25eb183817f05a2ee631d8fff837 (diff)
downloadkamek-c6c8bdfaf7c5462104290154f815a11f32a6b7cc.tar.gz
kamek-c6c8bdfaf7c5462104290154f815a11f32a6b7cc.zip
fuck I have spent SO LONG on fixing this bug
Diffstat (limited to '')
-rw-r--r--fileselect.yaml1
-rwxr-xr-xinclude/game.h12
-rw-r--r--kamek_pal.x1
-rw-r--r--src/fileselect.S53
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