mirror of
https://github.com/zeldaret/ss
synced 2026-08-31 09:20:48 -04:00
More, d_snd_file_mgr OK
This commit is contained in:
@@ -251,7 +251,7 @@ void dAcBoomerang_c::retrieve() {
|
||||
if (mFader.isStatus(mFaderBase_c::FADED_OUT)) {
|
||||
mFader.setFrame(5);
|
||||
mFader.fadeIn();
|
||||
playSound(SE_BE_COME_BACK);
|
||||
startSound(SE_BE_COME_BACK);
|
||||
}
|
||||
mFader.calc();
|
||||
}
|
||||
@@ -391,7 +391,7 @@ void dAcBoomerang_c::executeState_ReturnWait() {
|
||||
forwardSpeed = 0.f;
|
||||
placeOnArm();
|
||||
if (mAnmChr[BOOMERANG_ANIM_PINCERS].isStop() || !dAcPy_c::GetLink2()->checkActionFlagsCont(0x10)) {
|
||||
playSound(SE_BE_CATCH);
|
||||
startSound(SE_BE_CATCH);
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
}
|
||||
}
|
||||
@@ -439,7 +439,7 @@ void dAcBoomerang_c::initializeState_Move() {
|
||||
|
||||
field_0x8E4.fromXY(angle.x, angle.y, forwardSpeed);
|
||||
|
||||
playSound(SE_BE_THROW);
|
||||
startSound(SE_BE_THROW);
|
||||
dJEffManager_c::spawnUIEffect(PARTICLE_RESOURCE_ID_MAPPING_3_, mVec3_c::Zero, nullptr, nullptr, nullptr, nullptr);
|
||||
field_0x8F0 = mVec3_c::Zero;
|
||||
field_0x8D4 = 0.0f;
|
||||
@@ -484,7 +484,7 @@ void dAcBoomerang_c::executeTimeWarning() {
|
||||
|
||||
flashClr.r = (1.f / (r - 6)) * MAX(0, (mFlashTimer % r) - 5) * 255.f;
|
||||
if (flashClr.r == 0xFF && !mStateMgr.isState(StateID_MoveCancelWait)) {
|
||||
playSound(SE_BE_WARNING);
|
||||
startSound(SE_BE_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,7 +554,7 @@ int dAcBoomerang_c::actorExecute() {
|
||||
if (checkField_0x8CC(FLAG_0x20) && !checkField_0x8CC(FLAG_CANCEL)) {
|
||||
if (mStateMgr.isState(StateID_Move) || mStateMgr.isState(StateID_MoveCancelWait)) {
|
||||
mEff3.createContinuousEffect(PARTICLE_RESOURCE_ID_MAPPING_7_, mWorldMtx, nullptr, nullptr);
|
||||
playSoundEffect1(SE_BE_HIT_LEAVES_LV);
|
||||
holdSound(SE_BE_HIT_LEAVES_LV);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -120,7 +120,7 @@ void dDvdUnk::FontUnk::fn_80052A20() {
|
||||
|
||||
if (checkFlag(FLAG_ERROR_STATE)) {
|
||||
dGfx_c::GetInstance()->releaseTextureBuffer();
|
||||
dSndPlayerMgr_c::GetInstance()->fn_8035E6E0();
|
||||
dSndPlayerMgr_c::GetInstance()->leaveCaution();
|
||||
}
|
||||
|
||||
if (dLytSystemWindow_c::GetInstance() != nullptr && dLytSystemWindow_c::GetInstance()->fn_80152F80()) {
|
||||
@@ -169,11 +169,11 @@ void FontUnk::preExecute() {
|
||||
if (prevError && !isAnyError()) {
|
||||
dGfx_c::GetInstance()->releaseTextureBuffer();
|
||||
offFlag(FLAG_ERROR_STATE);
|
||||
dSndPlayerMgr_c::GetInstance()->fn_8035E6E0();
|
||||
dSndPlayerMgr_c::GetInstance()->leaveCaution();
|
||||
}
|
||||
|
||||
if (field_0x2C == true && !prevError && isAnyError()) {
|
||||
dSndPlayerMgr_c::GetInstance()->fn_8035E620();
|
||||
dSndPlayerMgr_c::GetInstance()->enterCaution();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,7 +222,7 @@ void FontUnk::fn_80052D50() {
|
||||
if (checkFlag(FLAG_ERROR_STATE)) {
|
||||
dGfx_c::GetInstance()->releaseTextureBuffer();
|
||||
mFlags = 0;
|
||||
dSndPlayerMgr_c::GetInstance()->fn_8035E6E0();
|
||||
dSndPlayerMgr_c::GetInstance()->leaveCaution();
|
||||
}
|
||||
dPadManager_c::GetInstance()->init();
|
||||
}
|
||||
|
||||
+1
-1
@@ -338,7 +338,7 @@ void Manage_c::ModeProc_SoftReset() {
|
||||
dScBoot_c::GetInstance()->setField_0x5E3(true);
|
||||
|
||||
dDvdUnk::FontUnk::GetInstance()->fn_800529B0();
|
||||
dSndPlayerMgr_c::GetInstance()->fn_8035E6E0();
|
||||
dSndPlayerMgr_c::GetInstance()->leaveCaution();
|
||||
|
||||
if (dDvdUnk::FontUnk::GetInstance()->isNandError() ||
|
||||
dDvdUnk::FontUnk::GetInstance()->getNandError() != NandResultTracker::ERR_CAT_NONE ||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "d/lyt/d_lyt_util_items.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
#include "f/f_base.h"
|
||||
#include "f/f_manager.h"
|
||||
#include "f/f_profile_name.h"
|
||||
@@ -1572,12 +1573,12 @@ void dTagProcessor_c::somethingWithScrapperAndMusic(wchar_t *src) {
|
||||
if ((ac->profile_name >= fProfile::NPC_SLFB && ac->profile_name <= fProfile::NPC_SLFL) ||
|
||||
(ac->profile_name >= fProfile::NPC_SLB && ac->profile_name <= fProfile::FLY_SLB) ||
|
||||
ac->profile_name == fProfile::NPC_SLB2 || ac->profile_name == fProfile::NPC_DRBC) {
|
||||
fn_8035E790(BGM_MGR, dLytMsgWindow_c::getInstance()->getField_0x784(), ac);
|
||||
dSndPlayerMgr_c::GetInstance()->setMsgActor(dLytMsgWindow_c::getInstance()->getField_0x784(), ac);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (field_0x824 == 101) {
|
||||
fn_8035E790(BGM_MGR, dLytMsgWindow_c::getInstance()->getField_0x784(), nullptr);
|
||||
dSndPlayerMgr_c::GetInstance()->setMsgActor(dLytMsgWindow_c::getInstance()->getField_0x784(), nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ dSnd3DActor_c::dSnd3DActor_c(dSndSourceParam *pSourceParam, s32 sourceType)
|
||||
),
|
||||
a_field_0x7D(0),
|
||||
mIsDisabled(false),
|
||||
a_field_0x7F(0),
|
||||
mIsDemoActor(false),
|
||||
mIsPaused(false),
|
||||
a_field_0x84(0.0f),
|
||||
a_field_0x88(0.0f),
|
||||
@@ -33,8 +33,8 @@ dSnd3DActor_c::dSnd3DActor_c(dSndSourceParam *pSourceParam, s32 sourceType)
|
||||
resetCachedRelativePositions();
|
||||
// Portability hazard
|
||||
SetUserParam(reinterpret_cast<u32>(this));
|
||||
if (dSndPlayerMgr_c::GetInstance()->canUseThisPlayer(sourceType)) {
|
||||
a_field_0x7F = 1;
|
||||
if (dSndPlayerMgr_c::GetInstance()->shouldUseDemoPlayer(sourceType)) {
|
||||
mIsDemoActor = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -255,6 +255,15 @@ void dSndBgmMgr_c::setBgmHandleIdxVolume(u32 handleIdx, f32 volume, s32 fadeFram
|
||||
}
|
||||
}
|
||||
|
||||
bool dSndBgmMgr_c::isPlayingBgmSound() const {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if (mBgmSounds[i]->isPlaying()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool dSndBgmMgr_c::isPlayingBgmSoundId(u32 soundId) const {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if (mBgmSounds[i]->isPlayingSoundId(soundId)) {
|
||||
|
||||
@@ -172,7 +172,7 @@ static const SndEventDef sSndEventDefs_D003_1[] = {
|
||||
#pragma pop
|
||||
|
||||
bool dSndStateMgr_c::handleStageEvent(const char *name) {
|
||||
if (field_0x08C != SND_EVENT_0x87) {
|
||||
if (mSoundEventId != SND_EVENT_0x87) {
|
||||
const SndEventDef *def = nullptr;
|
||||
s32 defCount = 0;
|
||||
|
||||
@@ -226,8 +226,8 @@ bool dSndStateMgr_c::handleStageEvent(const char *name) {
|
||||
if (def != nullptr && defCount > 0) {
|
||||
for (s32 i = 0; i < defCount; def++, i++) {
|
||||
if (streq(name, def->eventName)) {
|
||||
field_0x08C = def->eventId;
|
||||
field_0x234 = def;
|
||||
mSoundEventId = def->eventId;
|
||||
mpSoundEventDef = def;
|
||||
sEventExecuteCallback = def->executeCb;
|
||||
if (def->initializeCb != nullptr) {
|
||||
(def->initializeCb)();
|
||||
@@ -241,12 +241,12 @@ bool dSndStateMgr_c::handleStageEvent(const char *name) {
|
||||
}
|
||||
|
||||
bool dSndStateMgr_c::handleGlobalEvent(const char *name) {
|
||||
if (field_0x08C != SND_EVENT_0x87) {
|
||||
if (mSoundEventId != SND_EVENT_0x87) {
|
||||
for (const SndEventDef *def = sSndEventDefs_GLOBAL;
|
||||
def < sSndEventDefs_GLOBAL + ARRAY_LENGTH(sSndEventDefs_GLOBAL); def++) {
|
||||
if (streq(name, def->eventName)) {
|
||||
field_0x08C = def->eventId;
|
||||
field_0x234 = def;
|
||||
mSoundEventId = def->eventId;
|
||||
mpSoundEventDef = def;
|
||||
sEventExecuteCallback = def->executeCb;
|
||||
if (def->initializeCb != nullptr) {
|
||||
(def->initializeCb)();
|
||||
|
||||
@@ -30,8 +30,8 @@ void dSndStateMgr_c::handleDemoEvent(const char *name) {
|
||||
for (const SndEventDef *def = sSndEventDefs_DEMO; def < sSndEventDefs_DEMO + ARRAY_LENGTH(sSndEventDefs_DEMO);
|
||||
def++) {
|
||||
if (streq(name, def->eventName)) {
|
||||
field_0x08C = def->eventId;
|
||||
field_0x234 = def;
|
||||
mSoundEventId = def->eventId;
|
||||
mpSoundEventDef = def;
|
||||
sEventExecuteCallback = def->executeCb;
|
||||
if (def->initializeCb != nullptr) {
|
||||
(def->initializeCb)();
|
||||
@@ -40,8 +40,8 @@ void dSndStateMgr_c::handleDemoEvent(const char *name) {
|
||||
}
|
||||
}
|
||||
|
||||
if (field_0x08C == SND_EVENT_0x98) {
|
||||
field_0x08C = SND_EVENT_0x78;
|
||||
if (mSoundEventId == SND_EVENT_0x89) {
|
||||
mSoundEventId = SND_EVENT_0x78;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
#include "d/snd/d_snd_file_mgr.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "nw4r/snd/snd_DisposeCallbackManager.h"
|
||||
#include "nw4r/snd/snd_SoundArchive.h"
|
||||
#include "nw4r/snd/snd_SoundArchiveLoader.h"
|
||||
#include "nw4r/snd/snd_SoundArchivePlayer.h"
|
||||
|
||||
dSndFileManager::dSndFileManagerGlob dSndFileManager::sGlob;
|
||||
|
||||
static dSndFileManager sFileManager;
|
||||
|
||||
dSndFileManager *dSndFileManager::create(nw4r::snd::SoundArchive *pArchive, nw4r::snd::SoundHeap *pHeap) {
|
||||
sGlob.numFiles = pArchive->detail_GetFileCount();
|
||||
sGlob.pData = (const void **)pHeap->Alloc(sGlob.numFiles * sizeof(const void *));
|
||||
sGlob.pWaveData = (const void **)pHeap->Alloc(sGlob.numFiles * sizeof(const void *));
|
||||
clearGlob();
|
||||
nw4r::snd::detail::DisposeCallbackManager::GetInstance().RegisterDisposeCallback(&sFileManager);
|
||||
return &sFileManager;
|
||||
}
|
||||
|
||||
void dSndFileManager::clearGlob() {
|
||||
for (u32 i = 0; i < sGlob.numFiles; i++) {
|
||||
sGlob.pData[i] = nullptr;
|
||||
sGlob.pWaveData[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool dSndFileManager::loadFileForSound(const nw4r::snd::SoundArchive &pArchive, u32 soundId, nw4r::snd::SoundHeap *pHeap) {
|
||||
nw4r::snd::SoundArchive::SoundInfo info;
|
||||
if (!pArchive.ReadSoundInfo(soundId, &info)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sGlob.pData[info.fileId] == nullptr) {
|
||||
nw4r::snd::detail::SoundArchiveLoader loader(pArchive);
|
||||
const void *data = loader.LoadFile(info.fileId, pHeap);
|
||||
if (data == nullptr) {
|
||||
return false;
|
||||
}
|
||||
sGlob.pData[info.fileId] = data;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dSndFileManager::isLoadedFileForSound(nw4r::snd::SoundArchivePlayer *pPlayer, u32 soundId) {
|
||||
const nw4r::snd::SoundArchive &pArchive = pPlayer->GetSoundArchive();
|
||||
nw4r::snd::SoundArchive::SoundInfo info;
|
||||
if (!pArchive.ReadSoundInfo(soundId, &info)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pPlayer->detail_GetFileAddress(info.fileId) == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dSndFileManager::isLoadedFileAndWaveForBank(nw4r::snd::SoundArchivePlayer *pPlayer, u32 soundId) {
|
||||
const nw4r::snd::SoundArchive &pArchive = pPlayer->GetSoundArchive();
|
||||
nw4r::snd::SoundArchive::BankInfo info;
|
||||
if (!pArchive.ReadBankInfo(soundId, &info)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pPlayer->detail_GetFileAddress(info.fileId) == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pPlayer->detail_GetFileWaveDataAddress(info.fileId) == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dSndFileManager::isLoadedFileAndWaveForSound(nw4r::snd::SoundArchivePlayer *pPlayer, u32 soundId) {
|
||||
const nw4r::snd::SoundArchive &pArchive = pPlayer->GetSoundArchive();
|
||||
nw4r::snd::SoundArchive::SoundInfo info;
|
||||
if (!pArchive.ReadSoundInfo(soundId, &info)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pPlayer->detail_GetFileAddress(info.fileId) == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pPlayer->detail_GetFileWaveDataAddress(info.fileId) == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void dSndFileManager::InvalidateData(void const *pStart, void const *pEnd) {
|
||||
for (u32 i = 0; i < sGlob.numFiles; i++) {
|
||||
if (pStart <= sGlob.pData[i] && sGlob.pData[i] <= pEnd) {
|
||||
sGlob.pData[i] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndFileManager::InvalidateWaveData(void const *pStart, void const *pEnd) {
|
||||
for (u32 i = 0; i < sGlob.numFiles; i++) {
|
||||
if (pStart <= sGlob.pWaveData[i] && sGlob.pWaveData[i] <= pEnd) {
|
||||
sGlob.pWaveData[i] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// These two might be inline given that the order is reversed
|
||||
|
||||
void const *dSndFileManager::GetFileWaveDataAddress(u32 id) {
|
||||
if (id >= mpGlob->numFiles) {
|
||||
return nullptr;
|
||||
}
|
||||
return mpGlob->pWaveData[id];
|
||||
}
|
||||
|
||||
void const *dSndFileManager::GetFileAddress(u32 id) {
|
||||
if (id >= mpGlob->numFiles) {
|
||||
return nullptr;
|
||||
}
|
||||
return mpGlob->pData[id];
|
||||
}
|
||||
+118
-11
@@ -2,16 +2,23 @@
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/a/d_a_base.h"
|
||||
#include "d/snd/d_snd_area_sound_effect_mgr.h"
|
||||
#include "d/snd/d_snd_bgm_mgr.h"
|
||||
#include "d/snd/d_snd_control_player_mgr.h"
|
||||
#include "d/snd/d_snd_mgr.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "d/snd/d_snd_source.h"
|
||||
#include "d/snd/d_snd_source_enums.h"
|
||||
#include "d/snd/d_snd_source_mgr.h"
|
||||
#include "d/snd/d_snd_state_mgr.h"
|
||||
#include "d/snd/d_snd_wzsound.h"
|
||||
#include "egg/audio/eggAudioRmtSpeakerMgr.h"
|
||||
#include "egg/core/eggDvdRipper.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/snd/snd_SoundStartable.h"
|
||||
#include "sized_string.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
|
||||
const char *dSndPlayerMgr_c::getSoundArchivePath() {
|
||||
return "Sound/WZSound.brsar";
|
||||
@@ -81,6 +88,92 @@ void dSndPlayerMgr_c::shutdown(s32 channel) {
|
||||
EGG::AudioRmtSpeakerMgr::shutdown(channel, nullptr);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::enterSystemMenu() {
|
||||
if (checkFlag(MGR_CAUTION)) {
|
||||
return;
|
||||
}
|
||||
enterPauseState();
|
||||
onFlag(MGR_SYSTEM);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_MENU_IN);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::leaveSystemMenu() {
|
||||
if (checkFlag(MGR_CAUTION)) {
|
||||
return;
|
||||
}
|
||||
leavePauseState();
|
||||
offFlag(MGR_SYSTEM);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::enterCaution() {
|
||||
if (checkFlag(MGR_CAUTION)) {
|
||||
return;
|
||||
}
|
||||
|
||||
s32 frames = 9;
|
||||
if (fn_80364DA0(ENEMY_SOUND_MGR)) {
|
||||
frames = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < dSndControlPlayerMgr_c::sNumPlayers; i++) {
|
||||
if ((u32)i != PLAYER_SMALL_IMPORTANT) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->getPlayer1(i)->PauseAllSound(true, frames);
|
||||
}
|
||||
}
|
||||
|
||||
onFlag(MGR_CAUTION);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_CAUTION_IN);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::leaveCaution() {
|
||||
if (!checkFlag(MGR_CAUTION)) {
|
||||
return;
|
||||
}
|
||||
|
||||
EGG::AudioRmtSpeakerMgr::connectAllByForce();
|
||||
offFlag(MGR_CAUTION);
|
||||
for (int i = 0; i < dSndControlPlayerMgr_c::sNumPlayers; i++) {
|
||||
if ((u32)i != PLAYER_SMALL_IMPORTANT) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->getPlayer1(i)->PauseAllSound(false, 9);
|
||||
}
|
||||
}
|
||||
|
||||
dSndBgmMgr_c::GetInstance()->pauseAllBgm();
|
||||
dSndAreaSoundEffectMgr_c::GetInstance()->pauseAllSounds();
|
||||
dSndSourceMgr_c::GetInstance()->pauseAllSound();
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::setMsgActor(s32 msgIdx, dAcBase_c *actor) {
|
||||
if (actor != nullptr) {
|
||||
dSoundSource_c *source = static_cast<dSoundSource_c *>(actor->getSoundSource());
|
||||
if (source != nullptr) {
|
||||
dSndSmallEffectMgr_c::GetInstance()->setButtonPressSound(source);
|
||||
dSndSourceMgr_c::GetInstance()->setMsgSource(source);
|
||||
} else {
|
||||
dSndSmallEffectMgr_c::GetInstance()->resetButtonPressSound();
|
||||
}
|
||||
} else {
|
||||
dSndSmallEffectMgr_c::GetInstance()->resetButtonPressSound();
|
||||
}
|
||||
dSndStateMgr_c::GetInstance()->doMsgStart(msgIdx);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::unsetMsgActor() {
|
||||
dSndStateMgr_c::GetInstance()->doMsgEnd();
|
||||
dSndSmallEffectMgr_c::GetInstance()->resetButtonPressSound();
|
||||
dSndSourceMgr_c::GetInstance()->setMsgSource(nullptr);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::enterMsgWait() {
|
||||
onFlag(MGR_MSG_WAIT);
|
||||
dSndStateMgr_c::GetInstance()->doMsgWaitStart();
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::leaveMsgWait() {
|
||||
offFlag(MGR_MSG_WAIT);
|
||||
dSndStateMgr_c::GetInstance()->doMsgWaitEnd();
|
||||
}
|
||||
|
||||
nw4r::snd::SoundStartable::StartResult dSndPlayerMgr_c::startSound(
|
||||
nw4r::snd::SoundHandle *pHandle, u32 soundId, const nw4r::snd::SoundStartable::StartInfo *pStartInfo
|
||||
) {
|
||||
@@ -108,19 +201,33 @@ nw4r::snd::SoundStartable::StartResult dSndPlayerMgr_c::startSound(
|
||||
return startSound(pHandle, id, pStartInfo);
|
||||
}
|
||||
|
||||
u32 dSndPlayerMgr_c::getRemoConSoundVariant(u32 soundId) const {
|
||||
const char *label = dSndMgr_c::getSoundLabelString(soundId);
|
||||
SizedString<64> variant;
|
||||
variant.sprintf("%s_RC", label);
|
||||
return sInstance->convertLabelStringToSoundId(variant);
|
||||
}
|
||||
|
||||
u32 dSndPlayerMgr_c::getRemoConSoundVariantDemo(u32 soundId) const {
|
||||
const char *label = getDemoArchive()->GetSoundLabelString(soundId);
|
||||
SizedString<64> variant;
|
||||
variant.sprintf("%s_RC", label);
|
||||
return sInstance->convertLabelStringToSoundId(variant);
|
||||
}
|
||||
|
||||
u32 dSndPlayerMgr_c::convertLabelStringToSoundId(const char *label) const {
|
||||
return dSndMgr_c::GetInstance()->changeNameToId(label);
|
||||
}
|
||||
|
||||
nw4r::snd::SoundArchivePlayer &dSndPlayerMgr_c::getSoundArchivePlayerForType(s32 sourceType) {
|
||||
if (canUseThisPlayer(sourceType)) {
|
||||
return mSoundArchivePlayer;
|
||||
if (shouldUseDemoPlayer(sourceType)) {
|
||||
return mDemoSoundArchivePlayer;
|
||||
}
|
||||
return dSndMgr_c::getPlayer();
|
||||
}
|
||||
|
||||
bool dSndPlayerMgr_c::canUseThisPlayer(s32 sourceType) const {
|
||||
if (!mSoundArchivePlayer.IsAvailable()) {
|
||||
bool dSndPlayerMgr_c::shouldUseDemoPlayer(s32 sourceType) const {
|
||||
if (!mDemoSoundArchivePlayer.IsAvailable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -150,12 +257,12 @@ bool dSndPlayerMgr_c::loadDemoArchive(const char *demoArchiveName) {
|
||||
EGG::DvdRipper::Arg arg(path, (u8 *)buf, nullptr, EGG::DvdRipper::ALLOC_DIR_TOP, 0, &amountRead, &fileSize);
|
||||
void *ptr = EGG::DvdRipper::loadToMainRAM(arg);
|
||||
if (ptr != nullptr) {
|
||||
ok = mSoundArchive.Setup(ptr);
|
||||
ok = mDemoSoundArchive.Setup(ptr);
|
||||
if (ok) {
|
||||
u32 size = mSoundArchivePlayer.GetRequiredMemSize(&mSoundArchive);
|
||||
u32 size = mDemoSoundArchivePlayer.GetRequiredMemSize(&mDemoSoundArchive);
|
||||
void *buf2 = dSndMgr_c::GetInstance()->getSoundHeap()->Alloc(size);
|
||||
if (buf2 != nullptr) {
|
||||
ok = mSoundArchivePlayer.Setup(&mSoundArchive, buf2, size, nullptr, 0);
|
||||
ok = mDemoSoundArchivePlayer.Setup(&mDemoSoundArchive, buf2, size, nullptr, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,13 +273,13 @@ bool dSndPlayerMgr_c::loadDemoArchive(const char *demoArchiveName) {
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::shutdown() {
|
||||
mSoundArchivePlayer.Shutdown();
|
||||
mSoundArchive.Shutdown();
|
||||
mDemoSoundArchivePlayer.Shutdown();
|
||||
mDemoSoundArchive.Shutdown();
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::calc() {
|
||||
if (mSoundArchivePlayer.IsAvailable()) {
|
||||
mSoundArchivePlayer.Update();
|
||||
if (mDemoSoundArchivePlayer.IsAvailable()) {
|
||||
mDemoSoundArchivePlayer.Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ dSoundSourceIf_c *dSndSourceMgr_c::createSource(s32 sourceType, dAcBase_c *actor
|
||||
dSoundSourceIf_c *newSource = nullptr;
|
||||
bool isAnimSource = isAnimSoundSource(sourceType, actualName);
|
||||
bool isMultiSource = isMultiSoundSource(sourceType, actualName);
|
||||
bool isDemo = dSndPlayerMgr_c::GetInstance()->canUseThisPlayer(sourceType);
|
||||
bool isDemo = dSndPlayerMgr_c::GetInstance()->shouldUseDemoPlayer(sourceType);
|
||||
|
||||
if (isDemo) {
|
||||
newSource = new dSndSourceDemo_c(sourceType, actor, actualName, group);
|
||||
@@ -368,7 +368,7 @@ dSndSourceMgr_c::dSndSourceMgr_c()
|
||||
mpBoomerangSource(nullptr),
|
||||
mpTBoatSource(nullptr),
|
||||
field_0x3880(nullptr),
|
||||
field_0x3884(nullptr) {
|
||||
mpMsgSource(nullptr) {
|
||||
// TODO offsetof
|
||||
nw4r::ut::List_Init(&mGroup1List, 0);
|
||||
nw4r::ut::List_Init(&mGroup2List, 0);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_sc_game.h"
|
||||
#include "d/snd/d_snd_event.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
#include "d/snd/d_snd_stage_data.h"
|
||||
#include "egg/core/eggHeap.h"
|
||||
@@ -9,6 +10,7 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
SndEventCallback dSndStateMgr_c::sEventExecuteCallback;
|
||||
SND_DISPOSER_DEFINE(dSndStateMgr_c);
|
||||
|
||||
dSndStateMgr_c::dSndStateMgr_c()
|
||||
@@ -35,7 +37,7 @@ dSndStateMgr_c::dSndStateMgr_c()
|
||||
field_0x080(0),
|
||||
field_0x084(0),
|
||||
field_0x088(0),
|
||||
field_0x08C(0x89),
|
||||
mSoundEventId(SND_EVENT_0x89),
|
||||
field_0x090(0),
|
||||
field_0x094(0),
|
||||
field_0x118(nullptr),
|
||||
@@ -45,7 +47,7 @@ dSndStateMgr_c::dSndStateMgr_c()
|
||||
field_0x128(-1),
|
||||
field_0x22C(0),
|
||||
field_0x230(0),
|
||||
field_0x234(nullptr),
|
||||
mpSoundEventDef(nullptr),
|
||||
field_0x238(-1),
|
||||
field_0x23C(0),
|
||||
field_0x23D(0),
|
||||
@@ -85,8 +87,8 @@ void dSndStateMgr_c::setup(EGG::Heap *pHeap) {
|
||||
}
|
||||
|
||||
void dSndStateMgr_c::onStageOrLayerUpdate() {
|
||||
if (dSndPlayerMgr_c::GetInstance()->checkFlag(dSndPlayerMgr_c::MGR_UNK_0x80)) {
|
||||
dSndPlayerMgr_c::GetInstance()->stopAllSound();
|
||||
if (dSndPlayerMgr_c::GetInstance()->checkFlag(dSndPlayerMgr_c::MGR_CAUTION)) {
|
||||
dSndPlayerMgr_c::GetInstance()->leaveCaution();
|
||||
}
|
||||
|
||||
bool unk_0x065 = field_0x065;
|
||||
@@ -198,3 +200,35 @@ bool dSndStateMgr_c::isSeekerStoneStage(const char *stageName, s32 layer) {
|
||||
bool dSndStateMgr_c::isInStage(const char *stageName) {
|
||||
return !std::strcmp(dScGame_c::currentSpawnInfo.getStageName(), stageName);
|
||||
}
|
||||
|
||||
void dSndStateMgr_c::initializeEventCallbacks(const char *name) {
|
||||
if (name == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
mpSoundEventDef = nullptr;
|
||||
sEventExecuteCallback = nullptr;
|
||||
resetOverrides();
|
||||
|
||||
if (checkFlag0x94(0x2)) {
|
||||
handleDemoEvent(name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mSoundEventId == SND_EVENT_0x87) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!handleStageEvent(name)) {
|
||||
handleGlobalEvent(name);
|
||||
}
|
||||
|
||||
if (mSoundEventId == SND_EVENT_0x89) {
|
||||
if (strstr(name, "Intro")) {
|
||||
mSoundEventId = SND_EVENT_0x88;
|
||||
} else {
|
||||
mSoundEventId = SND_EVENT_0x86;
|
||||
cbUnkNoop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user