From f256a7fcdf84162c1add0d56d15ea287ec03c908 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 20 Oct 2019 13:10:14 +1000 Subject: [PATCH] Decompile aiAudioPlayMusic --- src/game/chr/chraicommands.c | 53 +++++++++------------------- src/include/game/chr/chraicommands.h | 2 +- src/setup/setup_000000.c | 2 +- 3 files changed, 18 insertions(+), 39 deletions(-) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 6e23b61cf..96461c3d6 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -10322,43 +10322,22 @@ bool aiAudioStopChannel(void) /** * @cmd 015b */ -GLOBAL_ASM( -glabel ai015b -/* f058544: 3c02800a */ lui $v0,0x800a -/* f058548: 24429fc0 */ addiu $v0,$v0,-24640 -/* f05854c: 8c4e0434 */ lw $t6,0x434($v0) -/* f058550: 8c4f0438 */ lw $t7,0x438($v0) -/* f058554: 27bdffe0 */ addiu $sp,$sp,-32 -/* f058558: afbf0014 */ sw $ra,0x14($sp) -/* f05855c: 01cf1821 */ addu $v1,$t6,$t7 -/* f058560: 90640002 */ lbu $a0,0x2($v1) -/* f058564: 24010065 */ addiu $at,$zero,0x65 -/* f058568: 1481000b */ bne $a0,$at,.L0f058598 -/* f05856c: 00000000 */ sll $zero,$zero,0x0 -/* f058570: 0fc54bd4 */ jal func0f152f50 -/* f058574: afa3001c */ sw $v1,0x1c($sp) -/* f058578: 8fa3001c */ lw $v1,0x1c($sp) -/* f05857c: a7a2001a */ sh $v0,0x1a($sp) -/* f058580: 0fc5b783 */ jal func0f16de0c -/* f058584: 90640002 */ lbu $a0,0x2($v1) -/* f058588: 0fc54bdc */ jal func0f152f70 -/* f05858c: 97a4001a */ lhu $a0,0x1a($sp) -/* f058590: 10000003 */ beqz $zero,.L0f0585a0 -/* f058594: 00000000 */ sll $zero,$zero,0x0 -.L0f058598: -/* f058598: 0fc5b783 */ jal func0f16de0c -/* f05859c: 00000000 */ sll $zero,$zero,0x0 -.L0f0585a0: -/* f0585a0: 3c18800a */ lui $t8,0x800a -/* f0585a4: 8f18a3f8 */ lw $t8,-0x5c08($t8) -/* f0585a8: 8fbf0014 */ lw $ra,0x14($sp) -/* f0585ac: 3c01800a */ lui $at,0x800a -/* f0585b0: 27190003 */ addiu $t9,$t8,0x3 -/* f0585b4: ac39a3f8 */ sw $t9,-0x5c08($at) -/* f0585b8: 27bd0020 */ addiu $sp,$sp,0x20 -/* f0585bc: 03e00008 */ jr $ra -/* f0585c0: 00001025 */ or $v0,$zero,$zero -); +bool aiAudioPlayMusic(void) +{ + u8 *cmd = g_Vars.ailist + g_Vars.aioffset; + + if (cmd[2] == MUSIC_CI_TRAINING) { + u16 something = func0f152f50(); + func0f16de0c(cmd[2]); + func0f152f70(something); + } else { + func0f16de0c(cmd[2]); + } + + g_Vars.aioffset += 3; + + return false; +} /** * @cmd 015c diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index b63e44016..77f6e2736 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -332,7 +332,7 @@ /*0x014b*/ bool ai014b(void); /*0x0152*/ bool ai0152(void); /*0x0157*/ bool ai0157(void); -/*0x015b*/ bool ai015b(void); +/*0x015b*/ bool aiAudioPlayMusic(void); /*0x015c*/ bool ai015c(void); /*0x0165*/ bool ai0165(void); /*0x0166*/ bool ai0166(void); diff --git a/src/setup/setup_000000.c b/src/setup/setup_000000.c index 67bb35bfc..f74887022 100644 --- a/src/setup/setup_000000.c +++ b/src/setup/setup_000000.c @@ -14300,7 +14300,7 @@ bool (*command_pointers[])(void) = { /*0x0158*/ NULL, /*0x0159*/ NULL, /*0x015a*/ NULL, - /*0x015b*/ ai015b, + /*0x015b*/ aiAudioPlayMusic, /*0x015c*/ ai015c, /*0x015d*/ NULL, /*0x015e*/ NULL,