From 76e5d003abdee68b012cccfe15af542dc4d906d7 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 19 Jan 2020 10:39:23 +1000 Subject: [PATCH] Decompile mpIsPlayerLockedOut --- src/game/game_0dcdb0.c | 4 ++-- src/game/game_0f09f0.c | 6 +++--- src/game/game_187770.c | 32 ++++++++++++-------------------- src/include/game/game_187770.h | 2 +- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/game/game_0dcdb0.c b/src/game/game_0dcdb0.c index 0036f88be..13d9a80b7 100644 --- a/src/game/game_0dcdb0.c +++ b/src/game/game_0dcdb0.c @@ -16664,7 +16664,7 @@ glabel func0f0e8138 /* f0e818c: 0fc39d68 */ jal func0f0e75a0 /* f0e8190: 8fa70048 */ lw $a3,0x48($sp) /* f0e8194: 3c048007 */ lui $a0,0x8007 -/* f0e8198: 0fc62ff6 */ jal func0f18bfd8 +/* f0e8198: 0fc62ff6 */ jal mpIsPlayerLockedOut /* f0e819c: 8c841448 */ lw $a0,0x1448($a0) /* f0e81a0: 5040000c */ beqzl $v0,.L0f0e81d4 /* f0e81a4: 8faf0040 */ lw $t7,0x40($sp) @@ -21334,7 +21334,7 @@ glabel func0f0ec4e4 /* f0ec534: 3c048007 */ lui $a0,0x8007 /* f0ec538: 51000034 */ beqzl $t0,.L0f0ec60c /* f0ec53c: 8e620010 */ lw $v0,0x10($s3) -/* f0ec540: 0fc62ff6 */ jal func0f18bfd8 +/* f0ec540: 0fc62ff6 */ jal mpIsPlayerLockedOut /* f0ec544: 8c841448 */ lw $a0,0x1448($a0) /* f0ec548: 10400005 */ beqz $v0,.L0f0ec560 /* f0ec54c: 27b40048 */ addiu $s4,$sp,0x48 diff --git a/src/game/game_0f09f0.c b/src/game/game_0f09f0.c index aa976197c..c1ff1b544 100644 --- a/src/game/game_0f09f0.c +++ b/src/game/game_0f09f0.c @@ -2523,7 +2523,7 @@ glabel func0f0f2588 /* f0f25b0: 1000002b */ beqz $zero,.L0f0f2660 /* f0f25b4: 24020001 */ addiu $v0,$zero,0x1 .L0f0f25b8: -/* f0f25b8: 0fc62ff6 */ jal func0f18bfd8 +/* f0f25b8: 0fc62ff6 */ jal mpIsPlayerLockedOut /* f0f25bc: 8c841448 */ lw $a0,0x1448($a0) /* f0f25c0: 10400007 */ beqz $v0,.L0f0f25e0 /* f0f25c4: 00000000 */ sll $zero,$zero,0x0 @@ -10294,7 +10294,7 @@ glabel func0f0f935c /* f0f958c: 57ca0034 */ bnel $s8,$t2,.L0f0f9660 /* f0f9590: 93c9003c */ lbu $t1,0x3c($s8) /* f0f9594: 92700000 */ lbu $s0,0x0($s3) -/* f0f9598: 0fc62ff6 */ jal func0f18bfd8 +/* f0f9598: 0fc62ff6 */ jal mpIsPlayerLockedOut /* f0f959c: afb10124 */ sw $s1,0x124($sp) /* f0f95a0: 44807000 */ mtc1 $zero,$f14 /* f0f95a4: 10400007 */ beqz $v0,.L0f0f95c4 @@ -10973,7 +10973,7 @@ glabel func0f0f935c /* f0f9f30: 00009825 */ or $s3,$zero,$zero /* f0f9f34: 8fb10124 */ lw $s1,0x124($sp) /* f0f9f38: 8c841448 */ lw $a0,0x1448($a0) -/* f0f9f3c: 0fc62ff6 */ jal func0f18bfd8 +/* f0f9f3c: 0fc62ff6 */ jal mpIsPlayerLockedOut /* f0f9f40: 016d9021 */ addu $s2,$t3,$t5 /* f0f9f44: 50400008 */ beqzl $v0,.L0f0f9f68 /* f0f9f48: 8e580004 */ lw $t8,0x4($s2) diff --git a/src/game/game_187770.c b/src/game/game_187770.c index 22db2b193..b6f369737 100644 --- a/src/game/game_187770.c +++ b/src/game/game_187770.c @@ -5473,26 +5473,18 @@ u32 mpGetLockPlayerNum(void) return g_MpLockPlayerNum; } -GLOBAL_ASM( -glabel func0f18bfd8 -/* f18bfd8: 3c0e800b */ lui $t6,0x800b -/* f18bfdc: 91cecc10 */ lbu $t6,-0x33f0($t6) -/* f18bfe0: 3c0f800b */ lui $t7,0x800b -/* f18bfe4: 15c00003 */ bnez $t6,.L0f18bff4 -/* f18bfe8: 00000000 */ sll $zero,$zero,0x0 -/* f18bfec: 03e00008 */ jr $ra -/* f18bff0: 00001025 */ or $v0,$zero,$zero -.L0f18bff4: -/* f18bff4: 81efcc20 */ lb $t7,-0x33e0($t7) -/* f18bff8: 24020001 */ addiu $v0,$zero,0x1 -/* f18bffc: 148f0003 */ bne $a0,$t7,.L0f18c00c -/* f18c000: 00000000 */ sll $zero,$zero,0x0 -/* f18c004: 03e00008 */ jr $ra -/* f18c008: 00001025 */ or $v0,$zero,$zero -.L0f18c00c: -/* f18c00c: 03e00008 */ jr $ra -/* f18c010: 00000000 */ sll $zero,$zero,0x0 -); +bool mpIsPlayerLockedOut(u32 playernum) +{ + if (g_MpSetup.locktype == MPLOCKTYPE_NONE) { + return false; + } + + if (g_MpLockPlayerNum == playernum) { + return false; + } + + return true; +} GLOBAL_ASM( glabel func0f18c014 diff --git a/src/include/game/game_187770.h b/src/include/game/game_187770.h index 318345a88..d9bbad2f1 100644 --- a/src/include/game/game_187770.h +++ b/src/include/game/game_187770.h @@ -60,7 +60,7 @@ u32 func0f18bee8(void); s32 mpSetLock(s32 arg0, s32 arg1); u32 mpGetLockType(void); u32 mpGetLockPlayerNum(void); -u32 func0f18bfd8(void); +bool mpIsPlayerLockedOut(u32 playernum); u32 func0f18c014(void); bool mpIsTrackUnlocked(s32 tracknum); s32 mpGetTrackSlotIndex(s32 tracknum);