2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 17:04:55 +00:00

Additional runtime stubs

This commit is contained in:
Jack Andersen
2015-08-17 10:33:58 -10:00
parent 387332ed70
commit 281b908574
22 changed files with 134 additions and 31 deletions

View File

@@ -4,25 +4,13 @@
#include <stdint.h>
#include <stdlib.h>
#include "RetroTemplates.hpp"
#include <Athena/IStreamReader.hpp>
#include <Athena/IStreamWriter.hpp>
using CInputStream = Athena::io::IStreamReader;
using COutputStream = Athena::io::IStreamWriter;
template<class T>
class TOneStatic
{
static T m_allocspace;
static uint32_t m_refCount;
public:
static T* GetAllocSpace() {return &m_allocspace;}
static uint32_t& ReferenceCount() {return m_refCount;}
void* operator new(size_t) {++ReferenceCount(); return GetAllocSpace();}
void operator delete(void*) {--ReferenceCount();}
};
template<class T> T TOneStatic<T>::m_allocspace;
template<class T> uint32_t TOneStatic<T>::m_refCount;
class CBasics
{
public: