From de02c1057746d9df9ea6f90ff1dafb718f92754b Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 31 Dec 2019 09:48:32 +1000 Subject: [PATCH] Decompile optionsGetMusicVolume and optionsSetMusicVolume --- src/game/chr/chraicommands.c | 4 ++-- src/game/game_102240.c | 4 ++-- src/game/game_10ccd0.c | 6 +++--- src/game/game_152710.c | 34 ++++++++-------------------------- src/include/game/game_152710.h | 4 ++-- src/include/game/game_16cfa0.h | 2 +- 6 files changed, 18 insertions(+), 36 deletions(-) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 2a71333dd..c27bb69f1 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -7920,9 +7920,9 @@ bool aiAudioPlayMusic(void) u8 *cmd = g_Vars.ailist + g_Vars.aioffset; if (cmd[2] == MUSIC_CI_TRAINING) { - u16 something = func0f152f50(); + u16 volume = optionsGetMusicVolume(); audioPlayTrack(cmd[2]); - func0f152f70(something); + optionsSetMusicVolume(volume); } else { audioPlayTrack(cmd[2]); } diff --git a/src/game/game_102240.c b/src/game/game_102240.c index 35fa24316..f98071efb 100644 --- a/src/game/game_102240.c +++ b/src/game/game_102240.c @@ -1146,13 +1146,13 @@ glabel menuhandlerMusicVolume /* f1032a4: 24010009 */ addiu $at,$zero,0x9 /* f1032a8: 5481000e */ bnel $a0,$at,.L0f1032e4 /* f1032ac: 8fbf0014 */ lw $ra,0x14($sp) -/* f1032b0: 0fc54bd4 */ jal func0f152f50 +/* f1032b0: 0fc54bd4 */ jal optionsGetMusicVolume /* f1032b4: afa60020 */ sw $a2,0x20($sp) /* f1032b8: 8fa60020 */ lw $a2,0x20($sp) /* f1032bc: 10000008 */ beqz $zero,.L0f1032e0 /* f1032c0: acc20000 */ sw $v0,0x0($a2) .L0f1032c4: -/* f1032c4: 0fc54bdc */ jal func0f152f70 +/* f1032c4: 0fc54bdc */ jal optionsSetMusicVolume /* f1032c8: 94c40002 */ lhu $a0,0x2($a2) /* f1032cc: 3c02800a */ lui $v0,%hi(g_Vars) /* f1032d0: 24429fc0 */ addiu $v0,$v0,%lo(g_Vars) diff --git a/src/game/game_10ccd0.c b/src/game/game_10ccd0.c index 6dc167500..d721e7337 100644 --- a/src/game/game_10ccd0.c +++ b/src/game/game_10ccd0.c @@ -3109,7 +3109,7 @@ glabel func0f10f698 /* f10f720: a048000b */ sb $t0,0xb($v0) /* f10f724: 0c003a87 */ jal func0000ea1c /* f10f728: a049000b */ sb $t1,0xb($v0) -/* f10f72c: 0fc54bdc */ jal func0f152f70 +/* f10f72c: 0fc54bdc */ jal optionsSetMusicVolume /* f10f730: 24045000 */ addiu $a0,$zero,0x5000 /* f10f734: 0c003ce3 */ jal func0000f38c /* f10f738: 24040001 */ addiu $a0,$zero,0x1 @@ -3457,7 +3457,7 @@ glabel func0f10fac8 /* f10fc50: 00a02025 */ or $a0,$a1,$zero .L0f10fc54: /* f10fc54: 000449c0 */ sll $t1,$a0,0x7 -/* f10fc58: 0fc54bdc */ jal func0f152f70 +/* f10fc58: 0fc54bdc */ jal optionsSetMusicVolume /* f10fc5c: 3124ffff */ andi $a0,$t1,0xffff /* f10fc60: 02802025 */ or $a0,$s4,$zero /* f10fc64: 0fc354fe */ jal func0f0d53f8 @@ -3949,7 +3949,7 @@ glabel func0f10feac /* f11039c: 00057082 */ srl $t6,$a1,0x2 /* f1103a0: 0fc354be */ jal func0f0d52f8 /* f1103a4: 01c02825 */ or $a1,$t6,$zero -/* f1103a8: 0fc54bd4 */ jal func0f152f50 +/* f1103a8: 0fc54bd4 */ jal optionsGetMusicVolume /* f1103ac: 00000000 */ sll $zero,$zero,0x0 /* f1103b0: 000229c3 */ sra $a1,$v0,0x7 /* f1103b4: 00057882 */ srl $t7,$a1,0x2 diff --git a/src/game/game_152710.c b/src/game/game_152710.c index 061f596b7..d94b4b417 100644 --- a/src/game/game_152710.c +++ b/src/game/game_152710.c @@ -388,30 +388,12 @@ void optionsSetScreenSplit(u8 split) g_ScreenSplit = split; } -GLOBAL_ASM( -glabel func0f152f50 -/* f152f50: 27bdffe8 */ addiu $sp,$sp,-24 -/* f152f54: afbf0014 */ sw $ra,0x14($sp) -/* f152f58: 0fc5b3e8 */ jal func0f16cfa0 -/* f152f5c: 00000000 */ sll $zero,$zero,0x0 -/* f152f60: 8fbf0014 */ lw $ra,0x14($sp) -/* f152f64: 27bd0018 */ addiu $sp,$sp,0x18 -/* f152f68: 03e00008 */ jr $ra -/* f152f6c: 00000000 */ sll $zero,$zero,0x0 -); +s32 optionsGetMusicVolume(void) +{ + return func0f16cfa0(); +} -GLOBAL_ASM( -glabel func0f152f70 -/* f152f70: 27bdffe8 */ addiu $sp,$sp,-24 -/* f152f74: afbf0014 */ sw $ra,0x14($sp) -/* f152f78: afa40018 */ sw $a0,0x18($sp) -/* f152f7c: 308effff */ andi $t6,$a0,0xffff -/* f152f80: 0fc5b3fa */ jal func0f16cfe8 -/* f152f84: 01c02025 */ or $a0,$t6,$zero -/* f152f88: 8fbf0014 */ lw $ra,0x14($sp) -/* f152f8c: 27bd0018 */ addiu $sp,$sp,0x18 -/* f152f90: 03e00008 */ jr $ra -/* f152f94: 00000000 */ sll $zero,$zero,0x0 -/* f152f98: 00000000 */ sll $zero,$zero,0x0 -/* f152f9c: 00000000 */ sll $zero,$zero,0x0 -); +void optionsSetMusicVolume(u16 volume) +{ + func0f16cfe8(volume); +} diff --git a/src/include/game/game_152710.h b/src/include/game/game_152710.h index be348aa9e..70afa3ebb 100644 --- a/src/include/game/game_152710.h +++ b/src/include/game/game_152710.h @@ -43,7 +43,7 @@ s32 optionsGetScreenRatio(void); void optionsSetScreenRatio(s32 ratio); u8 optionsGetScreenSplit(void); void optionsSetScreenSplit(u8 split); -u32 func0f152f50(void); -void func0f152f70(u32 arg0); +s32 optionsGetMusicVolume(void); +void optionsSetMusicVolume(u16 volume); #endif diff --git a/src/include/game/game_16cfa0.h b/src/include/game/game_16cfa0.h index 7b3f332af..d27a1403b 100644 --- a/src/include/game/game_16cfa0.h +++ b/src/include/game/game_16cfa0.h @@ -4,7 +4,7 @@ #include "types.h" u32 func0f16cfa0(void); -u32 func0f16cfe8(void); +void func0f16cfe8(u16 volume); u32 func0f16d0a8(void); u32 func0f16d124(void); u32 func0f16d1bc(void);