Decompile audioPostEvent

This commit is contained in:
Ryan Dwyer 2021-10-18 17:58:09 +10:00
parent de0021904f
commit ecf8582048
11 changed files with 62 additions and 76 deletions

View File

@ -158,6 +158,11 @@ typedef struct {
u8 param;
} N_AL19Event;
typedef struct {
struct audiohandle *handle;
u32 data;
} N_ALGenericEvent;
struct audiohandle;
typedef struct {
@ -181,6 +186,7 @@ typedef struct {
N_AL18Event evt18;
N_AL19Event evt19;
N_AL400Event evt400;
N_ALGenericEvent generic;
} msg;
} N_ALEvent;

View File

@ -1985,7 +1985,7 @@ glabel var7f1ac1b0
/* f096830: 24050010 */ addiu $a1,$zero,0x10
/* f096834: 00008825 */ or $s1,$zero,$zero
/* f096838: 8fa60060 */ lw $a2,0x60($sp)
/* f09683c: 0c00d492 */ jal func00033e50
/* f09683c: 0c00d492 */ jal audioPostEvent
/* f096840: afa80068 */ sw $t0,0x68($sp)
/* f096844: 10000014 */ beqz $zero,.NB0f096898
/* f096848: 8fa80068 */ lw $t0,0x68($sp)
@ -6110,7 +6110,7 @@ glabel var7f1ac320
/* f09ab70: 460a1482 */ mul.s $f18,$f2,$f10
/* f09ab74: 46126401 */ sub.s $f16,$f12,$f18
/* f09ab78: e7b00034 */ swc1 $f16,0x34($sp)
/* f09ab7c: 0c00cf94 */ jal func00033e50
/* f09ab7c: 0c00cf94 */ jal audioPostEvent
/* f09ab80: 8fa60034 */ lw $a2,0x34($sp)
.L0f09ab84:
/* f09ab84: 00002025 */ or $a0,$zero,$zero
@ -6440,7 +6440,7 @@ glabel var7f1ac320
/* f09ab70: 460a1482 */ mul.s $f18,$f2,$f10
/* f09ab74: 46126401 */ sub.s $f16,$f12,$f18
/* f09ab78: e7b00034 */ swc1 $f16,0x34($sp)
/* f09ab7c: 0c00cf94 */ jal func00033e50
/* f09ab7c: 0c00cf94 */ jal audioPostEvent
/* f09ab80: 8fa60034 */ lw $a2,0x34($sp)
.L0f09ab84:
/* f09ab84: 00002025 */ or $a0,$zero,$zero
@ -6761,7 +6761,7 @@ glabel var7f1ac320
/* f098b88: 460a1482 */ mul.s $f18,$f2,$f10
/* f098b8c: 46126401 */ sub.s $f16,$f12,$f18
/* f098b90: e7b00030 */ swc1 $f16,0x30($sp)
/* f098b94: 0c00d492 */ jal func00033e50
/* f098b94: 0c00d492 */ jal audioPostEvent
/* f098b98: 8fa60030 */ lw $a2,0x30($sp)
.NB0f098b9c:
/* f098b9c: 8fbf002c */ lw $ra,0x2c($sp)
@ -6915,7 +6915,7 @@ const char var7f1ab898[] = "rofftime";
//
// tmp = 1.0f - frac * 0.4f;
//
// func00033e50(handle, 16, *(s32 *)&tmp);
// audioPostEvent(handle, 16, *(s32 *)&tmp);
// }
//
//#if VERSION >= VERSION_NTSC_1_0
@ -7722,7 +7722,7 @@ s32 bgunTickIncAttackEmpty(struct handweaponinfo *info, s32 handnum, struct hand
handle = sndStart(var80095200, SFX_HIT_WATER, NULL, -1, -1, -1, -1, -1);
if (handle) {
func00033e50(handle, 16, *(s32 *)&speed);
audioPostEvent(handle, 16, *(s32 *)&speed);
}
#if VERSION >= VERSION_NTSC_1_0
@ -7748,7 +7748,7 @@ s32 bgunTickIncAttackEmpty(struct handweaponinfo *info, s32 handnum, struct hand
handle = sndStart(var80095200, SFX_FIREEMPTY, NULL, -1, -1, -1, -1, -1);
if (handle) {
func00033e50(handle, 16, *(s32 *)&speed);
audioPostEvent(handle, 16, *(s32 *)&speed);
}
#if VERSION >= VERSION_NTSC_1_0
@ -8129,7 +8129,7 @@ s32 bgunTickIncChangeGun(struct handweaponinfo *info, s32 handnum, struct hand *
handle1 = sndStart(var80095200, SFX_EQUIP_HORIZONSCANNER, 0, -1, -1, -1, -1, -1);
if (handle1) {
func00033e50(handle1, 16, *(s32 *)&speed1);
audioPostEvent(handle1, 16, *(s32 *)&speed1);
}
#if VERSION >= VERSION_NTSC_1_0
@ -8172,7 +8172,7 @@ s32 bgunTickIncChangeGun(struct handweaponinfo *info, s32 handnum, struct hand *
handle2 = sndStart(var80095200, SFX_PICKUP_GUN, 0, -1, -1, -1, -1, -1);
if (handle2) {
func00033e50(handle2, 16, *(s32 *)&speed2);
audioPostEvent(handle2, 16, *(s32 *)&speed2);
}
#if VERSION >= VERSION_NTSC_1_0
@ -8190,7 +8190,7 @@ s32 bgunTickIncChangeGun(struct handweaponinfo *info, s32 handnum, struct hand *
handle3 = sndStart(var80095200, SFX_PICKUP_GUN, 0, -1, -1, -1, -1, -1);
if (handle3) {
func00033e50(handle3, 16, *(s32 *)&speed3);
audioPostEvent(handle3, 16, *(s32 *)&speed3);
}
#if VERSION >= VERSION_NTSC_1_0
@ -18480,11 +18480,11 @@ glabel var7f1ac8b8
/* f0a3dcc: 44064000 */ mfc1 $a2,$f8
/* f0a3dd0: 00000000 */ nop
.L0f0a3dd4:
/* f0a3dd4: 0c00cf94 */ jal func00033e50
/* f0a3dd4: 0c00cf94 */ jal audioPostEvent
/* f0a3dd8: 8e04074c */ lw $a0,0x74c($s0)
/* f0a3ddc: 8e04074c */ lw $a0,0x74c($s0)
/* f0a3de0: 24050010 */ addiu $a1,$zero,0x10
/* f0a3de4: 0c00cf94 */ jal func00033e50
/* f0a3de4: 0c00cf94 */ jal audioPostEvent
/* f0a3de8: 8fa60034 */ lw $a2,0x34($sp)
.L0f0a3dec:
/* f0a3dec: 8faa0044 */ lw $t2,0x44($sp)
@ -18793,11 +18793,11 @@ glabel var7f1ac8b8
/* f0a3dcc: 44064000 */ mfc1 $a2,$f8
/* f0a3dd0: 00000000 */ nop
.L0f0a3dd4:
/* f0a3dd4: 0c00cf94 */ jal func00033e50
/* f0a3dd4: 0c00cf94 */ jal audioPostEvent
/* f0a3dd8: 8e04074c */ lw $a0,0x74c($s0)
/* f0a3ddc: 8e04074c */ lw $a0,0x74c($s0)
/* f0a3de0: 24050010 */ addiu $a1,$zero,0x10
/* f0a3de4: 0c00cf94 */ jal func00033e50
/* f0a3de4: 0c00cf94 */ jal audioPostEvent
/* f0a3de8: 8fa60034 */ lw $a2,0x34($sp)
.L0f0a3dec:
/* f0a3dec: 8faa0044 */ lw $t2,0x44($sp)
@ -24365,7 +24365,7 @@ void bgunTickMaulerCharge(void)
* its speed is adjusted, the game raises the priority of the main
* thread (this thread) to above the audio thread's priority so that
* the audio thread cannot execute and start playing the audio
* between the calls to sndStart and func00033e50. But this pattern
* between the calls to sndStart and audioPostEvent. But this pattern
* is not done here.
*
* There is a known issue where the Mauler charge sound is played
@ -24389,7 +24389,7 @@ void bgunTickMaulerCharge(void)
if (hand->matmot1 < 0.1f || !charging) {
audioStop(hand->audiohandle);
} else {
func00033e50(hand->audiohandle, 16, *(s32 *)&speed);
audioPostEvent(hand->audiohandle, 16, *(s32 *)&speed);
}
}
}

View File

@ -122,7 +122,7 @@ glabel casingTick
/* f01db80: 24050010 */ addiu $a1,$zero,0x10
/* f01db84: 10800003 */ beqz $a0,.L0f01db94
/* f01db88: 00000000 */ nop
/* f01db8c: 0c00cf94 */ jal func00033e50
/* f01db8c: 0c00cf94 */ jal audioPostEvent
/* f01db90: 8fa60058 */ lw $a2,0x58($sp)
.L0f01db94:
/* f01db94: 1000006c */ b .L0f01dd48
@ -364,7 +364,7 @@ glabel casingTick
/* f01db80: 24050010 */ addiu $a1,$zero,0x10
/* f01db84: 10800003 */ beqz $a0,.L0f01db94
/* f01db88: 00000000 */ nop
/* f01db8c: 0c00cf94 */ jal func00033e50
/* f01db8c: 0c00cf94 */ jal audioPostEvent
/* f01db90: 8fa60058 */ lw $a2,0x58($sp)
.L0f01db94:
/* f01db94: 1000006c */ b .L0f01dd48

View File

@ -12030,7 +12030,7 @@ bool aiChrBeginOrEndTeleport(void)
handle = sndStart(var80095200, SFX_RELOAD_FARSIGHT, NULL, -1, -1, -1, -1, -1);
if (handle) {
func00033e50(handle, 16, *(u32 *)&fvalue);
audioPostEvent(handle, 16, *(u32 *)&fvalue);
}
#if VERSION >= VERSION_NTSC_1_0
@ -12081,7 +12081,7 @@ bool aiIfChrTeleportFullWhite(void)
handle = sndStart(var80095200, SFX_FIRE_SHOTGUN, NULL, -1, -1, -1, -1, -1);
if (handle) {
func00033e50(handle, 16, *(u32 *)&fvalue);
audioPostEvent(handle, 16, *(u32 *)&fvalue);
}
#if VERSION >= VERSION_NTSC_1_0

View File

@ -202,11 +202,11 @@ void menuPlaySound(s32 menusound)
handle = sndStart(var80095200, sound, NULL, -1, -1, -1, -1, -1);
if (handle && flag1) {
func00033e50(handle, 16, *(s32 *)&speed);
audioPostEvent(handle, 16, *(s32 *)&speed);
}
if (handle && flag2) {
func00033e50(handle, 8, 0x4000);
audioPostEvent(handle, 8, 0x4000);
}
#if VERSION >= VERSION_NTSC_1_0

View File

@ -3764,8 +3764,8 @@ void nbombsTick(void)
somevalue = 0;
}
func00033e50(g_NbombAudioHandle, 8, somevalue);
func00033e50(g_NbombAudioHandle, 16, *(s32 *)&speed);
audioPostEvent(g_NbombAudioHandle, 8, somevalue);
audioPostEvent(g_NbombAudioHandle, 16, *(s32 *)&speed);
}
} else {
if (g_NbombAudioHandle && audioIsPlaying(g_NbombAudioHandle)) {
@ -3860,7 +3860,7 @@ void nbombCreate(struct coord *pos, struct prop *prop)
if (g_Nbombs[index].audiohandle20) {
union audioparam param;
param.f32 = 0.4f;
func00033e50(g_Nbombs[index].audiohandle20, 16, param.s32);
audioPostEvent(g_Nbombs[index].audiohandle20, 16, param.s32);
}
}
@ -3870,7 +3870,7 @@ void nbombCreate(struct coord *pos, struct prop *prop)
if (g_Nbombs[index].audiohandle24) {
union audioparam param;
param.f32 = 0.4f;
func00033e50(g_Nbombs[index].audiohandle24, 16, param.s32);
audioPostEvent(g_Nbombs[index].audiohandle24, 16, param.s32);
}
}
#else
@ -3882,7 +3882,7 @@ void nbombCreate(struct coord *pos, struct prop *prop)
if (g_Nbombs[index].audiohandle20) {
union audioparam param;
param.f32 = 0.4f;
func00033e50(g_Nbombs[index].audiohandle20, 16, param.s32);
audioPostEvent(g_Nbombs[index].audiohandle20, 16, param.s32);
}
sndStart(var80095200, SFX_LAUNCH_ROCKET, &g_Nbombs[index].audiohandle24, -1, -1, -1, -1, -1);
@ -3890,7 +3890,7 @@ void nbombCreate(struct coord *pos, struct prop *prop)
if (g_Nbombs[index].audiohandle24) {
union audioparam param;
param.f32 = 0.4f;
func00033e50(g_Nbombs[index].audiohandle24, 16, param.s32);
audioPostEvent(g_Nbombs[index].audiohandle24, 16, param.s32);
}
#endif
}

View File

@ -452,7 +452,7 @@ void weaponPlayWhooshSound(s32 weaponnum, struct prop *prop)
handle = sndStart(var80095200, soundnum, NULL, -1, -1, -1, -1, -1);
if (handle) {
func00033e50(handle, 0x10, *(s32 *)&speed);
audioPostEvent(handle, 0x10, *(s32 *)&speed);
}
osSetThreadPri(0, prevpri);
@ -460,7 +460,7 @@ void weaponPlayWhooshSound(s32 weaponnum, struct prop *prop)
handle = sndStart(var80095200, soundnum, NULL, -1, -1, -1, -1, -1);
if (handle) {
func00033e50(handle, 0x10, *(s32 *)&speed);
audioPostEvent(handle, 0x10, *(s32 *)&speed);
}
#endif
} else {
@ -515,7 +515,7 @@ void func0f060bac(s32 weaponnum, struct prop *prop)
handle = sndStart(var80095200, soundnum, 0, -1, -1, -1, -1, -1);
if (handle) {
func00033e50(handle, 0x10, *(s32 *)&speed);
audioPostEvent(handle, 0x10, *(s32 *)&speed);
}
osSetThreadPri(0, prevpri);
@ -523,7 +523,7 @@ void func0f060bac(s32 weaponnum, struct prop *prop)
handle = sndStart(var80095200, soundnum, 0, -1, -1, -1, -1, -1);
if (handle) {
func00033e50(handle, 0x10, *(s32 *)&speed);
audioPostEvent(handle, 0x10, *(s32 *)&speed);
}
#endif
} else {

View File

@ -1548,7 +1548,7 @@ glabel var7f1b5780
/* f133880: 8fb90dec */ lw $t9,0xdec($sp)
/* f133884: 24050010 */ addiu $a1,$zero,0x10
/* f133888: 8fa60174 */ lw $a2,0x174($sp)
/* f13388c: 0c00cf94 */ jal func00033e50
/* f13388c: 0c00cf94 */ jal audioPostEvent
/* f133890: 8f240040 */ lw $a0,0x40($t9)
.L0f133894:
/* f133894: 8fa70dec */ lw $a3,0xdec($sp)

View File

@ -22,7 +22,7 @@ u32 func00033c30(void);
u32 func00033cf0(void);
u32 func00033db0(void);
u32 func00033dd8(void);
void func00033e50(struct audiohandle *handle, s32 arg1, s32 arg2);
void audioPostEvent(struct audiohandle *handle, s16 type, s32 data);
u16 func00033ec4(s32 arg0);
u32 func00033f08(void);
u32 func00033f24(void);

View File

@ -4698,40 +4698,20 @@ glabel func00033dd8
/* 33e4c: 00000000 */ nop
);
GLOBAL_ASM(
glabel func00033e50
/* 33e50: 27bdffd8 */ addiu $sp,$sp,-40
/* 33e54: afbf0014 */ sw $ra,0x14($sp)
/* 33e58: afa40028 */ sw $a0,0x28($sp)
/* 33e5c: afa5002c */ sw $a1,0x2c($sp)
/* 33e60: afa60030 */ sw $a2,0x30($sp)
/* 33e64: 87ae002e */ lh $t6,0x2e($sp)
/* 33e68: a7ae0018 */ sh $t6,0x18($sp)
/* 33e6c: 8faf0028 */ lw $t7,0x28($sp)
/* 33e70: afaf001c */ sw $t7,0x1c($sp)
/* 33e74: 8fb80030 */ lw $t8,0x30($sp)
/* 33e78: afb80020 */ sw $t8,0x20($sp)
/* 33e7c: 8fb90028 */ lw $t9,0x28($sp)
/* 33e80: 1320000a */ beqz $t9,.L00033eac
/* 33e84: 00000000 */ nop
/* 33e88: 3c048006 */ lui $a0,%hi(var8005f12c)
/* 33e8c: 8c84f12c */ lw $a0,%lo(var8005f12c)($a0)
/* 33e90: 27a50018 */ addiu $a1,$sp,0x18
/* 33e94: 00003025 */ or $a2,$zero,$zero
/* 33e98: 00003825 */ or $a3,$zero,$zero
/* 33e9c: 0c00f184 */ jal n_alEvtqPostEvent
/* 33ea0: 24840014 */ addiu $a0,$a0,20
/* 33ea4: 10000001 */ b .L00033eac
/* 33ea8: 00000000 */ nop
.L00033eac:
/* 33eac: 10000001 */ b .L00033eb4
/* 33eb0: 00000000 */ nop
.L00033eb4:
/* 33eb4: 8fbf0014 */ lw $ra,0x14($sp)
/* 33eb8: 27bd0028 */ addiu $sp,$sp,0x28
/* 33ebc: 03e00008 */ jr $ra
/* 33ec0: 00000000 */ nop
);
void audioPostEvent(struct audiohandle *handle, s16 type, s32 data)
{
N_ALEvent evt;
evt.type = type;
evt.msg.generic.handle = handle;
evt.msg.generic.data = data;
if (handle) {
n_alEvtqPostEvent(&var8005f12c->evtq, &evt, 0, 0);
} else {
// empty
}
}
GLOBAL_ASM(
glabel func00033ec4

View File

@ -3802,7 +3802,7 @@ glabel sndAdjust
/* 10684: 8fbf0014 */ lw $ra,0x14($sp)
/* 10688: 10c80005 */ beq $a2,$t0,.L000106a0
/* 1068c: 24050008 */ addiu $a1,$zero,0x8
/* 10690: 0c00cf94 */ jal func00033e50
/* 10690: 0c00cf94 */ jal audioPostEvent
/* 10694: afa70034 */ sw $a3,0x34($sp)
/* 10698: 8fa70034 */ lw $a3,0x34($sp)
/* 1069c: 2408ffff */ addiu $t0,$zero,-1
@ -3811,7 +3811,7 @@ glabel sndAdjust
/* 106a4: 8faf0028 */ lw $t7,0x28($sp)
/* 106a8: 8de40000 */ lw $a0,0x0($t7)
/* 106ac: 24050004 */ addiu $a1,$zero,0x4
/* 106b0: 0c00cf94 */ jal func00033e50
/* 106b0: 0c00cf94 */ jal audioPostEvent
/* 106b4: 30e6007f */ andi $a2,$a3,0x7f
/* 106b8: 2408ffff */ addiu $t0,$zero,-1
.L000106bc:
@ -3824,7 +3824,7 @@ glabel sndAdjust
/* 106d4: 8fa6003c */ lw $a2,0x3c($sp)
/* 106d8: 45030005 */ bc1tl .L000106f0
/* 106dc: 8fb80024 */ lw $t8,0x24($sp)
/* 106e0: 0c00cf94 */ jal func00033e50
/* 106e0: 0c00cf94 */ jal audioPostEvent
/* 106e4: 8f240000 */ lw $a0,0x0($t9)
/* 106e8: 2408ffff */ addiu $t0,$zero,-1
/* 106ec: 8fb80024 */ lw $t8,0x24($sp)
@ -3833,7 +3833,7 @@ glabel sndAdjust
/* 106f4: 24050100 */ addiu $a1,$zero,0x100
/* 106f8: 13080003 */ beq $t8,$t0,.L00010708
/* 106fc: 03003025 */ or $a2,$t8,$zero
/* 10700: 0c00cf94 */ jal func00033e50
/* 10700: 0c00cf94 */ jal audioPostEvent
/* 10704: 8d440000 */ lw $a0,0x0($t2)
.L00010708:
/* 10708: 8fbf0014 */ lw $ra,0x14($sp)
@ -3979,7 +3979,7 @@ glabel sndAdjust
/* 10a68: 8fbf0014 */ lw $ra,0x14($sp)
/* 10a6c: 10c90005 */ beq $a2,$t1,.NB00010a84
/* 10a70: 24050008 */ addiu $a1,$zero,0x8
/* 10a74: 0c00d492 */ jal func00033e50
/* 10a74: 0c00d492 */ jal audioPostEvent
/* 10a78: afa70034 */ sw $a3,0x34($sp)
/* 10a7c: 8fa70034 */ lw $a3,0x34($sp)
/* 10a80: 2409ffff */ addiu $t1,$zero,-1
@ -3988,7 +3988,7 @@ glabel sndAdjust
/* 10a88: 8faf0028 */ lw $t7,0x28($sp)
/* 10a8c: 8de40000 */ lw $a0,0x0($t7)
/* 10a90: 24050004 */ addiu $a1,$zero,0x4
/* 10a94: 0c00d492 */ jal func00033e50
/* 10a94: 0c00d492 */ jal audioPostEvent
/* 10a98: 30e6007f */ andi $a2,$a3,0x7f
/* 10a9c: 2409ffff */ addiu $t1,$zero,-1
.NB00010aa0:
@ -4001,7 +4001,7 @@ glabel sndAdjust
/* 10ab8: 8fa6003c */ lw $a2,0x3c($sp)
/* 10abc: 45030005 */ bc1tl .NB00010ad4
/* 10ac0: 8fb80024 */ lw $t8,0x24($sp)
/* 10ac4: 0c00d492 */ jal func00033e50
/* 10ac4: 0c00d492 */ jal audioPostEvent
/* 10ac8: 8f240000 */ lw $a0,0x0($t9)
/* 10acc: 2409ffff */ addiu $t1,$zero,-1
/* 10ad0: 8fb80024 */ lw $t8,0x24($sp)
@ -4010,7 +4010,7 @@ glabel sndAdjust
/* 10ad8: 24050100 */ addiu $a1,$zero,0x100
/* 10adc: 13090003 */ beq $t8,$t1,.NB00010aec
/* 10ae0: 03003025 */ or $a2,$t8,$zero
/* 10ae4: 0c00d492 */ jal func00033e50
/* 10ae4: 0c00d492 */ jal audioPostEvent
/* 10ae8: 8d440000 */ lw $a0,0x0($t2)
.NB00010aec:
/* 10aec: 8fbf0014 */ lw $ra,0x14($sp)