mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 15:04:56 +00:00
various implementation
This commit is contained in:
48
Runtime/CDvdFile.hpp
Normal file
48
Runtime/CDvdFile.hpp
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef __RETRO_CDVDFILE_HPP__
|
||||
#define __RETRO_CDVDFILE_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
const char* DecodeARAMFile(const char* name);
|
||||
|
||||
enum ESeekOrigin
|
||||
{
|
||||
OriginBegin = 0,
|
||||
OriginCur = 1,
|
||||
OriginEnd = 2
|
||||
};
|
||||
|
||||
struct DVDFileInfo;
|
||||
class CDvdRequest;
|
||||
|
||||
class CDvdFile
|
||||
{
|
||||
public:
|
||||
CDvdFile(const char*);
|
||||
void UpdateFilePos(int);
|
||||
void CalcFileOffset(int, ESeekOrigin);
|
||||
static void internalCallback(s32, DVDFileInfo*);
|
||||
bool FileExists(const char*);
|
||||
void CloseFile();
|
||||
CDvdRequest* AsyncSeekRead(void*, u32, ESeekOrigin, int);
|
||||
void SyncSeekRead(void*, u32, ESeekOrigin, int);
|
||||
CDvdRequest* AsyncRead(void*, u32);
|
||||
void SyncRead(void*, u32);
|
||||
void StallForARAMFile();
|
||||
void StartARAMFileLoad();
|
||||
void PopARAMFileLoad();
|
||||
void PushARAMFileLoad();
|
||||
void TryARAMFile();
|
||||
void PingARAMTransfer();
|
||||
void HandleDVDInterrupt();
|
||||
void HandleARAMInterrupt();
|
||||
static void ARAMARAMXferCallback(u32);
|
||||
static void DVDARAMXferCallback(s32, DVDFileInfo*);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __RETRO_CDVDFILE_HPP__
|
||||
34
Runtime/CDvdRequest.hpp
Normal file
34
Runtime/CDvdRequest.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef __RETRO_CDVDREQUEST_HPP__
|
||||
#define __RETRO_CDVDREQUEST_HPP__
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CDvdRequest
|
||||
{
|
||||
public:
|
||||
virtual void WaitUntilComplete()=0;
|
||||
virtual bool IsComplete()=0;
|
||||
virtual void PostCancelRequest()=0;
|
||||
|
||||
enum EMediaType
|
||||
{
|
||||
MediaARAM = 0,
|
||||
MediaReal = 1,
|
||||
MediaNOD = 2
|
||||
};
|
||||
virtual EMediaType GetMediaType() const=0;
|
||||
};
|
||||
|
||||
class CNODDvdRequest : public CDvdRequest
|
||||
{
|
||||
public:
|
||||
void WaitUntilComplete();
|
||||
bool IsComplete();
|
||||
void PostCancelRequest();
|
||||
EMediaType GetMediaType() const {return MediaNOD;}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __RETRO_CDVDREQUEST_HPP__
|
||||
0
Runtime/CFactoryMgr.cpp
Normal file
0
Runtime/CFactoryMgr.cpp
Normal file
28
Runtime/CFactoryMgr.hpp
Normal file
28
Runtime/CFactoryMgr.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef __RETRO_CFACTORYMGR_HPP__
|
||||
#define __RETRO_CFACTORYMGR_HPP__
|
||||
|
||||
#include <unordered_map>
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
class SObjectTag;
|
||||
class CVParamTransfer;
|
||||
class CInputStream;
|
||||
|
||||
typedef void(*CFactoryFnReturn)(const SObjectTag&, CInputStream&, const CVParamTransfer&);
|
||||
|
||||
class CFactoryMgr
|
||||
{
|
||||
std::unordered_map<u32, CFactoryFnReturn> m_factories;
|
||||
public:
|
||||
MakeObjectFromMemory(const SObjectTag&, void*, int, bool, const CVParamTransfer&);
|
||||
void AddFactory(FourCC key, CFactoryFnReturn func)
|
||||
{
|
||||
m_factories[key] = func;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __RETRO_CFACTORYMGR_HPP__
|
||||
@@ -7,11 +7,19 @@ add_subdirectory(GuiSys)
|
||||
add_subdirectory(Input)
|
||||
add_subdirectory(Particle)
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND PLAT_SRCS CMemoryCardSysWin.cpp)
|
||||
elseif(APPLE)
|
||||
list(APPEND PLAT_SRCS CMemoryCardSysMac.cpp)
|
||||
else()
|
||||
list(APPEND PLAT_SRCS CMemoryCardSysNix.cpp)
|
||||
endif()
|
||||
|
||||
add_library(RuntimeCommon
|
||||
COsContext.hpp COsContextBoo.cpp
|
||||
CMainFlow.hpp CMainFlow.cpp
|
||||
CMemory.hpp CMemory.cpp
|
||||
CMemoryCardSys.hpp CMemoryCardSysPC.cpp
|
||||
CMemoryCardSys.hpp
|
||||
IAllocator.hpp IAllocator.cpp
|
||||
CGameAllocator.hpp CGameAllocator.cpp
|
||||
CBasics.hpp CBasicsPC.cpp
|
||||
@@ -25,6 +33,9 @@ add_library(RuntimeCommon
|
||||
CWorldTransManager.hpp CWorldTransManager.cpp
|
||||
CRandom16.hpp CRandom16.cpp
|
||||
CResFactory.hpp CResFactory.cpp
|
||||
CResLoader.hpp CResLoader.cpp
|
||||
CDvdRequest.hpp CNODDvdRequest.cpp
|
||||
CDvdFile.hpp CNODDvdFile.cpp
|
||||
IObjectStore.hpp
|
||||
CSimplePool.hpp CSimplePool.cpp
|
||||
CAi.hpp CAi.cpp
|
||||
@@ -45,10 +56,14 @@ add_library(RuntimeCommon
|
||||
CAreaOctTree.hpp CAreaOctTree.cpp
|
||||
CActor.hpp CActor.cpp
|
||||
CPhysicsActor.hpp CPhysicsActor.cpp
|
||||
CFactoryMgr.hpp CFactoryMgr.cpp
|
||||
CPakFile.hpp CPakFile.cpp
|
||||
CStringExtras.hpp
|
||||
rstl.hpp rstl.cpp
|
||||
GameGlobalObjects.hpp
|
||||
RetroTypes.hpp
|
||||
GCNTypes.hpp)
|
||||
GCNTypes.hpp
|
||||
${PLAT_SRCS})
|
||||
|
||||
add_subdirectory(MP1)
|
||||
add_subdirectory(MP2)
|
||||
|
||||
0
Runtime/CMemoryCardSysOSX.cpp
Normal file
0
Runtime/CMemoryCardSysOSX.cpp
Normal file
0
Runtime/CMemoryCardSysWin.cpp
Normal file
0
Runtime/CMemoryCardSysWin.cpp
Normal file
0
Runtime/CNODDvdFile.cpp
Normal file
0
Runtime/CNODDvdFile.cpp
Normal file
16
Runtime/CNODDvdRequest.cpp
Normal file
16
Runtime/CNODDvdRequest.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "CDvdRequest.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
void CNODDvdRequest::WaitUntilComplete()
|
||||
{
|
||||
}
|
||||
bool CNODDvdRequest::IsComplete()
|
||||
{
|
||||
}
|
||||
void CNODDvdRequest::PostCancelRequest()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
0
Runtime/CPakFile.cpp
Normal file
0
Runtime/CPakFile.cpp
Normal file
76
Runtime/CPakFile.hpp
Normal file
76
Runtime/CPakFile.hpp
Normal file
@@ -0,0 +1,76 @@
|
||||
#ifndef __RETRO_CPAKFILE_HPP__
|
||||
#define __RETRO_CPAKFILE_HPP__
|
||||
|
||||
#include <vector>
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CStringExtras.hpp"
|
||||
#include "CDvdFile.hpp"
|
||||
#include "CDvdRequest.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CPakFile : public CDvdFile
|
||||
{
|
||||
friend class CResLoader;
|
||||
public:
|
||||
struct SResInfo
|
||||
{
|
||||
u32 compressed;
|
||||
SObjectTag tag;
|
||||
u32 size;
|
||||
u32 offset;
|
||||
};
|
||||
private:
|
||||
enum EAsyncPhase
|
||||
{
|
||||
PakAsyncWarmup = 0,
|
||||
PakAsyncInitialHeader = 1,
|
||||
PakAsyncDataLoad = 2,
|
||||
PakAsyncLoaded = 3
|
||||
} x2c_asyncLoadPhase;
|
||||
CDvdRequest* x34_dvdReq;
|
||||
std::vector<std::pair<std::string, SObjectTag>> x4c_nameList;
|
||||
std::vector<u32> x5c_depList;
|
||||
std::vector<std::pair<u32, SResInfo>> x6c_resList;
|
||||
public:
|
||||
CPakFile(const std::string& filename);
|
||||
const std::vector<u32>& GetDepList() const {return x5c_depList;}
|
||||
u32 GetResIdByName(const char* name) const
|
||||
{
|
||||
for (const std::pair<std::string, SObjectTag>& p : x4c_nameList)
|
||||
if (!CStringExtras::CompareCaseInsensitive(p.first.c_str(), name))
|
||||
return p.second.id;
|
||||
return 0;
|
||||
}
|
||||
const SResInfo* GetResInfoForLoad(u32 id);
|
||||
const SResInfo* GetResInfo(u32 id) const;
|
||||
u32 GetFakeStaticSize() const;
|
||||
void DataLoad();
|
||||
void InitialHeaderLoad();
|
||||
void Warmup();
|
||||
void AsyncIdle()
|
||||
{
|
||||
if (x2c_asyncLoadPhase == PakAsyncLoaded)
|
||||
return;
|
||||
if (x34_dvdReq && x34_dvdReq->IsComplete())
|
||||
return;
|
||||
switch (x2c_asyncLoadPhase)
|
||||
{
|
||||
case PakAsyncWarmup:
|
||||
Warmup();
|
||||
break;
|
||||
case PakAsyncInitialHeader:
|
||||
InitialHeaderLoad();
|
||||
break;
|
||||
case PakAsyncDataLoad:
|
||||
DataLoad();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __RETRO_CPAKFILE_HPP__
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
void CResFactory::Build(const SObjectTag&, const CVParamTransfer&)
|
||||
std::unique_ptr<IObj> CResFactory::Build(const SObjectTag&, const CVParamTransfer&)
|
||||
{
|
||||
}
|
||||
void CResFactory::BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**)
|
||||
@@ -12,11 +12,5 @@ void CResFactory::BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**)
|
||||
void CResFactory::CancelBuild(const SObjectTag&)
|
||||
{
|
||||
}
|
||||
bool CResFactory::CanBuild(const SObjectTag&)
|
||||
{
|
||||
}
|
||||
const SObjectTag& CResFactory::GetResourceIdByName(const char*) const
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +1,41 @@
|
||||
#ifndef __RETRO_CRESFACTORY_HPP__
|
||||
#define __RETRO_CRESFACTORY_HPP__
|
||||
|
||||
#include <unordered_map>
|
||||
#include "IFactory.hpp"
|
||||
#include "CResLoader.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
class CDvdRequest;
|
||||
|
||||
class CResFactory : public IFactory
|
||||
{
|
||||
CResLoader x4_loader;
|
||||
public:
|
||||
void Build(const SObjectTag&, const CVParamTransfer&);
|
||||
struct SLoadingData
|
||||
{
|
||||
SObjectTag tag;
|
||||
CDvdRequest* dvdReq;
|
||||
IObj** targetPtr;
|
||||
void* loadBuffer;
|
||||
u32 resSize;
|
||||
};
|
||||
private:
|
||||
std::unordered_map<SObjectTag, SLoadingData> m_loadList;
|
||||
void AddToLoadList(const SLoadingData& data) {m_loadList[data.tag] = data;}
|
||||
public:
|
||||
std::unique_ptr<IObj> Build(const SObjectTag&, const CVParamTransfer&);
|
||||
void BuildAsync(const SObjectTag&, const CVParamTransfer&, IObj**);
|
||||
void CancelBuild(const SObjectTag&);
|
||||
bool CanBuild(const SObjectTag&);
|
||||
const SObjectTag& GetResourceIdByName(const char*) const;
|
||||
bool CanBuild(const SObjectTag& tag) {return x4_loader.ResourceExists(tag);}
|
||||
u32 GetResourceIdByName(const char* name) const {return x4_loader.GetResourceIdByName(name);}
|
||||
|
||||
std::vector<std::pair<std::string, SObjectTag>> GetResourceIdToNameList() const
|
||||
{
|
||||
std::vector<std::pair<std::string, SObjectTag>> retval;
|
||||
return retval;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
0
Runtime/CResLoader.cpp
Normal file
0
Runtime/CResLoader.cpp
Normal file
155
Runtime/CResLoader.hpp
Normal file
155
Runtime/CResLoader.hpp
Normal file
@@ -0,0 +1,155 @@
|
||||
#ifndef __RETRO_CRESLOADER_HPP__
|
||||
#define __RETRO_CRESLOADER_HPP__
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CPakFile.hpp"
|
||||
#include "CBasics.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
class SObjectTag;
|
||||
class CDvdRequest;
|
||||
|
||||
class CResLoader
|
||||
{
|
||||
//std::list<std::unique_ptr<CPakFile>> x4_unusedList;
|
||||
std::list<std::unique_ptr<CPakFile>> x1c_pakLoadedList;
|
||||
std::list<std::unique_ptr<CPakFile>> x34_pakLoadingList;
|
||||
u32 x44_pakLoadingCount = 0;
|
||||
u32 x4c_cachedResId = -1;
|
||||
const CPakFile::SResInfo* x50_cachedResInfo = nullptr;
|
||||
public:
|
||||
const std::vector<u32>& GetTagListForFile(const std::string&) const;
|
||||
void AddPakFileAsync(const std::string&, bool);
|
||||
void AddPakFile(const std::string&, bool);
|
||||
CInputStream* LoadNewResourcePartSync(const SObjectTag&, int, int, char*);
|
||||
void LoadMemResourceSync(const SObjectTag&, char*, int*);
|
||||
CInputStream* LoadResourceFromMemorySync(const SObjectTag&, const void*);
|
||||
CInputStream* LoadNewResourceSync(const SObjectTag&, char*);
|
||||
|
||||
CDvdRequest* LoadResourcePartAsync(const SObjectTag& tag, int offset, int length, void* buf)
|
||||
{
|
||||
return FindResourceForLoad(tag.id)->AsyncSeekRead(buf, length,
|
||||
OriginBegin, x50_cachedResInfo->offset + offset);
|
||||
}
|
||||
|
||||
CDvdRequest* LoadResourceAsync(const SObjectTag& tag, void* buf)
|
||||
{
|
||||
return FindResourceForLoad(tag.id)->AsyncSeekRead(buf, ROUND_UP_32(x50_cachedResInfo->size),
|
||||
OriginBegin, x50_cachedResInfo->offset);
|
||||
}
|
||||
|
||||
bool GetResourceCompression(const SObjectTag& tag)
|
||||
{
|
||||
if (FindResource(tag.id))
|
||||
return x50_cachedResInfo->compressed;
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 ResourceSize(const SObjectTag& tag)
|
||||
{
|
||||
if (FindResource(tag.id))
|
||||
return x50_cachedResInfo->size;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ResourceExists(const SObjectTag& tag)
|
||||
{
|
||||
return FindResource(tag.id);
|
||||
}
|
||||
|
||||
FourCC GetResourceTypeById(u32 id)
|
||||
{
|
||||
if (FindResource(id))
|
||||
return x50_cachedResInfo->tag.type;
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 GetResourceIdByName(const char* name) const
|
||||
{
|
||||
for (const std::unique_ptr<CPakFile>& file : x1c_pakLoadedList)
|
||||
{
|
||||
u32 id = file->GetResIdByName(name);
|
||||
if (id)
|
||||
return id;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool AreAllPaksLoaded() const
|
||||
{
|
||||
return x44_pakLoadingCount == 0;
|
||||
}
|
||||
|
||||
void AsyncIdlePakLoading()
|
||||
{
|
||||
for (auto it=x34_pakLoadingList.begin();
|
||||
it != x34_pakLoadingList.end();
|
||||
++it)
|
||||
{
|
||||
(*it)->AsyncIdle();
|
||||
if ((*it)->x2c_asyncLoadPhase == CPakFile::PakAsyncLoaded)
|
||||
{
|
||||
MoveToCorrectLoadedList(std::move(*it));
|
||||
it = x34_pakLoadingList.erase(it);
|
||||
--x44_pakLoadingCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool FindResource(u32 id)
|
||||
{
|
||||
for (const std::unique_ptr<CPakFile>& file : x1c_pakLoadedList)
|
||||
if (CacheFromPak(*file, id))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
CPakFile* FindResourceForLoad(u32 id)
|
||||
{
|
||||
for (std::unique_ptr<CPakFile>& file : x1c_pakLoadedList)
|
||||
if (CacheFromPakForLoad(*file, id))
|
||||
return file.get();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CPakFile* FindResourceForLoad(const SObjectTag& tag)
|
||||
{
|
||||
return FindResourceForLoad(tag.id);
|
||||
}
|
||||
|
||||
bool CacheFromPakForLoad(CPakFile& file, u32 id)
|
||||
{
|
||||
const CPakFile::SResInfo* info = file.GetResInfoForLoad(id);
|
||||
if (info)
|
||||
{
|
||||
x4c_cachedResId = id;
|
||||
x50_cachedResInfo = info;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CacheFromPak(const CPakFile& file, u32 id)
|
||||
{
|
||||
const CPakFile::SResInfo* info = file.GetResInfo(id);
|
||||
if (info)
|
||||
{
|
||||
x4c_cachedResId = id;
|
||||
x50_cachedResInfo = info;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void MoveToCorrectLoadedList(std::unique_ptr<CPakFile>&& file)
|
||||
{
|
||||
x1c_pakLoadedList.push_back(std::move(file));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __RETRO_CRESLOADER_HPP__
|
||||
29
Runtime/CStringExtras.hpp
Normal file
29
Runtime/CStringExtras.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef __RETRO_CSTRINGEXTRAS_HPP__
|
||||
#define __RETRO_CSTRINGEXTRAS_HPP__
|
||||
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CStringExtras
|
||||
{
|
||||
public:
|
||||
static int CompareCaseInsensitive(const char* a, const char* b)
|
||||
{
|
||||
#if _WIN32
|
||||
return _stricmp(a, b);
|
||||
#else
|
||||
return strcasecmp(a, b);
|
||||
#endif
|
||||
}
|
||||
static int CompareCaseInsensitive(const std::string& a, const std::string& b)
|
||||
{
|
||||
return CompareCaseInsensitive(a.c_str(), b.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __RETRO_CSTRINGEXTRAS_HPP__
|
||||
@@ -2,9 +2,11 @@
|
||||
#define __RETRO_CTOKEN_HPP__
|
||||
|
||||
#include <memory>
|
||||
#include "IObj.hpp"
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CVParamTransfer.hpp"
|
||||
#include "IVParamObj.hpp"
|
||||
#include "IObjectStore.hpp"
|
||||
#include "IFactory.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
@@ -28,23 +30,72 @@ public:
|
||||
|
||||
bool IsLoading() const {return x3_loading;}
|
||||
void Unlock() {}
|
||||
void RemoveReference() {}
|
||||
void Lock() {}
|
||||
u32 RemoveReference()
|
||||
{
|
||||
--x0_refCount;
|
||||
if (x0_refCount == 0)
|
||||
{
|
||||
if (x10_object)
|
||||
Unload();
|
||||
if (IsLoading())
|
||||
CancelLoad();
|
||||
xC_objectStore->ObjectUnreferenced(x4_objTag);
|
||||
}
|
||||
}
|
||||
void CancelLoad() {}
|
||||
void Unload() {}
|
||||
void GetObject() {}
|
||||
void Unload()
|
||||
{
|
||||
x10_object.reset(nullptr);
|
||||
x3_loading = false;
|
||||
}
|
||||
IObj& GetObject()
|
||||
{
|
||||
IFactory& factory = xC_objectStore->GetFactory();
|
||||
factory.Build(x4_objTag, x14_params);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class CToken
|
||||
{
|
||||
CObjectReference* x0_objRef;
|
||||
CObjectReference& x0_objRef;
|
||||
bool x4_lockHeld = false;
|
||||
public:
|
||||
~CToken()
|
||||
void Unlock()
|
||||
{
|
||||
if (x4_lockHeld)
|
||||
{
|
||||
x0_objRef.Unlock();
|
||||
x4_lockHeld = false;
|
||||
}
|
||||
}
|
||||
void Lock()
|
||||
{
|
||||
if (!x4_lockHeld)
|
||||
{
|
||||
x0_objRef.Lock();
|
||||
x4_lockHeld = true;
|
||||
}
|
||||
}
|
||||
void RemoveRef()
|
||||
{
|
||||
|
||||
}
|
||||
IObj& GetObj()
|
||||
{
|
||||
Lock();
|
||||
return x0_objRef.GetObject();
|
||||
}
|
||||
CToken& operator=(CToken&& other)
|
||||
{
|
||||
|
||||
}
|
||||
~CToken()
|
||||
{
|
||||
if (x0_objRef && x4_lockHeld)
|
||||
x0_objRef->Unlock();
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
|
||||
@@ -5,16 +5,9 @@
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CCharacterFactoryBuilder
|
||||
class CCharacterFactoryBuilder : public IFactory
|
||||
{
|
||||
public:
|
||||
CCharacterFactoryBuilder();
|
||||
class CDummyFactory : public IFactory
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __RETRO_CASSETFACTORY_HPP__
|
||||
|
||||
0
Runtime/Character/CCharLayoutInfo.cpp
Normal file
0
Runtime/Character/CCharLayoutInfo.cpp
Normal file
0
Runtime/Character/CCharLayoutInfo.hpp
Normal file
0
Runtime/Character/CCharLayoutInfo.hpp
Normal file
0
Runtime/Character/CHierarchyPoseBuilder.cpp
Normal file
0
Runtime/Character/CHierarchyPoseBuilder.cpp
Normal file
13
Runtime/Character/CHierarchyPoseBuilder.hpp
Normal file
13
Runtime/Character/CHierarchyPoseBuilder.hpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef __RETRO_CHIERARCHYPOSEBUILDER_HPP__
|
||||
#define __RETRO_CHIERARCHYPOSEBUILDER_HPP__
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CHierarchyPoseBuilder
|
||||
{
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __RETRO_CHIERARCHYPOSEBUILDER_HPP__
|
||||
@@ -8,4 +8,5 @@ add_library(RuntimeCommonCharacter
|
||||
CAnimationDatabase.hpp
|
||||
CAnimationDatabaseGame.hpp
|
||||
CTransitionDatabase.hpp
|
||||
CTransitionDatabaseGame.hpp)
|
||||
CTransitionDatabaseGame.hpp
|
||||
CHierarchyPoseBuilder.hpp CHierarchyPoseBuilder.cpp)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef __RETRO_IFACTORY_HPP__
|
||||
#define __RETRO_IFACTORY_HPP__
|
||||
|
||||
#include <memory>
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace Retro
|
||||
@@ -12,11 +13,11 @@ class IFactory
|
||||
{
|
||||
public:
|
||||
virtual ~IFactory() {}
|
||||
virtual void Build(const SObjectTag&, const CVParamTransfer&)=0;
|
||||
virtual std::unique_ptr<IObj> 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*) const=0;
|
||||
virtual u32 GetResourceIdByName(const char*) const=0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -8,13 +8,15 @@ namespace Retro
|
||||
|
||||
class IObj
|
||||
{
|
||||
public:
|
||||
virtual ~IObj() {}
|
||||
};
|
||||
|
||||
class TObjOwnerDerivedFromIObjUntyped : public IObj
|
||||
{
|
||||
protected:
|
||||
void* m_objPtr;
|
||||
TObjOwnerDerivedFromIObjUntyped(void* objPtr) : m_objPtr(objPtr) {}
|
||||
IObj* m_objPtr;
|
||||
TObjOwnerDerivedFromIObjUntyped(IObj* objPtr) : m_objPtr(objPtr) {}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
|
||||
@@ -3,21 +3,23 @@
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
class SObjectTag;
|
||||
class CVParamTransfer;
|
||||
class IFactory;
|
||||
class IObj;
|
||||
|
||||
class IObjectStore
|
||||
{
|
||||
public:
|
||||
/*
|
||||
GetObj((SObjectTag const &,CVParamTransfer const &))
|
||||
GetObj((SObjectTag const &))
|
||||
GetObj((char const *))
|
||||
GetObj((char const *,CVParamTransfer const &))
|
||||
HasObject(const(SObjectTag const &))
|
||||
.data6:80352C6C .long CSimplePool::ObjectIsLive(const(SObjectTag const &))
|
||||
.data6:80352C70 .long CSimplePool::GetFactory(const(void))
|
||||
.data6:80352C74 .long CSimplePool::Flush((void))
|
||||
.data6:80352C78 .long CSimplePool::ObjectUnreferenced((SObjectTag const &))
|
||||
*/
|
||||
virtual IObj& GetObj(const SObjectTag&, const CVParamTransfer&)=0;
|
||||
virtual IObj& GetObj(const SObjectTag&)=0;
|
||||
virtual IObj& GetObj(char const*)=0;
|
||||
virtual IObj& GetObj(char const*, const CVParamTransfer&)=0;
|
||||
virtual void HasObject(const SObjectTag&) const=0;
|
||||
virtual void ObjectIsLive(const SObjectTag&) const=0;
|
||||
virtual IFactory& GetFactory() const=0;
|
||||
virtual void Flush()=0;
|
||||
virtual void ObjectUnreferenced(const SObjectTag&)=0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -11,10 +11,14 @@
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
using FourCC = HECL::FourCC;
|
||||
|
||||
struct SObjectTag
|
||||
{
|
||||
FourCC type;
|
||||
UniqueID32 id;
|
||||
u32 id;
|
||||
bool operator!=(const SObjectTag& other) const {return id != other.id;}
|
||||
bool operator==(const SObjectTag& other) const {return id == other.id;}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -62,4 +66,14 @@ using TAreaId = u32;
|
||||
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<>
|
||||
struct hash<Retro::SObjectTag>
|
||||
{
|
||||
inline size_t operator()(const Retro::SObjectTag& tag) const
|
||||
{return tag.id;}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __RETRO_TYPES_HPP__
|
||||
|
||||
Reference in New Issue
Block a user