mirror of https://github.com/AxioDL/metaforce.git
Prelim CSimplePool RE work (needs verification)
This commit is contained in:
parent
e060746b14
commit
0133115cee
|
@ -1,5 +1,5 @@
|
|||
#ifndef _RETRO_AFSM_HPP_
|
||||
#define _RETRO_AFSM_HPP_
|
||||
#ifndef _DNAMP1_AFSM_HPP_
|
||||
#define _DNAMP1_AFSM_HPP_
|
||||
|
||||
#include <Athena/FileWriter.hpp>
|
||||
#include "../DNACommon/DNACommon.hpp"
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef _DNAMP2_AFSM_HPP_
|
||||
#define _DNAMP2_AFSM_HPP_
|
||||
|
||||
#include "../DNAMP1/AFSM.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
namespace DNAMP2
|
||||
{
|
||||
using AFSM = DNAMP1::AFSM;
|
||||
}
|
||||
}
|
||||
#endif // _RETRO_AFSM_HPP_
|
|
@ -15,4 +15,5 @@ add_library(DNAMP2
|
|||
CMDL.hpp
|
||||
MREA.cpp
|
||||
MAPA.hpp
|
||||
AFSM.hpp
|
||||
STRG.hpp STRG.cpp)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "ANCS.hpp"
|
||||
#include "MREA.hpp"
|
||||
#include "MAPA.hpp"
|
||||
#include "AFSM.hpp"
|
||||
#include "../DNACommon/TXTR.hpp"
|
||||
|
||||
namespace Retro
|
||||
|
@ -215,6 +216,8 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const DNAMP1::PAK::Entry& ent
|
|||
return {STRG::Extract, nullptr, {_S(".yaml")}};
|
||||
case SBIG('TXTR'):
|
||||
return {TXTR::Extract, nullptr, {_S(".png")}};
|
||||
case SBIG('AFSM'):
|
||||
return {AFSM::Extract, nullptr, {_S(".yaml")}};
|
||||
case SBIG('CMDL'):
|
||||
return {nullptr, CMDL::Extract, {_S(".blend")}, 1};
|
||||
case SBIG('ANCS'):
|
||||
|
|
|
@ -9,36 +9,61 @@ CSimplePool::CSimplePool(IFactory& factory)
|
|||
: x30_factory(factory), x34_paramXfer(new TObjOwnerParam<IObjectStore*>(this))
|
||||
{}
|
||||
|
||||
CToken CSimplePool::GetObj(const SObjectTag&, const CVParamTransfer&)
|
||||
CToken CSimplePool::GetObj(const SObjectTag& tag, const CVParamTransfer& paramXfer)
|
||||
{
|
||||
auto iter = std::find_if(x4_resources.begin(), x4_resources.end(), [&tag](std::pair<SObjectTag, CObjectReference*> pair)->bool{
|
||||
return pair.first == tag;
|
||||
});
|
||||
|
||||
if (iter != x4_resources.end())
|
||||
return CToken(iter.second);
|
||||
// TODO: There is some logic missing here, need to figure out what it's doing
|
||||
CObjectReference* ret = new CObjectReference(*this, x30_factory.Build(tag, paramXfer), paramXfer);
|
||||
|
||||
return CToken(ret);
|
||||
}
|
||||
|
||||
CToken CSimplePool::GetObj(const SObjectTag&)
|
||||
CToken CSimplePool::GetObj(const SObjectTag& tag)
|
||||
{
|
||||
return GetObj(tag, x34_paramXfer);
|
||||
}
|
||||
|
||||
CToken CSimplePool::GetObj(char const*)
|
||||
CToken CSimplePool::GetObj(char const* resourceName)
|
||||
{
|
||||
return GetObj(resourceName, x34_paramXfer);
|
||||
}
|
||||
|
||||
CToken CSimplePool::GetObj(char const*, const CVParamTransfer&)
|
||||
CToken CSimplePool::GetObj(char const* resourceName, const CVParamTransfer& paramXfer)
|
||||
{
|
||||
const SObjectTag* tag = x30_factory.GetResourceIdByName(resourceName);
|
||||
return GetObj(*tag, paramXfer);
|
||||
}
|
||||
|
||||
void CSimplePool::HasObject(const SObjectTag&) const
|
||||
bool CSimplePool::HasObject(const SObjectTag& tag) const
|
||||
{
|
||||
auto iter = std::find_if(x4_resources.begin(), x4_resources.end(), [&tag](std::pair<SObjectTag, CObjectReference*> pair)->bool{
|
||||
return pair.first == tag;
|
||||
});
|
||||
|
||||
return iter != x4_resources.end();
|
||||
}
|
||||
|
||||
void CSimplePool::ObjectIsLive(const SObjectTag&) const
|
||||
bool CSimplePool::ObjectIsLive(const SObjectTag&) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CSimplePool::Flush()
|
||||
{
|
||||
}
|
||||
|
||||
void CSimplePool::ObjectUnreferenced(const SObjectTag&)
|
||||
void CSimplePool::ObjectUnreferenced(const SObjectTag& tag)
|
||||
{
|
||||
auto iter = std::find_if(x4_resources.begin(), x4_resources.end(), [&tag](std::pair<SObjectTag, CObjectReference*> pair)->bool{
|
||||
return pair.first == tag;
|
||||
});
|
||||
if (iter != x4_resources.end())
|
||||
x4_resources.erase(iter);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,8 @@ class CObjectReference;
|
|||
|
||||
class CSimplePool : public IObjectStore
|
||||
{
|
||||
std::unordered_map<SObjectTag, CObjectReference*> x4_resources;
|
||||
std::list<std::pair<SObjectTag, CObjectReference*>> x4_resources;
|
||||
//std::unordered_map<SObjectTag, CObjectReference*> x4_resources;
|
||||
IFactory& x30_factory;
|
||||
CVParamTransfer x34_paramXfer;
|
||||
public:
|
||||
|
@ -22,8 +23,8 @@ public:
|
|||
CToken GetObj(const SObjectTag&);
|
||||
CToken GetObj(char const*);
|
||||
CToken GetObj(char const*, const CVParamTransfer&);
|
||||
void HasObject(const SObjectTag&) const;
|
||||
void ObjectIsLive(const SObjectTag&) const;
|
||||
bool HasObject(const SObjectTag&) const;
|
||||
bool ObjectIsLive(const SObjectTag&) const;
|
||||
IFactory& GetFactory() const {return x30_factory;}
|
||||
void Flush();
|
||||
void ObjectUnreferenced(const SObjectTag&);
|
||||
|
|
|
@ -15,8 +15,8 @@ public:
|
|||
virtual CToken GetObj(const SObjectTag&)=0;
|
||||
virtual CToken GetObj(char const*)=0;
|
||||
virtual CToken GetObj(char const*, const CVParamTransfer&)=0;
|
||||
virtual void HasObject(const SObjectTag&) const=0;
|
||||
virtual void ObjectIsLive(const SObjectTag&) const=0;
|
||||
virtual bool HasObject(const SObjectTag&) const=0;
|
||||
virtual bool ObjectIsLive(const SObjectTag&) const=0;
|
||||
virtual IFactory& GetFactory() const=0;
|
||||
virtual void Flush()=0;
|
||||
virtual void ObjectUnreferenced(const SObjectTag&)=0;
|
||||
|
|
Loading…
Reference in New Issue