diff --git a/src/game/bondbike.c b/src/game/bondbike.c index fcf8eb344..a82875685 100644 --- a/src/game/bondbike.c +++ b/src/game/bondbike.c @@ -277,13 +277,13 @@ glabel var7f1adb74 /* f0d274c: 8fa70060 */ lw $a3,0x60($sp) /* f0d2750: 00002025 */ or $a0,$zero,$zero /* f0d2754: 83a5005b */ lb $a1,0x5b($sp) -/* f0d2758: 0c005326 */ jal func00014c98 +/* f0d2758: 0c005326 */ jal contCountButtonsOnSpecificSamples /* f0d275c: 24060202 */ addiu $a2,$zero,0x202 /* f0d2760: 8fac0060 */ lw $t4,0x60($sp) /* f0d2764: 00002025 */ or $a0,$zero,$zero /* f0d2768: 24060101 */ addiu $a2,$zero,0x101 /* f0d276c: ad820028 */ sw $v0,0x28($t4) -/* f0d2770: 0c005326 */ jal func00014c98 +/* f0d2770: 0c005326 */ jal contCountButtonsOnSpecificSamples /* f0d2774: 83a5005b */ lb $a1,0x5b($sp) /* f0d2778: 8fa70060 */ lw $a3,0x60($sp) /* f0d277c: ace2002c */ sw $v0,0x2c($a3) @@ -575,8 +575,8 @@ glabel var7f1adb74 // || optionsGetControlMode(g_Vars.currentplayerstats->mpindex) == CONTROLMODE_13 // || optionsGetControlMode(g_Vars.currentplayerstats->mpindex) == CONTROLMODE_11) // && !soloIsPaused()) { -// data->stepleft = func00014c98(0, contnum, L_JPAD | L_CBUTTONS); -// data->stepright = func00014c98(0, contnum, R_JPAD | R_CBUTTONS); +// data->stepleft = contCountButtonsOnSpecificSamples(0, contnum, L_JPAD | L_CBUTTONS); +// data->stepright = contCountButtonsOnSpecificSamples(0, contnum, R_JPAD | R_CBUTTONS); // } // // // Forward/back diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 2ff855ef8..cd46536db 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -878,7 +878,7 @@ glabel var7f1ad8e4 /* f0c8c90: 00152600 */ sll $a0,$s5,0x18 /* f0c8c94: 00046603 */ sra $t4,$a0,0x18 /* f0c8c98: 01802025 */ or $a0,$t4,$zero -/* f0c8c9c: 0c005408 */ jal func00015020 +/* f0c8c9c: 0c005408 */ jal contGetButtonsPressedThisFrame /* f0c8ca0: 3405ffff */ dli $a1,0xffff /* f0c8ca4: 10000002 */ b .L0f0c8cb0 /* f0c8ca8: a7a201a0 */ sh $v0,0x1a0($sp) @@ -1091,7 +1091,7 @@ glabel var7f1ad8e4 /* f0c8f98: 00044e03 */ sra $t1,$a0,0x18 /* f0c8f9c: a7a200e6 */ sh $v0,0xe6($sp) /* f0c8fa0: 01202025 */ or $a0,$t1,$zero -/* f0c8fa4: 0c005408 */ jal func00015020 +/* f0c8fa4: 0c005408 */ jal contGetButtonsPressedThisFrame /* f0c8fa8: 3405ffff */ dli $a1,0xffff /* f0c8fac: 8e4b0284 */ lw $t3,0x284($s2) /* f0c8fb0: 340affff */ dli $t2,0xffff @@ -1238,7 +1238,7 @@ glabel var7f1ad8e4 /* f0c91ac: 02002025 */ or $a0,$s0,$zero /* f0c91b0: afa3004c */ sw $v1,0x4c($sp) /* f0c91b4: afa70048 */ sw $a3,0x48($sp) -/* f0c91b8: 0c00529e */ jal func00014a78 +/* f0c91b8: 0c00529e */ jal contGetButtonsOnSample /* f0c91bc: 33262000 */ andi $a2,$t9,0x2000 /* f0c91c0: 8fa3004c */ lw $v1,0x4c($sp) /* f0c91c4: 8fa70048 */ lw $a3,0x48($sp) @@ -1280,7 +1280,7 @@ glabel var7f1ad8e4 /* f0c9244: 01c02825 */ or $a1,$t6,$zero /* f0c9248: afa3004c */ sw $v1,0x4c($sp) /* f0c924c: afa70048 */ sw $a3,0x48($sp) -/* f0c9250: 0c0052d4 */ jal func00014b50 +/* f0c9250: 0c0052d4 */ jal contGetButtonsPressedOnSample /* f0c9254: 31e62000 */ andi $a2,$t7,0x2000 /* f0c9258: 8fa3004c */ lw $v1,0x4c($sp) /* f0c925c: 10400005 */ beqz $v0,.L0f0c9274 @@ -1466,7 +1466,7 @@ glabel var7f1ad8e4 /* f0c94e4: 00057603 */ sra $t6,$a1,0x18 /* f0c94e8: 01c02825 */ or $a1,$t6,$zero /* f0c94ec: 02002025 */ or $a0,$s0,$zero -/* f0c94f0: 0c00529e */ jal func00014a78 +/* f0c94f0: 0c00529e */ jal contGetButtonsOnSample /* f0c94f4: 3226ffff */ andi $a2,$s1,0xffff /* f0c94f8: 14400009 */ bnez $v0,.L0f0c9520 /* f0c94fc: 02002025 */ or $a0,$s0,$zero @@ -1474,7 +1474,7 @@ glabel var7f1ad8e4 /* f0c9504: 00142e00 */ sll $a1,$s4,0x18 /* f0c9508: 00057e03 */ sra $t7,$a1,0x18 /* f0c950c: 01e02825 */ or $a1,$t7,$zero -/* f0c9510: 0c00529e */ jal func00014a78 +/* f0c9510: 0c00529e */ jal contGetButtonsOnSample /* f0c9514: 33068000 */ andi $a2,$t8,0x8000 /* f0c9518: 50400028 */ beqzl $v0,.L0f0c95bc /* f0c951c: 8e490284 */ lw $t1,0x284($s2) @@ -1487,7 +1487,7 @@ glabel var7f1ad8e4 /* f0c9534: 14200031 */ bnez $at,.L0f0c95fc /* f0c9538: 02002025 */ or $a0,$s0,$zero /* f0c953c: 83a500ef */ lb $a1,0xef($sp) -/* f0c9540: 0c0052d4 */ jal func00014b50 +/* f0c9540: 0c0052d4 */ jal contGetButtonsPressedOnSample /* f0c9544: afa6004c */ sw $a2,0x4c($sp) /* f0c9548: 10400006 */ beqz $v0,.L0f0c9564 /* f0c954c: 8fa6004c */ lw $a2,0x4c($sp) @@ -1502,7 +1502,7 @@ glabel var7f1ad8e4 /* f0c956c: 85f8024c */ lh $t8,0x24c($t7) /* f0c9570: 07020023 */ bltzl $t8,.L0f0c9600 /* f0c9574: 26100001 */ addiu $s0,$s0,0x1 -/* f0c9578: 0c00529e */ jal func00014a78 +/* f0c9578: 0c00529e */ jal contGetButtonsOnSample /* f0c957c: 83a500ef */ lb $a1,0xef($sp) /* f0c9580: 5440001f */ bnezl $v0,.L0f0c9600 /* f0c9584: 26100001 */ addiu $s0,$s0,0x1 @@ -1528,7 +1528,7 @@ glabel var7f1ad8e4 /* f0c95cc: 02002025 */ or $a0,$s0,$zero /* f0c95d0: 97ab00ea */ lhu $t3,0xea($sp) /* f0c95d4: 83a500ef */ lb $a1,0xef($sp) -/* f0c95d8: 0c00529e */ jal func00014a78 +/* f0c95d8: 0c00529e */ jal contGetButtonsOnSample /* f0c95dc: 31662000 */ andi $a2,$t3,0x2000 /* f0c95e0: 54400005 */ bnezl $v0,.L0f0c95f8 /* f0c95e4: 8e4d0284 */ lw $t5,0x284($s2) @@ -1557,7 +1557,7 @@ glabel var7f1ad8e4 /* f0c9628: 0005c603 */ sra $t8,$a1,0x18 /* f0c962c: 8fa60044 */ lw $a2,0x44($sp) /* f0c9630: 03002825 */ or $a1,$t8,$zero -/* f0c9634: 0c00529e */ jal func00014a78 +/* f0c9634: 0c00529e */ jal contGetButtonsOnSample /* f0c9638: 02002025 */ or $a0,$s0,$zero /* f0c963c: 14400009 */ bnez $v0,.L0f0c9664 /* f0c9640: 02002025 */ or $a0,$s0,$zero @@ -1565,7 +1565,7 @@ glabel var7f1ad8e4 /* f0c9648: 00142e00 */ sll $a1,$s4,0x18 /* f0c964c: 0005ce03 */ sra $t9,$a1,0x18 /* f0c9650: 03202825 */ or $a1,$t9,$zero -/* f0c9654: 0c00529e */ jal func00014a78 +/* f0c9654: 0c00529e */ jal contGetButtonsOnSample /* f0c9658: 31064000 */ andi $a2,$t0,0x4000 /* f0c965c: 5040003e */ beqzl $v0,.L0f0c9758 /* f0c9660: 8e450284 */ lw $a1,0x284($s2) @@ -1578,7 +1578,7 @@ glabel var7f1ad8e4 /* f0c9678: 2881ffff */ slti $at,$a0,-1 /* f0c967c: 5420002f */ bnezl $at,.L0f0c973c /* f0c9680: 2881fffe */ slti $at,$a0,-2 -/* f0c9684: 0c0052d4 */ jal func00014b50 +/* f0c9684: 0c0052d4 */ jal contGetButtonsPressedOnSample /* f0c9688: 02002025 */ or $a0,$s0,$zero /* f0c968c: 5040000e */ beqzl $v0,.L0f0c96c8 /* f0c9690: 8e450284 */ lw $a1,0x284($s2) @@ -1716,14 +1716,14 @@ glabel var7f1ad8e4 /* f0c9864: 00057603 */ sra $t6,$a1,0x18 /* f0c9868: 11a0002e */ beqz $t5,.L0f0c9924 /* f0c986c: 02002025 */ or $a0,$s0,$zero -/* f0c9870: 0c005241 */ jal func00014904 +/* f0c9870: 0c005241 */ jal contGetStickYOnSample /* f0c9874: 01c02825 */ or $a1,$t6,$zero /* f0c9878: 2841001f */ slti $at,$v0,0x1f /* f0c987c: 14200011 */ bnez $at,.L0f0c98c4 /* f0c9880: 02002025 */ or $a0,$s0,$zero /* f0c9884: 00142e00 */ sll $a1,$s4,0x18 /* f0c9888: 00057e03 */ sra $t7,$a1,0x18 -/* f0c988c: 0c005270 */ jal func000149c0 +/* f0c988c: 0c005270 */ jal contGetStickYOnSampleIndex /* f0c9890: 01e02825 */ or $a1,$t7,$zero /* f0c9894: 2841001f */ slti $at,$v0,0x1f /* f0c9898: 1020000a */ beqz $at,.L0f0c98c4 @@ -1743,14 +1743,14 @@ glabel var7f1ad8e4 /* f0c98c4: 00142e00 */ sll $a1,$s4,0x18 /* f0c98c8: 0005ce03 */ sra $t9,$a1,0x18 /* f0c98cc: 03202825 */ or $a1,$t9,$zero -/* f0c98d0: 0c005241 */ jal func00014904 +/* f0c98d0: 0c005241 */ jal contGetStickYOnSample /* f0c98d4: 02002025 */ or $a0,$s0,$zero /* f0c98d8: 2841ffe2 */ slti $at,$v0,-30 /* f0c98dc: 10200011 */ beqz $at,.L0f0c9924 /* f0c98e0: 02002025 */ or $a0,$s0,$zero /* f0c98e4: 00142e00 */ sll $a1,$s4,0x18 /* f0c98e8: 00054603 */ sra $t0,$a1,0x18 -/* f0c98ec: 0c005270 */ jal func000149c0 +/* f0c98ec: 0c005270 */ jal contGetStickYOnSampleIndex /* f0c98f0: 01002825 */ or $a1,$t0,$zero /* f0c98f4: 2841ffe2 */ slti $at,$v0,-30 /* f0c98f8: 1420000a */ bnez $at,.L0f0c9924 @@ -1936,7 +1936,7 @@ glabel var7f1ad8e4 /* f0c9b6c: 12e0000d */ beqz $s7,.L0f0c9ba4 /* f0c9b70: 97ac00ea */ lhu $t4,0xea($sp) /* f0c9b74: 83a400ef */ lb $a0,0xef($sp) -/* f0c9b78: 0c005408 */ jal func00015020 +/* f0c9b78: 0c005408 */ jal contGetButtonsPressedThisFrame /* f0c9b7c: 31852000 */ andi $a1,$t4,0x2000 /* f0c9b80: 10400008 */ beqz $v0,.L0f0c9ba4 /* f0c9b84: 00000000 */ nop @@ -2024,7 +2024,7 @@ glabel var7f1ad8e4 /* f0c9ca4: 01802825 */ or $a1,$t4,$zero /* f0c9ca8: 02002025 */ or $a0,$s0,$zero /* f0c9cac: afa3004c */ sw $v1,0x4c($sp) -/* f0c9cb0: 0c00529e */ jal func00014a78 +/* f0c9cb0: 0c00529e */ jal contGetButtonsOnSample /* f0c9cb4: afa70048 */ sw $a3,0x48($sp) /* f0c9cb8: 8fa3004c */ lw $v1,0x4c($sp) /* f0c9cbc: 8fa70048 */ lw $a3,0x48($sp) @@ -2068,7 +2068,7 @@ glabel var7f1ad8e4 /* f0c9d44: 01803025 */ or $a2,$t4,$zero /* f0c9d48: 01402825 */ or $a1,$t2,$zero /* f0c9d4c: afa3004c */ sw $v1,0x4c($sp) -/* f0c9d50: 0c0052d4 */ jal func00014b50 +/* f0c9d50: 0c0052d4 */ jal contGetButtonsPressedOnSample /* f0c9d54: afa70048 */ sw $a3,0x48($sp) /* f0c9d58: 8fa3004c */ lw $v1,0x4c($sp) /* f0c9d5c: 10400005 */ beqz $v0,.L0f0c9d74 @@ -2126,7 +2126,7 @@ glabel var7f1ad8e4 /* f0c9e1c: 30cf0202 */ andi $t7,$a2,0x202 /* f0c9e20: 01e03025 */ or $a2,$t7,$zero /* f0c9e24: 01c02825 */ or $a1,$t6,$zero -/* f0c9e28: 0c005326 */ jal func00014c98 +/* f0c9e28: 0c005326 */ jal contCountButtonsOnSpecificSamples /* f0c9e2c: 02002025 */ or $a0,$s0,$zero /* f0c9e30: 00152e00 */ sll $a1,$s5,0x18 /* f0c9e34: 02203025 */ or $a2,$s1,$zero @@ -2135,7 +2135,7 @@ glabel var7f1ad8e4 /* f0c9e40: afa201dc */ sw $v0,0x1dc($sp) /* f0c9e44: 03002825 */ or $a1,$t8,$zero /* f0c9e48: 03203025 */ or $a2,$t9,$zero -/* f0c9e4c: 0c005326 */ jal func00014c98 +/* f0c9e4c: 0c005326 */ jal contCountButtonsOnSpecificSamples /* f0c9e50: 02002025 */ or $a0,$s0,$zero /* f0c9e54: afa201e0 */ sw $v0,0x1e0($sp) /* f0c9e58: 8e450284 */ lw $a1,0x284($s2) @@ -2232,7 +2232,7 @@ glabel var7f1ad8e4 /* f0c9fa0: 30cb0202 */ andi $t3,$a2,0x202 /* f0c9fa4: 01603025 */ or $a2,$t3,$zero /* f0c9fa8: 01402825 */ or $a1,$t2,$zero -/* f0c9fac: 0c005326 */ jal func00014c98 +/* f0c9fac: 0c005326 */ jal contCountButtonsOnSpecificSamples /* f0c9fb0: 02002025 */ or $a0,$s0,$zero /* f0c9fb4: 00152e00 */ sll $a1,$s5,0x18 /* f0c9fb8: 02203025 */ or $a2,$s1,$zero @@ -2241,7 +2241,7 @@ glabel var7f1ad8e4 /* f0c9fc4: afa201dc */ sw $v0,0x1dc($sp) /* f0c9fc8: 01802825 */ or $a1,$t4,$zero /* f0c9fcc: 01a03025 */ or $a2,$t5,$zero -/* f0c9fd0: 0c005326 */ jal func00014c98 +/* f0c9fd0: 0c005326 */ jal contCountButtonsOnSpecificSamples /* f0c9fd4: 02002025 */ or $a0,$s0,$zero /* f0c9fd8: afa201e0 */ sw $v0,0x1e0($sp) /* f0c9fdc: 8e450284 */ lw $a1,0x284($s2) @@ -2403,7 +2403,7 @@ glabel var7f1ad8e4 /* f0ca21c: 00056603 */ sra $t4,$a1,0x18 /* f0ca220: 8fa6003c */ lw $a2,0x3c($sp) /* f0ca224: 01802825 */ or $a1,$t4,$zero -/* f0ca228: 0c00529e */ jal func00014a78 +/* f0ca228: 0c00529e */ jal contGetButtonsOnSample /* f0ca22c: 02002025 */ or $a0,$s0,$zero /* f0ca230: 5040002d */ beqzl $v0,.L0f0ca2e8 /* f0ca234: 8e4f0284 */ lw $t7,0x284($s2) @@ -2418,7 +2418,7 @@ glabel var7f1ad8e4 /* f0ca258: 02913024 */ and $a2,$s4,$s1 /* f0ca25c: 30d8ffff */ andi $t8,$a2,0xffff /* f0ca260: 03003025 */ or $a2,$t8,$zero -/* f0ca264: 0c0052d4 */ jal func00014b50 +/* f0ca264: 0c0052d4 */ jal contGetButtonsPressedOnSample /* f0ca268: afb8004c */ sw $t8,0x4c($sp) /* f0ca26c: 10400006 */ beqz $v0,.L0f0ca288 /* f0ca270: 8fa6004c */ lw $a2,0x4c($sp) @@ -2435,7 +2435,7 @@ glabel var7f1ad8e4 /* f0ca298: 02002025 */ or $a0,$s0,$zero /* f0ca29c: 05620026 */ bltzl $t3,.L0f0ca338 /* f0ca2a0: 26100001 */ addiu $s0,$s0,0x1 -/* f0ca2a4: 0c00529e */ jal func00014a78 +/* f0ca2a4: 0c00529e */ jal contGetButtonsOnSample /* f0ca2a8: 01802825 */ or $a1,$t4,$zero /* f0ca2ac: 54400022 */ bnezl $v0,.L0f0ca338 /* f0ca2b0: 26100001 */ addiu $s0,$s0,0x1 @@ -2464,7 +2464,7 @@ glabel var7f1ad8e4 /* f0ca304: 30c8ffff */ andi $t0,$a2,0xffff /* f0ca308: 0005ce03 */ sra $t9,$a1,0x18 /* f0ca30c: 03202825 */ or $a1,$t9,$zero -/* f0ca310: 0c00529e */ jal func00014a78 +/* f0ca310: 0c00529e */ jal contGetButtonsOnSample /* f0ca314: 01003025 */ or $a2,$t0,$zero /* f0ca318: 54400005 */ bnezl $v0,.L0f0ca330 /* f0ca31c: 8e490284 */ lw $t1,0x284($s2) @@ -2496,7 +2496,7 @@ glabel var7f1ad8e4 /* f0ca368: 00056e03 */ sra $t5,$a1,0x18 /* f0ca36c: 01a02825 */ or $a1,$t5,$zero /* f0ca370: 02002025 */ or $a0,$s0,$zero -/* f0ca374: 0c00529e */ jal func00014a78 +/* f0ca374: 0c00529e */ jal contGetButtonsOnSample /* f0ca378: 97a60046 */ lhu $a2,0x46($sp) /* f0ca37c: 50400040 */ beqzl $v0,.L0f0ca480 /* f0ca380: 8e450284 */ lw $a1,0x284($s2) @@ -2510,7 +2510,7 @@ glabel var7f1ad8e4 /* f0ca3a0: 1420002f */ bnez $at,.L0f0ca460 /* f0ca3a4: 01e02825 */ or $a1,$t7,$zero /* f0ca3a8: 02002025 */ or $a0,$s0,$zero -/* f0ca3ac: 0c0052d4 */ jal func00014b50 +/* f0ca3ac: 0c0052d4 */ jal contGetButtonsPressedOnSample /* f0ca3b0: 03003025 */ or $a2,$t8,$zero /* f0ca3b4: 5040000e */ beqzl $v0,.L0f0ca3f0 /* f0ca3b8: 8e450284 */ lw $a1,0x284($s2) @@ -2638,7 +2638,7 @@ glabel var7f1ad8e4 /* f0ca568: 322a0404 */ andi $t2,$s1,0x404 /* f0ca56c: afaa0050 */ sw $t2,0x50($sp) /* f0ca570: 03202825 */ or $a1,$t9,$zero -/* f0ca574: 0c0052d4 */ jal func00014b50 +/* f0ca574: 0c0052d4 */ jal contGetButtonsPressedOnSample /* f0ca578: 01003025 */ or $a2,$t0,$zero /* f0ca57c: 1040000b */ beqz $v0,.L0f0ca5ac /* f0ca580: 02002025 */ or $a0,$s0,$zero @@ -2658,7 +2658,7 @@ glabel var7f1ad8e4 /* f0ca5ac: 00152e00 */ sll $a1,$s5,0x18 /* f0ca5b0: 00056603 */ sra $t4,$a1,0x18 /* f0ca5b4: 01802825 */ or $a1,$t4,$zero -/* f0ca5b8: 0c0052d4 */ jal func00014b50 +/* f0ca5b8: 0c0052d4 */ jal contGetButtonsPressedOnSample /* f0ca5bc: 97a60052 */ lhu $a2,0x52($sp) /* f0ca5c0: 5040000c */ beqzl $v0,.L0f0ca5f4 /* f0ca5c4: 8e4e0288 */ lw $t6,0x288($s2) @@ -4006,7 +4006,7 @@ glabel var7f1ad8e4 // sp1a2 = arg2 ? contGetButtons(contpad1, 0xffff) : 0; // // // 8c8c -// sp1a0 = arg2 ? func00015020(contpad1, 0xffff) : 0; +// sp1a0 = arg2 ? contGetButtonsPressedThisFrame(contpad1, 0xffff) : 0; // // // 8cb0 // c1allowedbuttons = 0xffff; @@ -4095,7 +4095,7 @@ glabel var7f1ad8e4 // // s4 shifted to s8 and stored in a0 for next jal // 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) +// spe4 = contGetButtonsPressedThisFrame(contpad2, 0xffff); // sh v0,0xe4(sp) // c2stickx2 = c2stickx; // s3 = spe9 // c2sticky2 = c2sticky; // a0 = s0 // @@ -4174,7 +4174,7 @@ glabel var7f1ad8e4 // // 9170 // if (optionsGetAimControl(g_Vars.currentplayerstats->mpindex) == AIMCONTROL_HOLD) { // for (i = 0; i < numsamples; i++) { -// sp14c[i] = arg2 && func00014a78(i, aimpad, aimallowedbuttons & Z_TRIG); +// sp14c[i] = arg2 && contGetButtonsOnSample(i, aimpad, aimallowedbuttons & Z_TRIG); // spfc[i] = !sp14c[i]; // } // @@ -4186,7 +4186,7 @@ glabel var7f1ad8e4 // // 920c // if (optionsGetAimControl(g_Vars.currentplayerstats->mpindex) != AIMCONTROL_HOLD) { // for (i = 0; i < numsamples; i++) { -// if (arg2 && func00014b50(i, aimpad, aimallowedbuttons & Z_TRIG)) { +// if (arg2 && contGetButtonsPressedOnSample(i, aimpad, aimallowedbuttons & Z_TRIG)) { // g_Vars.currentplayer->insightaimmode = !g_Vars.currentplayer->insightaimmode; // } // @@ -4267,16 +4267,16 @@ glabel var7f1ad8e4 // } // } else { // for (i = 0; i < numsamples; i++) { -// if (func00014a78(i, contpad1, c1allowedbuttons & A_BUTTON) -// || func00014a78(i, contpad2, c2allowedbuttons & A_BUTTON)) { +// if (contGetButtonsOnSample(i, contpad1, c1allowedbuttons & A_BUTTON) +// || contGetButtonsOnSample(i, contpad2, c2allowedbuttons & A_BUTTON)) { // if (g_Vars.currentplayer->invdowntime > -2) { -// if (func00014b50(i, shootpad, shootallowedbuttons & Z_TRIG)) { +// if (contGetButtonsPressedOnSample(i, shootpad, shootallowedbuttons & Z_TRIG)) { // movedata.weaponbackoffset++; // g_Vars.currentplayer->invdowntime = -1; // } // // if (g_Vars.currentplayer->invdowntime > -1 -// && func00014a78(i, shootpad, shootallowedbuttons & Z_TRIG) == 0) { +// && contGetButtonsOnSample(i, shootpad, shootallowedbuttons & Z_TRIG) == 0) { // if (g_Vars.currentplayer->invdowntime > 15) { // activemenuOpen(); // g_Vars.currentplayer->invdowntime = -1; @@ -4287,7 +4287,7 @@ glabel var7f1ad8e4 // } // } else { // if (g_Vars.currentplayer->invdowntime > 0 && -// (!arg2 || func00014a78(i, shootpad, shootallowedbuttons & Z_TRIG) == 0)) { +// (!arg2 || contGetButtonsOnSample(i, shootpad, shootallowedbuttons & Z_TRIG) == 0)) { // movedata.weaponforwardoffset++; // } // @@ -4300,10 +4300,10 @@ glabel var7f1ad8e4 // // 9608 // if (arg2) { // for (i = 0; i < numsamples; i++) { -// if (func00014a78(i, contpad1, c1allowedbuttons & B_BUTTON) -// || func00014a78(i, contpad2, c2allowedbuttons & B_BUTTON)) { +// if (contGetButtonsOnSample(i, contpad1, c1allowedbuttons & B_BUTTON) +// || contGetButtonsOnSample(i, contpad2, c2allowedbuttons & B_BUTTON)) { // if (g_Vars.currentplayer->usedowntime >= -1) { -// if (func00014b50(i, shootpad, shootallowedbuttons & Z_TRIG) +// if (contGetButtonsPressedOnSample(i, shootpad, shootallowedbuttons & Z_TRIG) // && g_Vars.currentplayer->usedowntime > -1 // && currentPlayerConsiderToggleGunFunction(g_Vars.currentplayer->usedowntime, 1, 0)) { // g_Vars.currentplayer->usedowntime = -3; @@ -4368,7 +4368,7 @@ glabel var7f1ad8e4 // if (arg2) { // for (i = 0; i < numsamples; i++) { // if (sp1a8 == 0 && sp14c[i]) { -// if (func00014904(i, contpad2) > 30 && func000149c0(i, contpad2) <= 30) { +// if (contGetStickYOnSample(i, contpad2) > 30 && contGetStickYOnSampleIndex(i, contpad2) <= 30) { // if (movedata.crouchdown) { // movedata.crouchdown--; // } else { @@ -4378,7 +4378,7 @@ glabel var7f1ad8e4 // g_Vars.currentplayer->aimtaptime = -1; // } // -// if (func00014904(i, contpad2) < -30 && func000149c0(i, contpad2) >= -30) { +// if (contGetStickYOnSample(i, contpad2) < -30 && contGetStickYOnSampleIndex(i, contpad2) >= -30) { // if (movedata.crouchup) { // movedata.crouchup--; // } else { @@ -4461,7 +4461,7 @@ glabel var7f1ad8e4 // // if (weaponHasFlag(getCurrentPlayerWeaponId(0), WEAPONFLAG_80000000)) { // if (arg2 -// && func00015020(shootpad, shootallowedbuttons & Z_TRIG) +// && contGetButtonsPressedThisFrame(shootpad, shootallowedbuttons & Z_TRIG) // && g_Vars.currentplayer->pausemode == PAUSEMODE_UNPAUSED) { // movedata.btapcount++; // } @@ -4495,7 +4495,7 @@ glabel var7f1ad8e4 // // 9c60 // if (optionsGetAimControl(g_Vars.currentplayerstats->mpindex) == AIMCONTROL_HOLD) { // for (i = 0; i < numsamples; i++) { -// sp14c[i] = arg2 && func00014a78(i, contpad1, aimbuttons & c1allowedbuttons); +// sp14c[i] = arg2 && contGetButtonsOnSample(i, contpad1, aimbuttons & c1allowedbuttons); // spfc[i] = !sp14c[i]; // } // @@ -4507,7 +4507,7 @@ glabel var7f1ad8e4 // // 9d04 // if (optionsGetAimControl(g_Vars.currentplayerstats->mpindex) != AIMCONTROL_HOLD) { // for (i = 0; i < numsamples; i++) { -// if (arg2 && func00014b50(i, contpad1, aimbuttons & c1allowedbuttons)) { +// if (arg2 && contGetButtonsPressedOnSample(i, contpad1, aimbuttons & c1allowedbuttons)) { // g_Vars.currentplayer->insightaimmode = !g_Vars.currentplayer->insightaimmode; // } // @@ -4531,8 +4531,8 @@ glabel var7f1ad8e4 // // Side stepping // if (g_Vars.currentplayer->insightaimmode == false) { // if (arg2) { -// movedata.digitalstepleft = func00014c98(spfc, contpad1, c1allowedbuttons & (L_JPAD | L_CBUTTONS)); -// movedata.digitalstepright = func00014c98(spfc, contpad1, c1allowedbuttons & (R_JPAD | R_CBUTTONS)); +// movedata.digitalstepleft = contCountButtonsOnSpecificSamples(spfc, contpad1, c1allowedbuttons & (L_JPAD | L_CBUTTONS)); +// movedata.digitalstepright = contCountButtonsOnSpecificSamples(spfc, contpad1, c1allowedbuttons & (R_JPAD | R_CBUTTONS)); // } // } else { // // This doesn't appear to be r-leaning. @@ -4574,8 +4574,8 @@ glabel var7f1ad8e4 // } // // if (!g_Vars.currentplayer->insightaimmode && arg2) { -// movedata.digitalstepleft = func00014c98(spfc, contpad1, c1allowedbuttons & (L_JPAD | L_CBUTTONS)); -// movedata.digitalstepright = func00014c98(spfc, contpad1, c1allowedbuttons & (R_JPAD | R_CBUTTONS)); +// movedata.digitalstepleft = contCountButtonsOnSpecificSamples(spfc, contpad1, c1allowedbuttons & (L_JPAD | L_CBUTTONS)); +// movedata.digitalstepright = contCountButtonsOnSpecificSamples(spfc, contpad1, c1allowedbuttons & (R_JPAD | R_CBUTTONS)); // } // // movedata.digitalstepforward = false; @@ -4646,14 +4646,14 @@ glabel var7f1ad8e4 // } // } else { // for (i = 0; i < numsamples; i++) { -// if (func00014a78(i, contpad1, invbuttons & c1allowedbuttons)) { +// if (contGetButtonsOnSample(i, contpad1, invbuttons & c1allowedbuttons)) { // if (g_Vars.currentplayer->invdowntime > -2) { -// if (func00014b50(i, contpad1, shootbuttons & c1allowedbuttons)) { +// if (contGetButtonsPressedOnSample(i, contpad1, shootbuttons & c1allowedbuttons)) { // movedata.weaponbackoffset++; // g_Vars.currentplayer->invdowntime = -1; // } // -// if (g_Vars.currentplayer->invdowntime >= 0 && func00014a78(i, contpad1, shootbuttons & c1allowedbuttons) == 0) { +// if (g_Vars.currentplayer->invdowntime >= 0 && contGetButtonsOnSample(i, contpad1, shootbuttons & c1allowedbuttons) == 0) { // // Holding A and haven't pressed Z // if (g_Vars.currentplayer->invdowntime > 15) { // activemenuOpen(); @@ -4666,7 +4666,7 @@ glabel var7f1ad8e4 // } else { // // Wasn't holding A on this sample // if (g_Vars.currentplayer->invdowntime > 0 && -// (!arg2 || func00014a78(i, contpad1, shootbuttons & c1allowedbuttons) == 0)) { +// (!arg2 || contGetButtonsOnSample(i, contpad1, shootbuttons & c1allowedbuttons) == 0)) { // // But was on previous sample, so cycle weapon // movedata.weaponforwardoffset++; // } @@ -4681,9 +4681,9 @@ glabel var7f1ad8e4 // // a340 // if (arg2) { // for (i = 0; i < numsamples; i++) { -// if (func00014a78(i, contpad1, c1allowedbuttons & B_BUTTON)) { +// if (contGetButtonsOnSample(i, contpad1, c1allowedbuttons & B_BUTTON)) { // if (g_Vars.currentplayer->usedowntime >= -1) { -// if (func00014b50(i, contpad1, shootbuttons & c1allowedbuttons) +// if (contGetButtonsPressedOnSample(i, contpad1, shootbuttons & c1allowedbuttons) // && g_Vars.currentplayer->usedowntime >= 0 // && currentPlayerConsiderToggleGunFunction(g_Vars.currentplayer->usedowntime, 1, 0)) { // g_Vars.currentplayer->usedowntime = -3; @@ -4745,7 +4745,7 @@ glabel var7f1ad8e4 // if (arg2) { // for (i = 0; i < numsamples; i++) { // if (sp1a8 == 0 && sp14c[i]) { -// if (func00014b50(i, contpad1, c1allowedbuttons & (U_JPAD | U_CBUTTONS))) { +// if (contGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (U_JPAD | U_CBUTTONS))) { // if (movedata.crouchdown) { // movedata.crouchdown--; // } else { @@ -4755,7 +4755,7 @@ glabel var7f1ad8e4 // g_Vars.currentplayer->aimtaptime = -1; // } // -// if (func00014b50(i, contpad1, c1allowedbuttons & (D_JPAD | D_CBUTTONS))) { +// if (contGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & (D_JPAD | D_CBUTTONS))) { // if (movedata.crouchup) { // movedata.crouchup--; // } else { diff --git a/src/game/game_01b0a0.c b/src/game/game_01b0a0.c index 547619781..ebbf97133 100644 --- a/src/game/game_01b0a0.c +++ b/src/game/game_01b0a0.c @@ -202,25 +202,25 @@ glabel activemenuTick /* f01b33c: 24150001 */ addiu $s5,$zero,0x1 /* f01b340: 24140001 */ addiu $s4,$zero,0x1 /* f01b344: afa000b0 */ sw $zero,0xb0($sp) -/* f01b348: 0c005212 */ jal func00014848 +/* f01b348: 0c005212 */ jal contGetStickXOnSample /* f01b34c: afa000ac */ sw $zero,0xac($sp) /* f01b350: 0002b600 */ sll $s6,$v0,0x18 /* f01b354: 0016c603 */ sra $t8,$s6,0x18 /* f01b358: 0300b025 */ or $s6,$t8,$zero /* f01b35c: 03c02025 */ or $a0,$s8,$zero -/* f01b360: 0c005241 */ jal func00014904 +/* f01b360: 0c005241 */ jal contGetStickYOnSample /* f01b364: 83a500d3 */ lb $a1,0xd3($sp) /* f01b368: 0002be00 */ sll $s7,$v0,0x18 /* f01b36c: 0017ce03 */ sra $t9,$s7,0x18 /* f01b370: 0320b825 */ or $s7,$t9,$zero /* f01b374: 03c02025 */ or $a0,$s8,$zero /* f01b378: 83a500d3 */ lb $a1,0xd3($sp) -/* f01b37c: 0c00529e */ jal func00014a78 +/* f01b37c: 0c00529e */ jal contGetButtonsOnSample /* f01b380: 3406ffff */ dli $a2,0xffff /* f01b384: 3051ffff */ andi $s1,$v0,0xffff /* f01b388: 03c02025 */ or $a0,$s8,$zero /* f01b38c: 83a500d3 */ lb $a1,0xd3($sp) -/* f01b390: 0c0052d4 */ jal func00014b50 +/* f01b390: 0c0052d4 */ jal contGetButtonsPressedOnSample /* f01b394: 3406ffff */ dli $a2,0xffff /* f01b398: 3c08800a */ lui $t0,%hi(g_ActiveMenuIndex) /* f01b39c: 8d0821b8 */ lw $t0,%lo(g_ActiveMenuIndex)($t0) @@ -367,7 +367,7 @@ glabel activemenuTick /* f01b584: 00056603 */ sra $t4,$a1,0x18 /* f01b588: 01608025 */ or $s0,$t3,$zero /* f01b58c: 01802825 */ or $a1,$t4,$zero -/* f01b590: 0c005212 */ jal func00014848 +/* f01b590: 0c005212 */ jal contGetStickXOnSample /* f01b594: 03c02025 */ or $a0,$s8,$zero /* f01b598: 00029600 */ sll $s2,$v0,0x18 /* f01b59c: 00102e00 */ sll $a1,$s0,0x18 @@ -375,7 +375,7 @@ glabel activemenuTick /* f01b5a4: 00057603 */ sra $t6,$a1,0x18 /* f01b5a8: 01a09025 */ or $s2,$t5,$zero /* f01b5ac: 01c02825 */ or $a1,$t6,$zero -/* f01b5b0: 0c005241 */ jal func00014904 +/* f01b5b0: 0c005241 */ jal contGetStickYOnSample /* f01b5b4: 03c02025 */ or $a0,$s8,$zero /* f01b5b8: 00029e00 */ sll $s3,$v0,0x18 /* f01b5bc: 00102e00 */ sll $a1,$s0,0x18 @@ -384,14 +384,14 @@ glabel activemenuTick /* f01b5c8: 01e09825 */ or $s3,$t7,$zero /* f01b5cc: 03002825 */ or $a1,$t8,$zero /* f01b5d0: 03c02025 */ or $a0,$s8,$zero -/* f01b5d4: 0c00529e */ jal func00014a78 +/* f01b5d4: 0c00529e */ jal contGetButtonsOnSample /* f01b5d8: 3406ffff */ dli $a2,0xffff /* f01b5dc: 00102e00 */ sll $a1,$s0,0x18 /* f01b5e0: 0005ce03 */ sra $t9,$a1,0x18 /* f01b5e4: 3051ffff */ andi $s1,$v0,0xffff /* f01b5e8: 03202825 */ or $a1,$t9,$zero /* f01b5ec: 03c02025 */ or $a0,$s8,$zero -/* f01b5f0: 0c0052d4 */ jal func00014b50 +/* f01b5f0: 0c0052d4 */ jal contGetButtonsPressedOnSample /* f01b5f4: 3406ffff */ dli $a2,0xffff /* f01b5f8: 3c08800a */ lui $t0,%hi(g_Vars+0x284) /* f01b5fc: 8d08a244 */ lw $t0,%lo(g_Vars+0x284)($t0) diff --git a/src/game/game_01bea0.c b/src/game/game_01bea0.c index 09f11e517..5179b8c92 100644 --- a/src/game/game_01bea0.c +++ b/src/game/game_01bea0.c @@ -665,7 +665,7 @@ glabel var7f1a863c /* f01c6f8: 0271c821 */ addu $t9,$s3,$s1 .L0f01c6fc: /* f01c6fc: 01c02025 */ or $a0,$t6,$zero -/* f01c700: 0c005408 */ jal func00015020 +/* f01c700: 0c005408 */ jal contGetButtonsPressedThisFrame /* f01c704: 3405ffff */ dli $a1,0xffff /* f01c708: 8eb80004 */ lw $t8,0x4($s5) /* f01c70c: 2401000b */ addiu $at,$zero,0xb @@ -837,7 +837,7 @@ glabel var7f1a863c /* f01c95c: 3c04800b */ lui $a0,%hi(g_MpPlayers+0x45) /* f01c960: 008d2021 */ addu $a0,$a0,$t5 /* f01c964: 8084c7fd */ lb $a0,%lo(g_MpPlayers+0x45)($a0) -/* f01c968: 0c005408 */ jal func00015020 +/* f01c968: 0c005408 */ jal contGetButtonsPressedThisFrame /* f01c96c: 3405ffff */ dli $a1,0xffff /* f01c970: 304f4000 */ andi $t7,$v0,0x4000 /* f01c974: 51e0005c */ beqzl $t7,.L0f01cae8 @@ -2149,7 +2149,7 @@ glabel var7f1a863c // // c6dc // if (g_MenuData.root == MENUROOT_MPSETUP || g_MenuData.root == MENUROOT_4MBMAINMENU) { // s32 pass2; -// u16 buttons = func00015020(i, 0xffff); +// u16 buttons = contGetButtonsPressedThisFrame(i, 0xffff); // // // c714 // if (g_MenuData.root == MENUROOT_4MBMAINMENU) { @@ -2229,7 +2229,7 @@ glabel var7f1a863c // } // // if (g_MenuData.root == MENUROOT_MPENDSCREEN) { -// u16 buttons2 = func00015020(g_MpPlayers[i].base.unk45, 0xffff); +// u16 buttons2 = contGetButtonsPressedThisFrame(g_MpPlayers[i].base.unk45, 0xffff); // // if (buttons2 & B_BUTTON) { // s32 playernum = -1; diff --git a/src/game/game_0b63b0.c b/src/game/game_0b63b0.c index c57868324..624d83f91 100644 --- a/src/game/game_0b63b0.c +++ b/src/game/game_0b63b0.c @@ -4352,7 +4352,7 @@ glabel cameraDoAnimation /* f0ba110: 5720001c */ bnezl $t9,.L0f0ba184 /* f0ba114: 8fbf0014 */ lw $ra,0x14($sp) .L0f0ba118: -/* f0ba118: 0c004f75 */ jal func00013dd4 +/* f0ba118: 0c004f75 */ jal contDisableTemporarily /* f0ba11c: 00000000 */ nop /* f0ba120: 3c02800a */ lui $v0,%hi(g_Vars+0x2ac) /* f0ba124: 8c42a26c */ lw $v0,%lo(g_Vars+0x2ac)($v0) @@ -8879,7 +8879,7 @@ glabel var7f1ad6ac /* f0be570: 00122600 */ sll $a0,$s2,0x18 /* f0be574: 00046e03 */ sra $t5,$a0,0x18 /* f0be578: 01a02025 */ or $a0,$t5,$zero -/* f0be57c: 0c005408 */ jal func00015020 +/* f0be57c: 0c005408 */ jal contGetButtonsPressedThisFrame /* f0be580: 24052000 */ addiu $a1,$zero,0x2000 /* f0be584: 1040001e */ beqz $v0,.L0f0be600 /* f0be588: 240c0001 */ addiu $t4,$zero,0x1 @@ -8910,7 +8910,7 @@ glabel var7f1ad6ac /* f0be5e0: 00152600 */ sll $a0,$s5,0x18 /* f0be5e4: 00044e03 */ sra $t1,$a0,0x18 /* f0be5e8: 01202025 */ or $a0,$t1,$zero -/* f0be5ec: 0c005408 */ jal func00015020 +/* f0be5ec: 0c005408 */ jal contGetButtonsPressedThisFrame /* f0be5f0: 24052000 */ addiu $a1,$zero,0x2000 /* f0be5f4: 10400002 */ beqz $v0,.L0f0be600 /* f0be5f8: 240a0001 */ addiu $t2,$zero,0x1 @@ -8963,7 +8963,7 @@ glabel var7f1ad6ac .L0f0be6a4: /* f0be6a4: 00045e03 */ sra $t3,$a0,0x18 /* f0be6a8: 01602025 */ or $a0,$t3,$zero -/* f0be6ac: 0c005408 */ jal func00015020 +/* f0be6ac: 0c005408 */ jal contGetButtonsPressedThisFrame /* f0be6b0: 34058000 */ dli $a1,0x8000 /* f0be6b4: 10400003 */ beqz $v0,.L0f0be6c4 /* f0be6b8: 00122600 */ sll $a0,$s2,0x18 @@ -8981,7 +8981,7 @@ glabel var7f1ad6ac .L0f0be6e4: /* f0be6e4: 00122600 */ sll $a0,$s2,0x18 /* f0be6e8: 0004ce03 */ sra $t9,$a0,0x18 -/* f0be6ec: 0c005408 */ jal func00015020 +/* f0be6ec: 0c005408 */ jal contGetButtonsPressedThisFrame /* f0be6f0: 03202025 */ or $a0,$t9,$zero /* f0be6f4: 10400003 */ beqz $v0,.L0f0be704 /* f0be6f8: 00122600 */ sll $a0,$s2,0x18 @@ -10249,7 +10249,7 @@ glabel var7f1ad6ac /* f0bf980: 00102600 */ sll $a0,$s0,0x18 /* f0bf984: 00046603 */ sra $t4,$a0,0x18 /* f0bf988: 01802025 */ or $a0,$t4,$zero -/* f0bf98c: 0c005408 */ jal func00015020 +/* f0bf98c: 0c005408 */ jal contGetButtonsPressedThisFrame /* f0bf990: 3405f030 */ dli $a1,0xf030 /* f0bf994: 10400024 */ beqz $v0,.L0f0bfa28 /* f0bf998: 240e0002 */ addiu $t6,$zero,0x2 @@ -10720,7 +10720,7 @@ glabel var7f1ad6ac // } // // // e57c -// if (func00015020(contpad1, Z_TRIG)) { +// if (contGetButtonsPressedThisFrame(contpad1, Z_TRIG)) { // explode = true; // } // } else { @@ -10730,7 +10730,7 @@ glabel var7f1ad6ac // slow = true; // } // -// if (func00015020(contpad2, Z_TRIG)) { +// if (contGetButtonsPressedThisFrame(contpad2, Z_TRIG)) { // explode = true; // } // } @@ -10747,7 +10747,7 @@ glabel var7f1ad6ac // } else { // if (g_PlayersWithControl[g_Vars.currentplayernum]) { // if (mode == CONTROLMODE_13 || mode == CONTROLMODE_14) { -// if (func00015020(contpad1, A_BUTTON)) { +// if (contGetButtonsPressedThisFrame(contpad1, A_BUTTON)) { // explode = true; // } // @@ -10755,7 +10755,7 @@ glabel var7f1ad6ac // slow = true; // } // } else { -// if (func00015020(contpad1, Z_TRIG)) { +// if (contGetButtonsPressedThisFrame(contpad1, Z_TRIG)) { // explode = true; // } // @@ -11316,7 +11316,7 @@ glabel var7f1ad6ac // // if (soloIsPaused() == false // && param_1 -// && func00015020(contpad1, A_BUTTON | B_BUTTON | Z_TRIG | START_BUTTON | L_TRIG | R_TRIG)) { +// && contGetButtonsPressedThisFrame(contpad1, A_BUTTON | B_BUTTON | Z_TRIG | START_BUTTON | L_TRIG | R_TRIG)) { // var8007074c = 2; // // if (currentPlayerIsFadeComplete()) { diff --git a/src/game/game_0f09f0.c b/src/game/game_0f09f0.c index 0578c10bf..875311ce7 100644 --- a/src/game/game_0f09f0.c +++ b/src/game/game_0f09f0.c @@ -11010,7 +11010,7 @@ glabel var7f1b2ac8 /* f0fa960: 3405ffff */ dli $a1,0xffff /* f0fa964: 3052ffff */ andi $s2,$v0,0xffff /* f0fa968: 82640003 */ lb $a0,0x3($s3) -/* f0fa96c: 0c005408 */ jal func00015020 +/* f0fa96c: 0c005408 */ jal contGetButtonsPressedThisFrame /* f0fa970: 3405ffff */ dli $a1,0xffff /* f0fa974: 304e8000 */ andi $t6,$v0,0x8000 /* f0fa978: 8fa80124 */ lw $t0,0x124($sp) diff --git a/src/game/game_1371b0.c b/src/game/game_1371b0.c index deec628cf..3494789a1 100644 --- a/src/game/game_1371b0.c +++ b/src/game/game_1371b0.c @@ -1833,7 +1833,7 @@ glabel var7f1b5824 /* f138b24: 00000000 */ nop /* f138b28: 00002025 */ or $a0,$zero,$zero .L0f138b2c: -/* f138b2c: 0c005408 */ jal func00015020 +/* f138b2c: 0c005408 */ jal contGetButtonsPressedThisFrame /* f138b30: 24050010 */ addiu $a1,$zero,0x10 /* f138b34: 10400014 */ beqz $v0,.L0f138b88 /* f138b38: 00000000 */ nop @@ -4389,7 +4389,7 @@ glabel var7f1b5930 /* f13ae10: afbf001c */ sw $ra,0x1c($sp) /* f13ae14: afb00018 */ sw $s0,0x18($sp) /* f13ae18: 00002025 */ or $a0,$zero,$zero -/* f13ae1c: 0c005408 */ jal func00015020 +/* f13ae1c: 0c005408 */ jal contGetButtonsPressedThisFrame /* f13ae20: 24050020 */ addiu $a1,$zero,0x20 /* f13ae24: 10400003 */ beqz $v0,.L0f13ae34 /* f13ae28: 00000000 */ nop @@ -4826,7 +4826,7 @@ glabel var7f1b5948 /* f13b44c: 00002025 */ or $a0,$zero,$zero /* f13b450: 51800018 */ beqzl $t4,.L0f13b4b4 /* f13b454: 8fbf001c */ lw $ra,0x1c($sp) -/* f13b458: 0c005408 */ jal func00015020 +/* f13b458: 0c005408 */ jal contGetButtonsPressedThisFrame /* f13b45c: 3405ffcf */ dli $a1,0xffcf /* f13b460: 10400013 */ beqz $v0,.L0f13b4b0 /* f13b464: 240d0026 */ addiu $t5,$zero,0x26 diff --git a/src/game/game_141820.c b/src/game/game_141820.c index dae5ac068..76a01337b 100644 --- a/src/game/game_141820.c +++ b/src/game/game_141820.c @@ -3988,7 +3988,7 @@ glabel hudRenderEyespyUi /* f1451c4: 00047e03 */ sra $t7,$a0,0x18 /* f1451c8: 01e02025 */ or $a0,$t7,$zero /* f1451cc: 3051ffff */ andi $s1,$v0,0xffff -/* f1451d0: 0c005408 */ jal func00015020 +/* f1451d0: 0c005408 */ jal contGetButtonsPressedThisFrame /* f1451d4: 3405ffff */ dli $a1,0xffff /* f1451d8: 00102600 */ sll $a0,$s0,0x18 /* f1451dc: 0004ce03 */ sra $t9,$a0,0x18 diff --git a/src/game/game_167ae0.c b/src/game/game_167ae0.c index dee2b963a..2c734187f 100644 --- a/src/game/game_167ae0.c +++ b/src/game/game_167ae0.c @@ -4204,22 +4204,22 @@ void func0f16b96c(void) func0f0abc28(); func0f0df364(); - if ((func00015020(0, 0xffff) != 0 + if ((contGetButtonsPressedThisFrame(0, 0xffff) != 0 || contGetStickX(0) > 10 || contGetStickX(0) < -10 || contGetStickY(0) > 10 || contGetStickY(0) < -10 - || func00015020(1, 0xffff) != 0 + || contGetButtonsPressedThisFrame(1, 0xffff) != 0 || contGetStickX(1) > 10 || contGetStickX(1) < -10 || contGetStickY(1) > 10 || contGetStickY(1) < -10 - || func00015020(2, 0xffff) != 0 + || contGetButtonsPressedThisFrame(2, 0xffff) != 0 || contGetStickX(2) > 10 || contGetStickX(2) < -10 || contGetStickY(2) > 10 || contGetStickY(2) < -10 - || func00015020(3, 0xffff) != 0 + || contGetButtonsPressedThisFrame(3, 0xffff) != 0 || contGetStickX(3) > 10 || contGetStickX(3) < -10 || contGetStickY(3) > 10 diff --git a/src/game/pak/pak.c b/src/game/pak/pak.c index ac1f1dd66..29f906bf1 100644 --- a/src/game/pak/pak.c +++ b/src/game/pak/pak.c @@ -816,7 +816,7 @@ glabel func0f116bdc /* f116c30: afbf0014 */ sw $ra,0x14($sp) /* f116c34: afa40018 */ sw $a0,0x18($sp) /* f116c38: 00047600 */ sll $t6,$a0,0x18 -/* f116c3c: 0c004f13 */ jal func00013c4c +/* f116c3c: 0c004f13 */ jal contSetPfsTemporarilyPlugged /* f116c40: 000e2603 */ sra $a0,$t6,0x18 /* f116c44: 8fbf0014 */ lw $ra,0x14($sp) /* f116c48: 27bd0018 */ addiu $sp,$sp,0x18 @@ -3299,7 +3299,7 @@ glabel func0f1189d8 /* f118a64: 00102600 */ sll $a0,$s0,0x18 /* f118a68: 0fc478ff */ jal func0f11e3fc /* f118a6c: 00000000 */ sll $zero,$zero,0x0 -/* f118a70: 0c004e90 */ jal func00013a40 +/* f118a70: 0c004e90 */ jal contRecordPfsState /* f118a74: 24040010 */ addiu $a0,$zero,0x10 /* f118a78: 240b0010 */ addiu $t3,$zero,0x10 /* f118a7c: 3c01800a */ lui $at,%hi(g_Vars+0x4d0) @@ -8645,7 +8645,7 @@ glabel func0f11ca30 /* f11cac4: 02801825 */ or $v1,$s4,$zero /* f11cac8: 16f40005 */ bne $s7,$s4,.L0f11cae0 /* f11cacc: 02c09025 */ or $s2,$s6,$zero -/* f11cad0: 0c004e7a */ jal func000139e8 +/* f11cad0: 0c004e7a */ jal contShiftPfsStates /* f11cad4: 00000000 */ sll $zero,$zero,0x0 /* f11cad8: 305400ff */ andi $s4,$v0,0xff /* f11cadc: 02801825 */ or $v1,$s4,$zero diff --git a/src/game/title.c b/src/game/title.c index 089aaf1fa..ae2888c30 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -1338,7 +1338,7 @@ void titleTickPdLogo(void) titleSetNextMode(TITLEMODE_SKIP); } - if (func00015020(0, 0xffff)) { + if (contGetButtonsPressedThisFrame(0, 0xffff)) { var800624a8 = var800624ac = 1; if (g_TitleTimer < 549) { @@ -3310,7 +3310,7 @@ void titleTickRarePresents(void) if (g_TitleTimer > 300) { titleSetNextMode(TITLEMODE_PDLOGO); - } else if (func00015020(0, 0xffff)) { + } else if (contGetButtonsPressedThisFrame(0, 0xffff)) { titleSetNextMode(TITLEMODE_SKIP); } } @@ -3568,7 +3568,7 @@ void titleTickNintendoLogo(void) g_TitleTimer += g_Vars.lvupdate240_60; } - if (func00015020(0, 0xffff)) { + if (contGetButtonsPressedThisFrame(0, 0xffff)) { if (osResetType == RESET_TYPE_NMI) { var800624a8 = 1; titleSetNextMode(TITLEMODE_PDLOGO); @@ -3965,7 +3965,7 @@ void titleTickRareLogo(void) g_TitleTimer += g_Vars.lvupdate240_60; - if (func00015020(0, 0xffff)) { + if (contGetButtonsPressedThisFrame(0, 0xffff)) { if (osResetType == RESET_TYPE_NMI) { var800624a8 = 1; titleSetNextMode(TITLEMODE_PDLOGO); diff --git a/src/gvars/gvars.c b/src/gvars/gvars.c index aca6284e6..d3d0fe156 100644 --- a/src/gvars/gvars.c +++ b/src/gvars/gvars.c @@ -12162,8 +12162,8 @@ u32 var80099a3c = 0; OSMesgQueue var80099a40 = {0}; u32 var80099a58 = 0; u32 var80099a5c = 0; -struct contdata var80099a60[2] = {0}; -s32 var80099e68[4] = {0}; +struct contdata g_ContData[2] = {0}; +s32 g_ContDisableCooldown[4] = {0}; OSMesgQueue var80099e78 = {0}; OSMesg var80099e90 = NULL; u32 var80099e94 = 0; @@ -12188,31 +12188,7 @@ OSMesg var80099f18 = NULL; u32 var80099f1c = 0; OSMesgQueue var80099f20 = {0}; OSContStatus var80099f38[4] = {0}; -u8 var80099f48[4] = {0}; -u32 var80099f4c = 0; -u32 var80099f50 = 0; -u32 var80099f54 = 0; -u32 var80099f58 = 0; -u32 var80099f5c = 0; -u32 var80099f60 = 0; -u32 var80099f64 = 0; -u32 var80099f68 = 0; -u32 var80099f6c = 0; -u32 var80099f70 = 0; -u32 var80099f74 = 0; -u32 var80099f78 = 0; -u32 var80099f7c = 0; -u32 var80099f80 = 0; -u32 var80099f84 = 0; -u32 var80099f88 = 0; -u32 var80099f8c = 0; -u32 var80099f90 = 0; -u32 var80099f94 = 0; -u32 var80099f98 = 0; -u32 var80099f9c = 0; -u32 var80099fa0 = 0; -u32 var80099fa4 = 0; -u32 var80099fa8 = 0; +u8 g_ContPfsStates[100] = {0}; u32 var80099fac = 0; u32 var80099fb0 = 0; u32 var80099fb4 = 0; diff --git a/src/include/game/data/data_000000.h b/src/include/game/data/data_000000.h index b4b9f23a6..eaa7192e2 100644 --- a/src/include/game/data/data_000000.h +++ b/src/include/game/data/data_000000.h @@ -113,18 +113,18 @@ extern u32 var8005edf0; extern u32 var8005ee10; extern u32 var8005ee14; extern u32 var8005ee18; -extern struct contdata *var8005ee60; +extern struct contdata *g_ContDataPtr; extern bool g_ContBusy; extern u32 var8005ee68; -extern u32 var8005ee6c[4]; -extern u32 var8005ee7c[4]; -extern u32 var8005ee8c[4]; -extern u32 var8005ee9c[4]; +extern u32 g_ContBadReadsStickX[4]; +extern u32 g_ContBadReadsStickY[4]; +extern u32 g_ContBadReadsButtons[4]; +extern u32 g_ContBadReadsButtonsPressed[4]; extern u8 g_ConnectedControllers; extern bool g_ContInitDone; extern u32 g_ContNeedsInit; extern u32 var8005eebc; -extern s32 var8005eecc; +extern s32 g_ContNextPfsStateIndex; extern u32 var8005eedc; extern s32 var8005eee0; extern s32 var8005eee4; diff --git a/src/include/gvars/gvars.h b/src/include/gvars/gvars.h index 2abe0234b..b5b24c2b5 100644 --- a/src/include/gvars/gvars.h +++ b/src/include/gvars/gvars.h @@ -461,9 +461,9 @@ extern u32 var80099900; extern u32 var80099a00; extern OSMesg var80099a20; extern OSMesgQueue var80099a40; -extern struct contdata var80099a60[2]; +extern struct contdata g_ContData[2]; extern u32 var80099c64; -extern s32 var80099e68[4]; +extern s32 g_ContDisableCooldown[4]; extern OSMesgQueue var80099e78; extern OSMesg var80099e90; extern OSMesg var80099eb8; @@ -475,7 +475,7 @@ extern OSMesgQueue var80099f00; extern OSMesg var80099f18; extern OSMesgQueue var80099f20; extern OSContStatus var80099f38[4]; -extern u8 var80099f48[4]; +extern u8 g_ContPfsStates[100]; extern u32 var8009a874; extern u32 var8009a878; extern u32 var8009a87c; diff --git a/src/include/lib/lib_13900.h b/src/include/lib/lib_13900.h index 91786ce25..11b544803 100644 --- a/src/include/lib/lib_13900.h +++ b/src/include/lib/lib_13900.h @@ -9,16 +9,16 @@ void func00013974(u32 value); u32 func00013980(void); void func0001398c(s32 value); void func000139c8(void); -s32 func000139e8(void); -void func00013a40(u8 arg0); +s32 contShiftPfsStates(void); +void contRecordPfsState(u8 pfsstate); void contCheckPfs(s32 arg0); -void func00013c4c(s8 index); +void contSetPfsTemporarilyPlugged(s8 index); void contSystemInit(void); -void func00013dd4(void); +void contDisableTemporarily(void); void func00013dfc(void); void func00013e84(void); u32 contGetConnectedControllers(void); -void func00014058(struct contdata *contdata); +void contConsumeSamples(struct contdata *contdata); void func00014238(void); void contDebugJoy(void); s32 contStartReadData(OSMesgQueue *mq); @@ -26,16 +26,16 @@ void contReadData(void); void contPoll(void); void func00014810(bool value); s32 contGetNumSamples(void); -s32 func00014848(s32 samplenum, s8 contpadnum); -s32 func00014904(s32 samplenum, s8 contpadnum); -s32 func000149c0(s32 samplenum, s8 contpadnum); -u16 func00014a78(s32 samplenum, s8 contpadnum, u16 mask); -u16 func00014b50(s32 samplenum, s8 contpadnum, u16 mask); -s32 func00014c98(u32 *arg0, s8 contpadnum, u16 mask); +s32 contGetStickXOnSample(s32 samplenum, s8 contpadnum); +s32 contGetStickYOnSample(s32 samplenum, s8 contpadnum); +s32 contGetStickYOnSampleIndex(s32 samplenum, s8 contpadnum); +u16 contGetButtonsOnSample(s32 samplenum, s8 contpadnum, u16 mask); +u16 contGetButtonsPressedOnSample(s32 samplenum, s8 contpadnum, u16 mask); +s32 contCountButtonsOnSpecificSamples(u32 *arg0, s8 contpadnum, u16 mask); s8 contGetStickX(s8 contpadnum); s8 contGetStickY(s8 contpadnum); u16 contGetButtons(s8 contpadnum, u16 mask); -u16 func00015020(s8 contpadnum, u16 mask); +u16 contGetButtonsPressedThisFrame(s8 contpadnum, u16 mask); s32 func000150c4(void); void func000150e8(void); void func00015144(void); diff --git a/src/include/types.h b/src/include/types.h index fee874bc3..4f3b3df65 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -7092,12 +7092,12 @@ struct contsample { struct contdata { struct contsample samples[20]; - s32 unk1e0; - s32 unk1e4; - s32 unk1e8; - s32 unk1ec; - u16 unk1f0[4]; - u16 unk1f8[4]; + s32 curlast; + s32 curstart; + s32 nextlast; + s32 nextsecondlast; + u16 buttonspressed[4]; + u16 buttonsreleased[4]; s32 unk200; }; diff --git a/src/lib/lib_13900.c b/src/lib/lib_13900.c index 583989889..d2902ba4e 100644 --- a/src/lib/lib_13900.c +++ b/src/lib/lib_13900.c @@ -15,34 +15,62 @@ #include "lib/lib_4f5e0.h" #include "types.h" +/** + * PD uses use a separate thread (than the main game) for controller polling. + * This thread polls the controllers as frequently as possible and stores its + * results inside g_ContData->samples. This allows the main thread to access a + * history of controller states since the last rendered frame. For example, + * under laggy conditions the player might press and release a button between + * two frames and the main thread can tell that this has happened even if the + * button was unpressed during both the previous and current frame. + * + * The samples array contains 20 elements and is written to in a cyclic manner. + * These samples are split into two partitions: cur and next. cur refers to + * samples which are currently visible to the main thread on this frame, and + * samples in next are samples which have been added since the start of the + * current frame and will be made visible on the next frame. + * + * At the start of a frame, the main thread informs the cont system that it's + * ready to consume more samples. The cont system then moves the partition + * boundaries so that the old next partition becomes the new cur, and everything + * else becomes available for next. + * + * If all 20 samples are in use, the cont system will overwrite the most recent + * sample in the next partition. + */ + const char var70054080[] = "joyReset\n"; const char var7005408c[] = "joyReset: doing nothing\n"; -struct contdata *var8005ee60 = &var80099a60[0]; +struct contdata *g_ContDataPtr = &g_ContData[0]; bool g_ContBusy = false; -u32 var8005ee68 = 0x00000000; -u32 var8005ee6c[4] = {0}; -u32 var8005ee7c[4] = {0}; -u32 var8005ee8c[4] = {0}; -u32 var8005ee9c[4] = {0}; +u32 var8005ee68 = 0; + +// Number of times per pad that different inputs were attempted to be read +// when controller was disconnected or not ready. +u32 g_ContBadReadsStickX[4] = {0}; +u32 g_ContBadReadsStickY[4] = {0}; +u32 g_ContBadReadsButtons[4] = {0}; +u32 g_ContBadReadsButtonsPressed[4] = {0}; + u8 g_ConnectedControllers = 0; -u32 var8005eeb0 = 0x00000000; +bool g_ContQueuesCreated = false; bool g_ContInitDone = false; bool g_ContNeedsInit = true; -u32 var8005eebc = 0x00000000; -u32 var8005eec0 = 0x00000001; +u32 var8005eebc = 0; +u32 var8005eec0 = 1; s32 (*var8005eec4)(struct contsample *samples, s32 samplenum) = NULL; void (*var8005eec8)(struct contsample *samples, s32 samplenum, s32 samplenum2) = NULL; -s32 var8005eecc = 0; -u32 var8005eed0 = 0x00000000; -u32 var8005eed4 = 0x00000000; +s32 g_ContNextPfsStateIndex = 0; +u32 var8005eed0 = 0; +u32 var8005eed4 = 0; u8 var8005eed8 = 0; -u32 var8005eedc = 0x00000001; +u32 var8005eedc = 1; s32 var8005eee0 = 0; s32 var8005eee4 = -1; -u32 var8005eee8 = 0x00000000; -u32 var8005eeec = 0x00000000; -u32 var8005eef0 = 0x00000001; +u32 var8005eee8 = 0; +u32 var8005eeec = 0; +u32 var8005eef0 = 1; void func00013900(void) { @@ -81,38 +109,38 @@ void func000139c8(void) } /** - * Remove an item from the beginning of the var80099f48 array, + * Remove an item from the beginning of the g_ContPfsStates array, * shift the rest of the array back and return the removed item. */ -s32 func000139e8(void) +s32 contShiftPfsStates(void) { - s32 result = 0; + s32 pfsstate = 0; s32 i; - if (var8005eecc) { - result = var80099f48[0]; + if (g_ContNextPfsStateIndex) { + pfsstate = g_ContPfsStates[0]; - if (var8005eecc > 1) { - for (i = 0; i < var8005eecc; i++) { - var80099f48[i] = var80099f48[i + 1]; + if (g_ContNextPfsStateIndex > 1) { + for (i = 0; i < g_ContNextPfsStateIndex; i++) { + g_ContPfsStates[i] = g_ContPfsStates[i + 1]; } - var8005eecc--; + g_ContNextPfsStateIndex--; } } - return result; + return pfsstate; } -void func00013a40(u8 arg0) +void contRecordPfsState(u8 pfsstate) { - if (var8005eecc + 1 >= 100) { - func000139e8(); + if (g_ContNextPfsStateIndex + 1 >= 100) { + contShiftPfsStates(); } - if (var8005eecc == 0 || arg0 != var80099f48[var8005eecc - 1]) { - var80099f48[var8005eecc] = arg0; - var8005eecc++; + if (g_ContNextPfsStateIndex == 0 || pfsstate != g_ContPfsStates[g_ContNextPfsStateIndex - 1]) { + g_ContPfsStates[g_ContNextPfsStateIndex] = pfsstate; + g_ContNextPfsStateIndex++; } } @@ -162,7 +190,7 @@ void contCheckPfs(s32 arg0) bitpattern |= 0x10; - func00013a40(bitpattern); + contRecordPfsState(bitpattern); var8005eee4 = var8005eee0; } @@ -175,11 +203,18 @@ void contCheckPfs(s32 arg0) } } -void func00013c4c(s8 index) +/** + * "Temporarily" because the next time contCheckPfs runs, the true state will be + * recorded. + * + * Note that var8005eed8 is always zero, so this record will suggest that this + * pak is the only one connected. + */ +void contSetPfsTemporarilyPlugged(s8 index) { - u8 value = var8005eed8 & ~(1 << index); + u8 bitpattern = var8005eed8 & ~(1 << index); - func00013a40(value); + contRecordPfsState(bitpattern); } void contSystemInit(void) @@ -195,36 +230,45 @@ void contSystemInit(void) osSetEventMesg(OS_EVENT_SI, &var80099e78, NULL); - var8005eeb0 = 1; + g_ContQueuesCreated = true; + var8005eec4 = NULL; var8005eec8 = NULL; for (i = 0; i < 2; i++) { - var80099a60[i].unk1e0 = 0; - var80099a60[i].unk1e4 = 0; - var80099a60[i].unk1e8 = 0; - var80099a60[i].unk1ec = 0; - var80099a60[i].unk200 = -1; + g_ContData[i].curlast = 0; + g_ContData[i].curstart = 0; + g_ContData[i].nextlast = 0; + g_ContData[i].nextsecondlast = 0; + g_ContData[i].unk200 = -1; for (j = 0; j < 4; j++) { - var80099a60[i].samples[0].pads[j].button = 0; - var80099a60[i].samples[0].pads[j].stick_x = 0; - var80099a60[i].samples[0].pads[j].stick_y = 0; - var80099a60[i].samples[0].pads[j].errno = 0; + g_ContData[i].samples[0].pads[j].button = 0; + g_ContData[i].samples[0].pads[j].stick_x = 0; + g_ContData[i].samples[0].pads[j].stick_y = 0; + g_ContData[i].samples[0].pads[j].errno = 0; } } for (i = 0; i < 4; i++) { - var80099e68[i] = 0; + g_ContDisableCooldown[i] = 0; } } -void func00013dd4(void) +/** + * Disable all input on all controllers for 60 frames, or until the player has + * released all inputs. + * + * It's used to prevent the player from accidentally skipping cutscenes and + * progressing past endscreens if they are holding buttons when they are + * started. + */ +void contDisableTemporarily(void) { s32 i; for (i = 0; i < 4; i++) { - var80099e68[i] = 60; + g_ContDisableCooldown[i] = 60; } } @@ -232,7 +276,7 @@ void func00013dfc(void) { OSMesg msg; - if (var8005eeb0) { + if (g_ContQueuesCreated) { osSendMesg(&var80099ec0, &msg, OS_MESG_NOBLOCK); osRecvMesg(&var80099ee0, &msg, OS_MESG_BLOCK); @@ -296,8 +340,8 @@ s8 contGetFreeSlot(void) { s32 i; - if (var8005ee60->unk200 >= 0) { - return var8005ee60->unk200; + if (g_ContDataPtr->unk200 >= 0) { + return g_ContDataPtr->unk200; } for (i = 0; i < 4; i++) { @@ -315,7 +359,7 @@ u32 contGetConnectedControllers(void) } GLOBAL_ASM( -glabel func00014058 +glabel contConsumeSamples /* 14058: 27bdfff8 */ addiu $sp,$sp,-8 /* 1405c: afb00004 */ sw $s0,0x4($sp) /* 14060: 8c8e01e0 */ lw $t6,0x1e0($a0) @@ -331,8 +375,8 @@ glabel func00014058 /* 14084: a46001f8 */ sh $zero,0x1f8($v1) /* 14088: 8c9901e0 */ lw $t9,0x1e0($a0) /* 1408c: 8c8501e4 */ lw $a1,0x1e4($a0) -/* 14090: 3c18800a */ lui $t8,%hi(var80099e68) -/* 14094: 27189e68 */ addiu $t8,$t8,%lo(var80099e68) +/* 14090: 3c18800a */ lui $t8,%hi(g_ContDisableCooldown) +/* 14094: 27189e68 */ addiu $t8,$t8,%lo(g_ContDisableCooldown) /* 14098: 10b9005e */ beq $a1,$t9,.L00014214 /* 1409c: 24ae0001 */ addiu $t6,$a1,0x1 /* 140a0: 01d0001a */ div $zero,$t6,$s0 @@ -451,46 +495,46 @@ glabel func00014058 /* 14234: 27bd0008 */ addiu $sp,$sp,0x8 ); -// Mismatch because goal calculates &var80099e68 before the % 20 on the marked -// line, but the below does it after. -//void func00014058(struct contdata *contdata) +// Mismatch because goal calculates &g_ContDisableCooldown before the % 20 on +// the marked line, but the below does it after. +//void contConsumeSamples(struct contdata *contdata) //{ // s8 i; // s32 samplenum; // u16 buttons1; // u16 buttons2; // -// contdata->unk1e4 = contdata->unk1e0; -// contdata->unk1e0 = contdata->unk1e8; +// contdata->curstart = contdata->curlast; +// contdata->curlast = contdata->nextlast; // // for (i = 0; i < 4; i++) { -// contdata->unk1f0[i] = 0; -// contdata->unk1f8[i] = 0; +// contdata->buttonspressed[i] = 0; +// contdata->buttonsreleased[i] = 0; // -// if (contdata->unk1e0 != contdata->unk1e4) { +// if (contdata->curlast != contdata->curstart) { // // Mismatch here -// samplenum = (contdata->unk1e4 + 1) % 20; +// samplenum = (contdata->curstart + 1) % 20; // // while (true) { // buttons1 = contdata->samples[samplenum].pads[i].button; // buttons2 = contdata->samples[(samplenum + 19) % 20].pads[i].button; // -// contdata->unk1f0[i] |= buttons1 & ~buttons2; -// contdata->unk1f8[i] |= ~buttons1 & buttons2; +// contdata->buttonspressed[i] |= buttons1 & ~buttons2; +// contdata->buttonsreleased[i] |= ~buttons1 & buttons2; // -// if (var80099e68[i] > 0) { +// if (g_ContDisableCooldown[i] > 0) { // if (contdata->samples[samplenum].pads[i].button == 0 // && contdata->samples[samplenum].pads[i].stick_x < 15 // && contdata->samples[samplenum].pads[i].stick_x > -15 // && contdata->samples[samplenum].pads[i].stick_y < 15 // && contdata->samples[samplenum].pads[i].stick_y > -15) { -// var80099e68[i] = 0; +// g_ContDisableCooldown[i] = 0; // } else { -// var80099e68[i]--; +// g_ContDisableCooldown[i]--; // } // } // -// if (samplenum == contdata->unk1e0) { +// if (samplenum == contdata->curlast) { // break; // } // @@ -537,14 +581,14 @@ void contDebugJoy(void) } if (var8005eec4) { - var80099a60[1].unk1e8 = var8005eec4(var80099a60[1].samples, var80099a60[1].unk1e0); - func00014058(&var80099a60[1]); + g_ContData[1].nextlast = var8005eec4(g_ContData[1].samples, g_ContData[1].curlast); + contConsumeSamples(&g_ContData[1]); } - func00014058(&var80099a60[0]); + contConsumeSamples(&g_ContData[0]); if (var8005eec8) { - var8005eec8(var80099a60[0].samples, var80099a60[0].unk1e4, var80099a60[0].unk1e0); + var8005eec8(g_ContData[0].samples, g_ContData[0].curstart, g_ContData[0].curlast); } if (func000150c4() && var8005eec0 && contGetNumSamples() <= 0) { @@ -553,10 +597,10 @@ void contDebugJoy(void) #if VERSION >= VERSION_NTSC_FINAL func00014238(); func00015144(); - func00014058(&var80099a60[0]); + contConsumeSamples(&g_ContData[0]); #else func00015144(); - func00014058(&var80099a60[0]); + contConsumeSamples(&g_ContData[0]); func00014238(); #endif } @@ -578,18 +622,18 @@ s32 contStartReadData(OSMesgQueue *mq) void contReadData(void) { - s32 index = (var80099a60[0].unk1e8 + 1) % 20; + s32 index = (g_ContData[0].nextlast + 1) % 20; - if (index == var80099a60[0].unk1e4) { + if (index == g_ContData[0].curstart) { // If the sample queue is full, don't overwrite the oldest sample. // Instead, overwrite the most recent. - index = var80099a60[0].unk1e8; + index = g_ContData[0].nextlast; } - osContGetReadData(var80099a60[0].samples[index].pads); + osContGetReadData(g_ContData[0].samples[index].pads); - var80099a60[0].unk1e8 = index; - var80099a60[0].unk1ec = (var80099a60[0].unk1e8 + 19) % 20; + g_ContData[0].nextlast = index; + g_ContData[0].nextsecondlast = (g_ContData[0].nextlast + 19) % 20; } void contPoll(void) @@ -606,8 +650,8 @@ void contPoll(void) // Check if error state has changed for any controller for (i = 0; i < 4; i++) { - if ((var80099a60[0].samples[var80099a60[0].unk1e8].pads[i].errno == 0 && var80099a60[0].samples[var80099a60[0].unk1ec].pads[i].errno != 0) - || (var80099a60[0].samples[var80099a60[0].unk1e8].pads[i].errno != 0 && var80099a60[0].samples[var80099a60[0].unk1ec].pads[i].errno == 0)) { + if ((g_ContData[0].samples[g_ContData[0].nextlast].pads[i].errno == 0 && g_ContData[0].samples[g_ContData[0].nextsecondlast].pads[i].errno != 0) + || (g_ContData[0].samples[g_ContData[0].nextlast].pads[i].errno != 0 && g_ContData[0].samples[g_ContData[0].nextsecondlast].pads[i].errno == 0)) { func00013e84(); break; } @@ -648,8 +692,8 @@ void contPoll(void) // Check if error state has changed for any controller for (i = 0; i < 4; i++) { - if ((var80099a60[0].samples[var80099a60[0].unk1e8].pads[i].errno == 0 && var80099a60[0].samples[var80099a60[0].unk1ec].pads[i].errno != 0) - || (var80099a60[0].samples[var80099a60[0].unk1e8].pads[i].errno != 0 && var80099a60[0].samples[var80099a60[0].unk1ec].pads[i].errno == 0)) { + if ((g_ContData[0].samples[g_ContData[0].nextlast].pads[i].errno == 0 && g_ContData[0].samples[g_ContData[0].nextsecondlast].pads[i].errno != 0) + || (g_ContData[0].samples[g_ContData[0].nextlast].pads[i].errno != 0 && g_ContData[0].samples[g_ContData[0].nextsecondlast].pads[i].errno == 0)) { func00013e84(); break; } @@ -667,11 +711,11 @@ void contPoll(void) s32 i; for (i = 0; i < 4; i++) { - if (var8005ee6c[i] || var8005ee7c[i] || var8005ee8c[i] || var8005ee9c[i]) { - var8005ee6c[i] = 0; - var8005ee7c[i] = 0; - var8005ee8c[i] = 0; - var8005ee9c[i] = 0; + if (g_ContBadReadsStickX[i] || g_ContBadReadsStickY[i] || g_ContBadReadsButtons[i] || g_ContBadReadsButtonsPressed[i]) { + g_ContBadReadsStickX[i] = 0; + g_ContBadReadsStickY[i] = 0; + g_ContBadReadsButtons[i] = 0; + g_ContBadReadsButtonsPressed[i] = 0; } } @@ -688,117 +732,124 @@ void func00014810(bool value) s32 contGetNumSamples(void) { - return (var8005ee60->unk1e0 - var8005ee60->unk1e4 + 20) % 20; + return (g_ContDataPtr->curlast - g_ContDataPtr->curstart + 20) % 20; } -s32 func00014848(s32 samplenum, s8 contpadnum) +s32 contGetStickXOnSample(s32 samplenum, s8 contpadnum) { - if (var8005ee60->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { - var8005ee6c[contpadnum]++; + if (g_ContDataPtr->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { + g_ContBadReadsStickX[contpadnum]++; return 0; } - if (var80099e68[contpadnum] > 0) { + if (g_ContDisableCooldown[contpadnum] > 0) { return 0; } - return var8005ee60->samples[(var8005ee60->unk1e4 + samplenum + 1) % 20].pads[contpadnum].stick_x; + return g_ContDataPtr->samples[(g_ContDataPtr->curstart + samplenum + 1) % 20].pads[contpadnum].stick_x; } -s32 func00014904(s32 samplenum, s8 contpadnum) +s32 contGetStickYOnSample(s32 samplenum, s8 contpadnum) { - if (var8005ee60->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { - var8005ee7c[contpadnum]++; + if (g_ContDataPtr->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { + g_ContBadReadsStickY[contpadnum]++; return 0; } - if (var80099e68[contpadnum] > 0) { + if (g_ContDisableCooldown[contpadnum] > 0) { return 0; } - return var8005ee60->samples[(var8005ee60->unk1e4 + samplenum + 1) % 20].pads[contpadnum].stick_y; + return g_ContDataPtr->samples[(g_ContDataPtr->curstart + samplenum + 1) % 20].pads[contpadnum].stick_y; } -s32 func000149c0(s32 samplenum, s8 contpadnum) +s32 contGetStickYOnSampleIndex(s32 samplenum, s8 contpadnum) { - if (var8005ee60->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { - var8005ee7c[contpadnum]++; + if (g_ContDataPtr->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { + g_ContBadReadsStickY[contpadnum]++; return 0; } - if (var80099e68[contpadnum] > 0) { + if (g_ContDisableCooldown[contpadnum] > 0) { return 0; } - return var8005ee60->samples[(var8005ee60->unk1e4 + samplenum) % 20].pads[contpadnum].stick_y; + return g_ContDataPtr->samples[(g_ContDataPtr->curstart + samplenum) % 20].pads[contpadnum].stick_y; } -u16 func00014a78(s32 samplenum, s8 contpadnum, u16 mask) +u16 contGetButtonsOnSample(s32 samplenum, s8 contpadnum, u16 mask) { u16 button; - if (var8005ee60->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { - var8005ee8c[contpadnum]++; + if (g_ContDataPtr->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { + g_ContBadReadsButtons[contpadnum]++; return 0; } - if (var80099e68[contpadnum] > 0) { + if (g_ContDisableCooldown[contpadnum] > 0) { return 0; } - button = var8005ee60->samples[(var8005ee60->unk1e4 + samplenum + 1) % 20].pads[contpadnum].button; + button = g_ContDataPtr->samples[(g_ContDataPtr->curstart + samplenum + 1) % 20].pads[contpadnum].button; return button & mask; } -u16 func00014b50(s32 samplenum, s8 contpadnum, u16 mask) +u16 contGetButtonsPressedOnSample(s32 samplenum, s8 contpadnum, u16 mask) { u16 button1; u16 button2; - if (var8005ee60->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { - var8005ee9c[contpadnum]++; + if (g_ContDataPtr->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { + g_ContBadReadsButtonsPressed[contpadnum]++; return 0; } - if (var80099e68[contpadnum] > 0) { + if (g_ContDisableCooldown[contpadnum] > 0) { return 0; } - button1 = var8005ee60->samples[(var8005ee60->unk1e4 + samplenum + 1) % 20].pads[contpadnum].button; - button2 = var8005ee60->samples[(var8005ee60->unk1e4 + samplenum) % 20].pads[contpadnum].button; + button1 = g_ContDataPtr->samples[(g_ContDataPtr->curstart + samplenum + 1) % 20].pads[contpadnum].button; + button2 = g_ContDataPtr->samples[(g_ContDataPtr->curstart + samplenum) % 20].pads[contpadnum].button; return (button1 & ~button2) & mask; } -s32 func00014c98(u32 *arg0, s8 contpadnum, u16 mask) +/** + * Count the number of times the buttons specified by mask were held during the + * specific samples given in checksamples. + * + * For example, if checksamples[5] is nonzero and a button was pressed on + * samplenum 5 which matches the mask, count is incremented. + */ +s32 contCountButtonsOnSpecificSamples(u32 *checksamples, s8 contpadnum, u16 mask) { s32 count = 0; s32 index = 0; s32 i; u16 button; - if (var8005ee60->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { - var8005ee8c[contpadnum]++; + if (g_ContDataPtr->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { + g_ContBadReadsButtons[contpadnum]++; return 0; } - if (var80099e68[contpadnum] > 0) { + if (g_ContDisableCooldown[contpadnum] > 0) { return 0; } - i = (var8005ee60->unk1e4 + 1) % 20; + i = (g_ContDataPtr->curstart + 1) % 20; while (true) { - if (arg0 == NULL || arg0[index]) { - button = var8005ee60->samples[i].pads[contpadnum].button; + if (checksamples == NULL || checksamples[index]) { + button = g_ContDataPtr->samples[i].pads[contpadnum].button; if (button & mask) { count++; } } - if (i == var8005ee60->unk1e0) { + if (i == g_ContDataPtr->curlast) { break; } @@ -811,58 +862,58 @@ s32 func00014c98(u32 *arg0, s8 contpadnum, u16 mask) s8 contGetStickX(s8 contpadnum) { - if (var8005ee60->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { - var8005ee6c[contpadnum]++; + if (g_ContDataPtr->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { + g_ContBadReadsStickX[contpadnum]++; return 0; } - if (var80099e68[contpadnum] > 0) { + if (g_ContDisableCooldown[contpadnum] > 0) { return 0; } - return var8005ee60->samples[var8005ee60->unk1e0].pads[contpadnum].stick_x; + return g_ContDataPtr->samples[g_ContDataPtr->curlast].pads[contpadnum].stick_x; } s8 contGetStickY(s8 contpadnum) { - if (var8005ee60->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { - var8005ee7c[contpadnum]++; + if (g_ContDataPtr->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { + g_ContBadReadsStickY[contpadnum]++; return 0; } - if (var80099e68[contpadnum] > 0) { + if (g_ContDisableCooldown[contpadnum] > 0) { return 0; } - return var8005ee60->samples[var8005ee60->unk1e0].pads[contpadnum].stick_y; + return g_ContDataPtr->samples[g_ContDataPtr->curlast].pads[contpadnum].stick_y; } u16 contGetButtons(s8 contpadnum, u16 mask) { - if (var8005ee60->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { - var8005ee8c[contpadnum]++; + if (g_ContDataPtr->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { + g_ContBadReadsButtons[contpadnum]++; return 0; } - if (var80099e68[contpadnum] > 0) { + if (g_ContDisableCooldown[contpadnum] > 0) { return 0; } - return var8005ee60->samples[var8005ee60->unk1e0].pads[contpadnum].button & mask; + return g_ContDataPtr->samples[g_ContDataPtr->curlast].pads[contpadnum].button & mask; } -u16 func00015020(s8 contpadnum, u16 mask) +u16 contGetButtonsPressedThisFrame(s8 contpadnum, u16 mask) { - if (var8005ee60->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { - var8005ee9c[contpadnum]++; + if (g_ContDataPtr->unk200 < 0 && (g_ConnectedControllers >> contpadnum & 1) == 0) { + g_ContBadReadsButtonsPressed[contpadnum]++; return 0; } - if (var80099e68[contpadnum] > 0) { + if (g_ContDisableCooldown[contpadnum] > 0) { return 0; } - return var8005ee60->unk1f0[contpadnum] & mask; + return g_ContDataPtr->buttonspressed[contpadnum] & mask; } s32 func000150c4(void) diff --git a/src/lib/main.c b/src/lib/main.c index 0b159d578..d6d56db94 100644 --- a/src/lib/main.c +++ b/src/lib/main.c @@ -1149,7 +1149,7 @@ void mainEndStage(void) if (var8005d9d0 == 0) { func0f11c6d0(); - func00013dd4(); + contDisableTemporarily(); if (g_Vars.coopplayernum >= 0) { s32 prevplayernum = g_Vars.currentplayernum;