Decompile menuCalculateItemSize

This commit is contained in:
Ryan Dwyer
2022-01-23 22:22:44 +10:00
parent 4b1a47d350
commit bb7e643829
5 changed files with 460 additions and 1893 deletions
+425 -1863
View File
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -9027,24 +9027,24 @@ bool menuitemScrollableTick(struct menuitem *item, struct menudialog *dialog, st
char *rawtext;
s32 width;
s32 height;
s32 index1;
s32 index2;
s16 wvalue;
s16 hvalue;
s32 rowindex;
s32 colindex;
s16 colwidth;
s16 rowheight;
#if PAL
data->scrollable.unk08 = g_LanguageId;
#endif
func0f0f2354(dialog, item, &index1, &index2);
dialogFindItem(dialog, item, &rowindex, &colindex);
wvalue = g_Menus[g_MpPlayerNum].unk660[index2].unk00;
hvalue = g_Menus[g_MpPlayerNum].unk4fc[index1].unk00;
colwidth = g_Menus[g_MpPlayerNum].cols[colindex].width;
rowheight = g_Menus[g_MpPlayerNum].rows[rowindex].height;
if (menuIsScrollableUnscrollable(item)) {
width = wvalue - 10;
width = colwidth - 10;
} else {
width = wvalue - 24;
width = colwidth - 24;
}
rawtext = menuitemScrollableGetText(item->param);
@@ -9055,7 +9055,7 @@ bool menuitemScrollableTick(struct menuitem *item, struct menudialog *dialog, st
textMeasure(&height, &width, wrapped, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0);
data->scrollable.unk04 = height - hvalue + 5;
data->scrollable.unk04 = height - rowheight + 5;
if (data->scrollable.unk04 < -10) {
data->scrollable.unk04 = -10;
+5
View File
@@ -1442,17 +1442,21 @@
#define MENUITEMFLAG_00000008 0x00000008
#define MENUITEMFLAG_00000010 0x00000010
#define MENUITEMFLAG_00000020 0x00000020
#define MENUITEMFLAG_00000040 0x00000040
#define MENUITEMFLAG_00000080 0x00000080
#define MENUITEMFLAG_00000100 0x00000100
#define MENUITEMFLAG_00000200 0x00000200
#define MENUITEMFLAG_00000400 0x00000400
#define MENUITEMFLAG_00000800 0x00000800
#define MENUITEMFLAG_00001000 0x00001000
#define MENUITEMFLAG_00008000 0x00008000
#define MENUITEMFLAG_00020000 0x00020000
#define MENUITEMFLAG_00040000 0x00040000
#define MENUITEMFLAG_00100000 0x00100000
#define MENUITEMFLAG_00200000 0x00200000
#define MENUITEMFLAG_00400000 0x00400000
#define MENUITEMFLAG_01000000 0x01000000
#define MENUITEMFLAG_02000000 0x02000000
#define MENUITEMFLAG_04000000 0x04000000
#define MENUITEMTYPE_LABEL 0x01
@@ -1530,6 +1534,7 @@
#define MENUSOUND_TOGGLEON 0x08 // Checking a checkbox
#define MENUSOUND_TOGGLEOFF 0x09 // Unchecking a checkbox, opening a dropdown, cancelling a dropdown
#define MENUSOUND_SUBFOCUS 0x0a // Changing focus within a list or dropdown
#define MENUSOUND_0B 0x0b
#define MENUSOUND_KEYBOARDFOCUS 0x0c // Changing focus within a keyboard item
#define MENUSOUND_KEYBOARDCANCEL 0x0d // Pressing A on a keyboard's cancel button
+5 -5
View File
@@ -23,16 +23,16 @@ char *menuResolveText(u32 thing, void *dialogoritem);
char *menuResolveParam2Text(struct menuitem *item);
char *menuResolveDialogTitle(struct menudialogdef *dialogdef);
void func0f0f15a4(struct menuitem *item, s32 *arg1);
void func0f0f1618(struct menuitem *item, s16 *arg1, s16 *arg2, struct menudialog *dialog);
void menuCalculateItemSize(struct menuitem *item, s16 *width, s16 *height, struct menudialog *dialog);
void func0f0f1d6c(struct menudialogdef *dialogdef, struct menudialog *dialog, struct menu *menu);
u32 func0f0f1ef4(void);
void dialogCalculateContentSize(struct menudialogdef *dialogdef, struct menudialog *dialog, struct menu *menu);
s32 func0f0f2354(struct menudialog *dialog, struct menuitem *item, s32 *arg2, s32 *arg3);
s32 dialogFindItem(struct menudialog *dialog, struct menuitem *item, s32 *rowindex, s32 *colindex);
bool menuIsScrollableUnscrollable(struct menuitem *item);
bool menuIsItemDisabled(struct menuitem *item, struct menudialog *dialog);
bool func0f0f2674(struct menuitem *item, struct menudialog *dialog, u32 arg2);
struct menuitem *func0f0f26fc(s32 arg0, s32 arg1, struct menudialogdef *dialogdef, s32 *arg3, struct menudialog *dialog);
struct menuitem *func0f0f288c(struct menudialog *dialog);
struct menuitem *dialogFindItemAtColY(s32 targety, s32 colindex, struct menudialogdef *dialogdef, s32 *rowindexptr, struct menudialog *dialog);
struct menuitem *dialogFindFirstItem(struct menudialog *dialog);
u32 func0f0f2928(void);
u32 func0f0f29cc(void);
u32 func0f0f2b2c(void);
@@ -73,7 +73,7 @@ void func0f0f8bb4(u8 *arg0, u32 arg1, u32 arg2);
void menuInit(void);
u32 func0f0f9030(void);
u32 func0f0f935c(void);
void func0f0fa574(struct menudialog *dialog);
void dialogInitItems(struct menudialog *dialog);
void func0f0fa6ac(void);
void menuDialogTick(void);
u32 func0f0fb488(void);
+15 -15
View File
@@ -3771,9 +3771,9 @@ struct menulayer {
struct menudialog {
struct menudialogdef *definition;
u8 unk04;
u8 unk05;
u16 unk06;
u8 colstart;
u8 numcols;
u16 blockstart;
struct menuitem *focuseditem;
/*0x0c*/ bool dimmed; // when dropdown is open or slider is active
/*0x10*/ u32 unk10;
@@ -3927,18 +3927,18 @@ struct perfectheadtexturelist {
struct textureconfig selectedtexture;
};
struct menu4fc {
s16 unk00;
struct menurow {
s16 height;
u8 itemindex;
s8 blockindex;
};
struct menu660 {
s16 unk00;
s16 unk02;
struct menucolumn {
s16 width;
s16 height;
u8 unk04;
u16 unk06;
u8 unk08;
u16 rowstart;
u8 numrows;
};
struct menu {
@@ -3947,12 +3947,12 @@ struct menu {
/*0x464*/ struct menulayer layers[6];
/*0x4f4*/ s16 depth; // index into layers. 1-indexed?
/*0x4f8*/ struct menudialog *curdialog;
/*0x4fc*/ struct menu4fc unk4fc[VERSION >= VERSION_NTSC_1_0 ? 88 : 80];
/*0x65c*/ s32 unk65c;
/*0x660*/ struct menu660 unk660[VERSION >= VERSION_NTSC_1_0 ? 12 : 10];
/*0x6d8*/ s32 unk6d8;
/*0x4fc*/ struct menurow rows[VERSION >= VERSION_NTSC_1_0 ? 88 : 80];
/*0x65c*/ s32 rowend;
/*0x660*/ struct menucolumn cols[VERSION >= VERSION_NTSC_1_0 ? 12 : 10];
/*0x6d8*/ s32 colend;
/*0x6dc*/ u32 blocks[80]; // for menuitemdata
/*0x81c*/ s32 unk81c;
/*0x81c*/ s32 blockend;
/*0x820*/ u8 unk820;
/*0x824*/ u32 unk824;
/*0x828*/ u32 unk828;