Skip to content

Commit 3e06c19

Browse files
authored
Basic documentation of overlay 18 (link shop) (#367)
1 parent 1b6c833 commit 3e06c19

5 files changed

Lines changed: 101 additions & 3 deletions

File tree

headers/data/overlay18.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ extern struct simple_menu_id_item LINK_SHOP_SUBMENU_ITEMS_6[9];
2323
extern struct simple_menu_id_item LINK_SHOP_SUBMENU_ITEMS_7[9];
2424
extern void* OVERLAY18_FUNCTION_POINTER_TABLE[76];
2525
extern undefined4 OV18_STATIC_INITIALIZER;
26+
extern struct link_shop* LINK_SHOP_PTR;
2627

2728
#endif

headers/functions/functions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "overlay11.h"
1010
#include "overlay13.h"
1111
#include "overlay14.h"
12+
#include "overlay18.h"
1213
#include "overlay19.h"
1314
#include "overlay29.h"
1415
#include "overlay30.h"

headers/functions/overlay18.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef HEADERS_FUNCTIONS_OVERLAY18_H_
2+
#define HEADERS_FUNCTIONS_OVERLAY18_H_
3+
4+
int LinkShopEntryPoint(void);
5+
void LinkShopDestructor(void);
6+
int LinkShopMainManager(void);
7+
8+
#endif

headers/types/ground_mode/ground_mode.h

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,4 +968,61 @@ struct ground_bg {
968968
};
969969
ASSERT_SIZE(struct ground_bg, 1372);
970970

971+
struct link_shop {
972+
int8_t window_id_0x0;
973+
int8_t portrait_window_id; // 0x1
974+
int8_t window_id_0x2;
975+
int8_t window_id_0x3;
976+
int8_t window_id_0x4;
977+
int8_t window_id_0x5;
978+
int8_t window_id_0x6;
979+
int8_t window_id_0x7;
980+
int8_t window_id_0x8;
981+
int8_t scroll_box_window_id; // 0x9
982+
int8_t window_id_0xa;
983+
int8_t window_id_0xb;
984+
int8_t window_id_0xc;
985+
int8_t window_id_0xd;
986+
int8_t window_id_0xe;
987+
int8_t window_id_0xf;
988+
bool unk_0x10;
989+
undefined padding_0x11[3];
990+
struct preprocessor_args preprocessor_args; // 0x14
991+
struct portrait_params portrait_params; // 0x64
992+
undefined4
993+
unk_0x74; // Potentially also some state value; used in a switch in LinkShopMainManager.
994+
uint32_t state; // 0x78: Current state of the link shop menu; used in a switch in
995+
// LinkShopMainManager. Could be an enum.
996+
undefined4
997+
unk_0x7c; // Potentially also some state value; used in a switch in LinkShopMainManager.
998+
uint32_t next_state; // 0x80: Next value for state.
999+
undefined4 unk_0x84;
1000+
undefined4 unk_0x88;
1001+
undefined2 unk_0x8c;
1002+
undefined2 padding_0x8e;
1003+
struct window_extra_info extra_info_1; // 0x90
1004+
struct window_extra_info extra_info_2; // 0x128
1005+
struct window_extra_info extra_info_3; // 0x1C0
1006+
struct window_extra_info extra_info_4; // 0x258
1007+
struct window_extra_info extra_info_5; // 0x2F0
1008+
undefined2 unk_0x388;
1009+
undefined2 unk_0x38a;
1010+
int16_t member_idx; // 0x38C: Index in TEAM_MEMBER_TABLE for the selected monster.
1011+
undefined2 padding_0x38e;
1012+
undefined4 unk_0x390;
1013+
uint8_t unk_0x394[8];
1014+
undefined4 unk_0x39c;
1015+
undefined4 unk_0x3a0;
1016+
undefined2 unk_0x3a4;
1017+
undefined1 unk_0x3a6; // This through 0x3AD is filled with a memcpy; may be a smaller struct.
1018+
undefined1 unk_0x3a7; // Could not find direct use of this; may be padding.
1019+
undefined2 unk_0x3a8;
1020+
undefined2 unk_0x3aa;
1021+
undefined1 unk_0x3ac;
1022+
undefined1 unk_0x3ad;
1023+
char name[10]; // 0x3AE: Name of the selected monster.
1024+
undefined unk_0x3b8[12]; // Could not find direct use of this, probably not padding though.
1025+
};
1026+
ASSERT_SIZE(struct link_shop, 964);
1027+
9711028
#endif

symbols/overlay18.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,36 @@ overlay18:
1212
NA: 0x3500
1313
JP: 0x3520
1414
description: Controls the Electivire Link Shop.
15-
functions: []
15+
functions:
16+
- name: LinkShopEntryPoint
17+
address:
18+
EU: 0x238AC80
19+
NA: 0x238A140
20+
JP: 0x238B6A0
21+
description: |-
22+
Is the entrypoint of the overlay_load_entry, and seems to run once to initiate the Link Shop. Is not called anywhere else.
23+
Allocates space for link_shop, and initializes many of its fields.
24+
25+
return: Always returns 1.
26+
- name: LinkShopDestructor
27+
address:
28+
EU: 0x238BB14
29+
NA: 0x238AFD4
30+
JP: 0x238C530
31+
description: |-
32+
Is the destructor of the overlay_load_entry, and seems to run once on closing the Link Shop. Is not called anywhere else.
33+
Frees up the allocated space for link_shop if it is not already empty.
34+
35+
No params.
36+
- name: LinkShopMainManager
37+
address:
38+
EU: 0x238BB5C
39+
NA: 0x238B01C
40+
JP: 0x238C578
41+
description: |-
42+
Called every frame the Electivire Link Shop is open. Handles the majority of the menu.
43+
44+
return: Usually returns 1. Returns 4 when exiting the Link Shop.
1645
data:
1746
- name: LINK_SHOP_WINDOW_PARAMS_1
1847
address:
@@ -214,14 +243,16 @@ overlay18:
214243
NA: 0x4
215244
JP: 0x4
216245
description: Static initializer for overlay 18.
217-
- name: OVERLAY18_UNKNOWN_POINTER__NA_238D620
246+
- name: LINK_SHOP_PTR
218247
address:
219248
EU: 0x238E160
220249
NA: 0x238D620
221250
JP: 0x238EBA0
222251
length:
252+
EU: 0x4
223253
NA: 0x4
224-
description: "Note: unverified, ported from Irdkwia's notes"
254+
JP: 0x4
255+
description: Pointer to the heap-allocated link_shop struct.
225256
- name: OVERLAY18_UNKNOWN_POINTER__NA_238D624
226257
address:
227258
NA: 0x238D624

0 commit comments

Comments
 (0)