mirror of
https://github.com/zeldaret/ss
synced 2026-07-11 22:50:06 -04:00
start matching some d/snd things
This commit is contained in:
+5
-78
@@ -4,6 +4,7 @@
|
||||
#include "UnknownTypeBelongings.h"
|
||||
#include "common.h"
|
||||
#include "d/d_base.h"
|
||||
#include "d/snd/d_snd_source.h"
|
||||
#include "m/m_allocator.h"
|
||||
#include "m/m_angle.h"
|
||||
#include "m/m_vec.h"
|
||||
@@ -13,83 +14,9 @@
|
||||
class dAcBase_c;
|
||||
struct cBgS_PolyInfo;
|
||||
|
||||
struct SoundSource {
|
||||
virtual ~SoundSource() {}
|
||||
// TODO there's probably multiple inheritance involved and stuff
|
||||
#define SOUNDSOURCE_VIRTUAL(offset) virtual void vt_##offset();
|
||||
|
||||
SOUNDSOURCE_VIRTUAL(0x0C);
|
||||
SOUNDSOURCE_VIRTUAL(0x10);
|
||||
SOUNDSOURCE_VIRTUAL(0x14);
|
||||
SOUNDSOURCE_VIRTUAL(0x18);
|
||||
SOUNDSOURCE_VIRTUAL(0x1C);
|
||||
SOUNDSOURCE_VIRTUAL(0x20);
|
||||
SOUNDSOURCE_VIRTUAL(0x24);
|
||||
SOUNDSOURCE_VIRTUAL(0x28);
|
||||
SOUNDSOURCE_VIRTUAL(0x2C);
|
||||
SOUNDSOURCE_VIRTUAL(0x30);
|
||||
SOUNDSOURCE_VIRTUAL(0x34);
|
||||
SOUNDSOURCE_VIRTUAL(0x38);
|
||||
SOUNDSOURCE_VIRTUAL(0x3C);
|
||||
SOUNDSOURCE_VIRTUAL(0x40);
|
||||
SOUNDSOURCE_VIRTUAL(0x44);
|
||||
virtual bool shutdown(); // 0x48
|
||||
SOUNDSOURCE_VIRTUAL(0x4C);
|
||||
SOUNDSOURCE_VIRTUAL(0x50);
|
||||
SOUNDSOURCE_VIRTUAL(0x54);
|
||||
SOUNDSOURCE_VIRTUAL(0x58);
|
||||
SOUNDSOURCE_VIRTUAL(0x5C);
|
||||
SOUNDSOURCE_VIRTUAL(0x60);
|
||||
SOUNDSOURCE_VIRTUAL(0x64);
|
||||
SOUNDSOURCE_VIRTUAL(0x68);
|
||||
SOUNDSOURCE_VIRTUAL(0x6C);
|
||||
SOUNDSOURCE_VIRTUAL(0x70);
|
||||
SOUNDSOURCE_VIRTUAL(0x74);
|
||||
SOUNDSOURCE_VIRTUAL(0x78);
|
||||
SOUNDSOURCE_VIRTUAL(0x7C);
|
||||
SOUNDSOURCE_VIRTUAL(0x80);
|
||||
SOUNDSOURCE_VIRTUAL(0x84);
|
||||
SOUNDSOURCE_VIRTUAL(0x88);
|
||||
SOUNDSOURCE_VIRTUAL(0x8C);
|
||||
SOUNDSOURCE_VIRTUAL(0x90);
|
||||
SOUNDSOURCE_VIRTUAL(0x94);
|
||||
SOUNDSOURCE_VIRTUAL(0x98);
|
||||
SOUNDSOURCE_VIRTUAL(0x9C);
|
||||
SOUNDSOURCE_VIRTUAL(0xA0);
|
||||
SOUNDSOURCE_VIRTUAL(0xA4);
|
||||
SOUNDSOURCE_VIRTUAL(0xA8);
|
||||
SOUNDSOURCE_VIRTUAL(0xAC);
|
||||
SOUNDSOURCE_VIRTUAL(0xB0);
|
||||
SOUNDSOURCE_VIRTUAL(0xB4);
|
||||
SOUNDSOURCE_VIRTUAL(0xB8);
|
||||
SOUNDSOURCE_VIRTUAL(0xBC);
|
||||
SOUNDSOURCE_VIRTUAL(0xC0);
|
||||
SOUNDSOURCE_VIRTUAL(0xC4);
|
||||
SOUNDSOURCE_VIRTUAL(0xC8);
|
||||
SOUNDSOURCE_VIRTUAL(0xCC);
|
||||
SOUNDSOURCE_VIRTUAL(0xD0);
|
||||
SOUNDSOURCE_VIRTUAL(0xD4);
|
||||
SOUNDSOURCE_VIRTUAL(0xD8);
|
||||
SOUNDSOURCE_VIRTUAL(0xDC);
|
||||
SOUNDSOURCE_VIRTUAL(0xE0);
|
||||
SOUNDSOURCE_VIRTUAL(0xE4);
|
||||
SOUNDSOURCE_VIRTUAL(0xE8);
|
||||
SOUNDSOURCE_VIRTUAL(0xEC);
|
||||
SOUNDSOURCE_VIRTUAL(0xF0);
|
||||
SOUNDSOURCE_VIRTUAL(0xF4);
|
||||
SOUNDSOURCE_VIRTUAL(0xF8);
|
||||
SOUNDSOURCE_VIRTUAL(0xFC);
|
||||
|
||||
virtual bool isReadyMaybe(); // 0x100
|
||||
virtual bool load(void *data, const char *name); // 0x104
|
||||
virtual void setFrame(f32 frame); // 0x108
|
||||
virtual void setRate(f32 frame); // 0x10C
|
||||
virtual void set_0x164(UNKWORD val); // 0x114
|
||||
};
|
||||
|
||||
struct SoundInfo {
|
||||
dAcBase_c *actor;
|
||||
SoundSource *sound_source;
|
||||
dSoundSourceIf_c *sound_source;
|
||||
mVec3_c *obj_pos;
|
||||
TListNode<SoundInfo> mLink;
|
||||
};
|
||||
@@ -143,7 +70,7 @@ public:
|
||||
/* 0x68 */ mHeapAllocator_c heap_allocator;
|
||||
/* 0x84 */ ObjInfo *obj_info;
|
||||
/* 0x88 */ TList<SoundInfo, 12> sound_list;
|
||||
/* 0x94 */ RaiiPtr<SoundSource> sound_source;
|
||||
/* 0x94 */ RaiiPtr<dSoundSourceIf_c> sound_source;
|
||||
/* 0x98 */ mVec3_c *obj_pos;
|
||||
/* 0x9C */ mVec3_c pos_copy;
|
||||
/* 0xA8 */ u32 params2;
|
||||
@@ -252,7 +179,7 @@ public:
|
||||
s8 viewClipIdx, ObjInfo *objInfo
|
||||
);
|
||||
|
||||
/* 8002c690 */ SoundSource *FUN_8002c690();
|
||||
/* 8002c690 */ dSoundSourceIf_c *FUN_8002c690();
|
||||
/* 8002c710 */ int initAllocatorWork1Heap(int size, char *name, int align);
|
||||
/* 8002c720 */ int initAllocator(int size, char *name, EGG::Heap *heap, int align);
|
||||
/* 8002c7b0 */ bool addActorToRoom(s32 roomId);
|
||||
@@ -301,7 +228,7 @@ public:
|
||||
/* 8002d810 */ void FUN_8002d810();
|
||||
/* 8002d830 */ void FUN_8002d830();
|
||||
/* 8002d860 */ void FUN_8002d860(UNKWORD val);
|
||||
/* 8002d880 */ SoundSource *getSoundSource();
|
||||
/* 8002d880 */ dSoundSourceIf_c *getSoundSource();
|
||||
// End of SoundSource stuff
|
||||
|
||||
/* 8002d890 */ void removeSoundInfo(SoundInfo *);
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
#ifndef D_SND_ACTOR_H
|
||||
#define D_SND_ACTOR_H
|
||||
|
||||
#include "common.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
#include "nw4r/snd/snd_Sound3DActor.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
|
||||
class dSnd3DActor_c : public nw4r::snd::Sound3DActor {
|
||||
static const u32 NUM_SOUNDS = 4;
|
||||
|
||||
public:
|
||||
dSnd3DActor_c(UNKTYPE *, u8);
|
||||
|
||||
virtual ~dSnd3DActor_c() {}
|
||||
|
||||
virtual bool d_vt_0x30() {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void d_vt_0x34(const nw4r::math::VEC3 &);
|
||||
|
||||
virtual void d_vt_0x38(bool flag, int fadeFrames) = 0;
|
||||
|
||||
virtual UNKWORD d_vt_0x3C() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual UNKWORD d_vt_0x40() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual UNKWORD d_vt_0x44() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual const nw4r::math::VEC3 &getPositionRelativeToPlayer();
|
||||
virtual f32 getDistanceToPlayer(); // vt 0x4C
|
||||
virtual void updatePositionRelativeToPlayer(); // vt 0x50
|
||||
virtual void updateDistanceToPlayer(); // vt 0x54
|
||||
virtual void d_vt_0x58() = 0;
|
||||
virtual void d_vt_0x5C() = 0;
|
||||
|
||||
void resetFloats();
|
||||
|
||||
bool checkFlag(u16 flag) const {
|
||||
return (mFlags & flag);
|
||||
}
|
||||
|
||||
bool hasPlayingSounds() const;
|
||||
bool isPlayingSound(u32 id);
|
||||
|
||||
const char *soundIdToSoundLabel(u32 soundId) const;
|
||||
u32 soundLabelToSoundId(const char *soundLabel) const;
|
||||
|
||||
protected:
|
||||
// a_ prefix to prevent multiple inheritance clashes
|
||||
/* 0x7D */ u8 a_field_0x7D;
|
||||
/* 0x7E */ u8 a_field_0x7E;
|
||||
/* 0x7F */ u8 a_field_0x7F;
|
||||
/* 0x80 */ u8 a_field_0x80;
|
||||
/* 0x84 */ f32 a_field_0x84;
|
||||
/* 0x88 */ f32 a_field_0x88;
|
||||
/* 0x8C */ f32 a_field_0x8C;
|
||||
/* 0x90 */ f32 a_field_0x90;
|
||||
/* 0x94 */ f32 a_field_0x94;
|
||||
/* 0x98 */ f32 a_field_0x98;
|
||||
/* 0x9C */ f32 a_field_0x9C;
|
||||
/* 0xA0 */ u8 a_0xA0[0xC8 - 0xA0];
|
||||
/* 0xC8 */ UNKTYPE *a_field_0xC8;
|
||||
/* 0xCC */ u16 mFlags;
|
||||
/* 0xD0 */ nw4r::math::VEC3 mPositionRelativeToPlayer;
|
||||
/* 0xDC */ f32 mDistanceToPlayer;
|
||||
/* 0xE0 */ f32 a_field_0xE0;
|
||||
};
|
||||
|
||||
// used at the very least when trying to finish Demise
|
||||
class IsCurrentSoundIdChecker {
|
||||
public:
|
||||
IsCurrentSoundIdChecker(u32 id, bool *pResult) : mSoundId(id), mpResult(pResult) {}
|
||||
~IsCurrentSoundIdChecker() {}
|
||||
|
||||
virtual void operator()(nw4r::snd::SoundHandle &pHandle) {
|
||||
if (mSoundId == pHandle.GetId()) {
|
||||
*mpResult = true;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x04 */ u32 mSoundId;
|
||||
/* 0x08 */ bool *mpResult;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef D_SND_3D_ENGINE
|
||||
#define D_SND_3D_ENGINE
|
||||
|
||||
#include "nw4r/snd/snd_BasicSound.h"
|
||||
#include "nw4r/snd/snd_Sound3DEngine.h"
|
||||
#include "nw4r/snd/snd_Sound3DManager.h"
|
||||
|
||||
class dSnd3DEngine_c : public nw4r::snd::Sound3DEngine {
|
||||
public:
|
||||
dSnd3DEngine_c();
|
||||
|
||||
virtual void UpdateAmbientParam(
|
||||
const nw4r::snd::Sound3DManager *mgr, const nw4r::snd::Sound3DParam *param3d, u32 unk, u32 flags,
|
||||
nw4r::snd::SoundAmbientParam *paramAmb
|
||||
) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,66 @@
|
||||
#ifndef D_SND_3D_MANAGER_H
|
||||
#define D_SND_3D_MANAGER_H
|
||||
|
||||
#include "d/snd/d_snd_3d_engine.h"
|
||||
#include "d/snd/d_snd_util.h"
|
||||
#include "egg/gfx/eggCamera.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
#include "nw4r/snd/snd_Sound3DListener.h"
|
||||
#include "nw4r/snd/snd_Sound3DManager.h"
|
||||
|
||||
class dSnd3DManager_c;
|
||||
extern template class SndMgrDisposer<dSnd3DManager_c>;
|
||||
|
||||
class dSnd3DManager_c {
|
||||
public:
|
||||
SndMgrDisposer<dSnd3DManager_c> *GetDisposer() {
|
||||
return &mDisposer;
|
||||
}
|
||||
|
||||
static dSnd3DManager_c *GetInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
static dSnd3DManager_c *sInstance;
|
||||
static SndMgrDisposer<dSnd3DManager_c> *sDisposer;
|
||||
|
||||
private:
|
||||
SndMgrDisposer<dSnd3DManager_c> mDisposer;
|
||||
|
||||
public:
|
||||
dSnd3DManager_c();
|
||||
|
||||
void setup();
|
||||
void updateFromCamera(EGG::LookAtCamera &camera);
|
||||
void setCamDistance(f32 value);
|
||||
void resetCamDistance();
|
||||
void calc();
|
||||
void clearState();
|
||||
|
||||
nw4r::snd::Sound3DManager& getManager() {
|
||||
return mManager;
|
||||
}
|
||||
|
||||
const mVec3_c &getListenerPos() const {
|
||||
return mSoundListenerPosition;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void updateListenerPos(f32);
|
||||
/* 0x10 */ bool mIsSetup;
|
||||
/* 0x11 */ u8 field_0x11;
|
||||
/* 0x14 */ dSnd3DEngine_c *mpEngine;
|
||||
/* 0x18 */ nw4r::snd::Sound3DManager mManager;
|
||||
/* 0x44 */ nw4r::snd::Sound3DListener mListener;
|
||||
/* 0xB0 */ EGG::LookAtCamera mCamera;
|
||||
/* 0x138 */ mVec3_c field_0x138;
|
||||
/* 0x144 */ mVec3_c mSoundListenerPosition;
|
||||
/* 0x150 */ f32 mCameraPosSqVelocity;
|
||||
/* 0x154 */ f32 mCameraAtSqVelocity;
|
||||
/* 0x158 */ f32 mCamDistance;
|
||||
/* 0x15C */ s16 mTimer;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef D_SND_3D_ACTOR_H
|
||||
#define D_SND_3D_ACTOR_H
|
||||
|
||||
#include "nw4r/snd/snd_SoundActor.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
|
||||
class dSndActor_c : public nw4r::snd::SoundActor {
|
||||
public:
|
||||
dSndActor_c(nw4r::snd::SoundArchivePlayer &rPlayer);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef D_SND_CHECKERS_H
|
||||
#define D_SND_CHECKERS_H
|
||||
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
|
||||
class SoundPropertiesChecker {
|
||||
public:
|
||||
virtual void operator()(nw4r::snd::SoundHandle &pHandle);
|
||||
|
||||
private:
|
||||
/* 0x04 */ u32 mSoundId;
|
||||
/* 0x08 */ u32 mPlayCounter;
|
||||
/* 0x0C */ u32 mPauseCounter;
|
||||
/* 0x10 */ u32 mCounter3;
|
||||
/* 0x14 */ u32 mCounter4;
|
||||
/* 0x18 */ u32 *mpPlayCounter;
|
||||
/* 0x1C */ u32 *mpPauseCounter;
|
||||
/* 0x20 */ u32 *mpCounter3;
|
||||
/* 0x24 */ u32 *mpCounter4;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef D_SND_MGR_H
|
||||
#define D_SND_MGR_H
|
||||
|
||||
#include "egg/audio/eggAudioMgr.h"
|
||||
#include "nw4r/snd/snd_SoundArchivePlayer.h"
|
||||
|
||||
class dSndMgr_c : public EGG::SimpleAudioMgr {
|
||||
public:
|
||||
dSndMgr_c();
|
||||
|
||||
virtual void calc() override;
|
||||
void initialize(EGG::Heap *heap, u32 size);
|
||||
void initHbm(u32 frame);
|
||||
|
||||
static void restoreEffectsCallback();
|
||||
|
||||
static dSndMgr_c *GetInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
static nw4r::snd::SoundArchivePlayer* getPlayer() {
|
||||
return sInstance->ArcPlayer::getPlayer();
|
||||
}
|
||||
|
||||
private:
|
||||
static dSndMgr_c *sInstance;
|
||||
|
||||
/* 0x6C8 */ u8 _0x6C8[0x6CC - 0x6C8];
|
||||
/* 0x6CC */ u8 field_0x6CC;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,61 @@
|
||||
#ifndef D_SND_PLAYER_MGR_H
|
||||
#define D_SND_PLAYER_MGR_H
|
||||
|
||||
#include "d/snd/d_snd_util.h"
|
||||
#include "nw4r/snd/snd_MemorySoundArchive.h"
|
||||
#include "nw4r/snd/snd_SoundArchivePlayer.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/snd/snd_SoundStartable.h"
|
||||
|
||||
class dSndPlayerMgr_c;
|
||||
extern template class SndMgrDisposer<dSndPlayerMgr_c>;
|
||||
|
||||
class dSndPlayerMgr_c {
|
||||
public:
|
||||
SndMgrDisposer<dSndPlayerMgr_c> *GetDisposer() {
|
||||
return &mDisposer;
|
||||
}
|
||||
|
||||
static dSndPlayerMgr_c *GetInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
static dSndPlayerMgr_c *sInstance;
|
||||
static SndMgrDisposer<dSndPlayerMgr_c> *sDisposer;
|
||||
|
||||
private:
|
||||
SndMgrDisposer<dSndPlayerMgr_c> mDisposer;
|
||||
|
||||
public:
|
||||
dSndPlayerMgr_c();
|
||||
|
||||
void calc();
|
||||
|
||||
u32 getFreeSize();
|
||||
bool loadDemoArchive(const char *demoArchiveName);
|
||||
const char *getSoundArchivePath();
|
||||
u32 convertLabelStringToSoundId(const char *label) const;
|
||||
nw4r::snd::SoundArchivePlayer &getSoundArchivePlayerForType(u8 type);
|
||||
|
||||
bool checkFlag(u32 mask) const {
|
||||
return mFlags & mask;
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x010 */ u8 field_0x010;
|
||||
/* 0x011 */ u8 field_0x011;
|
||||
/* 0x014 */ s32 field_0x014;
|
||||
/* 0x018 */ s32 field_0x018;
|
||||
/* 0x01C */ s32 field_0x01C;
|
||||
/* 0x020 */ u32 mFlags;
|
||||
|
||||
virtual nw4r::snd::SoundStartable::StartResult
|
||||
startSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const nw4r::snd::SoundStartable::StartInfo *pStartInfo);
|
||||
virtual nw4r::snd::SoundStartable::StartResult
|
||||
startSound(nw4r::snd::SoundHandle *pHandle, const char *soundLabel, const nw4r::snd::SoundStartable::StartInfo *pStartInfo);
|
||||
|
||||
/* 0x028 */ nw4r::snd::MemorySoundArchive mSoundArchive;
|
||||
/* 0x178 */ nw4r::snd::SoundArchivePlayer mSoundArchivePlayer;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,167 @@
|
||||
#ifndef D_SOUND_SOURCE_H
|
||||
#define D_SOUND_SOURCE_H
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_3d_actor.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
|
||||
|
||||
class dAcBase_c;
|
||||
|
||||
class dSoundSourceIf_c {
|
||||
public:
|
||||
virtual ~dSoundSourceIf_c() {}
|
||||
#define SOUNDSOURCE_VIRTUAL(offset) virtual void vt_##offset() = 0;
|
||||
SOUNDSOURCE_VIRTUAL(0x0C);
|
||||
SOUNDSOURCE_VIRTUAL(0x10);
|
||||
SOUNDSOURCE_VIRTUAL(0x14);
|
||||
SOUNDSOURCE_VIRTUAL(0x18);
|
||||
SOUNDSOURCE_VIRTUAL(0x1C);
|
||||
SOUNDSOURCE_VIRTUAL(0x20);
|
||||
SOUNDSOURCE_VIRTUAL(0x24);
|
||||
SOUNDSOURCE_VIRTUAL(0x28);
|
||||
SOUNDSOURCE_VIRTUAL(0x2C);
|
||||
SOUNDSOURCE_VIRTUAL(0x30);
|
||||
SOUNDSOURCE_VIRTUAL(0x34);
|
||||
SOUNDSOURCE_VIRTUAL(0x38);
|
||||
SOUNDSOURCE_VIRTUAL(0x3C);
|
||||
SOUNDSOURCE_VIRTUAL(0x40);
|
||||
SOUNDSOURCE_VIRTUAL(0x44);
|
||||
virtual bool hasPlayingSounds() const = 0; // 0x48
|
||||
SOUNDSOURCE_VIRTUAL(0x4C);
|
||||
SOUNDSOURCE_VIRTUAL(0x50);
|
||||
SOUNDSOURCE_VIRTUAL(0x54);
|
||||
SOUNDSOURCE_VIRTUAL(0x58);
|
||||
SOUNDSOURCE_VIRTUAL(0x5C);
|
||||
SOUNDSOURCE_VIRTUAL(0x60);
|
||||
SOUNDSOURCE_VIRTUAL(0x64);
|
||||
SOUNDSOURCE_VIRTUAL(0x68);
|
||||
SOUNDSOURCE_VIRTUAL(0x6C);
|
||||
SOUNDSOURCE_VIRTUAL(0x70);
|
||||
SOUNDSOURCE_VIRTUAL(0x74);
|
||||
SOUNDSOURCE_VIRTUAL(0x78);
|
||||
SOUNDSOURCE_VIRTUAL(0x7C);
|
||||
SOUNDSOURCE_VIRTUAL(0x80);
|
||||
SOUNDSOURCE_VIRTUAL(0x84);
|
||||
SOUNDSOURCE_VIRTUAL(0x88);
|
||||
SOUNDSOURCE_VIRTUAL(0x8C);
|
||||
SOUNDSOURCE_VIRTUAL(0x90);
|
||||
SOUNDSOURCE_VIRTUAL(0x94);
|
||||
SOUNDSOURCE_VIRTUAL(0x98);
|
||||
SOUNDSOURCE_VIRTUAL(0x9C);
|
||||
SOUNDSOURCE_VIRTUAL(0xA0);
|
||||
SOUNDSOURCE_VIRTUAL(0xA4);
|
||||
SOUNDSOURCE_VIRTUAL(0xA8);
|
||||
SOUNDSOURCE_VIRTUAL(0xAC);
|
||||
SOUNDSOURCE_VIRTUAL(0xB0);
|
||||
SOUNDSOURCE_VIRTUAL(0xB4);
|
||||
SOUNDSOURCE_VIRTUAL(0xB8);
|
||||
SOUNDSOURCE_VIRTUAL(0xBC);
|
||||
SOUNDSOURCE_VIRTUAL(0xC0);
|
||||
SOUNDSOURCE_VIRTUAL(0xC4);
|
||||
SOUNDSOURCE_VIRTUAL(0xC8);
|
||||
SOUNDSOURCE_VIRTUAL(0xCC);
|
||||
SOUNDSOURCE_VIRTUAL(0xD0);
|
||||
SOUNDSOURCE_VIRTUAL(0xD4);
|
||||
SOUNDSOURCE_VIRTUAL(0xD8);
|
||||
SOUNDSOURCE_VIRTUAL(0xDC);
|
||||
SOUNDSOURCE_VIRTUAL(0xE0);
|
||||
SOUNDSOURCE_VIRTUAL(0xE4);
|
||||
SOUNDSOURCE_VIRTUAL(0xE8);
|
||||
SOUNDSOURCE_VIRTUAL(0xEC);
|
||||
SOUNDSOURCE_VIRTUAL(0xF0);
|
||||
SOUNDSOURCE_VIRTUAL(0xF4);
|
||||
SOUNDSOURCE_VIRTUAL(0xF8);
|
||||
SOUNDSOURCE_VIRTUAL(0xFC);
|
||||
|
||||
virtual bool isReadyMaybe() = 0; // 0x100
|
||||
virtual bool load(void *data, const char *name) = 0; // 0x104
|
||||
virtual void setFrame(f32 frame) = 0; // 0x108
|
||||
virtual void setRate(f32 frame) = 0; // 0x10C
|
||||
virtual void set_0x164(UNKWORD val) = 0; // 0x114
|
||||
|
||||
SOUNDSOURCE_VIRTUAL(0x118);
|
||||
SOUNDSOURCE_VIRTUAL(0x11C);
|
||||
};
|
||||
|
||||
class dSoundSource_c : public dSoundSourceIf_c, public dSnd3DActor_c {
|
||||
public:
|
||||
dSoundSource_c(u8, dAcBase_c *, UNKWORD, UNKWORD);
|
||||
virtual ~dSoundSource_c();
|
||||
|
||||
u32 getRemoConSoundVariant(u32 soundId) const;
|
||||
|
||||
// This is where it gets a bit wild and this class starts mixing in overrides between
|
||||
// new virtual functions, which causes the vtable to list these functions in exactly this
|
||||
// order.
|
||||
virtual void d_s_vt_0x17C();
|
||||
virtual void d_s_vt_0x180();
|
||||
virtual void d_s_vt_0x184();
|
||||
virtual void d_s_vt_0x188();
|
||||
virtual void d_s_vt_0x18C();
|
||||
virtual void d_s_vt_0x190();
|
||||
virtual void d_s_vt_0x194();
|
||||
|
||||
virtual void d_vt_0x58() override;
|
||||
|
||||
virtual void d_s_vt_0x19C();
|
||||
virtual void d_s_vt_0x1A0();
|
||||
|
||||
virtual void d_vt_0x5C() override;
|
||||
virtual StartResult
|
||||
SetupSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *) override;
|
||||
|
||||
virtual void d_s_vt_0x1AC();
|
||||
virtual void d_s_vt_0x1B0();
|
||||
virtual void d_s_vt_0x1B4();
|
||||
virtual void d_s_vt_0x1B8();
|
||||
virtual void d_s_vt_0x1BC();
|
||||
virtual void d_s_vt_0x1C0();
|
||||
virtual void d_s_vt_0x1C4(bool flag, int fadeFrames);
|
||||
virtual void d_s_vt_0x1C8();
|
||||
virtual void d_s_vt_0x1CC();
|
||||
|
||||
virtual void d_vt_0x38(bool flag, int fadeFrames) override;
|
||||
|
||||
virtual void d_s_vt_0x1D4();
|
||||
virtual void d_s_vt_0x1D8();
|
||||
virtual void d_s_vt_0x1DC();
|
||||
virtual void d_s_vt_0x1E0();
|
||||
virtual void d_s_vt_0x1E4();
|
||||
virtual void d_s_vt_0x1E8();
|
||||
|
||||
// Overrides of dSoundSourceIf_c
|
||||
virtual bool hasPlayingSounds() const override;
|
||||
|
||||
private:
|
||||
// at 0x00: dSoundSourceIf_c vtable
|
||||
// at 0x04: dSnd3DActor_c sub-object
|
||||
// at 0x58: thunk-vtable
|
||||
/* 0xE8 */ u8 field_0xE8[0xF0 - 0xE8];
|
||||
|
||||
/* 0x0F0 */ UNKWORD field_0x0F0;
|
||||
/* 0x0F4 */ UNKWORD field_0x0F4;
|
||||
/* 0x0F8 */ dAcBase_c *mpPlayer;
|
||||
/* 0x0FC */ u8 field_0x0FC;
|
||||
/* 0x0FD */ u8 field_0x0FD;
|
||||
/* 0x0FE */ u8 field_0x0FE;
|
||||
/* 0x0FF */ u8 field_0x0FF;
|
||||
/* 0x100 */ u8 field_0x100;
|
||||
/* 0x101 */ u8 field_0x101;
|
||||
/* 0x102 */ u8 field_0x102;
|
||||
/* 0x104 */ UNKWORD field_0x104;
|
||||
/* 0x108 */ UNKWORD field_0x108;
|
||||
/* 0x10C */ UNKWORD field_0x10C;
|
||||
/* 0x110 */ nw4r::ut::List field_0x110; // node offset 0xEC
|
||||
/* 0x11C */ UNKWORD field_0x11C;
|
||||
/* 0x120 */ nw4r::ut::List field_0x120; // node offset 0x4
|
||||
/* 0x12C */ nw4r::ut::List field_0x12C; // node offset 0x4
|
||||
/* 0x138 */ nw4r::ut::Node mNode;
|
||||
/* 0x140 */ UNKWORD field_0x140;
|
||||
/* 0x144 */ u8 _0x144[0x154 - 0x144];
|
||||
/* 0x154 */ UNKWORD field_0x154;
|
||||
/* 0x158 */ s16 field_0x158;
|
||||
/* 0x15A */ s16 field_0x15A;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef D_SND_UTIL_H
|
||||
#define D_SND_UTIL_H
|
||||
|
||||
#include "common.h"
|
||||
#include "egg/core/eggDisposer.h"
|
||||
|
||||
// This setup is only inferred. d/snd uses it all over the place.
|
||||
// This works for dSndPlayerMgr_c, which has a vtable of its own but the Disposer at offset 0.
|
||||
// It also works for the factory at 0x80399c20, which calls a base class ctor,
|
||||
// an inline ctor, and has the Disposer at offset 0x18
|
||||
|
||||
template <typename T>
|
||||
struct SndMgrDisposer : public EGG::Disposer {
|
||||
virtual ~SndMgrDisposer();
|
||||
|
||||
static T *create();
|
||||
static void remove();
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
SndMgrDisposer<T>::~SndMgrDisposer() {
|
||||
if (this == T::sDisposer) {
|
||||
remove();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T *SndMgrDisposer<T>::create() {
|
||||
if (T::sInstance == nullptr) {
|
||||
T::sInstance = new T();
|
||||
T::sDisposer = T::sInstance->GetDisposer();
|
||||
}
|
||||
return T::sInstance;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void SndMgrDisposer<T>::remove() {
|
||||
T::sInstance = nullptr;
|
||||
T::sDisposer = nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user