2015-07-13 06:29:12 +00:00
|
|
|
#include "STRG.hpp"
|
|
|
|
#include "../DNAMP1/STRG.hpp"
|
|
|
|
#include "../DNAMP2/STRG.hpp"
|
|
|
|
#include "../DNAMP3/STRG.hpp"
|
|
|
|
|
|
|
|
namespace Retro
|
|
|
|
{
|
2015-07-16 01:57:34 +00:00
|
|
|
|
|
|
|
HECL::Database::ASListType<std::string> ASTYPE_STRGLanguage("STRG", "Language", "string");
|
|
|
|
|
2015-07-13 06:29:12 +00:00
|
|
|
std::unique_ptr<ISTRG> LoadSTRG(Athena::io::IStreamReader& reader)
|
|
|
|
{
|
|
|
|
reader.setEndian(Athena::BigEndian);
|
|
|
|
uint32_t magic = reader.readUint32();
|
|
|
|
if (magic != 0x87654321)
|
|
|
|
{
|
2015-07-16 01:57:34 +00:00
|
|
|
LogDNACommon.report(LogVisor::Error, "invalid STRG magic");
|
2015-07-13 06:29:12 +00:00
|
|
|
return std::unique_ptr<ISTRG>();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t version = reader.readUint32();
|
|
|
|
switch (version)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
2015-07-16 01:57:34 +00:00
|
|
|
DNAMP1::STRG* newStrg = new DNAMP1::STRG;
|
2015-07-13 06:29:12 +00:00
|
|
|
newStrg->_read(reader);
|
|
|
|
return std::unique_ptr<ISTRG>(newStrg);
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
2015-07-16 01:57:34 +00:00
|
|
|
DNAMP2::STRG* newStrg = new DNAMP2::STRG;
|
2015-07-13 06:29:12 +00:00
|
|
|
newStrg->_read(reader);
|
|
|
|
return std::unique_ptr<ISTRG>(newStrg);
|
|
|
|
}
|
|
|
|
case 3:
|
|
|
|
{
|
2015-07-16 01:57:34 +00:00
|
|
|
DNAMP3::STRG* newStrg = new DNAMP3::STRG;
|
2015-07-13 06:29:12 +00:00
|
|
|
newStrg->_read(reader);
|
|
|
|
return std::unique_ptr<ISTRG>(newStrg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return std::unique_ptr<ISTRG>();
|
|
|
|
}
|
|
|
|
}
|