From f307e5106721e8f0dcfb35dd6e4984ba4f18061e Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 17 Oct 2021 15:31:00 +1000 Subject: [PATCH] Decompile audioIsPlaying --- Makefile | 1 + src/include/lib/lib_317f0.h | 2 +- src/include/types.h | 20 +++++++++++++++++++- src/lib/lib_317f0.c | 25 ++++++++----------------- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index ecdad78c3..39dcdf956 100644 --- a/Makefile +++ b/Makefile @@ -103,6 +103,7 @@ G_C_FILES := \ $(shell find src/lib/ultra/audio -name '*.c') \ $(shell find src/lib/naudio -name '*.c') \ src/lib/lib_2fba0.c \ + src/lib/lib_317f0.c \ src/lib/lib_3a100.c \ src/lib/lib_3e730.c \ src/lib/mp3.c \ diff --git a/src/include/lib/lib_317f0.h b/src/include/lib/lib_317f0.h index fa45dedd6..0a18ecd29 100644 --- a/src/include/lib/lib_317f0.h +++ b/src/include/lib/lib_317f0.h @@ -14,7 +14,7 @@ void func00033378(void *fn); u32 func00033390(void); void func00033634(void *fn); u32 func0003364c(void); -u32 audioIsPlaying(struct audiohandle *handle); +bool audioIsPlaying(struct audiohandle *handle); struct audiohandle *func00033820(s32 arg0, s16 soundnum, s32 arg2, s32 arg3, f32 arg4, s32 arg5, s32 arg6, struct audiohandle **handle); void audioStop(struct audiohandle *handle); u32 func00033bc0(void); diff --git a/src/include/types.h b/src/include/types.h index 54ab4cc44..d4a5e62ca 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -2123,7 +2123,25 @@ struct eyespy { }; struct audiohandle { - u32 unk00; + /*0x00*/ u32 unk00; + /*0x04*/ u32 unk04; + /*0x08*/ u32 unk08; + /*0x0c*/ u32 unk0c; + /*0x10*/ u32 unk10; + /*0x14*/ u32 unk14; + /*0x18*/ u32 unk18; + /*0x1c*/ u32 unk1c; + /*0x20*/ u32 unk20; + /*0x24*/ u32 unk24; + /*0x28*/ u32 unk28; + /*0x2c*/ u32 unk2c; + /*0x30*/ u32 unk30; + /*0x34*/ u32 unk34; + /*0x38*/ u32 unk38; + /*0x3c*/ u32 unk3c; + /*0x40*/ u32 unk40; + /*0x44*/ u8 unk44; + /*0x45*/ u8 playing; }; /** diff --git a/src/lib/lib_317f0.c b/src/lib/lib_317f0.c index 16ae565fe..0dd696803 100644 --- a/src/lib/lib_317f0.c +++ b/src/lib/lib_317f0.c @@ -4031,23 +4031,14 @@ glabel func0003364c /* 337ec: 00000000 */ nop ); -GLOBAL_ASM( -glabel audioIsPlaying -/* 337f0: 10800005 */ beqz $a0,.L00033808 -/* 337f4: 00000000 */ nop -/* 337f8: 03e00008 */ jr $ra -/* 337fc: 90820045 */ lbu $v0,0x45($a0) -/* 33800: 10000003 */ b .L00033810 -/* 33804: 00000000 */ nop -.L00033808: -/* 33808: 03e00008 */ jr $ra -/* 3380c: 00001025 */ or $v0,$zero,$zero -.L00033810: -/* 33810: 03e00008 */ jr $ra -/* 33814: 00000000 */ nop -/* 33818: 03e00008 */ jr $ra -/* 3381c: 00000000 */ nop -); +bool audioIsPlaying(struct audiohandle *handle) +{ + if (handle) { + return handle->playing; + } else { + return false; + } +} #if VERSION >= VERSION_NTSC_1_0 GLOBAL_ASM(