From a5c90b097045a50df6ecb7cc37ce50f3fc9f142f Mon Sep 17 00:00:00 2001 From: Seth Barberee Date: Tue, 1 Mar 2022 19:40:00 -0800 Subject: decomp some more saving functions --- include/code_8094F88.h | 35 +++++++++++++++++++++++++++++++++++ include/pokemon.h | 22 +++++++++++----------- 2 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 include/code_8094F88.h (limited to 'include') diff --git a/include/code_8094F88.h b/include/code_8094F88.h new file mode 100644 index 0000000..32ef7a5 --- /dev/null +++ b/include/code_8094F88.h @@ -0,0 +1,35 @@ +#ifndef GUARD_CODE_8094F88_H +#define GUARD_CODE_8094F88_H + +struct unkStruct_203B480 +{ + u8 unk0; + struct unkPokeSubStruct_4 unk4; + u32 unk8; + u32 unkC; + u32 unk10; + u32 unk14; + u32 unk18; + u32 unk1C; + u8 unk20; + u8 unk21; + u8 unk22; + u32 unk24; + u32 unk28; + u8 unk2C; + u8 unk2D; +}; + +struct unkStruct_203B484 +{ + u32 unk0; + struct PokemonStruct unk4; +}; + +struct unkStruct_203B48C +{ + s32 unk0; + s32 unk4[0x20]; +}; + +#endif diff --git a/include/pokemon.h b/include/pokemon.h index 912df49..d72f88e 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -34,21 +34,21 @@ struct unkPokeSubStruct_C struct PokemonStruct { // size: 0x58 - u16 unk0; // recruited?? - u8 unk2; - u8 unkHasNextStage; // set to a random value? - struct unkPokeSubStruct_4 unk4; + /* 0x0 */ u16 unk0; // recruited?? + /* 0x1 */ u8 unk2; + /* 0x3 */ u8 unkHasNextStage; // set to a random value? + /* 0x4 */ struct unkPokeSubStruct_4 unk4; /* 0x8 */ s16 speciesNum; // species # - struct unkPokeSubStruct_C unkC[2]; + /* 0xC */ struct unkPokeSubStruct_C unkC[2]; /* 0x14 */ s16 IQ; /* 0x16 */ u16 pokeHP; // HP /* 0x18 */ struct Offense offense; - u32 unk1C; - u32 IQSkills; - u8 unk24; - u8 fill25[3]; - struct HeldItem heldItem; - struct PokemonMove moves[MAX_MON_MOVES]; + /* 0x1C */ u32 unk1C; + /* 0x20 */ u32 IQSkills; + /* 0x24 */ u8 unk24; + /* 0x25 */ u8 fill25[3]; + /* 0x28 */ struct HeldItem heldItem; + /* 0x2C */ struct PokemonMove moves[MAX_MON_MOVES]; /* 0x4C */ u8 name[POKEMON_NAME_LENGTH]; }; -- cgit v1.2.3 From aa939e0955ec683efb5dd963430eace695a26af9 Mon Sep 17 00:00:00 2001 From: Seth Barberee Date: Sun, 6 Mar 2022 14:41:40 -0600 Subject: All saving functions decomped - poke_sub_4 was determined to be Dungeon Index/Floor - Clean up code that references these functions --- include/pokemon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/pokemon.h b/include/pokemon.h index d72f88e..af6c103 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -20,8 +20,8 @@ struct Offense { }; struct unkPokeSubStruct_4 { - u8 unk4; - u8 unk5; + u8 dungeonIndex; + u8 dungeonFloor; u16 fill6; }; -- cgit v1.2.3 From 3477f61cf2f983e5851f720386128a4410d9e131 Mon Sep 17 00:00:00 2001 From: Seth Barberee Date: Sun, 13 Mar 2022 17:48:04 -0700 Subject: continue doing some more decomp --- include/constants/dungeon.h | 3 +++ include/friend_area_action_menu.h | 2 +- include/item.h | 4 +++- include/kecleon_items.h | 2 +- include/pokemon.h | 5 ++--- 5 files changed, 10 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/constants/dungeon.h b/include/constants/dungeon.h index 19f5340..6987c61 100644 --- a/include/constants/dungeon.h +++ b/include/constants/dungeon.h @@ -1,6 +1,8 @@ #ifndef GUARD_CONSTANTS_DUNGEON_H #define GUARD_CONSTANTS_DUNGEON_H +#define NUM_DUNGEON_MAZE (NUM_DUNGEONS - DUNGEON_NORMAL_MAZE_2) + enum Dungeon { DUNGEON_TINY_WOODS = 0, @@ -101,6 +103,7 @@ enum Dungeon DUNGEON_TEAM_RUMBLEROCK = 95, DUNGEON_RESCUE_TEAM_2 = 96, DUNGEON_RESCUE_TEAM_MAZE = 97, + NUM_DUNGEONS }; #endif diff --git a/include/friend_area_action_menu.h b/include/friend_area_action_menu.h index dfddc22..1080679 100644 --- a/include/friend_area_action_menu.h +++ b/include/friend_area_action_menu.h @@ -12,7 +12,7 @@ struct unkStruct_203B2BC struct HeldItem itemToGive; struct HeldItem unk14; struct PokemonStruct *unk18; - u32 unk1C; + u8 unk1C; u32 unk20; u16 unk24; struct PokemonMove unk28[8]; diff --git a/include/item.h b/include/item.h index 5da4c67..6ac6847 100644 --- a/include/item.h +++ b/include/item.h @@ -104,15 +104,17 @@ bool8 IsGummiItem(u8); void xxx_init_unk230_substruct(u8); bool8 xxx_insert_unk230_80919FC(u8); struct HeldItem *xxx_get_inv_unk230_at_809185C(u8); +void xxx_fill_unk230_gaps(); struct HeldItem* xxx_get_unk250_at_8091A90(u8); s32 xxx_count_inv_unk230(); u32 xxx_count_non_empty_inv_unk250_8091A48(); void sub_8091BB4(u8); void sub_8090F58(void*, u8 *, struct ItemSlot *, struct unkStruct_8090F58*); void ShiftItemsDownFrom(s32 start); +void ClearItemSlotAt(u32 index); void MoveToStorage(struct ItemSlot* slot); void FillInventoryGaps(); -bool8 sub_8091274(struct HeldItem* slot); +bool8 AddHeldItemToInventory(struct HeldItem* slot); bool8 IsNotMoneyOrUsedTMItem(u8 id); s32 FindItemInInventory(u8 itemIndex); diff --git a/include/kecleon_items.h b/include/kecleon_items.h index 11cb0a7..0719804 100644 --- a/include/kecleon_items.h +++ b/include/kecleon_items.h @@ -15,7 +15,7 @@ struct unkStruct_203B210 u32 unkC; s32 itemSellPrice; u32 unk14; - u32 unk18; + s32 unk18; struct ItemSlot unk1C; u8 unk20; u8 unk21; diff --git a/include/pokemon.h b/include/pokemon.h index af6c103..c50dc75 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -22,7 +22,6 @@ struct Offense { struct unkPokeSubStruct_4 { u8 dungeonIndex; u8 dungeonFloor; - u16 fill6; }; struct unkPokeSubStruct_C @@ -35,7 +34,7 @@ struct PokemonStruct { // size: 0x58 /* 0x0 */ u16 unk0; // recruited?? - /* 0x1 */ u8 unk2; + /* 0x1 */ bool8 isLeader; /* 0x3 */ u8 unkHasNextStage; // set to a random value? /* 0x4 */ struct unkPokeSubStruct_4 unk4; /* 0x8 */ s16 speciesNum; // species # @@ -76,7 +75,7 @@ struct PokemonStruct2 { // size 0x68 u16 unk0; // corresponds to unk0 inPokemonStruct - u8 unk2; // unk2 + bool8 isLeader; // unk2 u8 unkHasNextStage; // unk3 struct unkPokeSubStruct_4 unk4; // unk4 u16 IQ; // IQ (other offset) -- cgit v1.2.3 From 57f540b320ae8439fe4b42c6149641b877c7ea73 Mon Sep 17 00:00:00 2001 From: Seth Barberee Date: Mon, 21 Mar 2022 17:48:40 -0700 Subject: fix a few nonmatchings and code cleanup --- include/code_8094F88.h | 2 +- include/global.h | 5 +++++ include/pokemon.h | 9 ++------- include/sub_8095228.h | 17 ++++++++++------- 4 files changed, 18 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/code_8094F88.h b/include/code_8094F88.h index 32ef7a5..9af6c7a 100644 --- a/include/code_8094F88.h +++ b/include/code_8094F88.h @@ -4,7 +4,7 @@ struct unkStruct_203B480 { u8 unk0; - struct unkPokeSubStruct_4 unk4; + struct DungeonLocation unk4; u32 unk8; u32 unkC; u32 unk10; diff --git a/include/global.h b/include/global.h index 81388a8..5c71009 100644 --- a/include/global.h +++ b/include/global.h @@ -32,4 +32,9 @@ #define ARRAY_COUNT(array) (sizeof(array) / sizeof((array)[0])) +struct DungeonLocation { + u8 dungeonIndex; + u8 dungeonFloor; +}; + #endif // GUARD_GLOBAL_H diff --git a/include/pokemon.h b/include/pokemon.h index c50dc75..6b514c8 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -19,11 +19,6 @@ struct Offense { u8 def[2]; }; -struct unkPokeSubStruct_4 { - u8 dungeonIndex; - u8 dungeonFloor; -}; - struct unkPokeSubStruct_C { u8 unk0; @@ -36,7 +31,7 @@ struct PokemonStruct /* 0x0 */ u16 unk0; // recruited?? /* 0x1 */ bool8 isLeader; /* 0x3 */ u8 unkHasNextStage; // set to a random value? - /* 0x4 */ struct unkPokeSubStruct_4 unk4; + /* 0x4 */ struct DungeonLocation unk4; /* 0x8 */ s16 speciesNum; // species # /* 0xC */ struct unkPokeSubStruct_C unkC[2]; /* 0x14 */ s16 IQ; @@ -77,7 +72,7 @@ struct PokemonStruct2 u16 unk0; // corresponds to unk0 inPokemonStruct bool8 isLeader; // unk2 u8 unkHasNextStage; // unk3 - struct unkPokeSubStruct_4 unk4; // unk4 + struct DungeonLocation unk4; // unk4 u16 IQ; // IQ (other offset) u16 unkA; u16 unkC; diff --git a/include/sub_8095228.h b/include/sub_8095228.h index 3fd5993..9541d20 100644 --- a/include/sub_8095228.h +++ b/include/sub_8095228.h @@ -3,13 +3,16 @@ struct unkStruct_8095228 { - u8 unk0; - u8 unk1; - u8 unk2; - u8 unk3; - u8 unk4; - u8 padding[0x10 - 0x5]; - u32 unk10; + /* 0x0 */ u8 mailType; // mail type + /* 0x1 */ u8 missionType; // mission type + /* 0x2 */ u8 unk2; + /* 0x3 */ u8 unk3; + /* 0x4 */ u8 dungeon; // dungeon + /* 0x5 */ u8 floor; // floor + /* 0x8 */ u32 unk8; + /* 0xC */ s16 clientSpecies; // client pokemon + /* 0xE */ s16 targetSpecies; // target + u32 unk10; // TODO: verify that this is just a union of the 4 bytes in Wonder Mail u8 padding2[0x20 - 0x14]; struct ItemSlot unk20; u8 padding3[0x28 - 0x24]; -- cgit v1.2.3