ksys/world: Add Job class stubs

This commit is contained in:
Léo Lam 2021-04-30 13:12:55 +02:00
parent b39e0e5be3
commit 5798b676fd
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
26 changed files with 384 additions and 30 deletions

View File

@ -89223,10 +89223,10 @@
0x00000071010d1394,sub_71010D1394,12,
0x00000071010d13a0,wm::ShootingStarMgr::rtti1,204,
0x00000071010d146c,wm::ShootingStarMgr::rtti2,92,
0x00000071010d14c8,wm::Manager::m7_null,4,
0x00000071010d14cc,wm::Manager::m8_null,4,
0x00000071010d14d0,wm::Manager::m9_null,4,
0x00000071010d14d4,wm::Manager::m10_null,4,
0x00000071010d14c8,wm::Manager::m7_null,4,_ZN4ksys5world3Job10calcType1_Ev
0x00000071010d14cc,wm::Manager::m8_null,4,_ZN4ksys5world3Job10calcType2_Ev
0x00000071010d14d0,wm::Manager::m9_null,4,_ZN4ksys5world3Job2m9Ev
0x00000071010d14d4,wm::Manager::m10_null,4,_ZN4ksys5world3Job3m10Ev
0x00000071010d14d8,wm::ShootingStarMgr::getType,8,
0x00000071010d14e0,nullsub_4531,4,
0x00000071010d14e4,j__ZdlPv_1201,4,
@ -89241,7 +89241,7 @@
0x00000071010d20fc,sub_71010D20FC,24,
0x00000071010d2114,wm::DofMgr::m3,204,
0x00000071010d21e0,wm::DofMgr::m4,92,
0x00000071010d223c,wm::Manager::m11_null,4,
0x00000071010d223c,wm::Manager::m11_null,4,_ZN4ksys5world3Job3m11Ev
0x00000071010d2240,wm::DofMgr::m12,8,
0x00000071010d2248,wm::SkyMgr::ctor,3648,
0x00000071010d3088,WorldMgr::EnvPaletteStatic::ctor,408,
@ -89521,15 +89521,15 @@
0x00000071010f1ba8,ElementDirectionalWindOrGust::m18,8,
0x00000071010f1bb0,sub_71010F1BB0,364,
0x00000071010f1d1c,ElementDirectionalWind::create_1,508,
0x00000071010f1f18,wm::Manager::ctor,48,
0x00000071010f1f48,wm::Manager::dtor,4,
0x00000071010f1f4c,wm::Manager::dtorDelete,36,
0x00000071010f1f70,wm::initManager,12,
0x00000071010f1f7c,wm::Manager::invoke,76,
0x00000071010f1fc8,wm::Manager::rtti1,112,
0x00000071010f2038,wm::Manager::rtti2,92,
0x00000071010f2094,wm::Manager::init_null,4,
0x00000071010f2098,wm::Manager::calc_null,4,
0x00000071010f1f18,wm::Manager::ctor,48,_ZN4ksys5world3JobC2Ev
0x00000071010f1f48,wm::Manager::dtor,4,_ZN4ksys5world3JobD1Ev
0x00000071010f1f4c,wm::Manager::dtorDelete,36,_ZN4ksys5world3JobD0Ev
0x00000071010f1f70,wm::initManager,12,_ZN4ksys5world3Job4initEPN4sead4HeapE
0x00000071010f1f7c,wm::Manager::invoke,76,_ZN4ksys5world3Job6invokeEv
0x00000071010f1fc8,wm::Manager::rtti1,112,_ZNK4ksys5world3Job27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
0x00000071010f2038,wm::Manager::rtti2,92,_ZNK4ksys5world3Job18getRuntimeTypeInfoEv
0x00000071010f2094,wm::Manager::init_null,4,_ZN4ksys5world3Job5init_EPN4sead4HeapE
0x00000071010f2098,wm::Manager::calc_null,4,_ZN4ksys5world3Job5calc_Ev
0x00000071010f209c,ActorX6A0::ctor,160,
0x00000071010f213c,sub_71010F213C,64,
0x00000071010f217c,sub_71010F217C,72,
@ -89577,16 +89577,16 @@
0x00000071010f3d3c,WorldMgr::isClimateForbidComeback,92,_ZNK4ksys5world7Manager16isForbidComebackENS0_7ClimateE
0x00000071010f3d98,WorldMgr::unloadDgnenvAndGetWeatherMgr,76,
0x00000071010f3de4,WorldMgr::ctor,728,_ZN4ksys5world7ManagerC1Ev!
0x00000071010f40bc,WorldMgr::init,836,
0x00000071010f40bc,WorldMgr::init,836,_ZN4ksys5world7Manager4initEPN4sead4HeapE
0x00000071010f4400,WorldMgr::resetForStageUnload,84,
0x00000071010f4454,WorldMgr::loadBwinfo,148,
0x00000071010f44e8,WorldMgr::loadWorldInfo,8668,
0x00000071010f66c4,WorldMgr::updateRemainsType,268,
0x00000071010f67d0,WorldMgr::updateGraphicsMap,164,
0x00000071010f6874,sub_71010F6874,680,
0x00000071010f6874,sub_71010F6874,680,_ZN4ksys5world7ManagerD1Ev
0x00000071010f6b1c,sub_71010F6B1C,116,_ZN4ksys5world10DungeonEnvD2Ev
0x00000071010f6b90,sub_71010F6B90,76,_ZN4ksys5world9WorldInfoD2Ev
0x00000071010f6bdc,sub_71010F6BDC,36,
0x00000071010f6bdc,sub_71010F6BDC,36,_ZN4ksys5world7ManagerD0Ev
0x00000071010f6c00,WorldMgr::initBeforeStageGenB,32,
0x00000071010f6c20,WorldMgr::__auto4,32,
0x00000071010f6c40,WorldMgr::calc0,20,
@ -89636,7 +89636,7 @@
0x00000071010f8798,j__ZdlPv_1204,4,
0x00000071010f879c,_ZN4sead15FixedSafeStringILi9EEaSERKNS_14SafeStringBaseIcEE,240,
0x00000071010f888c,sub_71010F888C,428,
0x00000071010f8a38,WorldMgr::Climate::ctor,696,
0x00000071010f8a38,WorldMgr::Climate::ctor,696,_ZN4ksys5world11ClimateInfoC2Ev
0x00000071010f8cf0,sub_71010F8CF0,124,
0x00000071010f8d6c,sub_71010F8D6C,1028,
0x00000071010f9170,sub_71010F9170,44,

Can't render this file because it is too large.

View File

@ -1,4 +1,26 @@
target_sources(uking PRIVATE
worldChemicalMgr.cpp
worldChemicalMgr.h
worldCloudMgr.cpp
worldCloudMgr.h
worldDofMgr.cpp
worldDofMgr.h
worldJob.cpp
worldJob.h
worldManager.cpp
worldManager.h
worldShootingStarMgr.cpp
worldShootingStarMgr.h
worldShootingStarMgrEx.cpp
worldShootingStarMgrEx.h
worldSkyMgr.cpp
worldSkyMgr.h
worldTempMgr.cpp
worldTempMgr.h
worldTimeMgr.cpp
worldTimeMgr.h
worldWeatherMgr.cpp
worldWeatherMgr.h
worldWindMgr.cpp
worldWindMgr.h
)

View File

@ -0,0 +1 @@
#include "KingSystem/World/worldChemicalMgr.h"

View File

@ -0,0 +1,19 @@
#pragma once
#include "KingSystem/Utils/Types.h"
#include "KingSystem/World/worldJob.h"
namespace ksys::world {
// TODO
class ChemicalMgr : public Job {
public:
ChemicalMgr();
JobType getType() const override { return JobType::Chemical; }
u8 _20[0xdc0 - 0x20];
};
KSYS_CHECK_SIZE_NX150(ChemicalMgr, 0xdc0);
} // namespace ksys::world

View File

@ -0,0 +1 @@
#include "KingSystem/World/worldCloudMgr.h"

View File

@ -0,0 +1,19 @@
#pragma once
#include "KingSystem/Utils/Types.h"
#include "KingSystem/World/worldJob.h"
namespace ksys::world {
// TODO
class CloudMgr : public Job {
public:
CloudMgr();
JobType getType() const override { return JobType::Cloud; }
u8 _20[0x3fb8 - 0x20];
};
KSYS_CHECK_SIZE_NX150(CloudMgr, 0x3fb8);
} // namespace ksys::world

View File

@ -0,0 +1 @@
#include "KingSystem/World/worldDofMgr.h"

View File

@ -0,0 +1,19 @@
#pragma once
#include "KingSystem/Utils/Types.h"
#include "KingSystem/World/worldJob.h"
namespace ksys::world {
// TODO
class DofMgr : public Job {
public:
DofMgr();
JobType getType() const override { return JobType::Dof; }
u8 _20[0x1c0 - 0x20];
};
KSYS_CHECK_SIZE_NX150(DofMgr, 0x1c0);
} // namespace ksys::world

View File

@ -0,0 +1,30 @@
#include "KingSystem/World/worldJob.h"
#include "KingSystem/World/worldManager.h"
namespace ksys::world {
Job::Job() = default;
Job::~Job() = default;
void Job::init(sead::Heap* heap) {
init_(heap);
}
void Job::invoke() {
switch (Manager::instance()->getCalcType()) {
case CalcType::_0:
calc_();
break;
case CalcType::_1:
calcType1_();
break;
case CalcType::_2:
calcType2_();
break;
case CalcType::Invalid:
break;
}
}
} // namespace ksys::world

View File

@ -0,0 +1,44 @@
#pragma once
#include <hostio/seadHostIONode.h>
#include <mc/seadJob.h>
#include <prim/seadRuntimeTypeInfo.h>
#include "KingSystem/Utils/Types.h"
namespace ksys::world {
enum class JobType {
Time,
Cloud,
ShootingStar,
Weather,
Temp,
Wind,
Sky,
Dof,
Chemical,
};
constexpr int NumJobTypes = 9;
class Job : public sead::Job, public sead::hostio::Node {
SEAD_RTTI_BASE(Job)
public:
Job();
~Job() override;
void invoke() override;
void init(sead::Heap* heap);
protected:
virtual void init_(sead::Heap* heap) {}
virtual void calc_() {}
virtual void calcType1_() {}
virtual void calcType2_() {}
virtual void m9() {}
virtual void m10() {}
virtual void m11() {}
virtual JobType getType() const = 0;
};
KSYS_CHECK_SIZE_NX150(Job, 0x20);
} // namespace ksys::world

View File

@ -307,4 +307,58 @@ bool Manager::isForbidComeback(Climate climate) const {
// NON_MATCHING: stores in a different order (handwritten assignments?) but should be equivalent
Manager::Manager() = default;
static Job* makeJob(JobType type, sead::Heap* heap) {
switch (type) {
case JobType::Time:
return new (heap) TimeMgr;
case JobType::Cloud:
return new (heap) CloudMgr;
case JobType::ShootingStar:
return new (heap) ShootingStarMgrEx;
case JobType::Weather:
return new (heap) WeatherMgr;
case JobType::Temp:
return new (heap) TempMgr;
case JobType::Wind:
return new (heap) WindMgr;
case JobType::Sky:
return new (heap) SkyMgr;
case JobType::Dof:
return new (heap) DofMgr;
case JobType::Chemical:
return new (heap) ChemicalMgr;
}
return nullptr;
}
void Manager::init(sead::Heap* heap) {
mMgrs.allocBuffer(NumJobTypes, heap);
mAtomicPtrArray.allocBuffer(0x1000, heap);
mAtomicPtrArray.clear();
mJobQueue.initialize(NumJobTypes, heap);
mJobQueue.clear();
mWorldInfo.mClimates.allocBufferAssert(NumClimates, heap);
for (int i = 0; i < NumJobTypes; ++i) {
auto* job = makeJob(JobType(i), heap);
if (job) {
job->init(heap);
mMgrs.pushBack(job);
}
}
mWorldInfoLoadStatus = WorldInfoLoadStatus::NotLoaded;
}
Manager::~Manager() {
for (auto& mgr : mMgrs)
delete &mgr;
mMgrs.freeBuffer();
mAtomicPtrArray.freeBuffer();
mWorldInfo.mClimates.freeBuffer();
}
} // namespace ksys::world

View File

@ -12,11 +12,23 @@
#include <prim/seadSizedEnum.h>
#include "KingSystem/Resource/resHandle.h"
#include "KingSystem/Utils/Types.h"
#include "KingSystem/World/worldChemicalMgr.h"
#include "KingSystem/World/worldCloudMgr.h"
#include "KingSystem/World/worldDofMgr.h"
#include "KingSystem/World/worldShootingStarMgrEx.h"
#include "KingSystem/World/worldSkyMgr.h"
#include "KingSystem/World/worldTempMgr.h"
#include "KingSystem/World/worldTimeMgr.h"
#include "KingSystem/World/worldWeatherMgr.h"
#include "KingSystem/World/worldWindMgr.h"
namespace ksys::world {
enum class CalcType {
_3 = 3,
_0 = 0,
_1 = 1,
_2 = 2,
Invalid = 3,
};
enum class StageType {
@ -139,15 +151,6 @@ public:
};
KSYS_CHECK_SIZE_NX150(DungeonEnv, 0x338);
class TimeMgr;
class CloudMgr;
class ShootingStarMgr;
class WeatherMgr;
class TempMgr;
class SkyMgr;
class DofMgr;
class ChemicalMgr;
// FIXME: incomplete
class Manager : public sead::hostio::Node {
SEAD_SINGLETON_DISPOSER(Manager)
@ -203,11 +206,14 @@ public:
mScalingMode == ScalingMode::Disabled;
}
CalcType getCalcType() const { return mCalcType; }
TimeMgr* getTimeMgr() const { return static_cast<TimeMgr*>(mMgrs[0]); }
CloudMgr* getCloudMgr() const { return static_cast<CloudMgr*>(mMgrs[1]); }
ShootingStarMgr* getShootingStarMgr() const { return static_cast<ShootingStarMgr*>(mMgrs[2]); }
WeatherMgr* getWeatherMgr() const { return static_cast<WeatherMgr*>(mMgrs[3]); }
TempMgr* getTempMgr() const { return static_cast<TempMgr*>(mMgrs[4]); }
WindMgr* getWindMgr() const { return static_cast<WindMgr*>(mMgrs[5]); }
SkyMgr* getSkyMgr() const { return static_cast<SkyMgr*>(mMgrs[6]); }
DofMgr* getDofMgr() const { return static_cast<DofMgr*>(mMgrs[7]); }
ChemicalMgr* getChemicalMgr() const { return static_cast<ChemicalMgr*>(mMgrs[8]); }
@ -227,10 +233,10 @@ private:
DungeonEnv mDungeonEnv;
sead::DirectResource* mInfoRes{};
sead::PtrArray<void> mMgrs;
sead::PtrArray<Job> mMgrs;
agl::utl::AtomicPtrArray<void*> mAtomicPtrArray;
sead::BitFlag32 _5e0 = 1;
CalcType mCalcType = CalcType::_3;
CalcType mCalcType = CalcType::Invalid;
sead::FixedSizeJQ mJobQueue;
sead::Vector3f mCameraPos{0, 0, 0};

View File

@ -0,0 +1 @@
#include "KingSystem/World/worldShootingStarMgr.h"

View File

@ -0,0 +1,19 @@
#pragma once
#include "KingSystem/Utils/Types.h"
#include "KingSystem/World/worldJob.h"
namespace ksys::world {
// TODO
class ShootingStarMgr : public Job {
public:
ShootingStarMgr();
JobType getType() const override { return JobType::ShootingStar; }
u8 _20[0x30 - 0x20];
};
KSYS_CHECK_SIZE_NX150(ShootingStarMgr, 0x30);
} // namespace ksys::world

View File

@ -0,0 +1 @@
#include "KingSystem/World/worldShootingStarMgrEx.h"

View File

@ -0,0 +1,17 @@
#pragma once
#include "KingSystem/Utils/Types.h"
#include "KingSystem/World/worldShootingStarMgr.h"
namespace ksys::world {
// TODO
class ShootingStarMgrEx : public ShootingStarMgr {
public:
ShootingStarMgrEx();
u8 _30[0x88 - 0x30];
};
KSYS_CHECK_SIZE_NX150(ShootingStarMgrEx, 0x88);
} // namespace ksys::world

View File

@ -0,0 +1 @@
#include "KingSystem/World/worldSkyMgr.h"

View File

@ -0,0 +1,19 @@
#pragma once
#include "KingSystem/Utils/Types.h"
#include "KingSystem/World/worldJob.h"
namespace ksys::world {
// TODO
class SkyMgr : public Job {
public:
SkyMgr();
JobType getType() const override { return JobType::Sky; }
u8 _20[0x6b618 - 0x20];
};
KSYS_CHECK_SIZE_NX150(SkyMgr, 0x6b618);
} // namespace ksys::world

View File

@ -0,0 +1 @@
#include "KingSystem/World/worldTempMgr.h"

View File

@ -0,0 +1,19 @@
#pragma once
#include "KingSystem/Utils/Types.h"
#include "KingSystem/World/worldJob.h"
namespace ksys::world {
// TODO
class TempMgr : public Job {
public:
TempMgr();
JobType getType() const override { return JobType::Temp; }
u8 _20[0x90 - 0x20];
};
KSYS_CHECK_SIZE_NX150(TempMgr, 0x90);
} // namespace ksys::world

View File

@ -0,0 +1 @@
#include "KingSystem/World/worldTimeMgr.h"

View File

@ -0,0 +1,19 @@
#pragma once
#include "KingSystem/Utils/Types.h"
#include "KingSystem/World/worldJob.h"
namespace ksys::world {
// TODO
class TimeMgr : public Job {
public:
TimeMgr();
JobType getType() const override { return JobType::Time; }
u8 _20[0x158 - 0x20];
};
KSYS_CHECK_SIZE_NX150(TimeMgr, 0x158);
} // namespace ksys::world

View File

@ -0,0 +1 @@
#include "KingSystem/World/worldWeatherMgr.h"

View File

@ -0,0 +1,19 @@
#pragma once
#include "KingSystem/Utils/Types.h"
#include "KingSystem/World/worldJob.h"
namespace ksys::world {
// TODO
class WeatherMgr : public Job {
public:
WeatherMgr();
JobType getType() const override { return JobType::Weather; }
u8 _20[0x398 - 0x20];
};
KSYS_CHECK_SIZE_NX150(WeatherMgr, 0x398);
} // namespace ksys::world

View File

@ -0,0 +1 @@
#include "KingSystem/World/worldWindMgr.h"

View File

@ -0,0 +1,19 @@
#pragma once
#include "KingSystem/Utils/Types.h"
#include "KingSystem/World/worldJob.h"
namespace ksys::world {
// TODO
class WindMgr : public Job {
public:
WindMgr();
JobType getType() const override { return JobType::Wind; }
u8 _20[0x138 - 0x20];
};
KSYS_CHECK_SIZE_NX150(WindMgr, 0x138);
} // namespace ksys::world