2019-08-23 23:24:04 +00:00
|
|
|
#include "DataSpec/DNACommon/STRG.hpp"
|
|
|
|
|
|
|
|
#include "DataSpec/DNAMP1/STRG.hpp"
|
|
|
|
#include "DataSpec/DNAMP2/STRG.hpp"
|
|
|
|
#include "DataSpec/DNAMP3/STRG.hpp"
|
|
|
|
|
|
|
|
#include <logvisor/logvisor.hpp>
|
2015-07-13 06:29:12 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace DataSpec {
|
2015-07-16 01:57:34 +00:00
|
|
|
|
2021-06-07 19:29:18 +00:00
|
|
|
void ISTRG::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const { /* TODO: parse out resource tokens */
|
|
|
|
}
|
2015-07-13 06:29:12 +00:00
|
|
|
|
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) {
|
2020-04-11 22:51:39 +00:00
|
|
|
LogDNACommon.report(logvisor::Error, FMT_STRING("invalid STRG magic"));
|
2021-06-30 18:20:45 +00:00
|
|
|
return {};
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t version = reader.readUint32Big();
|
|
|
|
switch (version) {
|
|
|
|
case 0: {
|
2021-06-30 18:20:45 +00:00
|
|
|
auto* newStrg = new DNAMP1::STRG;
|
2018-12-08 05:30:43 +00:00
|
|
|
newStrg->_read(reader);
|
|
|
|
return std::unique_ptr<ISTRG>(newStrg);
|
|
|
|
}
|
|
|
|
case 1: {
|
2021-06-30 18:20:45 +00:00
|
|
|
auto* newStrg = new DNAMP2::STRG;
|
2018-12-08 05:30:43 +00:00
|
|
|
newStrg->_read(reader);
|
|
|
|
return std::unique_ptr<ISTRG>(newStrg);
|
|
|
|
}
|
|
|
|
case 3: {
|
2021-06-30 18:20:45 +00:00
|
|
|
auto* newStrg = new DNAMP3::STRG;
|
2018-12-08 05:30:43 +00:00
|
|
|
newStrg->_read(reader);
|
|
|
|
return std::unique_ptr<ISTRG>(newStrg);
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2021-06-30 18:20:45 +00:00
|
|
|
return {};
|
2015-07-13 06:29:12 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace DataSpec
|