2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 13:07:42 +00:00

various implementation

This commit is contained in:
Jack Andersen
2015-08-22 20:42:29 -10:00
parent 6577d4ca13
commit f3b5b9f49a
45 changed files with 580 additions and 84 deletions

View File

@@ -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>