Remove manual sead implementation

This commit is contained in:
MonsterDruide1 2021-07-13 23:37:28 +02:00
parent 72b3d5cdce
commit 44e5a1d242
14 changed files with 0 additions and 544 deletions

View File

@ -1,11 +0,0 @@
#pragma once
namespace sead
{
template<typename T>
class BitFlag
{
protected:
T mBits; // _0
};
};

View File

@ -1,29 +0,0 @@
#pragma once
#include "sead/seadListImpl.h"
namespace sead
{
class Heap;
class IDisposer
{
public:
IDisposer();
virtual ~IDisposer();
enum HeapNullOption
{
UseGivenHeap = 0x0,
UseGivenOrContainedHeap = 0x1,
NoDisposerIfNoSpecifiedHeap = 0x2,
UseCurrentOrSpecifiedHeap = 0x3
};
IDisposer(sead::Heap *, HeapNullOption);
sead::Heap* mDisposerHeap; // _8
sead::ListNode mNode; // _10
};
};

View File

@ -1,32 +0,0 @@
#pragma once
#include "sead/seadDisposer.h"
#include "sead/seadListImpl.h"
#include "sead/seadSafeString.h"
#include "sead/seadRuntimeTypeInfo.h"
namespace sead
{
class ArchiveRes;
class FileDevice : public TListNode<FileDevice *>, public IDisposer
{
SEAD_RTTI_BASE(FileDevice)
public:
bool tryGetFileSize(unsigned int *, const sead::SafeStringBase<char> &);
bool tryIsExistFile(bool *, const sead::SafeStringBase<char> &);
FixedSafeString<32> mName;
bool unk;
};
class ArchiveFileDevice : public FileDevice
{
SEAD_RTTI_OVERRIDE(ArchiveFileDevice, FileDevice)
public:
ArchiveFileDevice(ArchiveRes *);
ArchiveRes* mArchiveRes;
};
};

View File

@ -1,29 +0,0 @@
#pragma once
#include "seadDisposer.h"
#include "seadNamable.h"
#include "seadHostIO.h"
namespace sead
{
class Heap;
class HeapMgr
{
public:
HeapMgr();
virtual ~HeapMgr();
Heap* getCurrentHeap();
static HeapMgr sInstance;
static HeapMgr* sInstancePtr;
};
class Heap : public IDisposer, INamable, hostio::Reflexible
{
public:
};
};

View File

@ -1,13 +0,0 @@
#pragma once
namespace sead
{
namespace hostio
{
// all of these are unused in release builds, but used in develop / debug builds
class LifeCheckable { };
class PropertyEventListener : public LifeCheckable { };
class NodeEventListener : public PropertyEventListener { };
class Reflexible : public NodeEventListener { };
};
};

View File

@ -1,37 +0,0 @@
#pragma once
namespace sead
{
class ListNode
{
public:
ListNode* mPrev; // _0
ListNode* mNext; // _8
};
class ListImpl
{
public:
ListNode mStart; // _0
int mNodeCount; // _10
};
template <typename T>
class TListNode;
template<typename T>
class TList : ListImpl
{
public:
TListNode<T>* mCur; // _18
TListNode<T>* mNext; // _20
};
template<typename T>
class TListNode : ListNode
{
public:
T mData; // _10
TList<T>* mParentList; // _18
};
};

View File

@ -1,14 +0,0 @@
#pragma once
namespace sead
{
template<typename T>
class Matrix34
{
public:
T mMtx[3][4];
static const Matrix34 zero;
static const Matrix34 ident;
};
};

View File

@ -1,12 +0,0 @@
#pragma once
#include "sead/seadSafeString.h"
namespace sead
{
class INamable
{
public:
SafeStringBase<char> mName; // _0
};
};

View File

@ -1,16 +0,0 @@
#pragma once
namespace sead
{
template<typename T>
class Quat
{
public:
T x;
T y;
T z;
T w;
static const Quat unit;
};
};

View File

@ -1,42 +0,0 @@
#pragma once
#include "sead/seadBitFlag.h"
#include "sead/seadRuntimeTypeInfo.h"
namespace sead
{
class Heap;
class Resource
{
public:
SEAD_RTTI_BASE(Resource)
Resource();
virtual ~Resource();
};
class DirectResource : public Resource
{
public:
SEAD_RTTI_OVERRIDE(DirectResource, Resource)
DirectResource();
virtual ~DirectResource();
virtual int getLoadDataAlignment() const;
virtual void doCreate_(unsigned char *, unsigned int, sead::Heap *);
unsigned char* mData; // _8
unsigned int mSize; // _10
unsigned int mBufferSize; // _14
sead::BitFlag<unsigned long> mSettings; // _18
};
class ArchiveRes : public DirectResource
{
public:
SEAD_RTTI_OVERRIDE(ArchiveRes, DirectResource)
};
};

View File

@ -1,111 +0,0 @@
#pragma once
namespace sead
{
namespace RuntimeTypeInfo
{
class Interface
{
public:
Interface() {}
virtual bool isDerived(const Interface* typeInfo) const = 0;
};
class Root : public Interface
{
public:
Root() {}
bool isDerived(const Interface* typeInfo) const override { return typeInfo == this; }
};
template <typename BaseType>
class Derive : public Interface
{
public:
Derive() {}
bool isDerived(const Interface* typeInfo) const override
{
if (this == typeInfo)
return true;
const RuntimeTypeInfo::Interface* rootTypeInfo = BaseType::getRuntimeTypeInfoStatic();
return rootTypeInfo->isDerived(typeInfo);
}
};
};
template <typename DerivedType, typename Type>
inline bool IsDerivedFrom(const Type* obj)
{
const RuntimeTypeInfo::Interface* typeInfo = DerivedType::getRuntimeTypeInfoStatic();
return obj != nullptr && obj->checkDerivedRuntimeTypeInfo(typeInfo);
}
template <typename DerivedType, typename Type>
inline DerivedType* DynamicCast(Type* obj)
{
if (IsDerivedFrom<DerivedType, Type>(obj))
return static_cast<DerivedType*>(obj);
return nullptr;
}
}
#define SEAD_RTTI_BASE(CLASS) \
public: \
static const sead::RuntimeTypeInfo::Interface* getRuntimeTypeInfoStatic() \
{ \
static const sead::RuntimeTypeInfo::Root typeInfo; \
return &typeInfo; \
} \
\
static bool checkDerivedRuntimeTypeInfoStatic( \
const sead::RuntimeTypeInfo::Interface* typeInfo) \
{ \
const sead::RuntimeTypeInfo::Interface* clsTypeInfo = CLASS::getRuntimeTypeInfoStatic(); \
return typeInfo == clsTypeInfo; \
} \
\
virtual bool checkDerivedRuntimeTypeInfo(const sead::RuntimeTypeInfo::Interface* typeInfo) \
const \
{ \
return checkDerivedRuntimeTypeInfoStatic(typeInfo); \
} \
\
virtual const sead::RuntimeTypeInfo::Interface* getRuntimeTypeInfo() const \
{ \
return getRuntimeTypeInfoStatic(); \
}
#define SEAD_RTTI_OVERRIDE(CLASS, BASE) \
public: \
static const sead::RuntimeTypeInfo::Interface* getRuntimeTypeInfoStatic() \
{ \
static const sead::RuntimeTypeInfo::Derive<BASE> typeInfo; \
return &typeInfo; \
} \
\
static bool checkDerivedRuntimeTypeInfoStatic( \
const sead::RuntimeTypeInfo::Interface* typeInfo) \
\
{ \
const sead::RuntimeTypeInfo::Interface* clsTypeInfo = CLASS::getRuntimeTypeInfoStatic(); \
if (typeInfo == clsTypeInfo) \
return true; \
\
return BASE::checkDerivedRuntimeTypeInfoStatic(typeInfo); \
} \
\
bool checkDerivedRuntimeTypeInfo(const sead::RuntimeTypeInfo::Interface* typeInfo) \
const override \
{ \
return checkDerivedRuntimeTypeInfoStatic(typeInfo); \
} \
\
const sead::RuntimeTypeInfo::Interface* getRuntimeTypeInfo() const override \
{ \
return getRuntimeTypeInfoStatic(); \
}

View File

@ -1,97 +0,0 @@
#pragma once
namespace sead
{
template<typename T>
class SafeStringBase
{
public:
SafeStringBase(const T* pStr) : mTop(pStr) { }
virtual ~SafeStringBase();
virtual SafeStringBase<T>& operator=(const SafeStringBase<T> &);
virtual void assureTerminationImpl_() const;
inline int calcLength() const;
const T* cstr() const
{
assureTerminationImpl_();
return mTop;
}
static const T cNullChar;
static const int cMaximumLength = 0x80000;
protected:
const T* mTop; // _8
};
template<typename T>
class BufferedSafeStringBase : public SafeStringBase<T>
{
public:
__attribute__((always_inline))
BufferedSafeStringBase(T* buf, int size)
: SafeStringBase<T>(buf)
{
mSize = size;
if (size <= 0)
{
this->mTop = 0;
this->mSize = 0;
}
else
{
assureTerminationImpl_();
}
};
virtual ~BufferedSafeStringBase();
virtual BufferedSafeStringBase<T>& operator=(const SafeStringBase<T> &);
virtual void assureTerminationImpl_() const;
inline int copy(const SafeStringBase<T>& src, int copyLength = -1);
T* getBuffer()
{
assureTerminationImpl_();
return getMutableStringTop_();
}
T* getMutableStringTop_()
{
return const_cast<T*>(this->mTop);
}
inline void clear()
{
getMutableStringTop_()[0] = this->cNullChar;
}
int mSize; // _10
};
template<typename T, int Len>
class FixedSafeStringBase : public BufferedSafeStringBase<T>
{
public:
FixedSafeStringBase(const SafeStringBase<T>& rStr) : BufferedSafeStringBase<T>(mStrBuffer, Len)
{
this->copy(rStr);
}
T mStrBuffer[Len]; // _18
};
template<int Len>
class FixedSafeString : public FixedSafeStringBase<char, Len>
{
public:
FixedSafeString(const SafeStringBase<char> &rStr) : FixedSafeStringBase<char, Len>(rStr) { }
virtual ~FixedSafeString();
};
};

View File

@ -1,49 +0,0 @@
#include "seadSafeString.h"
#include <cstring>
namespace sead
{
template <typename T>
inline int SafeStringBase<T>::calcLength() const
{
assureTerminationImpl_();
int length = 0;
for (;;)
{
if (length > cMaximumLength || mTop[length] == cNullChar)
break;
length++;
}
if (length > cMaximumLength)
{
return 0;
}
return length;
}
template <typename T>
inline int BufferedSafeStringBase<T>::copy(const SafeStringBase<T>& src, int copyLength)
{
T* dst = getMutableStringTop_();
const T* csrc = src.cstr();
if (dst == csrc)
return 0;
if (copyLength < 0)
copyLength = src.calcLength();
if (copyLength >= mSize)
{
copyLength = mSize - 1;
}
std::memcpy(dst, csrc, copyLength * sizeof(T));
dst[copyLength] = SafeStringBase<T>::cNullChar;
return copyLength;
}
};

View File

@ -1,52 +0,0 @@
#pragma once
namespace sead
{
template<typename T>
class Vector2
{
public:
T x;
T y;
};
template<typename T>
class Vector3
{
public:
T x;
T y;
T z;
inline void set(T x, T y, T z)
{
this->x = x;
this->y = y;
this->z = z;
}
static const Vector3 zero;
static const Vector3 ex;
static const Vector3 ey;
static const Vector3 ez;
static const Vector3 ones;
};
template<typename T>
class Vector4
{
public:
T x;
T y;
T z;
T h;
inline void set(T x, T y, T z, T h)
{
this->x = x;
this->y = y;
this->z = z;
this->h = h;
}
};
};