From d46f2dcb0adfa49a5d1212eda9a6d0cd55f4a3fc Mon Sep 17 00:00:00 2001 From: assidion2 Date: Wed, 2 Oct 2024 19:33:58 +0400 Subject: [PATCH 1/2] Overlay31 research (#280) --- headers/data/ram.h | 1 + headers/functions/overlay31.h | 3 +++ headers/types/common/enums.h | 8 ++++++++ headers/types/common/window.h | 14 ++++++++++++++ symbols/overlay29.yml | 2 +- symbols/overlay31.yml | 25 +++++++++++++++++++++++++ symbols/ram.yml | 6 ++++++ 7 files changed, 58 insertions(+), 1 deletion(-) diff --git a/headers/data/ram.h b/headers/data/ram.h index add2d7b9..5c6cbf0d 100644 --- a/headers/data/ram.h +++ b/headers/data/ram.h @@ -75,5 +75,6 @@ extern int MULTIHIT_MOVE_SUCCESSIVE_HITS; extern int TRIPLE_KICK_SUCCESSIVE_HITS; extern int METRONOME_NEXT_INDEX; extern struct floor_generation_status FLOOR_GENERATION_STATUS; +extern struct stairs_menu* STAIRS_MENU_PTR; #endif diff --git a/headers/functions/overlay31.h b/headers/functions/overlay31.h index e5ae250c..8d76f315 100644 --- a/headers/functions/overlay31.h +++ b/headers/functions/overlay31.h @@ -4,6 +4,9 @@ void EntryOverlay31(void); void DrawDungeonMenuStatusWindow(int param_1); void DungeonMenuSwitch(int idx); +void CreateStairsMenuState(struct entity* entity); +void StairsSubheadingCallback(int window_id); +int HandleStairsMenu(void); void MovesMenu(struct action_data* action); bool HandleMovesMenuWrapper0(undefined* param_1, undefined param_2, undefined param_3, int monster_index); diff --git a/headers/types/common/enums.h b/headers/types/common/enums.h index dbdad77e..ccf7cba3 100644 --- a/headers/types/common/enums.h +++ b/headers/types/common/enums.h @@ -3894,6 +3894,14 @@ enum item_flag { ITEM_FLAG_THROWABLE_AT_ENEMY = 2, }; +// Type of stairs +enum stairs_type { + STAIRS_TYPE_NORMAL = 0, + STAIRS_TYPE_WARP_ZONE = 1, + STAIRS_TYPE_RESCUE_POINT = 2, + STAIRS_TYPE_HIDDEN = 3, +}; + #pragma pack(push, 1) ENUM_8_BIT(box_type); #pragma pack(pop) diff --git a/headers/types/common/window.h b/headers/types/common/window.h index 3e5935a0..81f832b3 100644 --- a/headers/types/common/window.h +++ b/headers/types/common/window.h @@ -1077,4 +1077,18 @@ struct inventory_menu { }; ASSERT_SIZE(struct inventory_menu, 420); +// Used for creating the stairs menu. +struct stairs_menu { + undefined4 field_0x0; + undefined4 field_0x4; + struct entity* entity; // 0x8: Seems to always point to the leader? + // 0xC: Used for switching in HandleStairsMenu. + // Seems to be 0 when opening the main stairs menu, 1 when the main stairs menu is open, + // 3 when opening the info menu, and 4 when the info menu is open. + int state; + undefined4 unk_info_menu_var; // 0x10: Has something to do with opening the "Info" menu + enum stairs_type stairs_type; // 0x14: Which stairs menu to display +}; +ASSERT_SIZE(struct stairs_menu, 24); + #endif diff --git a/symbols/overlay29.yml b/symbols/overlay29.yml index d4bd876d..f6a6552a 100644 --- a/symbols/overlay29.yml +++ b/symbols/overlay29.yml @@ -248,7 +248,7 @@ overlay29: Floor types: 0 appears to mean the current floor is "normal" - 1 appears to mean the current floor is a fixed floor + 1 means the current floor is a fixed floor with warp zones enabled 2 means the current floor has a rescue point return: floor type diff --git a/symbols/overlay31.yml b/symbols/overlay31.yml index b6e8b517..a6fdff43 100644 --- a/symbols/overlay31.yml +++ b/symbols/overlay31.yml @@ -40,6 +40,31 @@ overlay31: Note: unverified, ported from Irdkwia's notes r0: appears to be an index of some sort, probably the menu index based on the function name? + - name: CreateStairsMenuState + address: + EU: 0x2383AD4 + description: |- + Called when the leader steps on any stairs tile (regular, warp zone, rescue point, hidden stairs). + + Allocates a stairs_menu struct on the heap with information for HandleStairsMenu, which will be pointed to by STAIRS_MENU_PTR. + + r0: Entity pointer (in practice, always the leader) + - name: StairsSubheadingCallback + address: + EU: 0x2383B68 + description: |- + Callback function passed to CreateAdvancedTextBox for creating the subheading for the stairs menu. + + r0: window_id + - name: HandleStairsMenu + address: + EU: 0x2383BBC + description: |- + Handles displaying the stairs menu and is called on each frame while it is open, also updating the leader's action fields. + + Uses a switch statement based on the state field in stairs_menu to determine what actions to take. + + return: int - name: MovesMenu address: EU: 0x2385DC0 diff --git a/symbols/ram.yml b/symbols/ram.yml index 4a4d80b9..6029d9ad 100644 --- a/symbols/ram.yml +++ b/symbols/ram.yml @@ -685,3 +685,9 @@ ram: This data is populated as the dungeon floor is generated. type: struct floor_generation_status + - name: STAIRS_MENU_PTR + address: + EU: 0x238AEC4 + length: + EU: 0x4 + description: Pointer to the stairs_menu struct. From ab7b4ed209aff0711549375324e9ce98e2032cbb Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Wed, 2 Oct 2024 20:48:27 -0500 Subject: [PATCH 2/2] Fill language addresses (#281) --- symbols/overlay29.yml | 2 ++ symbols/overlay31.yml | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/symbols/overlay29.yml b/symbols/overlay29.yml index f6a6552a..cbaf0d91 100644 --- a/symbols/overlay29.yml +++ b/symbols/overlay29.yml @@ -720,6 +720,8 @@ overlay29: - name: ShouldDisplayEntityAdvanced address: EU: 0x22E6880 + NA: 0x22E5ED0 + JP: 0x22E7540 description: |- Returns whether or not the entity should be displayed, using the same checks as ShouldDisplayEntity except also checking whether it is visible and whether the camera entity is blinded. diff --git a/symbols/overlay31.yml b/symbols/overlay31.yml index a6fdff43..9eba11d2 100644 --- a/symbols/overlay31.yml +++ b/symbols/overlay31.yml @@ -43,6 +43,8 @@ overlay31: - name: CreateStairsMenuState address: EU: 0x2383AD4 + NA: 0x2382ED4 + JP: 0x2384154 description: |- Called when the leader steps on any stairs tile (regular, warp zone, rescue point, hidden stairs). @@ -52,6 +54,8 @@ overlay31: - name: StairsSubheadingCallback address: EU: 0x2383B68 + NA: 0x2382F68 + JP: 0x23841E8 description: |- Callback function passed to CreateAdvancedTextBox for creating the subheading for the stairs menu. @@ -59,6 +63,8 @@ overlay31: - name: HandleStairsMenu address: EU: 0x2383BBC + NA: 0x2382FBC + JP: 0x238423C description: |- Handles displaying the stairs menu and is called on each frame while it is open, also updating the leader's action fields.