BgmLineKeeper progress

This commit is contained in:
shibbo 2024-08-21 18:13:03 -04:00
parent 11c736d69a
commit a499be957c
11 changed files with 359 additions and 13 deletions

View File

@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"label": "decompiled",
"message": "0.2246%",
"message": "0.2353%",
"color": "blue"
}

View File

@ -56089,26 +56089,26 @@ _ZN2al13BgmLineKeeper4initEPNS_15AudioSystemInfoEPKcS4_=00000071008FE720=0000018
_ZN2al13BgmLineKeeper6updateEb=00000071008FE8B0=000001E4=false
_ZN2al13BgmLineKeeper8startBgmERKNS_17BgmPlayingRequestE=00000071008FEAA0=000005C4=false
_ZN2al13BgmLineKeeper16checkIfIslandBgmERKNS_17BgmPlayingRequestE=00000071008FF070=000001D8=false
_ZN2al13BgmLineKeeper13checkPhaseBgmERKNS_17BgmPlayingRequestE=00000071008FF250=000000A4=false
_ZN2al13BgmLineKeeper13checkPhaseBgmERKNS_17BgmPlayingRequestE=00000071008FF250=000000A4=true
_ZN2al13BgmLineKeeper14startIslandBgmERKNS_17BgmPlayingRequestEPNS_7BgmLineEi=00000071008FF300=00000130=false
_ZN2al13BgmLineKeeper10prepareBgmERKNS_17BgmPlayingRequestE=00000071008FF430=000000A0=false
_ZN2al13BgmLineKeeper16startPreparedBgmEPKc=00000071008FF4D0=000000B4=false
_ZN2al13BgmLineKeeper7stopBgmEPKcii=00000071008FF590=000000D8=false
_ZN2al13BgmLineKeeper8pauseBgmEPKci=00000071008FF670=000000A4=false
_ZN2al13BgmLineKeeper9resumeBgmEPKci=00000071008FF720=000000DC=false
_ZN2al13BgmLineKeeper18pauseActiveBgmLineEi=00000071008FF800=0000001C=false
_ZN2al13BgmLineKeeper19resumeActiveBgmLineEi=00000071008FF820=0000001C=false
_ZN2al13BgmLineKeeper18pauseActiveBgmLineEi=00000071008FF800=0000001C=true
_ZN2al13BgmLineKeeper19resumeActiveBgmLineEi=00000071008FF820=0000001C=true
_ZN2al13BgmLineKeeper14pauseIslandBgmEi=00000071008FF840=000000A4=false
_ZNK2al13BgmLineKeeper20getBgmLineByLineNameEPKc=00000071008FF8F0=00000078=false
_ZN2al13BgmLineKeeper15resumeIslandBgmEi=00000071008FF970=000000A4=false
_ZN2al13BgmLineKeeper13pauseOceanBgmEi=00000071008FFA20=000000A4=false
_ZN2al13BgmLineKeeper14resumeOceanBgmEi=00000071008FFAD0=000000A4=false
_ZN2al13BgmLineKeeper20isPauseActiveBgmLineEv=00000071008FFB80=00000020=false
_ZN2al13BgmLineKeeper14stopAllBgmLineEi=00000071008FFBA0=00000060=false
_ZNK2al13BgmLineKeeper20getBgmLineByLineNameEPKc=00000071008FF8F0=00000078=true
_ZN2al13BgmLineKeeper15resumeIslandBgmEi=00000071008FF970=000000A4=true
_ZN2al13BgmLineKeeper13pauseOceanBgmEi=00000071008FFA20=000000A4=true
_ZN2al13BgmLineKeeper14resumeOceanBgmEi=00000071008FFAD0=000000A4=true
_ZN2al13BgmLineKeeper20isPauseActiveBgmLineEv=00000071008FFB80=00000020=true
_ZN2al13BgmLineKeeper14stopAllBgmLineEi=00000071008FFBA0=00000060=true
_ZN2al13BgmLineKeeper17tryStopAllBgmLineEi=00000071008FFC00=000000D8=false
_ZN2al13BgmLineKeeper23tryPauseBgmIfNotPlayingEPKci=00000071008FFCE0=00000138=false
_ZN2al13BgmLineKeeper15changeSituationEPKc=00000071008FFE20=00000064=false
_ZNK2al13BgmLineKeeper16getActiveBgmLineEv=00000071008FFE90=00000044=false
_ZN2al13BgmLineKeeper15changeSituationEPKc=00000071008FFE20=00000064=true
_ZNK2al13BgmLineKeeper16getActiveBgmLineEv=00000071008FFE90=00000044=true
_ZN2al13BgmLineKeeper22changeLineAutoStopModeEPKcb=00000071008FFEE0=00000078=false
_ZN2al13BgmLineKeeper17setActiveBgmPitchEf=00000071008FFF60=00000060=false
_ZN2al13BgmLineKeeper15clearIslandListEj=00000071008FFFC0=000000E8=false

View File

@ -0,0 +1,26 @@
#pragma once
namespace al {
struct UnkStruct {
int num; // 0x00
};
template <typename T>
class AudioInfoList {
public:
int getInfoNum() const {
int num = _0->num;
if (mInfoList != nullptr) {
return mInfoList->getInfoNum() + num;
}
return num;
}
void sortInfo();
UnkStruct* _0;
AudioInfoList<T>* mInfoList; // 0x08
};
}; // namespace al

View File

@ -9,4 +9,15 @@ namespace al {
bool isEqualString(const sead::SafeString&, const sead::SafeString&);
bool isEqualStringCase(const char*, const char*);
bool isEqualStringCase(const sead::SafeString&, const sead::SafeString&);
template <s32 Length>
class StringTmp : public sead::FixedSafeString<Length> {
public:
StringTmp(const char* pStr, ...) : sead::FixedSafeString<Length>() {
std::va_list va_args;
va_start(va_args, pStr);
sead::FixedSafeString<Length>::formatV(pStr, va_args);
va_end(va_args);
}
};
}; // namespace al

View File

@ -0,0 +1,26 @@
#pragma once
#include <Project/Bgm/BgmRhythmCtrl.hpp>
#include <types.hpp>
namespace al {
class BgmLineKeeper;
class BgmRhythmCtrl;
class SeadAudioPlayer;
class BgmDirector : public IUseActiveBgmLine {
public:
u64* _0;
u64* _8;
SeadAudioPlayer* mAudioPlayer; // 0x10
BgmLineKeeper* mLineKeeper; // 0x18
BgmRhythmCtrl* mRhythmCtrl; // 0x20
f32 _28;
u32 _2C;
u32 _30;
u32 _34;
bool _38;
u8 _39;
bool _3A;
};
}; // namespace al

View File

@ -0,0 +1,22 @@
#pragma once
#include <types.hpp>
namespace al {
class BgmLine {
public:
BgmLine(f32);
void pauseBgm(s32);
void resumeBgm(s32);
const char* getLineName() const;
bool isPause() const;
void stopAllBgmPlayer(s32);
void changeSituation(const char*, bool);
bool isRunning() const;
};
}; // namespace al

View File

@ -0,0 +1,83 @@
#pragma once
#include <container/seadPtrArray.hpp>
#include <types.hpp>
#include "Project/Audio/AudioInfoList.hpp"
#include "Project/Bgm/BgmLine.hpp"
namespace al {
struct BgmPlayingRequest {
const char* mName; // 0x00
};
class BgmLineInfo;
class BgmLineKeeper {
public:
BgmLineKeeper(f32);
s32 checkIfIsIslandBgm(const BgmPlayingRequest&);
s32 checkPhaseBgm(const BgmPlayingRequest&);
void pauseActiveBgmLine(s32);
void resumeActiveBgmLine(s32);
BgmLine* getBgmLineByLineName(const char*) const;
void resumeIslandBgm(s32);
void pauseOceanBgm(s32);
void resumeOceanBgm(s32);
bool isPauseActiveBgmLine();
void stopAllBgmLine(s32);
bool tryStopAllBgmLine(f32);
void changeSituation(const char*);
BgmLine* getActiveBgmLine() const;
sead::PtrArray<BgmLine>* mLines = nullptr; // 0x00
u64* _8 = nullptr;
AudioInfoList<BgmLineInfo>* _10 = nullptr;
u32 mCurrentLine = 0; // 0x18
u8 _1C = 0;
u8 _1D = 0;
u8 _1E = 0;
u8 _1F = 0;
u32 _20 = 0;
u32 _24 = 0;
u8 _28 = 0;
u8 _29;
u8 _2A;
u8 _2B;
s32 _2C;
s32 _30;
s32 _34;
s32 _38;
s32 _3C;
s32 _40;
s32 _44;
s32 _48;
s32 _4C;
s32 _50;
s32 _54;
s32 _58;
u32 _5C;
const char* _60 = "Dummy";
s32 _68;
s32 _6C;
s32 _70 = -1;
u16 _74 = 0;
u16 _76;
s32 _78 = -1;
s32 _7C = -1;
u32 _80 = 0;
u8 _84 = 0;
u8 _85;
u8 _86;
u8 _87;
s32 _88 = -1;
f32 _8C;
s32 _90 = -1;
s32 _94 = -1;
u8 _98 = 0;
u8 _99 = 0;
};
}; // namespace al

View File

@ -0,0 +1,5 @@
#pragma once
namespace al {
class IUseActiveBgmLine {};
}; // namespace al

View File

@ -0,0 +1,168 @@
#include "Project/Bgm/BgmLineKeeper.hpp"
#include "Project/Base/StringUtil.hpp"
namespace al {
BgmLineKeeper::BgmLineKeeper(f32 val) : _8C(val) {}
s32 BgmLineKeeper::checkIfIsIslandBgm(const BgmPlayingRequest& rReq) {
if (rReq.mName == nullptr) {
return -1;
}
if (al::isEqualString(rReq.mName, "Island01")) {
return 0;
}
if (al::isEqualString(rReq.mName, "Island02")) {
return 1;
}
if (al::isEqualString(rReq.mName, "Island03")) {
return 2;
}
if (al::isEqualString(rReq.mName, "Island04")) {
return 3;
}
if (al::isEqualString(rReq.mName, "Island05")) {
return 4;
}
if (al::isEqualString(rReq.mName, "Island06")) {
return 5;
}
if (al::isEqualString(rReq.mName, "Island07")) {
return 6;
}
if (al::isEqualString(rReq.mName, "Island08")) {
return 7;
}
if (al::isEqualString(rReq.mName, "Island09")) {
return 8;
}
if (al::isEqualString(rReq.mName, "Island10")) {
return 9;
}
if (al::isEqualString(rReq.mName, "Island11")) {
return 10;
}
if (al::isEqualString(rReq.mName, "Island12")) {
return 11;
}
return -1;
}
s32 BgmLineKeeper::checkPhaseBgm(const BgmPlayingRequest& rReq) {
if (al::isEqualString(rReq.mName, "Phase1")) {
return 0;
}
if (al::isEqualString(rReq.mName, "Phase2")) {
return 1;
}
if (al::isEqualString(rReq.mName, "Phase3")) {
return 2;
}
if (al::isEqualString(rReq.mName, "Phase4")) {
return 3;
}
return -1;
}
void BgmLineKeeper::pauseActiveBgmLine(s32 idx) {
if (mLines != nullptr) {
mLines->getPtrAt(mCurrentLine)->pauseBgm(idx);
}
}
void BgmLineKeeper::resumeActiveBgmLine(s32 idx) {
if (mLines != nullptr) {
mLines->getPtrAt(mCurrentLine)->resumeBgm(idx);
}
}
BgmLine* BgmLineKeeper::getBgmLineByLineName(const char* pName) const {
if (mLines != nullptr) {
for (s32 i = 0; i < mLines->mNumPtrs; i++) {
auto line = mLines->getPtrAt(i);
if (al::isEqualString(line->getLineName(), pName)) {
return line;
}
}
}
return nullptr;
}
void BgmLineKeeper::resumeIslandBgm(s32 bgm) {
auto line = getBgmLineByLineName("Island");
if (line != nullptr) {
line->resumeBgm(bgm);
}
}
void BgmLineKeeper::pauseOceanBgm(s32 bgm) {
auto line = getBgmLineByLineName("Main");
if (line != nullptr) {
line->pauseBgm(bgm);
}
}
void BgmLineKeeper::resumeOceanBgm(s32 bgm) {
auto line = getBgmLineByLineName("Main");
if (line != nullptr) {
line->resumeBgm(bgm);
}
}
bool BgmLineKeeper::isPauseActiveBgmLine() {
if (mLines != nullptr) {
return mLines->getPtrAt(mCurrentLine)->isPause();
}
return false;
}
void BgmLineKeeper::stopAllBgmLine(s32 bgm) {
if (mLines != nullptr && mLines->mNumPtrs != 0) {
for (u32 i = 0; i < mLines->mNumPtrs; i++) {
auto line = mLines->getPtrAt(i);
line->stopAllBgmPlayer(bgm);
}
}
}
void BgmLineKeeper::changeSituation(const char* pSituation) {
if (mLines != nullptr && mLines->mNumPtrs != 0) {
for (u32 i = 0; i < mLines->mNumPtrs; i++) {
auto line = mLines->getPtrAt(i);
line->changeSituation(pSituation, false);
}
}
}
BgmLine* BgmLineKeeper::getActiveBgmLine() const {
if (mLines != nullptr) {
auto line = mLines->getPtrAt(mCurrentLine);
return line->isRunning() ? line : nullptr;
}
return nullptr;
}
}; // namespace al

View File

@ -39,6 +39,8 @@ namespace sead {
PtrArray(s32 maxNumptrs, T** pBuffer) : PtrArrayImpl(maxNumptrs, pBuffer) {}
T* operator[](s32 idx) const { return getAt(idx); }
T* getPtrAt(s32 idx) { return reinterpret_cast<T*>(this->getAt(idx)); }
T* operator[](s32 idx) const { return getPtrAt(idx); }
};
}; // namespace sead

View File

@ -1,5 +1,6 @@
#pragma once
#include <cstdarg>
#include <types.hpp>
namespace sead {
@ -39,6 +40,8 @@ namespace sead {
void clear() { getString()[0] = SafeStringBase<T>::cNullChar; }
s32 formatV(const T*, std::va_list);
~BufferedSafeStringBase() override = default;
void assureTerminationImpl_() const override;
BufferedSafeStringBase<T>& operator=(const SafeStringBase<T>&);