Attempt to decompile menudialogCoopAntiOptions

This commit is contained in:
Ryan Dwyer 2020-01-18 13:44:24 +10:00
parent 08475f6f48
commit 4bd9c8f220
4 changed files with 38 additions and 9 deletions

View File

@ -1932,7 +1932,7 @@ s32 menuhandlerBuddyOptionsContinue(u32 operation, struct menu_item *item, s32 *
}
GLOBAL_ASM(
glabel func0f10408c
glabel getMaxAiBuddies
/* f10408c: 3c0e800a */ lui $t6,0x800a
/* f104090: 8dcedfe8 */ lw $t6,-0x2018($t6)
/* f104094: 24180001 */ addiu $t8,$zero,0x1
@ -1970,14 +1970,14 @@ glabel func0f10408c
);
GLOBAL_ASM(
glabel menudialog00104104
glabel menudialogCoopAntiOptions
/* f104104: 27bdffe0 */ addiu $sp,$sp,-32
/* f104108: 24010064 */ addiu $at,$zero,0x64
/* f10410c: afbf0014 */ sw $ra,0x14($sp)
/* f104110: afa50024 */ sw $a1,0x24($sp)
/* f104114: 1481000a */ bne $a0,$at,.L0f104140
/* f104118: afa60028 */ sw $a2,0x28($sp)
/* f10411c: 0fc41023 */ jal func0f10408c
/* f10411c: 0fc41023 */ jal getMaxAiBuddies
/* f104120: afa40020 */ sw $a0,0x20($sp)
/* f104124: 3c0e800a */ lui $t6,0x800a
/* f104128: 8dcea434 */ lw $t6,-0x5bcc($t6)
@ -2028,6 +2028,35 @@ glabel menudialog00104104
/* f1041d0: 00000000 */ sll $zero,$zero,0x0
);
// Commented because this function suggests that the 3rd argument to menudialog
// functions is either not a menustackitem or is using unions.
// It uses offset 0x0a, but 0x08 is a 4 byte pointer.
//bool menudialogCoopAntiOptions(u32 operation, struct menu_dialog *dialog, struct menustackitem *stackitem)
//{
// if (operation == MENUOP_100) {
// s32 max = getMaxAiBuddies();
//
// if (g_Vars.numaibuddies > max) {
// g_Vars.numaibuddies = max;
// }
// }
//
// if (operation == MENUOP_102) {
// if (g_MenuStack[g_MpPlayerNum].unk00 &&
// g_MenuStack[g_MpPlayerNum].unk00->dialog == dialog) {
// struct menustackitem00 *unk00 = stackitem->unk00;
//
// if (unk00->unk0a) {
// menuhandlerBuddyOptionsContinue(MENUOP_SET, NULL, NULL);
// }
//
// unk00->unk0a = 0;
// }
// }
//
// return 0;
//}
s32 menuhandlerCoopRadar(u32 operation, struct menu_item *item, bool *enable)
{
switch (operation) {
@ -2083,7 +2112,7 @@ glabel menuhandlerCoopBuddy
/* f1042fc: 10000044 */ beqz $zero,.L0f104410
/* f104300: 00001025 */ or $v0,$zero,$zero
.L0f104304:
/* f104304: 0fc41023 */ jal func0f10408c
/* f104304: 0fc41023 */ jal getMaxAiBuddies
/* f104308: 00000000 */ sll $zero,$zero,0x0
/* f10430c: afa20030 */ sw $v0,0x30($sp)
/* f104310: 0c005013 */ jal func0001404c

View File

@ -10,7 +10,7 @@ u32 func0f103550(void);
f32 func0f1036ac(s32 arg0, s32 arg1);
bool isStageDifficultyUnlocked(s32 stageindex, s32 difficulty);
u32 func0f103e68(void);
u32 func0f10408c(void);
u32 getMaxAiBuddies(void);
u32 func0f104664(void);
u32 func0f104720(void);
u32 func0f105664(void);
@ -27,7 +27,7 @@ u32 func0f106a7c(void);
u32 func0f106b20(void);
s32 menudialog00103368(u32, u32, u32 *);
void menudialog00103608(void);
s32 menudialog00104104(u32, u32, u32 *);
bool menudialogCoopAntiOptions(u32 operation, struct menu_dialog *dialog, struct menustackitem *stackitem);
s32 menudialog0010559c(u32, u32, u32 *);
s32 menudialog00105c54(u32, u32, u32 *);
s32 menudialog001063d4(u32, u32, u32 *);

View File

@ -153,7 +153,7 @@ struct g_vars {
/*000468*/ bool speedpillon;
/*00046c*/ bool restartlevel;
/*000470*/ u32 perfectbuddynum;
/*000474*/ u32 numaibuddies;
/*000474*/ s32 numaibuddies;
/*000478*/ u32 unk000478;
/*00047c*/ u32 unk00047c;
/*000480*/ u32 unk000480;

View File

@ -1676,7 +1676,7 @@ struct menu_dialog g_CoopOptionsMenuDialog = {
MENUDIALOGTYPE_DEFAULT,
0x56ff, // "Co-Operative Options"
menuitems_cooperativeoptions,
menudialog00104104,
menudialogCoopAntiOptions,
0x00000004,
NULL,
};
@ -1696,7 +1696,7 @@ struct menu_dialog g_AntiOptionsMenuDialog = {
MENUDIALOGTYPE_DEFAULT,
0x570a, // "Counter-Operative Options"
menuitems_counteroperativeoptions,
menudialog00104104,
menudialogCoopAntiOptions,
0x00000004,
NULL,
};