diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/main.h | 4 | ||||
-rw-r--r-- | include/options.h | 15 | ||||
-rw-r--r-- | include/pokemon.h | 2 | ||||
-rw-r--r-- | include/save_block_2.h | 71 | ||||
-rw-r--r-- | include/sound.h | 2 | ||||
-rw-r--r-- | include/structs.h | 44 |
6 files changed, 62 insertions, 76 deletions
diff --git a/include/main.h b/include/main.h index ec3fca46..b61e68b9 100644 --- a/include/main.h +++ b/include/main.h @@ -3,7 +3,7 @@ #include "FS_overlay.h" #include "SPI_pm.h" -#include "structs.h" +#include "save_block_2.h" struct UnkStruct_02006234; @@ -36,7 +36,7 @@ struct Unk2106FA0 struct Unk21DBE18 * unk14; s32 unk18; s32 unk1C; - struct UnkStruct_021C59C8 * unk20; + struct SaveBlock2 * unk20; }; struct Unk21C4818 diff --git a/include/options.h b/include/options.h deleted file mode 100644 index 730cbaa5..00000000 --- a/include/options.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef POKEDIAMOND_OPTIONS_H -#define POKEDIAMOND_OPTIONS_H - -#include "main.h" - -struct Options { - u16 unk0_0:4; - u16 unk0_4:2; - u16 unk0_6:10; - u8 padding[2]; // TODO: finish me -}; - -struct Options * LoadPlayerDataAddress(struct UnkStruct_021C59C8 *); - -#endif //POKEDIAMOND_OPTIONS_H diff --git a/include/pokemon.h b/include/pokemon.h index 6148544f..cf5d3377 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -304,7 +304,7 @@ int LowestFlagNo(u32 mask); BOOL IsPokemonLegendaryOrMythical(u16 species); u16 GetLegendaryMon(u32 idx); BOOL FUN_0206A998(struct Pokemon * pokemon); -BOOL FUN_0206A9AC(struct BoxPokemon * boxmon, struct SaveBlock2 * sb2, u32 heap_id); +BOOL FUN_0206A9AC(struct BoxPokemon * boxmon, struct PlayerData * sb2, u32 heap_id); void FUN_0206AA84(struct Pokemon * pokemon); void FUN_0206AAB4(struct BoxPokemon * boxmon); diff --git a/include/save_block_2.h b/include/save_block_2.h index bfac686d..bb2fb2df 100644 --- a/include/save_block_2.h +++ b/include/save_block_2.h @@ -2,6 +2,14 @@ #define POKEDIAMOND_SAVE_BLOCK_2_H #include "pokemon.h" +#include "MATH_crc.h" + +struct Options { + u16 unk0_0:4; + u16 unk0_4:2; + u16 unk0_6:10; + u8 padding[2]; // TODO: finish me +}; struct SavArrayHeader { @@ -12,26 +20,63 @@ struct SavArrayHeader u16 field_E; }; +struct PlayerData +{ + /* 0x00 */ u16 playerName[OT_NAME_LENGTH + 1]; + /* 0x10 */ u32 playerId; + /* 0x14 */ u32 money; + /* 0x18 */ u8 gender; + /* 0x19 */ u8 language; + /* 0x1A */ u8 badges; + /* 0x1B */ u8 avatar; + /* 0x1C */ u8 field_1C; + /* 0x1D */ u8 field_1D_0:1; + u8 field_1D_1:1; +}; + +struct PlayerDataSav +{ + struct Options options; + struct PlayerData data; + u16 field_24; + u16 field_26; + u32 field_28; +}; + +struct SaveBlock2_Sub_20464 { + u8 unk_0; + u8 padding[3]; + int unk_4; + int unk_8; + u8 unk_C; + u8 unk_D; + u8 unk_E; + u8 padding2; +}; + struct SaveBlock2 { - /* 0x00000 */ u16 playerName[OT_NAME_LENGTH + 1]; - /* 0x00010 */ u32 playerId; - /* 0x00014 */ u32 money; - /* 0x00018 */ u8 gender; - /* 0x00019 */ u8 origin; - /* 0x0001A */ u8 badges; - /* 0x0001B */ u8 avatar; - /* 0x0001C */ u8 filler_0001C[0x1F8]; + /* 0x00000 */ int unk_00000; + /* 0x00004 */ int unk_00004; + /* 0x00008 */ int unk_00008; + /* 0x0000C */ int unk_0000C; + /* 0x00010 */ int unk_00010; + /* 0x00014 */ struct MATHCRC16Table unk_00014; /* 0x00214 */ u8 dynamic_region[0x20000]; - /* 0x20214 */ u8 filler_20214[16]; + /* 0x20214 */ int unk_20214; + /* 0x20218 */ u8 unk_20218[8]; + /* 0x20220 */ int unk_20220; /* 0x20224 */ struct SavArrayHeader arrayHeaders[36]; - /* 0x20464 */ u8 filler_20464[0x44]; + /* 0x20464 */ struct SaveBlock2_Sub_20464 unk_20464[4]; + /* 0x204A4 */ int unk_204A4; // TODO: finish this struct }; // size: 0x204A8 -struct String * FUN_020239A0(struct SaveBlock2 *, u32 heap_id); -u32 FUN_020239BC(struct SaveBlock2 *); -u32 FUN_020239CC(struct SaveBlock2 *); +struct String * PlayerData_GetPlayerName_NewString(struct PlayerData *, u32 heap_id); +u32 PlayerData_GetTrainerID(struct PlayerData *); +u32 PlayerData_GetTrainerGender(struct PlayerData *); void * SavArray_get(struct SaveBlock2 *, int); +struct Options * LoadPlayerDataAddress(struct SaveBlock2 *); + #endif //POKEDIAMOND_SAVE_BLOCK_2_H diff --git a/include/sound.h b/include/sound.h index a79e6ecf..6e78bfa4 100644 --- a/include/sound.h +++ b/include/sound.h @@ -3,7 +3,7 @@ #include "FS_file.h" #include "sdat.h" -#include "options.h" +#include "save_block_2.h" struct SoundData { diff --git a/include/structs.h b/include/structs.h deleted file mode 100644 index fbcf6e0c..00000000 --- a/include/structs.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef POKEDIAMOND_STRUCTS_H -#define POKEDIAMOND_STRUCTS_H - -#include "pokemon.h" -#include "map.h" - -// MATH -typedef u16 MATHCRC16Table[256]; - -struct UnkStruct_021C59C8_Sub20224 { - int unk_0; - int unk_4; - int unk_8; - u16 unk_C; - u16 unk_E; -}; - -struct UnkStruct_021C59C8_Sub_20464 { - u8 unk_0; - u8 padding[3]; - int unk_4; - int unk_8; - u8 unk_C; - u8 unk_D; - u8 unk_E; - u8 padding2; -}; - -struct UnkStruct_021C59C8 { - /* 0x00000 */ int unk_00000; - /* 0x00004 */ int unk_00004; - /* 0x00008 */ int unk_00008; - /* 0x0000C */ int unk_0000C; - /* 0x00010 */ int unk_00010; - /* 0x00014 */ MATHCRC16Table unk_00014; - /* 0x00214 */ u8 filler_00214[0x2004]; - /* 0x20218 */ u8 unk_20218[8]; - /* 0x20220 */ int unk_20220; - /* 0x20224 */ struct UnkStruct_021C59C8_Sub20224 unk_20224[36]; - /* 0x20464 */ struct UnkStruct_021C59C8_Sub_20464 unk_20464[4]; - /* 0x204A4 */ int unk_204A4; -}; - -#endif //POKEDIAMOND_STRUCTS_H |