Decompile menuhandlerSfxVolume

This commit is contained in:
Ryan Dwyer 2019-12-31 13:53:24 +10:00
parent 44e6b887c5
commit 852a13a667
7 changed files with 25 additions and 41 deletions

View File

@ -1,6 +1,7 @@
#include <ultra64.h>
#include "constants.h"
#include "gvars/gvars.h"
#include "library/library_0e9d0.h"
#include "setup/setup_000000.h"
#include "setup/setup_0160b0.h"
#include "setup/setup_020df0.h"
@ -1024,41 +1025,23 @@ s32 menuhandlerMusicVolume(u32 operation, struct menu_item *item, u32 *volume)
return 0;
}
GLOBAL_ASM(
glabel menuhandlerSfxVolume
/* f1032f4: 27bdffe8 */ addiu $sp,$sp,-24
/* f1032f8: 24010006 */ addiu $at,$zero,0x6
/* f1032fc: afbf0014 */ sw $ra,0x14($sp)
/* f103300: 1081000d */ beq $a0,$at,.L0f103338
/* f103304: afa5001c */ sw $a1,0x1c($sp)
/* f103308: 24010009 */ addiu $at,$zero,0x9
/* f10330c: 14810011 */ bne $a0,$at,.L0f103354
/* f103310: 3c028006 */ lui $v0,0x8006
/* f103314: 9442ddc8 */ lhu $v0,-0x2238($v0)
/* f103318: 240e5000 */ addiu $t6,$zero,0x5000
/* f10331c: 28415001 */ slti $at,$v0,0x5001
/* f103320: 14200003 */ bnez $at,.L0f103330
/* f103324: 00000000 */ sll $zero,$zero,0x0
/* f103328: 1000000a */ beqz $zero,.L0f103354
/* f10332c: acce0000 */ sw $t6,0x0($a2)
.L0f103330:
/* f103330: 10000008 */ beqz $zero,.L0f103354
/* f103334: acc20000 */ sw $v0,0x0($a2)
.L0f103338:
/* f103338: 0c003a87 */ jal func0000ea1c
/* f10333c: 94c40002 */ lhu $a0,0x2($a2)
/* f103340: 3c02800a */ lui $v0,%hi(g_Vars)
/* f103344: 24429fc0 */ addiu $v0,$v0,%lo(g_Vars)
/* f103348: 8c4f0458 */ lw $t7,0x458($v0)
/* f10334c: 35f80001 */ ori $t8,$t7,0x1
/* f103350: ac580458 */ sw $t8,0x458($v0)
.L0f103354:
/* f103354: 8fbf0014 */ lw $ra,0x14($sp)
/* f103358: 27bd0018 */ addiu $sp,$sp,0x18
/* f10335c: 00001025 */ or $v0,$zero,$zero
/* f103360: 03e00008 */ jr $ra
/* f103364: 00000000 */ sll $zero,$zero,0x0
);
s32 menuhandlerSfxVolume(u32 operation, struct menu_item *item, u32 *volume)
{
switch (operation) {
case MENUOP_GETSLIDER:
if (g_SfxVolume > 0x5000) {
*volume = 0x5000;
} else {
*volume = g_SfxVolume;
}
break;
case MENUOP_SET:
audioSetSfxVolume(*volume);
g_Vars.unk000458 |= 1;
}
return 0;
}
GLOBAL_ASM(
glabel menudialog00103368

View File

@ -3107,7 +3107,7 @@ glabel func0f10f698
/* f10f718: 3308ff07 */ andi $t0,$t8,0xff07
/* f10f71c: 310900f8 */ andi $t1,$t0,0xf8
/* f10f720: a048000b */ sb $t0,0xb($v0)
/* f10f724: 0c003a87 */ jal func0000ea1c
/* f10f724: 0c003a87 */ jal audioSetSfxVolume
/* f10f728: a049000b */ sb $t1,0xb($v0)
/* f10f72c: 0fc54bdc */ jal optionsSetMusicVolume
/* f10f730: 24045000 */ addiu $a0,$zero,0x5000
@ -3444,7 +3444,7 @@ glabel func0f10fac8
/* f10fc20: 00a02025 */ or $a0,$a1,$zero
.L0f10fc24:
/* f10fc24: 000441c0 */ sll $t0,$a0,0x7
/* f10fc28: 0c003a87 */ jal func0000ea1c
/* f10fc28: 0c003a87 */ jal audioSetSfxVolume
/* f10fc2c: 3104ffff */ andi $a0,$t0,0xffff
/* f10fc30: 02802025 */ or $a0,$s4,$zero
/* f10fc34: 0fc354fe */ jal func0f0d53f8

View File

@ -75,7 +75,7 @@ s32 menuhandlerReversePitch(u32 operation, struct menu_item *item, bool *enable)
s32 menuhandlerScreenRatio(u32 operation, struct menu_item *item, bool *enable);
s32 menuhandlerScreenSize(u32 operation, struct menu_item *item, bool *enable);
s32 menuhandlerScreenSplit(u32 operation, struct menu_item *item, bool *enable);
s32 menuhandlerSfxVolume(u32 operation, struct menu_item *item, bool *enable);
s32 menuhandlerSfxVolume(u32 operation, struct menu_item *item, u32 *volume);
s32 menuhandlerShowGunFunction(u32 operation, struct menu_item *item, bool *enable);
s32 menuhandlerShowMissionTime(u32 operation, struct menu_item *item, bool *enable);
s32 menuhandlerShowZoomRange(u32 operation, struct menu_item *item, bool *enable);

View File

@ -6,7 +6,7 @@
u32 audioIsFiltered(void);
u32 func0000e9d0(void);
u32 func0000e9dc(void);
u32 func0000ea1c(void);
void audioSetSfxVolume(u16 volume);
u32 func0000ea80(void);
u32 func0000eadc(void);
u32 func0000eb2c(void);

View File

@ -97,6 +97,7 @@ extern u32 var8005ddb4;
extern u32 var8005ddb8;
extern u32 var8005ddc0;
extern u32 var8005ddc4;
extern u16 g_SfxVolume;
extern u32 g_SoundMode;
extern u32 var8005ddd4;
extern u32 var8005ddd8;

View File

@ -68,7 +68,7 @@ glabel func0000e9dc
);
GLOBAL_ASM(
glabel func0000ea1c
glabel audioSetSfxVolume
/* ea1c: 27bdffe0 */ addiu $sp,$sp,-32
/* ea20: afb10018 */ sw $s1,0x18($sp)
/* ea24: 3091ffff */ andi $s1,$a0,0xffff

View File

@ -3884,7 +3884,7 @@ u32 var8005ddb8 = 0xffffffff;
u32 var8005ddbc = 0x00000000;
u32 var8005ddc0 = 0x00000000;
u32 var8005ddc4 = 0x00000000;
u32 var8005ddc8 = 0x7fff0000;
u16 g_SfxVolume = 32767;
u32 g_SoundMode = SOUNDMODE_STEREO;
u32 var8005ddd0 = 0x00000000;
u32 var8005ddd4 = 0x00000000;