Attempt to decompile menuRenderItemSelectable

This commit is contained in:
Ryan Dwyer
2020-09-20 23:54:48 +10:00
parent fe7aa8371a
commit 54a353de89
5 changed files with 157 additions and 27 deletions
+131 -6
View File
@@ -31,9 +31,6 @@ const char var7f1adfa0[] = "brcol";
const char var7f1adfa8[] = "%d: ";
const char var7f1adfb0[] = "%s";
const char var7f1adfb4[] = "";
const char var7f1adfb8[] = "";
const char var7f1adfbc[] = "";
const char var7f1adfc0[] = "%d\n";
s32 var80071190 = 0x00000000;
s32 var80071194 = 0x00000000;
@@ -5846,6 +5843,131 @@ glabel menuRenderItemSelectable
/* f0eb468: 27bd0080 */ addiu $sp,$sp,0x80
);
const char var7f1adfb8[] = "";
//Gfx *menuRenderItemSelectable(Gfx *gdl, struct menurenderthing *thing)
//{
// u32 leftcolour;
// u32 rightcolour;
// char *text;
// s32 x = thing->x + 10;
// s32 y = thing->y + 2;
// u32 font1 = var8007fb10;
// u32 font2 = var8007fb0c;
//
// if (thing->item->param1 & 0x00000010) {
// x -= 6;
// }
//
// if (thing->item->param1 & 0x00400000) {
// font1 = var8007fb18;
// font2 = var8007fb14;
// }
//
// text = menuResolveParam2Text(thing->item);
//
// if (thing->unk10->unk40 < 0) {
// leftcolour = g_MenuColourPalettes[thing->unk10->colour1index].unk18;
// } else {
// leftcolour = colourBlend(
// g_MenuColourPalettes[thing->unk10->colour2index].unk18,
// g_MenuColourPalettes[thing->unk10->colour1index].unk18,
// thing->unk10->colourweight);
// }
//
// if (thing->unk10->unk0c) {
// leftcolour = colourBlend(leftcolour, 0, 127) & 0xffffff00 | leftcolour & 0xff;
// }
//
// rightcolour = leftcolour;
//
// if (thing->focused) {
// // Mismatch: The addiu and lui at eb030 and eb034 are swapped. The addiu
// // is adding the lower half of the address of g_MenuColourPalettes for
// // use in the else branch. The lui is loading a value into $at for the
// // float to u32 conversion for weight.
// u32 colour2;
// u32 weight = func0f006b08(40) * 255;
//
// if (thing->unk10->unk40 < 0) {
// colour2 = g_MenuColourPalettes[thing->unk10->colour1index].unk20;
// } else {
// colour2 = colourBlend(
// g_MenuColourPalettes[thing->unk10->colour2index].unk20,
// g_MenuColourPalettes[thing->unk10->colour1index].unk20,
// thing->unk10->colourweight);
// }
//
// leftcolour = colourBlend(colourBlend(leftcolour, leftcolour & 0x000000ff, 127), colour2, weight);
//
// func0f153e38(
// g_MenuColourPalettes3[thing->unk10->colour1index].unk20,
// g_MenuColourPalettes2[thing->unk10->colour1index].unk20);
// } else {
// func0f153e38(
// g_MenuColourPalettes3[thing->unk10->colour1index].unk18,
// g_MenuColourPalettes2[thing->unk10->colour1index].unk18);
// }
//
// if (func0f0f2588(thing->item, thing->unk10)) {
// if (thing->unk10->unk40 < 0) {
// leftcolour = g_MenuColourPalettes[thing->unk10->colour1index].unk1c;
// } else {
// leftcolour = colourBlend(
// g_MenuColourPalettes[thing->unk10->colour2index].unk1c,
// g_MenuColourPalettes[thing->unk10->colour1index].unk1c,
// thing->unk10->colourweight);
// }
//
// if (thing->unk10->unk0c) {
// leftcolour = colourBlend(leftcolour, 0x00000000, 127) & 0xffffff00 | leftcolour & 0xff;
// }
//
// rightcolour = leftcolour;
//
// func0f153e38(
// g_MenuColourPalettes3[thing->unk10->colour1index].unk1c,
// g_MenuColourPalettes2[thing->unk10->colour1index].unk1c);
// }
//
// if (thing->item->param1 & 0x00000020) {
// // Center text
// s32 textheight;
// s32 textwidth;
// textMeasure(&textheight, &textwidth, text, font1, font2, 0);
// x = thing->x + (thing->width - textwidth) / 2;
// }
//
// if (thing->item->param1 & 0x00400000) {
// x += 35;
// y += 6;
// }
//
// gdl = func0f153628(gdl);
// gdl = textRenderWhite(gdl, &x, &y, text, font1, font2,
// leftcolour, thing->width, thing->height, 0, 0);
//
// if ((thing->item->param1 & 0x00408000) == 0) {
// // Right side text
// text = menuResolveText(thing->item->param3, thing->item);
//
// // This is not how you check if a string is empty...
// if (text != NULL && text != "") {
// s32 textheight;
// s32 textwidth;
//
// y = thing->y + 2;
// textMeasure(&textheight, &textwidth, text, font1, font2, 0);
// x = thing->x + thing->width - textwidth - 10;
//
// gdl = textRenderWhite(gdl, &x, &y, text, font1, font2,
// rightcolour, thing->width, thing->height, 0, 0);
// }
// }
//
// return func0f153780(gdl);
//}
GLOBAL_ASM(
glabel func0f0eb46c
/* f0eb46c: 27bdffd0 */ addiu $sp,$sp,-48
@@ -5893,6 +6015,9 @@ glabel func0f0eb46c
/* f0eb504: 00000000 */ nop
);
const char var7f1adfbc[] = "";
const char var7f1adfc0[] = "%d\n";
GLOBAL_ASM(
glabel menuRenderItemSlider
/* f0eb508: 27bdff50 */ addiu $sp,$sp,-176
@@ -6808,7 +6933,7 @@ Gfx *menuRenderItemCarousel(Gfx *gdl, struct menurenderthing *thing)
if (thing->focused) {
u32 colour1;
u32 alpha = func0f006b08(40) * 255;
u32 weight = func0f006b08(40) * 255;
if (thing->unk10->unk40 < 0) {
colour1 = g_MenuColourPalettes[thing->unk10->colour1index].unk20;
@@ -6819,7 +6944,7 @@ Gfx *menuRenderItemCarousel(Gfx *gdl, struct menurenderthing *thing)
thing->unk10->colourweight);
}
colour = colourBlend(colourBlend(colour, 0x000000ff, 127), colour1, alpha);
colour = colourBlend(colourBlend(colour, 0x000000ff, 127), colour1, weight);
}
// Left arrow
@@ -13265,7 +13390,7 @@ Gfx *menuRenderItem(Gfx *gdl, struct menurenderthing *thing)
{
switch (thing->item->type) {
case MENUITEMTYPE_CUSTOM: return menuRenderItemCustom(gdl);
case MENUITEMTYPE_SELECTABLE: return menuRenderItemSelectable(gdl);
case MENUITEMTYPE_SELECTABLE: return menuRenderItemSelectable(gdl, thing);
case MENUITEMTYPE_SLIDER: return menuRenderItemSlider(gdl);
case MENUITEMTYPE_CHECKBOX: return menuRenderItemCheckbox(gdl);
case MENUITEMTYPE_SCROLLABLE: return menuRenderItemScrollable(gdl, thing);
+17 -17
View File
@@ -2091,30 +2091,30 @@ glabel func0f0f2588
/* f0f2670: 00000000 */ nop
);
bool func0f0f2674(u8 *arg0, u32 arg1, u32 arg2)
bool func0f0f2674(struct menuitem *item, struct menurenderthing10 *thing10, u32 arg2)
{
u32 thing1;
u32 thing2;
switch (*arg0) {
case 1:
case 6:
case 7:
case 11:
case 18:
case 19:
case 21:
case 23:
case 25:
switch (item->type) {
case MENUITEMTYPE_LABEL:
case MENUITEMTYPE_OBJECTIVES:
case MENUITEMTYPE_07:
case MENUITEMTYPE_SEPARATOR:
case MENUITEMTYPE_MODEL:
case MENUITEMTYPE_13:
case MENUITEMTYPE_METER:
case MENUITEMTYPE_MARQUEE:
case MENUITEMTYPE_CONTROLLER:
return false;
case 16:
case 20:
case 22:
case 24:
func0f0f2354(arg1, arg0, &thing1, &thing2);
case MENUITEMTYPE_10:
case MENUITEMTYPE_14:
case MENUITEMTYPE_16:
case MENUITEMTYPE_18:
func0f0f2354(thing10, item, &thing1, &thing2);
}
if (func0f0f2588(arg0, arg1)) {
if (func0f0f2588(item, thing10)) {
return false;
}
+5
View File
@@ -1068,10 +1068,15 @@
#define MENUITEMTYPE_KEYBOARD 0x0d
#define MENUITEMTYPE_RANKING 0x0e
#define MENUITEMTYPE_PLAYERSTATS 0x0f
#define MENUITEMTYPE_10 0x10
#define MENUITEMTYPE_CAROUSEL 0x11
#define MENUITEMTYPE_MODEL 0x12
#define MENUITEMTYPE_13 0x13
#define MENUITEMTYPE_14 0x14
#define MENUITEMTYPE_METER 0x15
#define MENUITEMTYPE_16 0x16
#define MENUITEMTYPE_MARQUEE 0x17
#define MENUITEMTYPE_18 0x18
#define MENUITEMTYPE_CONTROLLER 0x19
#define MENUITEMTYPE_END 0x1a
+1 -1
View File
@@ -23,7 +23,7 @@ Gfx *menuRenderItemObjectives(Gfx *gdl, struct menurenderthing *thing);
Gfx *menuRenderItemModel(Gfx *gdl, struct menurenderthing *thing);
Gfx *menuRenderItemLabel(Gfx *gdl);
Gfx *menuRenderItemMeter(Gfx *gdl, struct menurenderthing *thing);
Gfx *menuRenderItemSelectable(Gfx *gdl);
Gfx *menuRenderItemSelectable(Gfx *gdl, struct menurenderthing *thing);
u32 func0f0eb46c(void);
Gfx *menuRenderItemSlider(Gfx *gdl);
u32 func0f0ebec8(void);
+3 -3
View File
@@ -26,10 +26,10 @@ u32 func0f0f1618(void);
void func0f0f1d6c(struct menudialog *dialog, struct menuframe *frame, struct menu *menu);
u32 func0f0f1ef4(void);
void func0f0f2134(struct menudialog *dialog, struct menuframe *frame, struct menu *menu);
void func0f0f2354(u32 arg0, u8 *arg1, u32 *arg2, u32 *arg3);
void func0f0f2354(struct menurenderthing10 *thing10, struct menuitem *item, u32 *arg2, u32 *arg3);
bool func0f0f2534(struct menuitem *item);
bool func0f0f2588(u8 *arg0, u32 arg1);
bool func0f0f2674(u8 *arg0, u32 arg1, u32 arg2);
bool func0f0f2588(struct menuitem *item, struct menurenderthing10 *arg1);
bool func0f0f2674(struct menuitem *item, struct menurenderthing10 *thing10, u32 arg2);
u32 func0f0f26fc(void);
struct menuitem *func0f0f288c(struct menuframe *frame);
u32 func0f0f2928(void);