diff options
| author | robojumper <robojumper@gmail.com> | 2025-07-04 15:48:00 +0200 |
|---|---|---|
| committer | robojumper <robojumper@gmail.com> | 2025-09-13 10:59:37 +0200 |
| commit | a8690716e6079a878f1c208bf167aaf2f651fc67 (patch) | |
| tree | 325e6fcd63a0388be01d5c218dc8571a3d4159b1 /include/d/snd | |
| parent | 69cdf95057b3b5b10adcbde208d472e4e660c075 (diff) | |
More, d_snd_file_mgr OK
Diffstat (limited to 'include/d/snd')
| -rw-r--r-- | include/d/snd/d_snd_3d_actor.h | 2 | ||||
| -rw-r--r-- | include/d/snd/d_snd_area_sound_effect_mgr.h | 1 | ||||
| -rw-r--r-- | include/d/snd/d_snd_bgm_mgr.h | 2 | ||||
| -rw-r--r-- | include/d/snd/d_snd_control_player_mgr.h | 4 | ||||
| -rw-r--r-- | include/d/snd/d_snd_event.h | 5 | ||||
| -rw-r--r-- | include/d/snd/d_snd_file_mgr.h | 44 | ||||
| -rw-r--r-- | include/d/snd/d_snd_player_mgr.h | 42 | ||||
| -rw-r--r-- | include/d/snd/d_snd_source_mgr.h | 7 | ||||
| -rw-r--r-- | include/d/snd/d_snd_stage_data.h | 3 | ||||
| -rw-r--r-- | include/d/snd/d_snd_state_mgr.h | 26 |
10 files changed, 110 insertions, 26 deletions
diff --git a/include/d/snd/d_snd_3d_actor.h b/include/d/snd/d_snd_3d_actor.h index 58c21675..2228f7d5 100644 --- a/include/d/snd/d_snd_3d_actor.h +++ b/include/d/snd/d_snd_3d_actor.h @@ -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; diff --git a/include/d/snd/d_snd_area_sound_effect_mgr.h b/include/d/snd/d_snd_area_sound_effect_mgr.h index aa4f7f72..3cda1f9b 100644 --- a/include/d/snd/d_snd_area_sound_effect_mgr.h +++ b/include/d/snd/d_snd_area_sound_effect_mgr.h @@ -23,6 +23,7 @@ public: bool startSound(u32 soundId, u32 handleIdx); void calc(); void stopSounds(s32 fadeFrames); + void pauseAllSounds(); private: bool isPlayingAnySound() const; diff --git a/include/d/snd/d_snd_bgm_mgr.h b/include/d/snd/d_snd_bgm_mgr.h index b42d6182..4b5d01f8 100644 --- a/include/d/snd/d_snd_bgm_mgr.h +++ b/include/d/snd/d_snd_bgm_mgr.h @@ -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; diff --git a/include/d/snd/d_snd_control_player_mgr.h b/include/d/snd/d_snd_control_player_mgr.h index 72eef912..bf28f647 100644 --- a/include/d/snd/d_snd_control_player_mgr.h +++ b/include/d/snd/d_snd_control_player_mgr.h @@ -22,6 +22,10 @@ public: dSndControlPlayerMgr_c(); + void setupPlayerControlsGlobal(); + void setupPlayerControlsStage(); + void setupPlayerControlsStageBgm(); + void calc(); static const s32 sNumPlayers; diff --git a/include/d/snd/d_snd_event.h b/include/d/snd/d_snd_event.h index 3094e47a..dafff2d9 100644 --- a/include/d/snd/d_snd_event.h +++ b/include/d/snd/d_snd_event.h @@ -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 diff --git a/include/d/snd/d_snd_file_mgr.h b/include/d/snd/d_snd_file_mgr.h new file mode 100644 index 00000000..dce7d67d --- /dev/null +++ b/include/d/snd/d_snd_file_mgr.h @@ -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 diff --git a/include/d/snd/d_snd_player_mgr.h b/include/d/snd/d_snd_player_mgr.h index 4a6796ee..f5c9a9ee 100644 --- a/include/d/snd/d_snd_player_mgr.h +++ b/include/d/snd/d_snd_player_mgr.h @@ -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 diff --git a/include/d/snd/d_snd_source_mgr.h b/include/d/snd/d_snd_source_mgr.h index ca631a2e..41503455 100644 --- a/include/d/snd/d_snd_source_mgr.h +++ b/include/d/snd/d_snd_source_mgr.h @@ -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 diff --git a/include/d/snd/d_snd_stage_data.h b/include/d/snd/d_snd_stage_data.h index 96dce3d4..ada97ea3 100644 --- a/include/d/snd/d_snd_stage_data.h +++ b/include/d/snd/d_snd_stage_data.h @@ -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, diff --git a/include/d/snd/d_snd_state_mgr.h b/include/d/snd/d_snd_state_mgr.h index e61e961a..36bff333 100644 --- a/include/d/snd/d_snd_state_mgr.h +++ b/include/d/snd/d_snd_state_mgr.h @@ -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; |
