From f17073efa07f1ee054dd6ab1fdd2c5ce35dbf27a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 10 Aug 2020 10:11:48 -0400 Subject: Name some symbols in scrcmd space --- include/proto.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/proto.h b/include/proto.h index b45c2b48..c52b26ac 100644 --- a/include/proto.h +++ b/include/proto.h @@ -17,6 +17,6 @@ void FUN_02005E90(int, int, int, int); void FUN_020056AC(int, int, int, int, int); void FUN_020808AC(struct BoxPokemon *, int, int, int, int); void * FUN_02022610(void *, int); -void FUN_0200B7B8(u32 *, struct String *, struct String *); +void StringExpandPlaceholders(u32 *, struct String *, struct String *); #endif //POKEDIAMOND_PROTO_H -- cgit v1.2.3 From d5446788d822324d58b5a814fe6ca7aaaf6fa6d2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 12 Aug 2020 10:01:13 -0400 Subject: Rename scrcmds related to flags --- include/proto.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/proto.h b/include/proto.h index c52b26ac..506d0992 100644 --- a/include/proto.h +++ b/include/proto.h @@ -16,7 +16,7 @@ void FUN_02005E80(int); void FUN_02005E90(int, int, int, int); void FUN_020056AC(int, int, int, int, int); void FUN_020808AC(struct BoxPokemon *, int, int, int, int); -void * FUN_02022610(void *, int); +void * SavArray_get(void *, int); void StringExpandPlaceholders(u32 *, struct String *, struct String *); #endif //POKEDIAMOND_PROTO_H -- cgit v1.2.3 From ca2af0a5d0cf80c38995dde9e4d05246c11128e7 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 12 Aug 2020 10:50:18 -0400 Subject: more scrcmd names --- include/save_block_2.h | 2 +- include/script.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/save_block_2.h b/include/save_block_2.h index 38e11de4..ac5a2044 100644 --- a/include/save_block_2.h +++ b/include/save_block_2.h @@ -8,7 +8,7 @@ struct SaveBlock2 u8 filler_14[4]; u8 gender; u8 padding[3]; - // TODO: finish this struct + // TODO: finish this st ruct }; struct String * FUN_020239A0(struct SaveBlock2 *, u32 heap_id); diff --git a/include/script.h b/include/script.h index 494a9d9f..7c4dae6d 100644 --- a/include/script.h +++ b/include/script.h @@ -3,6 +3,7 @@ #include "global.h" #include "msgdata.h" +#include "save_block_2.h" struct ScriptContext; @@ -23,7 +24,7 @@ struct ScriptContext u32 unk74; struct MsgData * unk78; u8 *unk7C; - void * unk80; + struct SaveBlock2 * unk80; }; #define ScriptReadByte(ctx) (*(ctx->scriptPtr++)) -- cgit v1.2.3 From dda861d78ad47a85a54c4c6a2dd3f7e301e65fa5 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 12 Aug 2020 15:19:31 -0400 Subject: Decompile unk_02046294.s --> event_data.c --- include/event_data.h | 19 +++++++++++++++++++ include/party.h | 21 +++++++++++---------- include/pokemon.h | 3 ++- include/proto.h | 1 - include/save_block_2.h | 17 ++++++++++++----- 5 files changed, 44 insertions(+), 17 deletions(-) create mode 100644 include/event_data.h (limited to 'include') diff --git a/include/event_data.h b/include/event_data.h new file mode 100644 index 00000000..e1d46348 --- /dev/null +++ b/include/event_data.h @@ -0,0 +1,19 @@ +#ifndef GUARD_SCRIPT_STATE_H +#define GUARD_SCRIPT_STATE_H + +struct ScriptState +{ + u16 vars[288]; + u8 flags[364]; +}; + +u32 SavArray_Flags_sizeof(void); +void SavArray_Flags_init(struct ScriptState * state); +struct ScriptState * SavArray_Flags_get(struct SaveBlock2 * sav2); +BOOL CheckFlagInArray(struct ScriptState * state, u16 flag_id); +void SetFlagInArray(struct ScriptState * state, u16 flag_id); +void ClearFlagInArray(struct ScriptState * state, u16 flag_id); +u8 * GetFlagAddr(struct ScriptState * state, u16 flag_id); +u16 * GetVarAddr(struct ScriptState * state, u16 var_id); + +#endif //GUARD_SCRIPT_STATE_H diff --git a/include/party.h b/include/party.h index eca62239..2d06705c 100644 --- a/include/party.h +++ b/include/party.h @@ -2,19 +2,20 @@ #define POKEDIAMOND_PARTY_H #include "pokemon.h" +#include "save_block_2.h" BOOL PartyHasMon(struct PlayerParty * party_p, u16 species); int GetPartyCount(struct PlayerParty * party_p); struct Pokemon * GetPartyMonByIndex(struct PlayerParty * party_p, int idx); -u32 FUN_0206B8A4(void); -struct PlayerParty * FUN_0206B8AC(u32 heap_id); -void FUN_0206B8C0(struct PlayerParty * party); -void FUN_0206B8CC(struct PlayerParty * party, int count); -BOOL FUN_0206B900(struct PlayerParty * party, struct Pokemon * pokemon); -BOOL FUN_0206B938(struct PlayerParty * party, int pos); -void FUN_0206B9DC(struct PlayerParty * party, int pos, struct Pokemon * pokemon); -BOOL FUN_0206BA38(struct PlayerParty * party, int pos1, int pos2); -void FUN_0206BAD0(struct PlayerParty * src, struct PlayerParty * dest); -struct PlayerParty * FUN_0206BB1C(void * ptr); +u32 SavArray_Party_sizeof(void); +struct PlayerParty * SavArray_Party_alloc(u32 heap_id); +void SavArray_Party_init(struct PlayerParty * party); +void InitPartyWithMaxSize(struct PlayerParty * party, int count); +BOOL AddMonToParty(struct PlayerParty * party, struct Pokemon * pokemon); +BOOL RemoveMonFromParty(struct PlayerParty * party, int pos); +void ReplacePartySlotWithMon(struct PlayerParty * party, int pos, struct Pokemon * pokemon); +BOOL SwapSlotsInParty(struct PlayerParty * party, int pos1, int pos2); +void CopyPlayerParty(struct PlayerParty * src, struct PlayerParty * dest); +struct PlayerParty * SavArray_PlayerParty_get(struct SaveBlock2 * ptr); #endif //POKEDIAMOND_PARTY_H diff --git a/include/pokemon.h b/include/pokemon.h index 2387ef78..6148544f 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -9,7 +9,6 @@ #include "seals.h" #include "constants/pokemon.h" #include "string16.h" -#include "save_block_2.h" struct BaseStats { /* 0x00 */ u8 hp; @@ -199,6 +198,8 @@ struct PlayerParty struct Pokemon mons[PARTY_SIZE]; }; +#include "save_block_2.h" + void ZeroMonData(struct Pokemon * pokemon); void ZeroBoxMonData(struct BoxPokemon * boxmon); u32 SizeOfStructPokemon(void); diff --git a/include/proto.h b/include/proto.h index 506d0992..fb2f8a78 100644 --- a/include/proto.h +++ b/include/proto.h @@ -16,7 +16,6 @@ void FUN_02005E80(int); void FUN_02005E90(int, int, int, int); void FUN_020056AC(int, int, int, int, int); void FUN_020808AC(struct BoxPokemon *, int, int, int, int); -void * SavArray_get(void *, int); void StringExpandPlaceholders(u32 *, struct String *, struct String *); #endif //POKEDIAMOND_PROTO_H diff --git a/include/save_block_2.h b/include/save_block_2.h index ac5a2044..b086e566 100644 --- a/include/save_block_2.h +++ b/include/save_block_2.h @@ -1,18 +1,25 @@ #ifndef POKEDIAMOND_SAVE_BLOCK_2_H #define POKEDIAMOND_SAVE_BLOCK_2_H +#include "pokemon.h" + struct SaveBlock2 { - u16 playerName[OT_NAME_LENGTH + 1]; - u32 playerId; - u8 filler_14[4]; - u8 gender; - u8 padding[3]; + /* 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[0x14]; + /* 0x00030 */ struct PlayerParty party; // TODO: finish this st ruct }; struct String * FUN_020239A0(struct SaveBlock2 *, u32 heap_id); u32 FUN_020239BC(struct SaveBlock2 *); u32 FUN_020239CC(struct SaveBlock2 *); +void * SavArray_get(struct SaveBlock2 *, int); #endif //POKEDIAMOND_SAVE_BLOCK_2_H -- cgit v1.2.3 From 9e8e57cacbdb4e75cb7e3adce06a957dec25c33f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 12 Aug 2020 15:52:49 -0400 Subject: Pad out struct SaveBlock2 --- include/save_block_2.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/save_block_2.h b/include/save_block_2.h index b086e566..bfac686d 100644 --- a/include/save_block_2.h +++ b/include/save_block_2.h @@ -3,6 +3,15 @@ #include "pokemon.h" +struct SavArrayHeader +{ + u32 id; + u32 size; + u32 offset; + u16 field_C; + u16 field_E; +}; + struct SaveBlock2 { /* 0x00000 */ u16 playerName[OT_NAME_LENGTH + 1]; @@ -12,10 +21,13 @@ struct SaveBlock2 /* 0x00019 */ u8 origin; /* 0x0001A */ u8 badges; /* 0x0001B */ u8 avatar; - /* 0x0001C */ u8 filler_0001C[0x14]; - /* 0x00030 */ struct PlayerParty party; - // TODO: finish this st ruct -}; + /* 0x0001C */ u8 filler_0001C[0x1F8]; + /* 0x00214 */ u8 dynamic_region[0x20000]; + /* 0x20214 */ u8 filler_20214[16]; + /* 0x20224 */ struct SavArrayHeader arrayHeaders[36]; + /* 0x20464 */ u8 filler_20464[0x44]; + // TODO: finish this struct +}; // size: 0x204A8 struct String * FUN_020239A0(struct SaveBlock2 *, u32 heap_id); u32 FUN_020239BC(struct SaveBlock2 *); -- cgit v1.2.3 From ad1e7f58f2912df805d9a768715497c9cc6a85c1 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 12 Aug 2020 16:52:18 -0400 Subject: Merge two struct definitions --- include/main.h | 4 +-- include/options.h | 15 ----------- include/pokemon.h | 2 +- include/save_block_2.h | 71 +++++++++++++++++++++++++++++++++++++++++--------- include/sound.h | 2 +- include/structs.h | 44 ------------------------------- 6 files changed, 62 insertions(+), 76 deletions(-) delete mode 100644 include/options.h delete mode 100644 include/structs.h (limited to 'include') 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 -- cgit v1.2.3 From 692b76fd27bf0b74a3fe871864c5d77387c05618 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 12 Aug 2020 19:35:47 -0400 Subject: Resolve warnings --- include/pokemon.h | 3 +-- include/save_block_2.h | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/pokemon.h b/include/pokemon.h index cf5d3377..1ab3c401 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -9,6 +9,7 @@ #include "seals.h" #include "constants/pokemon.h" #include "string16.h" +#include "save_block_2.h" struct BaseStats { /* 0x00 */ u8 hp; @@ -198,8 +199,6 @@ struct PlayerParty struct Pokemon mons[PARTY_SIZE]; }; -#include "save_block_2.h" - void ZeroMonData(struct Pokemon * pokemon); void ZeroBoxMonData(struct BoxPokemon * boxmon); u32 SizeOfStructPokemon(void); diff --git a/include/save_block_2.h b/include/save_block_2.h index bb2fb2df..e969bde7 100644 --- a/include/save_block_2.h +++ b/include/save_block_2.h @@ -1,7 +1,6 @@ #ifndef POKEDIAMOND_SAVE_BLOCK_2_H #define POKEDIAMOND_SAVE_BLOCK_2_H -#include "pokemon.h" #include "MATH_crc.h" struct Options { @@ -32,6 +31,8 @@ struct PlayerData /* 0x1C */ u8 field_1C; /* 0x1D */ u8 field_1D_0:1; u8 field_1D_1:1; + u8 field_1D_pad:6; + /* 0x1E */ u8 padding_1E[2]; }; struct PlayerDataSav -- cgit v1.2.3 From dd47776b7c311afdbfbb123485ecf2bf695a3c04 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 13 Aug 2020 08:24:20 -0400 Subject: Decompile coins.s --- include/coins.h | 13 +++++++++++++ include/options.h | 13 +++++++++++++ include/player_data.h | 39 +++++++++++++++++++++++++++++++++++++++ include/save_block_2.h | 38 +------------------------------------- 4 files changed, 66 insertions(+), 37 deletions(-) create mode 100644 include/coins.h create mode 100644 include/options.h create mode 100644 include/player_data.h (limited to 'include') diff --git a/include/coins.h b/include/coins.h new file mode 100644 index 00000000..f68d44a0 --- /dev/null +++ b/include/coins.h @@ -0,0 +1,13 @@ +#ifndef POKEDIAMOND_COINS_H +#define POKEDIAMOND_COINS_H + +#define MAX_COINS 50000 + +void InitCoins(u16 * coins); +void SetCoins(u16 * coins, u16 value); +u16 CheckCoins(u16 * coins); +BOOL GiveCoins(u16 * coins, u16 amount); +BOOL CanGiveCoins(u16 * coins, u16 amount); +BOOL TakeCoins(u16 * coins, u16 amount); + +#endif //POKEDIAMOND_COINS_H diff --git a/include/options.h b/include/options.h new file mode 100644 index 00000000..4ed466df --- /dev/null +++ b/include/options.h @@ -0,0 +1,13 @@ +#ifndef POKEDIAMOND_OPTIONS_H +#define POKEDIAMOND_OPTIONS_H + +struct Options { + u16 unk0_0:4; + u16 unk0_4:2; + u16 unk0_6:1; + u16 unk0_7:1; + u16 unk0_8:2; + u16 unk0_A:5; +}; + +#endif //POKEDIAMOND_OPTIONS_H diff --git a/include/player_data.h b/include/player_data.h new file mode 100644 index 00000000..f051b1ce --- /dev/null +++ b/include/player_data.h @@ -0,0 +1,39 @@ +#ifndef POKEDIAMOND_PLAYER_DATA_H +#define POKEDIAMOND_PLAYER_DATA_H + +#include "options.h" + +struct SaveBlock2; + +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; + u8 field_1D_pad:6; + /* 0x1E */ u8 padding_1E[2]; +}; + +struct PlayerDataSav +{ + struct Options options; + u8 padding[2]; + struct PlayerData data; + u16 field_24; + u16 field_26; + u32 field_28; +}; + +struct Options * LoadPlayerDataAddress(struct SaveBlock2 *); +struct String * PlayerData_GetPlayerName_NewString(struct PlayerData *, u32 heap_id); +u32 PlayerData_GetTrainerID(struct PlayerData *); +u32 PlayerData_GetTrainerGender(struct PlayerData *); + +#endif //POKEDIAMOND_PLAYER_DATA_H diff --git a/include/save_block_2.h b/include/save_block_2.h index e969bde7..fe052b1d 100644 --- a/include/save_block_2.h +++ b/include/save_block_2.h @@ -2,13 +2,7 @@ #define POKEDIAMOND_SAVE_BLOCK_2_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 -}; +#include "player_data.h" struct SavArrayHeader { @@ -19,31 +13,6 @@ 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; - u8 field_1D_pad:6; - /* 0x1E */ u8 padding_1E[2]; -}; - -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]; @@ -73,11 +42,6 @@ struct SaveBlock2 // TODO: finish this struct }; // size: 0x204A8 -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 -- cgit v1.2.3 From a13a7535cd78a113d23a8cccddced3d5f13ad479 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 13 Aug 2020 08:41:21 -0400 Subject: Decompile igt --- include/igt.h | 16 ++++++++++++++++ include/player_data.h | 7 ++++--- 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 include/igt.h (limited to 'include') diff --git a/include/igt.h b/include/igt.h new file mode 100644 index 00000000..bf5e5a63 --- /dev/null +++ b/include/igt.h @@ -0,0 +1,16 @@ +#ifndef POKEDIAMOND_IGT_H +#define POKEDIAMOND_IGT_H + +struct IGT +{ + u16 hours; + u8 minutes; + u8 seconds; +}; + +void InitIGT(struct IGT * igt); +void AddIGTSeconds(struct IGT * igt, u32 seconds); +u16 GetIGTHours(struct IGT * igt); +u8 GetIGTMinutes(struct IGT * igt); + +#endif //POKEDIAMOND_IGT_H diff --git a/include/player_data.h b/include/player_data.h index f051b1ce..04583052 100644 --- a/include/player_data.h +++ b/include/player_data.h @@ -2,6 +2,7 @@ #define POKEDIAMOND_PLAYER_DATA_H #include "options.h" +#include "igt.h" struct SaveBlock2; @@ -26,9 +27,9 @@ struct PlayerDataSav struct Options options; u8 padding[2]; struct PlayerData data; - u16 field_24; - u16 field_26; - u32 field_28; + u16 coins; + struct IGT igt; + u8 padding2[2]; }; struct Options * LoadPlayerDataAddress(struct SaveBlock2 *); -- cgit v1.2.3 From ddd20f2c76a34b4fc46503c8bf88d53a755453a8 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 13 Aug 2020 08:58:40 -0400 Subject: Rename routines in player_data.s --- include/player_data.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/player_data.h b/include/player_data.h index 04583052..28133f43 100644 --- a/include/player_data.h +++ b/include/player_data.h @@ -32,9 +32,9 @@ struct PlayerDataSav u8 padding2[2]; }; -struct Options * LoadPlayerDataAddress(struct SaveBlock2 *); -struct String * PlayerData_GetPlayerName_NewString(struct PlayerData *, u32 heap_id); -u32 PlayerData_GetTrainerID(struct PlayerData *); -u32 PlayerData_GetTrainerGender(struct PlayerData *); +struct Options * Sav2_PlayerData_GetOptionsAddr(struct SaveBlock2 *); +struct String * PlayerProfile_GetPlayerName_NewString(struct PlayerData *, u32 heap_id); +u32 PlayerProfile_GetTrainerID(struct PlayerData *); +u32 PlayerProfile_GetTrainerGender(struct PlayerData *); #endif //POKEDIAMOND_PLAYER_DATA_H -- cgit v1.2.3