mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 22:27:41 +00:00
Humungous refactor
This commit is contained in:
@@ -11,7 +11,7 @@ namespace DataSpec
|
||||
namespace DNAANCS
|
||||
{
|
||||
|
||||
using Actor = HECL::BlenderConnection::DataStream::Actor;
|
||||
using Actor = hecl::BlenderConnection::DataStream::Actor;
|
||||
|
||||
template <typename IDTYPE>
|
||||
struct CharacterResInfo
|
||||
@@ -20,7 +20,7 @@ struct CharacterResInfo
|
||||
IDTYPE cmdl;
|
||||
IDTYPE cskr;
|
||||
IDTYPE cinf;
|
||||
std::vector<std::pair<HECL::FourCC, std::pair<IDTYPE, IDTYPE>>> overlays;
|
||||
std::vector<std::pair<hecl::FourCC, std::pair<IDTYPE, IDTYPE>>> overlays;
|
||||
};
|
||||
|
||||
template <typename IDTYPE>
|
||||
@@ -33,13 +33,13 @@ struct AnimationResInfo
|
||||
};
|
||||
|
||||
template <class PAKRouter, class ANCSDNA, class MaterialSet, class SurfaceHeader, atUint32 CMDLVersion>
|
||||
bool ReadANCSToBlender(HECL::BlenderConnection& conn,
|
||||
bool ReadANCSToBlender(hecl::BlenderConnection& conn,
|
||||
const ANCSDNA& ancs,
|
||||
const HECL::ProjectPath& outPath,
|
||||
const hecl::ProjectPath& outPath,
|
||||
PAKRouter& pakRouter,
|
||||
const typename PAKRouter::EntryType& entry,
|
||||
const SpecBase& dataspec,
|
||||
std::function<void(const HECL::SystemChar*)> fileChanged,
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged,
|
||||
bool force=false)
|
||||
{
|
||||
/* Extract character CMDL/CSKR first */
|
||||
@@ -47,17 +47,18 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
|
||||
ancs.getCharacterResInfo(chResInfo);
|
||||
for (const auto& info : chResInfo)
|
||||
{
|
||||
const NOD::Node* node;
|
||||
const nod::Node* node;
|
||||
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(info.cmdl, &node, true, true);
|
||||
if (cmdlE)
|
||||
{
|
||||
HECL::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
if (force || cmdlPath.getPathType() == HECL::ProjectPath::Type::None)
|
||||
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
if (force || cmdlPath.getPathType() == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
if (!conn.createBlend(cmdlPath, HECL::BlenderConnection::BlendType::Mesh))
|
||||
if (!conn.createBlend(cmdlPath, hecl::BlenderConnection::BlendType::Mesh))
|
||||
return false;
|
||||
|
||||
HECL::SystemStringView bestNameView(pakRouter.getBestEntryName(*cmdlE));
|
||||
std::string bestName = pakRouter.getBestEntryName(*cmdlE);
|
||||
hecl::SystemStringView bestNameView(bestName);
|
||||
fileChanged(bestNameView.sys_str().c_str());
|
||||
|
||||
typename ANCSDNA::CSKRType cskr;
|
||||
@@ -76,13 +77,14 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
|
||||
}
|
||||
}
|
||||
|
||||
HECL::SystemStringView bestNameView(pakRouter.getBestEntryName(entry));
|
||||
std::string bestName = pakRouter.getBestEntryName(entry);
|
||||
hecl::SystemStringView bestNameView(bestName);
|
||||
fileChanged(bestNameView.sys_str().c_str());
|
||||
|
||||
/* Establish ANCS blend */
|
||||
if (!conn.createBlend(outPath, HECL::BlenderConnection::BlendType::Actor))
|
||||
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::Actor))
|
||||
return false;
|
||||
HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||
|
||||
os.format("import bpy\n"
|
||||
"from mathutils import Vector\n"
|
||||
@@ -125,7 +127,7 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
|
||||
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(info.cmdl, nullptr, true, true);
|
||||
if (cmdlE)
|
||||
{
|
||||
HECL::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
os.linkBlend(cmdlPath.getAbsolutePathUTF8().c_str(),
|
||||
pakRouter.getBestEntryName(*cmdlE).c_str(), true);
|
||||
|
||||
@@ -147,7 +149,7 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
|
||||
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(overlay.second.first, nullptr, true, true);
|
||||
if (cmdlE)
|
||||
{
|
||||
HECL::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
os.linkBlend(cmdlPath.getAbsolutePathUTF8().c_str(),
|
||||
pakRouter.getBestEntryName(*cmdlE).c_str(), true);
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#include "zeus/Math.hpp"
|
||||
#include "ANIM.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
@@ -39,50 +38,50 @@ size_t ComputeBitstreamSize(size_t keyFrameCount, const std::vector<Channel>& ch
|
||||
|
||||
static inline QuantizedRot QuantizeRotation(const Value& quat, atUint32 div)
|
||||
{
|
||||
float q = M_PI / 2.0 / div;
|
||||
float q = M_PI / 2.0f / float(div);
|
||||
return
|
||||
{
|
||||
{
|
||||
atInt16(asinf(quat.v4.vec[1]) / q),
|
||||
atInt16(asinf(quat.v4.vec[2]) / q),
|
||||
atInt16(asinf(quat.v4.vec[3]) / q),
|
||||
atInt16(std::asin(quat.v4.vec[1]) / q),
|
||||
atInt16(std::asin(quat.v4.vec[2]) / q),
|
||||
atInt16(std::asin(quat.v4.vec[3]) / q),
|
||||
},
|
||||
(quat.v4.vec[0] < 0) ? true : false
|
||||
(quat.v4.vec[0] < 0.f) ? true : false
|
||||
};
|
||||
}
|
||||
|
||||
static inline Value DequantizeRotation(const QuantizedRot& v, atUint32 div)
|
||||
{
|
||||
float q = M_PI / 2.0 / div;
|
||||
float q = M_PI / 2.0f / float(div);
|
||||
Value retval =
|
||||
{
|
||||
0.0,
|
||||
sinf(v.v[0] * q),
|
||||
sinf(v.v[1] * q),
|
||||
sinf(v.v[2] * q),
|
||||
0.0f,
|
||||
std::sin(v.v[0] * q),
|
||||
std::sin(v.v[1] * q),
|
||||
std::sin(v.v[2] * q),
|
||||
};
|
||||
retval.v4.vec[0] = sqrtf(std::max((1.0 -
|
||||
retval.v4.vec[0] = std::sqrt(std::max((1.0f -
|
||||
(retval.v4.vec[1] * retval.v4.vec[1] +
|
||||
retval.v4.vec[2] * retval.v4.vec[2] +
|
||||
retval.v4.vec[3] * retval.v4.vec[3])), 0.0));
|
||||
retval.v4.vec[3] * retval.v4.vec[3])), 0.0f));
|
||||
retval.v4.vec[0] = v.w ? -retval.v4.vec[0] : retval.v4.vec[0];
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline Value DequantizeRotation_3(const QuantizedRot& v, atUint32 div)
|
||||
{
|
||||
float q = 1.0 / div;
|
||||
float q = 1.0f / float(div);
|
||||
Value retval =
|
||||
{
|
||||
0.0,
|
||||
0.0f,
|
||||
v.v[0] * q,
|
||||
v.v[1] * q,
|
||||
v.v[2] * q,
|
||||
};
|
||||
retval.v4.vec[0] = sqrtf(std::max((1.0 -
|
||||
retval.v4.vec[0] = std::sqrt(std::max((1.0f -
|
||||
(retval.v4.vec[1] * retval.v4.vec[1] +
|
||||
retval.v4.vec[2] * retval.v4.vec[2] +
|
||||
retval.v4.vec[3] * retval.v4.vec[3])), 0.0));
|
||||
retval.v4.vec[3] * retval.v4.vec[3])), 0.0f));
|
||||
retval.v4.vec[0] = v.w ? -retval.v4.vec[0] : retval.v4.vec[0];
|
||||
return retval;
|
||||
}
|
||||
@@ -94,7 +93,7 @@ bool BitstreamReader::dequantizeBit(const atUint8* data)
|
||||
|
||||
/* Fill 32 bit buffer with region containing bits */
|
||||
/* Make them least significant */
|
||||
atUint32 tempBuf = HECL::SBig(*reinterpret_cast<const atUint32*>(data + byteCur)) >> bitRem;
|
||||
atUint32 tempBuf = hecl::SBig(*reinterpret_cast<const atUint32*>(data + byteCur)) >> bitRem;
|
||||
|
||||
/* That's it */
|
||||
m_bitCur += 1;
|
||||
@@ -108,13 +107,13 @@ atInt16 BitstreamReader::dequantize(const atUint8* data, atUint8 q)
|
||||
|
||||
/* Fill 32 bit buffer with region containing bits */
|
||||
/* Make them least significant */
|
||||
atUint32 tempBuf = HECL::SBig(*reinterpret_cast<const atUint32*>(data + byteCur)) >> bitRem;
|
||||
atUint32 tempBuf = hecl::SBig(*reinterpret_cast<const atUint32*>(data + byteCur)) >> bitRem;
|
||||
|
||||
/* If this shift underflows the value, buffer the next 32 bits */
|
||||
/* And tack onto shifted buffer */
|
||||
if ((bitRem + q) > 32)
|
||||
{
|
||||
atUint32 tempBuf2 = HECL::SBig(*reinterpret_cast<const atUint32*>(data + byteCur + 4));
|
||||
atUint32 tempBuf2 = hecl::SBig(*reinterpret_cast<const atUint32*>(data + byteCur + 4));
|
||||
tempBuf |= (tempBuf2 << (32 - bitRem));
|
||||
}
|
||||
|
||||
@@ -256,7 +255,7 @@ void BitstreamWriter::quantizeBit(atUint8* data, bool val)
|
||||
/* Fill 32 bit buffer with region containing bits */
|
||||
/* Make them least significant */
|
||||
*(atUint32*)(data + byteCur) =
|
||||
HECL::SBig(HECL::SBig(*(atUint32*)(data + byteCur)) | (val << bitRem));
|
||||
hecl::SBig(hecl::SBig(*(atUint32*)(data + byteCur)) | (val << bitRem));
|
||||
|
||||
m_bitCur += 1;
|
||||
}
|
||||
@@ -271,14 +270,14 @@ void BitstreamWriter::quantize(atUint8* data, atUint8 q, atInt16 val)
|
||||
/* Fill 32 bit buffer with region containing bits */
|
||||
/* Make them least significant */
|
||||
*(atUint32*)(data + byteCur) =
|
||||
HECL::SBig(HECL::SBig(*(atUint32*)(data + byteCur)) | (masked << bitRem));
|
||||
hecl::SBig(hecl::SBig(*(atUint32*)(data + byteCur)) | (masked << bitRem));
|
||||
|
||||
/* If this shift underflows the value, buffer the next 32 bits */
|
||||
/* And tack onto shifted buffer */
|
||||
if ((bitRem + q) > 32)
|
||||
{
|
||||
*(atUint32*)(data + byteCur + 4) =
|
||||
HECL::SBig(HECL::SBig(*(atUint32*)(data + byteCur + 4)) | (masked >> (32 - bitRem)));
|
||||
hecl::SBig(hecl::SBig(*(atUint32*)(data + byteCur + 4)) | (masked >> (32 - bitRem)));
|
||||
}
|
||||
|
||||
m_bitCur += q;
|
||||
@@ -295,7 +294,7 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
|
||||
rotDivOut = 32767; /* Normalized range of values */
|
||||
|
||||
/* Pre-pass to calculate translation multiplier */
|
||||
float maxTransDiff = 0.0;
|
||||
float maxTransDiff = 0.0f;
|
||||
auto kit = chanKeys.begin();
|
||||
for (Channel& chan : channels)
|
||||
{
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
#ifndef _DNACOMMON_BABEDEAD_HPP_
|
||||
#define _DNACOMMON_BABEDEAD_HPP_
|
||||
|
||||
#include <BlenderConnection.hpp>
|
||||
|
||||
#ifndef _USE_MATH_DEFINES
|
||||
#define _USE_MATH_DEFINES 1
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include "BlenderConnection.hpp"
|
||||
#include "zeus/Math.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
|
||||
template<class BabeDeadLight>
|
||||
void ReadBabeDeadLightToBlender(HECL::BlenderConnection::PyOutStream& os,
|
||||
void ReadBabeDeadLightToBlender(hecl::BlenderConnection::PyOutStream& os,
|
||||
const BabeDeadLight& light, unsigned s, unsigned l)
|
||||
{
|
||||
switch (light.lightType)
|
||||
@@ -45,7 +41,7 @@ void ReadBabeDeadLightToBlender(HECL::BlenderConnection::PyOutStream& os,
|
||||
"lamp_obj.rotation_mode = 'QUATERNION'\n"
|
||||
"lamp_obj.rotation_quaternion = Vector((0,0,-1)).rotation_difference(Vector((%f,%f,%f)))\n"
|
||||
"\n", s, l,
|
||||
light.spotCutoff * M_PI / 180.f,
|
||||
zeus::degToRad(light.spotCutoff),
|
||||
light.direction.vec[0], light.direction.vec[1], light.direction.vec[2]);
|
||||
break;
|
||||
default: return;
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace DataSpec
|
||||
namespace DNACMDL
|
||||
{
|
||||
|
||||
void InitGeomBlenderContext(HECL::BlenderConnection::PyOutStream& os,
|
||||
const HECL::ProjectPath& masterShaderPath)
|
||||
void InitGeomBlenderContext(hecl::BlenderConnection::PyOutStream& os,
|
||||
const hecl::ProjectPath& masterShaderPath)
|
||||
{
|
||||
os << "# Using 'Blender Game'\n"
|
||||
"bpy.context.scene.render.engine = 'BLENDER_GAME'\n"
|
||||
@@ -87,7 +87,7 @@ void InitGeomBlenderContext(HECL::BlenderConnection::PyOutStream& os,
|
||||
"\n", masterShaderPath.getAbsolutePathUTF8().c_str());
|
||||
}
|
||||
|
||||
void FinishBlenderMesh(HECL::BlenderConnection::PyOutStream& os,
|
||||
void FinishBlenderMesh(hecl::BlenderConnection::PyOutStream& os,
|
||||
unsigned matSetCount, int meshIdx)
|
||||
{
|
||||
if (meshIdx < 0)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef _DNACOMMON_CMDL_HPP_
|
||||
#define _DNACOMMON_CMDL_HPP_
|
||||
|
||||
#include <Athena/FileWriter.hpp>
|
||||
#include <HECL/Frontend.hpp>
|
||||
#include <HECL/Backend/GX.hpp>
|
||||
#include <athena/FileWriter.hpp>
|
||||
#include <hecl/Frontend.hpp>
|
||||
#include <hecl/Backend/GX.hpp>
|
||||
#include "PAK.hpp"
|
||||
#include "BlenderConnection.hpp"
|
||||
#include "GX.hpp"
|
||||
@@ -14,7 +14,7 @@ namespace DataSpec
|
||||
namespace DNACMDL
|
||||
{
|
||||
|
||||
using Mesh = HECL::BlenderConnection::DataStream::Mesh;
|
||||
using Mesh = hecl::BlenderConnection::DataStream::Mesh;
|
||||
|
||||
struct Header : BigDNA
|
||||
{
|
||||
@@ -49,7 +49,7 @@ struct SurfaceHeader_1 : BigDNA
|
||||
Value<atUint32> unk2 = 0;
|
||||
Value<atUint32> aabbSz = 0;
|
||||
Value<atVec3f> reflectionNormal;
|
||||
Seek<DNA_COUNT(aabbSz), Athena::Current> seek2;
|
||||
Seek<DNA_COUNT(aabbSz), athena::Current> seek2;
|
||||
Align<32> align;
|
||||
|
||||
static constexpr bool UseMatrixSkinning() {return false;}
|
||||
@@ -69,7 +69,7 @@ struct SurfaceHeader_2 : BigDNA
|
||||
Value<atVec3f> reflectionNormal;
|
||||
Value<atInt16> skinMtxBankIdx;
|
||||
Value<atUint16> surfaceGroup;
|
||||
Seek<DNA_COUNT(aabbSz), Athena::Current> seek2;
|
||||
Seek<DNA_COUNT(aabbSz), athena::Current> seek2;
|
||||
Align<32> align;
|
||||
|
||||
static constexpr bool UseMatrixSkinning() {return false;}
|
||||
@@ -89,7 +89,7 @@ struct SurfaceHeader_3 : BigDNA
|
||||
Value<atVec3f> reflectionNormal;
|
||||
Value<atInt16> skinMtxBankIdx;
|
||||
Value<atUint16> surfaceGroup;
|
||||
Seek<DNA_COUNT(aabbSz), Athena::Current> seek2;
|
||||
Seek<DNA_COUNT(aabbSz), athena::Current> seek2;
|
||||
Value<atUint8> unk3;
|
||||
Align<32> align;
|
||||
|
||||
@@ -166,7 +166,7 @@ void GetVertexAttributes(const MaterialSet& matSet,
|
||||
}
|
||||
|
||||
template <class PAKRouter, class MaterialSet>
|
||||
void ReadMaterialSetToBlender_1_2(HECL::BlenderConnection::PyOutStream& os,
|
||||
void ReadMaterialSetToBlender_1_2(hecl::BlenderConnection::PyOutStream& os,
|
||||
const MaterialSet& matSet,
|
||||
const PAKRouter& pakRouter,
|
||||
const typename PAKRouter::EntryType& entry,
|
||||
@@ -177,16 +177,16 @@ void ReadMaterialSetToBlender_1_2(HECL::BlenderConnection::PyOutStream& os,
|
||||
for (const UniqueID32& tex : matSet.head.textureIDs)
|
||||
{
|
||||
std::string texName = pakRouter.getBestEntryName(tex);
|
||||
const NOD::Node* node;
|
||||
const nod::Node* node;
|
||||
const typename PAKRouter::EntryType* texEntry = pakRouter.lookupEntry(tex, &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, tex);
|
||||
HECL::SystemUTF8View resPathView(resPath);
|
||||
hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, tex);
|
||||
hecl::SystemUTF8View resPathView(resPath);
|
||||
os.format("if '%s' in bpy.data.textures:\n"
|
||||
" image = bpy.data.images['%s']\n"
|
||||
" texture = bpy.data.textures[image.name]\n"
|
||||
@@ -209,7 +209,7 @@ void ReadMaterialSetToBlender_1_2(HECL::BlenderConnection::PyOutStream& os,
|
||||
}
|
||||
|
||||
template <class PAKRouter, class MaterialSet>
|
||||
void ReadMaterialSetToBlender_3(HECL::BlenderConnection::PyOutStream& os,
|
||||
void ReadMaterialSetToBlender_3(hecl::BlenderConnection::PyOutStream& os,
|
||||
const MaterialSet& matSet,
|
||||
const PAKRouter& pakRouter,
|
||||
const typename PAKRouter::EntryType& entry,
|
||||
@@ -251,7 +251,7 @@ public:
|
||||
}
|
||||
|
||||
template<class RigPair>
|
||||
void sendAdditionalVertsToBlender(HECL::BlenderConnection::PyOutStream& os,
|
||||
void sendAdditionalVertsToBlender(hecl::BlenderConnection::PyOutStream& os,
|
||||
const RigPair& rp) const
|
||||
{
|
||||
atUint32 nextVert = 1;
|
||||
@@ -312,7 +312,7 @@ private:
|
||||
case GX::INDEX16:
|
||||
if ((m_cur - m_dl.get() + 1) >= intptr_t(m_dlSize))
|
||||
return 0;
|
||||
retval = HECL::SBig(*(atUint16*)m_cur);
|
||||
retval = hecl::SBig(*(atUint16*)m_cur);
|
||||
m_cur += 2;
|
||||
break;
|
||||
default: break;
|
||||
@@ -346,7 +346,7 @@ public:
|
||||
|
||||
atUint16 readVertCount()
|
||||
{
|
||||
atUint16 retval = HECL::SBig(*(atUint16*)m_cur);
|
||||
atUint16 retval = hecl::SBig(*(atUint16*)m_cur);
|
||||
m_cur += 2;
|
||||
return retval;
|
||||
}
|
||||
@@ -510,14 +510,14 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
void InitGeomBlenderContext(HECL::BlenderConnection::PyOutStream& os,
|
||||
const HECL::ProjectPath& masterShaderPath);
|
||||
void FinishBlenderMesh(HECL::BlenderConnection::PyOutStream& os,
|
||||
void InitGeomBlenderContext(hecl::BlenderConnection::PyOutStream& os,
|
||||
const hecl::ProjectPath& masterShaderPath);
|
||||
void FinishBlenderMesh(hecl::BlenderConnection::PyOutStream& os,
|
||||
unsigned matSetCount, int meshIdx);
|
||||
|
||||
template <class PAKRouter, class MaterialSet, class RigPair, class SurfaceHeader>
|
||||
atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os,
|
||||
Athena::io::IStreamReader& reader,
|
||||
atUint32 ReadGeomSectionsToBlender(hecl::BlenderConnection::PyOutStream& os,
|
||||
athena::io::IStreamReader& reader,
|
||||
PAKRouter& pakRouter,
|
||||
const typename PAKRouter::EntryType& entry,
|
||||
const RigPair& rp,
|
||||
@@ -640,10 +640,10 @@ atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os,
|
||||
}
|
||||
|
||||
if (s < secCount - 1)
|
||||
reader.seek(secStart + secSizes[s], Athena::Begin);
|
||||
reader.seek(secStart + secSizes[s], athena::Begin);
|
||||
}
|
||||
|
||||
reader.seek(afterHeaderPos, Athena::Begin);
|
||||
reader.seek(afterHeaderPos, athena::Begin);
|
||||
|
||||
visitedDLOffsets = false;
|
||||
unsigned createdUVLayers = 0;
|
||||
@@ -986,7 +986,7 @@ atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os,
|
||||
}
|
||||
|
||||
if (s < secCount - 1)
|
||||
reader.seek(secStart + secSizes[s], Athena::Begin);
|
||||
reader.seek(secStart + secSizes[s], athena::Begin);
|
||||
}
|
||||
|
||||
/* Finish Mesh */
|
||||
@@ -999,8 +999,8 @@ atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os,
|
||||
}
|
||||
|
||||
template <class PAKRouter, class MaterialSet, class RigPair, class SurfaceHeader, atUint32 Version>
|
||||
bool ReadCMDLToBlender(HECL::BlenderConnection& conn,
|
||||
Athena::io::IStreamReader& reader,
|
||||
bool ReadCMDLToBlender(hecl::BlenderConnection& conn,
|
||||
athena::io::IStreamReader& reader,
|
||||
PAKRouter& pakRouter,
|
||||
const typename PAKRouter::EntryType& entry,
|
||||
const SpecBase& dataspec,
|
||||
@@ -1011,18 +1011,18 @@ bool ReadCMDLToBlender(HECL::BlenderConnection& conn,
|
||||
|
||||
if (head.magic != 0xDEADBABE)
|
||||
{
|
||||
LogDNACommon.report(LogVisor::Error, "invalid CMDL magic");
|
||||
LogDNACommon.report(logvisor::Error, "invalid CMDL magic");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (head.version != Version)
|
||||
{
|
||||
LogDNACommon.report(LogVisor::Error, "invalid CMDL version");
|
||||
LogDNACommon.report(logvisor::Error, "invalid CMDL version");
|
||||
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"
|
||||
"\n"
|
||||
@@ -1046,14 +1046,14 @@ bool ReadCMDLToBlender(HECL::BlenderConnection& conn,
|
||||
}
|
||||
|
||||
template <class PAKRouter, class MaterialSet>
|
||||
void NameCMDL(Athena::io::IStreamReader& reader,
|
||||
void NameCMDL(athena::io::IStreamReader& reader,
|
||||
PAKRouter& pakRouter,
|
||||
typename PAKRouter::EntryType& entry,
|
||||
const SpecBase& dataspec)
|
||||
{
|
||||
Header head;
|
||||
head.read(reader);
|
||||
std::string bestName = HECL::Format("CMDL_%s", entry.id.toString().c_str());
|
||||
std::string bestName = hecl::Format("CMDL_%s", entry.id.toString().c_str());
|
||||
|
||||
/* Pre-read pass to determine maximum used vert indices */
|
||||
atUint32 matSecCount = 0;
|
||||
@@ -1071,11 +1071,11 @@ void NameCMDL(Athena::io::IStreamReader& reader,
|
||||
}
|
||||
|
||||
if (s < head.secCount - 1)
|
||||
reader.seek(secStart + head.secSizes[s], Athena::Begin);
|
||||
reader.seek(secStart + head.secSizes[s], athena::Begin);
|
||||
}
|
||||
}
|
||||
|
||||
static void WriteDLVal(Athena::io::FileWriter& writer, GX::AttrType type, atUint32 val)
|
||||
static void WriteDLVal(athena::io::FileWriter& writer, GX::AttrType type, atUint32 val)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -1091,7 +1091,7 @@ static void WriteDLVal(Athena::io::FileWriter& writer, GX::AttrType type, atUint
|
||||
}
|
||||
|
||||
template <class MaterialSet, class SurfaceHeader, atUint32 Version>
|
||||
bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath, const Mesh& mesh)
|
||||
bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const Mesh& mesh)
|
||||
{
|
||||
Header head;
|
||||
head.magic = 0xDEADBABE;
|
||||
@@ -1110,23 +1110,23 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
|
||||
std::vector<MaterialSet> matSets;
|
||||
matSets.reserve(mesh.materialSets.size());
|
||||
{
|
||||
HECL::Frontend::Frontend FE;
|
||||
hecl::Frontend::Frontend FE;
|
||||
for (const std::vector<Mesh::Material>& mset : mesh.materialSets)
|
||||
{
|
||||
matSets.emplace_back();
|
||||
MaterialSet& targetMSet = matSets.back();
|
||||
std::vector<HECL::ProjectPath> texPaths;
|
||||
std::vector<HECL::Backend::GX> setBackends;
|
||||
std::vector<hecl::ProjectPath> texPaths;
|
||||
std::vector<hecl::Backend::GX> setBackends;
|
||||
setBackends.reserve(mset.size());
|
||||
|
||||
size_t endOff = 0;
|
||||
atUint32 nextGroupIdx = 0;
|
||||
for (const Mesh::Material& mat : mset)
|
||||
{
|
||||
std::string diagName = HECL::Format("%s:%s", inPath.getLastComponentUTF8(), mat.name.c_str());
|
||||
HECL::Frontend::IR matIR = FE.compileSource(mat.source, diagName);
|
||||
std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8(), mat.name.c_str());
|
||||
hecl::Frontend::IR matIR = FE.compileSource(mat.source, diagName);
|
||||
setBackends.emplace_back();
|
||||
HECL::Backend::GX& matGX = setBackends.back();
|
||||
hecl::Backend::GX& matGX = setBackends.back();
|
||||
matGX.reset(matIR, FE.getDiagnostics());
|
||||
|
||||
atUint32 groupIdx = -1;
|
||||
@@ -1134,7 +1134,7 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
|
||||
{
|
||||
for (size_t i=0 ; i<setBackends.size()-1 ; ++i)
|
||||
{
|
||||
const HECL::Backend::GX& other = setBackends[i];
|
||||
const hecl::Backend::GX& other = setBackends[i];
|
||||
if (matGX == other)
|
||||
{
|
||||
groupIdx = i;
|
||||
@@ -1153,16 +1153,16 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
|
||||
targetMSet.head.addMaterialEndOff(endOff);
|
||||
}
|
||||
|
||||
for (const HECL::ProjectPath& path : texPaths)
|
||||
for (const hecl::ProjectPath& path : texPaths)
|
||||
{
|
||||
const HECL::SystemString& relPath = path.getRelativePath();
|
||||
const hecl::SystemString& relPath = path.getRelativePath();
|
||||
|
||||
/* TODO: incorporate hecl hashes */
|
||||
size_t search = relPath.find(_S("TXTR_"));
|
||||
if (search != HECL::SystemString::npos)
|
||||
if (search != hecl::SystemString::npos)
|
||||
targetMSet.head.addTexture(relPath.c_str() + search + 5);
|
||||
else
|
||||
LogDNACommon.report(LogVisor::FatalError, "unable to get hash from path");
|
||||
LogDNACommon.report(logvisor::Fatal, "unable to get hash from path");
|
||||
}
|
||||
|
||||
size_t secSz = targetMSet.binarySize(0);
|
||||
@@ -1220,7 +1220,7 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
|
||||
{
|
||||
size_t vertSz = matSets.at(0).materials.at(surf.materialIdx).getVAFlags().vertDLSize();
|
||||
if (surf.verts.size() > 65536)
|
||||
LogDNACommon.report(LogVisor::FatalError, "GX DisplayList overflow");
|
||||
LogDNACommon.report(logvisor::Fatal, "GX DisplayList overflow");
|
||||
size_t secSz = 67 + surf.verts.size() * vertSz;
|
||||
secSz32 = ROUND_UP_32(secSz);
|
||||
if (secSz32 == 0)
|
||||
@@ -1232,7 +1232,7 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
|
||||
}
|
||||
|
||||
/* Write sections */
|
||||
Athena::io::FileWriter writer(outPath.getAbsolutePath());
|
||||
athena::io::FileWriter writer(outPath.getAbsolutePath());
|
||||
head.write(writer);
|
||||
std::vector<size_t>::const_iterator padIt = paddingSizes.cbegin();
|
||||
|
||||
@@ -1280,12 +1280,12 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
|
||||
|
||||
/* Surfaces */
|
||||
GX::Primitive prim;
|
||||
if (mesh.topology == HECL::HMDLTopology::Triangles)
|
||||
if (mesh.topology == hecl::HMDLTopology::Triangles)
|
||||
prim = GX::TRIANGLES;
|
||||
else if (mesh.topology == HECL::HMDLTopology::TriStrips)
|
||||
else if (mesh.topology == hecl::HMDLTopology::TriStrips)
|
||||
prim = GX::TRIANGLESTRIP;
|
||||
else
|
||||
LogDNACommon.report(LogVisor::FatalError, "unrecognized mesh output mode");
|
||||
LogDNACommon.report(logvisor::Fatal, "unrecognized mesh output mode");
|
||||
for (const Mesh::Surface& surf : mesh.surfaces)
|
||||
{
|
||||
const typename MaterialSet::Material::VAFlags& vaFlags =
|
||||
@@ -1335,7 +1335,7 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
|
||||
}
|
||||
|
||||
template <class MaterialSet, class SurfaceHeader, atUint32 Version>
|
||||
bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath, const Mesh& mesh)
|
||||
bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const Mesh& mesh)
|
||||
{
|
||||
Header head;
|
||||
head.magic = 0xDEADBABE;
|
||||
@@ -1354,19 +1354,19 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
|
||||
std::vector<MaterialSet> matSets;
|
||||
matSets.reserve(mesh.materialSets.size());
|
||||
{
|
||||
HECL::Frontend::Frontend FE;
|
||||
hecl::Frontend::Frontend FE;
|
||||
for (const std::vector<Mesh::Material>& mset : mesh.materialSets)
|
||||
{
|
||||
matSets.emplace_back();
|
||||
MaterialSet& targetMSet = matSets.back();
|
||||
std::vector<HECL::ProjectPath> texPaths;
|
||||
std::vector<hecl::ProjectPath> texPaths;
|
||||
texPaths.reserve(mset.size()*4);
|
||||
for (const Mesh::Material& mat : mset)
|
||||
{
|
||||
for (const HECL::ProjectPath& path : mat.texs)
|
||||
for (const hecl::ProjectPath& path : mat.texs)
|
||||
{
|
||||
bool found = false;
|
||||
for (const HECL::ProjectPath& ePath : texPaths)
|
||||
for (const hecl::ProjectPath& ePath : texPaths)
|
||||
{
|
||||
if (path == ePath)
|
||||
{
|
||||
@@ -1382,22 +1382,22 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
|
||||
size_t endOff = 0;
|
||||
for (const Mesh::Material& mat : mset)
|
||||
{
|
||||
std::string diagName = HECL::Format("%s:%s", inPath.getLastComponentUTF8(), mat.name.c_str());
|
||||
std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8(), mat.name.c_str());
|
||||
targetMSet.materials.emplace_back(FE, diagName, mat, mat.iprops, texPaths);
|
||||
endOff = targetMSet.materials.back().binarySize(endOff);
|
||||
targetMSet.head.addMaterialEndOff(endOff);
|
||||
}
|
||||
|
||||
for (const HECL::ProjectPath& path : texPaths)
|
||||
for (const hecl::ProjectPath& path : texPaths)
|
||||
{
|
||||
const HECL::SystemString& relPath = path.getRelativePath();
|
||||
const hecl::SystemString& relPath = path.getRelativePath();
|
||||
|
||||
/* TODO: incorporate hecl hashes */
|
||||
size_t search = relPath.find(_S("TXTR_"));
|
||||
if (search != HECL::SystemString::npos)
|
||||
if (search != hecl::SystemString::npos)
|
||||
targetMSet.head.addTexture(relPath.c_str() + search + 5);
|
||||
else
|
||||
LogDNACommon.report(LogVisor::FatalError, "unable to get hash from path");
|
||||
LogDNACommon.report(logvisor::Fatal, "unable to get hash from path");
|
||||
}
|
||||
|
||||
size_t secSz = targetMSet.binarySize(0);
|
||||
@@ -1407,7 +1407,7 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
|
||||
}
|
||||
}
|
||||
|
||||
HECL::HMDLBuffers bufs = mesh.getHMDLBuffers();
|
||||
hecl::HMDLBuffers bufs = mesh.getHMDLBuffers();
|
||||
|
||||
/* Metadata */
|
||||
size_t secSz = bufs.m_meta.binarySize(0);
|
||||
@@ -1445,7 +1445,7 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
|
||||
|
||||
/* Surfaces */
|
||||
size_t endOff = 0;
|
||||
for (const HECL::HMDLBuffers::Surface& surf : bufs.m_surfaces)
|
||||
for (const hecl::HMDLBuffers::Surface& surf : bufs.m_surfaces)
|
||||
{
|
||||
head.secSizes.push_back(64);
|
||||
paddingSizes.push_back(0);
|
||||
@@ -1454,7 +1454,7 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
|
||||
}
|
||||
|
||||
/* Write sections */
|
||||
Athena::io::FileWriter writer(outPath.getAbsolutePath());
|
||||
athena::io::FileWriter writer(outPath.getAbsolutePath());
|
||||
head.write(writer);
|
||||
std::vector<size_t>::const_iterator padIt = paddingSizes.cbegin();
|
||||
|
||||
@@ -1489,7 +1489,7 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
|
||||
++padIt;
|
||||
|
||||
/* Surfaces */
|
||||
for (const HECL::HMDLBuffers::Surface& surf : bufs.m_surfaces)
|
||||
for (const hecl::HMDLBuffers::Surface& surf : bufs.m_surfaces)
|
||||
{
|
||||
const Mesh::Surface& osurf = surf.m_origSurf;
|
||||
|
||||
@@ -1506,7 +1506,7 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
|
||||
}
|
||||
|
||||
/* Ensure final surface's alignment writes zeros */
|
||||
writer.seek(-1, Athena::Current);
|
||||
writer.seek(-1, athena::Current);
|
||||
writer.writeUByte(0);
|
||||
writer.close();
|
||||
return true;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace DataSpec
|
||||
{
|
||||
|
||||
LogVisor::LogModule LogDNACommon("Retro::DNACommon");
|
||||
logvisor::Module LogDNACommon("urde::DNACommon");
|
||||
SpecBase* g_curSpec = nullptr;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,48 +2,48 @@
|
||||
#define __DNA_COMMON_HPP__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Athena/DNAYaml.hpp>
|
||||
#include <NOD/DiscBase.hpp>
|
||||
#include "HECL/HECL.hpp"
|
||||
#include "HECL/Database.hpp"
|
||||
#include <athena/DNAYaml.hpp>
|
||||
#include <nod/DiscBase.hpp>
|
||||
#include "hecl/hecl.hpp"
|
||||
#include "hecl/Database.hpp"
|
||||
#include "../SpecBase.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
|
||||
extern LogVisor::LogModule LogDNACommon;
|
||||
extern logvisor::Module LogDNACommon;
|
||||
extern SpecBase* g_curSpec;
|
||||
|
||||
/* This comes up a great deal */
|
||||
typedef Athena::io::DNA<Athena::BigEndian> BigDNA;
|
||||
typedef Athena::io::DNAYaml<Athena::BigEndian> BigYAML;
|
||||
typedef athena::io::DNA<athena::BigEndian> BigDNA;
|
||||
typedef athena::io::DNAYaml<athena::BigEndian> BigYAML;
|
||||
|
||||
/** FourCC with DNA read/write */
|
||||
class DNAFourCC final : public BigYAML, public HECL::FourCC
|
||||
class DNAFourCC final : public BigYAML, public hecl::FourCC
|
||||
{
|
||||
public:
|
||||
DNAFourCC() : HECL::FourCC() {}
|
||||
DNAFourCC(const HECL::FourCC& other)
|
||||
: HECL::FourCC() {num = other.toUint32();}
|
||||
DNAFourCC() : hecl::FourCC() {}
|
||||
DNAFourCC(const hecl::FourCC& other)
|
||||
: hecl::FourCC() {num = other.toUint32();}
|
||||
DNAFourCC(const char* name)
|
||||
: HECL::FourCC(name) {}
|
||||
: hecl::FourCC(name) {}
|
||||
DNAFourCC(uint32_t n)
|
||||
: HECL::FourCC(n) {}
|
||||
: hecl::FourCC(n) {}
|
||||
|
||||
Delete expl;
|
||||
void read(Athena::io::IStreamReader& reader)
|
||||
void read(athena::io::IStreamReader& reader)
|
||||
{reader.readUBytesToBuf(fcc, 4);}
|
||||
void write(Athena::io::IStreamWriter& writer) const
|
||||
void write(athena::io::IStreamWriter& writer) const
|
||||
{writer.writeUBytes((atUint8*)fcc, 4);}
|
||||
void read(Athena::io::YAMLDocReader& reader)
|
||||
void read(athena::io::YAMLDocReader& reader)
|
||||
{std::string rs = reader.readString(nullptr); strncpy(fcc, rs.c_str(), 4);}
|
||||
void write(Athena::io::YAMLDocWriter& writer) const
|
||||
void write(athena::io::YAMLDocWriter& writer) const
|
||||
{writer.writeString(nullptr, std::string(fcc, 4));}
|
||||
size_t binarySize(size_t __isz) const
|
||||
{return __isz + 4;}
|
||||
};
|
||||
|
||||
using FourCC = HECL::FourCC;
|
||||
using FourCC = hecl::FourCC;
|
||||
|
||||
/** PAK 32-bit Unique ID */
|
||||
class UniqueID32 : public BigYAML
|
||||
@@ -52,18 +52,18 @@ class UniqueID32 : public BigYAML
|
||||
public:
|
||||
Delete expl;
|
||||
operator bool() const {return m_id != 0xffffffff && m_id != 0;}
|
||||
void read(Athena::io::IStreamReader& reader)
|
||||
void read(athena::io::IStreamReader& reader)
|
||||
{m_id = reader.readUint32Big();}
|
||||
void write(Athena::io::IStreamWriter& writer) const
|
||||
void write(athena::io::IStreamWriter& writer) const
|
||||
{writer.writeUint32Big(m_id);}
|
||||
void read(Athena::io::YAMLDocReader& reader)
|
||||
void read(athena::io::YAMLDocReader& reader)
|
||||
{m_id = reader.readUint32(nullptr);}
|
||||
void write(Athena::io::YAMLDocWriter& writer) const
|
||||
void write(athena::io::YAMLDocWriter& writer) const
|
||||
{writer.writeUint32(nullptr, m_id);}
|
||||
size_t binarySize(size_t __isz) const
|
||||
{return __isz + 4;}
|
||||
|
||||
UniqueID32& operator=(const HECL::ProjectPath& path)
|
||||
UniqueID32& operator=(const hecl::ProjectPath& path)
|
||||
{m_id = path.hash().val32(); return *this;}
|
||||
|
||||
bool operator!=(const UniqueID32& other) const {return m_id != other.m_id;}
|
||||
@@ -78,8 +78,8 @@ public:
|
||||
void clear() {m_id = 0xffffffff;}
|
||||
|
||||
UniqueID32() = default;
|
||||
UniqueID32(Athena::io::IStreamReader& reader) {read(reader);}
|
||||
UniqueID32(const HECL::ProjectPath& path) {*this = path;}
|
||||
UniqueID32(athena::io::IStreamReader& reader) {read(reader);}
|
||||
UniqueID32(const hecl::ProjectPath& path) {*this = path;}
|
||||
UniqueID32(const char* hexStr)
|
||||
{
|
||||
char copy[9];
|
||||
@@ -105,18 +105,18 @@ class UniqueID64 : public BigYAML
|
||||
public:
|
||||
Delete expl;
|
||||
operator bool() const {return m_id != 0xffffffffffffffff && m_id != 0;}
|
||||
void read(Athena::io::IStreamReader& reader)
|
||||
void read(athena::io::IStreamReader& reader)
|
||||
{m_id = reader.readUint64Big();}
|
||||
void write(Athena::io::IStreamWriter& writer) const
|
||||
void write(athena::io::IStreamWriter& writer) const
|
||||
{writer.writeUint64Big(m_id);}
|
||||
void read(Athena::io::YAMLDocReader& reader)
|
||||
void read(athena::io::YAMLDocReader& reader)
|
||||
{m_id = reader.readUint64(nullptr);}
|
||||
void write(Athena::io::YAMLDocWriter& writer) const
|
||||
void write(athena::io::YAMLDocWriter& writer) const
|
||||
{writer.writeUint64(nullptr, m_id);}
|
||||
size_t binarySize(size_t __isz) const
|
||||
{return __isz + 8;}
|
||||
|
||||
UniqueID64& operator=(const HECL::ProjectPath& path)
|
||||
UniqueID64& operator=(const hecl::ProjectPath& path)
|
||||
{m_id = path.hash().val64(); return *this;}
|
||||
|
||||
bool operator!=(const UniqueID64& other) const {return m_id != other.m_id;}
|
||||
@@ -131,8 +131,8 @@ public:
|
||||
void clear() {m_id = 0xffffffffffffffff;}
|
||||
|
||||
UniqueID64() = default;
|
||||
UniqueID64(Athena::io::IStreamReader& reader) {read(reader);}
|
||||
UniqueID64(const HECL::ProjectPath& path) {*this = path;}
|
||||
UniqueID64(athena::io::IStreamReader& reader) {read(reader);}
|
||||
UniqueID64(const hecl::ProjectPath& path) {*this = path;}
|
||||
UniqueID64(const char* hexStr)
|
||||
{
|
||||
char copy[17];
|
||||
@@ -174,17 +174,17 @@ public:
|
||||
UniqueID128() {m_id[0]=0xffffffffffffffff; m_id[1]=0xffffffffffffffff;}
|
||||
operator bool() const
|
||||
{return m_id[0] != 0xffffffffffffffff && m_id[0] != 0 && m_id[1] != 0xffffffffffffffff && m_id[1] != 0;}
|
||||
void read(Athena::io::IStreamReader& reader)
|
||||
void read(athena::io::IStreamReader& reader)
|
||||
{
|
||||
m_id[0] = reader.readUint64Big();
|
||||
m_id[1] = reader.readUint64Big();
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& writer) const
|
||||
void write(athena::io::IStreamWriter& writer) const
|
||||
{
|
||||
writer.writeUint64Big(m_id[0]);
|
||||
writer.writeUint64Big(m_id[1]);
|
||||
}
|
||||
void read(Athena::io::YAMLDocReader& reader)
|
||||
void read(athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
std::string str = reader.readString(nullptr);
|
||||
while (str.size() < 32)
|
||||
@@ -194,7 +194,7 @@ public:
|
||||
m_id[0] = strtoull(hStr.c_str(), nullptr, 16);
|
||||
m_id[1] = strtoull(lStr.c_str(), nullptr, 16);
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& writer) const
|
||||
void write(athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
writer.writeString(nullptr, toString().c_str());
|
||||
}
|
||||
@@ -238,31 +238,31 @@ public:
|
||||
template <class IDTYPE>
|
||||
class PAKPath : public BigYAML
|
||||
{
|
||||
HECL::ProjectPath m_path;
|
||||
hecl::ProjectPath m_path;
|
||||
IDTYPE m_id;
|
||||
public:
|
||||
HECL::ProjectPath getPath() const
|
||||
hecl::ProjectPath getPath() const
|
||||
{
|
||||
if (m_path)
|
||||
return m_path;
|
||||
if (!g_curSpec)
|
||||
LogDNACommon.report(LogVisor::FatalError, "current DataSpec not set for PAKPath");
|
||||
LogDNACommon.report(logvisor::Fatal, "current DataSpec not set for PAKPath");
|
||||
if (m_id)
|
||||
return g_curSpec->getWorking(m_id);
|
||||
return HECL::ProjectPath();
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
operator HECL::ProjectPath() const {return getPath();}
|
||||
operator hecl::ProjectPath() const {return getPath();}
|
||||
operator const IDTYPE&() const {return m_id;}
|
||||
|
||||
Delete _d;
|
||||
void read(Athena::io::IStreamReader& reader)
|
||||
void read(athena::io::IStreamReader& reader)
|
||||
{m_id.read(reader);}
|
||||
void write(Athena::io::IStreamWriter& writer) const
|
||||
void write(athena::io::IStreamWriter& writer) const
|
||||
{m_id.write(writer);}
|
||||
void read(Athena::io::YAMLDocReader& reader)
|
||||
void read(athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
if (!g_curSpec)
|
||||
LogDNACommon.report(LogVisor::FatalError, "current DataSpec not set for PAKPath");
|
||||
LogDNACommon.report(logvisor::Fatal, "current DataSpec not set for PAKPath");
|
||||
std::string path = reader.readString(nullptr);
|
||||
if (path.empty())
|
||||
{
|
||||
@@ -273,7 +273,7 @@ public:
|
||||
m_path.assign(g_curSpec->getProject(), path);
|
||||
m_id = m_path;
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& writer) const
|
||||
void write(athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
if (m_path)
|
||||
{
|
||||
@@ -295,7 +295,7 @@ class WordBitmap
|
||||
std::vector<atUint32> m_words;
|
||||
size_t m_bitCount = 0;
|
||||
public:
|
||||
void read(Athena::io::IStreamReader& reader, size_t bitCount)
|
||||
void read(athena::io::IStreamReader& reader, size_t bitCount)
|
||||
{
|
||||
m_bitCount = bitCount;
|
||||
size_t wordCount = (bitCount + 31) / 32;
|
||||
@@ -304,7 +304,7 @@ public:
|
||||
for (size_t w=0 ; w<wordCount ; ++w)
|
||||
m_words.push_back(reader.readUint32Big());
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& writer) const
|
||||
void write(athena::io::IStreamWriter& writer) const
|
||||
{
|
||||
for (atUint32 word : m_words)
|
||||
writer.writeUint32(word);
|
||||
@@ -356,7 +356,7 @@ public:
|
||||
};
|
||||
|
||||
/** Resource cooker function */
|
||||
typedef std::function<bool(const HECL::ProjectPath&, const HECL::ProjectPath&)> ResCooker;
|
||||
typedef std::function<bool(const hecl::ProjectPath&, const hecl::ProjectPath&)> ResCooker;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace DataSpec
|
||||
{
|
||||
|
||||
template<class DEAFBABE>
|
||||
void DeafBabeSendToBlender(HECL::BlenderConnection::PyOutStream& os, const DEAFBABE& db)
|
||||
void DeafBabeSendToBlender(hecl::BlenderConnection::PyOutStream& os, const DEAFBABE& db)
|
||||
{
|
||||
os << "material_index = []\n"
|
||||
"col_bm = bmesh.new()\n";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _DNACOMMON_GX_HPP_
|
||||
#define _DNACOMMON_GX_HPP_
|
||||
|
||||
#include "HECL/Backend/GX.hpp"
|
||||
using GX = HECL::Backend::GX;
|
||||
#include "hecl/Backend/GX.hpp"
|
||||
using GX = hecl::Backend::GX;
|
||||
|
||||
#endif // _DNACOMMON_GX_HPP_
|
||||
|
||||
@@ -74,13 +74,13 @@ struct MAPA : BigDNA
|
||||
};
|
||||
|
||||
|
||||
void read(Athena::io::IStreamReader& __dna_reader)
|
||||
void read(athena::io::IStreamReader& __dna_reader)
|
||||
{
|
||||
/* magic */
|
||||
magic = __dna_reader.readUint32Big();
|
||||
if (magic != 0xDEADD00D)
|
||||
{
|
||||
LogDNACommon.report(LogVisor::Error, "invalid MAPA magic");
|
||||
LogDNACommon.report(logvisor::Error, "invalid MAPA magic");
|
||||
return;
|
||||
}
|
||||
/* version */
|
||||
@@ -93,7 +93,7 @@ struct MAPA : BigDNA
|
||||
header.reset(new HeaderMP3);
|
||||
else
|
||||
{
|
||||
LogDNACommon.report(LogVisor::Error, "invalid MAPA version");
|
||||
LogDNACommon.report(logvisor::Error, "invalid MAPA version");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ struct MAPA : BigDNA
|
||||
__dna_reader.enumerate(surfaces, header->surfaceCount());
|
||||
}
|
||||
|
||||
void write(Athena::io::IStreamWriter& __dna_writer) const
|
||||
void write(athena::io::IStreamWriter& __dna_writer) const
|
||||
{
|
||||
/* magic */
|
||||
__dna_writer.writeUint32Big(magic);
|
||||
@@ -189,9 +189,9 @@ struct MAPA : BigDNA
|
||||
Value<Type> type;
|
||||
Value<atUint32> unknown1;
|
||||
Value<atUint32> sclyId;
|
||||
Seek<DNA_COUNT(4), Athena::Current> seek1;
|
||||
Seek<DNA_COUNT(4), athena::Current> seek1;
|
||||
Value<atVec4f> transformMtx[3];
|
||||
Seek<DNA_COUNT(0x10), Athena::Current> seek2;
|
||||
Seek<DNA_COUNT(0x10), athena::Current> seek2;
|
||||
virtual ~MappableObjectMP1_2() {}
|
||||
};
|
||||
|
||||
@@ -202,9 +202,9 @@ struct MAPA : BigDNA
|
||||
Value<atUint32> unknown1;
|
||||
Value<atUint32> sclyId;
|
||||
Buffer<DNA_COUNT(0x10)> unknownHash;
|
||||
Seek<DNA_COUNT(4), Athena::Current> seek1;
|
||||
Seek<DNA_COUNT(4), athena::Current> seek1;
|
||||
Value<atVec4f> transformMtx[3];
|
||||
Seek<DNA_COUNT(0x10), Athena::Current> seek2;
|
||||
Seek<DNA_COUNT(0x10), athena::Current> seek2;
|
||||
virtual ~MappableObjectMP3() {}
|
||||
};
|
||||
|
||||
@@ -252,21 +252,21 @@ struct MAPA : BigDNA
|
||||
};
|
||||
|
||||
template <typename PAKRouter>
|
||||
bool ReadMAPAToBlender(HECL::BlenderConnection& conn,
|
||||
bool ReadMAPAToBlender(hecl::BlenderConnection& conn,
|
||||
const MAPA& mapa,
|
||||
const HECL::ProjectPath& outPath,
|
||||
const hecl::ProjectPath& outPath,
|
||||
PAKRouter& pakRouter,
|
||||
const typename PAKRouter::EntryType& entry,
|
||||
bool force)
|
||||
{
|
||||
/* Rename MAPA for consistency */
|
||||
HECL::ProjectPath mapaPath(outPath.getParentPath(), _S("!map.blend"));
|
||||
if (!force && mapaPath.getPathType() == HECL::ProjectPath::Type::File)
|
||||
hecl::ProjectPath mapaPath(outPath.getParentPath(), _S("!map.blend"));
|
||||
if (!force && mapaPath.getPathType() == hecl::ProjectPath::Type::File)
|
||||
return true;
|
||||
|
||||
if (!conn.createBlend(mapaPath, HECL::BlenderConnection::BlendType::MapArea))
|
||||
if (!conn.createBlend(mapaPath, hecl::BlenderConnection::BlendType::MapArea))
|
||||
return false;
|
||||
HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||
|
||||
os << "import bpy, bmesh\n"
|
||||
"from mathutils import Matrix\n"
|
||||
@@ -450,8 +450,8 @@ bool ReadMAPAToBlender(HECL::BlenderConnection& conn,
|
||||
"bm.free()\n";
|
||||
|
||||
/* World background */
|
||||
HECL::ProjectPath worldBlend(outPath.getParentPath().getParentPath(), "!world.blend");
|
||||
if (worldBlend.getPathType() == HECL::ProjectPath::Type::File)
|
||||
hecl::ProjectPath worldBlend(outPath.getParentPath().getParentPath(), "!world.blend");
|
||||
if (worldBlend.getPathType() == hecl::ProjectPath::Type::File)
|
||||
os.linkBackground("//../!world.blend", "World");
|
||||
|
||||
os.centerView();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "DNACommon.hpp"
|
||||
#include "BlenderConnection.hpp"
|
||||
#include "CVector3f.hpp"
|
||||
#include "zeus/CVector3f.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
@@ -11,31 +11,23 @@ namespace DNAMLVL
|
||||
{
|
||||
|
||||
template <class PAKRouter, typename MLVL>
|
||||
bool ReadMLVLToBlender(HECL::BlenderConnection& conn,
|
||||
bool ReadMLVLToBlender(hecl::BlenderConnection& conn,
|
||||
const MLVL& mlvl,
|
||||
const HECL::ProjectPath& outPath,
|
||||
const hecl::ProjectPath& outPath,
|
||||
PAKRouter& pakRouter,
|
||||
const typename PAKRouter::EntryType& entry,
|
||||
bool force,
|
||||
std::function<void(const HECL::SystemChar*)> fileChanged)
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||
{
|
||||
/* Rename MLVL for consistency */
|
||||
HECL::ProjectPath mlvlPath(outPath.getParentPath(), _S("!world.blend"));
|
||||
if (!force && mlvlPath.getPathType() == HECL::ProjectPath::Type::File)
|
||||
hecl::ProjectPath mlvlPath(outPath.getParentPath(), _S("!world.blend"));
|
||||
if (!force && mlvlPath.getPathType() == hecl::ProjectPath::Type::File)
|
||||
return true;
|
||||
|
||||
/* Link Skybox CMDL */
|
||||
const typename PAKRouter::EntryType* skyboxEntry = pakRouter.lookupEntry(mlvl.worldSkyboxId);
|
||||
if (skyboxEntry)
|
||||
{
|
||||
HECL::ProjectPath skyboxPath = pakRouter.getWorking(skyboxEntry);
|
||||
HECL::ProjectPath(outPath.getParentPath(), _S("!skybox.blend")).makeLinkTo(skyboxPath);
|
||||
}
|
||||
|
||||
/* Create World Blend */
|
||||
if (!conn.createBlend(mlvlPath, HECL::BlenderConnection::BlendType::World))
|
||||
if (!conn.createBlend(mlvlPath, hecl::BlenderConnection::BlendType::World))
|
||||
return false;
|
||||
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 Matrix\n"
|
||||
@@ -52,7 +44,7 @@ bool ReadMLVLToBlender(HECL::BlenderConnection& conn,
|
||||
for (const auto& area : mlvl.areas)
|
||||
{
|
||||
const typename PAKRouter::EntryType* mreaEntry = pakRouter.lookupEntry(area.areaMREAId);
|
||||
HECL::SystemUTF8View areaDirName(*mreaEntry->unique.m_areaName);
|
||||
hecl::SystemUTF8View areaDirName(*mreaEntry->unique.m_areaName);
|
||||
|
||||
os.AABBToBMesh(area.aabb[0], area.aabb[1]);
|
||||
os.format("box_mesh = bpy.data.meshes.new('''%s''')\n"
|
||||
@@ -76,14 +68,14 @@ bool ReadMLVLToBlender(HECL::BlenderConnection& conn,
|
||||
for (const auto& dock : area.docks)
|
||||
{
|
||||
os << "bm = bmesh.new()\n";
|
||||
Zeus::CVector3f pvAvg;
|
||||
zeus::CVector3f pvAvg;
|
||||
for (const atVec3f& pv : dock.planeVerts)
|
||||
pvAvg += pv;
|
||||
pvAvg /= dock.planeVerts.size();
|
||||
int idx = 0;
|
||||
for (const atVec3f& pv : dock.planeVerts)
|
||||
{
|
||||
Zeus::CVector3f pvRel = Zeus::CVector3f(pv) - pvAvg;
|
||||
zeus::CVector3f pvRel = zeus::CVector3f(pv) - pvAvg;
|
||||
os.format("bm.verts.new((%f,%f,%f))\n"
|
||||
"bm.verts.ensure_lookup_table()\n",
|
||||
pvRel[0], pvRel[1], pvRel[2]);
|
||||
|
||||
@@ -16,7 +16,7 @@ struct NamedResourceCatalog : BigYAML
|
||||
String<-1> name;
|
||||
IDType uid;
|
||||
|
||||
void read(Athena::io::IStreamReader& __dna_reader)
|
||||
void read(athena::io::IStreamReader& __dna_reader)
|
||||
{
|
||||
/* type */
|
||||
type.read(__dna_reader);
|
||||
@@ -26,7 +26,7 @@ struct NamedResourceCatalog : BigYAML
|
||||
uid.read(__dna_reader);
|
||||
}
|
||||
|
||||
void write(Athena::io::IStreamWriter& __dna_writer) const
|
||||
void write(athena::io::IStreamWriter& __dna_writer) const
|
||||
{
|
||||
/* type */
|
||||
type.write(__dna_writer);
|
||||
@@ -36,7 +36,7 @@ struct NamedResourceCatalog : BigYAML
|
||||
uid.write(__dna_writer);
|
||||
}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& __dna_docin)
|
||||
void read(athena::io::YAMLDocReader& __dna_docin)
|
||||
{
|
||||
/* type */
|
||||
__dna_docin.enumerate("type", type);
|
||||
@@ -46,7 +46,7 @@ struct NamedResourceCatalog : BigYAML
|
||||
__dna_docin.enumerate("uid", uid);
|
||||
}
|
||||
|
||||
void write(Athena::io::YAMLDocWriter& __dna_docout) const
|
||||
void write(athena::io::YAMLDocWriter& __dna_docout) const
|
||||
{
|
||||
/* type */
|
||||
__dna_docout.enumerate("type", type);
|
||||
@@ -56,7 +56,7 @@ struct NamedResourceCatalog : BigYAML
|
||||
__dna_docout.enumerate("uid", uid);
|
||||
}
|
||||
|
||||
static const char* DNAType() { return "DataSpec::DNACommon::NameResourceCatalog::NamedResource"; }
|
||||
static const char* DNAType() { return "DataSpec::DNACommon::NameResourceCatalogvisor::NamedResource"; }
|
||||
|
||||
size_t binarySize(size_t __isz) const
|
||||
{
|
||||
@@ -68,7 +68,7 @@ struct NamedResourceCatalog : BigYAML
|
||||
};
|
||||
Vector<NamedResource, DNA_COUNT(namedResCount)> namedResources;
|
||||
|
||||
void read(Athena::io::IStreamReader& __dna_reader)
|
||||
void read(athena::io::IStreamReader& __dna_reader)
|
||||
{
|
||||
/* namedResCount */
|
||||
namedResCount = __dna_reader.readUint32Big();
|
||||
@@ -76,7 +76,7 @@ struct NamedResourceCatalog : BigYAML
|
||||
__dna_reader.enumerate(namedResources, namedResCount);
|
||||
}
|
||||
|
||||
void write(Athena::io::IStreamWriter& __dna_writer) const
|
||||
void write(athena::io::IStreamWriter& __dna_writer) const
|
||||
{
|
||||
/* namedResCount */
|
||||
__dna_writer.writeUint32Big(namedResCount);
|
||||
@@ -84,18 +84,14 @@ struct NamedResourceCatalog : BigYAML
|
||||
__dna_writer.enumerate(namedResources);
|
||||
}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& __dna_docin)
|
||||
void read(athena::io::YAMLDocReader& __dna_docin)
|
||||
{
|
||||
/* namedResCount */
|
||||
namedResCount = __dna_docin.readUint32("namedResCount");
|
||||
/* namedResources */
|
||||
__dna_docin.enumerate("namedResources", namedResources, namedResCount);
|
||||
namedResCount = __dna_docin.enumerate("namedResources", namedResources);
|
||||
}
|
||||
|
||||
void write(Athena::io::YAMLDocWriter& __dna_docout) const
|
||||
void write(athena::io::YAMLDocWriter& __dna_docout) const
|
||||
{
|
||||
/* namedResCount */
|
||||
__dna_docout.writeUint32("namedResCount", namedResCount);
|
||||
/* namedResources */
|
||||
__dna_docout.enumerate("namedResources", namedResources);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace DataSpec
|
||||
{
|
||||
|
||||
/* PAK entry stream reader */
|
||||
class PAKEntryReadStream : public Athena::io::IStreamReader
|
||||
class PAKEntryReadStream : public athena::io::IStreamReader
|
||||
{
|
||||
std::unique_ptr<atUint8[]> m_buf;
|
||||
atUint64 m_sz;
|
||||
@@ -24,18 +24,18 @@ public:
|
||||
: m_buf(std::move(buf)), m_sz(sz), m_pos(pos)
|
||||
{
|
||||
if (m_pos >= m_sz)
|
||||
LogDNACommon.report(LogVisor::FatalError, "PAK stream cursor overrun");
|
||||
LogDNACommon.report(logvisor::Fatal, "PAK stream cursor overrun");
|
||||
}
|
||||
void seek(atInt64 pos, Athena::SeekOrigin origin)
|
||||
void seek(atInt64 pos, athena::SeekOrigin origin)
|
||||
{
|
||||
if (origin == Athena::Begin)
|
||||
if (origin == athena::Begin)
|
||||
m_pos = pos;
|
||||
else if (origin == Athena::Current)
|
||||
else if (origin == athena::Current)
|
||||
m_pos += pos;
|
||||
else if (origin == Athena::End)
|
||||
else if (origin == athena::End)
|
||||
m_pos = m_sz + pos;
|
||||
if (m_pos > m_sz)
|
||||
LogDNACommon.report(LogVisor::FatalError, "PAK stream cursor overrun");
|
||||
LogDNACommon.report(logvisor::Fatal, "PAK stream cursor overrun");
|
||||
}
|
||||
atUint64 position() const {return m_pos;}
|
||||
atUint64 length() const {return m_sz;}
|
||||
@@ -61,9 +61,9 @@ struct UniqueResult
|
||||
Area,
|
||||
Layer
|
||||
} m_type = Type::NotFound;
|
||||
const HECL::SystemString* m_levelName = nullptr;
|
||||
const HECL::SystemString* m_areaName = nullptr;
|
||||
const HECL::SystemString* m_layerName = nullptr;
|
||||
const hecl::SystemString* m_levelName = nullptr;
|
||||
const hecl::SystemString* m_areaName = nullptr;
|
||||
const hecl::SystemString* m_layerName = nullptr;
|
||||
UniqueResult() = default;
|
||||
UniqueResult(Type tp) : m_type(tp) {}
|
||||
|
||||
@@ -72,7 +72,7 @@ struct UniqueResult
|
||||
{
|
||||
UniqueResult::Type resultType = UniqueResult::Type::NotFound;
|
||||
bool foundOneLayer = false;
|
||||
const HECL::SystemString* levelName = nullptr;
|
||||
const hecl::SystemString* levelName = nullptr;
|
||||
typename PAKBRIDGE::PAKType::IDType levelId;
|
||||
typename PAKBRIDGE::PAKType::IDType areaId;
|
||||
unsigned layerIdx;
|
||||
@@ -163,12 +163,12 @@ struct UniqueResult
|
||||
}
|
||||
}
|
||||
|
||||
HECL::ProjectPath uniquePath(const HECL::ProjectPath& pakPath) const
|
||||
hecl::ProjectPath uniquePath(const hecl::ProjectPath& pakPath) const
|
||||
{
|
||||
if (m_type == Type::Pak)
|
||||
return pakPath;
|
||||
|
||||
HECL::ProjectPath levelDir;
|
||||
hecl::ProjectPath levelDir;
|
||||
if (m_levelName)
|
||||
levelDir.assign(pakPath, *m_levelName);
|
||||
else
|
||||
@@ -177,15 +177,15 @@ struct UniqueResult
|
||||
|
||||
if (m_type == Type::Area)
|
||||
{
|
||||
HECL::ProjectPath areaDir(levelDir, *m_areaName);
|
||||
hecl::ProjectPath areaDir(levelDir, *m_areaName);
|
||||
areaDir.makeDir();
|
||||
return areaDir;
|
||||
}
|
||||
else if (m_type == Type::Layer)
|
||||
{
|
||||
HECL::ProjectPath areaDir(levelDir, *m_areaName);
|
||||
hecl::ProjectPath areaDir(levelDir, *m_areaName);
|
||||
areaDir.makeDir();
|
||||
HECL::ProjectPath layerDir(areaDir, *m_layerName);
|
||||
hecl::ProjectPath layerDir(areaDir, *m_layerName);
|
||||
layerDir.makeDir();
|
||||
return layerDir;
|
||||
}
|
||||
@@ -201,11 +201,11 @@ class PAKRouter;
|
||||
template <class PAKBRIDGE>
|
||||
struct ResExtractor
|
||||
{
|
||||
std::function<bool(PAKEntryReadStream&, const HECL::ProjectPath&)> func_a;
|
||||
std::function<bool(const SpecBase&, PAKEntryReadStream&, const HECL::ProjectPath&, PAKRouter<PAKBRIDGE>&,
|
||||
std::function<bool(PAKEntryReadStream&, const hecl::ProjectPath&)> func_a;
|
||||
std::function<bool(const SpecBase&, PAKEntryReadStream&, const hecl::ProjectPath&, PAKRouter<PAKBRIDGE>&,
|
||||
const typename PAKBRIDGE::PAKType::Entry&, bool,
|
||||
std::function<void(const HECL::SystemChar*)>)> func_b;
|
||||
const HECL::SystemChar* fileExts[4];
|
||||
std::function<void(const hecl::SystemChar*)>)> func_b;
|
||||
const hecl::SystemChar* fileExts[4];
|
||||
unsigned weight;
|
||||
std::function<void(const SpecBase&, PAKEntryReadStream&, PAKRouter<PAKBRIDGE>&,
|
||||
typename PAKBRIDGE::PAKType::Entry&)> func_name;
|
||||
@@ -215,13 +215,13 @@ struct ResExtractor
|
||||
template <class IDType>
|
||||
struct Level
|
||||
{
|
||||
HECL::SystemString name;
|
||||
hecl::SystemString name;
|
||||
struct Area
|
||||
{
|
||||
HECL::SystemString name;
|
||||
hecl::SystemString name;
|
||||
struct Layer
|
||||
{
|
||||
HECL::SystemString name;
|
||||
hecl::SystemString name;
|
||||
bool active;
|
||||
std::unordered_set<IDType> resources;
|
||||
};
|
||||
@@ -244,19 +244,19 @@ private:
|
||||
NamedResourceCatalog<IDType> m_catalog;
|
||||
const SpecBase& m_dataSpec;
|
||||
const std::vector<BRIDGETYPE>* m_bridges = nullptr;
|
||||
std::vector<std::pair<HECL::ProjectPath,HECL::ProjectPath>> m_bridgePaths;
|
||||
std::vector<std::pair<hecl::ProjectPath,hecl::ProjectPath>> m_bridgePaths;
|
||||
size_t m_curBridgeIdx = 0;
|
||||
const HECL::ProjectPath& m_gameWorking;
|
||||
const HECL::ProjectPath& m_gameCooked;
|
||||
HECL::ProjectPath m_sharedWorking;
|
||||
HECL::ProjectPath m_sharedCooked;
|
||||
const hecl::ProjectPath& m_gameWorking;
|
||||
const hecl::ProjectPath& m_gameCooked;
|
||||
hecl::ProjectPath m_sharedWorking;
|
||||
hecl::ProjectPath m_sharedCooked;
|
||||
const PAKType* m_pak = nullptr;
|
||||
const NOD::Node* m_node = nullptr;
|
||||
const nod::Node* m_node = nullptr;
|
||||
std::unordered_map<IDType, std::pair<size_t, EntryType*>> m_uniqueEntries;
|
||||
std::unordered_map<IDType, std::pair<size_t, EntryType*>> m_sharedEntries;
|
||||
std::unordered_map<IDType, RigPair> m_cmdlRigs;
|
||||
public:
|
||||
PAKRouter(const SpecBase& dataSpec, const HECL::ProjectPath& working, const HECL::ProjectPath& cooked)
|
||||
PAKRouter(const SpecBase& dataSpec, const hecl::ProjectPath& working, const hecl::ProjectPath& cooked)
|
||||
: m_dataSpec(dataSpec),
|
||||
m_gameWorking(working), m_gameCooked(cooked),
|
||||
m_sharedWorking(working, "Shared"), m_sharedCooked(cooked, "Shared") {}
|
||||
@@ -277,13 +277,13 @@ public:
|
||||
for (BRIDGETYPE& bridge : bridges)
|
||||
{
|
||||
const std::string& name = bridge.getName();
|
||||
HECL::SystemStringView sysName(name);
|
||||
hecl::SystemStringView sysName(name);
|
||||
|
||||
HECL::SystemString::const_iterator extit = sysName.sys_str().end() - 4;
|
||||
HECL::SystemString baseName(sysName.sys_str().begin(), extit);
|
||||
hecl::SystemString::const_iterator extit = sysName.sys_str().end() - 4;
|
||||
hecl::SystemString baseName(sysName.sys_str().begin(), extit);
|
||||
|
||||
m_bridgePaths.emplace_back(std::make_pair(HECL::ProjectPath(m_gameWorking, baseName),
|
||||
HECL::ProjectPath(m_gameCooked, baseName)));
|
||||
m_bridgePaths.emplace_back(std::make_pair(hecl::ProjectPath(m_gameWorking, baseName),
|
||||
hecl::ProjectPath(m_gameCooked, baseName)));
|
||||
|
||||
/* Index this PAK */
|
||||
bridge.build();
|
||||
@@ -319,8 +319,8 @@ public:
|
||||
++bridgeIdx;
|
||||
}
|
||||
|
||||
HECL::SystemString catalogPath = HECL::ProjectPath(m_gameCooked, "catalog.yaml").getAbsolutePath();
|
||||
FILE* catalog = HECL::Fopen(catalogPath.c_str(), _S("wb"));
|
||||
hecl::SystemString catalogPath = hecl::ProjectPath(m_gameCooked, "catalog.yaml").getAbsolutePath();
|
||||
FILE* catalog = hecl::Fopen(catalogPath.c_str(), _S("wb"));
|
||||
if (catalog)
|
||||
{
|
||||
m_catalog.toYAMLFile(catalog);
|
||||
@@ -346,150 +346,132 @@ public:
|
||||
++pit;
|
||||
++bridgeIdx;
|
||||
}
|
||||
LogDNACommon.report(LogVisor::FatalError, "PAKBridge provided to PAKRouter::enterPAKBridge() was not part of build()");
|
||||
LogDNACommon.report(logvisor::Fatal, "PAKBridge provided to PAKRouter::enterPAKBridge() was not part of build()");
|
||||
}
|
||||
|
||||
HECL::ProjectPath getWorking(const EntryType* entry,
|
||||
hecl::ProjectPath getWorking(const EntryType* entry,
|
||||
const ResExtractor<BRIDGETYPE>& extractor) const
|
||||
{
|
||||
if (!m_pak)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::getWorkingPath()");
|
||||
if (m_pak->m_noShare)
|
||||
{
|
||||
const EntryType* singleSearch = m_pak->lookupEntry(entry->id);
|
||||
if (singleSearch)
|
||||
{
|
||||
const HECL::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].first;
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].first;
|
||||
pakPath.makeDir();
|
||||
#if HECL_UCS2
|
||||
HECL::SystemString entName = HECL::UTF8ToWide(m_pak->bestEntryName(*entry));
|
||||
hecl::SystemString entName = hecl::UTF8ToWide(m_pak->bestEntryName(*entry));
|
||||
#else
|
||||
HECL::SystemString entName = m_pak->bestEntryName(*entry);
|
||||
hecl::SystemString entName = m_pak->bestEntryName(*entry);
|
||||
#endif
|
||||
if (extractor.fileExts[0] && !extractor.fileExts[1])
|
||||
entName += extractor.fileExts[0];
|
||||
return HECL::ProjectPath(pakPath, entName);
|
||||
return hecl::ProjectPath(pakPath, entName);
|
||||
}
|
||||
}
|
||||
|
||||
auto uniqueSearch = m_uniqueEntries.find(entry->id);
|
||||
if (uniqueSearch != m_uniqueEntries.end())
|
||||
{
|
||||
const HECL::ProjectPath& pakPath = m_bridgePaths[uniqueSearch->second.first].first;
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[uniqueSearch->second.first].first;
|
||||
pakPath.makeDir();
|
||||
HECL::ProjectPath uniquePath = entry->unique.uniquePath(pakPath);
|
||||
hecl::ProjectPath uniquePath = entry->unique.uniquePath(pakPath);
|
||||
#if HECL_UCS2
|
||||
HECL::SystemString entName = HECL::UTF8ToWide(m_pak->bestEntryName(*entry));
|
||||
hecl::SystemString entName = hecl::UTF8ToWide(m_pak->bestEntryName(*entry));
|
||||
#else
|
||||
HECL::SystemString entName = m_pak->bestEntryName(*entry);
|
||||
hecl::SystemString entName = m_pak->bestEntryName(*entry);
|
||||
#endif
|
||||
if (extractor.fileExts[0] && !extractor.fileExts[1])
|
||||
entName += extractor.fileExts[0];
|
||||
return HECL::ProjectPath(uniquePath, entName);
|
||||
return hecl::ProjectPath(uniquePath, entName);
|
||||
}
|
||||
|
||||
auto sharedSearch = m_sharedEntries.find(entry->id);
|
||||
if (sharedSearch != m_sharedEntries.end())
|
||||
{
|
||||
const HECL::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].first;
|
||||
HECL::ProjectPath uniquePathPre = entry->unique.uniquePath(pakPath);
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].first;
|
||||
hecl::ProjectPath uniquePathPre = entry->unique.uniquePath(pakPath);
|
||||
#if HECL_UCS2
|
||||
HECL::SystemString entBase = HECL::UTF8ToWide(m_pak->bestEntryName(*entry));
|
||||
hecl::SystemString entBase = hecl::UTF8ToWide(m_pak->bestEntryName(*entry));
|
||||
#else
|
||||
HECL::SystemString entBase = m_pak->bestEntryName(*entry);
|
||||
hecl::SystemString entBase = m_pak->bestEntryName(*entry);
|
||||
#endif
|
||||
HECL::SystemString entName = entBase;
|
||||
hecl::SystemString entName = entBase;
|
||||
if (extractor.fileExts[0] && !extractor.fileExts[1])
|
||||
entName += extractor.fileExts[0];
|
||||
HECL::ProjectPath sharedPath(m_sharedWorking, entName);
|
||||
HECL::ProjectPath uniquePath(uniquePathPre, entName);
|
||||
if (extractor.func_a || extractor.func_b)
|
||||
{
|
||||
if (extractor.fileExts[0] && !extractor.fileExts[1])
|
||||
uniquePath.makeLinkTo(sharedPath);
|
||||
else
|
||||
{
|
||||
for (int e=0 ; e<4 ; ++e)
|
||||
{
|
||||
if (!extractor.fileExts[e])
|
||||
break;
|
||||
HECL::SystemString entName = entBase + extractor.fileExts[e];
|
||||
HECL::ProjectPath sharedPath(m_sharedWorking, entName);
|
||||
HECL::ProjectPath uniquePath(uniquePathPre, entName);
|
||||
uniquePath.makeLinkTo(sharedPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
hecl::ProjectPath sharedPath(m_sharedWorking, entName);
|
||||
m_sharedWorking.makeDir();
|
||||
return sharedPath;
|
||||
}
|
||||
|
||||
LogDNACommon.report(LogVisor::FatalError, "Unable to find entry %s", entry->id.toString().c_str());
|
||||
return HECL::ProjectPath();
|
||||
LogDNACommon.report(logvisor::Fatal, "Unable to find entry %s", entry->id.toString().c_str());
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
|
||||
HECL::ProjectPath getWorking(const EntryType* entry) const
|
||||
hecl::ProjectPath getWorking(const EntryType* entry) const
|
||||
{
|
||||
return getWorking(entry, BRIDGETYPE::LookupExtractor(*entry));
|
||||
}
|
||||
|
||||
HECL::ProjectPath getWorking(const IDType& id) const
|
||||
hecl::ProjectPath getWorking(const IDType& id) const
|
||||
{
|
||||
return getWorking(lookupEntry(id));
|
||||
}
|
||||
|
||||
HECL::ProjectPath getCooked(const EntryType* entry) const
|
||||
hecl::ProjectPath getCooked(const EntryType* entry) const
|
||||
{
|
||||
if (!m_pak)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::getCookedPath()");
|
||||
if (m_pak->m_noShare)
|
||||
{
|
||||
const EntryType* singleSearch = m_pak->lookupEntry(entry->id);
|
||||
if (singleSearch)
|
||||
{
|
||||
const HECL::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].second;
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].second;
|
||||
pakPath.makeDir();
|
||||
return HECL::ProjectPath(pakPath, m_pak->bestEntryName(*entry));
|
||||
return hecl::ProjectPath(pakPath, m_pak->bestEntryName(*entry));
|
||||
}
|
||||
}
|
||||
auto uniqueSearch = m_uniqueEntries.find(entry->id);
|
||||
if (uniqueSearch != m_uniqueEntries.end())
|
||||
{
|
||||
const HECL::ProjectPath& pakPath = m_bridgePaths[uniqueSearch->second.first].second;
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[uniqueSearch->second.first].second;
|
||||
pakPath.makeDir();
|
||||
HECL::ProjectPath uniquePath = entry->unique.uniquePath(pakPath);
|
||||
return HECL::ProjectPath(uniquePath, m_pak->bestEntryName(*entry));
|
||||
hecl::ProjectPath uniquePath = entry->unique.uniquePath(pakPath);
|
||||
return hecl::ProjectPath(uniquePath, m_pak->bestEntryName(*entry));
|
||||
}
|
||||
auto sharedSearch = m_sharedEntries.find(entry->id);
|
||||
if (sharedSearch != m_sharedEntries.end())
|
||||
{
|
||||
m_sharedCooked.makeDir();
|
||||
return HECL::ProjectPath(m_sharedCooked, m_pak->bestEntryName(*entry));
|
||||
return hecl::ProjectPath(m_sharedCooked, m_pak->bestEntryName(*entry));
|
||||
}
|
||||
LogDNACommon.report(LogVisor::FatalError, "Unable to find entry %s", entry->id.toString().c_str());
|
||||
return HECL::ProjectPath();
|
||||
LogDNACommon.report(logvisor::Fatal, "Unable to find entry %s", entry->id.toString().c_str());
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
|
||||
HECL::ProjectPath getCooked(const IDType& id) const
|
||||
hecl::ProjectPath getCooked(const IDType& id) const
|
||||
{
|
||||
return getCooked(lookupEntry(id));
|
||||
}
|
||||
|
||||
HECL::SystemString getResourceRelativePath(const EntryType& a, const IDType& b) const
|
||||
hecl::SystemString getResourceRelativePath(const EntryType& a, const IDType& b) const
|
||||
{
|
||||
if (!m_pak)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::getResourceRelativePath()");
|
||||
const typename BRIDGETYPE::PAKType::Entry* be = lookupEntry(b);
|
||||
if (!be)
|
||||
return HECL::SystemString();
|
||||
HECL::ProjectPath aPath = getWorking(&a, BRIDGETYPE::LookupExtractor(a));
|
||||
HECL::SystemString ret;
|
||||
return hecl::SystemString();
|
||||
hecl::ProjectPath aPath = getWorking(&a, BRIDGETYPE::LookupExtractor(a));
|
||||
hecl::SystemString ret;
|
||||
for (int i=0 ; i<aPath.levelCount() ; ++i)
|
||||
ret += _S("../");
|
||||
HECL::ProjectPath bPath = getWorking(be, BRIDGETYPE::LookupExtractor(*be));
|
||||
hecl::ProjectPath bPath = getWorking(be, BRIDGETYPE::LookupExtractor(*be));
|
||||
ret += bPath.getRelativePath();
|
||||
return ret;
|
||||
}
|
||||
@@ -497,7 +479,7 @@ public:
|
||||
std::string getBestEntryName(const EntryType& entry) const
|
||||
{
|
||||
if (!m_pak)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::getBestEntryName()");
|
||||
return m_pak->bestEntryName(entry);
|
||||
}
|
||||
@@ -505,7 +487,7 @@ public:
|
||||
std::string getBestEntryName(const IDType& entry) const
|
||||
{
|
||||
if (!m_pak)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::getBestEntryName()");
|
||||
const typename BRIDGETYPE::PAKType::Entry* e = m_pak->lookupEntry(entry);
|
||||
if (!e)
|
||||
@@ -514,7 +496,7 @@ public:
|
||||
}
|
||||
|
||||
bool extractResources(const BRIDGETYPE& pakBridge, bool force,
|
||||
std::function<void(const HECL::SystemChar*, float)> progress)
|
||||
std::function<void(const hecl::SystemChar*, float)> progress)
|
||||
{
|
||||
enterPAKBridge(pakBridge);
|
||||
size_t count = 0;
|
||||
@@ -529,24 +511,24 @@ public:
|
||||
continue;
|
||||
|
||||
std::string bestName = getBestEntryName(*item);
|
||||
HECL::SystemStringView bestNameView(bestName);
|
||||
hecl::SystemStringView bestNameView(bestName);
|
||||
float thisFac = ++count / fsz;
|
||||
progress(bestNameView.sys_str().c_str(), thisFac);
|
||||
|
||||
/* TODO: Position after extracted item */
|
||||
HECL::ProjectPath cooked = getCooked(item);
|
||||
if (force || cooked.getPathType() == HECL::ProjectPath::Type::None)
|
||||
hecl::ProjectPath cooked = getCooked(item);
|
||||
if (force || cooked.getPathType() == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
PAKEntryReadStream s = item->beginReadStream(*m_node);
|
||||
FILE* fout = HECL::Fopen(cooked.getAbsolutePath().c_str(), _S("wb"));
|
||||
FILE* fout = hecl::Fopen(cooked.getAbsolutePath().c_str(), _S("wb"));
|
||||
fwrite(s.data(), 1, s.length(), fout);
|
||||
fclose(fout);
|
||||
}
|
||||
|
||||
HECL::ProjectPath working = getWorking(item, extractor);
|
||||
hecl::ProjectPath working = getWorking(item, extractor);
|
||||
if (extractor.func_a) /* Doesn't need PAKRouter access */
|
||||
{
|
||||
if (force || working.getPathType() == HECL::ProjectPath::Type::None)
|
||||
if (force || working.getPathType() == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
PAKEntryReadStream s = item->beginReadStream(*m_node);
|
||||
extractor.func_a(s, working);
|
||||
@@ -554,11 +536,11 @@ public:
|
||||
}
|
||||
else if (extractor.func_b) /* Needs PAKRouter access */
|
||||
{
|
||||
if (force || working.getPathType() == HECL::ProjectPath::Type::None)
|
||||
if (force || working.getPathType() == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
PAKEntryReadStream s = item->beginReadStream(*m_node);
|
||||
extractor.func_b(m_dataSpec, s, working, *this, *item, force,
|
||||
[&progress, thisFac](const HECL::SystemChar* update)
|
||||
[&progress, thisFac](const hecl::SystemChar* update)
|
||||
{
|
||||
progress(update, thisFac);
|
||||
});
|
||||
@@ -571,7 +553,7 @@ public:
|
||||
}
|
||||
|
||||
const typename BRIDGETYPE::PAKType::Entry* lookupEntry(const IDType& entry,
|
||||
const NOD::Node** nodeOut=nullptr,
|
||||
const nod::Node** nodeOut=nullptr,
|
||||
bool silenceWarnings=false,
|
||||
bool currentPAK=false) const
|
||||
{
|
||||
@@ -579,7 +561,7 @@ public:
|
||||
return nullptr;
|
||||
|
||||
if (!m_bridges)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::build() must be called before PAKRouter::lookupEntry()");
|
||||
|
||||
if (m_pak)
|
||||
@@ -596,7 +578,7 @@ public:
|
||||
if (currentPAK)
|
||||
{
|
||||
if (!silenceWarnings)
|
||||
LogDNACommon.report(LogVisor::Warning, "unable to find PAK entry %s in current PAK", entry.toString().c_str());
|
||||
LogDNACommon.report(logvisor::Warning, "unable to find PAK entry %s in current PAK", entry.toString().c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -613,7 +595,7 @@ public:
|
||||
}
|
||||
|
||||
if (!silenceWarnings)
|
||||
LogDNACommon.report(LogVisor::Warning, "unable to find PAK entry %s", entry.toString().c_str());
|
||||
LogDNACommon.report(logvisor::Warning, "unable to find PAK entry %s", entry.toString().c_str());
|
||||
if (nodeOut)
|
||||
*nodeOut = nullptr;
|
||||
return nullptr;
|
||||
@@ -622,7 +604,7 @@ public:
|
||||
template <typename DNA>
|
||||
bool lookupAndReadDNA(const IDType& id, DNA& out, bool silenceWarnings=false)
|
||||
{
|
||||
const NOD::Node* node;
|
||||
const nod::Node* node;
|
||||
const EntryType* entry = lookupEntry(id, &node, silenceWarnings);
|
||||
if (!entry)
|
||||
return false;
|
||||
@@ -639,10 +621,10 @@ public:
|
||||
return &search->second;
|
||||
}
|
||||
|
||||
HECL::ProjectPath getAreaLayerWorking(const IDType& areaId, int layerIdx) const
|
||||
hecl::ProjectPath getAreaLayerWorking(const IDType& areaId, int layerIdx) const
|
||||
{
|
||||
if (!m_bridges)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::build() must be called before PAKRouter::getAreaLayerWorking()");
|
||||
auto bridgePathIt = m_bridgePaths.cbegin();
|
||||
for (const BRIDGETYPE& bridge : *m_bridges)
|
||||
@@ -651,21 +633,21 @@ public:
|
||||
for (const auto& area : level.second.areas)
|
||||
if (area.first == areaId)
|
||||
{
|
||||
HECL::ProjectPath levelPath(bridgePathIt->first, level.second.name);
|
||||
HECL::ProjectPath areaPath(levelPath, area.second.name);
|
||||
hecl::ProjectPath levelPath(bridgePathIt->first, level.second.name);
|
||||
hecl::ProjectPath areaPath(levelPath, area.second.name);
|
||||
if (layerIdx < 0)
|
||||
return areaPath;
|
||||
return HECL::ProjectPath(areaPath, area.second.layers.at(layerIdx).name);
|
||||
return hecl::ProjectPath(areaPath, area.second.layers.at(layerIdx).name);
|
||||
}
|
||||
++bridgePathIt;
|
||||
}
|
||||
return HECL::ProjectPath();
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
|
||||
HECL::ProjectPath getAreaLayerCooked(const IDType& areaId, int layerIdx) const
|
||||
hecl::ProjectPath getAreaLayerCooked(const IDType& areaId, int layerIdx) const
|
||||
{
|
||||
if (!m_bridges)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::build() must be called before PAKRouter::getAreaLayerCooked()");
|
||||
auto bridgePathIt = m_bridgePaths.cbegin();
|
||||
for (const BRIDGETYPE& bridge : *m_bridges)
|
||||
@@ -674,15 +656,15 @@ public:
|
||||
for (const auto& area : level.second.areas)
|
||||
if (area.first == areaId)
|
||||
{
|
||||
HECL::ProjectPath levelPath(bridgePathIt->second, level.second.name);
|
||||
HECL::ProjectPath areaPath(levelPath, area.second.name);
|
||||
hecl::ProjectPath levelPath(bridgePathIt->second, level.second.name);
|
||||
hecl::ProjectPath areaPath(levelPath, area.second.name);
|
||||
if (layerIdx < 0)
|
||||
return areaPath;
|
||||
return HECL::ProjectPath(areaPath, area.second.layers.at(layerIdx).name);
|
||||
return hecl::ProjectPath(areaPath, area.second.layers.at(layerIdx).name);
|
||||
}
|
||||
++bridgePathIt;
|
||||
}
|
||||
return HECL::ProjectPath();
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "ParticleCommon.hpp"
|
||||
#include "PAK.hpp"
|
||||
#include "Athena/FileWriter.hpp"
|
||||
#include "athena/FileWriter.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
@@ -13,7 +13,7 @@ namespace DNAParticle
|
||||
template <class IDType>
|
||||
struct GPSM : BigYAML
|
||||
{
|
||||
static const char* DNAType() {return "Retro::GPSM";}
|
||||
static const char* DNAType() {return "urde::GPSM";}
|
||||
const char* DNATypeV() const {return DNAType();}
|
||||
|
||||
VectorElementFactory x0_PSIV;
|
||||
@@ -107,13 +107,13 @@ struct GPSM : BigYAML
|
||||
x45_25_PMOO = true;
|
||||
}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
for (const auto& elem : r.getCurNode()->m_mapChildren)
|
||||
{
|
||||
if (elem.first.size() < 4)
|
||||
{
|
||||
LogModule.report(LogVisor::Warning, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Warning, "short FourCC in element '%s'", elem.first.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ struct GPSM : BigYAML
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (x0_PSIV)
|
||||
{
|
||||
@@ -950,13 +950,13 @@ struct GPSM : BigYAML
|
||||
__isz = x128_ADV8.binarySize(__isz + 4);
|
||||
return __isz;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
if (clsId != SBIG('GPSM'))
|
||||
{
|
||||
LogModule.report(LogVisor::Warning, "non GPSM provided to GPSM parser");
|
||||
LogModule.report(logvisor::Warning, "non GPSM provided to GPSM parser");
|
||||
return;
|
||||
}
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
@@ -1226,13 +1226,13 @@ struct GPSM : BigYAML
|
||||
xd8_SELC.read(r);
|
||||
break;
|
||||
default:
|
||||
LogModule.report(LogVisor::FatalError, "Unknown GPSM class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, "Unknown GPSM class %.4s @%" PRIi64, &clsId, r.position());
|
||||
break;
|
||||
}
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
}
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeBytes((atInt8*)"GPSM", 4);
|
||||
if (x0_PSIV)
|
||||
@@ -1626,9 +1626,9 @@ struct GPSM : BigYAML
|
||||
};
|
||||
|
||||
template <class IDType>
|
||||
bool ExtractGPSM(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
|
||||
bool ExtractGPSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("w"));
|
||||
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("w"));
|
||||
if (fp)
|
||||
{
|
||||
GPSM<IDType> gpsm;
|
||||
@@ -1641,9 +1641,9 @@ bool ExtractGPSM(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
|
||||
}
|
||||
|
||||
template <class IDType>
|
||||
bool WriteGPSM(const GPSM<IDType>& gpsm, const HECL::ProjectPath& outPath)
|
||||
bool WriteGPSM(const GPSM<IDType>& gpsm, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
Athena::io::FileWriter w(outPath.getAbsolutePath(), true, false);
|
||||
athena::io::FileWriter w(outPath.getAbsolutePath(), true, false);
|
||||
if (w.hasError())
|
||||
return false;
|
||||
gpsm.write(w);
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace DataSpec
|
||||
{
|
||||
namespace DNAParticle
|
||||
{
|
||||
LogVisor::LogModule LogModule("Retro::DNAParticle");
|
||||
logvisor::Module LogModule("urde::DNAParticle");
|
||||
|
||||
void RealElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
void RealElementFactory::read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
||||
if (mapChildren.empty())
|
||||
@@ -17,7 +17,7 @@ void RealElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
||||
{
|
||||
@@ -130,7 +130,7 @@ void RealElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
|
||||
void RealElementFactory::write(Athena::io::YAMLDocWriter& w) const
|
||||
void RealElementFactory::write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
@@ -148,7 +148,7 @@ size_t RealElementFactory::binarySize(size_t __isz) const
|
||||
return __isz + 4;
|
||||
}
|
||||
|
||||
void RealElementFactory::read(Athena::io::IStreamReader& r)
|
||||
void RealElementFactory::read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
@@ -259,13 +259,13 @@ void RealElementFactory::read(Athena::io::IStreamReader& r)
|
||||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(LogVisor::FatalError, "Unknown RealElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, "Unknown RealElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
}
|
||||
|
||||
void RealElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
void RealElementFactory::write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
@@ -277,7 +277,7 @@ void RealElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
}
|
||||
|
||||
|
||||
void IntElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
void IntElementFactory::read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
||||
if (mapChildren.empty())
|
||||
@@ -288,7 +288,7 @@ void IntElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
||||
{
|
||||
@@ -353,7 +353,7 @@ void IntElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
|
||||
void IntElementFactory::write(Athena::io::YAMLDocWriter& w) const
|
||||
void IntElementFactory::write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
@@ -371,7 +371,7 @@ size_t IntElementFactory::binarySize(size_t __isz) const
|
||||
return __isz + 4;
|
||||
}
|
||||
|
||||
void IntElementFactory::read(Athena::io::IStreamReader& r)
|
||||
void IntElementFactory::read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
@@ -434,13 +434,13 @@ void IntElementFactory::read(Athena::io::IStreamReader& r)
|
||||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(LogVisor::FatalError, "Unknown IntElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, "Unknown IntElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
}
|
||||
|
||||
void IntElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
void IntElementFactory::write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
@@ -451,7 +451,7 @@ void IntElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
w.writeBytes((atInt8*)"NONE", 4);
|
||||
}
|
||||
|
||||
void VectorElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
void VectorElementFactory::read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
||||
if (mapChildren.empty())
|
||||
@@ -462,7 +462,7 @@ void VectorElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
||||
{
|
||||
@@ -527,7 +527,7 @@ void VectorElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
|
||||
void VectorElementFactory::write(Athena::io::YAMLDocWriter& w) const
|
||||
void VectorElementFactory::write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
@@ -545,7 +545,7 @@ size_t VectorElementFactory::binarySize(size_t __isz) const
|
||||
return __isz + 4;
|
||||
}
|
||||
|
||||
void VectorElementFactory::read(Athena::io::IStreamReader& r)
|
||||
void VectorElementFactory::read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
@@ -608,13 +608,13 @@ void VectorElementFactory::read(Athena::io::IStreamReader& r)
|
||||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(LogVisor::FatalError, "Unknown VectorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, "Unknown VectorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
}
|
||||
|
||||
void VectorElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
void VectorElementFactory::write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
@@ -626,7 +626,7 @@ void VectorElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
}
|
||||
|
||||
|
||||
void ColorElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
void ColorElementFactory::read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
||||
if (mapChildren.empty())
|
||||
@@ -637,7 +637,7 @@ void ColorElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
||||
{
|
||||
@@ -669,7 +669,7 @@ void ColorElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
|
||||
void ColorElementFactory::write(Athena::io::YAMLDocWriter& w) const
|
||||
void ColorElementFactory::write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
@@ -687,7 +687,7 @@ size_t ColorElementFactory::binarySize(size_t __isz) const
|
||||
return __isz + 4;
|
||||
}
|
||||
|
||||
void ColorElementFactory::read(Athena::io::IStreamReader& r)
|
||||
void ColorElementFactory::read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
@@ -717,13 +717,13 @@ void ColorElementFactory::read(Athena::io::IStreamReader& r)
|
||||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(LogVisor::FatalError, "Unknown ColorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, "Unknown ColorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
}
|
||||
|
||||
void ColorElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
void ColorElementFactory::write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
@@ -735,7 +735,7 @@ void ColorElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
}
|
||||
|
||||
|
||||
void ModVectorElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
void ModVectorElementFactory::read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
||||
if (mapChildren.empty())
|
||||
@@ -746,7 +746,7 @@ void ModVectorElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
||||
{
|
||||
@@ -795,7 +795,7 @@ void ModVectorElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
|
||||
void ModVectorElementFactory::write(Athena::io::YAMLDocWriter& w) const
|
||||
void ModVectorElementFactory::write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
@@ -813,7 +813,7 @@ size_t ModVectorElementFactory::binarySize(size_t __isz) const
|
||||
return __isz + 4;
|
||||
}
|
||||
|
||||
void ModVectorElementFactory::read(Athena::io::IStreamReader& r)
|
||||
void ModVectorElementFactory::read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
@@ -860,13 +860,13 @@ void ModVectorElementFactory::read(Athena::io::IStreamReader& r)
|
||||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(LogVisor::FatalError, "Unknown ModVectorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, "Unknown ModVectorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
}
|
||||
|
||||
void ModVectorElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
void ModVectorElementFactory::write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
@@ -878,7 +878,7 @@ void ModVectorElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
}
|
||||
|
||||
|
||||
void EmitterElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
void EmitterElementFactory::read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
||||
if (mapChildren.empty())
|
||||
@@ -889,7 +889,7 @@ void EmitterElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
||||
{
|
||||
@@ -914,7 +914,7 @@ void EmitterElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
|
||||
void EmitterElementFactory::write(Athena::io::YAMLDocWriter& w) const
|
||||
void EmitterElementFactory::write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
@@ -932,7 +932,7 @@ size_t EmitterElementFactory::binarySize(size_t __isz) const
|
||||
return __isz + 4;
|
||||
}
|
||||
|
||||
void EmitterElementFactory::read(Athena::io::IStreamReader& r)
|
||||
void EmitterElementFactory::read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
@@ -955,13 +955,13 @@ void EmitterElementFactory::read(Athena::io::IStreamReader& r)
|
||||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(LogVisor::FatalError, "Unknown EmitterElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, "Unknown EmitterElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
}
|
||||
|
||||
void EmitterElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
void EmitterElementFactory::write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace DataSpec
|
||||
{
|
||||
namespace DNAParticle
|
||||
{
|
||||
extern LogVisor::LogModule LogModule;
|
||||
extern logvisor::Module LogModule;
|
||||
|
||||
struct IElement : BigYAML
|
||||
{
|
||||
@@ -23,11 +23,11 @@ struct RealElementFactory : BigYAML
|
||||
std::unique_ptr<IRealElement> m_elem;
|
||||
operator bool() const {return m_elem.operator bool();}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r);
|
||||
void write(Athena::io::YAMLDocWriter& w) const;
|
||||
void read(athena::io::YAMLDocReader& r);
|
||||
void write(athena::io::YAMLDocWriter& w) const;
|
||||
size_t binarySize(size_t __isz) const;
|
||||
void read(Athena::io::IStreamReader& r);
|
||||
void write(Athena::io::IStreamWriter& w) const;
|
||||
void read(athena::io::IStreamReader& r);
|
||||
void write(athena::io::IStreamWriter& w) const;
|
||||
};
|
||||
|
||||
struct IIntElement : IElement {Delete _d;};
|
||||
@@ -37,11 +37,11 @@ struct IntElementFactory : BigYAML
|
||||
std::unique_ptr<IIntElement> m_elem;
|
||||
operator bool() const {return m_elem.operator bool();}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r);
|
||||
void write(Athena::io::YAMLDocWriter& w) const;
|
||||
void read(athena::io::YAMLDocReader& r);
|
||||
void write(athena::io::YAMLDocWriter& w) const;
|
||||
size_t binarySize(size_t __isz) const;
|
||||
void read(Athena::io::IStreamReader& r);
|
||||
void write(Athena::io::IStreamWriter& w) const;
|
||||
void read(athena::io::IStreamReader& r);
|
||||
void write(athena::io::IStreamWriter& w) const;
|
||||
};
|
||||
|
||||
struct IVectorElement : IElement {Delete _d;};
|
||||
@@ -51,11 +51,11 @@ struct VectorElementFactory : BigYAML
|
||||
std::unique_ptr<IVectorElement> m_elem;
|
||||
operator bool() const {return m_elem.operator bool();}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r);
|
||||
void write(Athena::io::YAMLDocWriter& w) const;
|
||||
void read(athena::io::YAMLDocReader& r);
|
||||
void write(athena::io::YAMLDocWriter& w) const;
|
||||
size_t binarySize(size_t __isz) const;
|
||||
void read(Athena::io::IStreamReader& r);
|
||||
void write(Athena::io::IStreamWriter& w) const;
|
||||
void read(athena::io::IStreamReader& r);
|
||||
void write(athena::io::IStreamWriter& w) const;
|
||||
};
|
||||
|
||||
struct IColorElement : IElement {Delete _d;};
|
||||
@@ -65,11 +65,11 @@ struct ColorElementFactory : BigYAML
|
||||
std::unique_ptr<IColorElement> m_elem;
|
||||
operator bool() const {return m_elem.operator bool();}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r);
|
||||
void write(Athena::io::YAMLDocWriter& w) const;
|
||||
void read(athena::io::YAMLDocReader& r);
|
||||
void write(athena::io::YAMLDocWriter& w) const;
|
||||
size_t binarySize(size_t __isz) const;
|
||||
void read(Athena::io::IStreamReader& r);
|
||||
void write(Athena::io::IStreamWriter& w) const;
|
||||
void read(athena::io::IStreamReader& r);
|
||||
void write(athena::io::IStreamWriter& w) const;
|
||||
};
|
||||
|
||||
struct IModVectorElement : IElement {Delete _d;};
|
||||
@@ -79,11 +79,11 @@ struct ModVectorElementFactory : BigYAML
|
||||
std::unique_ptr<IModVectorElement> m_elem;
|
||||
operator bool() const {return m_elem.operator bool();}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r);
|
||||
void write(Athena::io::YAMLDocWriter& w) const;
|
||||
void read(athena::io::YAMLDocReader& r);
|
||||
void write(athena::io::YAMLDocWriter& w) const;
|
||||
size_t binarySize(size_t __isz) const;
|
||||
void read(Athena::io::IStreamReader& r);
|
||||
void write(Athena::io::IStreamWriter& w) const;
|
||||
void read(athena::io::IStreamReader& r);
|
||||
void write(athena::io::IStreamWriter& w) const;
|
||||
};
|
||||
|
||||
struct IEmitterElement : IElement {Delete _d;};
|
||||
@@ -93,11 +93,11 @@ struct EmitterElementFactory : BigYAML
|
||||
std::unique_ptr<IEmitterElement> m_elem;
|
||||
operator bool() const {return m_elem.operator bool();}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r);
|
||||
void write(Athena::io::YAMLDocWriter& w) const;
|
||||
void read(athena::io::YAMLDocReader& r);
|
||||
void write(athena::io::YAMLDocWriter& w) const;
|
||||
size_t binarySize(size_t __isz) const;
|
||||
void read(Athena::io::IStreamReader& r);
|
||||
void write(Athena::io::IStreamWriter& w) const;
|
||||
void read(athena::io::IStreamReader& r);
|
||||
void write(athena::io::IStreamWriter& w) const;
|
||||
};
|
||||
|
||||
struct IUVElement : IElement {Delete _d;};
|
||||
@@ -108,11 +108,11 @@ struct BoolHelper : IElement
|
||||
bool value = false;
|
||||
operator bool() const {return value;}
|
||||
BoolHelper& operator=(bool val) {value = val; return *this;}
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
value = r.readBool(nullptr);
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.writeBool(nullptr, value);
|
||||
}
|
||||
@@ -120,7 +120,7 @@ struct BoolHelper : IElement
|
||||
{
|
||||
return __isz + 5;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
@@ -129,7 +129,7 @@ struct BoolHelper : IElement
|
||||
else
|
||||
value = false;
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeBytes((atInt8*)"CNST", 4);
|
||||
w.writeBool(value);
|
||||
@@ -150,11 +150,11 @@ struct REConstant : IRealElement
|
||||
Delete _d;
|
||||
Value<float> val;
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
val = r.readFloat(nullptr);
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.writeFloat(nullptr, val);
|
||||
}
|
||||
@@ -162,11 +162,11 @@ struct REConstant : IRealElement
|
||||
{
|
||||
return __isz + 4;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
val = r.readFloatBig();
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeFloatBig(val);
|
||||
}
|
||||
@@ -463,11 +463,11 @@ struct IEConstant : IIntElement
|
||||
Delete _d;
|
||||
Value<atUint32> val;
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
val = r.readUint32(nullptr);
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.writeUint32(nullptr, val);
|
||||
}
|
||||
@@ -475,11 +475,11 @@ struct IEConstant : IIntElement
|
||||
{
|
||||
return __isz + 4;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
val = r.readUint32Big();
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeUint32Big(val);
|
||||
}
|
||||
@@ -624,7 +624,7 @@ struct VEConstant : IVectorElement
|
||||
Delete _d;
|
||||
RealElementFactory comps[3];
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
{
|
||||
@@ -633,7 +633,7 @@ struct VEConstant : IVectorElement
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.enterSubVector(nullptr);
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
@@ -650,13 +650,13 @@ struct VEConstant : IVectorElement
|
||||
__isz = comps[1].binarySize(__isz);
|
||||
return comps[2].binarySize(__isz);
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
comps[0].read(r);
|
||||
comps[1].read(r);
|
||||
comps[2].read(r);
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
comps[0].write(w);
|
||||
comps[1].write(w);
|
||||
@@ -772,7 +772,7 @@ struct CEConstant : IColorElement
|
||||
Delete _d;
|
||||
RealElementFactory comps[4];
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
{
|
||||
@@ -781,7 +781,7 @@ struct CEConstant : IColorElement
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.enterSubVector(nullptr);
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
@@ -799,14 +799,14 @@ struct CEConstant : IColorElement
|
||||
__isz = comps[2].binarySize(__isz);
|
||||
return comps[3].binarySize(__isz);
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
comps[0].read(r);
|
||||
comps[1].read(r);
|
||||
comps[2].read(r);
|
||||
comps[3].read(r);
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
comps[0].write(w);
|
||||
comps[1].write(w);
|
||||
@@ -902,7 +902,7 @@ struct MVEConstant : IModVectorElement
|
||||
Delete _d;
|
||||
RealElementFactory comps[3];
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
{
|
||||
@@ -911,7 +911,7 @@ struct MVEConstant : IModVectorElement
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.enterSubVector(nullptr);
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
@@ -928,13 +928,13 @@ struct MVEConstant : IModVectorElement
|
||||
__isz = comps[1].binarySize(__isz);
|
||||
return comps[2].binarySize(__isz);
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
comps[0].read(r);
|
||||
comps[1].read(r);
|
||||
comps[2].read(r);
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
comps[0].write(w);
|
||||
comps[1].write(w);
|
||||
@@ -1039,7 +1039,7 @@ struct EESimpleEmitterTR : EESimpleEmitter
|
||||
{
|
||||
Delete _d;
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
position.m_elem.reset();
|
||||
velocity.m_elem.reset();
|
||||
@@ -1054,7 +1054,7 @@ struct EESimpleEmitterTR : EESimpleEmitter
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.enterSubRecord("ILOC");
|
||||
position.write(w);
|
||||
@@ -1070,7 +1070,7 @@ struct EESimpleEmitterTR : EESimpleEmitter
|
||||
__isz = velocity.binarySize(__isz);
|
||||
return __isz;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
position.m_elem.reset();
|
||||
velocity.m_elem.reset();
|
||||
@@ -1084,7 +1084,7 @@ struct EESimpleEmitterTR : EESimpleEmitter
|
||||
velocity.read(r);
|
||||
}
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeBytes((atInt8*)"ILOC", 4);
|
||||
position.write(w);
|
||||
@@ -1099,7 +1099,7 @@ struct UVEConstant : IUVElement
|
||||
{
|
||||
Delete _d;
|
||||
IDType tex;
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
tex.clear();
|
||||
if (r.enterSubRecord("tex"))
|
||||
@@ -1108,7 +1108,7 @@ struct UVEConstant : IUVElement
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.enterSubRecord("tex");
|
||||
tex.write(w);
|
||||
@@ -1118,7 +1118,7 @@ struct UVEConstant : IUVElement
|
||||
{
|
||||
return tex.binarySize(__isz + 4);
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
tex.clear();
|
||||
uint32_t clsId;
|
||||
@@ -1126,7 +1126,7 @@ struct UVEConstant : IUVElement
|
||||
if (clsId == SBIG('CNST'))
|
||||
tex.read(r);
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeBytes((atInt8*)"CNST", 4);
|
||||
tex.write(w);
|
||||
@@ -1145,7 +1145,7 @@ struct UVEAnimTexture : IUVElement
|
||||
IntElementFactory strideH;
|
||||
IntElementFactory cycleFrames;
|
||||
Value<bool> loop = false;
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
tex.clear();
|
||||
if (r.enterSubRecord("tex"))
|
||||
@@ -1184,7 +1184,7 @@ struct UVEAnimTexture : IUVElement
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.enterSubRecord("tex");
|
||||
tex.write(w);
|
||||
@@ -1217,7 +1217,7 @@ struct UVEAnimTexture : IUVElement
|
||||
__isz = cycleFrames.binarySize(__isz);
|
||||
return __isz;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
tex.clear();
|
||||
uint32_t clsId;
|
||||
@@ -1233,7 +1233,7 @@ struct UVEAnimTexture : IUVElement
|
||||
if (clsId == SBIG('CNST'))
|
||||
loop = r.readBool();
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeBytes((atInt8*)"CNST", 4);
|
||||
tex.write(w);
|
||||
@@ -1255,7 +1255,7 @@ struct UVElementFactory : BigYAML
|
||||
std::unique_ptr<IUVElement> m_elem;
|
||||
operator bool() const {return m_elem.operator bool();}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
if (r.enterSubRecord("CNST"))
|
||||
{
|
||||
@@ -1273,7 +1273,7 @@ struct UVElementFactory : BigYAML
|
||||
m_elem.reset();
|
||||
}
|
||||
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
@@ -1291,7 +1291,7 @@ struct UVElementFactory : BigYAML
|
||||
return __isz + 4;
|
||||
}
|
||||
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
@@ -1310,7 +1310,7 @@ struct UVElementFactory : BigYAML
|
||||
m_elem->read(r);
|
||||
}
|
||||
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
@@ -1339,7 +1339,7 @@ struct SpawnSystemKeyframeData : BigYAML
|
||||
Value<atUint32> b;
|
||||
Value<atUint32> c;
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
if (r.enterSubRecord("id"))
|
||||
{
|
||||
@@ -1362,7 +1362,7 @@ struct SpawnSystemKeyframeData : BigYAML
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.enterSubRecord("id");
|
||||
id.write(w);
|
||||
@@ -1375,14 +1375,14 @@ struct SpawnSystemKeyframeData : BigYAML
|
||||
{
|
||||
return id.binarySize(__isz + 12);
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
id.read(r);
|
||||
a = r.readUint32Big();
|
||||
b = r.readUint32Big();
|
||||
c = r.readUint32Big();
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
id.write(w);
|
||||
w.writeUint32Big(a);
|
||||
@@ -1393,7 +1393,7 @@ struct SpawnSystemKeyframeData : BigYAML
|
||||
|
||||
std::vector<std::pair<atUint32, std::vector<SpawnSystemKeyframeInfo>>> spawns;
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
if (r.enterSubRecord("a"))
|
||||
{
|
||||
@@ -1416,18 +1416,20 @@ struct SpawnSystemKeyframeData : BigYAML
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
spawns.clear();
|
||||
if (r.enterSubVector("spawns"))
|
||||
size_t spawnCount;
|
||||
if (r.enterSubVector("spawns", spawnCount))
|
||||
{
|
||||
spawns.reserve(r.getCurNode()->m_seqChildren.size());
|
||||
spawns.reserve(spawnCount);
|
||||
for (const auto& child : r.getCurNode()->m_seqChildren)
|
||||
{
|
||||
if (r.enterSubRecord(nullptr))
|
||||
{
|
||||
spawns.emplace_back();
|
||||
spawns.back().first = r.readUint32("startFrame");
|
||||
if (r.enterSubVector("systems"))
|
||||
size_t systemCount;
|
||||
if (r.enterSubVector("systems", systemCount))
|
||||
{
|
||||
spawns.back().second.reserve(r.getCurNode()->m_seqChildren.size());
|
||||
spawns.back().second.reserve(systemCount);
|
||||
for (const auto& in : r.getCurNode()->m_seqChildren)
|
||||
{
|
||||
spawns.back().second.emplace_back();
|
||||
@@ -1444,7 +1446,7 @@ struct SpawnSystemKeyframeData : BigYAML
|
||||
r.leaveSubVector();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (spawns.empty())
|
||||
return;
|
||||
@@ -1480,7 +1482,7 @@ struct SpawnSystemKeyframeData : BigYAML
|
||||
}
|
||||
return __isz;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
@@ -1507,7 +1509,7 @@ struct SpawnSystemKeyframeData : BigYAML
|
||||
}
|
||||
}
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (spawns.empty())
|
||||
{
|
||||
@@ -1537,7 +1539,7 @@ struct ChildResourceFactory : BigYAML
|
||||
{
|
||||
Delete _d;
|
||||
IDType id;
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
id.clear();
|
||||
if (r.enterSubRecord("CNST"))
|
||||
@@ -1546,7 +1548,7 @@ struct ChildResourceFactory : BigYAML
|
||||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (id)
|
||||
{
|
||||
@@ -1562,7 +1564,7 @@ struct ChildResourceFactory : BigYAML
|
||||
else
|
||||
return __isz + 4;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
id.clear();
|
||||
uint32_t clsId;
|
||||
@@ -1570,7 +1572,7 @@ struct ChildResourceFactory : BigYAML
|
||||
if (clsId == SBIG('CNST'))
|
||||
id.read(r);
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (id)
|
||||
{
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
namespace DataSpec
|
||||
{
|
||||
|
||||
std::unique_ptr<ISTRG> LoadSTRG(Athena::io::IStreamReader& reader)
|
||||
std::unique_ptr<ISTRG> LoadSTRG(athena::io::IStreamReader& reader)
|
||||
{
|
||||
uint32_t magic = reader.readUint32Big();
|
||||
if (magic != 0x87654321)
|
||||
{
|
||||
LogDNACommon.report(LogVisor::Error, "invalid STRG magic");
|
||||
LogDNACommon.report(logvisor::Error, "invalid STRG magic");
|
||||
return std::unique_ptr<ISTRG>();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <HECL/HECL.hpp>
|
||||
#include <HECL/Database.hpp>
|
||||
#include <Athena/FileWriter.hpp>
|
||||
#include <hecl/hecl.hpp>
|
||||
#include <hecl/Database.hpp>
|
||||
#include <athena/FileWriter.hpp>
|
||||
#include "DNACommon.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
@@ -17,10 +17,10 @@ struct ISTRG : BigYAML
|
||||
virtual size_t count() const=0;
|
||||
virtual std::string getUTF8(const FourCC& lang, size_t idx) const=0;
|
||||
virtual std::wstring getUTF16(const FourCC& lang, size_t idx) const=0;
|
||||
virtual HECL::SystemString getSystemString(const FourCC& lang, size_t idx) const=0;
|
||||
virtual hecl::SystemString getSystemString(const FourCC& lang, size_t idx) const=0;
|
||||
virtual int32_t lookupIdx(const std::string& name) const=0;
|
||||
};
|
||||
std::unique_ptr<ISTRG> LoadSTRG(Athena::io::IStreamReader& reader);
|
||||
std::unique_ptr<ISTRG> LoadSTRG(athena::io::IStreamReader& reader);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace DataSpec
|
||||
{
|
||||
|
||||
static LogVisor::LogModule Log("libpng");
|
||||
static logvisor::Module Log("libpng");
|
||||
|
||||
/* GX uses this upsampling technique to prevent banding on downsampled texture formats */
|
||||
static inline uint8_t Convert3To8(uint8_t v)
|
||||
@@ -80,10 +80,10 @@ static inline void LookupRGBA8(const uint8_t* texels, int width, int x, int y,
|
||||
int bidx = (by * bwidth + bx) * 2;
|
||||
const uint16_t* artexels = (uint16_t*)&texels[32*bidx];
|
||||
const uint16_t* gbtexels = (uint16_t*)&texels[32*(bidx+1)];
|
||||
uint16_t ar = HECL::SBig(artexels[ry*4+rx]);
|
||||
uint16_t ar = hecl::SBig(artexels[ry*4+rx]);
|
||||
*a = ar >> 8 & 0xff;
|
||||
*r = ar & 0xff;
|
||||
uint16_t gb = HECL::SBig(gbtexels[ry*4+rx]);
|
||||
uint16_t gb = hecl::SBig(gbtexels[ry*4+rx]);
|
||||
*g = gb >> 8 & 0xff;
|
||||
*b = gb & 0xff;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ static void DecodeIA8(png_structrp png, png_infop info,
|
||||
static const uint8_t* DecodePalette(png_structrp png, png_infop info,
|
||||
int numEntries, const uint8_t* data)
|
||||
{
|
||||
uint32_t format = HECL::SBig(*(uint32_t*)data);
|
||||
uint32_t format = hecl::SBig(*(uint32_t*)data);
|
||||
data += 8;
|
||||
png_color cEntries[256];
|
||||
png_byte aEntries[256];
|
||||
@@ -184,7 +184,7 @@ static const uint8_t* DecodePalette(png_structrp png, png_infop info,
|
||||
const uint16_t* data16 = (uint16_t*)data;
|
||||
for (int e=0 ; e<numEntries ; ++e)
|
||||
{
|
||||
uint16_t texel = HECL::SBig(data16[e]);
|
||||
uint16_t texel = hecl::SBig(data16[e]);
|
||||
cEntries[e].red = Convert5To8(texel >> 11 & 0x1f);
|
||||
cEntries[e].green = Convert6To8(texel >> 5 & 0x3f);
|
||||
cEntries[e].blue = Convert5To8(texel & 0x1f);
|
||||
@@ -197,7 +197,7 @@ static const uint8_t* DecodePalette(png_structrp png, png_infop info,
|
||||
const uint16_t* data16 = (uint16_t*)data;
|
||||
for (int e=0 ; e<numEntries ; ++e)
|
||||
{
|
||||
uint16_t texel = HECL::SBig(data16[e]);
|
||||
uint16_t texel = hecl::SBig(data16[e]);
|
||||
if (texel & 0x8000)
|
||||
{
|
||||
cEntries[e].red = Convert5To8(texel >> 10 & 0x1f);
|
||||
@@ -226,7 +226,7 @@ static const uint8_t* DecodePalette(png_structrp png, png_infop info,
|
||||
static const uint8_t* DecodePaletteSPLT(png_structrp png, png_infop info,
|
||||
int numEntries, const uint8_t* data)
|
||||
{
|
||||
uint32_t format = HECL::SBig(*(uint32_t*)data);
|
||||
uint32_t format = hecl::SBig(*(uint32_t*)data);
|
||||
data += 8;
|
||||
png_sPLT_entry entries[256] = {};
|
||||
png_sPLT_t GXEntry =
|
||||
@@ -258,7 +258,7 @@ static const uint8_t* DecodePaletteSPLT(png_structrp png, png_infop info,
|
||||
const uint16_t* data16 = (uint16_t*)data;
|
||||
for (int e=0 ; e<numEntries ; ++e)
|
||||
{
|
||||
uint16_t texel = HECL::SBig(data16[e]);
|
||||
uint16_t texel = hecl::SBig(data16[e]);
|
||||
entries[e].red = Convert5To8(texel >> 11 & 0x1f);
|
||||
entries[e].green = Convert6To8(texel >> 5 & 0x3f);
|
||||
entries[e].blue = Convert5To8(texel & 0x1f);
|
||||
@@ -273,7 +273,7 @@ static const uint8_t* DecodePaletteSPLT(png_structrp png, png_infop info,
|
||||
const uint16_t* data16 = (uint16_t*)data;
|
||||
for (int e=0 ; e<numEntries ; ++e)
|
||||
{
|
||||
uint16_t texel = HECL::SBig(data16[e]);
|
||||
uint16_t texel = hecl::SBig(data16[e]);
|
||||
if (texel & 0x8000)
|
||||
{
|
||||
entries[e].red = Convert5To8(texel >> 10 & 0x1f);
|
||||
@@ -369,7 +369,7 @@ static void DecodeRGB565(png_structrp png, png_infop info,
|
||||
{
|
||||
for (int x=0 ; x<width ; ++x)
|
||||
{
|
||||
uint16_t texel = HECL::SBig(Lookup16BPP(texels, width, x, y));
|
||||
uint16_t texel = hecl::SBig(Lookup16BPP(texels, width, x, y));
|
||||
buf[x*3] = Convert5To8(texel >> 11 & 0x1f);
|
||||
buf[x*3+1] = Convert6To8(texel >> 5 & 0x3f);
|
||||
buf[x*3+2] = Convert5To8(texel & 0x1f);
|
||||
@@ -390,7 +390,7 @@ static void DecodeRGB5A3(png_structrp png, png_infop info,
|
||||
{
|
||||
for (int x=0 ; x<width ; ++x)
|
||||
{
|
||||
uint16_t texel = HECL::SBig(Lookup16BPP(texels, width, x, y));
|
||||
uint16_t texel = hecl::SBig(Lookup16BPP(texels, width, x, y));
|
||||
if (texel & 0x8000)
|
||||
{
|
||||
buf[x*4] = Convert5To8(texel >> 10 & 0x1f);
|
||||
@@ -473,25 +473,25 @@ static void DecodeCMPR(png_structrp png, png_infop info,
|
||||
|
||||
static void PNGErr(png_structp png, png_const_charp msg)
|
||||
{
|
||||
Log.report(LogVisor::Error, msg);
|
||||
Log.report(logvisor::Error, msg);
|
||||
}
|
||||
|
||||
static void PNGWarn(png_structp png, png_const_charp msg)
|
||||
{
|
||||
Log.report(LogVisor::Warning, msg);
|
||||
Log.report(logvisor::Warning, msg);
|
||||
}
|
||||
|
||||
bool TXTR::Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
|
||||
bool TXTR::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
uint32_t format = rs.readUint32Big();
|
||||
uint16_t width = rs.readUint16Big();
|
||||
uint16_t height = rs.readUint16Big();
|
||||
uint32_t numMips = rs.readUint32Big();
|
||||
|
||||
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
|
||||
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
|
||||
if (!fp)
|
||||
{
|
||||
Log.report(LogVisor::Error,
|
||||
Log.report(logvisor::Error,
|
||||
_S("Unable to open '%s' for writing"),
|
||||
outPath.getAbsolutePath().c_str());
|
||||
return false;
|
||||
@@ -542,7 +542,7 @@ bool TXTR::Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TXTR::Cook(const HECL::ProjectPath& inPath, const HECL::ProjectPath& outPath)
|
||||
bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ class PAKEntryReadStream;
|
||||
|
||||
struct TXTR
|
||||
{
|
||||
static bool Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath);
|
||||
static bool Cook(const HECL::ProjectPath& inPath, const HECL::ProjectPath& outPath);
|
||||
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
|
||||
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user