From 87cb3ef8451f6e6dc0f642d22f5335c1c4f4b064 Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 27 Sep 2012 06:08:02 +0200 Subject: a tiny bit of savefile RE, and default world stuff in the savefile --- fileselect.yaml | 1 + include/game.h | 25 +++++++++++++++++++++++++ src/fileselect.S | 29 +++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/fileselect.yaml b/fileselect.yaml index 90c18f9..eb8c107 100644 --- a/fileselect.yaml +++ b/fileselect.yaml @@ -147,6 +147,7 @@ hooks: - {name: DFNiceTitle, type: branch_insn, branch_type: bl, src_addr_pal: 0x8077D044, target_func: 'DFNiceTitle'} - {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: FSDebugStates, type: add_func_pointer, src_addr_pal: 0x80943E38, target_func: 'FSDebugStates'} diff --git a/include/game.h b/include/game.h index 32b3a1d..071d93e 100755 --- a/include/game.h +++ b/include/game.h @@ -153,6 +153,31 @@ bool IsWideScreen(); #define COND_SGNORMAL 0x80 #define COND_SGSECRET 0x100 + +// 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 + +// Controls whether you can QUICK SAVE or not. +// Set if 8-Castle is complete. +#define SAVE_BIT_GAME_COMPLETE 2 + +// Set when all exits are complete. +// This is defined by "ReturnWhetherConditionMaskIsValid" / "SetSomeConditionShit" +// TODO: Need to RE and fix this for Newer... +#define SAVE_BIT_ALL_EXITS 4 + +// Set when all star coins in worlds 1-8 are obtained. +// Valid levels are chosen by the condition crap as above. +#define SAVE_BIT_ALL_STAR_COINS 8 + +#define SAVE_BIT_ALL_STAR_COINS_W9 0x10 + +// Set when, well... EVERYTHING is done. +#define SAVE_BIT_EVERYTHING_TRULY_DONE 0x20 + + class SaveFirstBlock { public: char titleID[4]; // 0x00 diff --git a/src/fileselect.S b/src/fileselect.S index 16a1047..6ee1c39 100644 --- a/src/fileselect.S +++ b/src/fileselect.S @@ -247,6 +247,22 @@ FSDebugStates: addi r1, r1, 0x10 blr +.global DefaultSavefileInfo +DefaultSavefileInfo: + addi r4, r3, 0x6FC + lis r5, DefaultSavefileInfoData@h + ori r5, r5, DefaultSavefileInfoData@l + lis r6, DefaultSavefileInfoDataEnd@h + ori r6, r6, DefaultSavefileInfoDataEnd@l +DSFICopyLoop: + lwz r7, 0(r5) + stw r7, 0(r4) + addi r4, r4, 4 + addi r5, r5, 4 + cmpw r5, r6 + blt DSFICopyLoop + blr + .align 4 .data @@ -281,3 +297,16 @@ ConvertedWorldName: .short 0,0,0,0,0,0,0,0,0,0,0,0 # 12 .short 0,0,0,0,0,0,0,0,0,0,0,0 # 12 +.align 4 +DefaultSavefileInfoData: +.string "Yoshi's Island" #15 +.byte 0,0,0,0,0,0,0,0,0,0,0 # 11 +.byte 0,0,0,0,0,0,0,0,0,0 # 10 +.long 0xFFFF99FF,0x1FB423FF +.long 0x173714FF,0x3C9135FF +.long 0xFFFF99FF,0x1FB423FF +.short 0x75,0x2E,0xB +.byte 0,0 + +DefaultSavefileInfoDataEnd: +.long 0 -- cgit v1.2.3