Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
versioning.h File Reference

Go to the source code of this file.

Data Structures

struct  SaveGlobals
 
struct  VanillaSaveFileSummary
 
struct  VanillaPartnerData
 PartnerData struct from unmodified Paper Mario. More...
 
struct  VanillaPlayerData
 PlayerData struct from unmodified Paper Mario. More...
 
struct  VanillaSaveData
 SaveData struct from unmodified Paper Mario. More...
 
struct  SaveFileSummary
 
struct  SaveData
 

Functions

void fio_deserialize_state ()
 Load game data from gCurrentSaveFile Performs version checking and supports potential migration between versions.
 
void fio_serialize_state ()
 Store current game data to gCurrentSaveFile.
 

Variables

SaveData gCurrentSaveFile
 

Data Structure Documentation

◆ SaveGlobals

struct SaveGlobals
Data Fields
char magicString[16]
s8 pad[32]
s32 crc1
s32 crc2
s32 useMonoSound
u32 lastFileSelected
s8 reserved[64]

◆ VanillaSaveFileSummary

struct VanillaSaveFileSummary
Data Fields
s32 timePlayed
u8 spiritsRescued
unsigned char unk_05[1]
s8 level
char filename[8]
unsigned char unk_0F[9]

◆ VanillaPartnerData

struct VanillaPartnerData
Data Fields
u8 enabled
s8 level
s16 unk_02[3]

◆ VanillaPlayerData

struct VanillaPlayerData
Data Fields
s8 bootsLevel
s8 hammerLevel
s8 curHP
s8 curMaxHP
s8 hardMaxHP
s8 curFP
s8 curMaxFP
s8 hardMaxFP
s8 maxBP
s8 level
b8 hasActionCommands
unsigned char pad_00B
s16 coins
s8 fortressKeyCount
u8 starPieces
s8 starPoints
s8 unused_011
s8 curPartner
unsigned char pad_013
VanillaPartnerData partners[12]
s16 keyItems[32]
s16 badges[128]
s16 invItems[10]
s16 storedItems[32]
s16 equippedBadges[64]
s8 unused_288
s8 merleeSpellType
s8 merleeCastsLeft
unsigned char pad_28B
s16 merleeTurnCount
s8 maxStarPower
unsigned char pad_28F
s16 starPower
s8 starBeamLevel
unsigned char pad_293
u16 actionCommandAttempts
u16 actionCommandSuccesses
u16 hitsTaken
u16 hitsBlocked
u16 playerFirstStrikes
u16 enemyFirstStrikes
u16 powerBounces
u16 battlesCount
u16 battlesWon
u16 fleeAttempts
u16 battlesFled
u16 trainingsDone
s32 walkingStepsTaken
s32 runningStepsTaken
u32 totalCoinsEarned
s16 idleFrameCounter
unsigned char pad_2BA[2]
u32 frameCounter
u16 quizzesAnswered
u16 quizzesCorrect
s32 partnerUnlockedTime[12]
s32 partnerUsedTime[12]
s32 tradeEventStartTime
s32 droTreeHintTime
u16 starPiecesCollected
u16 jumpGamePlays
u32 jumpGameTotal
u16 jumpGameRecord
u16 smashGamePlays
u32 smashGameTotal
u16 smashGameRecord
unsigned char pad_33E[0xEA]

◆ VanillaSaveData

struct VanillaSaveData
Data Fields
char magicString[16]
char version[32]
s32 crc1
s32 crc2
s32 saveSlot
s32 saveCount
VanillaPlayerData player
s16 areaID
s16 mapID
s16 entryID
unsigned char unk_46E[2]
s32 enemyDefeatFlags[60][12]
s32 globalFlags[64]
s8 globalBytes[512]
s32 areaFlags[8]
s8 areaBytes[16]
s8 debugEnemyContact
b8 debugUnused1
b8 debugUnused2
b8 musicEnabled
unsigned char unk_12E4[0x2]
Vec3s savePos
VanillaSaveFileSummary summary
unsigned char unk_1304[0x7C]

◆ SaveFileSummary

struct SaveFileSummary
Data Fields
s32 timePlayed
u8 spiritsRescued
unsigned char unused_05[1]
s8 level
char filename[8]
unsigned char unused_0F[9]

◆ SaveData

struct SaveData
Data Fields
char magicString[16]
char modName[28]
s8 majorVersion
s8 minorVersion
s8 patchVersion
char reserved
s32 crc1
s32 crc2
s32 saveSlot
s32 saveCount
PlayerData player
s16 areaID
s16 mapID
s16 entryID
unsigned char unk_46E[2]
s32 enemyDefeatFlags[60][12]
s32 globalFlags[64]
s8 globalBytes[512]
s32 areaFlags[8]
s8 areaBytes[16]
s8 debugEnemyContact
b8 debugUnused1
b8 debugUnused2
b8 musicEnabled
unsigned char unk_12E4[0x2]
Vec3s savePos
SaveFileSummary summary
unsigned char unk_1304[0x7C]

◆ SaveSlotMetadata

struct SaveSlotMetadata
Data Fields
char modName[28]
b8 hasData
b8 validData
unsigned char pad[5]

Function Documentation

◆ fio_deserialize_state()

void fio_deserialize_state ( )

Load game data from gCurrentSaveFile Performs version checking and supports potential migration between versions.

Definition at line 36 of file versioning.c.

36 {
37 SaveData* saveData = &gCurrentSaveFile;
38
39 if (saveData->modName[0] == '\0') {
40 // handle loading vanilla saves here
42 } else if (strcmp(saveData->modName, DX_MOD_NAME) != 0) {
43 // handle loading saves from other mods here
44 // by default, dx assumes other mod save data format is vanilla
46 } else if (saveData->majorVersion != DX_MOD_VER_MAJOR) {
47 // handle breaking changes between major versions here
49 } else {
51 }
52
57}
#define DX_MOD_VER_MAJOR
Definition config.h:8
#define DX_MOD_NAME
Creates the version string that appears on the file select menu.
Definition config.h:7
@ DEBUG_CONTACT_NONE
Definition enums.h:4267
GameStatus gGameStatus
Definition main_loop.c:21
void ver_deserialize_vanilla_save(SaveData *save)
Definition versioning.c:503
void ver_deserialize_standard()
Load save file data from a supported save version Assumes no changes in the SaveData,...
Definition versioning.c:61
s8 majorVersion
Definition versioning.h:146
SaveData gCurrentSaveFile
Definition fio.c:21
char modName[28]
Definition versioning.h:145

◆ fio_serialize_state()

void fio_serialize_state ( )

Store current game data to gCurrentSaveFile.

Definition at line 9 of file versioning.c.

9 {
10 SaveData* saveData = &gCurrentSaveFile;
11 s32 i, j;
12
13 saveData->player = gPlayerData;
14
15 saveData->areaID = gGameStatus.areaID;
16 saveData->mapID = gGameStatus.mapID;
17 saveData->entryID = gGameStatus.entryID;
18 saveData->savePos.x = gGameStatus.savedPos.x;
19 saveData->savePos.y = gGameStatus.savedPos.y;
20 saveData->savePos.z = gGameStatus.savedPos.z;
21
22 for (i = 0; i < ARRAY_COUNT(gCurrentEncounter.defeatFlags[0]); i++) {
23 for (j = 0; j < ARRAY_COUNT(gCurrentEncounter.defeatFlags); j++) {
24 saveData->enemyDefeatFlags[j][i] = gCurrentEncounter.defeatFlags[j][i];
25 }
26 }
27
32}
EncounterStatus gCurrentEncounter
Definition encounter.c:176
s32 defeatFlags[60][12]
Definition npc.h:403
#define ARRAY_COUNT(arr)
Definition macros.h:40
PlayerData gPlayerData
Definition 77480.c:40
s8 debugEnemyContact
Definition versioning.h:164
PlayerData player
Definition versioning.h:154
b8 debugUnused1
Definition versioning.h:165
s32 enemyDefeatFlags[60][12]
Definition versioning.h:159
b8 debugUnused2
Definition versioning.h:166
Vec3s savePos
Definition versioning.h:169
s16 entryID
Definition versioning.h:157
b8 musicEnabled
Definition versioning.h:167

Referenced by fio_save_game().

Variable Documentation

◆ gCurrentSaveFile