From 9b491a782eadc65395a67f3d4ba8a403d0b2a658 Mon Sep 17 00:00:00 2001 From: Kermalis <29823718+Kermalis@users.noreply.github.com> Date: Mon, 17 Jul 2023 22:16:42 -0400 Subject: [PATCH] Document/correct some struct sizes & offsets --- include/code_8094F88.h | 14 +++--- include/friend_rescue.h | 14 +++--- include/item.h | 22 ++++++--- include/pokemon.h | 107 +++++++++++++++++++++------------------- include/text.h | 9 +++- include/wonder_mail.h | 32 ++++++------ 6 files changed, 109 insertions(+), 89 deletions(-) diff --git a/include/code_8094F88.h b/include/code_8094F88.h index c96fdefbb..54d78e0ea 100644 --- a/include/code_8094F88.h +++ b/include/code_8094F88.h @@ -3,9 +3,9 @@ #include "item.h" +// size: 0x30 struct unkStruct_203B480 { - // size: 0x30 /* 0x0 */ u8 mailType; /* 0x1 */ u8 missionType; /* 0x4 */ struct DungeonLocation dungeon; @@ -21,21 +21,23 @@ struct unkStruct_203B480 struct Item unk20; u32 unk24; u32 unk28; - s8 rescuesAllowed; + /* 0x2C */ s8 rescuesAllowed; u8 unk2D; u8 padding4[0x30 - 0x2E]; }; +// size: 0x5C struct unkStruct_203B484 { - u32 unk0; - struct PokemonStruct unk4; + /* 0x0 */ u32 unk0; + /* 0x4 */ struct PokemonStruct unk4; }; +// size: 0x84 struct unkStruct_203B48C { - s32 unk0; - s32 unk4[0x20]; + /* 0x0 */ s32 unk0; + /* 0x4 */ s32 unk4[0x20]; }; extern struct unkStruct_203B480 *gUnknown_203B480; diff --git a/include/friend_rescue.h b/include/friend_rescue.h index 73915f3fc..af2e5620d 100644 --- a/include/friend_rescue.h +++ b/include/friend_rescue.h @@ -7,14 +7,14 @@ #include "wonder_mail.h" #include "menu.h" +// size: 0x568 struct WonderMailStruct_203B33C { - // size: 0x568 - u32 state; - u32 fallbackState; - u8 passwordBuffer[0x36]; + /* 0x0 */ u32 state; + /* 0x4 */ u32 fallbackState; + /* 0x8 */ u8 passwordBuffer[0x36]; u32 unk40; - u32 status; + /* 0x44 */ u32 status; struct unkStruct_203B480 unk48; struct unkStruct_203B480 unk78; struct WonderMailStruct_203B2C0_sub unkA8; @@ -25,7 +25,7 @@ struct WonderMailStruct_203B33C struct MenuStruct unk21C[4]; struct UnkTextStruct2 unk35C[4]; struct UnkTextStruct2 unk3BC[4]; - struct Item item; + /* 0x41C */ struct Item item; u32 unk420; // Is this supposed to be a File like 203B2C4? u8 unk424[0x100]; s32 unk524; @@ -35,7 +35,7 @@ struct WonderMailStruct_203B33C u8 fill52E; u32 unk530; u32 unk534; - s16 speciesNum; // A7 << 3 + /* 0x538 */ s16 speciesNum; // A7 << 3 struct unkStruct_802F204 unk53C; s32 unk564; }; diff --git a/include/item.h b/include/item.h index 277827e50..e890a7936 100644 --- a/include/item.h +++ b/include/item.h @@ -4,6 +4,7 @@ #include "constants/item.h" #include "code_8092334.h" +// size: 0x20 struct ItemDataEntry { /* 0x0 */ u8 *name; @@ -24,24 +25,29 @@ struct ItemDataEntry /* 0x1E */ u8 actionType; }; +// size: 0x4 struct Item { - u8 flags; - u8 quantity; - u8 id; + /* 0x0 */ u8 flags; + /* 0x1 */ u8 quantity; + /* 0x2 */ u8 id; }; -struct BulkItem { - u8 id; - u8 quantity; +// size: 0x4 +struct BulkItem +{ + /* 0x0 */ u8 id; + /* 0x1 */ u8 quantity; }; +// size: 0x4 struct Gummi { - s16 boostAmount; - u16 flags; + /* 0x0 */ s16 boostAmount; + /* 0x2 */ u16 flags; }; +// size: 0xC struct unkStruct_8090F58 { u32 unk0; diff --git a/include/pokemon.h b/include/pokemon.h index 8fcbc6189..388a9890a 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -10,89 +10,89 @@ #define OFFENSE_NRM 0 #define OFFENSE_SP 1 -struct Offense { - /* 0x18: att */ - /* 0x19: spatt */ - /* 0x1a: def */ - /* 0x1b: spdef */ - - u8 att[2]; - u8 def[2]; +// size: 0x4 +struct Offense +{ + /* 0x0 */ u8 att[2]; // Atk, SpAtk + /* 0x2 */ u8 def[2]; // Def, SpDef }; +// size: 0x4 struct unkPokeSubStruct_C { u8 unk0; u8 fill1[3]; }; +// size: 0x58 struct PokemonStruct { - // size: 0x58 - /* 0x0 */ u16 unk0; // recruited?? + u16 unk0; // recruited?? /* 0x2 */ bool8 isTeamLeader; /* 0x3 */ u8 unkHasNextStage; // set to a random value? /* 0x4 */ struct DungeonLocation dungeonLocation; /* 0x8 */ s16 speciesNum; // species # - /* 0xC */ struct unkPokeSubStruct_C unkC[2]; + struct unkPokeSubStruct_C unkC[2]; /* 0x14 */ s16 IQ; - /* 0x16 */ u16 pokeHP; // HP + /* 0x16 */ u16 pokeHP; /* 0x18 */ struct Offense offense; - /* 0x1C */ u32 unk1C; + u32 unk1C; /* 0x20 */ u32 IQSkills; - /* 0x24 */ u8 unk24; - /* 0x25 */ u8 fill25[3]; + u8 unk24; + u8 fill25[3]; /* 0x28 */ struct BulkItem heldItem; /* 0x2C */ struct Move moves[MAX_MON_MOVES]; /* 0x4C */ u8 name[POKEMON_NAME_LENGTH]; }; - +// size: 0x4 struct unkStruct_808E6F4 { s16 unk0; u8 unk2; }; +// size: 0x4 struct EvolveStage { - s16 speciesNum; - u8 unkHasNextStage; + /* 0x0 */ s16 speciesNum; + /* 0x2 */ u8 unkHasNextStage; }; - +// size: 0x24 struct unkStruct_8094184 { - struct Move moves[MAX_MON_MOVES]; + /* 0x0 */ struct Move moves[MAX_MON_MOVES]; u8 unk20; }; +// size: 0x64 struct PokemonStruct2 { - // size 0x68 - /* 0x0 */ u16 unk0; // corresponds to unk0 inPokemonStruct + u16 unk0; // corresponds to unk0 in PokemonStruct /* 0x2 */ bool8 isTeamLeader; // unk2 /* 0x3 */ u8 unkHasNextStage; // unk3 /* 0x4 */ struct DungeonLocation dungeonLocation; // unk4 /* 0x8 */ u16 IQ; // IQ (other offset) - /* 0xA */ s16 unkA; - /* 0xC */ u16 unkC; + s16 unkA; + u16 unkC; /* 0xE */ s16 speciesNum; // speciesNum (other offset) - /* 0x10 */ u16 unk10; // pokeHP - /* 0x12 */ u16 unk12; // pokeHP + u16 unk10; // pokeHP + u16 unk12; // pokeHP /* 0x14 */ struct Offense offense; // offense (other offset) - /* 0x18 */ u32 unk18; // unk1C + u32 unk18; // unk1C /* 0x1C */ struct unkStruct_8094184 moves; /* 0x40 */ struct Item itemSlot; // heldItem - /* 0x44 */ u32 unk44; // some struct - /* 0x48 */ u32 unk48; // some struct (same type as 44) + u32 unk44; // some struct + u32 unk48; // some struct (same type as 44) /* 0x4C */ u32 IQSkills; // unk20 - /* 0x50 */ u8 unk50; // unk24 - /* 0x51 */ u8 fill51[3]; - /* 0x54 */ struct unkStruct_808E6F4 unk54; + u8 unk50; // unk24 + u8 fill51[3]; + struct unkStruct_808E6F4 unk54; /* 0x58 */ u8 name[POKEMON_NAME_LENGTH]; // name (other offset) }; +// size: 0x90E8 struct unkStruct_203B45C { /* 0x0 */ struct PokemonStruct pokemon[NUM_MONSTERS]; @@ -100,25 +100,28 @@ struct unkStruct_203B45C /* 0x8F88 */ struct PokemonStruct team[MAX_TEAM_MEMBERS]; }; +// size: 0x4 struct PreEvolution { - /* 0x34 */ s16 evolveFrom; - /* 0x36 */ s16 evolveType; + /* 0x0 */ s16 evolveFrom; + /* 0x2 */ s16 evolveType; }; +// size: 0x4 struct EvolutionRequirements { - /* 0x38 */ u16 mainRequirement; - /* 0x3A */ u16 additionalRequirement; + /* 0x0 */ u16 mainRequirement; + /* 0x2 */ u16 additionalRequirement; }; +// size: 0x8 struct unkEvolve { /* 0x0 */ struct PreEvolution preEvolution; /* 0x4 */ struct EvolutionRequirements evolutionRequirements; }; - +// size: 0x48 struct MonsterDataEntry { /* 0x0 */ u8* species; @@ -127,13 +130,13 @@ struct MonsterDataEntry /* 0x9 */ u8 bodySize; /* 0xC */ s32 movementSpeed; /* 0x10 */ u16 dialogueSprites; // Bitwise flags for whether a dialogue sprite/portrait is available for each emotion. - /* 0x12 */ bool8 unk12; + bool8 unk12; /* 0x13 */ u8 types[2]; /* 0x15 */ u8 movementType; /* 0x16 */ u8 friendArea; /* 0x17 */ u8 abilities[2]; /* 0x19 */ u8 shadowSize; - /* 0x1A */ u8 fill1A; // 0 for all Pokémon. + u8 fill1A; // 0 for all Pokémon. /* 0x1B */ u8 regenSpeed; // 100 for all Pokémon. /* 0x1C */ bool8 canMove; // Set to false for Pokémon who don't move unless they're the leader, like Kakuna. /* 0x1D */ u8 chanceAsleep; @@ -143,9 +146,9 @@ struct MonsterDataEntry /* 0x28 */ u16 baseDefSpDef[2]; /* 0x2C */ u16 weight; /* 0x2E */ u16 size; - /* 0x30 */ u8 unk30; // 10 for all Pokémon. - /* 0x31 */ u8 unk31; // 10 for all Pokémon. - /* 0x32 */ u8 unk32; // 24 for all Pokémon. + u8 unk30; // 10 for all Pokémon. + u8 unk31; // 10 for all Pokémon. + u8 unk32; // 24 for all Pokémon. /* 0x33 */ bool8 toolboxEnabled; // If false, the AI can't use items. Doesn't seem to be used, as it's true for all Pokémon. /* 0x34 */ struct PreEvolution preEvolution; /* 0x38 */ struct EvolutionRequirements evolutionRequirements; @@ -155,25 +158,27 @@ struct MonsterDataEntry }; -// https://www.pokecommunity.com/showthread.php?t=407371 +// size: 0xC | https://www.pokecommunity.com/showthread.php?t=407371 struct LevelData { - s32 expRequired; - u8 gainHP; - u8 gainUnused; - u8 gainAtt; - u8 gainSPAtt; - u8 gainDef; - u8 gainSPDef; + /* 0x0 */ s32 expRequired; + /* 0x4 */ u8 gainHP; + /* 0x5 */ u8 gainUnused; + /* 0x6 */ u8 gainAtt; + /* 0x7 */ u8 gainSPAtt; + /* 0x8 */ u8 gainDef; + /* 0x9 */ u8 gainSPDef; u16 fillA; }; +// size: 0x1A4 struct unkStruct_808E218_arg { u16 unk0[NUM_MONSTERS]; - u32 count; + /* 0x1A0 */ u32 count; }; +// size: 0xC struct unkStruct_808E218 { // leveldata? (same size) diff --git a/include/text.h b/include/text.h index a04486e70..cfc371330 100644 --- a/include/text.h +++ b/include/text.h @@ -1,7 +1,9 @@ #ifndef GUARD_TEXT_H #define GUARD_TEXT_H -struct UnkTextStruct1 { +// size: 0x48 +struct UnkTextStruct1 +{ s16 unk0; s16 unk2; s16 unk04; @@ -13,6 +15,7 @@ struct UnkTextStruct1 { u8 unk46; }; +// size: 0x4 struct UnkTextStruct2_sub { u8 unk0; @@ -21,7 +24,9 @@ struct UnkTextStruct2_sub u8 unk3; }; -struct UnkTextStruct2 { +// size: 0x18 +struct UnkTextStruct2 +{ u8 fill00[0x04]; s32 unk4; struct UnkTextStruct2_sub unk08; diff --git a/include/wonder_mail.h b/include/wonder_mail.h index f59e8235e..5f6982e9b 100644 --- a/include/wonder_mail.h +++ b/include/wonder_mail.h @@ -10,12 +10,13 @@ #include "constants/wonder_mail.h" +// size: 0x28 struct unkStruct_802F204 { /* 0x0 */ u8 clientName[POKEMON_NAME_LENGTH]; /* 0xA */ u8 name2[POKEMON_NAME_LENGTH]; // target name? /* 0x14 */ s16 clientSpecies; - /* 0x16 */ u8 unk16; + u8 unk16; /* 0x18 */ s32 moneyReward; /* 0x1C */ u8 itemRewards[MAX_ITEM_REWARDS]; /* 0x1F */ u8 quantity; @@ -23,14 +24,15 @@ struct unkStruct_802F204 /* 0x24 */ u32 teamRankPtsReward; }; +// size: 0x14 struct WonderMail { /* 0x0 */ u8 mailType; // mail type /* 0x1 */ u8 missionType; // mission type - /* 0x2 */ u8 unk2; - /* 0x3 */ u8 unk3; + u8 unk2; + u8 unk3; /* 0x4 */ struct DungeonLocation dungeon; - /* 0x8 */ u32 unk8; + u32 unk8; /* 0xC */ s16 clientSpecies; // client pokemon /* 0xE */ s16 targetSpecies; // target /* 0x10 */ u8 targetItem; // item to find/deliver @@ -40,27 +42,28 @@ struct WonderMail }; +// size: 0x88 struct WonderMailStruct_203B2C0_sub { - struct unkStruct_203B480 mail; - struct PokemonStruct pokemon; + /* 0x0 */ struct unkStruct_203B480 mail; + /* 0x30 */ struct PokemonStruct pokemon; }; +// size: 0x548 struct WonderMailStruct_203B2C0 { - // size: 0x548 /* 0x0 */ u32 fallbackState; /* 0x4 */ u32 state; /* 0x8 */ u8 passwordBuffer[PASSWORD_BUFFER_SIZE]; u8 unk3E; u32 unk40; - u32 linkError; + /* 0x44 */ u32 linkError; struct unkStruct_203B480 unk48; struct unkStruct_203B480 unk78; struct WonderMailStruct_203B2C0_sub unkA8; struct WonderMailStruct_203B2C0_sub unk130; u8 fill16A[0x218 - 0x1B8]; - u8 mailIndex; + /* 0x218 */ u8 mailIndex; struct MenuStruct unk21C[4]; struct UnkTextStruct2 unk35C[4]; struct UnkTextStruct2 unk3BC[4]; @@ -72,18 +75,17 @@ struct WonderMailStruct_203B2C0 u8 unk42C; u8 unk42D; u8 unk42E; - u8 padding3[0x534 - 0x430]; + /* 0x430 */ u8 padding3[0x534 - 0x430]; u32 unk534; s32 unk538; // A7 << 3 u32 unk53C; - u32 mailCount; // A8 << 4 - s16 speciesNum; - + /* 0x540 */ u32 mailCount; // A8 << 4 + /* 0x544 */ s16 speciesNum; }; +// size: 0x564 struct WonderMailStruct_203B2C4 { - // size: 0x564 /* 0x0 */ u8 state; /* 0x4 */ u32 fallbackState; // wonder mail link status?? /* 0x8 */ u8 passwordBuffer[PASSWORD_BUFFER_SIZE]; // Probably a buffer for entry @@ -93,7 +95,7 @@ struct WonderMailStruct_203B2C4 u8 filler48[0x1B8 - 0x48]; struct unkStruct_203B480 unk1B8; struct unkStruct_203B480 unk1E8; - s8 mailIndex; + /* 0x218 */ s8 mailIndex; struct MenuStruct unk21C[4]; struct UnkTextStruct2 unk35C[4]; struct UnkTextStruct2 unk3BC[4];