2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 22:27:43 +00:00

initial MLVL and STRG trilogy integration

This commit is contained in:
Jack Andersen
2015-07-12 20:29:12 -10:00
parent abb9d4c000
commit 7876d4c209
26 changed files with 1333 additions and 126 deletions

View File

@@ -0,0 +1,42 @@
#include "STRG.hpp"
#include "../DNAMP1/STRG.hpp"
#include "../DNAMP2/STRG.hpp"
#include "../DNAMP3/STRG.hpp"
namespace Retro
{
std::unique_ptr<ISTRG> LoadSTRG(Athena::io::IStreamReader& reader)
{
reader.setEndian(Athena::BigEndian);
uint32_t magic = reader.readUint32();
if (magic != 0x87654321)
{
LogModule.report(LogVisor::Error, "invalid STRG magic");
return std::unique_ptr<ISTRG>();
}
uint32_t version = reader.readUint32();
switch (version)
{
case 0:
{
DNAMP1::STRG* newStrg = new struct DNAMP1::STRG;
newStrg->_read(reader);
return std::unique_ptr<ISTRG>(newStrg);
}
case 1:
{
DNAMP2::STRG* newStrg = new struct DNAMP2::STRG;
newStrg->_read(reader);
return std::unique_ptr<ISTRG>(newStrg);
}
case 3:
{
DNAMP3::STRG* newStrg = new struct DNAMP3::STRG;
newStrg->_read(reader);
return std::unique_ptr<ISTRG>(newStrg);
}
}
return std::unique_ptr<ISTRG>();
}
}