From d4dfa6124caca64b7690cff048a6b61fe3f71266 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 30 Oct 2020 18:13:32 +1000 Subject: [PATCH] Decompile contGetButtons --- src/game/bondeyespy.c | 4 +- src/game/bondmove.c | 28 ++++++------ src/game/data/data_003dc0.c | 5 +-- src/game/game_0b63b0.c | 54 +++++++++++------------ src/game/game_0f09f0.c | 2 +- src/game/game_1371b0.c | 6 +-- src/game/game_141820.c | 2 +- src/game/game_167ae0.c | 8 ++-- src/include/game/data/data_000000.h | 2 +- src/include/lib/lib_13900.h | 4 +- src/lib/lib_13900.c | 66 ++++++----------------------- src/lib/main.c | 16 +++---- 12 files changed, 77 insertions(+), 120 deletions(-) diff --git a/src/game/bondeyespy.c b/src/game/bondeyespy.c index 4142fb9fd..b3f97707c 100644 --- a/src/game/bondeyespy.c +++ b/src/game/bondeyespy.c @@ -1751,7 +1751,7 @@ glabel var7f1adb00 /* f0d09a8: a3bf00c2 */ sb $ra,0xc2($sp) /* f0d09ac: 83a400c3 */ lb $a0,0xc3($sp) /* f0d09b0: 3405ffff */ dli $a1,0xffff -/* f0d09b4: 0c0053d8 */ jal func00014f60 +/* f0d09b4: 0c0053d8 */ jal contGetButtons /* f0d09b8: a3b900c0 */ sb $t9,0xc0($sp) /* f0d09bc: 3c09800a */ lui $t1,%hi(g_Vars) /* f0d09c0: 25299fc0 */ addiu $t1,$t1,%lo(g_Vars) @@ -1823,7 +1823,7 @@ glabel var7f1adb00 /* f0d0ac0: a3a700c0 */ sb $a3,0xc0($sp) /* f0d0ac4: a7a800bc */ sh $t0,0xbc($sp) /* f0d0ac8: a3aa00c1 */ sb $t2,0xc1($sp) -/* f0d0acc: 0c0053d8 */ jal func00014f60 +/* f0d0acc: 0c0053d8 */ jal contGetButtons /* f0d0ad0: afab00b0 */ sw $t3,0xb0($sp) /* f0d0ad4: 3c09800a */ lui $t1,%hi(g_Vars) /* f0d0ad8: 25299fc0 */ addiu $t1,$t1,%lo(g_Vars) diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 2a82c7b45..51857efa8 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -867,7 +867,7 @@ glabel var7f1ad8e4 /* f0c8c6c: 00152600 */ sll $a0,$s5,0x18 /* f0c8c70: 00045e03 */ sra $t3,$a0,0x18 /* f0c8c74: 01602025 */ or $a0,$t3,$zero -/* f0c8c78: 0c0053d8 */ jal func00014f60 +/* f0c8c78: 0c0053d8 */ jal contGetButtons /* f0c8c7c: 3405ffff */ dli $a1,0xffff /* f0c8c80: 10000002 */ b .L0f0c8c8c /* f0c8c84: a7a201a2 */ sh $v0,0x1a2($sp) @@ -897,7 +897,7 @@ glabel var7f1ad8e4 /* f0c8cd4: 0004ce03 */ sra $t9,$a0,0x18 /* f0c8cd8: a7b8019e */ sh $t8,0x19e($sp) /* f0c8cdc: 03202025 */ or $a0,$t9,$zero -/* f0c8ce0: 0c0053d8 */ jal func00014f60 +/* f0c8ce0: 0c0053d8 */ jal contGetButtons /* f0c8ce4: 3405ffff */ dli $a1,0xffff /* f0c8ce8: 00508824 */ and $s1,$v0,$s0 /* f0c8cec: 97a901a2 */ lhu $t1,0x1a2($sp) @@ -1085,7 +1085,7 @@ glabel var7f1ad8e4 /* f0c8f80: 00044603 */ sra $t0,$a0,0x18 /* f0c8f84: 03208025 */ or $s0,$t9,$zero /* f0c8f88: 01002025 */ or $a0,$t0,$zero -/* f0c8f8c: 0c0053d8 */ jal func00014f60 +/* f0c8f8c: 0c0053d8 */ jal contGetButtons /* f0c8f90: 3405ffff */ dli $a1,0xffff /* f0c8f94: 00142600 */ sll $a0,$s4,0x18 /* f0c8f98: 00044e03 */ sra $t1,$a0,0x18 @@ -1111,7 +1111,7 @@ glabel var7f1ad8e4 /* f0c8fe8: 00047e03 */ sra $t7,$a0,0x18 /* f0c8fec: a7ae00da */ sh $t6,0xda($sp) /* f0c8ff0: 01e02025 */ or $a0,$t7,$zero -/* f0c8ff4: 0c0053d8 */ jal func00014f60 +/* f0c8ff4: 0c0053d8 */ jal contGetButtons /* f0c8ff8: 3405ffff */ dli $a1,0xffff /* f0c8ffc: 97b900e6 */ lhu $t9,0xe6($sp) /* f0c9000: 97a900e4 */ lhu $t1,0xe4($sp) @@ -1919,7 +1919,7 @@ glabel var7f1ad8e4 /* f0c9b2c: 31252000 */ andi $a1,$t1,0x2000 /* f0c9b30: 11000007 */ beqz $t0,.L0f0c9b50 /* f0c9b34: 00000000 */ nop -/* f0c9b38: 0c0053d8 */ jal func00014f60 +/* f0c9b38: 0c0053d8 */ jal contGetButtons /* f0c9b3c: 83a400ef */ lb $a0,0xef($sp) /* f0c9b40: 14400003 */ bnez $v0,.L0f0c9b50 /* f0c9b44: 00000000 */ nop @@ -1960,7 +1960,7 @@ glabel var7f1ad8e4 /* f0c9bc4: 02e02025 */ or $a0,$s7,$zero /* f0c9bc8: 97aa00ea */ lhu $t2,0xea($sp) /* f0c9bcc: 83a400ef */ lb $a0,0xef($sp) -/* f0c9bd0: 0c0053d8 */ jal func00014f60 +/* f0c9bd0: 0c0053d8 */ jal contGetButtons /* f0c9bd4: 31452000 */ andi $a1,$t2,0x2000 /* f0c9bd8: 0002202b */ sltu $a0,$zero,$v0 /* f0c9bdc: 5080000f */ beqzl $a0,.L0f0c9c1c @@ -2742,7 +2742,7 @@ glabel var7f1ad8e4 /* f0ca6d8: 00152600 */ sll $a0,$s5,0x18 /* f0ca6dc: 00046603 */ sra $t4,$a0,0x18 /* f0ca6e0: 01802025 */ or $a0,$t4,$zero -/* f0ca6e4: 0c0053d8 */ jal func00014f60 +/* f0ca6e4: 0c0053d8 */ jal contGetButtons /* f0ca6e8: 31a50404 */ andi $a1,$t5,0x404 /* f0ca6ec: 0002202b */ sltu $a0,$zero,$v0 .L0f0ca6f0: @@ -4003,7 +4003,7 @@ glabel var7f1ad8e4 // c1sticky = arg1 ? contGetStickY(contpad1) : 0; // // // 8c68 -// sp1a2 = arg2 ? func00014f60(contpad1, 0xffff) : 0; +// sp1a2 = arg2 ? contGetButtons(contpad1, 0xffff) : 0; // // // 8c8c // sp1a0 = arg2 ? func00015020(contpad1, 0xffff) : 0; @@ -4014,7 +4014,7 @@ glabel var7f1ad8e4 // // if (c1inhibitedbuttons) { // c1allowedbuttons = ~c1inhibitedbuttons; -// inhibitedbuttons = func00014f60(contpad1, 0xffff) & (c1inhibitedbuttons & 0xffff); +// inhibitedbuttons = contGetButtons(contpad1, 0xffff) & (c1inhibitedbuttons & 0xffff); // sp1a2 &= ~inhibitedbuttons; // sp1a0 &= ~inhibitedbuttons; // g_Vars.currentplayer->joybutinhibit = (g_Vars.currentplayer->joybutinhibit & 0xffff0000) | inhibitedbuttons; @@ -4093,7 +4093,7 @@ glabel var7f1ad8e4 // // s4 shifted to s8 and stored in a0 for next jal // c2sticky = contGetStickY(contpad2); // shifted to s8 and stored in s0 // // s4 shifted to s8 and stored in a0 for next jal -// spe6 = func00014f60(contpad2, 0xffff); // sh v0,0xe6(sp) +// spe6 = contGetButtons(contpad2, 0xffff); // sh v0,0xe6(sp) // // s4 shifted to s8 and stored in a0 for next jal // spe4 = func00015020(contpad2, 0xffff); // sh v0,0xe4(sp) // c2stickx2 = c2stickx; // s3 = spe9 @@ -4105,7 +4105,7 @@ glabel var7f1ad8e4 // // 8fac // if (c2inhibitedbuttons) { // c2allowedbuttons = ~c2inhibitedbuttons; -// inhibitedbuttons = func00014f60(contpad2, 0xffff) & c2inhibitedbuttons; +// inhibitedbuttons = contGetButtons(contpad2, 0xffff) & c2inhibitedbuttons; // spe6 &= ~inhibitedbuttons; // spe4 &= ~inhibitedbuttons; // g_Vars.currentplayer->joybutinhibit = (g_Vars.currentplayer->joybutinhibit & 0xffff) | (inhibitedbuttons << 16); @@ -4455,7 +4455,7 @@ glabel var7f1ad8e4 // movedata.unk58 = g_Vars.currentplayer->insightaimmode; // // if (g_Vars.currentplayer->waitforzrelease -// && func00014f60(shootpad, shootallowedbuttons & Z_TRIG) == 0) { +// && contGetButtons(shootpad, shootallowedbuttons & Z_TRIG) == 0) { // g_Vars.currentplayer->waitforzrelease = false; // } // @@ -4468,7 +4468,7 @@ glabel var7f1ad8e4 // } else { // movedata.triggeron = g_Vars.currentplayer->waitforzrelease == false // && arg2 -// && func00014f60(shootpad, shootallowedbuttons & Z_TRIG) +// && contGetButtons(shootpad, shootallowedbuttons & Z_TRIG) // && g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED // && (sp1a2 & A_BUTTON) == 0 // && (spe6 & A_BUTTON) == 0; @@ -4796,7 +4796,7 @@ glabel var7f1ad8e4 // && g_Vars.coopplayernum <= -1) { // movedata.eyesshut = g_Vars.currentplayer->insightaimmode // && sp1a8 == 0 -// && func00014f60(contpad1, c1allowedbuttons & (D_JPAD | D_CBUTTONS)); +// && contGetButtons(contpad1, c1allowedbuttons & (D_JPAD | D_CBUTTONS)); // } // // if (getCurrentPlayerWeaponId(0) == WEAPON_FARSIGHTXR20) { diff --git a/src/game/data/data_003dc0.c b/src/game/data/data_003dc0.c index 5af96ba46..cb252e477 100644 --- a/src/game/data/data_003dc0.c +++ b/src/game/data/data_003dc0.c @@ -653,10 +653,7 @@ u32 var8005ee64 = 0x00000000; u32 var8005ee68 = 0x00000000; u32 var8005ee6c[4] = {0}; u32 var8005ee7c[4] = {0}; -u32 var8005ee8c = 0x00000000; -u32 var8005ee90 = 0x00000000; -u32 var8005ee94 = 0x00000000; -u32 var8005ee98 = 0x00000000; +u32 var8005ee8c[4] = {0}; u32 var8005ee9c = 0x00000000; u32 var8005eea0 = 0x00000000; u32 var8005eea4 = 0x00000000; diff --git a/src/game/game_0b63b0.c b/src/game/game_0b63b0.c index 9e68df36d..c57868324 100644 --- a/src/game/game_0b63b0.c +++ b/src/game/game_0b63b0.c @@ -4490,7 +4490,7 @@ glabel var7f1ad5dc /* f0ba2d8: 00047e03 */ sra $t7,$a0,0x18 /* f0ba2dc: 12000005 */ beqz $s0,.L0f0ba2f4 /* f0ba2e0: 01e02025 */ or $a0,$t7,$zero -/* f0ba2e4: 0c0053d8 */ jal func00014f60 +/* f0ba2e4: 0c0053d8 */ jal contGetButtons /* f0ba2e8: 3405ffff */ dli $a1,0xffff /* f0ba2ec: 10000002 */ b .L0f0ba2f8 /* f0ba2f0: a7a2010c */ sh $v0,0x10c($sp) @@ -8346,7 +8346,7 @@ glabel var7f1ad6ac /* f0bdda8: 00047e03 */ sra $t7,$a0,0x18 /* f0bddac: 13000005 */ beqz $t8,.L0f0bddc4 /* f0bddb0: 01e02025 */ or $a0,$t7,$zero -/* f0bddb4: 0c0053d8 */ jal func00014f60 +/* f0bddb4: 0c0053d8 */ jal contGetButtons /* f0bddb8: 3405ffff */ dli $a1,0xffff /* f0bddbc: 10000002 */ b .L0f0bddc8 /* f0bddc0: 3043ffff */ andi $v1,$v0,0xffff @@ -8857,19 +8857,19 @@ glabel var7f1ad6ac .L0f0be524: /* f0be524: 00047e03 */ sra $t7,$a0,0x18 /* f0be528: 01e02025 */ or $a0,$t7,$zero -/* f0be52c: 0c0053d8 */ jal func00014f60 +/* f0be52c: 0c0053d8 */ jal contGetButtons /* f0be530: 3405c000 */ dli $a1,0xc000 /* f0be534: 1440000c */ bnez $v0,.L0f0be568 /* f0be538: 00152600 */ sll $a0,$s5,0x18 /* f0be53c: 00044e03 */ sra $t1,$a0,0x18 /* f0be540: 01202025 */ or $a0,$t1,$zero -/* f0be544: 0c0053d8 */ jal func00014f60 +/* f0be544: 0c0053d8 */ jal contGetButtons /* f0be548: 3405c000 */ dli $a1,0xc000 /* f0be54c: 14400006 */ bnez $v0,.L0f0be568 /* f0be550: 00152600 */ sll $a0,$s5,0x18 /* f0be554: 00045603 */ sra $t2,$a0,0x18 /* f0be558: 01402025 */ or $a0,$t2,$zero -/* f0be55c: 0c0053d8 */ jal func00014f60 +/* f0be55c: 0c0053d8 */ jal contGetButtons /* f0be560: 24052000 */ addiu $a1,$zero,0x2000 /* f0be564: 10400002 */ beqz $v0,.L0f0be570 .L0f0be568: @@ -8888,19 +8888,19 @@ glabel var7f1ad6ac .L0f0be594: /* f0be594: 00122600 */ sll $a0,$s2,0x18 /* f0be598: 00047603 */ sra $t6,$a0,0x18 -/* f0be59c: 0c0053d8 */ jal func00014f60 +/* f0be59c: 0c0053d8 */ jal contGetButtons /* f0be5a0: 01c02025 */ or $a0,$t6,$zero /* f0be5a4: 1440000c */ bnez $v0,.L0f0be5d8 /* f0be5a8: 00152600 */ sll $a0,$s5,0x18 /* f0be5ac: 0004ce03 */ sra $t9,$a0,0x18 /* f0be5b0: 03202025 */ or $a0,$t9,$zero -/* f0be5b4: 0c0053d8 */ jal func00014f60 +/* f0be5b4: 0c0053d8 */ jal contGetButtons /* f0be5b8: 3405c000 */ dli $a1,0xc000 /* f0be5bc: 14400006 */ bnez $v0,.L0f0be5d8 /* f0be5c0: 00122600 */ sll $a0,$s2,0x18 /* f0be5c4: 0004c603 */ sra $t8,$a0,0x18 /* f0be5c8: 03002025 */ or $a0,$t8,$zero -/* f0be5cc: 0c0053d8 */ jal func00014f60 +/* f0be5cc: 0c0053d8 */ jal contGetButtons /* f0be5d0: 24052000 */ addiu $a1,$zero,0x2000 /* f0be5d4: 10400002 */ beqz $v0,.L0f0be5e0 .L0f0be5d8: @@ -8932,13 +8932,13 @@ glabel var7f1ad6ac /* f0be630: 00122600 */ sll $a0,$s2,0x18 /* f0be634: 00047603 */ sra $t6,$a0,0x18 /* f0be638: 01c02025 */ or $a0,$t6,$zero -/* f0be63c: 0c0053d8 */ jal func00014f60 +/* f0be63c: 0c0053d8 */ jal contGetButtons /* f0be640: 24051000 */ addiu $a1,$zero,0x1000 /* f0be644: 14400006 */ bnez $v0,.L0f0be660 /* f0be648: 00152600 */ sll $a0,$s5,0x18 /* f0be64c: 0004ce03 */ sra $t9,$a0,0x18 /* f0be650: 03202025 */ or $a0,$t9,$zero -/* f0be654: 0c0053d8 */ jal func00014f60 +/* f0be654: 0c0053d8 */ jal contGetButtons /* f0be658: 24051000 */ addiu $a1,$zero,0x1000 /* f0be65c: 10400044 */ beqz $v0,.L0f0be770 .L0f0be660: @@ -8972,7 +8972,7 @@ glabel var7f1ad6ac .L0f0be6c4: /* f0be6c4: 00046603 */ sra $t4,$a0,0x18 /* f0be6c8: 01802025 */ or $a0,$t4,$zero -/* f0be6cc: 0c0053d8 */ jal func00014f60 +/* f0be6cc: 0c0053d8 */ jal contGetButtons /* f0be6d0: 24056030 */ addiu $a1,$zero,0x6030 /* f0be6d4: 10400012 */ beqz $v0,.L0f0be720 /* f0be6d8: 240e0001 */ addiu $t6,$zero,0x1 @@ -8990,7 +8990,7 @@ glabel var7f1ad6ac .L0f0be704: /* f0be704: 00047e03 */ sra $t7,$a0,0x18 /* f0be708: 01e02025 */ or $a0,$t7,$zero -/* f0be70c: 0c0053d8 */ jal func00014f60 +/* f0be70c: 0c0053d8 */ jal contGetButtons /* f0be710: 3405c030 */ dli $a1,0xc030 /* f0be714: 10400002 */ beqz $v0,.L0f0be720 /* f0be718: 24090001 */ addiu $t1,$zero,0x1 @@ -9012,7 +9012,7 @@ glabel var7f1ad6ac /* f0be750: 00122600 */ sll $a0,$s2,0x18 /* f0be754: 00046603 */ sra $t4,$a0,0x18 /* f0be758: 01802025 */ or $a0,$t4,$zero -/* f0be75c: 0c0053d8 */ jal func00014f60 +/* f0be75c: 0c0053d8 */ jal contGetButtons /* f0be760: 24051000 */ addiu $a1,$zero,0x1000 /* f0be764: 10400002 */ beqz $v0,.L0f0be770 /* f0be768: 240e0001 */ addiu $t6,$zero,0x1 @@ -10503,7 +10503,7 @@ glabel var7f1ad6ac // // dd8c // if (eyespy->active) { // s8 contpad1 = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex); -// u16 buttons = param_1 ? func00014f60(contpad1, 0xffff) : 0; +// u16 buttons = param_1 ? contGetButtons(contpad1, 0xffff) : 0; // // if (g_Vars.currentplayer->isdead == false // && g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED @@ -10712,9 +10712,9 @@ glabel var7f1ad6ac // if (g_PlayersWithControl[g_Vars.currentplayernum]) { // if (mode == CONTROLMODE_21 || mode == CONTROLMODE_22) { // // e52c -// if (func00014f60(contpad1, A_BUTTON | B_BUTTON) -// || func00014f60(contpad2, A_BUTTON | B_BUTTON) -// || func00014f60(contpad2, Z_TRIG)) { +// if (contGetButtons(contpad1, A_BUTTON | B_BUTTON) +// || contGetButtons(contpad2, A_BUTTON | B_BUTTON) +// || contGetButtons(contpad2, Z_TRIG)) { // // 568 // slow = true; // } @@ -10724,9 +10724,9 @@ glabel var7f1ad6ac // explode = true; // } // } else { -// if (func00014f60(contpad1, A_BUTTON | B_BUTTON) -// || func00014f60(contpad2, A_BUTTON | B_BUTTON) -// || func00014f60(contpad1, Z_TRIG)) { +// if (contGetButtons(contpad1, A_BUTTON | B_BUTTON) +// || contGetButtons(contpad2, A_BUTTON | B_BUTTON) +// || contGetButtons(contpad1, Z_TRIG)) { // slow = true; // } // @@ -10741,7 +10741,7 @@ glabel var7f1ad6ac // slow = true; // } // -// if (func00014f60(contpad1, START_BUTTON) || func00014f60(contpad2, START_BUTTON)) { +// if (contGetButtons(contpad1, START_BUTTON) || contGetButtons(contpad2, START_BUTTON)) { // pause = true; // } // } else { @@ -10751,7 +10751,7 @@ glabel var7f1ad6ac // explode = true; // } // -// if (func00014f60(contpad1, B_BUTTON | Z_TRIG | L_TRIG | R_TRIG)) { +// if (contGetButtons(contpad1, B_BUTTON | Z_TRIG | L_TRIG | R_TRIG)) { // slow = true; // } // } else { @@ -10759,7 +10759,7 @@ glabel var7f1ad6ac // explode = true; // } // -// if (func00014f60(contpad1, A_BUTTON | B_BUTTON | L_TRIG | R_TRIG)) { +// if (contGetButtons(contpad1, A_BUTTON | B_BUTTON | L_TRIG | R_TRIG)) { // slow = true; // } // } @@ -10770,7 +10770,7 @@ glabel var7f1ad6ac // slow = true; // } // -// if (func00014f60(contpad1, START_BUTTON)) { +// if (contGetButtons(contpad1, START_BUTTON)) { // pause = true; // } // } @@ -12634,7 +12634,7 @@ Gfx *func0f0c07c8(Gfx *gdl) if (g_Vars.antiplayernum >= 0 && g_Vars.currentplayer == g_Vars.anti) { // Anti - if (func00014f60(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000) && !mpIsPaused()) { + if (contGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000) && !mpIsPaused()) { g_Vars.currentplayer->dostartnewlife = true; } } else { @@ -12647,7 +12647,7 @@ Gfx *func0f0c07c8(Gfx *gdl) f32 stealhealth; f32 shield; - canrestart = func00014f60(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000) + canrestart = contGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000) && !mpIsPaused(); // Get ready to respawn. @@ -12754,7 +12754,7 @@ Gfx *func0f0c07c8(Gfx *gdl) } } - if (func00014f60(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000) + if (contGetButtons(optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex), 0xb000) && !mpIsPaused() && g_NumReasonsToEndMpMatch == 0) { canrestart = true; diff --git a/src/game/game_0f09f0.c b/src/game/game_0f09f0.c index 55e7361bb..53cb0c7fb 100644 --- a/src/game/game_0f09f0.c +++ b/src/game/game_0f09f0.c @@ -11006,7 +11006,7 @@ glabel var7f1b2ac8 /* f0fa950: 0011ce03 */ sra $t9,$s1,0x18 /* f0fa954: 03208825 */ or $s1,$t9,$zero /* f0fa958: 82640003 */ lb $a0,0x3($s3) -/* f0fa95c: 0c0053d8 */ jal func00014f60 +/* f0fa95c: 0c0053d8 */ jal contGetButtons /* f0fa960: 3405ffff */ dli $a1,0xffff /* f0fa964: 3052ffff */ andi $s2,$v0,0xffff /* f0fa968: 82640003 */ lb $a0,0x3($s3) diff --git a/src/game/game_1371b0.c b/src/game/game_1371b0.c index 0903f8cd3..deec628cf 100644 --- a/src/game/game_1371b0.c +++ b/src/game/game_1371b0.c @@ -1788,7 +1788,7 @@ glabel var7f1b5824 /* f138a78: 00000000 */ nop /* f138a7c: 4500000d */ bc1f .L0f138ab4 /* f138a80: 00000000 */ nop -/* f138a84: 0c0053d8 */ jal func00014f60 +/* f138a84: 0c0053d8 */ jal contGetButtons /* f138a88: 24050030 */ addiu $a1,$zero,0x30 /* f138a8c: 14400009 */ bnez $v0,.L0f138ab4 /* f138a90: 00000000 */ nop @@ -1819,7 +1819,7 @@ glabel var7f1b5824 /* f138aec: 00000000 */ nop /* f138af0: 4502000e */ bc1fl .L0f138b2c /* f138af4: 00002025 */ or $a0,$zero,$zero -/* f138af8: 0c0053d8 */ jal func00014f60 +/* f138af8: 0c0053d8 */ jal contGetButtons /* f138afc: 24050030 */ addiu $a1,$zero,0x30 /* f138b00: 5440000a */ bnezl $v0,.L0f138b2c /* f138b04: 00002025 */ or $a0,$zero,$zero @@ -4521,7 +4521,7 @@ glabel var7f1b5930 /* f13affc: 00000000 */ nop /* f13b000: 45020008 */ bc1fl .L0f13b024 /* f13b004: 8e020000 */ lw $v0,0x0($s0) -/* f13b008: 0c0053d8 */ jal func00014f60 +/* f13b008: 0c0053d8 */ jal contGetButtons /* f13b00c: 24050030 */ addiu $a1,$zero,0x30 /* f13b010: 54400004 */ bnezl $v0,.L0f13b024 /* f13b014: 8e020000 */ lw $v0,0x0($s0) diff --git a/src/game/game_141820.c b/src/game/game_141820.c index e164e9d47..dae5ac068 100644 --- a/src/game/game_141820.c +++ b/src/game/game_141820.c @@ -3982,7 +3982,7 @@ glabel hudRenderEyespyUi /* f1451ac: 0004c603 */ sra $t8,$a0,0x18 /* f1451b0: 01c08025 */ or $s0,$t6,$zero /* f1451b4: 03002025 */ or $a0,$t8,$zero -/* f1451b8: 0c0053d8 */ jal func00014f60 +/* f1451b8: 0c0053d8 */ jal contGetButtons /* f1451bc: 3405ffff */ dli $a1,0xffff /* f1451c0: 00102600 */ sll $a0,$s0,0x18 /* f1451c4: 00047e03 */ sra $t7,$a0,0x18 diff --git a/src/game/game_167ae0.c b/src/game/game_167ae0.c index 2c9b6defa..dee2b963a 100644 --- a/src/game/game_167ae0.c +++ b/src/game/game_167ae0.c @@ -4233,22 +4233,22 @@ void func0f16b96c(void) } if (g_Vars.stagenum < STAGE_TITLE && !var800624a4 && !g_Vars.in_cutscene) { - if (func00014f60(0, 0xffff) == 0 + if (contGetButtons(0, 0xffff) == 0 && contGetStickX(0) < 10 && contGetStickX(0) > -10 && contGetStickY(0) < 10 && contGetStickY(0) > -10 - && func00014f60(1, 0xffff) == 0 + && contGetButtons(1, 0xffff) == 0 && contGetStickX(1) < 10 && contGetStickX(1) > -10 && contGetStickY(1) < 10 && contGetStickY(1) > -10 - && func00014f60(2, 0xffff) == 0 + && contGetButtons(2, 0xffff) == 0 && contGetStickX(2) < 10 && contGetStickX(2) > -10 && contGetStickY(2) < 10 && contGetStickY(2) > -10 - && func00014f60(3, 0xffff) == 0 + && contGetButtons(3, 0xffff) == 0 && contGetStickX(3) < 10 && contGetStickX(3) > -10 && contGetStickY(3) < 10 diff --git a/src/include/game/data/data_000000.h b/src/include/game/data/data_000000.h index c8742c60d..599774ded 100644 --- a/src/include/game/data/data_000000.h +++ b/src/include/game/data/data_000000.h @@ -117,7 +117,7 @@ extern struct contdata *var8005ee60; extern u32 var8005ee68; extern u32 var8005ee6c[4]; extern u32 var8005ee7c[4]; -extern u32 var8005ee8c; +extern u32 var8005ee8c[4]; extern u32 var8005ee9c; extern u8 var8005eeac; extern u32 var8005eeb8; diff --git a/src/include/lib/lib_13900.h b/src/include/lib/lib_13900.h index a28697766..398647ae2 100644 --- a/src/include/lib/lib_13900.h +++ b/src/include/lib/lib_13900.h @@ -34,8 +34,8 @@ u32 func00014b50(u32 samplenum, s8 contpadnum, u32 buttons); u32 func00014c98(u32 *arg0, s8 contpadnum, u32 buttons); s8 contGetStickX(s8 contpadnum); s8 contGetStickY(s8 contpadnum); -u16 func00014f60(s8 contpadnum, u16 arg1); -u16 func00015020(s8 contpadnum, u16 arg1); +u16 contGetButtons(s8 contpadnum, u16 mask); +u16 func00015020(s8 contpadnum, u16 mask); u32 func000150c4(void); u32 func000150e8(void); u32 func00015144(void); diff --git a/src/lib/lib_13900.c b/src/lib/lib_13900.c index aa48ef2f9..450584a70 100644 --- a/src/lib/lib_13900.c +++ b/src/lib/lib_13900.c @@ -1702,59 +1702,19 @@ s8 contGetStickY(s8 contpadnum) return var8005ee60->samples[var8005ee60->index].pads[contpadnum].stick_y; } -GLOBAL_ASM( -glabel func00014f60 -/* 14f60: 3c038006 */ lui $v1,%hi(var8005ee60) -/* 14f64: 8c63ee60 */ lw $v1,%lo(var8005ee60)($v1) -/* 14f68: afa40000 */ sw $a0,0x0($sp) -/* 14f6c: afa50004 */ sw $a1,0x4($sp) -/* 14f70: 8c790200 */ lw $t9,0x200($v1) -/* 14f74: 00047600 */ sll $t6,$a0,0x18 -/* 14f78: 000e7e03 */ sra $t7,$t6,0x18 -/* 14f7c: 30b8ffff */ andi $t8,$a1,0xffff -/* 14f80: 03002825 */ or $a1,$t8,$zero -/* 14f84: 0721000f */ bgez $t9,.L00014fc4 -/* 14f88: 01e02025 */ or $a0,$t7,$zero -/* 14f8c: 3c088006 */ lui $t0,%hi(var8005eeac) -/* 14f90: 9108eeac */ lbu $t0,%lo(var8005eeac)($t0) -/* 14f94: 3c0c8006 */ lui $t4,%hi(var8005ee8c) -/* 14f98: 258cee8c */ addiu $t4,$t4,%lo(var8005ee8c) -/* 14f9c: 01e84807 */ srav $t1,$t0,$t7 -/* 14fa0: 312a0001 */ andi $t2,$t1,0x1 -/* 14fa4: 15400007 */ bnez $t2,.L00014fc4 -/* 14fa8: 000f5880 */ sll $t3,$t7,0x2 -/* 14fac: 016c1821 */ addu $v1,$t3,$t4 -/* 14fb0: 8c6d0000 */ lw $t5,0x0($v1) -/* 14fb4: 00001025 */ or $v0,$zero,$zero -/* 14fb8: 25ae0001 */ addiu $t6,$t5,0x1 -/* 14fbc: 03e00008 */ jr $ra -/* 14fc0: ac6e0000 */ sw $t6,0x0($v1) -.L00014fc4: -/* 14fc4: 00047880 */ sll $t7,$a0,0x2 -/* 14fc8: 3c18800a */ lui $t8,%hi(var80099e68) -/* 14fcc: 030fc021 */ addu $t8,$t8,$t7 -/* 14fd0: 8f189e68 */ lw $t8,%lo(var80099e68)($t8) -/* 14fd4: 5b000004 */ blezl $t8,.L00014fe8 -/* 14fd8: 8c7901e0 */ lw $t9,0x1e0($v1) -/* 14fdc: 03e00008 */ jr $ra -/* 14fe0: 00001025 */ or $v0,$zero,$zero -/* 14fe4: 8c7901e0 */ lw $t9,0x1e0($v1) -.L00014fe8: -/* 14fe8: 00045080 */ sll $t2,$a0,0x2 -/* 14fec: 01445023 */ subu $t2,$t2,$a0 -/* 14ff0: 00194080 */ sll $t0,$t9,0x2 -/* 14ff4: 01194023 */ subu $t0,$t0,$t9 -/* 14ff8: 000840c0 */ sll $t0,$t0,0x3 -/* 14ffc: 00684821 */ addu $t1,$v1,$t0 -/* 15000: 000a5040 */ sll $t2,$t2,0x1 -/* 15004: 012a5821 */ addu $t3,$t1,$t2 -/* 15008: 956c0000 */ lhu $t4,0x0($t3) -/* 1500c: 01851024 */ and $v0,$t4,$a1 -/* 15010: 304dffff */ andi $t5,$v0,0xffff -/* 15014: 01a01025 */ or $v0,$t5,$zero -/* 15018: 03e00008 */ jr $ra -/* 1501c: 00000000 */ nop -); +u16 contGetButtons(s8 contpadnum, u16 mask) +{ + if (var8005ee60->unk200 < 0 && (var8005eeac >> contpadnum & 1) == 0) { + var8005ee8c[contpadnum]++; + return 0; + } + + if (var80099e68[contpadnum] > 0) { + return 0; + } + + return var8005ee60->samples[var8005ee60->index].pads[contpadnum].button & mask; +} GLOBAL_ASM( glabel func00015020 diff --git a/src/lib/main.c b/src/lib/main.c index 04d97eee4..542c2c2f8 100644 --- a/src/lib/main.c +++ b/src/lib/main.c @@ -274,19 +274,19 @@ glabel mainInit /* d630: 3c018006 */ lui $at,%hi(var8005d9b0) /* d634: ac2bd9b0 */ sw $t3,%lo(var8005d9b0)($at) .L0000d638: -/* d638: 0c0053d8 */ jal func00014f60 +/* d638: 0c0053d8 */ jal contGetButtons /* d63c: 24051000 */ addiu $a1,$zero,0x1000 /* d640: 14400010 */ bnez $v0,.L0000d684 /* d644: 24040001 */ addiu $a0,$zero,0x1 -/* d648: 0c0053d8 */ jal func00014f60 +/* d648: 0c0053d8 */ jal contGetButtons /* d64c: 24051000 */ addiu $a1,$zero,0x1000 /* d650: 1440000c */ bnez $v0,.L0000d684 /* d654: 24040002 */ addiu $a0,$zero,0x2 -/* d658: 0c0053d8 */ jal func00014f60 +/* d658: 0c0053d8 */ jal contGetButtons /* d65c: 24051000 */ addiu $a1,$zero,0x1000 /* d660: 14400008 */ bnez $v0,.L0000d684 /* d664: 24040003 */ addiu $a0,$zero,0x3 -/* d668: 0c0053d8 */ jal func00014f60 +/* d668: 0c0053d8 */ jal contGetButtons /* d66c: 24051000 */ addiu $a1,$zero,0x1000 /* d670: 14400004 */ bnez $v0,.L0000d684 /* d674: 3c108006 */ lui $s0,%hi(g_DoBootPakMenu) @@ -648,10 +648,10 @@ const char var70053aa0[] = " -ml0 -me0 -mgfx100 -mvtx50 -mt700 -ma400"; // } // // // If holding start on any controller, open boot pak menu -// if (func00014f60(0, START_BUTTON) == 0 -// && func00014f60(1, START_BUTTON) == 0 -// && func00014f60(2, START_BUTTON) == 0 -// && func00014f60(3, START_BUTTON) == 0) { +// if (contGetButtons(0, START_BUTTON) == 0 +// && contGetButtons(1, START_BUTTON) == 0 +// && contGetButtons(2, START_BUTTON) == 0 +// && contGetButtons(3, START_BUTTON) == 0) { // g_DoBootPakMenu = false; // } else { // g_DoBootPakMenu = true;