2020-10-03 15:22:44 +00:00
|
|
|
|
#include "global.h"
|
2022-11-01 23:17:11 +00:00
|
|
|
|
#include "terminal.h"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-11 17:45:08 +00:00
|
|
|
|
// these are the main substructs of save context.
|
|
|
|
|
// we are going to hold off on splitting save context until later on,
|
|
|
|
|
// so these temporary structs will live here for now.
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-11 17:45:08 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
/* 0x00 */ char newf[6]; // string "ZELDAZ"
|
|
|
|
|
/* 0x06 */ s16 deaths;
|
|
|
|
|
/* 0x08 */ char playerName[8];
|
|
|
|
|
/* 0x10 */ s16 n64ddFlag;
|
|
|
|
|
/* 0x12 */ s16 healthCapacity; // "max_life"
|
|
|
|
|
/* 0x14 */ s16 health; // "now_life"
|
|
|
|
|
/* 0x16 */ s8 magicLevel;
|
|
|
|
|
/* 0x17 */ s8 magic;
|
|
|
|
|
/* 0x18 */ s16 rupees;
|
|
|
|
|
/* 0x1A */ u16 swordHealth;
|
|
|
|
|
/* 0x1C */ u16 naviTimer;
|
2022-05-23 16:52:01 +00:00
|
|
|
|
/* 0x1E */ u8 isMagicAcquired;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
/* 0x1F */ u8 unk_1F;
|
2022-05-23 16:52:01 +00:00
|
|
|
|
/* 0x20 */ u8 isDoubleMagicAcquired;
|
2022-08-24 01:13:03 +00:00
|
|
|
|
/* 0x21 */ u8 isDoubleDefenseAcquired;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
/* 0x22 */ u8 bgsFlag;
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
|
/* 0x23 */ u8 ocarinaGameRoundNum;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
/* 0x24 */ ItemEquips childEquips;
|
|
|
|
|
/* 0x2E */ ItemEquips adultEquips;
|
|
|
|
|
/* 0x38 */ u32 unk_38; // this may be incorrect, currently used for alignement
|
|
|
|
|
/* 0x3C */ char unk_3C[0x0E];
|
2022-07-31 23:44:47 +00:00
|
|
|
|
/* 0x4A */ s16 savedSceneId;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
} SavePlayerData; // size = 0x4C
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-11 17:45:08 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
/* 0x0000 */ SavePlayerData playerData; // "S_Private" substruct name
|
|
|
|
|
/* 0x004C */ ItemEquips equips;
|
|
|
|
|
/* 0x0058 */ Inventory inventory;
|
|
|
|
|
/* 0x00B8 */ SavedSceneFlags sceneFlags[124];
|
|
|
|
|
/* 0x0E48 */ FaroresWindData fw;
|
|
|
|
|
/* 0x0E70 */ char unk_E70[0x10];
|
|
|
|
|
/* 0x0E80 */ s32 gsFlags[6];
|
|
|
|
|
/* 0x0E98 */ char unk_E98[0x10];
|
|
|
|
|
/* 0x0EA8 */ s32 horseRaceRecord;
|
|
|
|
|
/* 0x0EAC */ char unk_EAC[0x0C];
|
|
|
|
|
/* 0x0EB8 */ u16 eventChkInf[14]; // "event_chk_inf"
|
|
|
|
|
/* 0x0ED4 */ u16 itemGetInf[4]; // "item_get_inf"
|
|
|
|
|
/* 0x0EDC */ u16 infTable[30]; // "inf_table"
|
|
|
|
|
/* 0x0F18 */ char unk_F18[0x04];
|
|
|
|
|
/* 0x0F1C */ u32 worldMapAreaData; // "area_arrival"
|
|
|
|
|
/* 0x0F20 */ char unk_F20[0x4];
|
2022-05-09 16:59:23 +00:00
|
|
|
|
/* 0x0F24 */ u8 scarecrowLongSongSet;
|
|
|
|
|
/* 0x0F25 */ u8 scarecrowLongSong[0x360];
|
2020-10-11 17:45:08 +00:00
|
|
|
|
/* 0x1285 */ char unk_1285[0x24];
|
|
|
|
|
/* 0x12A9 */ u8 scarecrowSpawnSongSet;
|
|
|
|
|
/* 0x12AA */ u8 scarecrowSpawnSong[0x80];
|
|
|
|
|
/* 0x132A */ char unk_132A[0x02];
|
|
|
|
|
/* 0x132C */ HorseData horseData;
|
|
|
|
|
/* 0x1336 */ u16 checksum; // "check_sum"
|
|
|
|
|
} SaveInfo; // size = 0x1338
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-11 17:45:08 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
/* 0x00 */ s32 entranceIndex;
|
2022-01-25 00:08:37 +00:00
|
|
|
|
/* 0x04 */ s32 linkAge;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
/* 0x08 */ s32 cutsceneIndex;
|
|
|
|
|
/* 0x0C */ u16 dayTime; // "zelda_time"
|
|
|
|
|
/* 0x10 */ s32 nightFlag;
|
2021-09-20 16:51:35 +00:00
|
|
|
|
/* 0x14 */ s32 totalDays;
|
|
|
|
|
/* 0x18 */ s32 unk_18; // increments with totalDays, gets reset by goron for bgs and one other use
|
2020-10-11 17:45:08 +00:00
|
|
|
|
/* 0x1C */ SaveInfo info; // "information"
|
|
|
|
|
} Save; // size = 0x1354
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-11 17:45:08 +00:00
|
|
|
|
#define SAVE_PLAYER_DATA (*((SavePlayerData*)&gSaveContext.newf))
|
|
|
|
|
#define SAVE_INFO (*((SaveInfo*)&gSaveContext.newf))
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2020-10-11 17:45:08 +00:00
|
|
|
|
#define SLOT_SIZE (sizeof(SaveContext) + 0x28)
|
|
|
|
|
#define CHECKSUM_SIZE (sizeof(Save) / 2)
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2022-02-13 05:05:11 +00:00
|
|
|
|
#define DEATHS offsetof(SaveContext, deaths)
|
|
|
|
|
#define NAME offsetof(SaveContext, playerName)
|
|
|
|
|
#define N64DD offsetof(SaveContext, n64ddFlag)
|
|
|
|
|
#define HEALTH_CAP offsetof(SaveContext, healthCapacity)
|
|
|
|
|
#define QUEST offsetof(SaveContext, inventory.questItems)
|
|
|
|
|
#define DEFENSE offsetof(SaveContext, inventory.defenseHearts)
|
|
|
|
|
#define HEALTH offsetof(SaveContext, health)
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-11-15 21:33:44 +00:00
|
|
|
|
#define SLOT_OFFSET(index) (SRAM_HEADER_SIZE + 0x10 + (index * SLOT_SIZE))
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
u16 gSramSlotOffsets[] = {
|
|
|
|
|
SLOT_OFFSET(0),
|
|
|
|
|
SLOT_OFFSET(1),
|
|
|
|
|
SLOT_OFFSET(2),
|
|
|
|
|
// the latter three saves are backup saves for the former saves
|
|
|
|
|
SLOT_OFFSET(3),
|
|
|
|
|
SLOT_OFFSET(4),
|
|
|
|
|
SLOT_OFFSET(5),
|
2020-10-11 17:45:08 +00:00
|
|
|
|
};
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
static char sZeldaMagic[] = { '\0', '\0', '\0', '\x98', '\x09', '\x10', '\x21', 'Z', 'E', 'L', 'D', 'A' };
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
static SavePlayerData sNewSavePlayerData = {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
{ '\0', '\0', '\0', '\0', '\0', '\0' }, // newf
|
|
|
|
|
0, // deaths
|
|
|
|
|
{ 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E }, // playerName
|
|
|
|
|
0, // n64ddFlag
|
|
|
|
|
0x30, // healthCapacity
|
2021-11-15 21:33:44 +00:00
|
|
|
|
0x30, // defense
|
2020-10-11 17:45:08 +00:00
|
|
|
|
0, // magicLevel
|
2022-05-23 16:52:01 +00:00
|
|
|
|
MAGIC_NORMAL_METER, // magic
|
2020-10-11 17:45:08 +00:00
|
|
|
|
0, // rupees
|
|
|
|
|
0, // swordHealth
|
|
|
|
|
0, // naviTimer
|
2022-05-23 16:52:01 +00:00
|
|
|
|
false, // isMagicAcquired
|
2020-10-11 17:45:08 +00:00
|
|
|
|
0, // unk_1F
|
2022-05-23 16:52:01 +00:00
|
|
|
|
false, // isDoubleMagicAcquired
|
2022-08-24 01:13:03 +00:00
|
|
|
|
false, // isDoubleDefenseAcquired
|
2020-10-11 17:45:08 +00:00
|
|
|
|
0, // bgsFlag
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
|
0, // ocarinaGameRoundNum
|
2020-10-11 17:45:08 +00:00
|
|
|
|
{
|
|
|
|
|
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
|
|
|
|
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
|
|
|
|
0, // equipment
|
|
|
|
|
}, // childEquips
|
|
|
|
|
{
|
|
|
|
|
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
|
|
|
|
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
|
|
|
|
0, // equipment
|
|
|
|
|
}, // adultEquips
|
|
|
|
|
0, // unk_38
|
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // unk_3C
|
2022-11-26 21:15:41 +00:00
|
|
|
|
SCENE_LINKS_HOUSE, // savedSceneId
|
2020-10-11 17:45:08 +00:00
|
|
|
|
};
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
static ItemEquips sNewSaveEquips = {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
|
|
|
|
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
|
|
|
|
0x1100, // equipment
|
|
|
|
|
};
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
static Inventory sNewSaveInventory = {
|
2022-10-16 00:02:54 +00:00
|
|
|
|
// items
|
|
|
|
|
{
|
2022-11-16 18:23:27 +00:00
|
|
|
|
ITEM_NONE, // SLOT_DEKU_STICK
|
|
|
|
|
ITEM_NONE, // SLOT_DEKU_NUT
|
2022-10-16 00:02:54 +00:00
|
|
|
|
ITEM_NONE, // SLOT_BOMB
|
|
|
|
|
ITEM_NONE, // SLOT_BOW
|
|
|
|
|
ITEM_NONE, // SLOT_ARROW_FIRE
|
|
|
|
|
ITEM_NONE, // SLOT_DINS_FIRE
|
|
|
|
|
ITEM_NONE, // SLOT_SLINGSHOT
|
|
|
|
|
ITEM_NONE, // SLOT_OCARINA
|
|
|
|
|
ITEM_NONE, // SLOT_BOMBCHU
|
|
|
|
|
ITEM_NONE, // SLOT_HOOKSHOT
|
|
|
|
|
ITEM_NONE, // SLOT_ARROW_ICE
|
|
|
|
|
ITEM_NONE, // SLOT_FARORES_WIND
|
|
|
|
|
ITEM_NONE, // SLOT_BOOMERANG
|
2022-11-16 18:23:27 +00:00
|
|
|
|
ITEM_NONE, // SLOT_LENS_OF_TRUTH
|
|
|
|
|
ITEM_NONE, // SLOT_MAGIC_BEAN
|
2022-10-16 00:02:54 +00:00
|
|
|
|
ITEM_NONE, // SLOT_HAMMER
|
|
|
|
|
ITEM_NONE, // SLOT_ARROW_LIGHT
|
|
|
|
|
ITEM_NONE, // SLOT_NAYRUS_LOVE
|
|
|
|
|
ITEM_NONE, // SLOT_BOTTLE_1
|
|
|
|
|
ITEM_NONE, // SLOT_BOTTLE_2
|
|
|
|
|
ITEM_NONE, // SLOT_BOTTLE_3
|
|
|
|
|
ITEM_NONE, // SLOT_BOTTLE_4
|
|
|
|
|
ITEM_NONE, // SLOT_TRADE_ADULT
|
|
|
|
|
ITEM_NONE, // SLOT_TRADE_CHILD
|
|
|
|
|
},
|
|
|
|
|
// ammo
|
|
|
|
|
{
|
2022-11-16 18:23:27 +00:00
|
|
|
|
0, // SLOT_DEKU_STICK
|
|
|
|
|
0, // SLOT_DEKU_NUT
|
2022-10-16 00:02:54 +00:00
|
|
|
|
0, // SLOT_BOMB
|
|
|
|
|
0, // SLOT_BOW
|
|
|
|
|
0, // SLOT_ARROW_FIRE
|
|
|
|
|
0, // SLOT_DINS_FIRE
|
|
|
|
|
0, // SLOT_SLINGSHOT
|
|
|
|
|
0, // SLOT_OCARINA
|
|
|
|
|
0, // SLOT_BOMBCHU
|
|
|
|
|
0, // SLOT_HOOKSHOT
|
|
|
|
|
0, // SLOT_ARROW_ICE
|
|
|
|
|
0, // SLOT_FARORES_WIND
|
|
|
|
|
0, // SLOT_BOOMERANG
|
2022-11-16 18:23:27 +00:00
|
|
|
|
0, // SLOT_LENS_OF_TRUTH
|
|
|
|
|
0, // SLOT_MAGIC_BEAN
|
2022-10-16 00:02:54 +00:00
|
|
|
|
0, // SLOT_HAMMER
|
|
|
|
|
},
|
2022-04-30 16:18:56 +00:00
|
|
|
|
// equipment
|
|
|
|
|
(((1 << EQUIP_INV_TUNIC_KOKIRI) << (EQUIP_TYPE_TUNIC * 4)) |
|
|
|
|
|
((1 << EQUIP_INV_BOOTS_KOKIRI) << (EQUIP_TYPE_BOOTS * 4))),
|
|
|
|
|
0, // upgrades
|
|
|
|
|
0, // questItems
|
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // dungeonItems
|
2020-10-11 17:45:08 +00:00
|
|
|
|
{
|
|
|
|
|
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
|
|
|
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
|
|
|
}, // dungeonKeys
|
|
|
|
|
0, // defenseHearts
|
|
|
|
|
0, // gsTokens
|
|
|
|
|
};
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
static u16 sNewSaveChecksum = 0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initialize new save.
|
|
|
|
|
* This save has an empty inventory with 3 hearts and single magic.
|
|
|
|
|
*/
|
|
|
|
|
void Sram_InitNewSave(void) {
|
|
|
|
|
SaveContext* temp = &gSaveContext;
|
|
|
|
|
|
|
|
|
|
bzero(&SAVE_INFO, sizeof(SaveInfo));
|
2021-09-20 16:51:35 +00:00
|
|
|
|
gSaveContext.totalDays = 0;
|
|
|
|
|
gSaveContext.bgsDayCount = 0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
|
|
|
|
SAVE_PLAYER_DATA = sNewSavePlayerData;
|
|
|
|
|
gSaveContext.equips = sNewSaveEquips;
|
|
|
|
|
gSaveContext.inventory = sNewSaveInventory;
|
|
|
|
|
|
|
|
|
|
temp->checksum = sNewSaveChecksum;
|
2022-11-26 21:15:41 +00:00
|
|
|
|
gSaveContext.horseData.sceneId = SCENE_HYRULE_FIELD;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
gSaveContext.horseData.pos.x = -1840;
|
|
|
|
|
gSaveContext.horseData.pos.y = 72;
|
|
|
|
|
gSaveContext.horseData.pos.z = 5497;
|
|
|
|
|
gSaveContext.horseData.angle = -0x6AD9;
|
|
|
|
|
gSaveContext.magicLevel = 0;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
gSaveContext.infTable[INFTABLE_1DX_INDEX] = 1;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
gSaveContext.sceneFlags[5].swch = 0x40000000;
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
static SavePlayerData sDebugSavePlayerData = {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
{ 'Z', 'E', 'L', 'D', 'A', 'Z' }, // newf
|
|
|
|
|
0, // deaths
|
|
|
|
|
{ 0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E }, // playerName ( "LINK" )
|
|
|
|
|
0, // n64ddFlag
|
|
|
|
|
0xE0, // healthCapacity
|
|
|
|
|
0xE0, // health
|
|
|
|
|
0, // magicLevel
|
2022-05-23 16:52:01 +00:00
|
|
|
|
MAGIC_NORMAL_METER, // magic
|
2020-10-11 17:45:08 +00:00
|
|
|
|
150, // rupees
|
|
|
|
|
8, // swordHealth
|
|
|
|
|
0, // naviTimer
|
2022-05-23 16:52:01 +00:00
|
|
|
|
true, // isMagicAcquired
|
2020-10-11 17:45:08 +00:00
|
|
|
|
0, // unk_1F
|
2022-05-23 16:52:01 +00:00
|
|
|
|
false, // isDoubleMagicAcquired
|
2022-08-24 01:13:03 +00:00
|
|
|
|
false, // isDoubleDefenseAcquired
|
2020-10-11 17:45:08 +00:00
|
|
|
|
0, // bgsFlag
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
|
0, // ocarinaGameRoundNum
|
2020-10-11 17:45:08 +00:00
|
|
|
|
{
|
|
|
|
|
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
|
|
|
|
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
|
|
|
|
0, // equipment
|
|
|
|
|
}, // childEquips
|
|
|
|
|
{
|
|
|
|
|
{ ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems
|
|
|
|
|
{ SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots
|
|
|
|
|
0, // equipment
|
|
|
|
|
}, // adultEquips
|
|
|
|
|
0, // unk_38
|
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // unk_3C
|
2022-11-26 21:15:41 +00:00
|
|
|
|
SCENE_HYRULE_FIELD, // savedSceneId
|
2020-10-11 17:45:08 +00:00
|
|
|
|
};
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
static ItemEquips sDebugSaveEquips = {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
{ ITEM_SWORD_MASTER, ITEM_BOW, ITEM_BOMB, ITEM_OCARINA_FAIRY }, // buttonItems
|
|
|
|
|
{ SLOT_BOW, SLOT_BOMB, SLOT_OCARINA }, // cButtonSlots
|
2022-04-30 16:18:56 +00:00
|
|
|
|
// equipment
|
|
|
|
|
(EQUIP_VALUE_SWORD_MASTER << (EQUIP_TYPE_SWORD * 4)) | (EQUIP_VALUE_SHIELD_HYLIAN << (EQUIP_TYPE_SHIELD * 4)) |
|
|
|
|
|
(EQUIP_VALUE_TUNIC_KOKIRI << (EQUIP_TYPE_TUNIC * 4)) | (EQUIP_VALUE_BOOTS_KOKIRI << (EQUIP_TYPE_BOOTS * 4)),
|
2020-10-11 17:45:08 +00:00
|
|
|
|
};
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
static Inventory sDebugSaveInventory = {
|
2022-10-16 00:02:54 +00:00
|
|
|
|
// items
|
|
|
|
|
{
|
2022-11-16 18:23:27 +00:00
|
|
|
|
ITEM_DEKU_STICK, // SLOT_DEKU_STICK
|
|
|
|
|
ITEM_DEKU_NUT, // SLOT_DEKU_NUT
|
|
|
|
|
ITEM_BOMB, // SLOT_BOMB
|
|
|
|
|
ITEM_BOW, // SLOT_BOW
|
|
|
|
|
ITEM_ARROW_FIRE, // SLOT_ARROW_FIRE
|
|
|
|
|
ITEM_DINS_FIRE, // SLOT_DINS_FIRE
|
|
|
|
|
ITEM_SLINGSHOT, // SLOT_SLINGSHOT
|
|
|
|
|
ITEM_OCARINA_FAIRY, // SLOT_OCARINA
|
|
|
|
|
ITEM_BOMBCHU, // SLOT_BOMBCHU
|
|
|
|
|
ITEM_HOOKSHOT, // SLOT_HOOKSHOT
|
|
|
|
|
ITEM_ARROW_ICE, // SLOT_ARROW_ICE
|
|
|
|
|
ITEM_FARORES_WIND, // SLOT_FARORES_WIND
|
|
|
|
|
ITEM_BOOMERANG, // SLOT_BOOMERANG
|
|
|
|
|
ITEM_LENS_OF_TRUTH, // SLOT_LENS_OF_TRUTH
|
|
|
|
|
ITEM_MAGIC_BEAN, // SLOT_MAGIC_BEAN
|
|
|
|
|
ITEM_HAMMER, // SLOT_HAMMER
|
|
|
|
|
ITEM_ARROW_LIGHT, // SLOT_ARROW_LIGHT
|
|
|
|
|
ITEM_NAYRUS_LOVE, // SLOT_NAYRUS_LOVE
|
|
|
|
|
ITEM_BOTTLE_EMPTY, // SLOT_BOTTLE_1
|
|
|
|
|
ITEM_BOTTLE_POTION_RED, // SLOT_BOTTLE_2
|
|
|
|
|
ITEM_BOTTLE_POTION_GREEN, // SLOT_BOTTLE_3
|
|
|
|
|
ITEM_BOTTLE_POTION_BLUE, // SLOT_BOTTLE_4
|
|
|
|
|
ITEM_POCKET_EGG, // SLOT_TRADE_ADULT
|
|
|
|
|
ITEM_WEIRD_EGG, // SLOT_TRADE_CHILD
|
2022-10-16 00:02:54 +00:00
|
|
|
|
},
|
|
|
|
|
// ammo
|
2020-12-04 18:47:50 +00:00
|
|
|
|
{
|
2022-11-16 18:23:27 +00:00
|
|
|
|
50, // SLOT_DEKU_STICK
|
|
|
|
|
50, // SLOT_DEKU_NUT
|
2022-10-16 00:02:54 +00:00
|
|
|
|
10, // SLOT_BOMB
|
|
|
|
|
30, // SLOT_BOW
|
|
|
|
|
1, // SLOT_ARROW_FIRE
|
|
|
|
|
1, // SLOT_DINS_FIRE
|
|
|
|
|
30, // SLOT_SLINGSHOT
|
|
|
|
|
1, // SLOT_OCARINA
|
|
|
|
|
50, // SLOT_BOMBCHU
|
|
|
|
|
1, // SLOT_HOOKSHOT
|
|
|
|
|
1, // SLOT_ARROW_ICE
|
|
|
|
|
1, // SLOT_FARORES_WIND
|
|
|
|
|
1, // SLOT_BOOMERANG
|
2022-11-16 18:23:27 +00:00
|
|
|
|
1, // SLOT_LENS_OF_TRUTH
|
|
|
|
|
1, // SLOT_MAGIC_BEAN
|
2022-10-16 00:02:54 +00:00
|
|
|
|
1 // SLOT_HAMMER
|
|
|
|
|
},
|
2022-04-30 16:18:56 +00:00
|
|
|
|
// equipment
|
|
|
|
|
((((1 << EQUIP_INV_SWORD_KOKIRI) << (EQUIP_TYPE_SWORD * 4)) |
|
|
|
|
|
((1 << EQUIP_INV_SWORD_MASTER) << (EQUIP_TYPE_SWORD * 4)) |
|
|
|
|
|
((1 << EQUIP_INV_SWORD_BGS) << (EQUIP_TYPE_SWORD * 4))) |
|
|
|
|
|
(((1 << EQUIP_INV_SHIELD_DEKU) << (EQUIP_TYPE_SHIELD * 4)) |
|
|
|
|
|
((1 << EQUIP_INV_SHIELD_HYLIAN) << (EQUIP_TYPE_SHIELD * 4)) |
|
|
|
|
|
((1 << EQUIP_INV_SHIELD_MIRROR) << (EQUIP_TYPE_SHIELD * 4))) |
|
|
|
|
|
(((1 << EQUIP_INV_TUNIC_KOKIRI) << (EQUIP_TYPE_TUNIC * 4)) |
|
|
|
|
|
((1 << EQUIP_INV_TUNIC_GORON) << (EQUIP_TYPE_TUNIC * 4)) |
|
|
|
|
|
((1 << EQUIP_INV_TUNIC_ZORA) << (EQUIP_TYPE_TUNIC * 4))) |
|
|
|
|
|
(((1 << EQUIP_INV_BOOTS_KOKIRI) << (EQUIP_TYPE_BOOTS * 4)) |
|
|
|
|
|
((1 << EQUIP_INV_BOOTS_IRON) << (EQUIP_TYPE_BOOTS * 4)) |
|
|
|
|
|
((1 << EQUIP_INV_BOOTS_HOVER) << (EQUIP_TYPE_BOOTS * 4)))),
|
2020-12-02 19:57:54 +00:00
|
|
|
|
0x125249, // upgrades
|
|
|
|
|
0x1E3FFFF, // questItems
|
|
|
|
|
{ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // dungeonItems
|
|
|
|
|
{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }, // dungeonKeys
|
|
|
|
|
0, // defenseHearts
|
|
|
|
|
0, // gsTokens
|
|
|
|
|
};
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
static u16 sDebugSaveChecksum = 0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initialize debug save. This is also used on the Title Screen
|
|
|
|
|
* This save has a mostly full inventory with 10 hearts and single magic.
|
|
|
|
|
*
|
|
|
|
|
* Some noteable flags that are set:
|
|
|
|
|
* Showed Mido sword/shield, met Deku Tree, Deku Tree mouth opened,
|
|
|
|
|
* used blue warp in Gohmas room, Zelda fled castle, light arrow cutscene watched,
|
|
|
|
|
* and set water level in Water Temple to lowest level.
|
|
|
|
|
*/
|
|
|
|
|
void Sram_InitDebugSave(void) {
|
|
|
|
|
SaveContext* temp = &gSaveContext;
|
|
|
|
|
|
|
|
|
|
bzero(&SAVE_INFO, sizeof(SaveInfo));
|
2021-09-20 16:51:35 +00:00
|
|
|
|
gSaveContext.totalDays = 0;
|
|
|
|
|
gSaveContext.bgsDayCount = 0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
|
|
|
|
SAVE_PLAYER_DATA = sDebugSavePlayerData;
|
|
|
|
|
gSaveContext.equips = sDebugSaveEquips;
|
|
|
|
|
gSaveContext.inventory = sDebugSaveInventory;
|
|
|
|
|
|
|
|
|
|
temp->checksum = sDebugSaveChecksum;
|
2022-11-26 21:15:41 +00:00
|
|
|
|
gSaveContext.horseData.sceneId = SCENE_HYRULE_FIELD;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
gSaveContext.horseData.pos.x = -1840;
|
|
|
|
|
gSaveContext.horseData.pos.y = 72;
|
|
|
|
|
gSaveContext.horseData.pos.z = 5497;
|
|
|
|
|
gSaveContext.horseData.angle = -0x6AD9;
|
|
|
|
|
gSaveContext.infTable[0] |= 0x5009;
|
|
|
|
|
gSaveContext.eventChkInf[0] |= 0x123F;
|
2022-04-29 18:19:48 +00:00
|
|
|
|
SET_EVENTCHKINF(EVENTCHKINF_80);
|
|
|
|
|
SET_EVENTCHKINF(EVENTCHKINF_C4);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
|
|
|
|
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
|
|
|
|
|
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI;
|
2022-04-30 16:18:56 +00:00
|
|
|
|
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_KOKIRI);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
if (gSaveContext.fileNum == 0xFF) {
|
|
|
|
|
gSaveContext.equips.buttonItems[1] = ITEM_SLINGSHOT;
|
|
|
|
|
gSaveContext.equips.cButtonSlots[0] = SLOT_SLINGSHOT;
|
2022-04-30 16:18:56 +00:00
|
|
|
|
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_DEKU);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-26 21:15:41 +00:00
|
|
|
|
gSaveContext.entranceIndex = ENTR_HYRULE_FIELD_0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
gSaveContext.magicLevel = 0;
|
|
|
|
|
gSaveContext.sceneFlags[5].swch = 0x40000000;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-09 17:45:53 +00:00
|
|
|
|
static s16 sDungeonEntrances[] = {
|
2022-11-26 21:15:41 +00:00
|
|
|
|
ENTR_DEKU_TREE_0, // SCENE_DEKU_TREE
|
|
|
|
|
ENTR_DODONGOS_CAVERN_0, // SCENE_DODONGOS_CAVERN
|
|
|
|
|
ENTR_JABU_JABU_0, // SCENE_JABU_JABU
|
|
|
|
|
ENTR_FOREST_TEMPLE_0, // SCENE_FOREST_TEMPLE
|
|
|
|
|
ENTR_FIRE_TEMPLE_0, // SCENE_FIRE_TEMPLE
|
|
|
|
|
ENTR_WATER_TEMPLE_0, // SCENE_WATER_TEMPLE
|
|
|
|
|
ENTR_SPIRIT_TEMPLE_0, // SCENE_SPIRIT_TEMPLE
|
|
|
|
|
ENTR_SHADOW_TEMPLE_0, // SCENE_SHADOW_TEMPLE
|
|
|
|
|
ENTR_BOTTOM_OF_THE_WELL_0, // SCENE_BOTTOM_OF_THE_WELL
|
|
|
|
|
ENTR_ICE_CAVERN_0, // SCENE_ICE_CAVERN
|
|
|
|
|
ENTR_GANONS_TOWER_0, // SCENE_GANONS_TOWER
|
|
|
|
|
ENTR_GERUDO_TRAINING_GROUND_0, // SCENE_GERUDO_TRAINING_GROUND
|
|
|
|
|
ENTR_THIEVES_HIDEOUT_0, // SCENE_THIEVES_HIDEOUT
|
|
|
|
|
ENTR_INSIDE_GANONS_CASTLE_0, // SCENE_INSIDE_GANONS_CASTLE
|
|
|
|
|
ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_0, // SCENE_GANONS_TOWER_COLLAPSE_INTERIOR
|
|
|
|
|
ENTR_INSIDE_GANONS_CASTLE_COLLAPSE_0, // SCENE_INSIDE_GANONS_CASTLE_COLLAPSE
|
2022-05-09 17:45:53 +00:00
|
|
|
|
};
|
|
|
|
|
|
2020-10-11 17:45:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* Copy save currently on the buffer to Save Context and complete various tasks to open the save.
|
|
|
|
|
* This includes:
|
|
|
|
|
* - Set proper entrance depending on where the game was saved
|
|
|
|
|
* - If health is less than 3 hearts, give 3 hearts
|
|
|
|
|
* - If either scarecrow song is set, copy them from save context to the proper location
|
|
|
|
|
* - Handle a case where the player saved and quit after zelda cutscene but didnt get the song
|
2022-10-13 08:06:49 +00:00
|
|
|
|
* - Give and equip master sword if player is adult and doesn't have master sword
|
2020-10-11 17:45:08 +00:00
|
|
|
|
* - Revert any trade items that spoil
|
|
|
|
|
*/
|
|
|
|
|
void Sram_OpenSave(SramContext* sramCtx) {
|
|
|
|
|
u16 i;
|
|
|
|
|
u16 j;
|
|
|
|
|
u8* ptr;
|
|
|
|
|
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("個人File作成\n"); // "Create personal file"
|
2021-06-01 17:31:29 +00:00
|
|
|
|
i = gSramSlotOffsets[gSaveContext.fileNum];
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("ぽいんと=%x(%d)\n", i, gSaveContext.fileNum); // "Point="
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
2022-05-01 22:06:35 +00:00
|
|
|
|
MemCpy(&gSaveContext, sramCtx->readBuff + i, sizeof(Save));
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
|
|
|
|
osSyncPrintf(VT_FGCOL(YELLOW));
|
2022-07-31 23:44:47 +00:00
|
|
|
|
osSyncPrintf("SCENE_DATA_ID = %d SceneNo = %d\n", gSaveContext.savedSceneId,
|
2020-10-11 17:45:08 +00:00
|
|
|
|
((void)0, gSaveContext.entranceIndex));
|
|
|
|
|
|
2022-07-31 23:44:47 +00:00
|
|
|
|
switch (gSaveContext.savedSceneId) {
|
2022-11-26 21:15:41 +00:00
|
|
|
|
case SCENE_DEKU_TREE:
|
|
|
|
|
case SCENE_DODONGOS_CAVERN:
|
|
|
|
|
case SCENE_JABU_JABU:
|
|
|
|
|
case SCENE_FOREST_TEMPLE:
|
|
|
|
|
case SCENE_FIRE_TEMPLE:
|
|
|
|
|
case SCENE_WATER_TEMPLE:
|
|
|
|
|
case SCENE_SPIRIT_TEMPLE:
|
|
|
|
|
case SCENE_SHADOW_TEMPLE:
|
|
|
|
|
case SCENE_BOTTOM_OF_THE_WELL:
|
|
|
|
|
case SCENE_ICE_CAVERN:
|
|
|
|
|
case SCENE_GANONS_TOWER:
|
|
|
|
|
case SCENE_GERUDO_TRAINING_GROUND:
|
|
|
|
|
case SCENE_THIEVES_HIDEOUT:
|
|
|
|
|
case SCENE_INSIDE_GANONS_CASTLE:
|
2022-07-31 23:44:47 +00:00
|
|
|
|
gSaveContext.entranceIndex = sDungeonEntrances[gSaveContext.savedSceneId];
|
2020-10-11 17:45:08 +00:00
|
|
|
|
break;
|
2022-05-09 17:45:53 +00:00
|
|
|
|
|
2022-11-26 21:15:41 +00:00
|
|
|
|
case SCENE_DEKU_TREE_BOSS:
|
|
|
|
|
gSaveContext.entranceIndex = ENTR_DEKU_TREE_0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
break;
|
2022-05-09 17:45:53 +00:00
|
|
|
|
|
2022-11-26 21:15:41 +00:00
|
|
|
|
case SCENE_DODONGOS_CAVERN_BOSS:
|
|
|
|
|
gSaveContext.entranceIndex = ENTR_DODONGOS_CAVERN_0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
break;
|
2022-05-09 17:45:53 +00:00
|
|
|
|
|
2022-11-26 21:15:41 +00:00
|
|
|
|
case SCENE_JABU_JABU_BOSS:
|
|
|
|
|
gSaveContext.entranceIndex = ENTR_JABU_JABU_0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
break;
|
2022-05-09 17:45:53 +00:00
|
|
|
|
|
2022-11-26 21:15:41 +00:00
|
|
|
|
case SCENE_FOREST_TEMPLE_BOSS:
|
|
|
|
|
gSaveContext.entranceIndex = ENTR_FOREST_TEMPLE_0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
break;
|
2022-05-09 17:45:53 +00:00
|
|
|
|
|
2022-11-26 21:15:41 +00:00
|
|
|
|
case SCENE_FIRE_TEMPLE_BOSS:
|
|
|
|
|
gSaveContext.entranceIndex = ENTR_FIRE_TEMPLE_0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
break;
|
2022-05-09 17:45:53 +00:00
|
|
|
|
|
2022-11-26 21:15:41 +00:00
|
|
|
|
case SCENE_WATER_TEMPLE_BOSS:
|
|
|
|
|
gSaveContext.entranceIndex = ENTR_WATER_TEMPLE_0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
break;
|
2022-05-09 17:45:53 +00:00
|
|
|
|
|
2022-11-26 21:15:41 +00:00
|
|
|
|
case SCENE_SPIRIT_TEMPLE_BOSS:
|
|
|
|
|
gSaveContext.entranceIndex = ENTR_SPIRIT_TEMPLE_0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
break;
|
2022-05-09 17:45:53 +00:00
|
|
|
|
|
2022-11-26 21:15:41 +00:00
|
|
|
|
case SCENE_SHADOW_TEMPLE_BOSS:
|
|
|
|
|
gSaveContext.entranceIndex = ENTR_SHADOW_TEMPLE_0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
break;
|
2022-05-09 17:45:53 +00:00
|
|
|
|
|
2022-11-26 21:15:41 +00:00
|
|
|
|
case SCENE_GANONS_TOWER_COLLAPSE_INTERIOR:
|
|
|
|
|
case SCENE_INSIDE_GANONS_CASTLE_COLLAPSE:
|
|
|
|
|
case SCENE_GANONDORF_BOSS:
|
|
|
|
|
case SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR:
|
2020-10-11 17:45:08 +00:00
|
|
|
|
case SCENE_GANON_BOSS:
|
2022-11-26 21:15:41 +00:00
|
|
|
|
gSaveContext.entranceIndex = ENTR_GANONS_TOWER_0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2022-11-26 21:15:41 +00:00
|
|
|
|
if (gSaveContext.savedSceneId != SCENE_LINKS_HOUSE) {
|
|
|
|
|
gSaveContext.entranceIndex =
|
|
|
|
|
(LINK_AGE_IN_YEARS == YEARS_CHILD) ? ENTR_LINKS_HOUSE_0 : ENTR_TEMPLE_OF_TIME_7;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
} else {
|
2022-11-26 21:15:41 +00:00
|
|
|
|
gSaveContext.entranceIndex = ENTR_LINKS_HOUSE_0;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
osSyncPrintf("scene_no = %d\n", gSaveContext.entranceIndex);
|
|
|
|
|
osSyncPrintf(VT_RST);
|
|
|
|
|
|
|
|
|
|
if (gSaveContext.health < 0x30) {
|
|
|
|
|
gSaveContext.health = 0x30;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-09 16:59:23 +00:00
|
|
|
|
if (gSaveContext.scarecrowLongSongSet) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf(VT_FGCOL(BLUE));
|
|
|
|
|
osSyncPrintf("\n====================================================================\n");
|
|
|
|
|
|
2022-05-09 16:59:23 +00:00
|
|
|
|
MemCpy(gScarecrowLongSongPtr, gSaveContext.scarecrowLongSong, sizeof(gSaveContext.scarecrowLongSong));
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
2022-05-09 16:59:23 +00:00
|
|
|
|
ptr = (u8*)gScarecrowLongSongPtr;
|
|
|
|
|
for (i = 0; i < ARRAY_COUNT(gSaveContext.scarecrowLongSong); i++, ptr++) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("%d, ", *ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
osSyncPrintf("\n====================================================================\n");
|
|
|
|
|
osSyncPrintf(VT_RST);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (gSaveContext.scarecrowSpawnSongSet) {
|
|
|
|
|
osSyncPrintf(VT_FGCOL(GREEN));
|
|
|
|
|
osSyncPrintf("\n====================================================================\n");
|
|
|
|
|
|
2022-05-01 22:06:35 +00:00
|
|
|
|
MemCpy(gScarecrowSpawnSongPtr, gSaveContext.scarecrowSpawnSong, sizeof(gSaveContext.scarecrowSpawnSong));
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
|
|
|
|
ptr = gScarecrowSpawnSongPtr;
|
2021-11-15 21:33:44 +00:00
|
|
|
|
for (i = 0; i < ARRAY_COUNT(gSaveContext.scarecrowSpawnSong); i++, ptr++) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("%d, ", *ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
osSyncPrintf("\n====================================================================\n");
|
|
|
|
|
osSyncPrintf(VT_RST);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if zelda cutscene has been watched but lullaby was not obtained, restore cutscene and take away letter
|
2022-04-29 18:19:48 +00:00
|
|
|
|
if (GET_EVENTCHKINF(EVENTCHKINF_40) && !CHECK_QUEST_ITEM(QUEST_SONG_LULLABY)) {
|
|
|
|
|
i = gSaveContext.eventChkInf[EVENTCHKINF_40_INDEX] & ~EVENTCHKINF_40_MASK;
|
|
|
|
|
gSaveContext.eventChkInf[EVENTCHKINF_40_INDEX] = i;
|
2021-04-06 01:07:53 +00:00
|
|
|
|
|
2022-11-16 18:23:27 +00:00
|
|
|
|
INV_CONTENT(ITEM_ZELDAS_LETTER) = ITEM_CHICKEN;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
2021-04-06 01:07:53 +00:00
|
|
|
|
for (j = 1; j < 4; j++) {
|
2022-11-16 18:23:27 +00:00
|
|
|
|
if (gSaveContext.equips.buttonItems[j] == ITEM_ZELDAS_LETTER) {
|
2021-04-06 01:07:53 +00:00
|
|
|
|
gSaveContext.equips.buttonItems[j] = ITEM_CHICKEN;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-30 16:18:56 +00:00
|
|
|
|
if (LINK_AGE_IN_YEARS == YEARS_ADULT && !CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER)) {
|
|
|
|
|
gSaveContext.inventory.equipment |= OWNED_EQUIP_FLAG(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
|
2022-04-30 16:18:56 +00:00
|
|
|
|
gSaveContext.equips.equipment &= ~(0xF << (EQUIP_TYPE_SWORD * 4));
|
|
|
|
|
gSaveContext.equips.equipment |= EQUIP_VALUE_SWORD_MASTER << (EQUIP_TYPE_SWORD * 4);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_COUNT(gSpoilingItems); i++) {
|
|
|
|
|
if (INV_CONTENT(ITEM_TRADE_ADULT) == gSpoilingItems[i]) {
|
|
|
|
|
INV_CONTENT(gSpoilingItemReverts[i]) = gSpoilingItemReverts[i];
|
|
|
|
|
|
|
|
|
|
for (j = 1; j < 4; j++) {
|
|
|
|
|
if (gSaveContext.equips.buttonItems[j] == gSpoilingItems[i]) {
|
|
|
|
|
gSaveContext.equips.buttonItems[j] = gSpoilingItemReverts[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gSaveContext.magicLevel = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Write the contents of the Save Context to a main and backup slot in SRAM.
|
|
|
|
|
* Note: The whole Save Context is written even though only the `save` substruct is read back later
|
|
|
|
|
*/
|
2021-05-02 23:15:16 +00:00
|
|
|
|
void Sram_WriteSave(SramContext* sramCtx) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
u16 offset;
|
|
|
|
|
u16 checksum;
|
|
|
|
|
u16 j;
|
|
|
|
|
u16* ptr;
|
|
|
|
|
|
|
|
|
|
gSaveContext.checksum = 0;
|
|
|
|
|
|
|
|
|
|
ptr = (u16*)&gSaveContext;
|
|
|
|
|
checksum = 0;
|
|
|
|
|
j = 0;
|
|
|
|
|
|
|
|
|
|
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
|
2021-10-03 03:17:09 +00:00
|
|
|
|
if (++j == 0x20) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
j = 0;
|
|
|
|
|
}
|
|
|
|
|
checksum += *ptr++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gSaveContext.checksum = checksum;
|
|
|
|
|
|
|
|
|
|
ptr = (u16*)&gSaveContext;
|
|
|
|
|
checksum = 0;
|
|
|
|
|
|
|
|
|
|
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
|
2021-10-03 03:17:09 +00:00
|
|
|
|
if (++j == 0x20) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
j = 0;
|
|
|
|
|
}
|
|
|
|
|
checksum += *ptr++;
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
offset = gSramSlotOffsets[gSaveContext.fileNum];
|
2020-10-11 17:45:08 +00:00
|
|
|
|
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
|
|
|
|
|
|
|
|
|
ptr = (u16*)&gSaveContext;
|
|
|
|
|
checksum = 0;
|
|
|
|
|
|
|
|
|
|
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
|
2021-10-03 03:17:09 +00:00
|
|
|
|
if (++j == 0x20) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
j = 0;
|
|
|
|
|
}
|
|
|
|
|
checksum += *ptr++;
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
offset = gSramSlotOffsets[gSaveContext.fileNum + 3];
|
2020-10-11 17:45:08 +00:00
|
|
|
|
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* For all 3 slots, verify that the checksum is correct. If corrupted, attempt to load a backup save.
|
|
|
|
|
* If backup is also corrupted, default to a new save (or debug save for slot 0 on debug rom).
|
|
|
|
|
*
|
|
|
|
|
* After verifying all 3 saves, pass relevant data to File Select to be displayed.
|
|
|
|
|
*/
|
2022-06-23 21:34:26 +00:00
|
|
|
|
void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCtx) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
u16 i;
|
2021-06-01 17:31:29 +00:00
|
|
|
|
u16 newChecksum;
|
|
|
|
|
u16 slotNum;
|
|
|
|
|
u16 offset;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
u16 j;
|
2021-06-01 17:31:29 +00:00
|
|
|
|
u16 oldChecksum;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
u16* ptr;
|
2021-06-01 17:31:29 +00:00
|
|
|
|
u16 dayTime;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
|
|
|
|
osSyncPrintf("SRAM START─LOAD\n");
|
|
|
|
|
bzero(sramCtx->readBuff, SRAM_SIZE);
|
|
|
|
|
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
dayTime = ((void)0, gSaveContext.dayTime);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
|
|
|
|
for (slotNum = 0; slotNum < 3; slotNum++) {
|
2021-06-01 17:31:29 +00:00
|
|
|
|
offset = gSramSlotOffsets[slotNum];
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("ぽいんと=%x(%d) SAVE_MAX=%d\n", offset, gSaveContext.fileNum, sizeof(Save));
|
2022-05-01 22:06:35 +00:00
|
|
|
|
MemCpy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save));
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
|
|
|
|
oldChecksum = gSaveContext.checksum;
|
|
|
|
|
gSaveContext.checksum = 0;
|
2021-06-01 17:31:29 +00:00
|
|
|
|
ptr = (u16*)&gSaveContext;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("\n============= S(%d) =============\n", slotNum);
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
for (i = newChecksum = j = 0; i < CHECKSUM_SIZE; i++, offset += 2) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
newChecksum += *ptr++;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "SAVE checksum calculation"
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("\nSAVEチェックサム計算 j=%x mmm=%x ", newChecksum, oldChecksum);
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
if (newChecksum != oldChecksum) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
// checksum didnt match, try backup save
|
2021-06-01 17:31:29 +00:00
|
|
|
|
osSyncPrintf("ERROR!!! = %x(%d)\n", gSramSlotOffsets[slotNum], slotNum);
|
|
|
|
|
offset = gSramSlotOffsets[slotNum + 3];
|
2022-05-01 22:06:35 +00:00
|
|
|
|
MemCpy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save));
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
|
|
|
|
oldChecksum = gSaveContext.checksum;
|
|
|
|
|
gSaveContext.checksum = 0;
|
2021-06-01 17:31:29 +00:00
|
|
|
|
ptr = (u16*)&gSaveContext;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("================= BACK─UP ========================\n");
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
for (i = newChecksum = j = 0; i < CHECKSUM_SIZE; i++, offset += 2) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
newChecksum += *ptr++;
|
|
|
|
|
}
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "(B) SAVE checksum calculation"
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("\n(B)SAVEチェックサム計算 j=%x mmm=%x ", newChecksum, oldChecksum);
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
if (newChecksum != oldChecksum) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
// backup save didnt work, make new save
|
2021-06-01 17:31:29 +00:00
|
|
|
|
osSyncPrintf("ERROR!!! = %x(%d+3)\n", gSramSlotOffsets[slotNum + 3], slotNum);
|
|
|
|
|
bzero(&gSaveContext.entranceIndex, sizeof(s32));
|
|
|
|
|
bzero(&gSaveContext.linkAge, sizeof(s32));
|
|
|
|
|
bzero(&gSaveContext.cutsceneIndex, sizeof(s32));
|
|
|
|
|
// note that gSaveContext.dayTime is not actually the sizeof(s32)
|
|
|
|
|
bzero(&gSaveContext.dayTime, sizeof(s32));
|
|
|
|
|
bzero(&gSaveContext.nightFlag, sizeof(s32));
|
2021-09-20 16:51:35 +00:00
|
|
|
|
bzero(&gSaveContext.totalDays, sizeof(s32));
|
|
|
|
|
bzero(&gSaveContext.bgsDayCount, sizeof(s32));
|
2021-06-01 17:31:29 +00:00
|
|
|
|
|
|
|
|
|
if (!slotNum) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
Sram_InitDebugSave();
|
|
|
|
|
gSaveContext.newf[0] = 'Z';
|
|
|
|
|
gSaveContext.newf[1] = 'E';
|
|
|
|
|
gSaveContext.newf[2] = 'L';
|
|
|
|
|
gSaveContext.newf[3] = 'D';
|
|
|
|
|
gSaveContext.newf[4] = 'A';
|
|
|
|
|
gSaveContext.newf[5] = 'Z';
|
|
|
|
|
osSyncPrintf("newf=%x,%x,%x,%x,%x,%x\n", gSaveContext.newf[0], gSaveContext.newf[1],
|
|
|
|
|
gSaveContext.newf[2], gSaveContext.newf[3], gSaveContext.newf[4],
|
|
|
|
|
gSaveContext.newf[5]);
|
|
|
|
|
} else {
|
|
|
|
|
Sram_InitNewSave();
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
ptr = (u16*)&gSaveContext;
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("\n--------------------------------------------------------------\n");
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
for (i = newChecksum = j = 0; i < CHECKSUM_SIZE; i++) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("%x ", *ptr);
|
|
|
|
|
if (++j == 0x20) {
|
|
|
|
|
osSyncPrintf("\n");
|
|
|
|
|
j = 0;
|
|
|
|
|
}
|
|
|
|
|
newChecksum += *ptr++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gSaveContext.checksum = newChecksum;
|
|
|
|
|
osSyncPrintf("\nCheck_Sum=%x(%x)\n", gSaveContext.checksum, newChecksum);
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
i = gSramSlotOffsets[slotNum + 3];
|
|
|
|
|
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + i, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
|
|
|
|
osSyncPrintf("????#%x,%x,%x,%x,%x,%x\n", gSaveContext.newf[0], gSaveContext.newf[1],
|
|
|
|
|
gSaveContext.newf[2], gSaveContext.newf[3], gSaveContext.newf[4], gSaveContext.newf[5]);
|
2021-06-01 17:31:29 +00:00
|
|
|
|
osSyncPrintf("\nぽいんと=%x(%d+3) check_sum=%x(%x)\n", i, slotNum, gSaveContext.checksum,
|
2020-10-11 17:45:08 +00:00
|
|
|
|
newChecksum);
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
i = gSramSlotOffsets[slotNum];
|
|
|
|
|
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + i, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
osSyncPrintf("ぽいんと=%x(%d) check_sum=%x(%x)\n", i, slotNum, gSaveContext.checksum, newChecksum);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
} else {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("\nSAVEデータ OK!!!!\n"); // "SAVE data OK! ! ! !"
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bzero(sramCtx->readBuff, SRAM_SIZE);
|
|
|
|
|
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
|
|
|
|
gSaveContext.dayTime = dayTime;
|
|
|
|
|
|
|
|
|
|
osSyncPrintf("SAVECT=%x, NAME=%x, LIFE=%x, ITEM=%x, 64DD=%x, HEART=%x\n", DEATHS, NAME, HEALTH_CAP, QUEST, N64DD,
|
|
|
|
|
DEFENSE);
|
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
MemCpy(&fileSelect->deaths[0], sramCtx->readBuff + SLOT_OFFSET(0) + DEATHS, sizeof(fileSelect->deaths[0]));
|
|
|
|
|
MemCpy(&fileSelect->deaths[1], sramCtx->readBuff + SLOT_OFFSET(1) + DEATHS, sizeof(fileSelect->deaths[0]));
|
|
|
|
|
MemCpy(&fileSelect->deaths[2], sramCtx->readBuff + SLOT_OFFSET(2) + DEATHS, sizeof(fileSelect->deaths[0]));
|
|
|
|
|
|
|
|
|
|
MemCpy(&fileSelect->fileNames[0], sramCtx->readBuff + SLOT_OFFSET(0) + NAME, sizeof(fileSelect->fileNames[0]));
|
|
|
|
|
MemCpy(&fileSelect->fileNames[1], sramCtx->readBuff + SLOT_OFFSET(1) + NAME, sizeof(fileSelect->fileNames[0]));
|
|
|
|
|
MemCpy(&fileSelect->fileNames[2], sramCtx->readBuff + SLOT_OFFSET(2) + NAME, sizeof(fileSelect->fileNames[0]));
|
|
|
|
|
|
|
|
|
|
MemCpy(&fileSelect->healthCapacities[0], sramCtx->readBuff + SLOT_OFFSET(0) + HEALTH_CAP,
|
|
|
|
|
sizeof(fileSelect->healthCapacities[0]));
|
|
|
|
|
MemCpy(&fileSelect->healthCapacities[1], sramCtx->readBuff + SLOT_OFFSET(1) + HEALTH_CAP,
|
|
|
|
|
sizeof(fileSelect->healthCapacities[0]));
|
|
|
|
|
MemCpy(&fileSelect->healthCapacities[2], sramCtx->readBuff + SLOT_OFFSET(2) + HEALTH_CAP,
|
|
|
|
|
sizeof(fileSelect->healthCapacities[0]));
|
|
|
|
|
|
|
|
|
|
MemCpy(&fileSelect->questItems[0], sramCtx->readBuff + SLOT_OFFSET(0) + QUEST, sizeof(fileSelect->questItems[0]));
|
|
|
|
|
MemCpy(&fileSelect->questItems[1], sramCtx->readBuff + SLOT_OFFSET(1) + QUEST, sizeof(fileSelect->questItems[0]));
|
|
|
|
|
MemCpy(&fileSelect->questItems[2], sramCtx->readBuff + SLOT_OFFSET(2) + QUEST, sizeof(fileSelect->questItems[0]));
|
|
|
|
|
|
|
|
|
|
MemCpy(&fileSelect->n64ddFlags[0], sramCtx->readBuff + SLOT_OFFSET(0) + N64DD, sizeof(fileSelect->n64ddFlags[0]));
|
|
|
|
|
MemCpy(&fileSelect->n64ddFlags[1], sramCtx->readBuff + SLOT_OFFSET(1) + N64DD, sizeof(fileSelect->n64ddFlags[0]));
|
|
|
|
|
MemCpy(&fileSelect->n64ddFlags[2], sramCtx->readBuff + SLOT_OFFSET(2) + N64DD, sizeof(fileSelect->n64ddFlags[0]));
|
|
|
|
|
|
|
|
|
|
MemCpy(&fileSelect->defense[0], sramCtx->readBuff + SLOT_OFFSET(0) + DEFENSE, sizeof(fileSelect->defense[0]));
|
|
|
|
|
MemCpy(&fileSelect->defense[1], sramCtx->readBuff + SLOT_OFFSET(1) + DEFENSE, sizeof(fileSelect->defense[0]));
|
|
|
|
|
MemCpy(&fileSelect->defense[2], sramCtx->readBuff + SLOT_OFFSET(2) + DEFENSE, sizeof(fileSelect->defense[0]));
|
|
|
|
|
|
|
|
|
|
MemCpy(&fileSelect->health[0], sramCtx->readBuff + SLOT_OFFSET(0) + HEALTH, sizeof(fileSelect->health[0]));
|
|
|
|
|
MemCpy(&fileSelect->health[1], sramCtx->readBuff + SLOT_OFFSET(1) + HEALTH, sizeof(fileSelect->health[0]));
|
|
|
|
|
MemCpy(&fileSelect->health[2], sramCtx->readBuff + SLOT_OFFSET(2) + HEALTH, sizeof(fileSelect->health[0]));
|
|
|
|
|
|
|
|
|
|
osSyncPrintf("f_64dd=%d, %d, %d\n", fileSelect->n64ddFlags[0], fileSelect->n64ddFlags[1],
|
|
|
|
|
fileSelect->n64ddFlags[2]);
|
|
|
|
|
osSyncPrintf("heart_status=%d, %d, %d\n", fileSelect->defense[0], fileSelect->defense[1], fileSelect->defense[2]);
|
|
|
|
|
osSyncPrintf("now_life=%d, %d, %d\n", fileSelect->health[0], fileSelect->health[1], fileSelect->health[2]);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
u16 offset;
|
|
|
|
|
u16 j;
|
|
|
|
|
u16* ptr;
|
|
|
|
|
u16 checksum;
|
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
if (fileSelect->buttonIndex != 0) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
Sram_InitNewSave();
|
|
|
|
|
} else {
|
|
|
|
|
Sram_InitDebugSave();
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-26 21:15:41 +00:00
|
|
|
|
gSaveContext.entranceIndex = ENTR_LINKS_HOUSE_0;
|
2022-01-25 00:08:37 +00:00
|
|
|
|
gSaveContext.linkAge = LINK_AGE_CHILD;
|
2022-05-20 18:40:13 +00:00
|
|
|
|
gSaveContext.dayTime = CLOCK_TIME(10, 0);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
gSaveContext.cutsceneIndex = 0xFFF1;
|
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
if (fileSelect->buttonIndex == 0) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
gSaveContext.cutsceneIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (offset = 0; offset < 8; offset++) {
|
2022-06-23 21:34:26 +00:00
|
|
|
|
gSaveContext.playerName[offset] = fileSelect->fileNames[fileSelect->buttonIndex][offset];
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gSaveContext.newf[0] = 'Z';
|
|
|
|
|
gSaveContext.newf[1] = 'E';
|
|
|
|
|
gSaveContext.newf[2] = 'L';
|
|
|
|
|
gSaveContext.newf[3] = 'D';
|
|
|
|
|
gSaveContext.newf[4] = 'A';
|
|
|
|
|
gSaveContext.newf[5] = 'Z';
|
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
gSaveContext.n64ddFlag = fileSelect->n64ddFlag;
|
|
|
|
|
osSyncPrintf("64DDフラグ=%d\n", fileSelect->n64ddFlag);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("newf=%x,%x,%x,%x,%x,%x\n", gSaveContext.newf[0], gSaveContext.newf[1], gSaveContext.newf[2],
|
|
|
|
|
gSaveContext.newf[3], gSaveContext.newf[4], gSaveContext.newf[5]);
|
|
|
|
|
osSyncPrintf("\n$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
|
|
|
|
|
|
|
|
|
|
ptr = (u16*)&gSaveContext;
|
|
|
|
|
j = 0;
|
|
|
|
|
checksum = 0;
|
|
|
|
|
|
|
|
|
|
for (offset = 0; offset < CHECKSUM_SIZE; offset++) {
|
|
|
|
|
osSyncPrintf("%x ", *ptr);
|
|
|
|
|
checksum += *ptr++;
|
2021-10-03 03:17:09 +00:00
|
|
|
|
if (++j == 0x20) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("\n");
|
|
|
|
|
j = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gSaveContext.checksum = checksum;
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("\nチェックサム=%x\n", gSaveContext.checksum); // "Checksum = %x"
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
offset = gSramSlotOffsets[gSaveContext.fileNum];
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("I=%x no=%d\n", offset, gSaveContext.fileNum);
|
2022-05-01 22:06:35 +00:00
|
|
|
|
MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
offset = gSramSlotOffsets[gSaveContext.fileNum + 3];
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("I=%x no=%d\n", offset, gSaveContext.fileNum + 3);
|
2022-05-01 22:06:35 +00:00
|
|
|
|
MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
|
|
|
|
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
|
|
|
|
|
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("SAVE終了\n"); // "SAVE end"
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("z_common_data.file_no = %d\n", gSaveContext.fileNum);
|
|
|
|
|
osSyncPrintf("SAVECT=%x, NAME=%x, LIFE=%x, ITEM=%x, SAVE_64DD=%x\n", DEATHS, NAME, HEALTH_CAP, QUEST, N64DD);
|
|
|
|
|
|
2021-06-01 17:31:29 +00:00
|
|
|
|
j = gSramSlotOffsets[gSaveContext.fileNum];
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
MemCpy(&fileSelect->deaths[gSaveContext.fileNum], sramCtx->readBuff + j + DEATHS, sizeof(fileSelect->deaths[0]));
|
|
|
|
|
MemCpy(&fileSelect->fileNames[gSaveContext.fileNum], sramCtx->readBuff + j + NAME,
|
|
|
|
|
sizeof(fileSelect->fileNames[0]));
|
|
|
|
|
MemCpy(&fileSelect->healthCapacities[gSaveContext.fileNum], sramCtx->readBuff + j + HEALTH_CAP,
|
|
|
|
|
sizeof(fileSelect->healthCapacities[0]));
|
|
|
|
|
MemCpy(&fileSelect->questItems[gSaveContext.fileNum], sramCtx->readBuff + j + QUEST,
|
|
|
|
|
sizeof(fileSelect->questItems[0]));
|
|
|
|
|
MemCpy(&fileSelect->n64ddFlags[gSaveContext.fileNum], sramCtx->readBuff + j + N64DD,
|
|
|
|
|
sizeof(fileSelect->n64ddFlags[0]));
|
|
|
|
|
MemCpy(&fileSelect->defense[gSaveContext.fileNum], sramCtx->readBuff + j + DEFENSE, sizeof(fileSelect->defense[0]));
|
|
|
|
|
MemCpy(&fileSelect->health[gSaveContext.fileNum], sramCtx->readBuff + j + HEALTH, sizeof(fileSelect->health[0]));
|
|
|
|
|
|
|
|
|
|
osSyncPrintf("f_64dd[%d]=%d\n", gSaveContext.fileNum, fileSelect->n64ddFlags[gSaveContext.fileNum]);
|
|
|
|
|
osSyncPrintf("heart_status[%d]=%d\n", gSaveContext.fileNum, fileSelect->defense[gSaveContext.fileNum]);
|
|
|
|
|
osSyncPrintf("now_life[%d]=%d\n", gSaveContext.fileNum, fileSelect->health[gSaveContext.fileNum]);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
void Sram_EraseSave(FileSelectState* fileSelect, SramContext* sramCtx) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
s32 offset;
|
|
|
|
|
|
|
|
|
|
Sram_InitNewSave();
|
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
offset = gSramSlotOffsets[fileSelect->selectedFileIndex];
|
2022-05-01 22:06:35 +00:00
|
|
|
|
MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
2020-10-11 17:45:08 +00:00
|
|
|
|
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
MemCpy(&fileSelect->n64ddFlags[fileSelect->selectedFileIndex], sramCtx->readBuff + offset + N64DD,
|
|
|
|
|
sizeof(fileSelect->n64ddFlags[0]));
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
offset = gSramSlotOffsets[fileSelect->selectedFileIndex + 3];
|
2022-05-01 22:06:35 +00:00
|
|
|
|
MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
2020-10-11 17:45:08 +00:00
|
|
|
|
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
|
|
|
|
|
|
|
|
|
|
osSyncPrintf("CLEAR終了\n");
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
void Sram_CopySave(FileSelectState* fileSelect, SramContext* sramCtx) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
s32 offset;
|
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
osSyncPrintf("READ=%d(%x) COPY=%d(%x)\n", fileSelect->selectedFileIndex,
|
|
|
|
|
gSramSlotOffsets[fileSelect->selectedFileIndex], fileSelect->copyDestFileIndex,
|
|
|
|
|
gSramSlotOffsets[fileSelect->copyDestFileIndex]);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
offset = gSramSlotOffsets[fileSelect->selectedFileIndex];
|
2022-05-01 22:06:35 +00:00
|
|
|
|
MemCpy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save));
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
offset = gSramSlotOffsets[fileSelect->copyDestFileIndex];
|
2022-05-01 22:06:35 +00:00
|
|
|
|
MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
offset = gSramSlotOffsets[fileSelect->copyDestFileIndex + 3];
|
2022-05-01 22:06:35 +00:00
|
|
|
|
MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
|
|
|
|
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
|
|
|
|
|
|
2022-06-23 21:34:26 +00:00
|
|
|
|
offset = gSramSlotOffsets[fileSelect->copyDestFileIndex];
|
|
|
|
|
|
|
|
|
|
MemCpy(&fileSelect->deaths[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + DEATHS,
|
|
|
|
|
sizeof(fileSelect->deaths[0]));
|
|
|
|
|
MemCpy(&fileSelect->fileNames[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + NAME,
|
|
|
|
|
sizeof(fileSelect->fileNames[0]));
|
|
|
|
|
MemCpy(&fileSelect->healthCapacities[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + HEALTH_CAP,
|
|
|
|
|
sizeof(fileSelect->healthCapacities[0]));
|
|
|
|
|
MemCpy(&fileSelect->questItems[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + QUEST,
|
|
|
|
|
sizeof(fileSelect->questItems[0]));
|
|
|
|
|
MemCpy(&fileSelect->n64ddFlags[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + N64DD,
|
|
|
|
|
sizeof(fileSelect->n64ddFlags[0]));
|
|
|
|
|
MemCpy(&fileSelect->defense[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + DEFENSE,
|
|
|
|
|
sizeof(fileSelect->defense[0]));
|
|
|
|
|
MemCpy(&fileSelect->health[fileSelect->copyDestFileIndex], (sramCtx->readBuff + offset) + HEALTH,
|
|
|
|
|
sizeof(fileSelect->health[0]));
|
|
|
|
|
|
|
|
|
|
osSyncPrintf("f_64dd[%d]=%d\n", gSaveContext.fileNum, fileSelect->n64ddFlags[gSaveContext.fileNum]);
|
|
|
|
|
osSyncPrintf("heart_status[%d]=%d\n", gSaveContext.fileNum, fileSelect->defense[gSaveContext.fileNum]);
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("COPY終了\n"); // "Copy end"
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-15 21:33:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* Write the first 16 bytes of the read buffer to the SRAM header
|
|
|
|
|
*/
|
|
|
|
|
void Sram_WriteSramHeader(SramContext* sramCtx) {
|
|
|
|
|
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_HEADER_SIZE, OS_WRITE);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
|
|
|
|
|
u16 i;
|
|
|
|
|
|
|
|
|
|
osSyncPrintf("sram_initialize( Game *game, Sram *sram )\n");
|
|
|
|
|
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_COUNTU(sZeldaMagic) - 3; i++) {
|
2021-11-15 21:33:44 +00:00
|
|
|
|
if (sZeldaMagic[i + SRAM_HEADER_MAGIC] != sramCtx->readBuff[i + SRAM_HEADER_MAGIC]) {
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("SRAM破壊!!!!!!\n"); // "SRAM destruction! ! ! ! ! !"
|
2021-11-15 21:33:44 +00:00
|
|
|
|
gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE];
|
2022-05-01 22:06:35 +00:00
|
|
|
|
MemCpy(sramCtx->readBuff, sZeldaMagic, sizeof(sZeldaMagic));
|
2021-11-15 21:33:44 +00:00
|
|
|
|
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language;
|
|
|
|
|
Sram_WriteSramHeader(sramCtx);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-15 21:33:44 +00:00
|
|
|
|
gSaveContext.audioSetting = sramCtx->readBuff[SRAM_HEADER_SOUND] & 3;
|
|
|
|
|
gSaveContext.zTargetSetting = sramCtx->readBuff[SRAM_HEADER_ZTARGET] & 1;
|
|
|
|
|
gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE];
|
2020-10-11 17:45:08 +00:00
|
|
|
|
|
z_message_PAL, message_data_static and surrounding doc (#996)
* Initial progress on z_message_PAL, very messy
* Fix merge
* Some more progress
* Fix merge
* More z_message_PAL
* Small progress
* More small progress
* message_data_static files OK
* Prepare z_message_tables
* Matched another function, small updates
* Attempt to use asm-processor static-symbols branch
* Refactor text id declarations
* Begin large text codes parser function
* Fix merge
* Refactor done
* Build OK, add color and highscore names
* Remove encoded text headers and automatically encode during build
* Fix kanfont
* Various cleanups
* DISP macros
* Another match aside data
* Further progress
* Small improvements
* Deduplicate magic values for text control codes, small improvements
* Tiny progress
* Minor cleanups
* Clean up z_message_PAL comment
* Progress on large functions
* Further progress on large functions
* Changes to mkldscript to link .data in the .rodata section
* data OK
* Few improvements
* Use gDPLoadTextureBlock macros where appropriate
* rm z_message_tables, progress on large functions
* 2 more matches
* Improvements
* Small progress
* More progress on big function
* progress
* match func_80107980
* match Message_Update
* match func_8010BED8
* done
* Progress on remaining large functions
* Small progress on largest function
* Another match, extract text and move to assets, improve text build system
* Small nonmatchings improvements
* docs wip
* Largest function maybe equivalent
* Fix merge
* Document do_action values, largest function is almost instruction-matching
* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice
* Fix merge
* one match
* Last function is instruction-matching
* Fix
* Improvements thanks to engineer124
* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup
* More variables labeled, use text state enum everywhere
* More labels and names
* Fix
* Actor_IsTalking -> Actor_TalkRequested
* Match func_8010C39C and remove unused asm
* More docs
* Mostly ocarina related docs
* All msgModes named
* Fix assetclean
* Cleanup
* Extraction fixes and headers
* Suggestions
* Review suggestions
* Change text extraction again, only extract if the headers do not already exist
* Fix
* Use ast for charmap, fix assetclean for real this time
* Review suggestions
* BGM ids and ran formatter
* Review comments
* rename include_readonly to include_data_with_rodata
* Remove leading 0s in number directives
* Review suggestions for message_data_static
* textbox pos enum comments, rename several enum names from Message to TextBox
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
2021-11-23 01:20:30 +00:00
|
|
|
|
if (gSaveContext.language >= LANGUAGE_MAX) {
|
|
|
|
|
gSaveContext.language = LANGUAGE_ENG;
|
2021-11-15 21:33:44 +00:00
|
|
|
|
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language;
|
|
|
|
|
Sram_WriteSramHeader(sramCtx);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(gameState->input[2].cur.button, BTN_DRIGHT)) {
|
|
|
|
|
bzero(sramCtx->readBuff, SRAM_SIZE);
|
|
|
|
|
for (i = 0; i < CHECKSUM_SIZE; i++) {
|
|
|
|
|
sramCtx->readBuff[i] = i;
|
|
|
|
|
}
|
|
|
|
|
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
|
2021-09-04 13:33:19 +00:00
|
|
|
|
osSyncPrintf("SRAM破壊!!!!!!\n"); // "SRAM destruction! ! ! ! ! !"
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-04 13:33:19 +00:00
|
|
|
|
// "GOOD! GOOD! Size = %d + %d = %d"
|
2020-10-11 17:45:08 +00:00
|
|
|
|
osSyncPrintf("GOOD!GOOD! サイズ=%d + %d = %d\n", sizeof(SaveInfo), 4, sizeof(SaveInfo) + 4);
|
|
|
|
|
osSyncPrintf(VT_FGCOL(BLUE));
|
|
|
|
|
osSyncPrintf("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
|
|
|
|
|
osSyncPrintf("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
|
|
|
|
|
osSyncPrintf("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
|
|
|
|
|
osSyncPrintf(VT_RST);
|
|
|
|
|
func_800F6700(gSaveContext.audioSetting);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Sram_Alloc(GameState* gameState, SramContext* sramCtx) {
|
|
|
|
|
sramCtx->readBuff = GameState_Alloc(gameState, SRAM_SIZE, "../z_sram.c", 1294);
|
2021-04-29 18:39:46 +00:00
|
|
|
|
ASSERT(sramCtx->readBuff != NULL, "sram->read_buff != NULL", "../z_sram.c", 1295);
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
|
void Sram_Init(PlayState* play, SramContext* sramCtx) {
|
2020-10-11 17:45:08 +00:00
|
|
|
|
}
|