More, d_snd_file_mgr OK

This commit is contained in:
robojumper
2025-07-04 15:48:00 +02:00
parent 69cdf95057
commit a8690716e6
26 changed files with 479 additions and 112 deletions
+1 -1
View File
@@ -111,7 +111,7 @@ protected:
// a_ prefix to prevent multiple inheritance clashes
/* 0x7D */ u8 a_field_0x7D;
/* 0x7E */ bool mIsDisabled;
/* 0x7F */ u8 a_field_0x7F;
/* 0x7F */ bool mIsDemoActor;
/* 0x80 */ bool mIsPaused;
/* 0x84 */ f32 a_field_0x84;
/* 0x88 */ f32 a_field_0x88;
@@ -23,6 +23,7 @@ public:
bool startSound(u32 soundId, u32 handleIdx);
void calc();
void stopSounds(s32 fadeFrames);
void pauseAllSounds();
private:
bool isPlayingAnySound() const;
+2
View File
@@ -31,9 +31,11 @@ public:
bool playBgm(u32 soundId, s32 fadeFrames, bool paused);
bool prepareBgm(u32 soundId, u32 startOffset);
void pauseAllBgm();
void stopAllBgm(s32 fadeFrames);
dSndBgmSound_c *getSoundHandleForBgm(u32 soundId, u32 startOffset);
bool isPlayingBgmSound() const;
bool isPlayingBgmSoundId(u32 soundId) const;
bool isPreparingBgmSoundId(u32 soundId) const;
+4
View File
@@ -22,6 +22,10 @@ public:
dSndControlPlayerMgr_c();
void setupPlayerControlsGlobal();
void setupPlayerControlsStage();
void setupPlayerControlsStageBgm();
void calc();
static const s32 sNumPlayers;
+3 -2
View File
@@ -148,9 +148,10 @@ enum SndEvent_e {
/* 0x84 */ SND_EVENT_Demo77_01 = 0x84,
/* 0x85 */ SND_EVENT_Demo79_01 = 0x85,
/* 0x86 */ SND_EVENT_0x86 = 0x86,
/* 0x87 */ SND_EVENT_0x87 = 0x87,
/* 0x89 */ SND_EVENT_0x98 = 0x89,
/* 0x88 */ SND_EVENT_0x88 = 0x88,
/* 0x89 */ SND_EVENT_0x89 = 0x89,
};
#endif
+44
View File
@@ -0,0 +1,44 @@
#ifndef D_SND_FILE_MGR_H
#define D_SND_FILE_MGR_H
#include "nw4r/snd/snd_DisposeCallbackManager.h"
#include "nw4r/snd/snd_SoundArchive.h"
#include "nw4r/snd/snd_SoundArchivePlayer.h"
#include "nw4r/snd/snd_SoundHeap.h"
class dSndFileManager : public nw4r::snd::SoundArchivePlayer_FileManager, public nw4r::snd::detail::DisposeCallback {
private:
struct dSndFileManagerGlob {
u32 numFiles;
const void **pData;
const void **pWaveData;
};
static dSndFileManagerGlob sGlob;
public:
dSndFileManager() {
mpGlob = &sGlob;
}
static dSndFileManager *create(nw4r::snd::SoundArchive *pArchive, nw4r::snd::SoundHeap *pHeap);
virtual void const *GetFileAddress(u32) override;
virtual void const *GetFileWaveDataAddress(u32) override;
virtual void InvalidateData(void const *pStart, void const *pEnd) override;
virtual void InvalidateWaveData(void const *pStart, void const *pEnd) override;
virtual ~dSndFileManager() {}
static bool loadFileForSound(const nw4r::snd::SoundArchive &pArchive, u32 soundId, nw4r::snd::SoundHeap *pHeap);
static bool isLoadedFileForSound(nw4r::snd::SoundArchivePlayer *pPlayer, u32 soundId);
static bool isLoadedFileAndWaveForBank(nw4r::snd::SoundArchivePlayer *pPlayer, u32 soundId);
static bool isLoadedFileAndWaveForSound(nw4r::snd::SoundArchivePlayer *pPlayer, u32 soundId);
private:
static void clearGlob();
/* 0x10 */ dSndFileManagerGlob *mpGlob;
};
#endif
+29 -13
View File
@@ -8,6 +8,8 @@
#include "nw4r/snd/snd_SoundHandle.h"
#include "nw4r/snd/snd_SoundStartable.h"
class dAcBase_c;
SND_DISPOSER_FORWARD_DECL(dSndPlayerMgr_c);
/**
@@ -44,8 +46,17 @@ public:
void fn_8035E250(u16);
bool fn_8035E2E0();
void fn_8035E310();
void fn_8035E620();
void fn_8035E6E0();
void enterSystemMenu();
void leaveSystemMenu();
void enterCaution();
void leaveCaution();
void setMsgActor(s32 msgIdx, dAcBase_c *actor);
void unsetMsgActor();
void enterMsgWait();
void leaveMsgWait();
u32 getFreeSize();
bool loadDemoArchive(const char *demoArchiveName);
@@ -55,9 +66,10 @@ public:
u32 getSomeUserParam(u32 soundId) const;
nw4r::snd::SoundArchivePlayer &getSoundArchivePlayerForType(s32 sourceType);
bool canUseThisPlayer(s32 sourceType) const;
bool shouldUseDemoPlayer(s32 sourceType) const;
void stopAllSound();
u32 getRemoConSoundVariantDemo(u32 soundId) const;
u32 getRemoConSoundVariant(u32 soundId) const;
enum PlayerMgrFlag_e {
MGR_HBM = 0x1,
@@ -65,8 +77,10 @@ public:
MGR_PAUSE = 0x4,
MGR_MAP = 0x8,
MGR_HELP = 0x10,
MGR_SYSTEM = 0x20,
MGR_MSG_WAIT = 0x40,
MGR_UNK_0x80 = 0x80,
MGR_CAUTION = 0x80,
};
bool checkFlag(u32 mask) const {
@@ -81,14 +95,16 @@ public:
mFlags &= ~mask;
}
u32 getEventMuteMask(u32 id) {
nw4r::snd::SoundArchive *archive;
if (mSoundArchivePlayer.IsAvailable()) {
archive = &mSoundArchive;
const nw4r::snd::SoundArchive *getDemoArchive() const {
if (mDemoSoundArchivePlayer.IsAvailable()) {
return &mDemoSoundArchive;
} else {
archive = dSndMgr_c::GetInstance()->getArchive();
return dSndMgr_c::GetInstance()->getArchive();
}
return archive->GetSoundUserParam(id) & sEventMuteFlagsMask;
}
u32 getEventMuteMask(u32 id) {
return getDemoArchive()->GetSoundUserParam(id) & sEventMuteFlagsMask;
}
enum FanfareUnmuteParam_e {
@@ -179,8 +195,8 @@ private:
nw4r::snd::SoundHandle *pHandle, const char *soundLabel, const nw4r::snd::SoundStartable::StartInfo *pStartInfo
);
/* 0x028 */ nw4r::snd::MemorySoundArchive mSoundArchive;
/* 0x178 */ nw4r::snd::SoundArchivePlayer mSoundArchivePlayer;
/* 0x028 */ nw4r::snd::MemorySoundArchive mDemoSoundArchive;
/* 0x178 */ nw4r::snd::SoundArchivePlayer mDemoSoundArchivePlayer;
};
#endif
+6 -1
View File
@@ -38,6 +38,10 @@ public:
return GetInstance()->mpBoomerangSource;
}
void setMsgSource(dSoundSource_c *source) {
mpMsgSource = source;
}
u8 getField_0x0012() const {
return field_0x0012;
}
@@ -48,6 +52,7 @@ public:
void stopAllSound();
void stopAllNonPlayerSound();
void pauseAllSound();
void incrementEnemyCount() {
field_0x3868++;
@@ -102,7 +107,7 @@ private:
/* 0x3878 */ dSoundSource_c *mpBoomerangSource;
/* 0x387C */ dSoundSource_c *mpTBoatSource;
/* 0x3880 */ dSoundSource_c *field_0x3880; // fi singing related?
/* 0x3884 */ dSoundSource_c *field_0x3884;
/* 0x3884 */ dSoundSource_c *mpMsgSource;
};
#endif
+1 -2
View File
@@ -12,7 +12,6 @@ struct dSndStageInfo {
/* 0x14 */ u32 unk4;
/* 0x18 */ const char *demoName;
static const s32 sNumStageInfos;
static const dSndStageInfo sInfos[];
};
@@ -35,7 +34,7 @@ enum SndStage_e {
/* 0x0E */ SND_STAGE_F300_4_L13,
/* 0x0F */ SND_STAGE_F300_4,
/* 0x10 */ SND_STAGE_F301,
/* 0x11 */ SND_STAGE_F301_1,
/* 0x11 */ SND_STAGE_F301_1,
/* 0x12 */ SND_STAGE_F301_2,
/* 0x13 */ SND_STAGE_F301_3,
/* 0x14 */ SND_STAGE_F301_4_L2,
+19 -7
View File
@@ -104,11 +104,24 @@ public:
bool isActiveDemoMaybe(s32 subtype) const;
bool isInEvent(const char *eventName);
void doMsgStart(s32 idx);
void doMsgEnd();
void doMsgWaitStart();
void doMsgWaitEnd();
private:
void resetOverrides();
void initializeEventCallbacks(const char *name);
bool handleGlobalEvent(const char *name);
bool handleStageEvent(const char *name);
void handleDemoEvent(const char *name);
// Callbacks start
static void cbUnkNoop();
// Callbacks end
u32 getStageTypeFlags(const char *stageName) const;
// ET, FS, or corresponding Sky Keep rooms
static bool isVolcanicDungeon(u32 stageId);
@@ -121,7 +134,6 @@ private:
u32 getStageId(const char *name, s32 layer);
static u32 getStageUnk2(u32 stageId);
static SndEventCallback sEventExecuteCallback;
/* 0x010 */ u32 field_0x010;
@@ -150,7 +162,7 @@ private:
/* 0x080 */ UNKWORD field_0x080;
/* 0x084 */ UNKWORD field_0x084;
/* 0x088 */ UNKWORD field_0x088;
/* 0x08C */ UNKWORD field_0x08C;
/* 0x08C */ s32 mSoundEventId;
/* 0x090 */ UNKWORD field_0x090;
/* 0x094 */ u32 field_0x094;
/* 0x098 */ SizedString<64> field_0x098;
@@ -160,13 +172,13 @@ private:
/* 0x120 */ UNKWORD field_0x120;
/* 0x124 */ UNKWORD field_0x124;
/* 0x128 */ UNKWORD field_0x128;
/* 0x12C */ SizedString<64> field_0x12C;
/* 0x16C */ SizedString<64> field_0x16C;
/* 0x1AC */ SizedString<64> field_0x1AC;
/* 0x1EC */ SizedString<64> field_0x1EC;
/* 0x12C */ SizedString<64> mSeName;
/* 0x16C */ SizedString<64> mBgmName;
/* 0x1AC */ SizedString<64> mFanName;
/* 0x1EC */ SizedString<64> mCmdName;
/* 0x22C */ UNKWORD field_0x22C;
/* 0x230 */ UNKWORD field_0x230;
/* 0x234 */ const SndEventDef *field_0x234;
/* 0x234 */ const SndEventDef *mpSoundEventDef;
/* 0x238 */ UNKWORD field_0x238;
/* 0x23C */ u8 field_0x23C;
/* 0x23D */ u8 field_0x23D;
-1
View File
@@ -16,7 +16,6 @@ extern "C" void fn_8035E000();
extern "C" void fn_8035E860(dSndPlayerMgr_c *);
extern "C" void fn_8035E820(dSndPlayerMgr_c *);
extern "C" void fn_8035E880(dSndPlayerMgr_c *);
extern "C" void fn_8035E790(dSndPlayerMgr_c *, UNKWORD, void *);
#define ENEMY_SOUND_MGR (dSndStateMgr_c::GetInstance())
extern "C" void fn_80362150(dSndStateMgr_c *, u16);