Merge pull request #231 from leoetlino/stack/03f-definition-moves

Move functions across and inside TUs to better match link order
This commit is contained in:
Léo Lam
2026-10-18 17:55:05 +01:00
committed by GitHub
32 changed files with 139 additions and 132 deletions
+3 -3
View File
@@ -49623,8 +49623,8 @@ Address,Quality,Size,Name
0x00000071007cbea4,U,000004,nullsub_2444
0x00000071007cbea8,U,000004,j__ZdlPv_353
0x00000071007cbeac,U,000440,StageFactory::create
0x00000071007cc064,O,000020,_ZN5uking9GameScene17getCurrentMapTypeEv
0x00000071007cc078,O,000020,_ZN5uking9GameScene17getCurrentMapNameEv
0x00000071007cc064,O,000020,_ZN5uking9StageInfo17getCurrentMapTypeEv
0x00000071007cc078,O,000020,_ZN5uking9StageInfo17getCurrentMapNameEv
0x00000071007cc08c,U,000012,getPSavePosAngleForStageGen
0x00000071007cc098,U,000012,getPSavePosForStageGen
0x00000071007cc0a4,U,003264,genStageUpdateMapTypeFlags
@@ -75237,7 +75237,7 @@ Address,Quality,Size,Name
0x0000007100d7ee8c,U,000076,
0x0000007100d7eed8,U,000016,
0x0000007100d7eee8,U,000128,
0x0000007100d7ef68,O,000004,_ZN4ksys3act9Awareness8calcHashERKN4sead14SafeStringBaseIcEE
0x0000007100d7ef68,O,000004,_ZN4ksys3act17calcAwarenessHashERKN4sead14SafeStringBaseIcEE
0x0000007100d7ef6c,U,000116,
0x0000007100d7efe0,U,000036,_ZN4ksys3act9Awareness4Unk18finalizeEv
0x0000007100d7f004,U,000040,
Can't render this file because it is too large.
@@ -14,14 +14,14 @@ void ForceSetCameraPos::enter_(ksys::act::ai::InlineParamPack* params) {
ksys::act::ai::Action::enter_(params);
}
void ForceSetCameraPos::calc_() {
ksys::act::ai::Action::calc_();
}
void ForceSetCameraPos::leave_() {
ksys::act::ai::Action::leave_();
}
void ForceSetCameraPos::loadParams_() {}
void ForceSetCameraPos::calc_() {
ksys::act::ai::Action::calc_();
}
} // namespace uking::action
@@ -14,6 +14,10 @@ void InWaterSelForkASPlay::enter_(ksys::act::ai::InlineParamPack* params) {
ksys::act::ai::Action::enter_(params);
}
void InWaterSelForkASPlay::calc_() {
ksys::act::ai::Action::calc_();
}
void InWaterSelForkASPlay::leave_() {
ksys::act::ai::Action::leave_();
}
@@ -28,8 +32,4 @@ void InWaterSelForkASPlay::loadParams_() {
getStaticParam(&mASName_s, "ASName");
}
void InWaterSelForkASPlay::calc_() {
ksys::act::ai::Action::calc_();
}
} // namespace uking::action
+2 -2
View File
@@ -1,5 +1,5 @@
#include "Game/Actor/Damage/actDamageInfoMgr.h"
#include "Game/Scene/gameScene.h"
#include "Game/Scene/gameStageInfo.h"
#include "KingSystem/ActorSystem/actGlobalParameter.h"
#include "KingSystem/GameData/gdtCommonFlagsUtils.h"
#include "KingSystem/Resource/GeneralParamList/resGParamListObjectGlobal.h"
@@ -49,7 +49,7 @@ bool DamageInfoMgr::isTrueFormMasterSword() const {
if (ksys::gdt::getFlag_LastBossGanonBeastGenerateFlag())
return true;
const sead::SafeString& map = GameScene::getCurrentMapName();
const sead::SafeString& map = StageInfo::getCurrentMapName();
if (!ksys::gdt::getFlag_Die_PGanonElectric() && map == "RemainsElectric")
return true;
@@ -1,6 +1,6 @@
#include "Game/Actor/Query/queryIsCurrentMainFieldStage.h"
#include <evfl/Query.h>
#include "Game/Scene/gameScene.h"
#include "Game/Scene/gameStageInfo.h"
namespace uking::query {
@@ -9,7 +9,7 @@ IsCurrentMainFieldStage::IsCurrentMainFieldStage(const InitArg& arg) : ksys::act
IsCurrentMainFieldStage::~IsCurrentMainFieldStage() = default;
int IsCurrentMainFieldStage::doQuery() {
return GameScene::getCurrentMapType() == "MainField";
return StageInfo::getCurrentMapType() == "MainField";
}
void IsCurrentMainFieldStage::loadParams(const evfl::QueryArg& arg) {}
-9
View File
@@ -1,16 +1,7 @@
#include "Game/Scene/gameScene.h"
#include "KingSystem/System/StageInfo.h"
namespace uking {
bool GameScene::sIsOpenWorldDemo{};
const sead::SafeString& GameScene::getCurrentMapType() {
return ksys::StageInfo::getCurrentMapType();
}
const sead::SafeString& GameScene::getCurrentMapName() {
return ksys::StageInfo::getCurrentMapName();
}
} // namespace uking
-6
View File
@@ -9,12 +9,6 @@ class GameScene {
public:
static bool isOpenWorldDemo() { return sIsOpenWorldDemo; }
/// Get the current map type (e.g. MainFieldDungeon)
static const sead::SafeString& getCurrentMapType();
/// Get the current map name (e.g. RemainsWind, FinalTrial, ...)
static const sead::SafeString& getCurrentMapName();
private:
static bool sIsOpenWorldDemo;
};
+9
View File
@@ -1,4 +1,5 @@
#include "Game/Scene/gameStageInfo.h"
#include "KingSystem/System/StageInfo.h"
#include "KingSystem/Utils/InitTimeInfo.h"
namespace uking {
@@ -7,4 +8,12 @@ static ksys::util::InitConstants sConstants;
sead::FixedSafeString<256> StageInfo::sStr;
StageInfo StageInfo::sInfo;
const sead::SafeString& StageInfo::getCurrentMapType() {
return ksys::StageInfo::getCurrentMapType();
}
const sead::SafeString& StageInfo::getCurrentMapName() {
return ksys::StageInfo::getCurrentMapName();
}
} // namespace uking
+6
View File
@@ -28,6 +28,12 @@ public:
static bool isAocField() { return sInfo.mIsAocField; }
static bool isMainField() { return sInfo.mIsMainField; }
/// Get the current map type (e.g. MainFieldDungeon)
static const sead::SafeString& getCurrentMapType();
/// Get the current map name (e.g. RemainsWind, FinalTrial, ...)
static const sead::SafeString& getCurrentMapName();
static sead::FixedSafeString<256> sStr;
private:
@@ -231,10 +231,6 @@ void Awareness::calc() {
resetFlag(Flag::_0);
}
u32 Awareness::calcHash(const sead::SafeString& key) {
return agl::utl::ParameterBase::calcHash(key);
}
void Awareness::Links2::calc() {
count = 0;
}
@@ -35,8 +35,6 @@ public:
void setEventActive(bool active);
void calc();
static u32 calcHash(const sead::SafeString& key);
private:
friend class AwarenessInstance;
@@ -1,7 +1,7 @@
#include "KingSystem/ActorSystem/Awareness/actAwarenessDefs.h"
#include <container/seadSafeArray.h>
#include <utility/aglParameter.h>
#include "KingSystem/ActorSystem/Awareness/actAwareness.h"
#include "KingSystem/ActorSystem/Awareness/actAwarenessMiscUtils.h"
namespace ksys::act {
@@ -29,7 +29,7 @@ sead::SafeArray<const char*, 23> sAwarenessSensorTypes = sead::toArray({
u32 getAwarenessTerrorFlags(u32 hash) {
for (u32 i = 0; i < u32(sAwarenessTerrorTypes.size()); ++i) {
if (Awareness::calcHash(sAwarenessTerrorTypes(i)) == hash)
if (calcAwarenessHash(sAwarenessTerrorTypes(i)) == hash)
return 1 << i;
}
@@ -39,7 +39,7 @@ u32 getAwarenessTerrorFlags(u32 hash) {
u32 getAwarenessSensorFlags(u32 hash) {
for (u32 i = 0; i < u32(sAwarenessSensorTypes.size()); ++i) {
if (Awareness::calcHash(sAwarenessSensorTypes(i)) == hash)
if (calcAwarenessHash(sAwarenessSensorTypes(i)) == hash)
return 1 << i;
}
return 0xffffffff;
@@ -0,0 +1,10 @@
#include "KingSystem/ActorSystem/Awareness/actAwarenessMiscUtils.h"
#include <utility/aglParameter.h>
namespace ksys::act {
u32 calcAwarenessHash(const sead::SafeString& key) {
return agl::utl::ParameterBase::calcHash(key);
}
} // namespace ksys::act
@@ -0,0 +1,10 @@
#pragma once
#include <basis/seadTypes.h>
#include <prim/seadSafeString.h>
namespace ksys::act {
u32 calcAwarenessHash(const sead::SafeString& key);
} // namespace ksys::act
+2 -2
View File
@@ -11,6 +11,8 @@ target_sources(uking PRIVATE
Awareness/actAwarenessDefs.h
Awareness/actAwarenessInstance.cpp
Awareness/actAwarenessInstance.h
Awareness/actAwarenessMiscUtils.cpp
Awareness/actAwarenessMiscUtils.h
Profiles/actRopeBase.cpp
@@ -77,8 +79,6 @@ target_sources(uking PRIVATE
actBaseProcInitializer.h
actBaseProcJob.cpp
actBaseProcJob.h
actBaseProcJobHandler.cpp
actBaseProcJobHandler.h
actBaseProcJobQue.cpp
actBaseProcJobQue.h
actBaseProcLink.cpp
-1
View File
@@ -11,7 +11,6 @@
#include <xlink2/xlink2Handle.h>
#include "KingSystem/ActorSystem/actActorEditorNode.h"
#include "KingSystem/ActorSystem/actBaseProc.h"
#include "KingSystem/ActorSystem/actBaseProcJobHandler.h"
#include "KingSystem/ActorSystem/actBaseProcLink.h"
#include "KingSystem/ActorSystem/actPhysicsConstraints.h"
#include "KingSystem/ActorSystem/actPhysicsUserTag.h"
+2 -1
View File
@@ -3,7 +3,6 @@
#include <time/seadTickSpan.h>
#include "KingSystem/ActorSystem/actBaseProcAccessor.h"
#include "KingSystem/ActorSystem/actBaseProcHandle.h"
#include "KingSystem/ActorSystem/actBaseProcJobHandler.h"
#include "KingSystem/ActorSystem/actBaseProcLink.h"
#include "KingSystem/ActorSystem/actBaseProcMgr.h"
#include "KingSystem/Terrain/teraSystem.h"
@@ -13,6 +12,8 @@ namespace ksys::act {
static util::InitTimeInfo sInfo;
BaseProcJobHandler::BaseProcJobHandler(BaseProc* proc) : mLink(proc, proc->getPriority()) {}
BaseProc::BaseProc(const CreateArg& arg)
: mName(arg.actor_name), mPriority(arg.class_info->priority) {
BaseProcMgr* mgr = BaseProcMgr::instance();
+43
View File
@@ -5,6 +5,7 @@
#include <container/seadSafeArray.h>
#include <math/seadMathCalcCommon.h>
#include <prim/seadBitFlag.h>
#include <prim/seadDelegate.h>
#include <prim/seadRuntimeTypeInfo.h>
#include <prim/seadSafeString.h>
#include <prim/seadTypedBitFlag.h>
@@ -332,4 +333,46 @@ private:
};
KSYS_CHECK_SIZE_NX150(BaseProc, 0x180);
class BaseProcJobHandler {
public:
explicit BaseProcJobHandler(BaseProc* proc);
virtual ~BaseProcJobHandler() = default;
virtual void invoke() = 0;
virtual void invokeSpecial() {}
BaseProcJobLink& getLink() { return mLink; }
const BaseProcJobLink& getLink() const { return mLink; }
protected:
BaseProcJobLink mLink;
};
KSYS_CHECK_SIZE_NX150(BaseProcJobHandler, 0x30);
/// For binding actor member functions.
template <typename T>
class BaseProcJobHandlerT : public BaseProcJobHandler {
public:
BaseProcJobHandlerT(T* proc, void (T::*fn)()) : BaseProcJobHandler(proc), mDelegate(proc, fn) {}
void invoke() override { mDelegate.invoke(); }
private:
sead::Delegate<T> mDelegate;
};
/// For binding two actor member functions.
template <typename T>
class BaseProcJobHandlerDualT : public BaseProcJobHandler {
public:
BaseProcJobHandlerDualT(T* proc, void (T::*fn)(), void (T::*fn_special)())
: BaseProcJobHandler(proc), mDelegate(proc, fn), mDelegateSpecial(proc, fn_special) {}
void invoke() override { mDelegate.invoke(); }
void invokeSpecial() override { mDelegateSpecial.invoke(); }
private:
sead::Delegate<T> mDelegate;
sead::Delegate<T> mDelegateSpecial;
};
} // namespace ksys::act
@@ -1,8 +0,0 @@
#include "KingSystem/ActorSystem/actBaseProcJobHandler.h"
#include "KingSystem/ActorSystem/actBaseProc.h"
namespace ksys::act {
BaseProcJobHandler::BaseProcJobHandler(BaseProc* proc) : mLink(proc, proc->getPriority()) {}
} // namespace ksys::act
@@ -1,51 +0,0 @@
#pragma once
#include <prim/seadDelegate.h>
#include "KingSystem/ActorSystem/actBaseProcJob.h"
#include "KingSystem/Utils/Types.h"
namespace ksys::act {
class BaseProcJobHandler {
public:
explicit BaseProcJobHandler(BaseProc* proc);
virtual ~BaseProcJobHandler() = default;
virtual void invoke() = 0;
virtual void invokeSpecial() {}
BaseProcJobLink& getLink() { return mLink; }
const BaseProcJobLink& getLink() const { return mLink; }
protected:
BaseProcJobLink mLink;
};
KSYS_CHECK_SIZE_NX150(BaseProcJobHandler, 0x30);
/// For binding actor member functions.
template <typename T>
class BaseProcJobHandlerT : public BaseProcJobHandler {
public:
BaseProcJobHandlerT(T* proc, void (T::*fn)()) : BaseProcJobHandler(proc), mDelegate(proc, fn) {}
void invoke() override { mDelegate.invoke(); }
private:
sead::Delegate<T> mDelegate;
};
/// For binding two actor member functions.
template <typename T>
class BaseProcJobHandlerDualT : public BaseProcJobHandler {
public:
BaseProcJobHandlerDualT(T* proc, void (T::*fn)(), void (T::*fn_special)())
: BaseProcJobHandler(proc), mDelegate(proc, fn), mDelegateSpecial(proc, fn_special) {}
void invoke() override { mDelegate.invoke(); }
void invokeSpecial() override { mDelegateSpecial.invoke(); }
private:
sead::Delegate<T> mDelegate;
sead::Delegate<T> mDelegateSpecial;
};
} // namespace ksys::act
@@ -3,10 +3,10 @@
#include <prim/seadScopedLock.h>
#include <thread/seadThread.h>
#include "KingSystem/ActorSystem/actActorSystem.h"
#include "KingSystem/ActorSystem/actBaseProc.h"
#include "KingSystem/ActorSystem/actBaseProcDeleter.h"
#include "KingSystem/ActorSystem/actBaseProcHeapMgr.h"
#include "KingSystem/ActorSystem/actBaseProcInitializer.h"
#include "KingSystem/ActorSystem/actBaseProcJobHandler.h"
#include "KingSystem/ActorSystem/actBaseProcJobQue.h"
#include "KingSystem/ActorSystem/actBaseProcLink.h"
+2 -2
View File
@@ -226,8 +226,6 @@ RailRoute::RailRoute() {
mFlags.set(Flag::Walkable);
}
RailRoute::~RailRoute() = default;
bool RailRoute::isRenderEnabled() const {
return mFlags.isOn(Flag::RenderEnabled);
}
@@ -252,6 +250,8 @@ const char* RailRoute::getCheckPointName(s32 idx) const {
return static_cast<RailRoutePoint*>(mRailPoints[idx])->mCheckPointName;
}
RailRoute::~RailRoute() = default;
bool RailRoute::parse(MubinIter* iter) {
int success = Rail::parse(iter);
+2 -2
View File
@@ -176,14 +176,14 @@ target_sources(uking PRIVATE
System/physStaticCompoundMgr.h
System/physStaticCompoundRigidBodyGroup.cpp
System/physStaticCompoundRigidBodyGroup.h
System/physStaticCompoundUtil.cpp
System/physStaticCompoundUtil.h
System/physSystem.cpp
System/physSystem.h
System/physSystemData.cpp
System/physSystemData.h
System/physUserTag.cpp
System/physUserTag.h
System/physUtil.cpp
System/physUtil.h
physConversions.h
physDefines.cpp
@@ -1,7 +1,7 @@
#include "KingSystem/Physics/RigidBody/TeraMesh/physTeraMeshRigidBody.h"
#include <Havok/Physics2012/Dynamics/Entity/hkpRigidBody.h>
#include "KingSystem/Physics/RigidBody/physRigidBodyParam.h"
#include "KingSystem/Physics/System/physStaticCompoundUtil.h"
#include "KingSystem/Physics/System/physUtil.h"
namespace ksys::phys {
@@ -5,7 +5,7 @@
#include <Havok/Physics2012/Utilities/Dynamics/ScaleSystem/hkpSystemScalingUtility.h>
#include <math/seadMathCalcCommon.h>
#include "KingSystem/Physics/RigidBody/physRigidBodyParam.h"
#include "KingSystem/Physics/System/physStaticCompoundUtil.h"
#include "KingSystem/Physics/System/physUtil.h"
#include "KingSystem/Physics/physConversions.h"
#include "KingSystem/Physics/physMaterialMask.h"
@@ -19,6 +19,7 @@
#include "KingSystem/Physics/RigidBody/physRigidBodyPolytope.h"
#include "KingSystem/Physics/RigidBody/physRigidBodySphere.h"
#include "KingSystem/Physics/System/physEntityGroupFilter.h"
#include "KingSystem/Physics/System/physUtil.h"
#include "KingSystem/Utils/SafeDelete.h"
namespace ksys::phys {
@@ -17,8 +17,8 @@
#include "KingSystem/Physics/System/physEntityContactListener.h"
#include "KingSystem/Physics/System/physGroupFilter.h"
#include "KingSystem/Physics/System/physPhantom.h"
#include "KingSystem/Physics/System/physStaticCompoundUtil.h"
#include "KingSystem/Physics/System/physSystem.h"
#include "KingSystem/Physics/System/physUtil.h"
#include "KingSystem/Physics/physConversions.h"
#include "KingSystem/Physics/physLayerMaskBuilder.h"
@@ -1 +0,0 @@
#include "KingSystem/Physics/System/physStaticCompoundUtil.h"
@@ -0,0 +1,25 @@
#include "KingSystem/Physics/System/physUtil.h"
#include "KingSystem/Physics/physDefines.h"
namespace ksys::phys {
MotionType motionTypeFromText(const sead::SafeString& text) {
static constexpr const char* texts[] = {
"Dynamic",
"Fixed",
"Keyframed",
};
static_assert(int(MotionType::Dynamic) == 0);
static_assert(int(MotionType::Fixed) == 1);
static_assert(int(MotionType::Keyframed) == 2);
int type = 0;
for (const char* type_text : texts) {
if (text == type_text)
return static_cast<MotionType>(type);
++type;
}
return MotionType::Unknown;
}
} // namespace ksys::phys
@@ -2,6 +2,7 @@
#include <basis/seadTypes.h>
#include <math/seadVector.h>
#include <prim/seadSafeString.h>
class hkpCollidable;
class hkpShape;
@@ -14,6 +15,10 @@ namespace ksys::phys {
class StaticCompoundRigidBodyGroup;
struct RigidBodyCollisionMasks;
enum class MotionType;
// 0x0000007100fd069c
MotionType motionTypeFromText(const sead::SafeString& text);
// 0x0000007100fd0810
u32 getMaterialMaskFromShape(const hkpShape& shape, const u32* shape_key,
-19
View File
@@ -84,23 +84,4 @@ WallCode wallCodeFromText(const sead::SafeString& text) {
return 0;
}
MotionType motionTypeFromText(const sead::SafeString& text) {
static constexpr const char* texts[] = {
"Dynamic",
"Fixed",
"Keyframed",
};
static_assert(int(MotionType::Dynamic) == 0);
static_assert(int(MotionType::Fixed) == 1);
static_assert(int(MotionType::Keyframed) == 2);
int type = 0;
for (const char* type_text : texts) {
if (text == type_text)
return static_cast<MotionType>(type);
++type;
}
return MotionType::Unknown;
}
} // namespace ksys::phys
-2
View File
@@ -401,6 +401,4 @@ FloorCode floorCodeFromText(const sead::SafeString& text);
const char* wallCodeToText(WallCode code);
WallCode wallCodeFromText(const sead::SafeString& text);
MotionType motionTypeFromText(const sead::SafeString& text);
} // namespace ksys::phys