2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-04-12 11:37:07 +00:00
|
|
|
|
|
|
|
#include "DNACommon.hpp"
|
|
|
|
#include "PAK.hpp"
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace DataSpec::DNADGRP {
|
2018-02-22 07:24:51 +00:00
|
|
|
|
2016-04-12 11:37:07 +00:00
|
|
|
template <class IDType>
|
2018-12-08 05:30:43 +00:00
|
|
|
struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) DGRP : BigDNA {
|
|
|
|
AT_DECL_DNA_YAML
|
|
|
|
Value<atUint32> dependCount;
|
|
|
|
struct ObjectTag : BigDNA {
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_DNA_YAML
|
2018-12-08 05:30:43 +00:00
|
|
|
DNAFourCC type;
|
|
|
|
Value<IDType> id;
|
|
|
|
|
|
|
|
bool validate() const {
|
|
|
|
if (!id.operator bool())
|
|
|
|
return false;
|
|
|
|
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(id);
|
|
|
|
return path && !path.isNone();
|
2018-04-02 04:27:24 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Vector<ObjectTag, AT_DNA_COUNT(dependCount)> depends;
|
|
|
|
|
|
|
|
void validateDeps() {
|
|
|
|
std::vector<ObjectTag> newDeps;
|
|
|
|
newDeps.reserve(depends.size());
|
|
|
|
for (const ObjectTag& tag : depends)
|
|
|
|
if (tag.validate())
|
|
|
|
newDeps.push_back(tag);
|
|
|
|
depends = std::move(newDeps);
|
|
|
|
dependCount = atUint32(depends.size());
|
|
|
|
}
|
2016-04-12 11:37:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template <class IDType>
|
|
|
|
bool ExtractDGRP(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
|
|
|
|
template <class IDType>
|
|
|
|
bool WriteDGRP(const DGRP<IDType>& dgrp, const hecl::ProjectPath& outPath);
|
2018-02-22 07:24:51 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace DataSpec::DNADGRP
|