Start CModelData, cleanup CFactoryFnReturn usage

This commit is contained in:
Phillip Stephens 2024-10-27 21:17:36 -07:00
parent c41440e3fb
commit d11d8f4cd8
21 changed files with 101 additions and 48 deletions

View File

@ -19168,7 +19168,7 @@ skDoorVerts__15CMappableObject = .bss:0x8046C498; // type:object size:0x60 scope
lbl_8046C4F8 = .bss:0x8046C4F8; // type:object size:0xC
lbl_8046C504 = .bss:0x8046C504; // type:object size:0x1C data:4byte
lbl_8046C520 = .bss:0x8046C520; // type:object size:0x18 data:4byte
lbl_8046C538 = .bss:0x8046C538; // type:object size:0x20 data:float
skNullAdvance = .bss:0x8046C538; // type:object size:0x20 scope:local data:float
lbl_8046C558 = .bss:0x8046C558; // type:object size:0xC
lbl_8046C564 = .bss:0x8046C564; // type:object size:0xC
lbl_8046C570 = .bss:0x8046C570; // type:object size:0xA8

View File

@ -19193,7 +19193,7 @@ skDoorVerts__15CMappableObject = .bss:0x8046C678; // type:object size:0x60 scope
lbl_8046C4F8 = .bss:0x8046C6D8; // type:object size:0xC scope:local
lbl_8046C504 = .bss:0x8046C6E4; // type:object size:0x1C scope:local data:4byte
lbl_8046C520 = .bss:0x8046C700; // type:object size:0x18 scope:local data:4byte
lbl_8046C538 = .bss:0x8046C718; // type:object size:0x20 scope:local data:float
skNullAdvance = .bss:0x8046C718; // type:object size:0x20 data:float scope:local
lbl_8046C558 = .bss:0x8046C738; // type:object size:0xC scope:local
lbl_8046C564 = .bss:0x8046C744; // type:object size:0xC scope:local
lbl_8046C570 = .bss:0x8046C750; // type:object size:0xA8 scope:local

View File

@ -13,7 +13,7 @@
#include <musyx/musyx.h>
#include <Kyoto/CFactoryMgr.hpp>
#include <Kyoto/CFactoryFnReturn.hpp>
class CVector3f;
class CSfxManager {
@ -243,4 +243,7 @@ public:
static bool IsValidHandle(CSfxHandle handle);
};
CFactoryFnReturn FAudioTranslationTableFactory(const SObjectTag& obj, CInputStream& in,
const CVParamTransfer& xfer);
#endif // _CSFXMANAGER

View File

@ -0,0 +1,16 @@
#ifndef _CFACTORYFNRETURN
#define _CFACTORYFNRETURN
#include <Kyoto/TToken.hpp>
class CFactoryFnReturn {
public:
template < typename T >
CFactoryFnReturn(T* ptr) : obj(TToken< T >::GetIObjObjectFor(ptr).release()) {}
const rstl::auto_ptr< CObjOwnerDerivedFromIObjUntyped >& GetObjForTransfer() const { return obj; }
private:
rstl::auto_ptr< CObjOwnerDerivedFromIObjUntyped > obj;
};
#endif // _CFACTORYFNRETURN

View File

@ -3,27 +3,12 @@
#include "types.h"
#include "Kyoto/IObjectStore.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
#include "Kyoto/TToken.hpp"
class CFactoryMgr {
public:
private:
uchar pad[0x38];
};
class CFactoryFnReturn {
public:
template < typename T >
CFactoryFnReturn(T* ptr) : obj(TToken< T >::GetIObjObjectFor(ptr).release()) {}
const rstl::auto_ptr<CObjOwnerDerivedFromIObjUntyped>& GetObjForTransfer() const { return obj; }
private:
rstl::auto_ptr< CObjOwnerDerivedFromIObjUntyped > obj;
};
CFactoryFnReturn FStringTableFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& xfer);
#endif // _CFACTORYMGR

View File

@ -6,20 +6,10 @@
#include "rstl/list.hpp"
#include <Kyoto/IFactory.hpp>
#include "Kyoto/CFactoryMgr.hpp"
#include "Kyoto/CResLoader.hpp"
class IFactory {
public:
virtual ~IFactory() {}
virtual CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&) = 0;
virtual void BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**) = 0;
virtual void CancelBuild(const SObjectTag&) = 0;
virtual bool CanBuild(const SObjectTag&) = 0;
virtual const SObjectTag* GetResourceIdByName(const char* name) const = 0;
// TODO
};
class CResFactory : public IFactory {
public:
CResFactory();

View File

@ -0,0 +1,21 @@
#ifndef _IFACTORY
#define _IFACTORY
#include <Kyoto/CFactoryFnReturn.hpp>
class SObjectTag;
class CVParamTransfer;
class IObj;
class IFactory {
public:
virtual ~IFactory() {}
virtual CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&) = 0;
virtual void BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**) = 0;
virtual void CancelBuild(const SObjectTag&) = 0;
virtual bool CanBuild(const SObjectTag&) = 0;
virtual const SObjectTag* GetResourceIdByName(const char* name) const = 0;
// TODO
};
#endif // _IFACTORY

View File

@ -0,0 +1,8 @@
#ifndef _CIOBJFACTORY
#define _CIOBJFACTORY
class IObjFactory {
virtual ~IObjFactory() {};
};
#endif // _CIOBJFACTORY

View File

@ -3,10 +3,11 @@
#include "types.h"
#include "rstl/single_ptr.hpp"
#include <rstl/single_ptr.hpp>
#include "Kyoto/Streams/CInputStream.hpp"
#include <Kyoto/CFactoryFnReturn.hpp>
class CInputStream;
class CStringTable {
int x0_stringCount;
rstl::single_ptr< uchar > x4_data;
@ -19,4 +20,7 @@ public:
extern CStringTable* gpStringTable;
CFactoryFnReturn FStringTableFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& xfer);
#endif // _CSTRINGTABLE

View File

@ -3,7 +3,7 @@
#include "MetroidPrime/CMappableObject.hpp"
#include "Kyoto/CFactoryMgr.hpp"
#include "Kyoto/CFactoryFnReturn.hpp"
#include "Kyoto/Graphics/CColor.hpp"
#include "Kyoto/Math/CAABox.hpp"
#include "Kyoto/Math/CVector3f.hpp"
@ -11,6 +11,7 @@
#include "rstl/single_ptr.hpp"
#include "rstl/vector.hpp"
class IWorld;
class CWorld;

View File

@ -44,11 +44,15 @@ private:
CHECK_SIZEOF(CAdvancementDeltas, 0x1c)
class CStaticRes {
CAssetId x0_cmdlId;
CVector3f x4_scale;
public:
CStaticRes(CAssetId id, const CVector3f& scale) : x0_cmdlId(id), x4_scale(scale) {}
const CAssetId GetId() const { return x0_cmdlId; }
const CVector3f GetScale() const { return x4_scale; }
private:
CAssetId x0_cmdlId;
CVector3f x4_scale;
};
class CModelData {

View File

@ -0,0 +1,11 @@
#ifndef _CCHARACTERFACTORY
#define _CCHARACTERFACTORY
#include <Kyoto/IObjFactory.hpp>
#include <Kyoto/CResFactory.hpp>
class CCharacterFactory : IObjFactory {
};
#endif // _CCHARACTERFACTORY

View File

@ -2,12 +2,15 @@
#define _CCHARACTERFACTORYBUILDER
#include "types.h"
#include <Kyoto/TToken.hpp>
class CAnimRes;
class CCharacterFactory;
class CCharacterFactoryBuilder {
public:
CCharacterFactoryBuilder();
~CCharacterFactoryBuilder();
TToken<CCharacterFactory> GetFactory(const CAnimRes& res);
private:
uchar pad[0x24];
};

View File

@ -9,6 +9,8 @@
#include "rstl/reserved_vector.hpp"
#include "rstl/string.hpp"
#include <Kyoto/CFactoryFnReturn.hpp>
class CInputStream;
class CScannableObjectInfo {
public:
@ -35,4 +37,7 @@ private:
rstl::reserved_vector< SBucket, 4 > x14_buckets;
};
CFactoryFnReturn FScannableObjectInfoFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& xfer);
#endif // _CSCANNABLEOBJECTINFO

View File

@ -1,7 +1,7 @@
#ifndef _CSTATEMACHINEFACTORY
#define _CSTATEMACHINEFACTORY
#include <Kyoto/CFactoryMgr.hpp>
#include <Kyoto/CFactoryFnReturn.hpp>
CFactoryFnReturn FAiFiniteStateMachineFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& xfer);

View File

@ -28,15 +28,14 @@ class CWeaponMode {
bool x4_26_instantKill : 1;
public:
CWeaponMode(EWeaponType type = kWT_None, bool charged = false, bool comboed = false,
bool instaKill = false)
explicit CWeaponMode(EWeaponType type = kWT_None, const bool charged = false,
const bool comboed = false, const bool instaKill = false)
: x0_weaponType(type)
, x4_24_charged(charged)
, x4_25_comboed(comboed)
, x4_26_instantKill(instaKill) {}
CWeaponMode(int type, int flags)
: x0_weaponType(EWeaponType(type)) {}
CWeaponMode(int type, int flags) : x0_weaponType(EWeaponType(type)) {}
EWeaponType GetType() const { return x0_weaponType; }

View File

@ -8,6 +8,8 @@
#include "rstl/auto_ptr.hpp"
#include "rstl/vector.hpp"
#include <Kyoto/CFactoryFnReturn.hpp>
class COBBTree;
class CCollidableOBBTreeGroupContainer {
@ -40,4 +42,7 @@ private:
CCollidableOBBTreeGroupContainer* x10_container;
};
CFactoryFnReturn FCollidableOBBTreeGroupFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& xfer);
#endif // _CCOLLIDABLEOBBTREEGROUP

View File

@ -3,7 +3,7 @@
#include "Kyoto/Audio/CAudioSys.hpp"
#include <Kyoto/CFactoryMgr.hpp>
#include <Kyoto/CFactoryFnReturn.hpp>
#include <Kyoto/Streams/CInputStream.hpp>
rstl::reserved_vector< CMidiManager::CMidiWrapper, 3 > CMidiManager::mMidiWrappers;

View File

@ -1,9 +1,9 @@
#include "Kyoto/Text/CStringTable.hpp"
#include "rstl/pair.hpp"
#include "rstl/vector.hpp"
#include <Kyoto/Streams/CInputStream.hpp>
#include "Kyoto/CFactoryMgr.hpp"
#include <rstl/pair.hpp>
#include <rstl/vector.hpp>
static FourCC mCurrentLanguage = 'ENGL';
static const wchar_t skInvalidString[] = L"Invalid";

View File

@ -1,5 +1,4 @@
#include "MetroidPrime/Factories/CScannableObjectInfo.hpp"
#include "Kyoto/CFactoryMgr.hpp"
#include "Kyoto/Basics/CBasics.hpp"
#include "Kyoto/Streams/CInputStream.hpp"

View File

@ -5,7 +5,6 @@
#include <WorldFormat/CCollidableOBBTree.hpp>
#include <WorldFormat/COBBTree.hpp>
#include <Kyoto/CFactoryMgr.hpp>
#pragma inline_max_size(250)
CFactoryFnReturn FCollidableOBBTreeGroupFactory(const SObjectTag& tag, CInputStream& in,