match set_music_track

rewrite flag as NOT


clean up set_music_track temps
This commit is contained in:
Alex Bates 2020-10-29 01:05:40 +00:00
parent 85f7331004
commit 9eef0b0273
No known key found for this signature in database
GPG Key ID: 5E11C2DB78877706
8 changed files with 21 additions and 34 deletions

View File

@ -1,23 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel set_music_track
/* E1018 8014A918 27BDFFE0 */ addiu $sp, $sp, -0x20
/* E101C 8014A91C 3C038016 */ lui $v1, 0x8016
/* E1020 8014A920 24639AF0 */ addiu $v1, $v1, -0x6510
/* E1024 8014A924 00041040 */ sll $v0, $a0, 1
/* E1028 8014A928 00441021 */ addu $v0, $v0, $a0
/* E102C 8014A92C 00021100 */ sll $v0, $v0, 4
/* E1030 8014A930 00431021 */ addu $v0, $v0, $v1
/* E1034 8014A934 AFBF0018 */ sw $ra, 0x18($sp)
/* E1038 8014A938 94430000 */ lhu $v1, ($v0)
/* E103C 8014A93C 8FA80030 */ lw $t0, 0x30($sp)
/* E1040 8014A940 3063FFF7 */ andi $v1, $v1, 0xfff7
/* E1044 8014A944 00084400 */ sll $t0, $t0, 0x10
/* E1048 8014A948 00084403 */ sra $t0, $t0, 0x10
/* E104C 8014A94C A4430000 */ sh $v1, ($v0)
/* E1050 8014A950 0C0529F8 */ jal _set_music_track
/* E1054 8014A954 AFA80010 */ sw $t0, 0x10($sp)
/* E1058 8014A958 8FBF0018 */ lw $ra, 0x18($sp)
/* E105C 8014A95C 03E00008 */ jr $ra
/* E1060 8014A960 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -307,7 +307,7 @@ typedef struct StaticEntityData {
} StaticEntityData; // size = 0x24
typedef struct MusicPlayer {
/* 0x00 */ s16 unkFlags;
/* 0x00 */ u16 unkFlags;
/* 0x02 */ char unk_02[2];
/* 0x04 */ s32 fadeOutTime;
/* 0x08 */ s32 fadeInTime;

View File

@ -113,7 +113,7 @@ f32 dist3D(f32 ax, f32 ay, f32 az, f32 bx, f32 by, f32 bz);
void add_vec2D_polar(f32* x, f32* y, f32 r, f32 theta);
s32 play_sound_at_position(s32 soundID, s32 value2, f32 posX, f32 posY, f32 posZ);
s32 set_music_track(s32 musicPlayer, s32 songID, s32 variation, s32 unk, s32 volume);
void set_music_track(s32 playerIndex, s32 songID, s32 variation, s32 unk, s16 volume);
ScriptInstance* get_script_by_index(s32 index);

View File

@ -165,4 +165,6 @@ extern Bytecode* SCRIPT_NpcDefeat;
extern Bytecode* ShakeCam1;
extern Bytecode* ShakeCamX;
extern MusicPlayer gMusicPlayers[];
#endif

View File

@ -1,21 +1,22 @@
#include "common.h"
// TODO: rodata
extern s32 D_80078DB0;
extern u16 D_80078DB4;
INCLUDE_ASM(s32, "code_303c0_len_3e10", al_LoadBKHeaders);
#ifdef NON_MATCHING
// Needs rodata
extern s32 D_80078DB0;
extern u16 D_80078DB4;
// Delay slot (probably needs rodata)
void func_80055050(void) {
D_80078DB4 = 1;
D_80078DB0 = 0;
}
#else
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055050);
INCLUDE_ASM(void, "code_303c0_len_3e10", func_80055050, void);
#endif
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055068);
INCLUDE_ASM(void, "code_303c0_len_3e10", func_80055068, u32 arg0);
INCLUDE_ASM(s32, "code_303c0_len_3e10", func_80055110);

View File

@ -11,10 +11,14 @@ void func_8014A52C(void) {
INCLUDE_ASM(s32, "code_e0b30_len_b80", func_8014A548);
INCLUDE_ASM(s32, "code_e0b30_len_b80", _set_music_track);
INCLUDE_ASM(s32, "code_e0b30_len_b80", _set_music_track, s32 playerIndex, s32 songID, s32 variation, s32 unk, s16 volume);
INCLUDE_ASM(s32, "code_e0b30_len_b80", set_music_track, s32 musicPlayer, s32 songID, s32 variation, s32 unk,
s32 volume);
void set_music_track(s32 playerIndex, s32 songID, s32 variation, s32 unk, s16 volume) {
MusicPlayer* musicPlayers = &gMusicPlayers;
musicPlayers[playerIndex].unkFlags &= ~8;
_set_music_track(playerIndex, songID, variation, unk, volume);
}
INCLUDE_ASM(s32, "code_e0b30_len_b80", func_8014A964);

View File

@ -1899,3 +1899,4 @@ EnemyNpcHit;0x80077F70
EnemyNpcDefeat;0x8007809C
D_80078DB0;0x80078DB0
D_80078DB4;0x80078DB4
gMusicPlayers;0x80159AF0

View File

@ -263,3 +263,5 @@ EnemyNpcDefeat = 0x8007809C;
D_80078DB0 = 0x80078DB0;
D_80078DB4 = 0x80078DB4;
gMusicPlayers = 0x80159AF0;