2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-16 04:17:03 +00:00

Humungous refactor

This commit is contained in:
Jack Andersen
2016-03-04 13:04:53 -10:00
parent 552ec1db4a
commit 783fb4c4fe
330 changed files with 2943 additions and 3077 deletions

View File

@@ -1,15 +1,15 @@
#include "ANIM.hpp"
#include <float.h>
#include <math.h>
#include <cfloat>
#include "zeus/Math.hpp"
namespace DataSpec
{
namespace DNAMP3
{
using ANIMOutStream = HECL::BlenderConnection::PyOutStream::ANIMOutStream;
using ANIMOutStream = hecl::BlenderConnection::PyOutStream::ANIMOutStream;
void ANIM::IANIM::sendANIMToBlender(HECL::BlenderConnection::PyOutStream& os, const CINF& cinf, bool additive) const
void ANIM::IANIM::sendANIMToBlender(hecl::BlenderConnection::PyOutStream& os, const CINF& cinf, bool additive) const
{
os.format("act.hecl_fps = round(%f)\n"
"act.hecl_additive = %s\n",
@@ -109,7 +109,7 @@ void ANIM::IANIM::sendANIMToBlender(HECL::BlenderConnection::PyOutStream& os, co
}
}
void ANIM::ANIM0::read(Athena::io::IStreamReader& reader)
void ANIM::ANIM0::read(athena::io::IStreamReader& reader)
{
Header head;
head.read(reader);
@@ -235,7 +235,7 @@ void ANIM::ANIM0::read(Athena::io::IStreamReader& reader)
}
}
void ANIM::ANIM0::write(Athena::io::IStreamWriter& writer) const
void ANIM::ANIM0::write(athena::io::IStreamWriter& writer) const
{
Header head;
head.unk0 = 0;
@@ -425,7 +425,7 @@ static float ComputeFrames(const std::vector<float>& keyTimes, std::vector<atUin
return mainInterval;
}
void ANIM::ANIM1::read(Athena::io::IStreamReader& reader)
void ANIM::ANIM1::read(athena::io::IStreamReader& reader)
{
Header head;
head.read(reader);
@@ -522,7 +522,7 @@ void ANIM::ANIM1::read(Athena::io::IStreamReader& reader)
chanKeys = bsReader.read(bsData.get(), head.keyCount-1, channels, 32767, head.translationMult);
}
void ANIM::ANIM1::write(Athena::io::IStreamWriter& writer) const
void ANIM::ANIM1::write(athena::io::IStreamWriter& writer) const
{
}

View File

@@ -27,7 +27,7 @@ struct ANIM : BigDNA
std::vector<std::vector<DNAANIM::Value>> chanKeys;
float mainInterval = 0.0;
void sendANIMToBlender(HECL::BlenderConnection::PyOutStream&, const CINF&, bool additive) const;
void sendANIMToBlender(hecl::BlenderConnection::PyOutStream&, const CINF&, bool additive) const;
};
struct ANIM0 : IANIM
@@ -80,7 +80,7 @@ struct ANIM : BigDNA
};
std::unique_ptr<IANIM> m_anim;
void read(Athena::io::IStreamReader& reader)
void read(athena::io::IStreamReader& reader)
{
atUint32 version = reader.readUint32Big();
switch (version)
@@ -94,12 +94,12 @@ struct ANIM : BigDNA
m_anim->read(reader);
break;
default:
Log.report(LogVisor::FatalError, "unrecognized ANIM version");
Log.report(logvisor::Fatal, "unrecognized ANIM version");
break;
}
}
void write(Athena::io::IStreamWriter& writer) const
void write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(m_anim->m_version);
m_anim->write(writer);
@@ -110,7 +110,7 @@ struct ANIM : BigDNA
return m_anim->binarySize(__isz + 4);
}
void sendANIMToBlender(HECL::BlenderConnection::PyOutStream& os, const CINF& cinf, bool additive) const
void sendANIMToBlender(hecl::BlenderConnection::PyOutStream& os, const CINF& cinf, bool additive) const
{
m_anim->sendANIMToBlender(os, cinf, additive);
}

View File

@@ -5,7 +5,7 @@ namespace DataSpec
namespace DNAMP3
{
void CHAR::AnimationInfo::EVNT::SFXEvent::read(Athena::io::IStreamReader& reader)
void CHAR::AnimationInfo::EVNT::SFXEvent::read(athena::io::IStreamReader& reader)
{
EventBase::read(reader);
caudId.read(reader);
@@ -17,10 +17,10 @@ void CHAR::AnimationInfo::EVNT::SFXEvent::read(Athena::io::IStreamReader& reader
if (extraType == 1)
extraFloat = reader.readFloatBig();
else if (extraType == 2)
reader.seek(35, Athena::Current);
reader.seek(35, athena::Current);
}
void CHAR::AnimationInfo::EVNT::SFXEvent::write(Athena::io::IStreamWriter& writer) const
void CHAR::AnimationInfo::EVNT::SFXEvent::write(athena::io::IStreamWriter& writer) const
{
EventBase::write(writer);
caudId.write(writer);
@@ -32,7 +32,7 @@ void CHAR::AnimationInfo::EVNT::SFXEvent::write(Athena::io::IStreamWriter& write
if (extraType == 1)
writer.writeFloatBig(extraFloat);
else if (extraType == 2)
writer.seek(35, Athena::Current);
writer.seek(35, athena::Current);
}
size_t CHAR::AnimationInfo::EVNT::SFXEvent::binarySize(size_t __isz) const
@@ -48,26 +48,24 @@ size_t CHAR::AnimationInfo::EVNT::SFXEvent::binarySize(size_t __isz) const
return __isz;
}
void CHAR::AnimationInfo::EVNT::SFXEvent::read(Athena::io::YAMLDocReader& reader)
void CHAR::AnimationInfo::EVNT::SFXEvent::read(athena::io::YAMLDocReader& reader)
{
EventBase::read(reader);
reader.enumerate("caudId", caudId);
unk1 = reader.readUint32("unk1");
unk2 = reader.readUint32("unk2");
unk3 = reader.readUint32("unk3");
reader.enumerate("unk3Vals", unk3Vals, unk3);
unk3 = reader.enumerate("unk3Vals", unk3Vals);
extraType = reader.readUint32("extraType");
if (extraType == 1)
extraFloat = reader.readFloat("extraFloat");
}
void CHAR::AnimationInfo::EVNT::SFXEvent::write(Athena::io::YAMLDocWriter& writer) const
void CHAR::AnimationInfo::EVNT::SFXEvent::write(athena::io::YAMLDocWriter& writer) const
{
EventBase::write(writer);
writer.enumerate("caudId", caudId);
writer.writeUint32("unk1", unk1);
writer.writeUint32("unk2", unk2);
writer.writeUint32("unk3", unk3);
writer.enumerate("unk3Vals", unk3Vals);
writer.writeUint32("extraType", extraType);
if (extraType == 1)
@@ -76,10 +74,10 @@ void CHAR::AnimationInfo::EVNT::SFXEvent::write(Athena::io::YAMLDocWriter& write
const char* CHAR::AnimationInfo::EVNT::SFXEvent::DNAType()
{
return "Retro::DNAMP3::CHAR::AnimationInfo::EVNT::SFXEvent";
return "urde::DNAMP3::CHAR::AnimationInfo::EVNT::SFXEvent";
}
void CHAR::AnimationInfo::MetaAnimFactory::read(Athena::io::IStreamReader& reader)
void CHAR::AnimationInfo::MetaAnimFactory::read(athena::io::IStreamReader& reader)
{
IMetaAnim::Type type(IMetaAnim::Type(reader.readUint32Big()));
switch (type)
@@ -110,7 +108,7 @@ void CHAR::AnimationInfo::MetaAnimFactory::read(Athena::io::IStreamReader& reade
}
}
void CHAR::AnimationInfo::MetaAnimFactory::write(Athena::io::IStreamWriter& writer) const
void CHAR::AnimationInfo::MetaAnimFactory::write(athena::io::IStreamWriter& writer) const
{
if (!m_anim)
return;
@@ -125,7 +123,7 @@ size_t CHAR::AnimationInfo::MetaAnimFactory::binarySize(size_t __isz) const
return m_anim->binarySize(__isz + 4);
}
void CHAR::AnimationInfo::MetaAnimFactory::read(Athena::io::YAMLDocReader& reader)
void CHAR::AnimationInfo::MetaAnimFactory::read(athena::io::YAMLDocReader& reader)
{
std::string type = reader.readString("type");
std::transform(type.begin(), type.end(), type.begin(), tolower);
@@ -161,7 +159,7 @@ void CHAR::AnimationInfo::MetaAnimFactory::read(Athena::io::YAMLDocReader& reade
}
void CHAR::AnimationInfo::MetaAnimFactory::write(Athena::io::YAMLDocWriter& writer) const
void CHAR::AnimationInfo::MetaAnimFactory::write(athena::io::YAMLDocWriter& writer) const
{
if (!m_anim)
return;
@@ -171,7 +169,7 @@ void CHAR::AnimationInfo::MetaAnimFactory::write(Athena::io::YAMLDocWriter& writ
const char* CHAR::AnimationInfo::MetaAnimFactory::DNAType()
{
return "Retro::DNAMP3::CHAR::AnimationInfo::MetaAnimFactory";
return "urde::DNAMP3::CHAR::AnimationInfo::MetaAnimFactory";
}
}

View File

@@ -308,34 +308,34 @@ struct CHAR : BigYAML
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged)
std::function<void(const hecl::SystemChar*)> fileChanged)
{
HECL::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"));
HECL::ProjectPath::Type yamlType = yamlPath.getPathType();
HECL::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"));
HECL::ProjectPath::Type blendType = blendPath.getPathType();
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"));
hecl::ProjectPath::Type yamlType = yamlPath.getPathType();
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"));
hecl::ProjectPath::Type blendType = blendPath.getPathType();
if (force ||
yamlType == HECL::ProjectPath::Type::None ||
blendType == HECL::ProjectPath::Type::None)
yamlType == hecl::ProjectPath::Type::None ||
blendType == hecl::ProjectPath::Type::None)
{
CHAR aChar;
aChar.read(rs);
if (force || yamlType == HECL::ProjectPath::Type::None)
if (force || yamlType == hecl::ProjectPath::Type::None)
{
FILE* fp = HECL::Fopen(yamlPath.getAbsolutePath().c_str(), _S("wb"));
FILE* fp = hecl::Fopen(yamlPath.getAbsolutePath().c_str(), _S("wb"));
aChar.toYAMLFile(fp);
fclose(fp);
}
if (force || blendType == HECL::ProjectPath::Type::None)
if (force || blendType == hecl::ProjectPath::Type::None)
{
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, CHAR, MaterialSet, DNACMDL::SurfaceHeader_3, 4>
(conn, aChar, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
}

View File

@@ -13,7 +13,7 @@ namespace DNAMP3
struct CINF : DNAMP2::CINF
{
Delete expl;
void sendCINFToBlender(HECL::BlenderConnection::PyOutStream& os, const UniqueID64& cinfId) const
void sendCINFToBlender(hecl::BlenderConnection::PyOutStream& os, const UniqueID64& cinfId) const
{
os.format("arm = bpy.data.armatures.new('CINF_%016" PRIX64 "')\n"
"arm_obj = bpy.data.objects.new(arm.name, arm)\n"

View File

@@ -17,11 +17,11 @@ struct CMDL
{
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool,
std::function<void(const HECL::SystemChar*)>)
std::function<void(const hecl::SystemChar*)>)
{
/* Check for RigPair */
const PAKRouter<PAKBridge>::RigPair* rp = pakRouter.lookupCMDLRigPair(entry.id);
@@ -37,8 +37,8 @@ struct CMDL
}
/* Do extract */
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
if (!conn.createBlend(outPath, HECL::BlenderConnection::BlendType::Mesh))
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::Mesh))
return false;
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_3, 5>
(conn, rs, pakRouter, entry, dataSpec, loadRp);

View File

@@ -1,6 +1,6 @@
#include "CMDLMaterials.hpp"
using Stream = HECL::BlenderConnection::PyOutStream;
using Stream = hecl::BlenderConnection::PyOutStream;
namespace DataSpec
{
@@ -108,7 +108,7 @@ void MaterialSet::ConstructMaterial(Stream& out,
" new_nodetree.links.new(kcolor_nodes[-1][1].outputs[0], final_node.inputs['Alpha'])\n";
}
void Material::SectionPASS::constructNode(HECL::BlenderConnection::PyOutStream& out,
void Material::SectionPASS::constructNode(hecl::BlenderConnection::PyOutStream& out,
const PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
const Material::ISection* prevSection,
@@ -121,16 +121,16 @@ void Material::SectionPASS::constructNode(HECL::BlenderConnection::PyOutStream&
if (txtrId)
{
std::string texName = pakRouter.getBestEntryName(txtrId);
const NOD::Node* node;
const nod::Node* node;
const PAK::Entry* texEntry = pakRouter.lookupEntry(txtrId, &node);
HECL::ProjectPath txtrPath = pakRouter.getWorking(texEntry);
if (txtrPath.getPathType() == HECL::ProjectPath::Type::None)
hecl::ProjectPath txtrPath = pakRouter.getWorking(texEntry);
if (txtrPath.getPathType() == hecl::ProjectPath::Type::None)
{
PAKEntryReadStream rs = texEntry->beginReadStream(*node);
TXTR::Extract(rs, txtrPath);
}
HECL::SystemString resPath = pakRouter.getResourceRelativePath(entry, txtrId);
HECL::SystemUTF8View resPathView(resPath);
hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, txtrId);
hecl::SystemUTF8View resPathView(resPath);
out.format("if '%s' in bpy.data.textures:\n"
" image = bpy.data.images['%s']\n"
" texture = bpy.data.textures[image.name]\n"
@@ -258,7 +258,7 @@ void Material::SectionPASS::constructNode(HECL::BlenderConnection::PyOutStream&
out << "gridder.row_break(2)\n";
}
void Material::SectionCLR::constructNode(HECL::BlenderConnection::PyOutStream& out,
void Material::SectionCLR::constructNode(hecl::BlenderConnection::PyOutStream& out,
const PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
const Material::ISection* prevSection,
@@ -278,7 +278,7 @@ void Material::SectionCLR::constructNode(HECL::BlenderConnection::PyOutStream& o
}
}
void Material::SectionINT::constructNode(HECL::BlenderConnection::PyOutStream& out,
void Material::SectionINT::constructNode(hecl::BlenderConnection::PyOutStream& out,
const PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
const Material::ISection* prevSection,

View File

@@ -64,7 +64,7 @@ struct MaterialSet : BigDNA
INT = SBIG('INT ')
} m_type;
ISection(Type type) : m_type(type) {}
virtual void constructNode(HECL::BlenderConnection::PyOutStream& out,
virtual void constructNode(hecl::BlenderConnection::PyOutStream& out,
const PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
const Material::ISection* prevSection,
@@ -115,7 +115,7 @@ struct MaterialSet : BigDNA
};
Vector<UVAnimation, DNA_COUNT(uvAnimSize != 0)> uvAnim;
void constructNode(HECL::BlenderConnection::PyOutStream& out,
void constructNode(hecl::BlenderConnection::PyOutStream& out,
const PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
const Material::ISection* prevSection,
@@ -136,7 +136,7 @@ struct MaterialSet : BigDNA
DNAFourCC subtype;
GX::Color color;
void constructNode(HECL::BlenderConnection::PyOutStream& out,
void constructNode(hecl::BlenderConnection::PyOutStream& out,
const PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
const Material::ISection* prevSection,
@@ -160,7 +160,7 @@ struct MaterialSet : BigDNA
DNAFourCC subtype;
Value<atUint32> value;
void constructNode(HECL::BlenderConnection::PyOutStream& out,
void constructNode(hecl::BlenderConnection::PyOutStream& out,
const PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
const Material::ISection* prevSection,
@@ -173,7 +173,7 @@ struct MaterialSet : BigDNA
{
Delete expl;
std::unique_ptr<ISection> section;
void read(Athena::io::IStreamReader& reader)
void read(athena::io::IStreamReader& reader)
{
DNAFourCC type;
type.read(reader);
@@ -196,7 +196,7 @@ struct MaterialSet : BigDNA
break;
}
}
void write(Athena::io::IStreamWriter& writer) const
void write(athena::io::IStreamWriter& writer) const
{
if (!section)
return;
@@ -209,7 +209,7 @@ struct MaterialSet : BigDNA
}
};
std::vector<SectionFactory> sections;
void read(Athena::io::IStreamReader& reader)
void read(athena::io::IStreamReader& reader)
{
header.read(reader);
sections.clear();
@@ -219,7 +219,7 @@ struct MaterialSet : BigDNA
} while (sections.back().section);
sections.pop_back();
}
void write(Athena::io::IStreamWriter& writer) const
void write(athena::io::IStreamWriter& writer) const
{
header.write(writer);
for (const SectionFactory& section : sections)
@@ -236,14 +236,14 @@ struct MaterialSet : BigDNA
};
Vector<Material, DNA_COUNT(materialCount)> materials;
static void RegisterMaterialProps(HECL::BlenderConnection::PyOutStream& out);
static void ConstructMaterial(HECL::BlenderConnection::PyOutStream& out,
static void RegisterMaterialProps(hecl::BlenderConnection::PyOutStream& out);
static void ConstructMaterial(hecl::BlenderConnection::PyOutStream& out,
const PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
const MaterialSet::Material& material,
unsigned groupIdx, unsigned matIdx);
void readToBlender(HECL::BlenderConnection::PyOutStream& os,
void readToBlender(hecl::BlenderConnection::PyOutStream& os,
const PAKRouter<PAKBridge>& pakRouter,
const PAKRouter<PAKBridge>::EntryType& entry,
unsigned setIdx)

View File

@@ -41,7 +41,7 @@ struct CSKR : BigDNA
return mtxBindings.at(idx).mtxs;
}
void weightVertex(HECL::BlenderConnection::PyOutStream& os, const CINF& cinf, atInt16 skinIdx) const
void weightVertex(hecl::BlenderConnection::PyOutStream& os, const CINF& cinf, atInt16 skinIdx) const
{
if (skinIdx < 0)
return;

View File

@@ -14,7 +14,7 @@ namespace DataSpec
{
namespace DNAMP3
{
LogVisor::LogModule Log("Retro::DNAMP3");
logvisor::Module Log("urde::DNAMP3");
static bool GetNoShare(const std::string& name)
{
@@ -25,16 +25,16 @@ static bool GetNoShare(const std::string& name)
return true;
}
PAKBridge::PAKBridge(HECL::Database::Project& project,
const NOD::Node& node,
PAKBridge::PAKBridge(hecl::Database::Project& project,
const nod::Node& node,
bool doExtract)
: m_project(project), m_node(node), m_pak(GetNoShare(node.getName())), m_doExtract(doExtract)
{
NOD::AthenaPartReadStream rs(node.beginReadStream());
nod::AthenaPartReadStream rs(node.beginReadStream());
m_pak.read(rs);
/* Append Level String */
std::set<HECL::SystemString, HECL::CaseInsensitiveCompare> uniq;
std::set<hecl::SystemString, hecl::CaseInsensitiveCompare> uniq;
for (PAK::Entry& entry : m_pak.m_entries)
{
if (entry.type == FOURCC('MLVL'))
@@ -53,7 +53,7 @@ PAKBridge::PAKBridge(HECL::Database::Project& project,
}
}
bool comma = false;
for (const HECL::SystemString& str : uniq)
for (const hecl::SystemString& str : uniq)
{
if (comma)
m_levelString += _S(", ");
@@ -62,12 +62,12 @@ PAKBridge::PAKBridge(HECL::Database::Project& project,
}
}
static HECL::SystemString LayerName(const std::string& name)
static hecl::SystemString LayerName(const std::string& name)
{
#if HECL_UCS2
HECL::SystemString ret = HECL::UTF8ToWide(name);
hecl::SystemString ret = hecl::UTF8ToWide(name);
#else
HECL::SystemString ret = name;
hecl::SystemString ret = name;
#endif
for (auto& ch : ret)
if (ch == _S('/') || ch == _S('\\'))
@@ -90,7 +90,7 @@ void PAKBridge::build()
mlvl.read(rs);
}
#if HECL_UCS2
level.name = HECL::UTF8ToWide(m_pak.bestEntryName(entry));
level.name = hecl::UTF8ToWide(m_pak.bestEntryName(entry));
#else
level.name = m_pak.bestEntryName(entry);
#endif
@@ -103,7 +103,7 @@ void PAKBridge::build()
if (worldMapEnt)
{
PAKEntryReadStream rs = worldMapEnt->beginReadStream(m_node);
rs.seek(8, Athena::Current);
rs.seek(8, athena::Current);
atUint32 areaCount = rs.readUint32Big();
mapw.reserve(areaCount);
for (atUint32 i=0 ; i<areaCount ; ++i)
@@ -138,21 +138,21 @@ void PAKBridge::build()
if (areaDeps.name.empty())
{
#if HECL_UCS2
areaDeps.name = HECL::UTF8ToWide(area.internalAreaName);
areaDeps.name = hecl::UTF8ToWide(area.internalAreaName);
#else
areaDeps.name = area.internalAreaName;
#endif
if (areaDeps.name.empty())
{
#if HECL_UCS2
areaDeps.name = _S("MREA_") + HECL::UTF8ToWide(area.areaMREAId.toString());
areaDeps.name = _S("MREA_") + hecl::UTF8ToWide(area.areaMREAId.toString());
#else
areaDeps.name = "MREA_" + area.areaMREAId.toString();
#endif
}
}
HECL::SystemChar num[16];
HECL::SNPrintf(num, 16, _S("%02u "), ai);
hecl::SystemChar num[16];
hecl::SNPrintf(num, 16, _S("%02u "), ai);
areaDeps.name = num + areaDeps.name;
const MLVL::LayerFlags& layerFlags = *layerFlagsIt++;
@@ -173,7 +173,7 @@ void PAKBridge::build()
while (layer.name.size() && isspace(layer.name.back()))
layer.name.pop_back();
#endif
HECL::SNPrintf(num, 16, layer.active ? _S("%02ua ") : _S("%02u "), l-1);
hecl::SNPrintf(num, 16, layer.active ? _S("%02ua ") : _S("%02u "), l-1);
layer.name = num + layer.name;
}
}

View File

@@ -9,31 +9,31 @@ namespace DataSpec
namespace DNAMP3
{
extern LogVisor::LogModule Log;
extern logvisor::Module Log;
/* MP3-specific, one-shot PAK traversal/extraction class */
class PAKBridge
{
HECL::Database::Project& m_project;
const NOD::Node& m_node;
hecl::Database::Project& m_project;
const nod::Node& m_node;
PAK m_pak;
public:
bool m_doExtract;
using Level = Level<UniqueID64>;
std::unordered_map<UniqueID64, Level> m_levelDeps;
HECL::SystemString m_levelString;
hecl::SystemString m_levelString;
PAKBridge(HECL::Database::Project& project,
const NOD::Node& node,
PAKBridge(hecl::Database::Project& project,
const nod::Node& node,
bool doExtract=true);
void build();
static ResExtractor<PAKBridge> LookupExtractor(const PAK::Entry& entry);
inline const std::string& getName() const {return m_node.getName();}
inline HECL::SystemString getLevelString() const {return m_levelString;}
inline hecl::SystemString getLevelString() const {return m_levelString;}
using PAKType = PAK;
inline const PAKType& getPAK() const {return m_pak;}
inline const NOD::Node& getNode() const {return m_node;}
inline const nod::Node& getNode() const {return m_node;}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID64, std::pair<UniqueID64, UniqueID64>>& addTo) const;

View File

@@ -13,15 +13,15 @@ struct MAPA : DNAMAPA::MAPA
{
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged)
std::function<void(const hecl::SystemChar*)> fileChanged)
{
MAPA mapa;
mapa.read(rs);
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
}
};

View File

@@ -80,18 +80,18 @@ struct MLVL : BigYAML
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged)
std::function<void(const hecl::SystemChar*)> fileChanged)
{
MLVL mlvl;
mlvl.read(rs);
FILE* fp = HECL::Fopen(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath().c_str(), _S("wb"));
FILE* fp = hecl::Fopen(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath().c_str(), _S("wb"));
mlvl.toYAMLFile(fp);
fclose(fp);
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter,
entry, force, fileChanged);
}

View File

@@ -1,4 +1,4 @@
#include <Athena/FileWriter.hpp>
#include <athena/FileWriter.hpp>
#include "MREA.hpp"
#include "../DNAMP2/DeafBabe.hpp"
#include "../DNACommon/BabeDead.hpp"
@@ -8,7 +8,7 @@ namespace DataSpec
namespace DNAMP3
{
MREA::StreamReader::StreamReader(Athena::io::IStreamReader& source,
MREA::StreamReader::StreamReader(athena::io::IStreamReader& source,
atUint32 blkCount, atUint32 secIdxCount)
: DNAMP2::MREA::StreamReader(source)
{
@@ -35,7 +35,7 @@ MREA::StreamReader::StreamReader(Athena::io::IStreamReader& source,
nextBlock();
}
void MREA::StreamReader::writeSecIdxs(Athena::io::IStreamWriter& writer) const
void MREA::StreamReader::writeSecIdxs(athena::io::IStreamWriter& writer) const
{
for (const std::pair<DNAFourCC, atUint32>& idx : m_secIdxs)
{
@@ -44,12 +44,12 @@ void MREA::StreamReader::writeSecIdxs(Athena::io::IStreamWriter& writer) const
}
}
void MREA::ReadBabeDeadToBlender_3(HECL::BlenderConnection::PyOutStream& os,
Athena::io::IStreamReader& rs)
void MREA::ReadBabeDeadToBlender_3(hecl::BlenderConnection::PyOutStream& os,
athena::io::IStreamReader& rs)
{
atUint32 bdMagic = rs.readUint32Big();
if (bdMagic != 0xBABEDEAD)
Log.report(LogVisor::FatalError, "invalid BABEDEAD magic");
Log.report(logvisor::Fatal, "invalid BABEDEAD magic");
os << "bpy.context.scene.render.engine = 'CYCLES'\n"
"bpy.context.scene.world.use_nodes = True\n"
"bpy.context.scene.render.engine = 'BLENDER_GAME'\n"
@@ -68,18 +68,18 @@ void MREA::ReadBabeDeadToBlender_3(HECL::BlenderConnection::PyOutStream& os,
bool MREA::Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
std::function<void(const HECL::SystemChar*)>)
std::function<void(const hecl::SystemChar*)>)
{
using RigPair = std::pair<CSKR*, CINF*>;
RigPair dummy(nullptr, nullptr);
/* Rename MREA for consistency */
HECL::ProjectPath mreaPath(outPath.getParentPath(), _S("!area.blend"));
if (!force && mreaPath.getPathType() == HECL::ProjectPath::Type::File)
hecl::ProjectPath mreaPath(outPath.getParentPath(), _S("!area.blend"));
if (!force && mreaPath.getPathType() == hecl::ProjectPath::Type::File)
return true;
/* Do extract */
@@ -89,7 +89,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* MREA decompression stream */
StreamReader drs(rs, head.compressedBlockCount, head.secIndexCount);
Athena::io::FileWriter mreaDecompOut(pakRouter.getCooked(&entry).getWithExtension(_S(".decomp")).getAbsolutePath());
athena::io::FileWriter mreaDecompOut(pakRouter.getCooked(&entry).getWithExtension(_S(".decomp")).getAbsolutePath());
head.write(mreaDecompOut);
mreaDecompOut.seekAlign32();
drs.writeDecompInfos(mreaDecompOut);
@@ -99,16 +99,16 @@ bool MREA::Extract(const SpecBase& dataSpec,
atUint64 decompLen = drs.length();
mreaDecompOut.writeBytes(drs.readBytes(decompLen).get(), decompLen);
mreaDecompOut.close();
drs.seek(0, Athena::Begin);
drs.seek(0, athena::Begin);
/* Start up blender connection */
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
if (!conn.createBlend(mreaPath, HECL::BlenderConnection::BlendType::Area))
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
if (!conn.createBlend(mreaPath, hecl::BlenderConnection::BlendType::Area))
return false;
/* Open Py Stream and read sections */
HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"from mathutils import Vector\n"
@@ -133,7 +133,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
atUint64 secStart = drs.position();
matSet.read(drs);
matSet.readToBlender(os, pakRouter, entry, 0);
drs.seek(secStart + head.secSizes[0], Athena::Begin);
drs.seek(secStart + head.secSizes[0], athena::Begin);
std::vector<DNACMDL::VertexAttributes> vertAttribs;
DNACMDL::GetVertexAttributes(matSet, vertAttribs);
@@ -147,16 +147,16 @@ bool MREA::Extract(const SpecBase& dataSpec,
MeshHeader mHeader;
secStart = drs.position();
mHeader.read(drs);
drs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
drs.seek(secStart + head.secSizes[curSec++], athena::Begin);
/* Surface count from here */
secStart = drs.position();
surfaceCounts.push_back(drs.readUint32Big());
drs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
drs.seek(secStart + head.secSizes[curSec++], athena::Begin);
/* Seek through AROT-relation sections */
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
}
/* Skip though WOBJs */
@@ -167,14 +167,14 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* Skip AROT */
if (secIdxIt->first == FOURCC('ROCT'))
{
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
++secIdxIt;
}
/* Skip AABB */
if (secIdxIt->first == FOURCC('AABB'))
{
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
++secIdxIt;
}
@@ -193,7 +193,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* Skip DEPS */
if (secIdxIt->first == FOURCC('DEPS'))
{
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
++secIdxIt;
}
@@ -201,14 +201,14 @@ bool MREA::Extract(const SpecBase& dataSpec,
if (secIdxIt->first == FOURCC('SOBJ'))
{
for (atUint32 l=0 ; l<head.sclyLayerCount ; ++l)
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
++secIdxIt;
}
/* Skip SGEN */
if (secIdxIt->first == FOURCC('SGEN'))
{
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
++secIdxIt;
}
@@ -220,7 +220,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
collision.read(drs);
DNAMP2::DeafBabe::BlenderInit(os);
collision.sendToBlender(os);
drs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
drs.seek(secStart + head.secSizes[curSec++], athena::Begin);
++secIdxIt;
}
@@ -229,7 +229,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
{
secStart = drs.position();
ReadBabeDeadToBlender_3(os, drs);
drs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
drs.seek(secStart + head.secSizes[curSec++], athena::Begin);
++secIdxIt;
}
@@ -258,7 +258,7 @@ bool MREA::ExtractLayerDeps(PAKEntryReadStream& rs, PAKBridge::Level::Area& area
{
if (idx.first == FOURCC('DEPS'))
{
drs.seek(head.getSecOffset(idx.second), Athena::Begin);
drs.seek(head.getSecOffset(idx.second), athena::Begin);
DEPS deps;
deps.read(drs);

View File

@@ -16,13 +16,13 @@ struct MREA
struct StreamReader : DNAMP2::MREA::StreamReader
{
std::vector<std::pair<DNAFourCC, atUint32>> m_secIdxs;
StreamReader(Athena::io::IStreamReader& source,
StreamReader(athena::io::IStreamReader& source,
atUint32 blkCount, atUint32 secIdxCount);
std::vector<std::pair<DNAFourCC, atUint32>>::const_iterator beginSecIdxs()
{
return m_secIdxs.begin();
}
void writeSecIdxs(Athena::io::IStreamWriter& writer) const;
void writeSecIdxs(athena::io::IStreamWriter& writer) const;
};
struct Header : BigDNA
@@ -36,7 +36,7 @@ struct MREA
Value<atUint32> secCount;
Value<atUint32> compressedBlockCount;
Value<atUint32> secIndexCount;
Seek<20, Athena::Current> align1;
Seek<20, athena::Current> align1;
Vector<atUint32, DNA_COUNT(secCount)> secSizes;
atUint32 getSecOffset(atUint32 idx) const
@@ -111,16 +111,16 @@ struct MREA
Value<atUint32> unk13;
};
static void ReadBabeDeadToBlender_3(HECL::BlenderConnection::PyOutStream& os,
Athena::io::IStreamReader& rs);
static void ReadBabeDeadToBlender_3(hecl::BlenderConnection::PyOutStream& os,
athena::io::IStreamReader& rs);
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool,
std::function<void(const HECL::SystemChar*)>);
std::function<void(const hecl::SystemChar*)>);
static bool ExtractLayerDeps(PAKEntryReadStream& rs, PAKBridge::Level::Area& areaOut);
};

View File

@@ -6,19 +6,19 @@ namespace DataSpec
namespace DNAMP3
{
const HECL::FourCC CMPD("CMPD");
const hecl::FourCC CMPD("CMPD");
void PAK::read(Athena::io::IStreamReader& reader)
void PAK::read(athena::io::IStreamReader& reader)
{
m_header.read(reader);
if (m_header.version != 2)
Log.report(LogVisor::FatalError, "unexpected PAK magic");
Log.report(logvisor::Fatal, "unexpected PAK magic");
reader.seek(8, Athena::Current);
reader.seek(8, athena::Current);
atUint32 strgSz = reader.readUint32Big();
reader.seek(4, Athena::Current);
reader.seek(4, athena::Current);
atUint32 rshdSz = reader.readUint32Big();
reader.seek(44, Athena::Current);
reader.seek(44, athena::Current);
atUint32 dataOffset = 128 + strgSz + rshdSz;
atUint64 strgBase = reader.position();
@@ -30,7 +30,7 @@ void PAK::read(Athena::io::IStreamReader& reader)
m_nameEntries.emplace_back();
m_nameEntries.back().read(reader);
}
reader.seek(strgBase + strgSz, Athena::Begin);
reader.seek(strgBase + strgSz, athena::Begin);
atUint32 count = reader.readUint32Big();
m_entries.clear();
@@ -67,7 +67,7 @@ void PAK::read(Athena::io::IStreamReader& reader)
}
}
}
void PAK::write(Athena::io::IStreamWriter& writer) const
void PAK::write(athena::io::IStreamWriter& writer) const
{
m_header.write(writer);
@@ -93,12 +93,12 @@ void PAK::write(Athena::io::IStreamWriter& writer) const
atUint32 dataPad = ((dataSz + 63) & ~63) - dataSz;
dataSz += dataPad;
writer.writeUint32Big(dataSz);
writer.seek(36, Athena::Current);
writer.seek(36, athena::Current);
writer.writeUint32Big((atUint32)m_nameEntries.size());
for (const NameEntry& entry : m_nameEntries)
entry.write(writer);
writer.seek(strgPad, Athena::Current);
writer.seek(strgPad, athena::Current);
writer.writeUint32Big((atUint32)m_entries.size());
for (const Entry& entry : m_entries)
@@ -107,7 +107,7 @@ void PAK::write(Athena::io::IStreamWriter& writer) const
copy.offset -= dataOffset;
copy.write(writer);
}
writer.seek(rshdPad, Athena::Current);
writer.seek(rshdPad, athena::Current);
}
size_t PAK::binarySize(size_t __isz) const
{
@@ -136,23 +136,23 @@ size_t PAK::binarySize(size_t __isz) const
return __isz;
}
std::unique_ptr<atUint8[]> PAK::Entry::getBuffer(const NOD::Node& pak, atUint64& szOut) const
std::unique_ptr<atUint8[]> PAK::Entry::getBuffer(const nod::Node& pak, atUint64& szOut) const
{
if (compressed)
{
std::unique_ptr<NOD::IPartReadStream> strm = pak.beginReadStream(offset);
std::unique_ptr<nod::IPartReadStream> strm = pak.beginReadStream(offset);
struct
{
HECL::FourCC magic;
hecl::FourCC magic;
atUint32 blockCount;
} head;
strm->read(&head, 8);
if (head.magic != CMPD)
{
Log.report(LogVisor::Error, "invalid CMPD block");
Log.report(logvisor::Error, "invalid CMPD block");
return std::unique_ptr<atUint8[]>();
}
head.blockCount = HECL::SBig(head.blockCount);
head.blockCount = hecl::SBig(head.blockCount);
struct Block
{
@@ -167,8 +167,8 @@ std::unique_ptr<atUint8[]> PAK::Entry::getBuffer(const NOD::Node& pak, atUint64&
for (atUint32 b=0 ; b<head.blockCount ; ++b)
{
Block& block = blocks[b];
block.compSz = HECL::SBig(block.compSz) & 0xffffff;
block.decompSz = HECL::SBig(block.decompSz);
block.compSz = hecl::SBig(block.compSz) & 0xffffff;
block.decompSz = hecl::SBig(block.decompSz);
if (block.compSz > maxBlockSz)
maxBlockSz = block.compSz;
totalDecompSz += block.decompSz;
@@ -192,7 +192,7 @@ std::unique_ptr<atUint8[]> PAK::Entry::getBuffer(const NOD::Node& pak, atUint64&
atUint32 rem = block.decompSz;
while (rem)
{
atUint16 chunkSz = HECL::SBig(*(atUint16*)compBufCur);
atUint16 chunkSz = hecl::SBig(*(atUint16*)compBufCur);
compBufCur += 2;
lzo_uint dsz = rem;
lzo1x_decompress(compBufCur, chunkSz, bufCur, &dsz, nullptr);

View File

@@ -4,7 +4,7 @@
#include <unordered_map>
#include <lzo/lzo1x.h>
#include <NOD/DiscBase.hpp>
#include <nod/DiscBase.hpp>
#include "../DNACommon/PAK.hpp"
namespace DataSpec
@@ -12,7 +12,7 @@ namespace DataSpec
namespace DNAMP3
{
extern const HECL::FourCC CMPD;
extern const hecl::FourCC CMPD;
struct PAK : BigDNA
{
@@ -25,7 +25,7 @@ struct PAK : BigDNA
Value<atUint32> version;
Value<atUint32> headSz;
Value<atUint8> md5sum[16];
Seek<40, Athena::Current> seek;
Seek<40, athena::Current> seek;
} m_header;
struct NameEntry : BigDNA
@@ -47,8 +47,8 @@ struct PAK : BigDNA
UniqueResult unique;
std::string name;
std::unique_ptr<atUint8[]> getBuffer(const NOD::Node& pak, atUint64& szOut) const;
inline PAKEntryReadStream beginReadStream(const NOD::Node& pak, atUint64 off=0) const
std::unique_ptr<atUint8[]> getBuffer(const nod::Node& pak, atUint64& szOut) const;
inline PAKEntryReadStream beginReadStream(const nod::Node& pak, atUint64 off=0) const
{
atUint64 sz;
std::unique_ptr<atUint8[]> buf = getBuffer(pak, sz);

View File

@@ -6,7 +6,7 @@ namespace DataSpec
namespace DNAMP3
{
void STRG::_read(Athena::io::IStreamReader& reader)
void STRG::_read(athena::io::IStreamReader& reader)
{
atUint32 langCount = reader.readUint32Big();
atUint32 strCount = reader.readUint32Big();
@@ -24,8 +24,8 @@ void STRG::_read(Athena::io::IStreamReader& reader)
}* nameIndex = (NameIdxEntry*)nameTableBuf.get();
for (atUint32 n=0 ; n<nameCount ; ++n)
{
const char* name = (char*)(nameTableBuf.get() + HECL::SBig(nameIndex[n].nameOff));
names[name] = HECL::SBig(nameIndex[n].strIdx);
const char* name = (char*)(nameTableBuf.get() + hecl::SBig(nameIndex[n].nameOff));
names[name] = hecl::SBig(nameIndex[n].strIdx);
}
}
@@ -53,7 +53,7 @@ void STRG::_read(Athena::io::IStreamReader& reader)
std::vector<std::string> strs;
for (atUint32 s=0 ; s<strCount ; ++s)
{
reader.seek(strBase + strOffs[l*strCount+s], Athena::Begin);
reader.seek(strBase + strOffs[l*strCount+s], athena::Begin);
atUint32 len = reader.readUint32Big();
strs.emplace_back(reader.readString(len));
}
@@ -66,28 +66,28 @@ void STRG::_read(Athena::io::IStreamReader& reader)
langMap.emplace(item.first, &item.second);
}
void STRG::read(Athena::io::IStreamReader& reader)
void STRG::read(athena::io::IStreamReader& reader)
{
atUint32 magic = reader.readUint32Big();
if (magic != 0x87654321)
{
Log.report(LogVisor::Error, "invalid STRG magic");
Log.report(logvisor::Error, "invalid STRG magic");
return;
}
atUint32 version = reader.readUint32Big();
if (version != 3)
{
Log.report(LogVisor::Error, "invalid STRG version");
Log.report(logvisor::Error, "invalid STRG version");
return;
}
_read(reader);
}
void STRG::read(Athena::io::YAMLDocReader& reader)
void STRG::read(athena::io::YAMLDocReader& reader)
{
const Athena::io::YAMLNode* root = reader.getRootNode();
const athena::io::YAMLNode* root = reader.getRootNode();
/* Validate Pass */
if (root->m_type == YAML_MAPPING_NODE)
@@ -98,12 +98,12 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
continue;
if (lang.first.size() != 4)
{
Log.report(LogVisor::Warning, "STRG language string '%s' must be exactly 4 characters; skipping", lang.first.c_str());
Log.report(logvisor::Warning, "STRG language string '%s' must be exactly 4 characters; skipping", lang.first.c_str());
return;
}
if (lang.second->m_type != YAML_SEQUENCE_NODE)
{
Log.report(LogVisor::Warning,
Log.report(logvisor::Warning,
"STRG language string '%s' must contain a sequence; skipping", lang.first.c_str());
return;
}
@@ -111,7 +111,7 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
{
if (str->m_type != YAML_SCALAR_NODE)
{
Log.report(LogVisor::Warning, "STRG language '%s' must contain all scalars; skipping", lang.first.c_str());
Log.report(logvisor::Warning, "STRG language '%s' must contain all scalars; skipping", lang.first.c_str());
return;
}
}
@@ -119,16 +119,16 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
}
else
{
Log.report(LogVisor::Warning, "STRG must have a mapping root node; skipping");
Log.report(logvisor::Warning, "STRG must have a mapping root node; skipping");
return;
}
const Athena::io::YAMLNode* nameYAML = root->findMapChild("names");
const athena::io::YAMLNode* nameYAML = root->findMapChild("names");
names.clear();
if (nameYAML && nameYAML->m_type == YAML_MAPPING_NODE)
for (const auto& item : nameYAML->m_mapChildren)
if (item.second->m_type == YAML_SCALAR_NODE)
names[item.first] = Athena::io::NodeToVal<atInt32>(item.second.get());
names[item.first] = athena::io::NodeToVal<atInt32>(item.second.get());
langs.clear();
langs.reserve(root->m_mapChildren.size());
@@ -151,7 +151,7 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
langMap.emplace(item.first, &item.second);
}
void STRG::write(Athena::io::IStreamWriter& writer) const
void STRG::write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(0x87654321);
writer.writeUint32Big(3);
@@ -243,7 +243,7 @@ size_t STRG::binarySize(size_t __isz) const
return __isz;
}
void STRG::write(Athena::io::YAMLDocWriter& writer) const
void STRG::write(athena::io::YAMLDocWriter& writer) const
{
for (const auto& item : langs)
{
@@ -268,7 +268,7 @@ void STRG::write(Athena::io::YAMLDocWriter& writer) const
const char* STRG::DNAType()
{
return "Retro::DNAMP3::STRG";
return "urde::DNAMP3::STRG";
}
}

View File

@@ -14,7 +14,7 @@ struct STRG : ISTRG
{
DECL_YAML
Delete expl;
void _read(Athena::io::IStreamReader& reader);
void _read(athena::io::IStreamReader& reader);
std::vector<std::pair<DNAFourCC, std::vector<std::string>>> langs;
std::unordered_map<DNAFourCC, std::vector<std::string>*> langMap;
std::map<std::string, int32_t> names;
@@ -49,37 +49,37 @@ struct STRG : ISTRG
{
auto search = langMap.find(lang);
if (search != langMap.end())
return HECL::UTF8ToWide(search->second->at(idx));
return hecl::UTF8ToWide(search->second->at(idx));
return std::wstring();
}
inline HECL::SystemString getSystemString(const FourCC& lang, size_t idx) const
inline hecl::SystemString getSystemString(const FourCC& lang, size_t idx) const
{
auto search = langMap.find(lang);
if (search != langMap.end())
#if HECL_UCS2
return HECL::UTF8ToWide(search->second->at(idx));
return hecl::UTF8ToWide(search->second->at(idx));
#else
return search->second->at(idx);
#endif
return HECL::SystemString();
return hecl::SystemString();
}
static bool Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
std::unique_ptr<ISTRG> strg = LoadSTRG(rs);
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
strg->toYAMLFile(fp);
fclose(fp);
return true;
}
static bool Cook(const HECL::ProjectPath& inPath, const HECL::ProjectPath& outPath)
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
STRG strg;
FILE* fp = HECL::Fopen(inPath.getAbsolutePath().c_str(), _S("rb"));
FILE* fp = hecl::Fopen(inPath.getAbsolutePath().c_str(), _S("rb"));
strg.fromYAMLFile(fp);
fclose(fp);
Athena::io::FileWriter ws(outPath.getAbsolutePath());
athena::io::FileWriter ws(outPath.getAbsolutePath());
strg.write(ws);
return true;
}