Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions config/HAFE/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -302,23 +302,23 @@ 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

Sound.cpp:
.text start:0x80041704 end:0x80041884
.ctors start:0x80179294 end:0x80179298
.bss start:0x801F76C4 end:0x801F76E8
.bss start:0x801F76C8 end:0x801F76E8

sound_manager.cpp:
SoundManager.cpp:
.text start:0x80041884 end:0x80044AAC
.ctors start:0x80179298 end:0x8017929C
.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:
Expand Down
30 changes: 15 additions & 15 deletions config/HAFE/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
fn_80041784 = .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
fn_800418A8 = .text:0x800418A8; // type:function size:0x390
fn_80041C38 = .text:0x80041C38; // type:function size:0x260
__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__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
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -1104,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"),
Expand All @@ -1121,7 +1123,8 @@ 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, "GlobeDotsTable.cpp"),
Object(NonMatching, "Sound.cpp"),
Object(NonMatching, "SoundManager.cpp"),
],
},
{
Expand Down
3 changes: 3 additions & 0 deletions include/channel/Sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 10 additions & 0 deletions include/channel/SoundManager.h
Original file line number Diff line number Diff line change
@@ -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*);
1 change: 1 addition & 0 deletions include/nw4r/snd/snd_SoundArchivePlayer.h
Original file line number Diff line number Diff line change
@@ -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 <nw4r/types_nw4r.h>

#include <nw4r/snd/snd_DisposeCallback.h>
Expand Down
2 changes: 0 additions & 2 deletions src/SceneBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ struct DragScroll {

void PlaySE(s32 id);

void UpdateSound();
void CalcSound();
extern "C" void HBMStartBlackOut(void);

static const u32 sGlyphTextureIds[89] = {
Expand Down
37 changes: 37 additions & 0 deletions src/Sound.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "Sound.h"
#include "System.h"
#include "SoundManager.h"
#include "nw4r/snd/snd_SoundHandle.h"
#include "revolution/SC/scapi.h"

void *DefaultSoundAlloc(u32 size);

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();
}
61 changes: 61 additions & 0 deletions src/SoundManager.cpp
Original file line number Diff line number Diff line change
@@ -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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnamed label

u8 lbl_80330C39 = 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnamed label

SoundAllocFunc gAllocFunc = 0; // 0x3C
SoundMemFunc gMemFunc = 0; // 0x40
void *gMemSoundArchive = NULL; // 0x44
nw4r::snd::SoundArchivePlayer *gArchivePlayer = NULL; // 0x48
u32 *lbl_80330C4C = NULL; // 0x4C, something that inherits SoundArchive...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnamed label

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*)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

functions need to be named lol

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();
lbl_80330C4C = 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");
}
}
}
Loading