diff options
| author | notyourav <65437533+notyourav@users.noreply.github.com> | 2023-08-06 18:52:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-06 18:52:38 -0700 |
| commit | 2ebab6f49fab270672082bafcee79c895ee78f1b (patch) | |
| tree | 5db2aceb19b59c0275b86f7386c704ef63cf5463 /include | |
| parent | 8a294a49b68212a111d3fa2b25a80698eeb94051 (diff) | |
| parent | 758ec0722cee29ff94c415575a27ad5f5aea344d (diff) | |
Merge pull request #620 from Henny022p/savefile
SaveFile cleanup
Diffstat (limited to 'include')
| -rw-r--r-- | include/global.h | 7 | ||||
| -rw-r--r-- | include/player.h | 7 | ||||
| -rw-r--r-- | include/room.h | 18 | ||||
| -rw-r--r-- | include/save.h | 87 | ||||
| -rw-r--r-- | include/windcrest.h | 15 |
5 files changed, 90 insertions, 44 deletions
diff --git a/include/global.h b/include/global.h index 9b3557ce..3cd7c1d0 100644 --- a/include/global.h +++ b/include/global.h @@ -145,4 +145,11 @@ union SplitHWord { /* forward decls */ struct Entity_; +/** + * bitset macros + */ + +#define BIT(bit) (1 << (bit)) +#define IS_BIT_SET(value, bit) ((value)&BIT(bit)) + #endif // GLOBAL_H diff --git a/include/player.h b/include/player.h index eb347479..147ec5cb 100644 --- a/include/player.h +++ b/include/player.h @@ -353,20 +353,21 @@ typedef struct { /*0x05*/ u8 arrowCount; /*0x06*/ u8 bombBagType; /*0x07*/ u8 quiverType; - /*0x08*/ u8 filler[2]; + /*0x08*/ u8 figurineCount; + /*0x09*/ u8 _hasAllFigurines; /*0x0a*/ u8 charm; /*0x0b*/ u8 picolyteType; /*0x0c*/ u8 itemButtons[2]; /*0x0e*/ u8 bottles[4]; /*0x12*/ u8 effect; /*0x13*/ u8 hasAllFigurines; - /*0x14*/ u8 filler3[4]; + /*0x14*/ u8 filler14[4]; /*0x18*/ u16 rupees; /*0x1a*/ u16 shells; /*0x1c*/ u16 charmTimer; /*0x1e*/ u16 picolyteTimer; /*0x20*/ u16 effectTimer; - /*0x22*/ u8 filler4[6]; + /*0x22*/ u8 filler22[2]; } Stats; #define SLOT_A 0 diff --git a/include/room.h b/include/room.h index 57999ae2..a23dff14 100644 --- a/include/room.h +++ b/include/room.h @@ -133,7 +133,7 @@ typedef struct { /* 0x04 */ s16 start_pos_x; /* 0x06 */ s16 start_pos_y; /* 0x08 */ u8 layer; - /* 0x09 */ u8 field_0x15; + /* 0x09 */ u8 filler9; /* 0x0a */ u8 dungeon_area; /* 0x0b */ u8 dungeon_room; /* 0x0c */ s16 dungeon_x; @@ -142,7 +142,7 @@ typedef struct { /* 0x12 */ u16 dungeon_map_y; /* 0x14 */ u16 overworld_map_x; /* 0x16 */ u16 overworld_map_y; - /* 0x18 */ u8 field_0x24[8]; + /* 0x18 */ u8 filler18[8]; } PlayerRoomStatus; static_assert(sizeof(PlayerRoomStatus) == 0x20); @@ -155,8 +155,20 @@ typedef struct { /* 0x0a */ u16 stairs_idx; // seems to be a tile type /* 0x0c */ PlayerRoomStatus player_status; /* 0x2c */ u8 entity_update_type; // differentiates entity priority on kinstone menu? - /* 0x2d */ u8 field_0x2c[0x8]; + /* 0x2d */ u8 field2d; + /* 0x2e */ u8 location; + /* 0x2f */ u8 field2f; + /* 0x30 */ u8 field30; + /* 0x31 */ u8 field31; + /* 0x32 */ u8 field32; + /* 0x33 */ u8 field33; +#if defined(JP) || defined(EU) + /* 0x34 */ u8 hint_height; + /* 0x35 */ u8 field35; +#else + /* 0x34 */ u8 field35; /* 0x35 */ u8 hint_height; +#endif /* 0x36 */ u16 hint_idx; /* 0x38 */ u8 field_0x38; /* 0x39 */ u8 field_0x39; diff --git a/include/save.h b/include/save.h index aa206fe5..fef0b9ae 100644 --- a/include/save.h +++ b/include/save.h @@ -33,46 +33,57 @@ extern SaveResult HandleSave(u32 idx); * The contents of this structure are read from and written to EEPROM. */ typedef struct { - /*0x000*/ u8 invalid; /**< File is invalid. */ - /*0x001*/ u8 initialized; /**< File is initialized. */ - /*0x002*/ u8 msg_speed; /**< Message speed. */ - /*0x003*/ u8 brightness; /**< Brightness. */ - /*0x004*/ u8 filler4[0x2]; - /*0x006*/ u8 saw_staffroll; - /*0x007*/ u8 unk7; // TODO rolling barrel state? - /*0x008*/ u8 global_progress; /**< @see UpdateGlobalProgress */ - /*0x009*/ u8 field_0x9[0x17]; - /*0x020*/ u16 field_0x20; - /*0x022*/ u8 field_0x22[0x1e]; - /*0x040*/ u32 windcrests; /**< Windcrest flags. */ - /*0x044*/ u8 filler44[0xC]; - /*0x050*/ u32 unk50; - /*0x054*/ u8 filler54[0x8]; - /*0x05C*/ u32 unk5C; - /*0x060*/ u32 areaVisitFlags[8]; /**< Area visit flags. */ - /*0x080*/ char name[FILENAME_LENGTH]; /**< Save file name. */ - /*0x086*/ u8 filler86[0x2]; + /*0x000*/ u8 invalid; /**< save file is invalid */ + /*0x001*/ u8 initialized; /**< save file is initialized */ + /*0x002*/ u8 msg_speed; /**< message speed setting */ + /*0x003*/ u8 brightness; /**< brightness setting */ + /*0x004*/ u8 filler4[2]; /**< unused filler */ + /*0x006*/ u8 saw_staffroll; /**< beat the game and watched the credits */ + /*0x007*/ u8 dws_barrel_state; /**< state of the big barrel in DWS, 0 or 2 */ + /*0x008*/ u8 global_progress; /**< @see UpdateGlobalProgress */ + /*0x009*/ u8 available_figurines; /**< figurines available to get */ + /*0x00A*/ u8 fillerA[22]; /**< unused filler */ + /*0x020*/ u16 map_hints; /**< bitmask, used by subtask MapHint */ + /*0x022*/ u8 filler22[30]; /**< unused filler */ + /*0x040*/ u32 windcrests; /**< upper 8 bit Windcrest flags @see WindcrestID + * lower bits used for other things */ + /*0x044*/ u8 filler44[12]; /**< unused filler */ + /*0x050*/ u32 enemies_killed; /**< number of enemies killed */ + /*0x054*/ u8 filler54[8]; /**< unused filler */ + /*0x05C*/ u32 items_bought; /**< number of items bought in stockwells shop */ + /*0x060*/ u32 areaVisitFlags[8]; /**< Area visit flags. */ + /*0x080*/ char name[FILENAME_LENGTH]; /**< Save file name. */ + /*0x086*/ u8 filler86[2]; /**< unused filler */ /*0x088*/ PlayerRoomStatus saved_status; /**< Player room status. */ /*0x0A8*/ Stats stats; /**< Player stats. */ - /*0x0D0*/ u8 fillerD0[34]; - /*0x0F2*/ u8 inventory[36]; - /*0x116*/ u8 didAllFusions; - /*0x117*/ u8 fusedKinstoneCount; - /*0x118*/ u8 kinstoneTypes[0x13]; // 0x65-0x75 for each kinstone type present in kinstone bag - /*0x12B*/ u8 kinstoneAmounts[0x13]; // amount of each kinstone type above - /*0x13E*/ u8 filler13E[3]; - /*0x141*/ u8 fuserProgress[128]; // indexed by fuser id, incremented after fusion - /*0x1C1*/ u8 fuserOffers[128]; // available kinstone fusion for each fuser - /*0x241*/ u8 fusedKinstones[13]; /**< Bitfield for fused kinstones. @see CheckKinstoneFused */ - /*0x24E*/ u8 fusionUnmarked[13]; /**< Bitfield for disabled fusion map markers. @see CheckFusionMapMarkerDisabled */ - /*0x25B*/ u8 filler25B; - /*0x25C*/ u8 flags[0x200]; /**< Flags. */ - /*0x45C*/ u8 dungeonKeys[0x10]; // TODO Indexed by dungeon id, keys per dungeon - /*0x46C*/ u8 dungeonItems[0x10]; // TODO items in the dungeon. 4: compass, 2: big key, 1: small key - /*0x47C*/ u8 dungeonWarps[0x10]; // TODO indexed by dungeon id, EnableDungeonWarp, IsDungeonWarpActive - /*0x48C*/ u32 timers[7]; - /*0x4A8*/ u32 demo_timer; /**< Demo timer. */ - /*0x4AC*/ u8 filler4ac[0x8]; + /*0x0CC*/ u8 fillerCC[2]; /**< unused filler */ + /*0x0D0*/ u8 figurines[36]; /**< figurine bitset */ + /*0x0F2*/ u8 inventory[36]; /**< 2 bit per item @see Item */ + /*0x116*/ u8 didAllFusions; /**< completed all 100 kinstone fusions */ + /*0x117*/ u8 fusedKinstoneCount; /**< number of kinstones fused */ + /*0x118*/ u8 kinstoneTypes[19]; /**< item id for each kinstone type present in kinstone bag */ + /*0x12B*/ u8 kinstoneAmounts[19]; /**< amount of each kinstone type above */ + /*0x13E*/ u8 filler13E[3]; /**< unused filler */ + /*0x141*/ u8 fuserProgress[128]; /**< indexed by fuser id, incremented after fusion */ + /*0x1C1*/ u8 fuserOffers[128]; /**< available kinstone fusion for each fuser */ + /*0x241*/ u8 fusedKinstones[13]; /**< bitfield for fused kinstones + * @see CheckKinstoneFused */ + /*0x24E*/ u8 fusionUnmarked[13]; /**< bitfield for disabled fusion map markers + * @see CheckFusionMapMarkerDisabled */ + /*0x25B*/ u8 filler25B; /**< unused filler */ + /*0x25C*/ u8 flags[0x200]; /**< flags */ + /*0x45C*/ u8 dungeonKeys[0x10]; /**< indexed by dungeon id, keys per dungeon */ + /*0x46C*/ u8 dungeonItems[0x10]; /**< dungeon items 4: compass, 2: big key, 1: small key */ + /*0x47C*/ u8 dungeonWarps[0x10]; /**< indexed by dungeon id */ + /*0x48C*/ u32 darknut_timer; /**< timer for darknut fight before Vaati fight */ + /*0x490*/ u32 drug_kill_count; /**< "timer" enemy kill count when turning in the last drug quest item */ + /*0x494*/ u32 biggoron_timer; /**< timer for biggoron mirror shield */ + /*0x498*/ u32 vaati_timer; /**< timer for vaati wrath fight */ + /*0x49C*/ u32 timer4; /**< "timer4" unused */ + /*0x4A0*/ u32 timer5; /**< "timer5" unused */ + /*0x4A4*/ u32 timer6; /**< "timer6" unused */ + /*0x4A8*/ u32 demo_timer; /**< timer for US demo version playtime limit */ + /*0x4AC*/ u8 filler4ac[8]; /**< unused filler */ } SaveFile; /** diff --git a/include/windcrest.h b/include/windcrest.h new file mode 100644 index 00000000..2c81c1e4 --- /dev/null +++ b/include/windcrest.h @@ -0,0 +1,15 @@ +#ifndef SAVEFILE_WINDCREST_H +#define SAVEFILE_WINDCREST_H + +typedef enum WindcrestID { + WINDCREST_MT_CRENEL = 24, + WINDCREST_VEIL_FALLS, + WINDCREST_CLOUD_TOPS, + WINDCREST_HYRULE_TOWN, + WINDCREST_LAKE_HYLIA, + WINDCREST_CASTOR_WILDS, + WINDCREST_SOUTH_HYRULE_FIELD, + WINDCREST_MINISH_WOODS, +} WindcrestID; + +#endif // SAVEFILE_WINDCREST_H |
