diff --git a/headers/data/overlay18.h b/headers/data/overlay18.h index a01662f4..58f98c39 100644 --- a/headers/data/overlay18.h +++ b/headers/data/overlay18.h @@ -23,5 +23,6 @@ extern struct simple_menu_id_item LINK_SHOP_SUBMENU_ITEMS_6[9]; extern struct simple_menu_id_item LINK_SHOP_SUBMENU_ITEMS_7[9]; extern void* OVERLAY18_FUNCTION_POINTER_TABLE[76]; extern undefined4 OV18_STATIC_INITIALIZER; +extern struct link_shop* LINK_SHOP_PTR; #endif diff --git a/headers/functions/functions.h b/headers/functions/functions.h index 3c4859cb..842f63a4 100644 --- a/headers/functions/functions.h +++ b/headers/functions/functions.h @@ -9,6 +9,7 @@ #include "overlay11.h" #include "overlay13.h" #include "overlay14.h" +#include "overlay18.h" #include "overlay19.h" #include "overlay29.h" #include "overlay30.h" diff --git a/headers/functions/overlay18.h b/headers/functions/overlay18.h new file mode 100644 index 00000000..bbcdeb83 --- /dev/null +++ b/headers/functions/overlay18.h @@ -0,0 +1,8 @@ +#ifndef HEADERS_FUNCTIONS_OVERLAY18_H_ +#define HEADERS_FUNCTIONS_OVERLAY18_H_ + +int LinkShopEntryPoint(void); +void LinkShopDestructor(void); +int LinkShopMainManager(void); + +#endif diff --git a/headers/types/ground_mode/ground_mode.h b/headers/types/ground_mode/ground_mode.h index 06a3439c..f1d51a93 100644 --- a/headers/types/ground_mode/ground_mode.h +++ b/headers/types/ground_mode/ground_mode.h @@ -968,4 +968,61 @@ struct ground_bg { }; ASSERT_SIZE(struct ground_bg, 1372); +struct link_shop { + int8_t window_id_0x0; + int8_t portrait_window_id; // 0x1 + int8_t window_id_0x2; + int8_t window_id_0x3; + int8_t window_id_0x4; + int8_t window_id_0x5; + int8_t window_id_0x6; + int8_t window_id_0x7; + int8_t window_id_0x8; + int8_t scroll_box_window_id; // 0x9 + int8_t window_id_0xa; + int8_t window_id_0xb; + int8_t window_id_0xc; + int8_t window_id_0xd; + int8_t window_id_0xe; + int8_t window_id_0xf; + bool unk_0x10; + undefined padding_0x11[3]; + struct preprocessor_args preprocessor_args; // 0x14 + struct portrait_params portrait_params; // 0x64 + undefined4 + unk_0x74; // Potentially also some state value; used in a switch in LinkShopMainManager. + uint32_t state; // 0x78: Current state of the link shop menu; used in a switch in + // LinkShopMainManager. Could be an enum. + undefined4 + unk_0x7c; // Potentially also some state value; used in a switch in LinkShopMainManager. + uint32_t next_state; // 0x80: Next value for state. + undefined4 unk_0x84; + undefined4 unk_0x88; + undefined2 unk_0x8c; + undefined2 padding_0x8e; + struct window_extra_info extra_info_1; // 0x90 + struct window_extra_info extra_info_2; // 0x128 + struct window_extra_info extra_info_3; // 0x1C0 + struct window_extra_info extra_info_4; // 0x258 + struct window_extra_info extra_info_5; // 0x2F0 + undefined2 unk_0x388; + undefined2 unk_0x38a; + int16_t member_idx; // 0x38C: Index in TEAM_MEMBER_TABLE for the selected monster. + undefined2 padding_0x38e; + undefined4 unk_0x390; + uint8_t unk_0x394[8]; + undefined4 unk_0x39c; + undefined4 unk_0x3a0; + undefined2 unk_0x3a4; + undefined1 unk_0x3a6; // This through 0x3AD is filled with a memcpy; may be a smaller struct. + undefined1 unk_0x3a7; // Could not find direct use of this; may be padding. + undefined2 unk_0x3a8; + undefined2 unk_0x3aa; + undefined1 unk_0x3ac; + undefined1 unk_0x3ad; + char name[10]; // 0x3AE: Name of the selected monster. + undefined unk_0x3b8[12]; // Could not find direct use of this, probably not padding though. +}; +ASSERT_SIZE(struct link_shop, 964); + #endif diff --git a/symbols/overlay18.yml b/symbols/overlay18.yml index 3ff5c568..e39ba491 100644 --- a/symbols/overlay18.yml +++ b/symbols/overlay18.yml @@ -12,7 +12,36 @@ overlay18: NA: 0x3500 JP: 0x3520 description: Controls the Electivire Link Shop. - functions: [] + functions: + - name: LinkShopEntryPoint + address: + EU: 0x238AC80 + NA: 0x238A140 + JP: 0x238B6A0 + description: |- + Is the entrypoint of the overlay_load_entry, and seems to run once to initiate the Link Shop. Is not called anywhere else. + Allocates space for link_shop, and initializes many of its fields. + + return: Always returns 1. + - name: LinkShopDestructor + address: + EU: 0x238BB14 + NA: 0x238AFD4 + JP: 0x238C530 + description: |- + Is the destructor of the overlay_load_entry, and seems to run once on closing the Link Shop. Is not called anywhere else. + Frees up the allocated space for link_shop if it is not already empty. + + No params. + - name: LinkShopMainManager + address: + EU: 0x238BB5C + NA: 0x238B01C + JP: 0x238C578 + description: |- + Called every frame the Electivire Link Shop is open. Handles the majority of the menu. + + return: Usually returns 1. Returns 4 when exiting the Link Shop. data: - name: LINK_SHOP_WINDOW_PARAMS_1 address: @@ -214,14 +243,16 @@ overlay18: NA: 0x4 JP: 0x4 description: Static initializer for overlay 18. - - name: OVERLAY18_UNKNOWN_POINTER__NA_238D620 + - name: LINK_SHOP_PTR address: EU: 0x238E160 NA: 0x238D620 JP: 0x238EBA0 length: + EU: 0x4 NA: 0x4 - description: "Note: unverified, ported from Irdkwia's notes" + JP: 0x4 + description: Pointer to the heap-allocated link_shop struct. - name: OVERLAY18_UNKNOWN_POINTER__NA_238D624 address: NA: 0x238D624