mirror of https://github.com/AxioDL/metaforce.git
added runtime stubs
This commit is contained in:
parent
043af55580
commit
c1f4f31e6f
|
@ -5,3 +5,4 @@ if (NOT TARGET NOD)
|
||||||
endif()
|
endif()
|
||||||
include_directories(${ATHENA_INCLUDE_DIR} ${LOG_VISOR_INCLUDE_DIR})
|
include_directories(${ATHENA_INCLUDE_DIR} ${LOG_VISOR_INCLUDE_DIR})
|
||||||
add_subdirectory(DataSpec)
|
add_subdirectory(DataSpec)
|
||||||
|
add_subdirectory(Runtime)
|
||||||
|
|
|
@ -10,6 +10,20 @@ namespace Retro
|
||||||
/* This comes up a great deal */
|
/* This comes up a great deal */
|
||||||
typedef Athena::io::DNA<Athena::BigEndian> BigDNA;
|
typedef Athena::io::DNA<Athena::BigEndian> BigDNA;
|
||||||
|
|
||||||
|
class FourCC final : public BigDNA, public HECL::FourCC
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FourCC() : HECL::FourCC() {}
|
||||||
|
FourCC(const char* name)
|
||||||
|
: HECL::FourCC(name) {}
|
||||||
|
|
||||||
|
Delete expl;
|
||||||
|
inline void read(Athena::io::IStreamReader& reader)
|
||||||
|
{reader.readUBytesToBuf(fcc, 4);}
|
||||||
|
inline void write(Athena::io::IStreamWriter& writer) const
|
||||||
|
{writer.writeUBytes((atUint8*)fcc, 4);}
|
||||||
|
};
|
||||||
|
|
||||||
/* PAK 32-bit Unique ID */
|
/* PAK 32-bit Unique ID */
|
||||||
class UniqueID32 : public BigDNA
|
class UniqueID32 : public BigDNA
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace DNAMP1
|
||||||
struct MLVL : BigDNA
|
struct MLVL : BigDNA
|
||||||
{
|
{
|
||||||
DECL_DNA
|
DECL_DNA
|
||||||
HECL::FourCC magic;
|
FourCC magic;
|
||||||
Value<atUint32> version;
|
Value<atUint32> version;
|
||||||
UniqueID32 worldNameId;
|
UniqueID32 worldNameId;
|
||||||
UniqueID32 saveWorldId;
|
UniqueID32 saveWorldId;
|
||||||
|
|
|
@ -17,7 +17,7 @@ public:
|
||||||
struct NameEntry : public BigDNA
|
struct NameEntry : public BigDNA
|
||||||
{
|
{
|
||||||
DECL_DNA
|
DECL_DNA
|
||||||
HECL::FourCC type;
|
FourCC type;
|
||||||
UniqueID32 id;
|
UniqueID32 id;
|
||||||
Value<atUint32> nameLen;
|
Value<atUint32> nameLen;
|
||||||
String<DNA_COUNT(nameLen)> name;
|
String<DNA_COUNT(nameLen)> name;
|
||||||
|
@ -27,7 +27,7 @@ public:
|
||||||
{
|
{
|
||||||
DECL_DNA
|
DECL_DNA
|
||||||
Value<atUint32> compressed;
|
Value<atUint32> compressed;
|
||||||
HECL::FourCC type;
|
FourCC type;
|
||||||
UniqueID32 id;
|
UniqueID32 id;
|
||||||
Value<atUint32> size;
|
Value<atUint32> size;
|
||||||
Value<atUint32> offset;
|
Value<atUint32> offset;
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct STRG : BigDNA
|
||||||
|
|
||||||
struct Language
|
struct Language
|
||||||
{
|
{
|
||||||
HECL::FourCC lang;
|
FourCC lang;
|
||||||
std::vector<std::wstring> strings;
|
std::vector<std::wstring> strings;
|
||||||
};
|
};
|
||||||
std::vector<Language> langs;
|
std::vector<Language> langs;
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace DNAMP2
|
||||||
struct MLVL : BigDNA
|
struct MLVL : BigDNA
|
||||||
{
|
{
|
||||||
DECL_DNA
|
DECL_DNA
|
||||||
HECL::FourCC magic;
|
FourCC magic;
|
||||||
Value<atUint32> version;
|
Value<atUint32> version;
|
||||||
UniqueID32 worldNameId;
|
UniqueID32 worldNameId;
|
||||||
UniqueID32 darkWorldNameId;
|
UniqueID32 darkWorldNameId;
|
||||||
|
|
|
@ -55,7 +55,7 @@ void PAK::write(Athena::io::IStreamWriter& writer) const
|
||||||
writer.setEndian(Athena::BigEndian);
|
writer.setEndian(Athena::BigEndian);
|
||||||
m_header.write(writer);
|
m_header.write(writer);
|
||||||
|
|
||||||
HECL::FourCC("STRG").write(writer);
|
FourCC("STRG").write(writer);
|
||||||
atUint32 strgSz = 4;
|
atUint32 strgSz = 4;
|
||||||
for (const NameEntry& entry : m_nameEntries)
|
for (const NameEntry& entry : m_nameEntries)
|
||||||
strgSz += entry.name.size() + 13;
|
strgSz += entry.name.size() + 13;
|
||||||
|
@ -63,13 +63,13 @@ void PAK::write(Athena::io::IStreamWriter& writer) const
|
||||||
strgSz += strgPad;
|
strgSz += strgPad;
|
||||||
writer.writeUint32(strgSz);
|
writer.writeUint32(strgSz);
|
||||||
|
|
||||||
HECL::FourCC("RSHD").write(writer);
|
FourCC("RSHD").write(writer);
|
||||||
atUint32 rshdSz = 4 + 24 * m_entries.size();
|
atUint32 rshdSz = 4 + 24 * m_entries.size();
|
||||||
atUint32 rshdPad = ((rshdSz + 63) & ~63) - rshdSz;
|
atUint32 rshdPad = ((rshdSz + 63) & ~63) - rshdSz;
|
||||||
rshdSz += rshdPad;
|
rshdSz += rshdPad;
|
||||||
writer.writeUint32(rshdSz);
|
writer.writeUint32(rshdSz);
|
||||||
|
|
||||||
HECL::FourCC("DATA").write(writer);
|
FourCC("DATA").write(writer);
|
||||||
atUint32 dataSz = 0;
|
atUint32 dataSz = 0;
|
||||||
for (const Entry& entry : m_entries)
|
for (const Entry& entry : m_entries)
|
||||||
dataSz += (entry.size + 63) & ~63;
|
dataSz += (entry.size + 63) & ~63;
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
{
|
{
|
||||||
DECL_DNA
|
DECL_DNA
|
||||||
String<-1> name;
|
String<-1> name;
|
||||||
HECL::FourCC type;
|
FourCC type;
|
||||||
UniqueID64 id;
|
UniqueID64 id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
add_subdirectory(Core)
|
||||||
|
add_subdirectory(Graphics)
|
||||||
|
add_subdirectory(Audio)
|
||||||
|
add_subdirectory(Character)
|
||||||
|
add_subdirectory(GuiSys)
|
||||||
|
add_subdirectory(Script)
|
||||||
|
|
Loading…
Reference in New Issue