some progress on StageSwitch classes

This commit is contained in:
shibbo 2024-09-03 20:27:18 -04:00
parent b196bfc718
commit 1b3e5cecf8
17 changed files with 368 additions and 18 deletions

View File

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

View File

@ -54815,9 +54815,9 @@ _ZN2al19StageSwitchDirector7executeEv=00000071008D35E0=00000018=false
_ZN2al15StageSwitchInfoC2Ev=00000071008D3600=0000000C=false
_ZN2al23StageSwitchAccesserListC2Ev=00000071008D3610=00000008=false
_ZN2al23StageSwitchAccesserListC2EPKNS_19StageSwitchAccesserE=00000071008D3620=00000008=false
_ZN2al17StageSwitchKeeperC2Ev=00000071008D3630=00000010=false
_ZN2al17StageSwitchKeeper4initEPNS_19StageSwitchDirectorERKNS_13PlacementInfoE=00000071008D3640=000001A8=false
_ZNK2al17StageSwitchKeeper25tryGetStageSwitchAccesserEPKc=00000071008D37F0=00000098=false
_ZN2al17StageSwitchKeeperC2Ev=00000071008D3630=00000010=true
_ZN2al17StageSwitchKeeper4initEPNS_19StageSwitchDirectorERKNS_13PlacementInfoE=00000071008D3640=000001A8=true
_ZNK2al17StageSwitchKeeper25tryGetStageSwitchAccesserEPKc=00000071008D37F0=00000098=true
_ZN2al17StageSwitchKeeper15isUsingSwitchNoEi=00000071008D3890=0000004C=false
_ZN2al19StageSwitchAccesserC2Ev=00000071008D38E0=0000001C=false
_ZN2al19StageSwitchAccesser4initEPNS_19StageSwitchDirectorEPKcRKNS_11PlacementIdEb=00000071008D3900=000000C8=false
@ -54866,16 +54866,16 @@ _ZN2al24listenStageSwitchOnStartEPNS_15IUseStageSwitchERKNS_11FunctorBaseE=00000
_ZN2al27listenStageSwitchOnOffStartEPNS_15IUseStageSwitchERKNS_11FunctorBaseES4_=00000071008D4870=00000014=false
_ZN2al23listenStageSwitchOnStopEPNS_15IUseStageSwitchERKNS_11FunctorBaseE=00000071008D4890=00000010=false
_ZN2al30listenStageSwitchOnGoalItemGetEPNS_15IUseStageSwitchERKNS_11FunctorBaseE=00000071008D48A0=00000010=false
_ZN2al26StageSwitchFunctorListenerC2Ev=00000071008D48B0=00000018=false
_ZN2al26StageSwitchFunctorListener12setOnFunctorERKNS_11FunctorBaseE=00000071008D48D0=00000030=false
_ZN2al26StageSwitchFunctorListener13setOffFunctorERKNS_11FunctorBaseE=00000071008D4900=00000030=false
_ZN2al26StageSwitchFunctorListener8listenOnEv=00000071008D4930=00000018=false
_ZN2al26StageSwitchFunctorListener9listenOffEv=00000071008D4950=00000018=false
_ZN2al18StageSwitchWatcherC2EPNS_19StageSwitchListenerEPNS_19StageSwitchAccesserE=00000071008D4970=00000018=false
_ZN2al18StageSwitchWatcher6updateEv=00000071008D4990=00000068=false
_ZN2al24StageSwitchWatcherHolderC2Ei=00000071008D4A00=00000038=false
_ZN2al24StageSwitchWatcherHolder3addEPNS_18StageSwitchWatcherE=00000071008D4A40=0000001C=false
_ZN2al24StageSwitchWatcherHolder8movementEv=00000071008D4A60=00000048=false
_ZN2al26StageSwitchFunctorListenerC2Ev=00000071008D48B0=00000018=true
_ZN2al26StageSwitchFunctorListener12setOnFunctorERKNS_11FunctorBaseE=00000071008D48D0=00000030=true
_ZN2al26StageSwitchFunctorListener13setOffFunctorERKNS_11FunctorBaseE=00000071008D4900=00000030=true
_ZN2al26StageSwitchFunctorListener8listenOnEv=00000071008D4930=00000018=true
_ZN2al26StageSwitchFunctorListener9listenOffEv=00000071008D4950=00000018=true
_ZN2al18StageSwitchWatcherC2EPNS_19StageSwitchListenerEPNS_19StageSwitchAccesserE=00000071008D4970=00000018=true
_ZN2al18StageSwitchWatcher6updateEv=00000071008D4990=00000068=true
_ZN2al24StageSwitchWatcherHolderC2Ei=00000071008D4A00=00000038=true
_ZN2al24StageSwitchWatcherHolder3addEPNS_18StageSwitchWatcherE=00000071008D4A40=0000001C=true
_ZN2al24StageSwitchWatcherHolder8movementEv=00000071008D4A60=00000048=true
_ZN2al9SystemKitC2Ev=00000071008D4AB0=0000002C=false
_ZN2al9SystemKit18createMemorySystemEPN4sead4HeapEmmm=00000071008D4AE0=000000BC=false
_ZN2al9SystemKit16createFileLoaderEib=00000071008D4BA0=00000048=false

View File

@ -7,6 +7,7 @@
namespace al {
class ActorInitInfo;
class PlacementInfo;
class PlacementId;
bool tryGetZoneMatrixTR(sead::Matrix34f*, const ActorInitInfo&);
bool tryGetZoneID(s32*, const PlacementInfo&);
@ -25,13 +26,28 @@ namespace al {
s32 calcLinkChildNum(const PlacementInfo&, const char*);
s32 calcLinkCountClassName(const PlacementInfo&, const char*);
void getLinksInfo(PlacementInfo*, const PlacementInfo&, const char*);
void getLinksInfoByIndex(PlacementInfo*, const ActorInitInfo&, const char*, s32);
bool tryGetPlacementInfoByKey(PlacementInfo*, const PlacementInfo&, const char*);
bool isEqualPlacementID(const PlacementInfo&, const PlacementInfo&);
bool isSingleMode(const ActorInitInfo&);
s32 getCountPlacementInfo(const PlacementInfo&);
bool tryGetPlacementID(PlacementId*, const PlacementInfo&);
bool tryGetPlacementInfoAndKeyNameByIndex(PlacementInfo*, const char**, const PlacementInfo&,
s32);
bool tryGetPlacementInfoByIndex(PlacementInfo*, const PlacementInfo&, s32);
bool isClassName(const PlacementInfo&, const char*);
}; // namespace al
namespace alPlacementFunction {

View File

@ -0,0 +1,16 @@
#pragma once
#include <types.hpp>
namespace al {
class PlacementId {
public:
PlacementId();
const char* mID; // 0x00
const char* mUnitConfigName; // 0x08
const char* mZoneID; // 0x10
const char* mCommonID; // 0x18
const char* _20;
};
}; // namespace al

View File

@ -0,0 +1,28 @@
#pragma once
#include <types.hpp>
#include "Library/Placement/PlacementId.hpp"
#include "Library/Placement/PlacementInfo.hpp"
namespace al {
class StageSwitchDirector;
class StageSwitchAccesser {
public:
StageSwitchAccesser();
void init(StageSwitchDirector*, const char*, const PlacementId&, bool);
bool isOnSwitch() const;
inline void setThing(void* ptr) { _8 = ptr; }
StageSwitchDirector* mStageSwitchDirector; // 0x00
void* _8;
const char* mName; // 0x10
u64 _18;
s32 _20;
s32 _24;
bool _28;
};
}; // namespace al

View File

@ -0,0 +1,22 @@
#pragma once
#include "Library/Execute/IUseExecutor.hpp"
namespace al {
class StageSwitchListenerHolder;
class StageSwitchWatcherHolder;
class StageSwitchInfo;
class CameraDirector_RS;
class StageSwitchDirector : public IUseExecutor {
public:
virtual void execute();
StageSwitchInfo** mSwitchInfos; // 0x8
int _10;
int _14;
StageSwitchWatcherHolder* mWatcherHolder; // 0x18
StageSwitchListenerHolder* mListenerHolder; // 0x20
CameraDirector_RS* mCameraDirector; // 0x28
};
}; // namespace al

View File

@ -1,15 +1,22 @@
#pragma once
#include <types.hpp>
#include "Library/Placement/PlacementInfo.hpp"
namespace al {
class StageSwitchAccesser;
class StageSwitchDirector;
class StageSwitchKeeper {
public:
StageSwitchKeeper();
void* _0;
s32 mLinkCount; // 0x8
void init(StageSwitchDirector*, const PlacementInfo&);
StageSwitchAccesser* tryGetStageSwitchAccesser(const char*) const;
StageSwitchAccesser* mAccessors = nullptr; // 0x00
s32 mLinkCount = 0; // 0x8
u32 _C;
void* _10;
void* _10 = nullptr;
};
}; // namespace al

View File

@ -0,0 +1,25 @@
#pragma once
#include "Library/Thread/Functor.hpp"
namespace al {
class StageSwitchListener {
public:
virtual void listenOn() = 0;
virtual void listenOff() = 0;
};
class StageSwitchFunctorListener : public StageSwitchListener {
public:
StageSwitchFunctorListener();
virtual void listenOn();
virtual void listenOff();
void setOnFunctor(const FunctorBase&);
void setOffFunctor(const FunctorBase&);
FunctorBase* mOnFunctor = nullptr; // 0x08
FunctorBase* mOffFunctor = nullptr; // 0x10
};
}; // namespace al

View File

@ -0,0 +1,22 @@
#pragma once
#include <types.hpp>
namespace al {
class StageSwitchListener;
class StageSwitchAccesser;
class CameraDirector_RS;
class StageSwitchWatcher {
public:
StageSwitchWatcher(StageSwitchListener*, StageSwitchAccesser*);
void update();
StageSwitchListener* mListener; // 0x00
StageSwitchAccesser* mAccesser; // 0x08
CameraDirector_RS* mCameraDirector; // 0x10
bool _18 = false;
};
}; // namespace al

View File

@ -0,0 +1,19 @@
#pragma once
#include <types.hpp>
namespace al {
class StageSwitchWatcher;
class StageSwitchWatcherHolder {
public:
StageSwitchWatcherHolder(s32);
void add(StageSwitchWatcher*);
void movement();
StageSwitchWatcher** mWatchers; // 0x00
s32 mNumHolders; // 0x08
s32 mMaxHolders; // 0x0C
};
}; // namespace al

View File

@ -0,0 +1,70 @@
#pragma once
#include <types.hpp>
#include "Library/Execute/IUseExecutor.hpp"
#include "Project/Camera/IUseCameraDirector.hpp"
namespace al {
class SceneCameraCtrl;
class CameraPoserSceneInfo_RS;
class CameraPoserFactory_RS;
class CameraInSwitchOnAreaDirector;
class CameraAngleVerticalRequester;
class CameraTargetCollideInfoHolder;
class CameraTargetHolder;
class CameraInputHolder;
class CameraFlagCtrl;
class CameraParamTransfer;
class CameraTicketHolder;
class CameraStartParamCtrl;
class CameraStopJudge;
class SpecialCameraHolder;
class CameraPoseUpdater;
class CameraResourceHolder;
class ClippingDirectorBase;
class CameraDirector_RS : public IUseExecutor, public IUseCamera {
public:
virtual void execute();
virtual void draw() const;
virtual ~CameraDirector_RS();
virtual SceneCameraInfo* getSceneCameraInfo() const;
int _10;
int _14;
SceneCameraInfo* mSceneCameraInf; // 0x18
SceneCameraCtrl* mSceneCameraCtrl; // 0x20
CameraPoseUpdater** mPoseUpdaters; // 0x28
CameraPoserFactory_RS* mFactory; // 0x30
CameraPoserSceneInfo_RS* mSceneInfo; // 0x38
CameraTicketHolder* mTicketHolder; // 0x40
SpecialCameraHolder* mSpecialCameraHolder; // 0x48
CameraTargetCollideInfoHolder* mCollideInfoHolder; // 0x50
CameraTargetHolder* mTargetHolder; // 0x58
CameraInputHolder* mInputHolder; // 0x60
CameraAngleVerticalRequester* mCameraAngleVerticalReq; // 0x68
CameraStartParamCtrl* mStartParamCtrl; // 0x70
CameraStopJudge* mStopJudge; // 0x78
CameraParamTransfer* mParamTransfer; // 0x80
CameraResourceHolder* mResourceHolder; // 0x88
CameraFlagCtrl* mCameraFlagCtrl; // 0x90
u64 _98;
CameraInSwitchOnAreaDirector* mCameraSwitchOnArea; // 0xA0
u64 _A8;
ClippingDirectorBase* mCLippingDirectorBase; // 0xB0
u64 _B8;
u64 _C0;
u64 _C8;
u64 _D0;
u64 _D8;
u64 _E0;
u64 _E8;
u64 _F0;
u64 _F8;
u8 _100;
u8 _101;
u8 _102;
u8 _103;
u8 _104;
};
}; // namespace al

View File

@ -0,0 +1,48 @@
#include "Library/Stage/StageSwitchKeeper.hpp"
#include "Library/Placement/PlacementFunction.hpp"
#include "Library/Placement/PlacementId.hpp"
#include "Library/Stage/StageSwitchAccesser.hpp"
#include "Project/Base/StringUtil.hpp"
namespace al {
StageSwitchKeeper::StageSwitchKeeper() {}
void StageSwitchKeeper::init(StageSwitchDirector* pDirector, const PlacementInfo& rInfo) {
s32 linkCount = al::calcLinkCountClassName(rInfo, "StageSwitch");
mLinkCount = linkCount;
mAccessors = new StageSwitchAccesser[linkCount];
PlacementInfo linksInfo;
al::tryGetPlacementInfoByKey(&linksInfo, rInfo, "Links");
s32 placementNum = al::getCountPlacementInfo(linksInfo);
s32 curIndex = 0;
for (s32 i = 0; i < placementNum; i++) {
PlacementInfo info;
const char* keyName = nullptr;
al::tryGetPlacementInfoAndKeyNameByIndex(&info, &keyName, linksInfo, i);
PlacementInfo curPlacement;
al::tryGetPlacementInfoByIndex(&curPlacement, info, 0);
if (al::isClassName(curPlacement, "StageSwitch")) {
PlacementId placement;
al::tryGetPlacementID(&placement, curPlacement);
bool isDisaster = false;
al::tryGetArg(&isDisaster, curPlacement, "IsDisasterMode");
mAccessors[curIndex].setThing(_10);
mAccessors[curIndex].init(pDirector, keyName, placement, isDisaster);
curIndex++;
}
}
}
StageSwitchAccesser* StageSwitchKeeper::tryGetStageSwitchAccesser(const char* pName) const {
for (s32 i = 0; i < mLinkCount; i++) {
if (al::isEqualString(pName, mAccessors[i].mName)) {
return &mAccessors[i];
}
}
return nullptr;
}
}; // namespace al

View File

@ -0,0 +1,25 @@
#include "Library/Stage/StageSwitchListener.hpp"
namespace al {
StageSwitchFunctorListener::StageSwitchFunctorListener() {}
void StageSwitchFunctorListener::setOnFunctor(const FunctorBase& rFunc) {
mOnFunctor = rFunc.clone();
}
void StageSwitchFunctorListener::setOffFunctor(const FunctorBase& rFunc) {
mOffFunctor = rFunc.clone();
}
void StageSwitchFunctorListener::listenOn() {
if (mOnFunctor != nullptr) {
(*mOnFunctor)();
}
}
void StageSwitchFunctorListener::listenOff() {
if (mOffFunctor != nullptr) {
(*mOffFunctor)();
}
}
}; // namespace al

View File

@ -0,0 +1,31 @@
#include "Library/Stage/StageSwitchWatcher.hpp"
#include "Library/Stage/StageSwitchAccesser.hpp"
#include "Library/Stage/StageSwitchDirector.hpp"
#include "Library/Stage/StageSwitchListener.hpp"
#include "Project/Camera/CameraDirector_RS.hpp"
namespace al {
StageSwitchWatcher::StageSwitchWatcher(StageSwitchListener* pListener,
StageSwitchAccesser* pAccessor) {
mListener = pListener;
mAccesser = pAccessor;
_18 = false;
mCameraDirector = pAccessor->mStageSwitchDirector->mCameraDirector;
}
void StageSwitchWatcher::update() {
if (!mAccesser->_28 || mCameraDirector->_102) {
bool isOn = mAccesser->isOnSwitch();
if (isOn != _18) {
if (isOn) {
mListener->listenOn();
} else {
mListener->listenOff();
}
}
_18 = isOn;
}
}
}; // namespace al

View File

@ -0,0 +1,21 @@
#include "Library/Stage/StageSwitchWatcherHolder.hpp"
#include "Library/Stage/StageSwitchWatcher.hpp"
namespace al {
StageSwitchWatcherHolder::StageSwitchWatcherHolder(s32 maxHolders) {
mNumHolders = 0;
mMaxHolders = maxHolders;
mWatchers = new StageSwitchWatcher*[maxHolders];
}
void StageSwitchWatcherHolder::add(StageSwitchWatcher* pWatcher) {
mWatchers[mNumHolders] = pWatcher;
mNumHolders++;
}
void StageSwitchWatcherHolder::movement() {
for (s32 i = 0; i < mNumHolders; i++) {
mWatchers[i]->update();
}
}
}; // namespace al

View File

@ -1,7 +1,7 @@
#include "Project/AreaObj/AreaObj.hpp"
#include "Library/Placement/PlacementFunction.hpp"
#include "Library/Stage/StageSwitchFunction.hpp"
#include "Library/Stage/StageSwitchKeeper.hpp"
#include "Library/Stage/SwitchUtil.hpp"
#include "Library/Thread/Functor.hpp"
#include "Project/AreaObj/AreaShapeCube.hpp"
#include "Project/AreaObj/AreaShapeCylinder.hpp"