Decompile stageGetPrimaryTrack

This commit is contained in:
Ryan Dwyer 2020-08-28 19:33:40 +10:00
parent 4cd6244b38
commit 0d8759394a
7 changed files with 35 additions and 58 deletions

View File

@ -410,10 +410,9 @@ struct stagemusic stagemusictable[] = {
{ STAGE_WAR, MUSIC_ALIEN_CONFLICT, MUSIC_SKEDAR_WIND, MUSIC_ALIEN_CONFLICT },
{ STAGE_DUEL, MUSIC_CREDITS, -1, MUSIC_CREDITS },
{ STAGE_CREDITS, MUSIC_ALIEN_CONFLICT, -1, MUSIC_ALIEN_CONFLICT },
{ 0, 0, 0, 0 },
};
u32 var800845c0 = 0x00000000;
u32 var800845c4 = 0x00000000;
u32 var800845c8 = 0x00000000;
u32 var800845cc = 0x00000000;
u32 var800845d0 = 0x497423f0;

View File

@ -196,7 +196,7 @@ void func0f16d44c(void)
var800aa5d8[0].unk16 = 0;
}
#define TRACKNUM2() (var800840c8 != -1 ? var800840c8 : func0f176c40(var800aa5d0))
#define TRACKNUM2() (var800840c8 != -1 ? var800840c8 : stageGetPrimaryTrack(var800aa5d0))
void func0f16d4b8(f32 arg0)
{

View File

@ -6,6 +6,7 @@
#include "game/data/data_0160b0.h"
#include "game/data/data_01a3a0.h"
#include "game/data/data_020df0.h"
#include "game/data/data_02a0e0.h"
#include "game/data/data_02da90.h"
#include "game/game_0b63b0.h"
#include "game/game_176080.h"
@ -837,54 +838,30 @@ glabel func0f1766b4
/* f176c3c: 27bd0058 */ addiu $sp,$sp,0x58
);
GLOBAL_ASM(
glabel func0f176c40
/* f176c40: 3c0e800a */ lui $t6,%hi(g_Vars+0x318)
/* f176c44: 8dcea2d8 */ lw $t6,%lo(g_Vars+0x318)($t6)
/* f176c48: 27bdffe8 */ addiu $sp,$sp,-24
/* f176c4c: afbf0014 */ sw $ra,0x14($sp)
/* f176c50: 11c00005 */ beqz $t6,.L0f176c68
/* f176c54: 3c0f8008 */ lui $t7,%hi(stagemusictable)
/* f176c58: 0fc63130 */ jal func0f18c4c0
/* f176c5c: 00000000 */ nop
/* f176c60: 1000001a */ b .L0f176ccc
/* f176c64: 8fbf0014 */ lw $ra,0x14($sp)
.L0f176c68:
/* f176c68: 85ef4500 */ lh $t7,%lo(stagemusictable)($t7)
/* f176c6c: 3c188008 */ lui $t8,%hi(stagemusictable)
/* f176c70: 27024500 */ addiu $v0,$t8,%lo(stagemusictable)
/* f176c74: 11e00012 */ beqz $t7,.L0f176cc0
/* f176c78: 00000000 */ nop
/* f176c7c: 84430000 */ lh $v1,0x0($v0)
.L0f176c80:
/* f176c80: 5483000c */ bnel $a0,$v1,.L0f176cb4
/* f176c84: 84430008 */ lh $v1,0x8($v0)
/* f176c88: 84430002 */ lh $v1,0x2($v0)
/* f176c8c: 2401ffff */ addiu $at,$zero,-1
/* f176c90: 14610005 */ bne $v1,$at,.L0f176ca8
/* f176c94: 00000000 */ nop
/* f176c98: 0fc63130 */ jal func0f18c4c0
/* f176c9c: 00000000 */ nop
/* f176ca0: 1000000a */ b .L0f176ccc
/* f176ca4: 8fbf0014 */ lw $ra,0x14($sp)
.L0f176ca8:
/* f176ca8: 10000007 */ b .L0f176cc8
/* f176cac: 00601025 */ or $v0,$v1,$zero
/* f176cb0: 84430008 */ lh $v1,0x8($v0)
.L0f176cb4:
/* f176cb4: 24420008 */ addiu $v0,$v0,0x8
/* f176cb8: 1460fff1 */ bnez $v1,.L0f176c80
/* f176cbc: 00000000 */ nop
.L0f176cc0:
/* f176cc0: 0fc63130 */ jal func0f18c4c0
/* f176cc4: 00000000 */ nop
.L0f176cc8:
/* f176cc8: 8fbf0014 */ lw $ra,0x14($sp)
.L0f176ccc:
/* f176ccc: 27bd0018 */ addiu $sp,$sp,0x18
/* f176cd0: 03e00008 */ jr $ra
/* f176cd4: 00000000 */ nop
);
s32 stageGetPrimaryTrack(s32 stagenum)
{
s32 i;
if (g_Vars.normmplayerisrunning) {
return func0f18c4c0();
}
i = 0;
while (stagemusictable[i].stagenum) {
if (stagemusictable[i].stagenum == stagenum) {
if (stagemusictable[i].primarytrack == -1) {
return func0f18c4c0();
}
return stagemusictable[i].primarytrack;
}
i++;
}
return func0f18c4c0();
}
GLOBAL_ASM(
glabel func0f176cd8

View File

@ -23,6 +23,7 @@ extern u32 var80084220;
extern struct something *somethings[];
extern u32 var800844d0;
extern u32 var800844f0;
extern struct stagemusic stagemusictable[];
extern s32 var800845d8;
extern u32 var800845dc;
extern u32 var800845f4;

View File

@ -11,7 +11,7 @@ u32 func0f1762ac(void);
u32 func0f1763f4(void);
u32 func0f176668(void);
u32 func0f1766b4(void);
s32 func0f176c40(s32 stagenum);
s32 stageGetPrimaryTrack(s32 stagenum);
s32 func0f176cd8(s32 stagenum);
s32 func0f176d20(s32 stagenum);

View File

@ -3157,10 +3157,10 @@ struct stageoverviewentry {
};
struct stagemusic {
u16 stage;
s16 main_music;
s16 sfx_music;
s16 x_music;
s16 stagenum;
s16 primarytrack;
s16 ambienttrack;
s16 xtrack;
};
struct mission {

View File

@ -807,7 +807,7 @@ glabel func00011d84
/* 11e80: 0fc5b490 */ jal func0f16d240
/* 11e84: 24040001 */ addiu $a0,$zero,0x1
/* 11e88: 3c04800b */ lui $a0,%hi(var800aa5d0)
/* 11e8c: 0fc5db10 */ jal func0f176c40
/* 11e8c: 0fc5db10 */ jal stageGetPrimaryTrack
/* 11e90: 8c84a5d0 */ lw $a0,%lo(var800aa5d0)($a0)
/* 11e94: 0fc5b3e8 */ jal audioGetVolume
/* 11e98: afa20018 */ sw $v0,0x18($sp)
@ -876,7 +876,7 @@ glabel func00011d84
/* 11f88: 0fc5b490 */ jal func0f16d240
/* 11f8c: 24040001 */ addiu $a0,$zero,0x1
/* 11f90: 3c04800b */ lui $a0,%hi(var800aa5d0)
/* 11f94: 0fc5db10 */ jal func0f176c40
/* 11f94: 0fc5db10 */ jal stageGetPrimaryTrack
/* 11f98: 8c84a5d0 */ lw $a0,%lo(var800aa5d0)($a0)
/* 11f9c: 0fc5b3e8 */ jal audioGetVolume
/* 11fa0: afa20018 */ sw $v0,0x18($sp)