metaforce/DataSpec/DNACommon/STRG.cpp

40 lines
1.0 KiB
C++
Raw Normal View History

#include "STRG.hpp"
#include "../DNAMP1/STRG.hpp"
#include "../DNAMP2/STRG.hpp"
#include "../DNAMP3/STRG.hpp"
2018-12-08 05:30:43 +00:00
namespace DataSpec {
2015-07-16 01:57:34 +00:00
2018-12-08 05:30:43 +00:00
void ISTRG::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const { /* TODO: parse out resource tokens */ }
2018-12-08 05:30:43 +00:00
std::unique_ptr<ISTRG> LoadSTRG(athena::io::IStreamReader& reader) {
uint32_t magic = reader.readUint32Big();
if (magic != 0x87654321) {
LogDNACommon.report(logvisor::Error, "invalid STRG magic");
return std::unique_ptr<ISTRG>();
2018-12-08 05:30:43 +00:00
}
uint32_t version = reader.readUint32Big();
switch (version) {
case 0: {
DNAMP1::STRG* newStrg = new DNAMP1::STRG;
newStrg->_read(reader);
return std::unique_ptr<ISTRG>(newStrg);
}
case 1: {
DNAMP2::STRG* newStrg = new DNAMP2::STRG;
newStrg->_read(reader);
return std::unique_ptr<ISTRG>(newStrg);
}
case 3: {
DNAMP3::STRG* newStrg = new DNAMP3::STRG;
newStrg->_read(reader);
return std::unique_ptr<ISTRG>(newStrg);
}
default:
break;
}
return std::unique_ptr<ISTRG>();
}
2018-12-08 05:30:43 +00:00
} // namespace DataSpec