From 93e793ae858d52d492793f83d91c5981be417bb5 Mon Sep 17 00:00:00 2001 From: CreateSource Date: Thu, 22 Oct 2026 13:38:43 -0400 Subject: [PATCH 1/7] minor fixes --- config/HAFE/splits.txt | 2 +- configure.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/HAFE/splits.txt b/config/HAFE/splits.txt index 27c7946..86d5321 100644 --- a/config/HAFE/splits.txt +++ b/config/HAFE/splits.txt @@ -312,7 +312,7 @@ Sound.cpp: .ctors start:0x80179294 end:0x80179298 .bss start:0x801F76C4 end:0x801F76E8 -sound_manager.cpp: +SoundManager.cpp: .text start:0x80041884 end:0x80044AAC .ctors start:0x80179298 end:0x8017929C .data start:0x8019C640 end:0x801B3C80 diff --git a/configure.py b/configure.py index a96183f..cd3f99b 100755 --- a/configure.py +++ b/configure.py @@ -825,6 +825,7 @@ def MatchingFor(*versions): "lib": "MSL_C", "mw_version": "GC/3.0a3", "cflags": [*cflags_msl, "-Cpp_exceptions off"], + "progress_category": "mslc", "objects": [ Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/e_acos.c"), Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/e_asin.c"), From f4c92600dc47783b48ca48f1d1326170192042bc Mon Sep 17 00:00:00 2001 From: CreateSource Date: Wed, 14 Oct 2026 21:34:34 -0400 Subject: [PATCH 2/7] split and complete Tween, start unknown class --- config/HAFE/symbols.txt | 2 +- src/Unk.cpp | 0 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 src/Unk.cpp diff --git a/config/HAFE/symbols.txt b/config/HAFE/symbols.txt index 873c3b2..ab49cea 100644 --- a/config/HAFE/symbols.txt +++ b/config/HAFE/symbols.txt @@ -812,7 +812,7 @@ SetRotateZ__FPA4_ff = .text:0x80036968; // type:function size:0x10 fn_80036978 = .text:0x80036978; // type:function size:0x1C __ct__5TweenFv = .text:0x80036994; // type:function size:0x14 Update__5TweenFv = .text:0x800369A8; // type:function size:0x4C -fn_800369F4 = .text:0x800369F4; // type:function size:0x198 +__ct__3UnkFv = .text:0x800369F4; // type:function size:0x198 fn_80036B8C = .text:0x80036B8C; // type:function size:0xC fn_80036B98 = .text:0x80036B98; // type:function size:0xC fn_80036BA4 = .text:0x80036BA4; // type:function size:0xF0 diff --git a/src/Unk.cpp b/src/Unk.cpp new file mode 100644 index 0000000..e69de29 From 0a01dc414d6b4a9a822d175eb03dc9005232433c Mon Sep 17 00:00:00 2001 From: CreateSource Date: Wed, 14 Oct 2026 21:42:39 -0400 Subject: [PATCH 3/7] remove Unk --- config/HAFE/symbols.txt | 2 +- src/Unk.cpp | 0 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 src/Unk.cpp diff --git a/config/HAFE/symbols.txt b/config/HAFE/symbols.txt index ab49cea..873c3b2 100644 --- a/config/HAFE/symbols.txt +++ b/config/HAFE/symbols.txt @@ -812,7 +812,7 @@ SetRotateZ__FPA4_ff = .text:0x80036968; // type:function size:0x10 fn_80036978 = .text:0x80036978; // type:function size:0x1C __ct__5TweenFv = .text:0x80036994; // type:function size:0x14 Update__5TweenFv = .text:0x800369A8; // type:function size:0x4C -__ct__3UnkFv = .text:0x800369F4; // type:function size:0x198 +fn_800369F4 = .text:0x800369F4; // type:function size:0x198 fn_80036B8C = .text:0x80036B8C; // type:function size:0xC fn_80036B98 = .text:0x80036B98; // type:function size:0xC fn_80036BA4 = .text:0x80036BA4; // type:function size:0xF0 diff --git a/src/Unk.cpp b/src/Unk.cpp deleted file mode 100644 index e69de29..0000000 From f36e1bc24eed3bc228843a7cc888958b6cfca06b Mon Sep 17 00:00:00 2001 From: CreateSource Date: Thu, 22 Oct 2026 13:25:57 -0400 Subject: [PATCH 4/7] naive sound split --- config/HAFE/splits.txt | 2 +- config/HAFE/symbols.txt | 4 +- include/channel/Sound.h | 3 + include/nw4r/snd/snd_SoundArchivePlayer.h | 1 + include/nw4r/snd/snd_SoundHandle.h | 9 ++ src/SceneBase.cpp | 2 - src/Sound.cpp | 106 ++++++++++++++++++++++ 7 files changed, 122 insertions(+), 5 deletions(-) create mode 100644 src/Sound.cpp diff --git a/config/HAFE/splits.txt b/config/HAFE/splits.txt index 86d5321..76bd97d 100644 --- a/config/HAFE/splits.txt +++ b/config/HAFE/splits.txt @@ -302,7 +302,7 @@ SimpleGlobe.cpp: .ctors start:0x80179290 end:0x80179294 .rodata start:0x8018F730 end:0x8018F7B0 .data start:0x8019C630 end:0x8019C640 - .bss start:0x801F76A0 end:0x801F76C4 + .bss start:0x801F76A0 end:0x801F76C8 .sdata start:0x803301E0 end:0x803301E8 .sbss start:0x80330C28 end:0x80330C34 .sdata2 start:0x80332098 end:0x80332130 diff --git a/config/HAFE/symbols.txt b/config/HAFE/symbols.txt index 873c3b2..6b4a7e0 100644 --- a/config/HAFE/symbols.txt +++ b/config/HAFE/symbols.txt @@ -975,7 +975,7 @@ PlayRotateSound__11SimpleGlobeFUl = .text:0x800410A4; // type:function size:0x11 UpdateWater__11SimpleGlobeFv = .text:0x800411B4; // type:function size:0x4BC __sinit_\SimpleGlobe_cpp = .text:0x80041670; // type:function size:0x94 scope:local __ct__5SoundFPCcPv = .text:0x80041704; // type:function size:0x80 -fn_80041784 = .text:0x80041784; // type:function size:0x8 +SomeAllocFunc__FUl = .text:0x80041784; // type:function size:0x8 __dt__5SoundFv = .text:0x8004178C; // type:function size:0x70 UpdateSound__Fv = .text:0x800417FC; // type:function size:0x4 CalcSound__Fv = .text:0x80041800; // type:function size:0x4 @@ -8584,7 +8584,7 @@ lbl_801F76A0 = .bss:0x801F76A0; // type:object size:0xC lbl_801F76AC = .bss:0x801F76AC; // type:object size:0xC lbl_801F76B8 = .bss:0x801F76B8; // type:object size:0xC lbl_801F76C8 = .bss:0x801F76C8; // type:object size:0xC -gAmbientSounds = .bss:0x801F76D4; // type:object size:0x10 +gAmbientSounds = .bss:0x801F76D4; // type:object size:0x14 lbl_801F76E8 = .bss:0x801F76E8; // type:object size:0x30 align:4 data:float lbl_801F7718 = .bss:0x801F7718; // type:object size:0x28 data:byte VFipdm_disk_set = .bss:0x801F7740; // type:object size:0xB64 scope:global data:2byte diff --git a/include/channel/Sound.h b/include/channel/Sound.h index 4374822..fedec4f 100644 --- a/include/channel/Sound.h +++ b/include/channel/Sound.h @@ -17,6 +17,9 @@ class Sound { void* mHeap; // at 0x4 }; +void UpdateSound(); +void CalcSound(); + void StartSound(nw4r::snd::SoundHandle* handle, u32 id); void StopSound(nw4r::snd::SoundHandle* handle, s32 fadeFrames); void SetSoundVolume(nw4r::snd::SoundHandle* handle, f32 volume); diff --git a/include/nw4r/snd/snd_SoundArchivePlayer.h b/include/nw4r/snd/snd_SoundArchivePlayer.h index 0e9d377..cedccbe 100644 --- a/include/nw4r/snd/snd_SoundArchivePlayer.h +++ b/include/nw4r/snd/snd_SoundArchivePlayer.h @@ -1,5 +1,6 @@ #ifndef NW4R_SND_SOUND_ARCHIVE_PLAYER_H #define NW4R_SND_SOUND_ARCHIVE_PLAYER_H +#include "nw4r/snd/snd_SoundArchiveLoader.h" #include #include diff --git a/include/nw4r/snd/snd_SoundHandle.h b/include/nw4r/snd/snd_SoundHandle.h index c06e3b5..b6e5b88 100644 --- a/include/nw4r/snd/snd_SoundHandle.h +++ b/include/nw4r/snd/snd_SoundHandle.h @@ -114,7 +114,16 @@ class SoundHandle : private ut::NonCopyable { detail::BasicSound* mSound; // at 0x0 }; +void fn_80041884(void* data, void* heap, void *(*alloc_func)(u32), void (*mem_func)(void *)); +void fn_800418A8(u32 arg1, void* data, u32 arg3, void* heap, u32 arg5, void* (*alloc_func)(u32), void (*mem_func)(void*)); +void fn_80041C38(); +void fn_80041F54(); +void fn_800420E4(u8 sound_mode); + } // namespace snd } // namespace nw4r +typedef void *(*SoundAllocFunc)(u32); +typedef void (*SoundMemFunc)(void*); + #endif diff --git a/src/SceneBase.cpp b/src/SceneBase.cpp index 896a4ee..c8a3452 100644 --- a/src/SceneBase.cpp +++ b/src/SceneBase.cpp @@ -40,8 +40,6 @@ struct DragScroll { void PlaySE(s32 id); -void UpdateSound(); -void CalcSound(); extern "C" void HBMStartBlackOut(void); static const u32 sGlyphTextureIds[89] = { diff --git a/src/Sound.cpp b/src/Sound.cpp new file mode 100644 index 0000000..714de6e --- /dev/null +++ b/src/Sound.cpp @@ -0,0 +1,106 @@ +#include "Sound.h" +#include "System.h" +#include "nw4r/snd/snd_DvdSoundArchive.h" +#include "nw4r/snd/snd_FxReverbHi.h" +#include "nw4r/snd/snd_MemorySoundArchive.h" +#include "nw4r/snd/snd_SoundArchive.h" +#include "nw4r/snd/snd_SoundArchivePlayer.h" +#include "nw4r/snd/snd_SoundHandle.h" +#include "nw4r/snd/snd_SoundHeap.h" +#include "nw4r/snd/snd_SoundSystem.h" +#include "revolution/AI/ai.h" +#include "revolution/AX/AX.h" +#include "revolution/OS/OSError.h" +#include "revolution/SC/scapi.h" + +typedef void *(*SoundAllocFunc)(u32); +typedef void (*SoundMemFunc)(void*); + +void *DefaultSoundAlloc(u32 size); +void fn_80041884(void* data, void* heap, void *(*alloc_func)(u32), void (*mem_func)(void *)); +void fn_800418A8(u32 arg1, void* data, u32 arg3, void* heap, u32 arg5, void* (*alloc_func)(u32), void (*mem_func)(void*)); +void fn_80041C38(); +void fn_80041F54(); +void fn_800420E4(u8 sound_mode); + +nw4r::snd::SoundHandle gAmbientSounds[5]; + +Sound::Sound(const char* path, void* heap) { + this->mData = LoadContentFile(gUnk80330B64, path, 0x20, NULL, gMEM2Heap); + this->mHeap = heap; + + if (this->mData) { + fn_80041884(this->mData, this->mHeap, DefaultSoundAlloc, MEM2Free); + fn_800420E4(SCGetSoundMode()); + } +} + +void *DefaultSoundAlloc(u32 size) { + return MEM2Alloc(size, 0x20); +} + +Sound::~Sound() { + if (this->mData) { + fn_80041C38(); + MEM2Free(this->mData); + this->mData = NULL; + } +} + +void UpdateSound() {} + +void CalcSound() { + fn_80041F54(); +} + +void fn_80041884(void* data, void* heap, void* (*alloc_func)(u32), void (*mem_func)(void*)) { + fn_800418A8(1, data, 0, heap, 0, alloc_func, mem_func); +} + +u8 lbl_80330C38 = 0; +u8 lbl_80330C39 = 0; +SoundAllocFunc gAllocFunc = 0; // 0x3C +SoundMemFunc gMemFunc = 0; // 0x40 +void *gMemSoundArchive = NULL; // 0x44 +nw4r::snd::SoundArchivePlayer *gArchivePlayer = NULL; // 0x48 +u32 *gIDK = NULL; // 0x4C, something that inherits SoundArchive... +nw4r::snd::SoundHeap *gSoundHeap = NULL; // 0x50 +nw4r::snd::FxReverbHi *gFxReverb = NULL; // 0x6C + +void fn_800418A8(u8 arg1, void* data, const char *arg3, void* heap, u32 arg5, void* (*alloc_func)(u32), void (*mem_func)(void*)) { + if (lbl_80330C39 != 0) return; + + lbl_80330C39 = 1; + lbl_80330C38 = arg1; + gAllocFunc = alloc_func; + gMemFunc = mem_func; + + nw4r::snd::MemorySoundArchive *mem_sound_archive = NULL; + nw4r::snd::DvdSoundArchive *dvd_sound_archive = NULL; + if (arg1 != 0) { + gMemSoundArchive = mem_sound_archive = new nw4r::snd::MemorySoundArchive(); + } else { + gMemSoundArchive = dvd_sound_archive = new nw4r::snd::DvdSoundArchive(); + } + + gSoundHeap = new nw4r::snd::SoundHeap(); + gArchivePlayer = new nw4r::snd::SoundArchivePlayer(); + gIDK = new u32(0); + gFxReverb = new nw4r::snd::FxReverbHi(); + + if (!AICheckInit()) { + AIInit(NULL); + AXInit(); + } + + nw4r::snd::SoundSystem::InitSoundSystem(4, 3); + + if (lbl_80330C38 != 0) { + mem_sound_archive->Setup(data); + } else { + if (!dvd_sound_archive->Open(arg3)) { + // __LINE__ + OSPanic("sound_manager.cpp", 0x19D, "Cannot open Sound Archive File"); + } + } +} From c349b82c2323fc51702dbcb6c662c004dfbfe0d7 Mon Sep 17 00:00:00 2001 From: CreateSource Date: Thu, 22 Oct 2026 15:31:37 -0400 Subject: [PATCH 5/7] add unfinished SoundManager, match sound (minus weak function) --- config/HAFE/splits.txt | 2 +- config/HAFE/symbols.txt | 14 +++--- configure.py | 1 + include/channel/SoundManager.h | 10 +++++ include/nw4r/snd/snd_SoundHandle.h | 9 ---- src/Sound.cpp | 71 +----------------------------- src/SoundManager.cpp | 61 +++++++++++++++++++++++++ 7 files changed, 81 insertions(+), 87 deletions(-) create mode 100644 include/channel/SoundManager.h create mode 100644 src/SoundManager.cpp diff --git a/config/HAFE/splits.txt b/config/HAFE/splits.txt index 76bd97d..655c0ed 100644 --- a/config/HAFE/splits.txt +++ b/config/HAFE/splits.txt @@ -310,7 +310,7 @@ SimpleGlobe.cpp: Sound.cpp: .text start:0x80041704 end:0x80041884 .ctors start:0x80179294 end:0x80179298 - .bss start:0x801F76C4 end:0x801F76E8 + .bss start:0x801F76C8 end:0x801F76E8 SoundManager.cpp: .text start:0x80041884 end:0x80044AAC diff --git a/config/HAFE/symbols.txt b/config/HAFE/symbols.txt index 6b4a7e0..5e5ce8f 100644 --- a/config/HAFE/symbols.txt +++ b/config/HAFE/symbols.txt @@ -975,20 +975,20 @@ PlayRotateSound__11SimpleGlobeFUl = .text:0x800410A4; // type:function size:0x11 UpdateWater__11SimpleGlobeFv = .text:0x800411B4; // type:function size:0x4BC __sinit_\SimpleGlobe_cpp = .text:0x80041670; // type:function size:0x94 scope:local __ct__5SoundFPCcPv = .text:0x80041704; // type:function size:0x80 -SomeAllocFunc__FUl = .text:0x80041784; // type:function size:0x8 +DefaultSoundAlloc__FUl = .text:0x80041784; // type:function size:0x8 __dt__5SoundFv = .text:0x8004178C; // type:function size:0x70 UpdateSound__Fv = .text:0x800417FC; // type:function size:0x4 CalcSound__Fv = .text:0x80041800; // type:function size:0x4 __sinit_\Sound_cpp = .text:0x80041804; // type:function size:0x58 scope:local -fn_8004185C = .text:0x8004185C; // type:function size:0xC -fn_80041868 = .text:0x80041868; // type:function size:0x1C -fn_80041884 = .text:0x80041884; // type:function size:0x24 +__ct__Q34nw4r3snd11SoundHandleFv = .text:0x8004185C; // type:function size:0xC +__arraydtor$8191 = .text:0x80041868; // type:function size:0x1C +fn_80041884__FPvPvPFUl_PvPFPv_v = .text:0x80041884; // type:function size:0x24 fn_800418A8 = .text:0x800418A8; // type:function size:0x390 -fn_80041C38 = .text:0x80041C38; // type:function size:0x260 +fn_80041C38__Fv = .text:0x80041C38; // type:function size:0x260 fn_80041E98 = .text:0x80041E98; // type:function size:0x40 __dt__Q34nw4r3snd10FxReverbHiFv = .text:0x80041ED8; // type:function size:0x7C scope:weak -fn_80041F54 = .text:0x80041F54; // type:function size:0x190 -fn_800420E4 = .text:0x800420E4; // type:function size:0x4C +fn_80041F54__Fv = .text:0x80041F54; // type:function size:0x190 +fn_800420E4__FUc = .text:0x800420E4; // type:function size:0x4C fn_80042130 = .text:0x80042130; // type:function size:0x224 fn_80042354 = .text:0x80042354; // type:function size:0x1CC PlaySE__Fl = .text:0x80042520; // type:function size:0x120 diff --git a/configure.py b/configure.py index cd3f99b..8e89993 100755 --- a/configure.py +++ b/configure.py @@ -1122,6 +1122,7 @@ def MatchingFor(*versions): Object(Matching, "GlobeView.cpp"), Object(Matching, "SceneBase.cpp", extra_cflags=["-ipa file"]), Object(Matching, "SimpleGlobe.cpp", extra_cflags=["-ipa file"]), + Object(NonMatching, "Sound.cpp"), Object(NonMatching, "GlobeDotsTable.cpp"), ], }, diff --git a/include/channel/SoundManager.h b/include/channel/SoundManager.h new file mode 100644 index 0000000..514114c --- /dev/null +++ b/include/channel/SoundManager.h @@ -0,0 +1,10 @@ +#include "types.h" + +void fn_80041884(void* data, void* heap, void *(*alloc_func)(u32), void (*mem_func)(void *)); +void fn_800418A8(u32 arg1, void* data, u32 arg3, void* heap, u32 arg5, void* (*alloc_func)(u32), void (*mem_func)(void*)); +void fn_80041C38(); +void fn_80041F54(); +void fn_800420E4(u8 sound_mode); + +typedef void *(*SoundAllocFunc)(u32); +typedef void (*SoundMemFunc)(void*); diff --git a/include/nw4r/snd/snd_SoundHandle.h b/include/nw4r/snd/snd_SoundHandle.h index b6e5b88..c06e3b5 100644 --- a/include/nw4r/snd/snd_SoundHandle.h +++ b/include/nw4r/snd/snd_SoundHandle.h @@ -114,16 +114,7 @@ class SoundHandle : private ut::NonCopyable { detail::BasicSound* mSound; // at 0x0 }; -void fn_80041884(void* data, void* heap, void *(*alloc_func)(u32), void (*mem_func)(void *)); -void fn_800418A8(u32 arg1, void* data, u32 arg3, void* heap, u32 arg5, void* (*alloc_func)(u32), void (*mem_func)(void*)); -void fn_80041C38(); -void fn_80041F54(); -void fn_800420E4(u8 sound_mode); - } // namespace snd } // namespace nw4r -typedef void *(*SoundAllocFunc)(u32); -typedef void (*SoundMemFunc)(void*); - #endif diff --git a/src/Sound.cpp b/src/Sound.cpp index 714de6e..47cf1aa 100644 --- a/src/Sound.cpp +++ b/src/Sound.cpp @@ -1,27 +1,10 @@ #include "Sound.h" #include "System.h" -#include "nw4r/snd/snd_DvdSoundArchive.h" -#include "nw4r/snd/snd_FxReverbHi.h" -#include "nw4r/snd/snd_MemorySoundArchive.h" -#include "nw4r/snd/snd_SoundArchive.h" -#include "nw4r/snd/snd_SoundArchivePlayer.h" +#include "SoundManager.h" #include "nw4r/snd/snd_SoundHandle.h" -#include "nw4r/snd/snd_SoundHeap.h" -#include "nw4r/snd/snd_SoundSystem.h" -#include "revolution/AI/ai.h" -#include "revolution/AX/AX.h" -#include "revolution/OS/OSError.h" #include "revolution/SC/scapi.h" -typedef void *(*SoundAllocFunc)(u32); -typedef void (*SoundMemFunc)(void*); - void *DefaultSoundAlloc(u32 size); -void fn_80041884(void* data, void* heap, void *(*alloc_func)(u32), void (*mem_func)(void *)); -void fn_800418A8(u32 arg1, void* data, u32 arg3, void* heap, u32 arg5, void* (*alloc_func)(u32), void (*mem_func)(void*)); -void fn_80041C38(); -void fn_80041F54(); -void fn_800420E4(u8 sound_mode); nw4r::snd::SoundHandle gAmbientSounds[5]; @@ -52,55 +35,3 @@ void UpdateSound() {} void CalcSound() { fn_80041F54(); } - -void fn_80041884(void* data, void* heap, void* (*alloc_func)(u32), void (*mem_func)(void*)) { - fn_800418A8(1, data, 0, heap, 0, alloc_func, mem_func); -} - -u8 lbl_80330C38 = 0; -u8 lbl_80330C39 = 0; -SoundAllocFunc gAllocFunc = 0; // 0x3C -SoundMemFunc gMemFunc = 0; // 0x40 -void *gMemSoundArchive = NULL; // 0x44 -nw4r::snd::SoundArchivePlayer *gArchivePlayer = NULL; // 0x48 -u32 *gIDK = NULL; // 0x4C, something that inherits SoundArchive... -nw4r::snd::SoundHeap *gSoundHeap = NULL; // 0x50 -nw4r::snd::FxReverbHi *gFxReverb = NULL; // 0x6C - -void fn_800418A8(u8 arg1, void* data, const char *arg3, void* heap, u32 arg5, void* (*alloc_func)(u32), void (*mem_func)(void*)) { - if (lbl_80330C39 != 0) return; - - lbl_80330C39 = 1; - lbl_80330C38 = arg1; - gAllocFunc = alloc_func; - gMemFunc = mem_func; - - nw4r::snd::MemorySoundArchive *mem_sound_archive = NULL; - nw4r::snd::DvdSoundArchive *dvd_sound_archive = NULL; - if (arg1 != 0) { - gMemSoundArchive = mem_sound_archive = new nw4r::snd::MemorySoundArchive(); - } else { - gMemSoundArchive = dvd_sound_archive = new nw4r::snd::DvdSoundArchive(); - } - - gSoundHeap = new nw4r::snd::SoundHeap(); - gArchivePlayer = new nw4r::snd::SoundArchivePlayer(); - gIDK = new u32(0); - gFxReverb = new nw4r::snd::FxReverbHi(); - - if (!AICheckInit()) { - AIInit(NULL); - AXInit(); - } - - nw4r::snd::SoundSystem::InitSoundSystem(4, 3); - - if (lbl_80330C38 != 0) { - mem_sound_archive->Setup(data); - } else { - if (!dvd_sound_archive->Open(arg3)) { - // __LINE__ - OSPanic("sound_manager.cpp", 0x19D, "Cannot open Sound Archive File"); - } - } -} diff --git a/src/SoundManager.cpp b/src/SoundManager.cpp new file mode 100644 index 0000000..e4d4586 --- /dev/null +++ b/src/SoundManager.cpp @@ -0,0 +1,61 @@ +#include "SoundManager.h" + +#include "nw4r/snd/snd_DvdSoundArchive.h" +#include "nw4r/snd/snd_FxReverbHi.h" +#include "nw4r/snd/snd_MemorySoundArchive.h" +#include "nw4r/snd/snd_SoundArchivePlayer.h" +#include "nw4r/snd/snd_SoundHeap.h" +#include "nw4r/snd/snd_SoundSystem.h" + +u8 lbl_80330C38 = 0; +u8 lbl_80330C39 = 0; +SoundAllocFunc gAllocFunc = 0; // 0x3C +SoundMemFunc gMemFunc = 0; // 0x40 +void *gMemSoundArchive = NULL; // 0x44 +nw4r::snd::SoundArchivePlayer *gArchivePlayer = NULL; // 0x48 +u32 *gIDK = NULL; // 0x4C, something that inherits SoundArchive... +nw4r::snd::SoundHeap *gSoundHeap = NULL; // 0x50 +nw4r::snd::FxReverbHi *gFxReverb = NULL; // 0x6C + +void fn_80041884(void* data, void* heap, void* (*alloc_func)(u32), void (*mem_func)(void*)) { + fn_800418A8(1, data, 0, heap, 0, alloc_func, mem_func); +} + + +void fn_800418A8(u8 arg1, void* data, const char *arg3, void* heap, u32 arg5, void* (*alloc_func)(u32), void (*mem_func)(void*)) { + if (lbl_80330C39 != 0) return; + + lbl_80330C39 = 1; + lbl_80330C38 = arg1; + gAllocFunc = alloc_func; + gMemFunc = mem_func; + + nw4r::snd::MemorySoundArchive *mem_sound_archive = NULL; + nw4r::snd::DvdSoundArchive *dvd_sound_archive = NULL; + if (arg1 != 0) { + gMemSoundArchive = mem_sound_archive = new nw4r::snd::MemorySoundArchive(); + } else { + gMemSoundArchive = dvd_sound_archive = new nw4r::snd::DvdSoundArchive(); + } + + gSoundHeap = new nw4r::snd::SoundHeap(); + gArchivePlayer = new nw4r::snd::SoundArchivePlayer(); + gIDK = new u32(0); + gFxReverb = new nw4r::snd::FxReverbHi(); + + if (!AICheckInit()) { + AIInit(NULL); + AXInit(); + } + + nw4r::snd::SoundSystem::InitSoundSystem(4, 3); + + if (lbl_80330C38 != 0) { + mem_sound_archive->Setup(data); + } else { + if (!dvd_sound_archive->Open(arg3)) { + // __LINE__ + OSPanic("sound_manager.cpp", 0x19D, "Cannot open Sound Archive File"); + } + } +} From 8346a361b417e7acb23dba8a7e96fccb2ca0babb Mon Sep 17 00:00:00 2001 From: CreateSource Date: Thu, 22 Oct 2026 15:32:57 -0400 Subject: [PATCH 6/7] add SoundManager to configure.py --- configure.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.py b/configure.py index 8e89993..b9ea27b 100755 --- a/configure.py +++ b/configure.py @@ -1105,6 +1105,7 @@ def MatchingFor(*versions): Object(Matching, "main.cpp"), Object(Matching, "DrawUtil.cpp"), Object(Matching, "GlobeDots.cpp"), + Object(NonMatching, "GlobeDotsTable.cpp"), Object(Matching, "WiiConnect24.cpp"), Object(Matching, "WeatherUtil.cpp"), Object(Matching, "ChannelMathData.cpp"), @@ -1123,7 +1124,7 @@ def MatchingFor(*versions): Object(Matching, "SceneBase.cpp", extra_cflags=["-ipa file"]), Object(Matching, "SimpleGlobe.cpp", extra_cflags=["-ipa file"]), Object(NonMatching, "Sound.cpp"), - Object(NonMatching, "GlobeDotsTable.cpp"), + Object(NonMatching, "SoundManager.cpp"), ], }, { From ab4d0a730eb1c2e9bb522680136ee3dff06ffa31 Mon Sep 17 00:00:00 2001 From: CreateSource Date: Thu, 22 Oct 2026 15:39:21 -0400 Subject: [PATCH 7/7] setup SoundManager --- config/HAFE/splits.txt | 2 +- config/HAFE/symbols.txt | 14 +++++++------- src/SoundManager.cpp | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/config/HAFE/splits.txt b/config/HAFE/splits.txt index 655c0ed..d06660e 100644 --- a/config/HAFE/splits.txt +++ b/config/HAFE/splits.txt @@ -318,7 +318,7 @@ SoundManager.cpp: .data start:0x8019C640 end:0x801B3C80 .bss start:0x801F76E8 end:0x801F7740 .sdata start:0x803301E8 end:0x803301F0 - .sbss start:0x80330C34 end:0x80330C88 + .sbss start:0x80330C38 end:0x80330C88 .sdata2 start:0x80332130 end:0x80332150 revolution/CNT/cnt.c: diff --git a/config/HAFE/symbols.txt b/config/HAFE/symbols.txt index 5e5ce8f..b1945d9 100644 --- a/config/HAFE/symbols.txt +++ b/config/HAFE/symbols.txt @@ -983,7 +983,7 @@ __sinit_\Sound_cpp = .text:0x80041804; // type:function size:0x58 scope:local __ct__Q34nw4r3snd11SoundHandleFv = .text:0x8004185C; // type:function size:0xC __arraydtor$8191 = .text:0x80041868; // type:function size:0x1C fn_80041884__FPvPvPFUl_PvPFPv_v = .text:0x80041884; // type:function size:0x24 -fn_800418A8 = .text:0x800418A8; // type:function size:0x390 +fn_800418A8__FUcPvPCcPvUlPFUl_PvPFPv_v = .text:0x800418A8; // type:function size:0x390 fn_80041C38__Fv = .text:0x80041C38; // type:function size:0x260 fn_80041E98 = .text:0x80041E98; // type:function size:0x40 __dt__Q34nw4r3snd10FxReverbHiFv = .text:0x80041ED8; // type:function size:0x7C scope:weak @@ -9785,13 +9785,13 @@ gRotateSoundHandle = .sbss:0x80330C2C; // type:object size:0x4 data:4byte gGlobeLightColor = .sbss:0x80330C30; // type:object size:0x4 data:byte lbl_80330C38 = .sbss:0x80330C38; // type:object size:0x1 data:byte lbl_80330C39 = .sbss:0x80330C39; // type:object size:0x1 data:byte -lbl_80330C3C = .sbss:0x80330C3C; // type:object size:0x4 data:4byte -lbl_80330C40 = .sbss:0x80330C40; // type:object size:0x4 data:4byte -lbl_80330C44 = .sbss:0x80330C44; // type:object size:0x4 data:4byte -lbl_80330C48 = .sbss:0x80330C48; // type:object size:0x4 data:4byte +gAllocFunc = .sbss:0x80330C3C; // type:object size:0x4 data:4byte +gMemFunc = .sbss:0x80330C40; // type:object size:0x4 data:4byte +gMemSoundArchive = .sbss:0x80330C44; // type:object size:0x4 data:4byte +gArchivePlayer = .sbss:0x80330C48; // type:object size:0x4 data:4byte lbl_80330C4C = .sbss:0x80330C4C; // type:object size:0x4 data:4byte -lbl_80330C50 = .sbss:0x80330C50; // type:object size:0x4 data:4byte -lbl_80330C54 = .sbss:0x80330C54; // type:object size:0x4 data:4byte +gSoundHeap = .sbss:0x80330C50; // type:object size:0x4 data:4byte +gFxReverb = .sbss:0x80330C54; // type:object size:0x4 data:4byte lbl_80330C58 = .sbss:0x80330C58; // type:object size:0x4 data:4byte lbl_80330C5C = .sbss:0x80330C5C; // type:object size:0x4 data:4byte lbl_80330C60 = .sbss:0x80330C60; // type:object size:0x4 data:4byte diff --git a/src/SoundManager.cpp b/src/SoundManager.cpp index e4d4586..df1b7f5 100644 --- a/src/SoundManager.cpp +++ b/src/SoundManager.cpp @@ -13,7 +13,7 @@ SoundAllocFunc gAllocFunc = 0; // 0x3C SoundMemFunc gMemFunc = 0; // 0x40 void *gMemSoundArchive = NULL; // 0x44 nw4r::snd::SoundArchivePlayer *gArchivePlayer = NULL; // 0x48 -u32 *gIDK = NULL; // 0x4C, something that inherits SoundArchive... +u32 *lbl_80330C4C = NULL; // 0x4C, something that inherits SoundArchive... nw4r::snd::SoundHeap *gSoundHeap = NULL; // 0x50 nw4r::snd::FxReverbHi *gFxReverb = NULL; // 0x6C @@ -40,7 +40,7 @@ void fn_800418A8(u8 arg1, void* data, const char *arg3, void* heap, u32 arg5, vo gSoundHeap = new nw4r::snd::SoundHeap(); gArchivePlayer = new nw4r::snd::SoundArchivePlayer(); - gIDK = new u32(0); + lbl_80330C4C = new u32(0); gFxReverb = new nw4r::snd::FxReverbHi(); if (!AICheckInit()) {