From df3209abfb483b3b5de2b531201f38015b35f76d Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 9 Jan 2021 00:29:18 +1000 Subject: [PATCH] Decompile channelGetUnk06 --- src/game/chr/chraicommands.c | 2 +- src/game/game_092610.c | 22 ++++------------------ src/include/commands.h | 4 ++-- src/include/game/game_092610.h | 2 +- src/include/types.h | 3 ++- 5 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 534c7bc22..d891243b9 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -4819,7 +4819,7 @@ bool ai00d4(void) u8 *cmd = g_Vars.ailist + g_Vars.aioffset; s16 thing = cmd[4] | (cmd[3] << 8); - if (func0f092914((s8)cmd[2]) < thing) { + if (channelGetUnk06((s8)cmd[2]) < thing) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[5]); } else { g_Vars.aioffset += 6; diff --git a/src/game/game_092610.c b/src/game/game_092610.c index 5ceb9a427..9e384258a 100644 --- a/src/game/game_092610.c +++ b/src/game/game_092610.c @@ -188,24 +188,10 @@ glabel func0f0927d4 /* f092910: 00601025 */ or $v0,$v1,$zero ); -GLOBAL_ASM( -glabel func0f092914 -/* f092914: 0480000a */ bltz $a0,.L0f092940 -/* f092918: 28810008 */ slti $at,$a0,0x8 -/* f09291c: 10200008 */ beqz $at,.L0f092940 -/* f092920: 3c0e8007 */ lui $t6,%hi(g_AudioChannels) -/* f092924: 8dceae10 */ lw $t6,%lo(g_AudioChannels)($t6) -/* f092928: 00047900 */ sll $t7,$a0,0x4 -/* f09292c: 01e47823 */ subu $t7,$t7,$a0 -/* f092930: 000f78c0 */ sll $t7,$t7,0x3 -/* f092934: 01cfc021 */ addu $t8,$t6,$t7 -/* f092938: 03e00008 */ jr $ra -/* f09293c: 87020006 */ lh $v0,0x6($t8) -.L0f092940: -/* f092940: 00001825 */ or $v1,$zero,$zero -/* f092944: 03e00008 */ jr $ra -/* f092948: 00601025 */ or $v0,$v1,$zero -); +s32 channelGetUnk06(s32 channelnum) +{ + return (channelnum >= 0 && channelnum <= 7) ? g_AudioChannels[channelnum].unk06 : 0; +} GLOBAL_ASM( glabel func0f09294c diff --git a/src/include/commands.h b/src/include/commands.h index 124c0868f..6e7d87b9c 100644 --- a/src/include/commands.h +++ b/src/include/commands.h @@ -1942,9 +1942,9 @@ mkshort(0x00d3), \ channel, -#define cmd00d4(u1, u2, label) \ +#define cmd00d4(channel, u2, label) \ mkshort(0x00d4), \ - u1, \ + channel, \ mkshort(u2), \ label, diff --git a/src/include/game/game_092610.h b/src/include/game/game_092610.h index a543d6273..2c619ef78 100644 --- a/src/include/game/game_092610.h +++ b/src/include/game/game_092610.h @@ -6,7 +6,7 @@ bool func0f092610(struct prop *prop, s32 arg1); void func0f0926bc(struct prop *prop, s32 arg1, u16 arg2); s32 func0f0927d4(f32 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4); -s32 func0f092914(s32 arg0); +s32 channelGetUnk06(s32 channelnum); u32 func0f09294c(void); void func0f092a98(s32 channelnum); u32 func0f092b50(void); diff --git a/src/include/types.h b/src/include/types.h index c9383a6ef..61a45eb20 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -6678,7 +6678,8 @@ struct var800a45c4 { struct audiochannel { /*0x00*/ struct audiohandle *audiohandle; - /*0x04*/ u32 unk04; + /*0x04*/ u16 unk04; + /*0x06*/ s16 unk06; /*0x08*/ u32 unk08; /*0x0c*/ u32 unk0c; /*0x10*/ u32 unk10;