Merge branch 'master' into urde-tags

This commit is contained in:
Jack Andersen 2016-03-04 14:03:41 -10:00
commit 9ade279902
337 changed files with 2998 additions and 3016 deletions

12
.gitmodules vendored
View File

@ -1,9 +1,9 @@
[submodule "NODLib"]
path = NODLib
url = https://github.com/AxioDL/NODLib.git
[submodule "hecl"]
path = hecl
url = https://github.com/AxioDL/hecl.git
[submodule "libSpecter"]
path = libSpecter
url = https://github.com/AxioDL/libSpecter.git
[submodule "specter"]
path = specter
url = https://github.com/AxioDL/specter.git
[submodule "nod"]
path = nod
url = https://github.com/AxioDL/nod.git

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0054 NEW)
project(PathShagged)
project(urde)
if(MSVC)
# Shaddup MSVC
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D__SSE__=1 -D_CRT_SECURE_NO_WARNINGS=1 -DD_SCL_SECURE_NO_WARNINGS=1 /wd4267 /wd4244 /wd4305 /MP)
@ -53,7 +53,7 @@ if(USE_LD_GOLD AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_
endif()
endif()
set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hecl/extern/libBoo/include)
set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hecl/extern/boo/include)
set(HECL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hecl/include
${CMAKE_CURRENT_SOURCE_DIR}/hecl/blender)
@ -67,25 +67,25 @@ set(HECL_DATASPEC_DECLS
"/* RetroCommon specs */
namespace DataSpec
{
extern HECL::Database::DataSpecEntry SpecEntMP1;
extern HECL::Database::DataSpecEntry SpecEntMP2;
extern HECL::Database::DataSpecEntry SpecEntMP3;
extern hecl::Database::DataSpecEntry SpecEntMP1;
extern hecl::Database::DataSpecEntry SpecEntMP2;
extern hecl::Database::DataSpecEntry SpecEntMP3;
}")
set(HECL_DATASPEC_PUSHES
" /* RetroCommon */
HECL::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP1);
HECL::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP2);
HECL::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3);")
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP1);
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP2);
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3);")
add_subdirectory(hecl)
add_definitions(${BOO_SYS_DEFINES})
add_subdirectory(libSpecter)
set(SPECTER_INCLUDE_DIR libSpecter/include libSpecter/freetype2/include)
add_subdirectory(NODLib)
set(NODLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/NODLib/include)
add_subdirectory(specter)
set(SPECTER_INCLUDE_DIR specter/include specter/freetype2/include)
add_subdirectory(nod)
set(NOD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/nod/include)
add_definitions(-DZE_ATHENA_TYPES=1)
set(MATHLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libSpecter/MathLib/include)
include_directories(${ATHENA_INCLUDE_DIR} ${LOG_VISOR_INCLUDE_DIR} ${HECL_INCLUDE_DIR}
${NODLIB_INCLUDE_DIR} ${MATHLIB_INCLUDE_DIR} ${BOO_INCLUDE_DIR}
set(ZEUS_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/specter/zeus/include)
include_directories(${ATHENA_INCLUDE_DIR} ${LOGVISOR_INCLUDE_DIR} ${HECL_INCLUDE_DIR}
${NOD_INCLUDE_DIR} ${ZEUS_INCLUDE_DIR} ${BOO_INCLUDE_DIR}
${SPECTER_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(DataSpec)
add_subdirectory(Editor)

View File

@ -10,13 +10,13 @@ namespace DataSpec
namespace Blender
{
bool BuildMasterShader(const HECL::ProjectPath& path)
bool BuildMasterShader(const hecl::ProjectPath& path)
{
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
if (!conn.createBlend(path, HECL::BlenderConnection::BlendType::None))
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
if (!conn.createBlend(path, hecl::BlenderConnection::BlendType::None))
return false;
{
HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
os << RETRO_MASTER_SHADER;
os << "make_master_shader_library()\n";
}

View File

@ -1,14 +1,14 @@
#ifndef _RETRO_BLENDER_SUPPORT_HPP_
#define _RETRO_BLENDER_SUPPORT_HPP_
#include <HECL/HECL.hpp>
#include <hecl/hecl.hpp>
namespace DataSpec
{
namespace Blender
{
bool BuildMasterShader(const HECL::ProjectPath& path);
bool BuildMasterShader(const hecl::ProjectPath& path);
}
}

View File

@ -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,18 +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;
std::string bestName = pakRouter.getBestEntryName(*cmdlE);
HECL::SystemStringView bestNameView(bestName);
hecl::SystemStringView bestNameView(bestName);
fileChanged(bestNameView.sys_str().c_str());
typename ANCSDNA::CSKRType cskr;
@ -78,13 +78,13 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
}
std::string bestName = pakRouter.getBestEntryName(entry);
HECL::SystemStringView bestNameView(bestName);
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"
@ -127,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);
@ -149,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);

View File

@ -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)
{

View File

@ -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;

View File

@ -66,7 +66,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,
@ -77,16 +77,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"
@ -109,7 +109,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,
@ -124,7 +124,7 @@ void ReadMaterialSetToBlender_3(HECL::BlenderConnection::PyOutStream& os,
}
template void ReadMaterialSetToBlender_3<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::MaterialSet>
(HECL::BlenderConnection::PyOutStream& os,
(hecl::BlenderConnection::PyOutStream& os,
const DNAMP3::MaterialSet& matSet,
const PAKRouter<DNAMP3::PAKBridge>& pakRouter,
const typename PAKRouter<DNAMP3::PAKBridge>::EntryType& entry,
@ -158,7 +158,7 @@ public:
}
template<class RigPair>
void sendAdditionalVertsToBlender(HECL::BlenderConnection::PyOutStream& os,
void sendAdditionalVertsToBlender(hecl::BlenderConnection::PyOutStream& os,
const RigPair& rp) const
{
atUint32 nextVert = 1;
@ -219,7 +219,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;
@ -253,7 +253,7 @@ public:
atUint16 readVertCount()
{
atUint16 retval = HECL::SBig(*(atUint16*)m_cur);
atUint16 retval = hecl::SBig(*(atUint16*)m_cur);
m_cur += 2;
return retval;
}
@ -417,8 +417,8 @@ public:
}
};
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"
@ -499,7 +499,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)
@ -570,8 +570,8 @@ void FinishBlenderMesh(HECL::BlenderConnection::PyOutStream& os,
}
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,
@ -694,10 +694,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;
@ -1040,7 +1040,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 */
@ -1053,8 +1053,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,
@ -1065,18 +1065,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"
@ -1101,8 +1101,8 @@ bool ReadCMDLToBlender(HECL::BlenderConnection& conn,
template bool ReadCMDLToBlender<PAKRouter<DNAMP1::PAKBridge>, DNAMP1::MaterialSet,
std::pair<DNAMP1::CSKR*,DNAMP1::CINF*>, DNACMDL::SurfaceHeader_1, 2>
(HECL::BlenderConnection& conn,
Athena::io::IStreamReader& reader,
(hecl::BlenderConnection& conn,
athena::io::IStreamReader& reader,
PAKRouter<DNAMP1::PAKBridge>& pakRouter,
const typename PAKRouter<DNAMP1::PAKBridge>::EntryType& entry,
const SpecBase& dataspec,
@ -1110,8 +1110,8 @@ template bool ReadCMDLToBlender<PAKRouter<DNAMP1::PAKBridge>, DNAMP1::MaterialSe
template bool ReadCMDLToBlender<PAKRouter<DNAMP2::PAKBridge>, DNAMP2::MaterialSet,
std::pair<DNAMP2::CSKR*,DNAMP2::CINF*>, DNACMDL::SurfaceHeader_2, 4>
(HECL::BlenderConnection& conn,
Athena::io::IStreamReader& reader,
(hecl::BlenderConnection& conn,
athena::io::IStreamReader& reader,
PAKRouter<DNAMP2::PAKBridge>& pakRouter,
const typename PAKRouter<DNAMP2::PAKBridge>::EntryType& entry,
const SpecBase& dataspec,
@ -1119,8 +1119,8 @@ template bool ReadCMDLToBlender<PAKRouter<DNAMP2::PAKBridge>, DNAMP2::MaterialSe
template bool ReadCMDLToBlender<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::MaterialSet,
std::pair<DNAMP3::CSKR*,DNAMP3::CINF*>, DNACMDL::SurfaceHeader_3, 4>
(HECL::BlenderConnection& conn,
Athena::io::IStreamReader& reader,
(hecl::BlenderConnection& conn,
athena::io::IStreamReader& reader,
PAKRouter<DNAMP3::PAKBridge>& pakRouter,
const typename PAKRouter<DNAMP3::PAKBridge>::EntryType& entry,
const SpecBase& dataspec,
@ -1128,22 +1128,22 @@ template bool ReadCMDLToBlender<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::MaterialSe
template bool ReadCMDLToBlender<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::MaterialSet,
std::pair<DNAMP3::CSKR*,DNAMP3::CINF*>, DNACMDL::SurfaceHeader_3, 5>
(HECL::BlenderConnection& conn,
Athena::io::IStreamReader& reader,
(hecl::BlenderConnection& conn,
athena::io::IStreamReader& reader,
PAKRouter<DNAMP3::PAKBridge>& pakRouter,
const typename PAKRouter<DNAMP3::PAKBridge>::EntryType& entry,
const SpecBase& dataspec,
const std::pair<DNAMP3::CSKR*,DNAMP3::CINF*>& rp);
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;
@ -1161,17 +1161,17 @@ 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);
}
}
template void NameCMDL<PAKRouter<DNAMP1::PAKBridge>, DNAMP1::MaterialSet>
(Athena::io::IStreamReader& reader,
(athena::io::IStreamReader& reader,
PAKRouter<DNAMP1::PAKBridge>& pakRouter,
typename PAKRouter<DNAMP1::PAKBridge>::EntryType& entry,
const SpecBase& dataspec);
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)
{
@ -1187,7 +1187,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;
@ -1206,23 +1206,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;
@ -1230,7 +1230,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;
@ -1249,16 +1249,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);
@ -1316,7 +1316,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)
@ -1328,7 +1328,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();
@ -1376,12 +1376,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 =
@ -1431,10 +1431,10 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
}
template bool WriteCMDL<DNAMP1::MaterialSet, DNACMDL::SurfaceHeader_1, 2>
(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath, const Mesh& mesh);
(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const Mesh& mesh);
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;
@ -1453,19 +1453,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)
{
@ -1481,22 +1481,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);
@ -1506,7 +1506,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);
@ -1544,7 +1544,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);
@ -1553,7 +1553,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();
@ -1588,7 +1588,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;
@ -1605,7 +1605,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;

View File

@ -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;
@ -116,27 +116,27 @@ void GetVertexAttributes(const MaterialSet& matSet,
std::vector<VertexAttributes>& attributesOut);
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,
unsigned setIdx);
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,
unsigned setIdx);
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,
@ -150,24 +150,24 @@ atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os,
atUint32 surfaceCount=0);
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,
const RigPair& rp);
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);
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);
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);
}
}

View File

@ -4,7 +4,7 @@
namespace DataSpec
{
LogVisor::LogModule LogDNACommon("Retro::DNACommon");
logvisor::Module LogDNACommon("urde::DNACommon");
SpecBase* g_curSpec = nullptr;
PAKRouterBase* g_PakRouter = nullptr;

View File

@ -2,49 +2,49 @@
#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;
extern class PAKRouterBase* g_PakRouter;
/* 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;
class UniqueID32;
class UniqueID64;
class UniqueID128;
@ -56,24 +56,24 @@ protected:
const SpecBase& m_dataSpec;
public:
PAKRouterBase(const SpecBase& dataSpec) : m_dataSpec(dataSpec) {}
HECL::Database::Project& getProject() const {return m_dataSpec.getProject();}
virtual HECL::ProjectPath getWorking(const UniqueID32&) const
hecl::Database::Project& getProject() const {return m_dataSpec.getProject();}
virtual hecl::ProjectPath getWorking(const UniqueID32&) const
{
LogDNACommon.report(LogVisor::FatalError,
LogDNACommon.report(logvisor::Fatal,
"PAKRouter IDType mismatch; expected UniqueID32 specialization");
return HECL::ProjectPath();
return hecl::ProjectPath();
}
virtual HECL::ProjectPath getWorking(const UniqueID64&) const
virtual hecl::ProjectPath getWorking(const UniqueID64&) const
{
LogDNACommon.report(LogVisor::FatalError,
LogDNACommon.report(logvisor::Fatal,
"PAKRouter IDType mismatch; expected UniqueID64 specialization");
return HECL::ProjectPath();
return hecl::ProjectPath();
}
virtual HECL::ProjectPath getWorking(const UniqueID128&) const
virtual hecl::ProjectPath getWorking(const UniqueID128&) const
{
LogDNACommon.report(LogVisor::FatalError,
LogDNACommon.report(logvisor::Fatal,
"PAKRouter IDType mismatch; expected UniqueID128 specialization");
return HECL::ProjectPath();
return hecl::ProjectPath();
}
};
@ -85,16 +85,16 @@ class UniqueIDBridge
friend class UniqueID64;
public:
template <class IDType>
static HECL::ProjectPath TranslatePakIdToPath(const IDType& id)
static hecl::ProjectPath TranslatePakIdToPath(const IDType& id)
{
if (!g_PakRouter)
LogDNACommon.report(LogVisor::FatalError,
LogDNACommon.report(logvisor::Fatal,
"UniqueIDBridge::setPakRouter must be called before translatePakIdToPath");
return g_PakRouter->getWorking(id);
}
static HECL::ProjectPath MakePathFromString(const std::string& str)
static hecl::ProjectPath MakePathFromString(const std::string& str)
{
return HECL::ProjectPath(g_PakRouter->getProject(), str);
return hecl::ProjectPath(g_PakRouter->getProject(), str);
}
template <class IDType>
static void TransformOldHashToNewHash(IDType& id)
@ -110,19 +110,19 @@ 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)
{
*this = UniqueIDBridge::MakePathFromString(reader.readString(nullptr));
}
void write(Athena::io::YAMLDocWriter& writer) const
void write(athena::io::YAMLDocWriter& writer) const
{
if (!operator bool())
return;
HECL::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
if (!path)
return;
writer.writeString(nullptr, path.getRelativePathUTF8());
@ -130,7 +130,7 @@ public:
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;}
@ -146,8 +146,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];
@ -173,19 +173,19 @@ 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)
{
*this = UniqueIDBridge::MakePathFromString(reader.readString(nullptr));
}
void write(Athena::io::YAMLDocWriter& writer) const
void write(athena::io::YAMLDocWriter& writer) const
{
if (!operator bool())
return;
HECL::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
if (!path)
return;
writer.writeString(nullptr, path.getRelativePathUTF8());
@ -193,7 +193,7 @@ public:
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;}
@ -208,8 +208,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];
@ -251,25 +251,25 @@ 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)
{
*this = UniqueIDBridge::MakePathFromString(reader.readString(nullptr));
}
void write(Athena::io::YAMLDocWriter& writer) const
void write(athena::io::YAMLDocWriter& writer) const
{
if (!operator bool())
return;
HECL::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
if (!path)
return;
writer.writeString(nullptr, path.getRelativePathUTF8());
@ -277,7 +277,7 @@ public:
size_t binarySize(size_t __isz) const
{return __isz + 16;}
UniqueID128& operator=(const HECL::ProjectPath& path)
UniqueID128& operator=(const hecl::ProjectPath& path)
{
m_id[0] = path.hash().val64();
m_id[1] = 0;
@ -323,7 +323,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;
@ -332,7 +332,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);
@ -384,7 +384,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;
}

View File

@ -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";

View File

@ -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_

View File

@ -8,13 +8,13 @@ namespace DataSpec
namespace DNAMAPA
{
void MAPA::read(Athena::io::IStreamReader& __dna_reader)
void MAPA::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 */
@ -27,7 +27,7 @@ void MAPA::read(Athena::io::IStreamReader& __dna_reader)
header.reset(new HeaderMP3);
else
{
LogDNACommon.report(LogVisor::Error, "invalid MAPA version");
LogDNACommon.report(logvisor::Error, "invalid MAPA version");
return;
}
@ -52,7 +52,7 @@ void MAPA::read(Athena::io::IStreamReader& __dna_reader)
__dna_reader.enumerate(surfaces, header->surfaceCount());
}
void MAPA::write(Athena::io::IStreamWriter& __dna_writer) const
void MAPA::write(athena::io::IStreamWriter& __dna_writer) const
{
/* magic */
__dna_writer.writeUint32Big(magic);
@ -85,21 +85,21 @@ size_t MAPA::binarySize(size_t __isz) const
}
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"
@ -283,8 +283,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();
@ -294,25 +294,25 @@ bool ReadMAPAToBlender(HECL::BlenderConnection& conn,
}
template bool ReadMAPAToBlender<PAKRouter<DNAMP1::PAKBridge>>
(HECL::BlenderConnection& conn,
(hecl::BlenderConnection& conn,
const MAPA& mapa,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP1::PAKBridge>& pakRouter,
const typename PAKRouter<DNAMP1::PAKBridge>::EntryType& entry,
bool force);
template bool ReadMAPAToBlender<PAKRouter<DNAMP2::PAKBridge>>
(HECL::BlenderConnection& conn,
(hecl::BlenderConnection& conn,
const MAPA& mapa,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP2::PAKBridge>& pakRouter,
const typename PAKRouter<DNAMP2::PAKBridge>::EntryType& entry,
bool force);
template bool ReadMAPAToBlender<PAKRouter<DNAMP3::PAKBridge>>
(HECL::BlenderConnection& conn,
(hecl::BlenderConnection& conn,
const MAPA& mapa,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP3::PAKBridge>& pakRouter,
const typename PAKRouter<DNAMP3::PAKBridge>::EntryType& entry,
bool force);

View File

@ -74,8 +74,8 @@ struct MAPA : BigDNA
};
void read(Athena::io::IStreamReader& __dna_reader);
void write(Athena::io::IStreamWriter& __dna_writer) const;
void read(athena::io::IStreamReader& __dna_reader);
void write(athena::io::IStreamWriter& __dna_writer) const;
size_t binarySize(size_t __isz) const;
std::unique_ptr<IMAPAHeader> header;
@ -117,9 +117,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() {}
};
@ -130,9 +130,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() {}
};
@ -180,9 +180,9 @@ 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);

View File

@ -9,23 +9,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;
/* 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"
@ -42,7 +42,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"
@ -66,14 +66,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]);
@ -102,31 +102,31 @@ bool ReadMLVLToBlender(HECL::BlenderConnection& conn,
}
template bool ReadMLVLToBlender<PAKRouter<DNAMP1::PAKBridge>, DNAMP1::MLVL>
(HECL::BlenderConnection& conn,
(hecl::BlenderConnection& conn,
const DNAMP1::MLVL& mlvl,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP1::PAKBridge>& pakRouter,
const typename PAKRouter<DNAMP1::PAKBridge>::EntryType& entry,
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged);
std::function<void(const hecl::SystemChar*)> fileChanged);
template bool ReadMLVLToBlender<PAKRouter<DNAMP2::PAKBridge>, DNAMP2::MLVL>
(HECL::BlenderConnection& conn,
(hecl::BlenderConnection& conn,
const DNAMP2::MLVL& mlvl,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP2::PAKBridge>& pakRouter,
const typename PAKRouter<DNAMP2::PAKBridge>::EntryType& entry,
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged);
std::function<void(const hecl::SystemChar*)> fileChanged);
template bool ReadMLVLToBlender<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::MLVL>
(HECL::BlenderConnection& conn,
(hecl::BlenderConnection& conn,
const DNAMP3::MLVL& mlvl,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP3::PAKBridge>& pakRouter,
const typename PAKRouter<DNAMP3::PAKBridge>::EntryType& entry,
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged);
std::function<void(const hecl::SystemChar*)> fileChanged);
}
}

View File

@ -3,7 +3,7 @@
#include "DNACommon.hpp"
#include "BlenderConnection.hpp"
#include "CVector3f.hpp"
#include "zeus/CVector3f.hpp"
namespace DataSpec
{
@ -11,13 +11,13 @@ 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);
}
}

View File

@ -11,7 +11,7 @@ void UniqueResult::checkEntry(const PAKBRIDGE& pakBridge, const typename PAKBRID
{
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;
@ -109,12 +109,12 @@ template void UniqueResult::checkEntry(const DNAMP2::PAKBridge& pakBridge,
template void UniqueResult::checkEntry(const DNAMP3::PAKBridge& pakBridge,
const DNAMP3::PAKBridge::PAKType::Entry& entry);
HECL::ProjectPath UniqueResult::uniquePath(const HECL::ProjectPath& pakPath) const
hecl::ProjectPath UniqueResult::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
@ -123,15 +123,15 @@ HECL::ProjectPath UniqueResult::uniquePath(const HECL::ProjectPath& pakPath) con
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;
}
@ -156,13 +156,13 @@ void PAKRouter<BRIDGETYPE>::build(std::vector<BRIDGETYPE>& bridges, std::functio
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();
@ -199,7 +199,7 @@ void PAKRouter<BRIDGETYPE>::build(std::vector<BRIDGETYPE>& bridges, std::functio
/* Add named resources to catalog YAML files */
for (BRIDGETYPE& bridge : bridges)
{
Athena::io::YAMLDocWriter catalogWriter(nullptr);
athena::io::YAMLDocWriter catalogWriter(nullptr);
enterPAKBridge(bridge);
const typename BRIDGETYPE::PAKType& pak = bridge.getPAK();
@ -211,9 +211,9 @@ void PAKRouter<BRIDGETYPE>::build(std::vector<BRIDGETYPE>& bridges, std::functio
}
/* Write catalog */
const HECL::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].first;
HECL::SystemString catalogPath = HECL::ProjectPath(pakPath, "catalog.yaml").getAbsolutePath();
FILE* catalog = HECL::Fopen(catalogPath.c_str(), _S("w"));
const hecl::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].first;
hecl::SystemString catalogPath = hecl::ProjectPath(pakPath, "catalog.yaml").getAbsolutePath();
FILE* catalog = hecl::Fopen(catalogPath.c_str(), _S("w"));
yaml_emitter_set_output_file(catalogWriter.getEmitter(), catalog);
catalogWriter.finish();
fclose(catalog);
@ -240,143 +240,143 @@ void PAKRouter<BRIDGETYPE>::enterPAKBridge(const BRIDGETYPE& pakBridge)
++pit;
++bridgeIdx;
}
LogDNACommon.report(LogVisor::FatalError,
LogDNACommon.report(logvisor::Fatal,
"PAKBridge provided to PAKRouter::enterPAKBridge() was not part of build()");
}
template <class BRIDGETYPE>
HECL::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
const ResExtractor<BRIDGETYPE>& extractor) const
{
if (!entry)
return HECL::ProjectPath();
return hecl::ProjectPath();
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(getBestEntryName(*entry));
hecl::SystemString entName = hecl::UTF8ToWide(getBestEntryName(*entry));
#else
HECL::SystemString entName = getBestEntryName(*entry);
hecl::SystemString entName = getBestEntryName(*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(getBestEntryName(*entry));
hecl::SystemString entName = hecl::UTF8ToWide(getBestEntryName(*entry));
#else
HECL::SystemString entName = getBestEntryName(*entry);
hecl::SystemString entName = getBestEntryName(*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())
{
#if HECL_UCS2
HECL::SystemString entBase = HECL::UTF8ToWide(getBestEntryName(*entry));
hecl::SystemString entBase = hecl::UTF8ToWide(getBestEntryName(*entry));
#else
HECL::SystemString entBase = getBestEntryName(*entry);
hecl::SystemString entBase = getBestEntryName(*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 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();
}
template <class BRIDGETYPE>
HECL::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry) const
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry) const
{
if (!entry)
return HECL::ProjectPath();
return hecl::ProjectPath();
return getWorking(entry, BRIDGETYPE::LookupExtractor(*entry));
}
template <class BRIDGETYPE>
HECL::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const IDType& id) const
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const IDType& id) const
{
return getWorking(lookupEntry(id));
}
template <class BRIDGETYPE>
HECL::ProjectPath PAKRouter<BRIDGETYPE>::getCooked(const EntryType* entry) const
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCooked(const EntryType* entry) const
{
if (!entry)
return HECL::ProjectPath();
return hecl::ProjectPath();
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, getBestEntryName(*entry));
return hecl::ProjectPath(pakPath, getBestEntryName(*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, getBestEntryName(*entry));
hecl::ProjectPath uniquePath = entry->unique.uniquePath(pakPath);
return hecl::ProjectPath(uniquePath, getBestEntryName(*entry));
}
auto sharedSearch = m_sharedEntries.find(entry->id);
if (sharedSearch != m_sharedEntries.end())
{
m_sharedCooked.makeDir();
return HECL::ProjectPath(m_sharedCooked, getBestEntryName(*entry));
return hecl::ProjectPath(m_sharedCooked, getBestEntryName(*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();
}
template <class BRIDGETYPE>
HECL::ProjectPath PAKRouter<BRIDGETYPE>::getCooked(const IDType& id) const
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCooked(const IDType& id) const
{
return getCooked(lookupEntry(id));
}
template <class BRIDGETYPE>
HECL::SystemString PAKRouter<BRIDGETYPE>::getResourceRelativePath(const EntryType& a, const IDType& b) const
hecl::SystemString PAKRouter<BRIDGETYPE>::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;
}
@ -416,7 +416,7 @@ std::string PAKRouter<BRIDGETYPE>::getBestEntryName(const IDType& entry) const
template <class BRIDGETYPE>
bool PAKRouter<BRIDGETYPE>::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;
@ -431,24 +431,24 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
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);
/* Extract first, so they start out invalid */
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);
@ -456,11 +456,11 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
}
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);
});
@ -474,7 +474,7 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
template <class BRIDGETYPE>
const typename BRIDGETYPE::PAKType::Entry* PAKRouter<BRIDGETYPE>::lookupEntry(const IDType& entry,
const NOD::Node** nodeOut,
const nod::Node** nodeOut,
bool silenceWarnings,
bool currentPAK) const
{
@ -482,7 +482,7 @@ const typename BRIDGETYPE::PAKType::Entry* PAKRouter<BRIDGETYPE>::lookupEntry(co
return nullptr;
if (!m_bridges)
LogDNACommon.report(LogVisor::FatalError,
LogDNACommon.report(logvisor::Fatal,
"PAKRouter::build() must be called before PAKRouter::lookupEntry()");
if (m_pak)
@ -500,7 +500,7 @@ const typename BRIDGETYPE::PAKType::Entry* PAKRouter<BRIDGETYPE>::lookupEntry(co
{
#ifndef NDEBUG
if (!silenceWarnings)
LogDNACommon.report(LogVisor::Warning,
LogDNACommon.report(logvisor::Warning,
"unable to find PAK entry %s in current PAK", entry.toString().c_str());
#endif
return nullptr;
@ -520,7 +520,7 @@ const typename BRIDGETYPE::PAKType::Entry* PAKRouter<BRIDGETYPE>::lookupEntry(co
#ifndef NDEBUG
if (!silenceWarnings)
LogDNACommon.report(LogVisor::Warning,
LogDNACommon.report(logvisor::Warning,
"unable to find PAK entry %s", entry.toString().c_str());
#endif
if (nodeOut)
@ -538,10 +538,10 @@ const typename PAKRouter<BRIDGETYPE>::RigPair* PAKRouter<BRIDGETYPE>::lookupCMDL
}
template <class BRIDGETYPE>
HECL::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerWorking(const IDType& areaId, int layerIdx) const
hecl::ProjectPath PAKRouter<BRIDGETYPE>::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)
@ -550,22 +550,22 @@ HECL::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerWorking(const IDType& areaI
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();
}
template <class BRIDGETYPE>
HECL::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerCooked(const IDType& areaId, int layerIdx) const
hecl::ProjectPath PAKRouter<BRIDGETYPE>::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)
@ -574,15 +574,15 @@ HECL::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerCooked(const IDType& areaId
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();
}
template class PAKRouter<DNAMP1::PAKBridge>;

View File

@ -7,7 +7,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;
@ -23,18 +23,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;}
@ -60,16 +60,16 @@ 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) {}
template <class PAKBRIDGE>
void checkEntry(const PAKBRIDGE& pakBridge, const typename PAKBRIDGE::PAKType::Entry& entry);
HECL::ProjectPath uniquePath(const HECL::ProjectPath& pakPath) const;
hecl::ProjectPath uniquePath(const hecl::ProjectPath& pakPath) const;
};
template <class BRIDGETYPE>
@ -79,11 +79,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;
@ -93,13 +93,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;
};
@ -120,19 +120,19 @@ public:
using RigPair = std::pair<IDType, IDType>;
private:
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)
: PAKRouterBase(dataSpec),
m_gameWorking(working), m_gameCooked(cooked),
m_sharedWorking(working, "Shared"), m_sharedCooked(cooked, "Shared") {}
@ -141,30 +141,30 @@ public:
void enterPAKBridge(const BRIDGETYPE& pakBridge);
HECL::ProjectPath getWorking(const EntryType* entry,
hecl::ProjectPath getWorking(const EntryType* entry,
const ResExtractor<BRIDGETYPE>& extractor) const;
HECL::ProjectPath getWorking(const EntryType* entry) const;
HECL::ProjectPath getWorking(const IDType& id) const;
HECL::ProjectPath getCooked(const EntryType* entry) const;
HECL::ProjectPath getCooked(const IDType& id) const;
hecl::ProjectPath getWorking(const EntryType* entry) const;
hecl::ProjectPath getWorking(const IDType& id) const;
hecl::ProjectPath getCooked(const EntryType* entry) const;
hecl::ProjectPath getCooked(const IDType& id) const;
HECL::SystemString getResourceRelativePath(const EntryType& a, const IDType& b) const;
hecl::SystemString getResourceRelativePath(const EntryType& a, const IDType& b) const;
std::string getBestEntryName(const EntryType& entry) const;
std::string getBestEntryName(const IDType& entry) const;
bool extractResources(const BRIDGETYPE& pakBridge, bool force,
std::function<void(const HECL::SystemChar*, float)> progress);
std::function<void(const hecl::SystemChar*, float)> progress);
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;
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;
@ -175,8 +175,8 @@ public:
const RigPair* lookupCMDLRigPair(const IDType& id) const;
HECL::ProjectPath getAreaLayerWorking(const IDType& areaId, int layerIdx) const;
HECL::ProjectPath getAreaLayerCooked(const IDType& areaId, int layerIdx) const;
hecl::ProjectPath getAreaLayerWorking(const IDType& areaId, int layerIdx) const;
hecl::ProjectPath getAreaLayerCooked(const IDType& areaId, int layerIdx) const;
};
}

View File

@ -6,13 +6,13 @@ namespace DNAParticle
{
template <class IDType>
void GPSM<IDType>::read(Athena::io::YAMLDocReader& r)
void GPSM<IDType>::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;
}
@ -267,7 +267,7 @@ void GPSM<IDType>::read(Athena::io::YAMLDocReader& r)
}
template <class IDType>
void GPSM<IDType>::write(Athena::io::YAMLDocWriter& w) const
void GPSM<IDType>::write(athena::io::YAMLDocWriter& w) const
{
if (x0_PSIV)
{
@ -855,13 +855,13 @@ size_t GPSM<IDType>::binarySize(size_t __isz) const
}
template <class IDType>
void GPSM<IDType>::read(Athena::io::IStreamReader& r)
void GPSM<IDType>::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);
@ -1131,7 +1131,7 @@ void GPSM<IDType>::read(Athena::io::IStreamReader& r)
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);
@ -1139,7 +1139,7 @@ void GPSM<IDType>::read(Athena::io::IStreamReader& r)
}
template <class IDType>
void GPSM<IDType>::write(Athena::io::IStreamWriter& w) const
void GPSM<IDType>::write(athena::io::IStreamWriter& w) const
{
w.writeBytes((atInt8*)"GPSM", 4);
if (x0_PSIV)
@ -1535,9 +1535,9 @@ template struct GPSM<UniqueID32>;
template struct GPSM<UniqueID64>;
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;
@ -1548,13 +1548,13 @@ bool ExtractGPSM(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
}
return false;
}
template bool ExtractGPSM<UniqueID32>(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath);
template bool ExtractGPSM<UniqueID64>(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath);
template bool ExtractGPSM<UniqueID32>(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template bool ExtractGPSM<UniqueID64>(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);
@ -1564,8 +1564,8 @@ bool WriteGPSM(const GPSM<IDType>& gpsm, const HECL::ProjectPath& outPath)
w.writeBytes((atInt8*)"\xff", 1);
return true;
}
template bool WriteGPSM<UniqueID32>(const GPSM<UniqueID32>& gpsm, const HECL::ProjectPath& outPath);
template bool WriteGPSM<UniqueID64>(const GPSM<UniqueID64>& gpsm, const HECL::ProjectPath& outPath);
template bool WriteGPSM<UniqueID32>(const GPSM<UniqueID32>& gpsm, const hecl::ProjectPath& outPath);
template bool WriteGPSM<UniqueID64>(const GPSM<UniqueID64>& gpsm, const hecl::ProjectPath& outPath);
}
}

View File

@ -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,18 +107,18 @@ struct GPSM : BigYAML
x45_25_PMOO = true;
}
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;
};
template <class IDType>
bool ExtractGPSM(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath);
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);
}
}

View File

@ -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)
{

View File

@ -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,20 +1416,20 @@ struct SpawnSystemKeyframeData : BigYAML
r.leaveSubRecord();
}
spawns.clear();
size_t spawnsCount;
if (r.enterSubVector("spawns", spawnsCount))
size_t spawnCount;
if (r.enterSubVector("spawns", spawnCount))
{
spawns.reserve(spawnsCount);
spawns.reserve(spawnCount);
for (const auto& child : r.getCurNode()->m_seqChildren)
{
if (r.enterSubRecord(nullptr))
{
spawns.emplace_back();
spawns.back().first = r.readUint32("startFrame");
size_t systemsCount;
if (r.enterSubVector("systems", systemsCount))
size_t systemCount;
if (r.enterSubVector("systems", systemCount))
{
spawns.back().second.reserve(systemsCount);
spawns.back().second.reserve(systemCount);
for (const auto& in : r.getCurNode()->m_seqChildren)
{
spawns.back().second.emplace_back();
@ -1446,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;
@ -1482,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);
@ -1509,7 +1509,7 @@ struct SpawnSystemKeyframeData : BigYAML
}
}
}
void write(Athena::io::IStreamWriter& w) const
void write(athena::io::IStreamWriter& w) const
{
if (spawns.empty())
{
@ -1539,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"))
@ -1548,7 +1548,7 @@ struct ChildResourceFactory : BigYAML
r.leaveSubRecord();
}
}
void write(Athena::io::YAMLDocWriter& w) const
void write(athena::io::YAMLDocWriter& w) const
{
if (id)
{
@ -1564,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;
@ -1572,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)
{

View File

@ -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>();
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);
};
}

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP1_AFSM_HPP_
#define _DNAMP1_AFSM_HPP_
#include <Athena/FileWriter.hpp>
#include <athena/FileWriter.hpp>
#include "../DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
@ -32,7 +32,7 @@ struct AFSM : public BigYAML
String<-1> name;
Value<float> parameter;
Value<atUint32> targetState;
void read(Athena::io::IStreamReader& __dna_reader)
void read(athena::io::IStreamReader& __dna_reader)
{
/* name */
name = __dna_reader.readString(-1);
@ -45,7 +45,7 @@ struct AFSM : public BigYAML
}
}
void write(Athena::io::IStreamWriter& __dna_writer) const
void write(athena::io::IStreamWriter& __dna_writer) const
{
/* name */
__dna_writer.writeString(name, -1);
@ -58,7 +58,7 @@ struct AFSM : public BigYAML
}
}
void read(Athena::io::YAMLDocReader& __dna_docin)
void read(athena::io::YAMLDocReader& __dna_docin)
{
/* name */
name = __dna_docin.readString("name");
@ -71,7 +71,7 @@ struct AFSM : public BigYAML
}
}
void write(Athena::io::YAMLDocWriter& __dna_docout) const
void write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* name */
__dna_docout.writeString("name", name);
@ -86,7 +86,7 @@ struct AFSM : public BigYAML
static const char* DNAType()
{
return "Retro::DNAMP1::AFSM::Transition::Trigger";
return "urde::DNAMP1::AFSM::Transition::Trigger";
}
size_t binarySize(size_t __isz) const
@ -98,21 +98,21 @@ struct AFSM : public BigYAML
Vector<Trigger, DNA_COUNT(triggerCount)> triggers;
void read(Athena::io::IStreamReader& __dna_reader)
void read(athena::io::IStreamReader& __dna_reader)
{
/* triggerCount */
triggerCount = __dna_reader.readUint32Big();
int i = 0;
/* triggers */
__dna_reader.enumerate<Trigger>(triggers, triggerCount,
[&](Athena::io::IStreamReader& in, Trigger& tr){
[&](athena::io::IStreamReader& in, Trigger& tr){
tr.first = i == 0;
tr.read(in);
i++;
});
}
void write(Athena::io::IStreamWriter& __dna_writer) const
void write(athena::io::IStreamWriter& __dna_writer) const
{
/* triggerCount */
__dna_writer.writeInt32Big(triggerCount);
@ -120,19 +120,19 @@ struct AFSM : public BigYAML
__dna_writer.enumerate(triggers);
}
void read(Athena::io::YAMLDocReader& __dna_docin)
void read(athena::io::YAMLDocReader& __dna_docin)
{
int i = 0;
/* triggers */
triggerCount = __dna_docin.enumerate<Trigger>("triggers", triggers,
[&](Athena::io::YAMLDocReader& in, Trigger& tr){
[&](athena::io::YAMLDocReader& in, Trigger& tr){
tr.first = i == 0;
tr.read(in);
i++;
});
}
void write(Athena::io::YAMLDocWriter& __dna_docout) const
void write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* triggers */
__dna_docout.enumerate("triggers", triggers);
@ -140,7 +140,7 @@ struct AFSM : public BigYAML
static const char* DNAType()
{
return "Retro::DNAMP1::AFSM::Transition";
return "urde::DNAMP1::AFSM::Transition";
}
size_t binarySize(size_t __isz) const
@ -155,11 +155,11 @@ struct AFSM : public BigYAML
Vector<State, DNA_COUNT(stateCount)> states;
static bool Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
AFSM afsm;
afsm.read(rs);
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
afsm.toYAMLFile(fp);
fclose(fp);
return true;

View File

@ -5,7 +5,7 @@ namespace DataSpec
namespace DNAMP1
{
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::read(Athena::io::IStreamReader& reader)
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::read(athena::io::IStreamReader& reader)
{
parmType = reader.readUint32Big();
unk1 = reader.readUint32Big();
@ -32,7 +32,7 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::read(A
}
}
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::write(Athena::io::IStreamWriter& writer) const
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(parmType);
writer.writeUint32Big(unk1);
@ -77,13 +77,13 @@ size_t ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::bina
return __isz;
}
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::read(Athena::io::YAMLDocReader& reader)
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::read(athena::io::YAMLDocReader& reader)
{
parmType = reader.readUint32("parmType");
unk1 = reader.readUint32("unk1");
unk2 = reader.readFloat("unk2");
size_t parmValsCount;
reader.enterSubVector("parmVals", parmValsCount);
size_t parmValCount;
reader.enterSubVector("parmVals", parmValCount);
switch (DataType(parmType))
{
case DataType::Int32:
@ -108,7 +108,7 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::read(A
reader.leaveSubVector();
}
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::write(Athena::io::YAMLDocWriter& writer) const
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::write(athena::io::YAMLDocWriter& writer) const
{
writer.writeUint32("parmType", parmType);
writer.writeUint32("unk1", unk1);
@ -139,10 +139,10 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::write(
const char* ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::DNAType()
{
return "Retro::DNAMP1::ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo";
return "urde::DNAMP1::ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo";
}
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(Athena::io::IStreamReader& reader)
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(athena::io::IStreamReader& reader)
{
id = reader.readUint32Big();
atUint32 parmInfoCount = reader.readUint32Big();
@ -153,7 +153,7 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(Athena::io:
animInfos.clear();
animInfos.reserve(animInfoCount);
reader.enumerate<AnimInfo>(animInfos, animInfoCount,
[this, parmInfoCount](Athena::io::IStreamReader& reader, AnimInfo& ai)
[this, parmInfoCount](athena::io::IStreamReader& reader, AnimInfo& ai)
{
ai.id = reader.readUint32Big();
ai.parmVals.reserve(parmInfoCount);
@ -180,7 +180,7 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(Athena::io:
});
}
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::write(Athena::io::IStreamWriter& writer) const
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(id);
writer.writeUint32Big(parmInfos.size());
@ -245,19 +245,19 @@ size_t ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::binarySize(siz
return __isz;
}
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(Athena::io::YAMLDocReader& reader)
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(athena::io::YAMLDocReader& reader)
{
id = reader.readUint32("id");
size_t parmInfoCount = reader.enumerate("parmInfos", parmInfos);
reader.enumerate<AnimInfo>("animInfos", animInfos,
[this, parmInfoCount](Athena::io::YAMLDocReader& reader, AnimInfo& ai)
[this, parmInfoCount](athena::io::YAMLDocReader& reader, AnimInfo& ai)
{
ai.id = reader.readUint32("id");
ai.parmVals.reserve(parmInfoCount);
size_t parmValsCount;
reader.enterSubVector("parmVals", parmValsCount);
size_t parmValCount;
reader.enterSubVector("parmVals", parmValCount);
for (const ParmInfo& pi : parmInfos)
{
switch (ParmInfo::DataType(pi.parmType))
@ -282,14 +282,14 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(Athena::io:
});
}
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::write(Athena::io::YAMLDocWriter& writer) const
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::write(athena::io::YAMLDocWriter& writer) const
{
writer.writeUint32("id", id);
writer.enumerate("parmInfos", parmInfos);
writer.enumerate<AnimInfo>("animInfos", animInfos,
[this](Athena::io::YAMLDocWriter& writer, const AnimInfo& ai)
[this](athena::io::YAMLDocWriter& writer, const AnimInfo& ai)
{
writer.writeUint32("id", ai.id);
auto it = ai.parmVals.begin();
@ -323,10 +323,10 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::write(Athena::io
const char* ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::DNAType()
{
return "Retro::DNAMP1::ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState";
return "urde::DNAMP1::ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState";
}
void ANCS::CharacterSet::CharacterInfo::read(Athena::io::IStreamReader& reader)
void ANCS::CharacterSet::CharacterInfo::read(athena::io::IStreamReader& reader)
{
idx = reader.readUint32Big();
atUint16 sectionCount = reader.readUint16Big();
@ -386,7 +386,7 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::IStreamReader& reader)
}
}
void ANCS::CharacterSet::CharacterInfo::write(Athena::io::IStreamWriter& writer) const
void ANCS::CharacterSet::CharacterInfo::write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(idx);
@ -522,7 +522,7 @@ size_t ANCS::CharacterSet::CharacterInfo::binarySize(size_t __isz) const
return __isz;
}
void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader)
void ANCS::CharacterSet::CharacterInfo::read(athena::io::YAMLDocReader& reader)
{
idx = reader.readUint32("idx");
atUint16 sectionCount = reader.readUint16("sectionCount");
@ -574,7 +574,7 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader)
}
}
void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer) const
void ANCS::CharacterSet::CharacterInfo::write(athena::io::YAMLDocWriter& writer) const
{
writer.writeUint32("idx", idx);
@ -639,10 +639,10 @@ void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer)
const char* ANCS::CharacterSet::CharacterInfo::DNAType()
{
return "Retro::DNAMP1::ANCS::CharacterSet::CharacterInfo";
return "urde::DNAMP1::ANCS::CharacterSet::CharacterInfo";
}
void ANCS::AnimationSet::MetaAnimFactory::read(Athena::io::IStreamReader& reader)
void ANCS::AnimationSet::MetaAnimFactory::read(athena::io::IStreamReader& reader)
{
IMetaAnim::Type type(IMetaAnim::Type(reader.readUint32Big()));
switch (type)
@ -673,7 +673,7 @@ void ANCS::AnimationSet::MetaAnimFactory::read(Athena::io::IStreamReader& reader
}
}
void ANCS::AnimationSet::MetaAnimFactory::write(Athena::io::IStreamWriter& writer) const
void ANCS::AnimationSet::MetaAnimFactory::write(athena::io::IStreamWriter& writer) const
{
if (!m_anim)
return;
@ -688,7 +688,7 @@ size_t ANCS::AnimationSet::MetaAnimFactory::binarySize(size_t __isz) const
return m_anim->binarySize(__isz + 4);
}
void ANCS::AnimationSet::MetaAnimFactory::read(Athena::io::YAMLDocReader& reader)
void ANCS::AnimationSet::MetaAnimFactory::read(athena::io::YAMLDocReader& reader)
{
std::string type = reader.readString("type");
std::transform(type.begin(), type.end(), type.begin(), tolower);
@ -724,7 +724,7 @@ void ANCS::AnimationSet::MetaAnimFactory::read(Athena::io::YAMLDocReader& reader
}
void ANCS::AnimationSet::MetaAnimFactory::write(Athena::io::YAMLDocWriter& writer) const
void ANCS::AnimationSet::MetaAnimFactory::write(athena::io::YAMLDocWriter& writer) const
{
if (!m_anim)
return;
@ -734,10 +734,10 @@ void ANCS::AnimationSet::MetaAnimFactory::write(Athena::io::YAMLDocWriter& write
const char* ANCS::AnimationSet::MetaAnimFactory::DNAType()
{
return "Retro::DNAMP1::ANCS::AnimationSet::MetaAnimFactory";
return "urde::DNAMP1::ANCS::AnimationSet::MetaAnimFactory";
}
void ANCS::AnimationSet::MetaTransFactory::read(Athena::io::IStreamReader& reader)
void ANCS::AnimationSet::MetaTransFactory::read(athena::io::IStreamReader& reader)
{
IMetaTrans::Type type(IMetaTrans::Type(reader.readUint32Big()));
switch (type)
@ -761,7 +761,7 @@ void ANCS::AnimationSet::MetaTransFactory::read(Athena::io::IStreamReader& reade
}
}
void ANCS::AnimationSet::MetaTransFactory::write(Athena::io::IStreamWriter& writer) const
void ANCS::AnimationSet::MetaTransFactory::write(athena::io::IStreamWriter& writer) const
{
if (!m_trans)
{
@ -779,7 +779,7 @@ size_t ANCS::AnimationSet::MetaTransFactory::binarySize(size_t __isz) const
return m_trans->binarySize(__isz + 4);
}
void ANCS::AnimationSet::MetaTransFactory::read(Athena::io::YAMLDocReader& reader)
void ANCS::AnimationSet::MetaTransFactory::read(athena::io::YAMLDocReader& reader)
{
std::string type = reader.readString("type");
std::transform(type.begin(), type.end(), type.begin(), tolower);
@ -805,7 +805,7 @@ void ANCS::AnimationSet::MetaTransFactory::read(Athena::io::YAMLDocReader& reade
}
void ANCS::AnimationSet::MetaTransFactory::write(Athena::io::YAMLDocWriter& writer) const
void ANCS::AnimationSet::MetaTransFactory::write(athena::io::YAMLDocWriter& writer) const
{
if (!m_trans)
{
@ -818,10 +818,10 @@ void ANCS::AnimationSet::MetaTransFactory::write(Athena::io::YAMLDocWriter& writ
const char* ANCS::AnimationSet::MetaTransFactory::DNAType()
{
return "Retro::DNAMP1::ANCS::AnimationSet::MetaTransFactory";
return "urde::DNAMP1::ANCS::AnimationSet::MetaTransFactory";
}
void ANCS::AnimationSet::read(Athena::io::IStreamReader& reader)
void ANCS::AnimationSet::read(athena::io::IStreamReader& reader)
{
atUint16 sectionCount = reader.readUint16Big();
@ -856,7 +856,7 @@ void ANCS::AnimationSet::read(Athena::io::IStreamReader& reader)
}
}
void ANCS::AnimationSet::write(Athena::io::IStreamWriter& writer) const
void ANCS::AnimationSet::write(athena::io::IStreamWriter& writer) const
{
atUint16 sectionCount;
if (animResources.size())
@ -939,7 +939,7 @@ size_t ANCS::AnimationSet::binarySize(size_t __isz) const
return __isz;
}
void ANCS::AnimationSet::read(Athena::io::YAMLDocReader& reader)
void ANCS::AnimationSet::read(athena::io::YAMLDocReader& reader)
{
atUint16 sectionCount = reader.readUint16("sectionCount");
@ -969,7 +969,7 @@ void ANCS::AnimationSet::read(Athena::io::YAMLDocReader& reader)
}
}
void ANCS::AnimationSet::write(Athena::io::YAMLDocWriter& writer) const
void ANCS::AnimationSet::write(athena::io::YAMLDocWriter& writer) const
{
atUint16 sectionCount;
if (animResources.size())
@ -1008,7 +1008,7 @@ void ANCS::AnimationSet::write(Athena::io::YAMLDocWriter& writer) const
const char* ANCS::AnimationSet::DNAType()
{
return "Retro::DNAMP1::ANCS::AnimationSet";
return "urde::DNAMP1::ANCS::AnimationSet";
}
}

View File

@ -9,7 +9,7 @@
#include "CINF.hpp"
#include "CSKR.hpp"
#include "ANIM.hpp"
#include "Athena/FileReader.hpp"
#include "athena/FileReader.hpp"
namespace DataSpec
{
@ -390,34 +390,34 @@ struct ANCS : BigYAML
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged)
std::function<void(const hecl::SystemChar*)> fileChanged)
{
HECL::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"));
HECL::ProjectPath::Type yamlType = yamlPath.getPathType();
HECL::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"));
HECL::ProjectPath::Type blendType = blendPath.getPathType();
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"));
hecl::ProjectPath::Type yamlType = yamlPath.getPathType();
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"));
hecl::ProjectPath::Type blendType = blendPath.getPathType();
if (force ||
yamlType == HECL::ProjectPath::Type::None ||
blendType == HECL::ProjectPath::Type::None)
yamlType == hecl::ProjectPath::Type::None ||
blendType == hecl::ProjectPath::Type::None)
{
ANCS ancs;
ancs.read(rs);
if (force || yamlType == HECL::ProjectPath::Type::None)
if (force || yamlType == hecl::ProjectPath::Type::None)
{
FILE* fp = HECL::Fopen(yamlPath.getAbsolutePath().c_str(), _S("wb"));
FILE* fp = hecl::Fopen(yamlPath.getAbsolutePath().c_str(), _S("wb"));
ancs.toYAMLFile(fp);
fclose(fp);
}
if (force || blendType == HECL::ProjectPath::Type::None)
if (force || blendType == hecl::ProjectPath::Type::None)
{
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, DNACMDL::SurfaceHeader_1, 2>
(conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
}
@ -426,19 +426,19 @@ struct ANCS : BigYAML
return true;
}
static bool Cook(const HECL::ProjectPath& outPath,
const HECL::ProjectPath& inPath,
static bool Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNAANCS::Actor& actor)
{
/* Search for yaml */
HECL::ProjectPath yamlPath = inPath.getWithExtension(_S(".yaml"), true);
if (yamlPath.getPathType() != HECL::ProjectPath::Type::File)
Log.report(LogVisor::FatalError, _S("'%s' not found as file"),
hecl::ProjectPath yamlPath = inPath.getWithExtension(_S(".yaml"), true);
if (yamlPath.getPathType() != hecl::ProjectPath::Type::File)
Log.report(logvisor::Fatal, _S("'%s' not found as file"),
yamlPath.getRelativePath().c_str());
Athena::io::FileReader yamlReader(yamlPath.getAbsolutePath());
athena::io::FileReader yamlReader(yamlPath.getAbsolutePath());
if (!BigYAML::ValidateFromYAMLFile<ANCS>(yamlReader))
Log.report(LogVisor::FatalError, _S("'%s' is not Retro::DNAMP1::ANCS type"),
Log.report(logvisor::Fatal, _S("'%s' is not urde::DNAMP1::ANCS type"),
yamlPath.getRelativePath().c_str());
ANCS ancs;
ancs.read(yamlReader);

View File

@ -5,9 +5,9 @@ namespace DataSpec
namespace DNAMP1
{
using ANIMOutStream = HECL::BlenderConnection::PyOutStream::ANIMOutStream;
using ANIMOutStream = hecl::BlenderConnection::PyOutStream::ANIMOutStream;
void ANIM::IANIM::sendANIMToBlender(HECL::BlenderConnection::PyOutStream& os, const CINF& cinf) const
void ANIM::IANIM::sendANIMToBlender(hecl::BlenderConnection::PyOutStream& os, const CINF& cinf) const
{
os.format("act.hecl_fps = round(%f)\n", (1.0f / mainInterval));
@ -68,7 +68,7 @@ void ANIM::IANIM::sendANIMToBlender(HECL::BlenderConnection::PyOutStream& os, co
}
}
void ANIM::ANIM0::read(Athena::io::IStreamReader& reader)
void ANIM::ANIM0::read(athena::io::IStreamReader& reader)
{
Header head;
head.read(reader);
@ -138,7 +138,7 @@ void ANIM::ANIM0::read(Athena::io::IStreamReader& reader)
evnt.read(reader);
}
void ANIM::ANIM0::write(Athena::io::IStreamWriter& writer) const
void ANIM::ANIM0::write(athena::io::IStreamWriter& writer) const
{
Header head;
head.unk0 = 0;
@ -239,7 +239,7 @@ size_t ANIM::ANIM0::binarySize(size_t __isz) const
return __isz + 4;
}
void ANIM::ANIM2::read(Athena::io::IStreamReader& reader)
void ANIM::ANIM2::read(athena::io::IStreamReader& reader)
{
Header head;
head.read(reader);
@ -303,7 +303,7 @@ void ANIM::ANIM2::read(Athena::io::IStreamReader& reader)
chanKeys = bsReader.read(bsData.get(), keyframeCount, channels, head.rotDiv, head.translationMult);
}
void ANIM::ANIM2::write(Athena::io::IStreamWriter& writer) const
void ANIM::ANIM2::write(athena::io::IStreamWriter& writer) const
{
Header head;
head.evnt = evnt;

View File

@ -28,7 +28,7 @@ struct ANIM : BigDNA
float mainInterval = 0.0;
UniqueID32 evnt;
void sendANIMToBlender(HECL::BlenderConnection::PyOutStream&, const CINF&) const;
void sendANIMToBlender(hecl::BlenderConnection::PyOutStream&, const CINF&) const;
};
struct ANIM0 : IANIM
@ -90,7 +90,7 @@ struct ANIM : BigDNA
Value<atUint16> initTZ = 0;
Value<atUint8> qTZ = 0;
void read(Athena::io::IStreamReader& reader)
void read(athena::io::IStreamReader& reader)
{
id = reader.readUint32Big();
keyCount1 = reader.readUint16Big();
@ -111,7 +111,7 @@ struct ANIM : BigDNA
qTZ = reader.readUByte();
}
}
void write(Athena::io::IStreamWriter& writer) const
void write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(id);
writer.writeUint16Big(keyCount1);
@ -143,7 +143,7 @@ struct ANIM : BigDNA
};
std::unique_ptr<IANIM> m_anim;
void read(Athena::io::IStreamReader& reader)
void read(athena::io::IStreamReader& reader)
{
atUint32 version = reader.readUint32Big();
switch (version)
@ -157,12 +157,12 @@ struct ANIM : BigDNA
m_anim->read(reader);
break;
default:
Log.report(LogVisor::Error, "unrecognized ANIM version");
Log.report(logvisor::Error, "unrecognized ANIM version");
break;
}
}
void write(Athena::io::IStreamWriter& writer) const
void write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(m_anim->m_version);
m_anim->write(writer);
@ -173,7 +173,7 @@ struct ANIM : BigDNA
return m_anim->binarySize(__isz + 4);
}
void sendANIMToBlender(HECL::BlenderConnection::PyOutStream& os, const CINF& cinf, bool) const
void sendANIMToBlender(hecl::BlenderConnection::PyOutStream& os, const CINF& cinf, bool) const
{
m_anim->sendANIMToBlender(os, cinf);
}

View File

@ -56,7 +56,7 @@ struct CINF : BigDNA
return nullptr;
}
void sendVertexGroupsToBlender(HECL::BlenderConnection::PyOutStream& os) const
void sendVertexGroupsToBlender(hecl::BlenderConnection::PyOutStream& os) const
{
for (atUint32 bid : boneIds)
{
@ -71,7 +71,7 @@ struct CINF : BigDNA
}
}
void sendCINFToBlender(HECL::BlenderConnection::PyOutStream& os, const UniqueID32& cinfId) const
void sendCINFToBlender(hecl::BlenderConnection::PyOutStream& os, const UniqueID32& cinfId) const
{
os.format("arm = bpy.data.armatures.new('CINF_%08X')\n"
"arm_obj = bpy.data.objects.new(arm.name, arm)\n"

View File

@ -8,7 +8,7 @@
#include "CINF.hpp"
#include "CSKR.hpp"
#include <Athena/FileReader.hpp>
#include <athena/FileReader.hpp>
namespace DataSpec
{
@ -19,11 +19,11 @@ struct CMDL
{
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged)
std::function<void(const hecl::SystemChar*)> fileChanged)
{
/* Check for RigPair */
const PAKRouter<PAKBridge>::RigPair* rp = pakRouter.lookupCMDLRigPair(entry.id);
@ -39,8 +39,8 @@ struct CMDL
}
/* Do extract */
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
if (!conn.createBlend(outPath, HECL::BlenderConnection::BlendType::Mesh))
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::Mesh))
return false;
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1, 2>
(conn, rs, pakRouter, entry, dataSpec, loadRp);
@ -48,24 +48,24 @@ struct CMDL
#if 0
/* Cook and re-extract test */
HECL::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true);
HECL::BlenderConnection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(HECL::TopologyTriStrips, -1);
hecl::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true);
hecl::BlenderConnection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(hecl::TopologyTriStrips, -1);
ds.close();
DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, outPath, mesh);
Athena::io::FileReader reader(tempOut.getAbsolutePath());
HECL::ProjectPath tempBlend = outPath.getWithExtension(_S(".recook.blend"), true);
if (!conn.createBlend(tempBlend, HECL::BlenderConnection::TypeMesh))
athena::io::FileReader reader(tempOut.getAbsolutePath());
hecl::ProjectPath tempBlend = outPath.getWithExtension(_S(".recook.blend"), true);
if (!conn.createBlend(tempBlend, hecl::BlenderConnection::TypeMesh))
return false;
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1_2, 2>
(conn, reader, pakRouter, entry, dataSpec, loadRp);
return conn.saveBlend();
#elif 0
/* HMDL cook test */
HECL::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true);
HECL::BlenderConnection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(HECL::HMDLTopology::TriStrips, 16);
hecl::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true);
hecl::BlenderConnection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(hecl::HMDLTopology::TriStrips, 16);
ds.close();
DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_1, 2>(tempOut, outPath, mesh);
#endif
@ -81,11 +81,11 @@ struct CMDL
DNACMDL::NameCMDL<PAKRouter<PAKBridge>, MaterialSet>(rs, pakRouter, entry, dataSpec);
}
static bool Cook(const HECL::ProjectPath& outPath,
const HECL::ProjectPath& inPath,
static bool Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNACMDL::Mesh& mesh)
{
HECL::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"));
hecl::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"));
if (mesh.skins.size())
{
DNACMDL::Mesh skinMesh = mesh.getContiguousSkinningVersion();
@ -94,7 +94,7 @@ struct CMDL
/* Output skinning intermediate */
auto vertCountIt = skinMesh.contiguousSkinVertCounts.cbegin();
Athena::io::FileWriter writer(outPath.getWithExtension(_S(".skin")).getAbsolutePath());
athena::io::FileWriter writer(outPath.getWithExtension(_S(".skin")).getAbsolutePath());
writer.writeUint32Big(skinMesh.skins.size());
for (const std::vector<DNACMDL::Mesh::SkinBind> skin : skinMesh.skins)
{
@ -116,18 +116,18 @@ struct CMDL
return true;
}
static bool HMDLCook(const HECL::ProjectPath& outPath,
const HECL::ProjectPath& inPath,
static bool HMDLCook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNACMDL::Mesh& mesh)
{
HECL::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"));
hecl::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"));
if (mesh.skins.size())
{
if (!DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_1, 2>(tempOut, inPath, mesh))
return false;
/* Output skinning intermediate */
Athena::io::FileWriter writer(outPath.getWithExtension(_S(".skin")).getAbsolutePath());
athena::io::FileWriter writer(outPath.getWithExtension(_S(".skin")).getAbsolutePath());
writer.writeUint32Big(mesh.skinBanks.banks.size());
for (const DNACMDL::Mesh::SkinBanks::Bank& sb : mesh.skinBanks.banks)
{

View File

@ -1,7 +1,7 @@
#include "CMDLMaterials.hpp"
#include "../DNAMP2/CMDLMaterials.hpp"
using Stream = HECL::BlenderConnection::PyOutStream;
using Stream = hecl::BlenderConnection::PyOutStream;
namespace DataSpec
{
@ -914,10 +914,10 @@ void MaterialSet::ConstructMaterial(Stream& out,
unsigned matIdx)
{_ConstructMaterial(out, material, groupIdx, matIdx);}
MaterialSet::Material::Material(const HECL::Backend::GX& gx,
MaterialSet::Material::Material(const hecl::Backend::GX& gx,
const std::unordered_map<std::string, int32_t>& iprops,
const std::vector<HECL::ProjectPath>& texPathsIn,
std::vector<HECL::ProjectPath>& texPathsOut,
const std::vector<hecl::ProjectPath>& texPathsIn,
std::vector<hecl::ProjectPath>& texPathsOut,
int colorCount,
int uvCount,
bool lightmapUVs,
@ -969,7 +969,7 @@ MaterialSet::Material::Material(const HECL::Backend::GX& gx,
textureIdxs.reserve(gx.m_tevCount);
for (unsigned i=0 ; i<gx.m_tevCount ; ++i)
{
const HECL::Backend::GX::TEVStage& stage = gx.m_tevs[i];
const hecl::Backend::GX::TEVStage& stage = gx.m_tevs[i];
tevStageTexInfo.emplace_back();
TEVStageTexInfo& texInfo = tevStageTexInfo.back();
if (stage.m_texGenIdx != -1)
@ -977,7 +977,7 @@ MaterialSet::Material::Material(const HECL::Backend::GX& gx,
if (stage.m_texMapIdx != -1)
{
texInfo.texSlot = textureIdxs.size();
const HECL::ProjectPath& texPath = texPathsIn.at(stage.m_texMapIdx);
const hecl::ProjectPath& texPath = texPathsIn.at(stage.m_texMapIdx);
texFlags |= 1 << i;
++textureCount;
bool found = false;
@ -1056,11 +1056,11 @@ MaterialSet::Material::Material(const HECL::Backend::GX& gx,
ColorChannel& ch = colorChannels.back();
for (unsigned i=0 ; i<gx.m_tevCount ; ++i)
{
const HECL::Backend::GX::TEVStage& stage = gx.m_tevs[i];
const hecl::Backend::GX::TEVStage& stage = gx.m_tevs[i];
for (int c=0 ; c<4 ; ++c)
if (stage.m_color[c] == HECL::Backend::GX::CC_RASC ||
stage.m_color[c] == HECL::Backend::GX::CC_RASA ||
stage.m_alpha[c] == HECL::Backend::GX::CA_RASA)
if (stage.m_color[c] == hecl::Backend::GX::CC_RASC ||
stage.m_color[c] == hecl::Backend::GX::CC_RASA ||
stage.m_alpha[c] == hecl::Backend::GX::CA_RASA)
{
ch.setLighting(true);
break;
@ -1075,7 +1075,7 @@ MaterialSet::Material::Material(const HECL::Backend::GX& gx,
tevStages.reserve(gx.m_tevCount);
for (unsigned i=0 ; i<gx.m_tevCount ; ++i)
{
const HECL::Backend::GX::TEVStage& stage = gx.m_tevs[i];
const hecl::Backend::GX::TEVStage& stage = gx.m_tevs[i];
tevStages.emplace_back();
TEVStage& target = tevStages.back();
@ -1104,7 +1104,7 @@ MaterialSet::Material::Material(const HECL::Backend::GX& gx,
tcgCount = gx.m_tcgCount;
for (unsigned i=0 ; i<gx.m_tcgCount ; ++i)
{
const HECL::Backend::GX::TexCoordGen& tcg = gx.m_tcgs[i];
const hecl::Backend::GX::TexCoordGen& tcg = gx.m_tcgs[i];
tcgs.emplace_back();
TexCoordGen& target = tcgs.back();
target.setType(GX::TG_MTX3x4);
@ -1132,7 +1132,7 @@ MaterialSet::Material::Material(const HECL::Backend::GX& gx,
bool found = false;
for (unsigned t=0 ; t<gx.m_tcgCount ; ++t)
{
const HECL::Backend::GX::TexCoordGen& tcg = gx.m_tcgs[t];
const hecl::Backend::GX::TexCoordGen& tcg = gx.m_tcgs[t];
if (tcg.m_mtx == GX::IDENTITY)
continue;
if ((tcg.m_mtx - GX::TEXMTX0) / 3 == uvAnimsCount)
@ -1149,11 +1149,11 @@ MaterialSet::Material::Material(const HECL::Backend::GX& gx,
}
}
HMDLMaterialSet::Material::Material(HECL::Frontend::Frontend& FE,
HMDLMaterialSet::Material::Material(hecl::Frontend::Frontend& FE,
const std::string& diagName,
const HECL::BlenderConnection::DataStream::Mesh::Material& mat,
const hecl::BlenderConnection::DataStream::Mesh::Material& mat,
const std::unordered_map<std::string, int32_t>& iprops,
const std::vector<HECL::ProjectPath>& texPaths)
const std::vector<hecl::ProjectPath>& texPaths)
{
auto search = iprops.find("retro_depth_sort");
if (search != iprops.end())
@ -1187,10 +1187,10 @@ HMDLMaterialSet::Material::Material(HECL::Frontend::Frontend& FE,
if (search != iprops.end())
flags.setLightmap(search->second != 0);
for (const HECL::ProjectPath& path : mat.texs)
for (const hecl::ProjectPath& path : mat.texs)
{
size_t idx = 0;
for (const HECL::ProjectPath& tPath : texPaths)
for (const hecl::ProjectPath& tPath : texPaths)
{
if (path == tPath)
{
@ -1210,15 +1210,15 @@ HMDLMaterialSet::Material::Material(HECL::Frontend::Frontend& FE,
uvAnimsSize = 4;
uvAnimsCount = 0;
for (const HECL::Frontend::IR::Instruction& inst : heclIr.m_instructions)
for (const hecl::Frontend::IR::Instruction& inst : heclIr.m_instructions)
{
if (inst.m_op != HECL::Frontend::IR::OpType::Call)
if (inst.m_op != hecl::Frontend::IR::OpType::Call)
continue;
if (inst.m_call.m_name.compare("Texture"))
continue;
const HECL::Frontend::IR::Instruction& sourceInst = inst.getChildInst(heclIr, 1);
if (sourceInst.m_op != HECL::Frontend::IR::OpType::Call)
const hecl::Frontend::IR::Instruction& sourceInst = inst.getChildInst(heclIr, 1);
if (sourceInst.m_op != hecl::Frontend::IR::OpType::Call)
continue;
if (sourceInst.m_call.m_name.compare(0, 11, "RetroUVMode"))
continue;
@ -1227,7 +1227,7 @@ HMDLMaterialSet::Material::Material(HECL::Frontend::Frontend& FE,
gameArgs.reserve(sourceInst.getChildCount() - 1);
for (int i=1 ; i<sourceInst.getChildCount() ; ++i)
{
const HECL::Frontend::IR::Instruction& ci = sourceInst.getChildInst(heclIr, i);
const hecl::Frontend::IR::Instruction& ci = sourceInst.getChildInst(heclIr, i);
gameArgs.push_back(ci.getImmVec());
}
@ -1248,7 +1248,7 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
{
mode = Mode::Scroll;
if (gameArgs.size() < 2)
Log.report(LogVisor::FatalError, "Mode2 UV anim requires 2 vector arguments");
Log.report(logvisor::Fatal, "Mode2 UV anim requires 2 vector arguments");
vals[0] = gameArgs[0].vec[0];
vals[1] = gameArgs[0].vec[1];
vals[2] = gameArgs[1].vec[0];
@ -1258,7 +1258,7 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
{
mode = Mode::Rotation;
if (gameArgs.size() < 2)
Log.report(LogVisor::FatalError, "Mode3 UV anim requires 2 arguments");
Log.report(logvisor::Fatal, "Mode3 UV anim requires 2 arguments");
vals[0] = gameArgs[0].vec[0];
vals[1] = gameArgs[1].vec[0];
}
@ -1266,7 +1266,7 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
{
mode = Mode::HStrip;
if (gameArgs.size() < 4)
Log.report(LogVisor::FatalError, "Mode4 UV anim requires 4 arguments");
Log.report(logvisor::Fatal, "Mode4 UV anim requires 4 arguments");
vals[0] = gameArgs[0].vec[0];
vals[1] = gameArgs[1].vec[0];
vals[2] = gameArgs[2].vec[0];
@ -1276,7 +1276,7 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
{
mode = Mode::VStrip;
if (gameArgs.size() < 4)
Log.report(LogVisor::FatalError, "Mode5 UV anim requires 4 arguments");
Log.report(logvisor::Fatal, "Mode5 UV anim requires 4 arguments");
vals[0] = gameArgs[0].vec[0];
vals[1] = gameArgs[1].vec[0];
vals[2] = gameArgs[2].vec[0];
@ -1288,12 +1288,12 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
{
mode = Mode::WhoMustNotBeNamed;
if (gameArgs.size() < 2)
Log.report(LogVisor::FatalError, "Mode7 UV anim requires 2 arguments");
Log.report(logvisor::Fatal, "Mode7 UV anim requires 2 arguments");
vals[0] = gameArgs[0].vec[0];
vals[1] = gameArgs[1].vec[0];
}
else
Log.report(LogVisor::FatalError, "unsupported UV anim '%s'", gameFunction.c_str());
Log.report(logvisor::Fatal, "unsupported UV anim '%s'", gameFunction.c_str());
}
}

View File

@ -268,7 +268,7 @@ struct MaterialSet : BigDNA
Eight
} mode;
float vals[9];
void read(Athena::io::IStreamReader& reader)
void read(athena::io::IStreamReader& reader)
{
mode = Mode(reader.readUint32Big());
switch (mode)
@ -303,7 +303,7 @@ struct MaterialSet : BigDNA
break;
}
}
void write(Athena::io::IStreamWriter& writer) const
void write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(atUint32(mode));
switch (mode)
@ -365,21 +365,21 @@ struct MaterialSet : BigDNA
};
Vector<UVAnimation, DNA_COUNT(uvAnimsCount)> uvAnims;
static void AddTexture(HECL::BlenderConnection::PyOutStream& out,
static void AddTexture(hecl::BlenderConnection::PyOutStream& out,
GX::TexGenSrc type, int mtxIdx, uint32_t texIdx);
static void AddTextureAnim(HECL::BlenderConnection::PyOutStream& out,
static void AddTextureAnim(hecl::BlenderConnection::PyOutStream& out,
MaterialSet::Material::UVAnimation::Mode type,
unsigned idx, const float* vals);
static void AddKcolor(HECL::BlenderConnection::PyOutStream& out,
static void AddKcolor(hecl::BlenderConnection::PyOutStream& out,
const GX::Color& col, unsigned idx);
static void AddDynamicColor(HECL::BlenderConnection::PyOutStream& out, unsigned idx);
static void AddDynamicAlpha(HECL::BlenderConnection::PyOutStream& out, unsigned idx);
static void AddDynamicColor(hecl::BlenderConnection::PyOutStream& out, unsigned idx);
static void AddDynamicAlpha(hecl::BlenderConnection::PyOutStream& out, unsigned idx);
Material() = default;
Material(const HECL::Backend::GX& gx,
Material(const hecl::Backend::GX& gx,
const std::unordered_map<std::string, int32_t>& iprops,
const std::vector<HECL::ProjectPath>& texPathsIn,
std::vector<HECL::ProjectPath>& texPathsOut,
const std::vector<hecl::ProjectPath>& texPathsIn,
std::vector<hecl::ProjectPath>& texPathsOut,
int colorCount,
int uvCount,
bool lightmapUVs,
@ -388,12 +388,12 @@ struct MaterialSet : BigDNA
};
Vector<Material, DNA_COUNT(head.materialCount)> materials;
static void RegisterMaterialProps(HECL::BlenderConnection::PyOutStream& out);
static void ConstructMaterial(HECL::BlenderConnection::PyOutStream& out,
static void RegisterMaterialProps(hecl::BlenderConnection::PyOutStream& out);
static void ConstructMaterial(hecl::BlenderConnection::PyOutStream& out,
const MaterialSet::Material& material,
unsigned groupIdx, unsigned matIdx);
void readToBlender(HECL::BlenderConnection::PyOutStream& os,
void readToBlender(hecl::BlenderConnection::PyOutStream& os,
const PAKRouter<PAKBridge>& pakRouter,
const PAKRouter<PAKBridge>::EntryType& entry,
unsigned setIdx)
@ -416,7 +416,7 @@ struct MaterialSet : BigDNA
++stageIdx;
continue;
}
const NOD::Node* node;
const nod::Node* node;
typename PAKRouter::EntryType* texEntry = (typename PAKRouter::EntryType*)
pakRouter.lookupEntry(head.textureIDs[mat.textureIdxs[texInfo.texSlot]], &node);
if (texEntry->name.size())
@ -427,9 +427,9 @@ struct MaterialSet : BigDNA
continue;
}
if (setIdx < 0)
texEntry->name = HECL::Format("%s_%d_%d", prefix, matIdx, stageIdx);
texEntry->name = hecl::Format("%s_%d_%d", prefix, matIdx, stageIdx);
else
texEntry->name = HECL::Format("%s_%d_%d_%d", prefix, setIdx, matIdx, stageIdx);
texEntry->name = hecl::Format("%s_%d_%d_%d", prefix, setIdx, matIdx, stageIdx);
if (mat.flags.lightmap() && stageIdx == 0)
{
@ -468,14 +468,14 @@ struct HMDLMaterialSet : BigDNA
Vector<MaterialSet::Material::UVAnimation, DNA_COUNT(uvAnimsCount)> uvAnims;
String<-1> heclSource;
HECL::Frontend::IR heclIr;
hecl::Frontend::IR heclIr;
Material() = default;
Material(HECL::Frontend::Frontend& FE,
Material(hecl::Frontend::Frontend& FE,
const std::string& diagName,
const HECL::BlenderConnection::DataStream::Mesh::Material& mat,
const hecl::BlenderConnection::DataStream::Mesh::Material& mat,
const std::unordered_map<std::string, int32_t>& iprops,
const std::vector<HECL::ProjectPath>& texPaths);
const std::vector<hecl::ProjectPath>& texPaths);
};
Vector<Material, DNA_COUNT(head.materialCount)> materials;
};

View File

@ -34,7 +34,7 @@ struct CSKR : BigDNA
return nullptr;
}
void weightVertex(HECL::BlenderConnection::PyOutStream& os, const CINF& cinf, atUint32 idx) const
void weightVertex(hecl::BlenderConnection::PyOutStream& os, const CINF& cinf, atUint32 idx) const
{
atUint32 accum = 0;
for (const SkinningRule& rule : skinningRules)

View File

@ -18,7 +18,7 @@ namespace DataSpec
{
namespace DNAMP1
{
LogVisor::LogModule Log("Retro::DNAMP1");
logvisor::Module Log("urde::DNAMP1");
static bool GetNoShare(const std::string& name)
{
@ -29,12 +29,12 @@ static bool GetNoShare(const std::string& name)
return true;
}
PAKBridge::PAKBridge(HECL::Database::Project& project,
const NOD::Node& node,
PAKBridge::PAKBridge(hecl::Database::Project& project,
const nod::Node& node,
bool doExtract)
: m_project(project), m_node(node), m_pak(false, GetNoShare(node.getName())), m_doExtract(doExtract)
{
NOD::AthenaPartReadStream rs(node.beginReadStream());
nod::AthenaPartReadStream rs(node.beginReadStream());
m_pak.read(rs);
/* Append Level String */
@ -60,12 +60,12 @@ PAKBridge::PAKBridge(HECL::Database::Project& project,
}
}
static HECL::SystemString LayerName(const std::string& name)
static hecl::SystemString LayerName(const std::string& name)
{
#if HECL_UCS2
HECL::SystemString ret = HECL::UTF8ToWide(name);
hecl::SystemString ret = hecl::UTF8ToWide(name);
#else
HECL::SystemString ret = name;
hecl::SystemString ret = name;
#endif
for (auto& ch : ret)
if (ch == _S('/') || ch == _S('\\'))
@ -89,7 +89,11 @@ void PAKBridge::build()
}
bool named;
#if HECL_UCS2
level.name = HECL::UTF8ToWide(m_pak.bestEntryName(entry, named));
<<<<<<< HEAD
level.name = hecl::UTF8ToWide(m_pak.bestEntryName(entry, named));
=======
level.name = hecl::UTF8ToWide(m_pak.bestEntryName(entry));
>>>>>>> master
#else
level.name = m_pak.bestEntryName(entry, named);
#endif
@ -103,7 +107,7 @@ void PAKBridge::build()
{
worldMapEnt->name = entry.name + "_mapw";
PAKEntryReadStream rs = worldMapEnt->beginReadStream(m_node);
rs.seek(8, Athena::Current);
rs.seek(8, athena::Current);
atUint32 areaCount = rs.readUint32Big();
mapw.reserve(areaCount);
for (atUint32 i=0 ; i<areaCount ; ++i)
@ -146,17 +150,17 @@ void PAKBridge::build()
if (areaDeps.name.empty())
{
#if HECL_UCS2
areaDeps.name = _S("MREA_") + HECL::UTF8ToWide(area.areaMREAId.toString());
areaDeps.name = _S("MREA_") + hecl::UTF8ToWide(area.areaMREAId.toString());
#else
areaDeps.name = "MREA_" + area.areaMREAId.toString();
#endif
}
HECL::SystemChar num[16];
HECL::SNPrintf(num, 16, _S("%02u "), ai);
hecl::SystemChar num[16];
hecl::SNPrintf(num, 16, _S("%02u "), ai);
areaDeps.name = num + areaDeps.name;
#if HECL_UCS2
std::string lowerName = HECL::WideToUTF8(areaDeps.name);
std::string lowerName = hecl::WideToUTF8(areaDeps.name);
#else
std::string lowerName(areaDeps.name);
#endif
@ -188,7 +192,7 @@ void PAKBridge::build()
while (layer.name.size() && isspace(layer.name.back()))
layer.name.pop_back();
#endif
HECL::SNPrintf(num, 16, layer.active ? _S("%02ua ") : _S("%02u "), l-1);
hecl::SNPrintf(num, 16, layer.active ? _S("%02ua ") : _S("%02u "), l-1);
layer.name = num + layer.name;
layer.resources.reserve(area.depLayers[l] - r);
@ -229,16 +233,16 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdl);
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskr);
PAK::Entry* cinfEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cinf);
cmdlEnt->name = HECL::Format("ANCS_%08X_%s_model", entry.first.toUint32(), ci.name.c_str());
cskrEnt->name = HECL::Format("ANCS_%08X_%s_skin", entry.first.toUint32(), ci.name.c_str());
cinfEnt->name = HECL::Format("ANCS_%08X_%s_skel", entry.first.toUint32(), ci.name.c_str());
cmdlEnt->name = hecl::Format("ANCS_%08X_%s_model", entry.first.toUint32(), ci.name.c_str());
cskrEnt->name = hecl::Format("ANCS_%08X_%s_skin", entry.first.toUint32(), ci.name.c_str());
cinfEnt->name = hecl::Format("ANCS_%08X_%s_skel", entry.first.toUint32(), ci.name.c_str());
if (ci.cmdlOverlay && ci.cskrOverlay)
{
addTo[ci.cmdlOverlay] = std::make_pair(ci.cskrOverlay, ci.cinf);
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlOverlay);
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrOverlay);
cmdlEnt->name = HECL::Format("ANCS_%08X_%s_overmodel", entry.first.toUint32(), ci.name.c_str());
cskrEnt->name = HECL::Format("ANCS_%08X_%s_overskin", entry.first.toUint32(), ci.name.c_str());
cmdlEnt->name = hecl::Format("ANCS_%08X_%s_overmodel", entry.first.toUint32(), ci.name.c_str());
cskrEnt->name = hecl::Format("ANCS_%08X_%s_overskin", entry.first.toUint32(), ci.name.c_str());
}
}
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animInfo;
@ -246,11 +250,11 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
for (auto& ae : animInfo)
{
PAK::Entry* animEnt = (PAK::Entry*)m_pak.lookupEntry(ae.second.animId);
animEnt->name = HECL::Format("ANCS_%08X_%s", entry.first.toUint32(), ae.second.name.c_str());
animEnt->name = hecl::Format("ANCS_%08X_%s", entry.first.toUint32(), ae.second.name.c_str());
if (ae.second.evntId)
{
PAK::Entry* evntEnt = (PAK::Entry*)m_pak.lookupEntry(ae.second.evntId);
evntEnt->name = HECL::Format("ANCS_%08X_%s_evnt", entry.first.toUint32(), ae.second.name.c_str());
evntEnt->name = hecl::Format("ANCS_%08X_%s_evnt", entry.first.toUint32(), ae.second.name.c_str());
}
}
}

View File

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

View File

@ -5,7 +5,7 @@ namespace DataSpec
namespace DNAMP1
{
void DeafBabe::BlenderInit(HECL::BlenderConnection::PyOutStream& os)
void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os)
{
os << "TYPE_COLORS = {'Ground':(1.0, 0.43, 0.15),\n"
" 'Stone':(0.28, 0.28, 0.28),\n"

View File

@ -86,10 +86,10 @@ struct DeafBabe : BigDNA
Vector<atVec3f, DNA_COUNT(vertCount)> verts;
/* Dummy MP2 member */
void insertNoClimb(HECL::BlenderConnection::PyOutStream&) const {}
void insertNoClimb(hecl::BlenderConnection::PyOutStream&) const {}
static void BlenderInit(HECL::BlenderConnection::PyOutStream& os);
void sendToBlender(HECL::BlenderConnection::PyOutStream& os) const
static void BlenderInit(hecl::BlenderConnection::PyOutStream& os);
void sendToBlender(hecl::BlenderConnection::PyOutStream& os) const
{
DeafBabeSendToBlender(os, *this);
}

View File

@ -5,7 +5,7 @@ namespace DataSpec
namespace DNAMP1
{
void EVNT::read(Athena::io::IStreamReader& reader)
void EVNT::read(athena::io::IStreamReader& reader)
{
version = reader.readUint32Big();
@ -26,7 +26,7 @@ void EVNT::read(Athena::io::IStreamReader& reader)
}
}
void EVNT::write(Athena::io::IStreamWriter& writer) const
void EVNT::write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(version);
@ -46,7 +46,7 @@ void EVNT::write(Athena::io::IStreamWriter& writer) const
}
}
void EVNT::read(Athena::io::YAMLDocReader& reader)
void EVNT::read(athena::io::YAMLDocReader& reader)
{
version = reader.readUint32("version");
@ -63,7 +63,7 @@ void EVNT::read(Athena::io::YAMLDocReader& reader)
}
}
void EVNT::write(Athena::io::YAMLDocWriter& writer) const
void EVNT::write(athena::io::YAMLDocWriter& writer) const
{
writer.writeUint32("version", version);
@ -81,7 +81,7 @@ void EVNT::write(Athena::io::YAMLDocWriter& writer) const
const char* EVNT::DNAType()
{
return "Retro::DNAMP1::EVNT";
return "urde::DNAMP1::EVNT";
}
size_t EVNT::binarySize(size_t __isz) const

View File

@ -66,11 +66,11 @@ struct EVNT : BigYAML
};
std::vector<SFXEvent> sfxEvents;
static bool Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
EVNT evnt;
evnt.read(rs);
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
evnt.toYAMLFile(fp);
fclose(fp);
return true;

View File

@ -5,7 +5,7 @@ namespace DataSpec
{
namespace DNAMP1
{
void FRME::read(Athena::io::IStreamReader& __dna_reader)
void FRME::read(athena::io::IStreamReader& __dna_reader)
{
/* version */
version = __dna_reader.readUint32Big();
@ -18,13 +18,13 @@ void FRME::read(Athena::io::IStreamReader& __dna_reader)
/* widgetCount */
widgetCount = __dna_reader.readUint32Big();
/* widgets */
__dna_reader.enumerate<Widget>(widgets, widgetCount, [this](Athena::io::IStreamReader& reader, Widget& w) {
__dna_reader.enumerate<Widget>(widgets, widgetCount, [this](athena::io::IStreamReader& reader, Widget& w) {
w.owner = this;
w.read(reader);
});
}
void FRME::write(Athena::io::IStreamWriter& __dna_writer) const
void FRME::write(athena::io::IStreamWriter& __dna_writer) const
{
/* version */
__dna_writer.writeUint32Big(version);
@ -46,7 +46,7 @@ size_t FRME::binarySize(size_t __isz) const
return __isz + 20;
}
void FRME::Widget::read(Athena::io::IStreamReader& __dna_reader)
void FRME::Widget::read(athena::io::IStreamReader& __dna_reader)
{
/* type */
type.read(__dna_reader);
@ -67,7 +67,7 @@ void FRME::Widget::read(Athena::io::IStreamReader& __dna_reader)
case SBIG('TBGP'): widgetInfo.reset(new TBGPInfo); break;
case SBIG('SLGP'): widgetInfo.reset(new SLGPInfo); break;
default:
Log.report(LogVisor::FatalError, _S("Unsupported FRME widget type %.8X"), type.toUint32());
Log.report(logvisor::Fatal, _S("Unsupported FRME widget type %.8X"), type.toUint32());
}
/* widgetInfo */
@ -98,7 +98,7 @@ void FRME::Widget::read(Athena::io::IStreamReader& __dna_reader)
unk4 = __dna_reader.readBool();
}
void FRME::Widget::write(Athena::io::IStreamWriter& __dna_writer) const
void FRME::Widget::write(athena::io::IStreamWriter& __dna_writer) const
{
/* type */
type.write(__dna_writer);
@ -143,7 +143,7 @@ size_t FRME::Widget::binarySize(size_t __isz) const
return __isz + 67;
}
void FRME::Widget::CAMRInfo::read(Athena::io::IStreamReader& __dna_reader)
void FRME::Widget::CAMRInfo::read(athena::io::IStreamReader& __dna_reader)
{
projectionType = ProjectionType(__dna_reader.readUint32Big());
if (projectionType == ProjectionType::Perspective)
@ -151,17 +151,17 @@ void FRME::Widget::CAMRInfo::read(Athena::io::IStreamReader& __dna_reader)
else if (projectionType == ProjectionType::Orthographic)
projection.reset(new OrthographicProjection);
else
Log.report(LogVisor::FatalError, _S("Invalid CAMR projection mode! %i"), int(projectionType));
Log.report(logvisor::Fatal, _S("Invalid CAMR projection mode! %i"), int(projectionType));
projection->read(__dna_reader);
}
void FRME::Widget::CAMRInfo::write(Athena::io::IStreamWriter& __dna_writer) const
void FRME::Widget::CAMRInfo::write(athena::io::IStreamWriter& __dna_writer) const
{
if (!projection)
Log.report(LogVisor::FatalError, _S("Invalid CAMR projection object!"));
Log.report(logvisor::Fatal, _S("Invalid CAMR projection object!"));
if (projection->type != projectionType)
Log.report(LogVisor::FatalError, _S("CAMR projection type does not match actual projection type!"));
Log.report(logvisor::Fatal, _S("CAMR projection type does not match actual projection type!"));
__dna_writer.writeUint32Big(atUint32(projectionType));
projection->write(__dna_writer);
@ -173,7 +173,7 @@ size_t FRME::Widget::CAMRInfo::binarySize(size_t __isz) const
return __isz + 4;
}
void FRME::Widget::TXPNInfo::read(Athena::io::IStreamReader& __dna_reader)
void FRME::Widget::TXPNInfo::read(athena::io::IStreamReader& __dna_reader)
{
IWidgetInfo::read(__dna_reader);
/* frameVals[0] */
@ -213,7 +213,7 @@ void FRME::Widget::TXPNInfo::read(Athena::io::IStreamReader& __dna_reader)
}
}
void FRME::Widget::TXPNInfo::write(Athena::io::IStreamWriter& __dna_writer) const
void FRME::Widget::TXPNInfo::write(athena::io::IStreamWriter& __dna_writer) const
{
IWidgetInfo::write(__dna_writer);
/* frameVals[0] */
@ -263,22 +263,22 @@ size_t FRME::Widget::TXPNInfo::binarySize(size_t __isz) const
return __isz + (version == 1 ? 78 : 66);
}
bool FRME::Extract(const SpecBase &dataSpec, PAKEntryReadStream &rs, const HECL::ProjectPath &outPath, PAKRouter<PAKBridge> &pakRouter, const PAK::Entry &entry, bool force, std::function<void (const HECL::SystemChar *)> fileChanged)
bool FRME::Extract(const SpecBase &dataSpec, PAKEntryReadStream &rs, const hecl::ProjectPath &outPath, PAKRouter<PAKBridge> &pakRouter, const PAK::Entry &entry, bool force, std::function<void (const hecl::SystemChar *)> fileChanged)
{
FRME frme;
frme.read(rs);
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
#if 0
if (!force && outPath.getPathType() == HECL::ProjectPath::Type::File)
if (!force && outPath.getPathType() == hecl::ProjectPath::Type::File)
return true;
#endif
if (!conn.createBlend(outPath, HECL::BlenderConnection::BlendType::Frame))
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::Frame))
return false;
HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
os << "import bpy, math\n"
"from mathutils import Matrix, Quaternion\n"
@ -347,7 +347,7 @@ bool FRME::Extract(const SpecBase &dataSpec, PAKEntryReadStream &rs, const HECL:
{
using MODLInfo = FRME::Widget::MODLInfo;
MODLInfo* info = dynamic_cast<MODLInfo*>(w.widgetInfo.get());
HECL::ProjectPath modelPath = pakRouter.getWorking(info->model);
hecl::ProjectPath modelPath = pakRouter.getWorking(info->model);
const PAKRouter<PAKBridge>::EntryType* cmdlE = pakRouter.lookupEntry(info->model, nullptr, true, true);
os.linkBlend(modelPath.getAbsolutePathUTF8().c_str(),
@ -366,16 +366,16 @@ bool FRME::Extract(const SpecBase &dataSpec, PAKEntryReadStream &rs, const HECL:
if (info && info->texture)
{
std::string texName = pakRouter.getBestEntryName(info->texture);
const NOD::Node* node;
const nod::Node* node;
const PAKRouter<PAKBridge>::EntryType* texEntry = pakRouter.lookupEntry(info->texture, &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, info->texture);
HECL::SystemUTF8View resPathView(resPath);
hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, info->texture);
hecl::SystemUTF8View resPathView(resPath);
os.format("if '%s' in bpy.data.images:\n"
" image = bpy.data.images['%s']\n"
"else:\n"

View File

@ -3,7 +3,7 @@
#include "../DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
#include <Athena/FileWriter.hpp>
#include <athena/FileWriter.hpp>
namespace DataSpec
{
@ -39,8 +39,8 @@ struct FRME : BigDNA
struct IWidgetInfo : BigDNA
{
Delete _d;
virtual void read(Athena::io::IStreamReader&) {}
void write(Athena::io::IStreamWriter&) const {}
virtual void read(athena::io::IStreamReader&) {}
void write(athena::io::IStreamWriter&) const {}
size_t binarySize(size_t __isz) const { return __isz; }
};
@ -219,11 +219,11 @@ struct FRME : BigDNA
Vector<Widget, DNA_COUNT(widgetCount)> widgets;
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged);
std::function<void(const hecl::SystemChar*)> fileChanged);
};
}

View File

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

View File

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

View File

@ -2,23 +2,19 @@
#include "SCLY.hpp"
#include "DeafBabe.hpp"
#include "../DNACommon/BabeDead.hpp"
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES 1
#endif
#include <math.h>
#include "zeus/Math.hpp"
namespace DataSpec
{
namespace DNAMP1
{
void MREA::ReadBabeDeadToBlender_1_2(HECL::BlenderConnection::PyOutStream& os,
Athena::io::IStreamReader& rs)
void MREA::ReadBabeDeadToBlender_1_2(hecl::BlenderConnection::PyOutStream& os,
athena::io::IStreamReader& rs)
{
atUint32 bdMagic = rs.readUint32Big();
if (bdMagic != 0xBABEDEAD)
Log.report(LogVisor::FatalError, "invalid BABEDEAD magic");
Log.report(logvisor::Fatal, "invalid BABEDEAD magic");
os << "bpy.context.scene.render.engine = 'CYCLES'\n"
"bpy.context.scene.world.use_nodes = True\n"
"bpy.context.scene.render.engine = 'BLENDER_GAME'\n"
@ -49,7 +45,7 @@ void MREA::AddCMDLRigPairs(PAKEntryReadStream& rs,
atUint64 secStart = rs.position();
while (curSec != head.sclySecIdx)
secStart += head.secSizes[curSec++];
rs.seek(secStart, Athena::Begin);
rs.seek(secStart, athena::Begin);
SCLY scly;
scly.read(rs);
scly.addCMDLRigPairs(pakRouter, addTo);
@ -57,18 +53,18 @@ void MREA::AddCMDLRigPairs(PAKEntryReadStream& rs,
bool MREA::Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
std::function<void(const HECL::SystemChar*)>)
std::function<void(const hecl::SystemChar*)>)
{
using RigPair = std::pair<CSKR*, CINF*>;
RigPair dummy(nullptr, nullptr);
/* Rename MREA for consistency */
HECL::ProjectPath mreaPath(outPath.getParentPath(), _S("!area.blend"));
if (!force && mreaPath.getPathType() == HECL::ProjectPath::Type::File)
hecl::ProjectPath mreaPath(outPath.getParentPath(), _S("!area.blend"));
if (!force && mreaPath.getPathType() == hecl::ProjectPath::Type::File)
return true;
/* Do extract */
@ -76,12 +72,12 @@ bool MREA::Extract(const SpecBase& dataSpec,
head.read(rs);
rs.seekAlign32();
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
if (!conn.createBlend(mreaPath, HECL::BlenderConnection::BlendType::Area))
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
if (!conn.createBlend(mreaPath, hecl::BlenderConnection::BlendType::Area))
return false;
/* Open Py Stream and read sections */
HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"from mathutils import Vector\n"
@ -113,7 +109,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
atUint64 secStart = rs.position();
matSet.read(rs);
matSet.readToBlender(os, pakRouter, entry, 0);
rs.seek(secStart + head.secSizes[0], Athena::Begin);
rs.seek(secStart + head.secSizes[0], athena::Begin);
std::vector<DNACMDL::VertexAttributes> vertAttribs;
DNACMDL::GetVertexAttributes(matSet, vertAttribs);
@ -124,7 +120,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
MeshHeader mHeader;
secStart = rs.position();
mHeader.read(rs);
rs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
rs.seek(secStart + head.secSizes[curSec++], athena::Begin);
curSec += DNACMDL::ReadGeomSectionsToBlender<PAKRouter<PAKBridge>, MaterialSet, RigPair, DNACMDL::SurfaceHeader_1>
(os, rs, pakRouter, entry, dummy, true,
true, vertAttribs, m, head.secCount, 0, &head.secSizes[curSec]);
@ -139,14 +135,14 @@ bool MREA::Extract(const SpecBase& dataSpec,
}
/* Skip AROT */
rs.seek(head.secSizes[curSec++], Athena::Current);
rs.seek(head.secSizes[curSec++], athena::Current);
/* Read SCLY layers */
secStart = rs.position();
SCLY scly;
scly.read(rs);
scly.exportToLayerDirectories(entry, pakRouter, force);
rs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
rs.seek(secStart + head.secSizes[curSec++], athena::Begin);
/* Read collision meshes */
DeafBabe collision;
@ -154,15 +150,15 @@ bool MREA::Extract(const SpecBase& dataSpec,
collision.read(rs);
DeafBabe::BlenderInit(os);
collision.sendToBlender(os);
rs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
rs.seek(secStart + head.secSizes[curSec++], athena::Begin);
/* Skip unknown section */
rs.seek(head.secSizes[curSec++], Athena::Current);
rs.seek(head.secSizes[curSec++], athena::Current);
/* Read BABEDEAD Lights as Cycles emissives */
secStart = rs.position();
ReadBabeDeadToBlender_1_2(os, rs);
rs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
rs.seek(secStart + head.secSizes[curSec++], athena::Begin);
/* Origins to center of mass */
os << "bpy.context.scene.layers[1] = True\n"
@ -193,15 +189,15 @@ void MREA::Name(const SpecBase& dataSpec,
atUint64 secStart = rs.position();
MaterialSet matSet;
matSet.read(rs);
matSet.nameTextures(pakRouter, HECL::Format("MREA_%s", entry.id.toString().c_str()).c_str(), -1);
rs.seek(secStart + head.secSizes[0], Athena::Begin);
matSet.nameTextures(pakRouter, hecl::Format("MREA_%s", entry.id.toString().c_str()).c_str(), -1);
rs.seek(secStart + head.secSizes[0], athena::Begin);
/* Skip to SCLY */
atUint32 curSec = 1;
secStart = rs.position();
while (curSec != head.sclySecIdx)
secStart += head.secSizes[curSec++];
rs.seek(secStart, Athena::Begin);
rs.seek(secStart, athena::Begin);
SCLY scly;
scly.read(rs);
scly.nameIDs(pakRouter);
@ -209,10 +205,10 @@ void MREA::Name(const SpecBase& dataSpec,
/* Skip to PATH */
while (curSec != head.pathSecIdx)
secStart += head.secSizes[curSec++];
rs.seek(secStart, Athena::Begin);
rs.seek(secStart, athena::Begin);
UniqueID32 pathID(rs);
const NOD::Node* node;
const nod::Node* node;
PAK::Entry* pathEnt = (PAK::Entry*)pakRouter.lookupEntry(pathID, &node);
pathEnt->name = entry.name + "_path";
}

View File

@ -100,8 +100,8 @@ struct MREA
Value<float> unk9;
};
static void ReadBabeDeadToBlender_1_2(HECL::BlenderConnection::PyOutStream& os,
Athena::io::IStreamReader& rs);
static void ReadBabeDeadToBlender_1_2(hecl::BlenderConnection::PyOutStream& os,
athena::io::IStreamReader& rs);
static void AddCMDLRigPairs(PAKEntryReadStream& rs,
PAKRouter<PAKBridge>& pakRouter,
@ -109,11 +109,11 @@ struct MREA
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool,
std::function<void(const HECL::SystemChar*)>);
std::function<void(const hecl::SystemChar*)>);
static void Name(const SpecBase& dataSpec,
PAKEntryReadStream& rs,

View File

@ -8,11 +8,11 @@ namespace DataSpec
namespace DNAMP1
{
void PAK::read(Athena::io::IStreamReader& reader)
void PAK::read(athena::io::IStreamReader& reader)
{
atUint32 version = reader.readUint32Big();
if (version != 0x00030005)
Log.report(LogVisor::FatalError, "unexpected PAK magic");
Log.report(logvisor::Fatal, "unexpected PAK magic");
reader.readUint32Big();
atUint32 nameCount = reader.readUint32Big();
@ -62,7 +62,7 @@ void PAK::read(Athena::io::IStreamReader& reader)
}
}
void PAK::write(Athena::io::IStreamWriter& writer) const
void PAK::write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(0x00030005);
writer.writeUint32Big(0);
@ -98,15 +98,15 @@ size_t PAK::binarySize(size_t __isz) const
}
std::unique_ptr<atUint8[]>
PAK::Entry::getBuffer(const NOD::Node& pak, atUint64& szOut) const
PAK::Entry::getBuffer(const nod::Node& pak, atUint64& szOut) const
{
if (compressed)
{
std::unique_ptr<NOD::IPartReadStream> strm = pak.beginReadStream(offset);
std::unique_ptr<nod::IPartReadStream> strm = pak.beginReadStream(offset);
atUint32 decompSz;
strm->read(&decompSz, 4);
decompSz = HECL::SBig(decompSz);
decompSz = hecl::SBig(decompSz);
atUint8* buf = new atUint8[decompSz];
atUint8* bufCur = buf;
@ -135,7 +135,7 @@ PAK::Entry::getBuffer(const NOD::Node& pak, atUint64& szOut) const
{
atUint16 chunkSz;
strm->read(&chunkSz, 2);
chunkSz = HECL::SBig(chunkSz);
chunkSz = hecl::SBig(chunkSz);
strm->read(compBuf, chunkSz);
lzo_uint dsz = rem;
lzo1x_decompress(compBuf, chunkSz, bufCur, &dsz, nullptr);

View File

@ -3,7 +3,7 @@
#include <unordered_map>
#include <NOD/DiscBase.hpp>
#include <nod/DiscBase.hpp>
#include "../DNACommon/PAK.hpp"
namespace DataSpec
@ -38,8 +38,8 @@ struct PAK : BigDNA
UniqueResult unique;
std::string name; /* backreferencing name for RE purposes */
std::unique_ptr<atUint8[]> getBuffer(const NOD::Node& pak, atUint64& szOut) const;
inline PAKEntryReadStream beginReadStream(const NOD::Node& pak, atUint64 off=0) const
std::unique_ptr<atUint8[]> getBuffer(const nod::Node& pak, atUint64& szOut) const;
inline PAKEntryReadStream beginReadStream(const nod::Node& pak, atUint64 off=0) const
{
atUint64 sz;
std::unique_ptr<atUint8[]> buf = getBuffer(pak, sz);

View File

@ -1,7 +1,7 @@
#ifndef _DNAMP1_SCAN_HPP_
#define _DNAMP1_SCAN_HPP_
#include <Athena/FileWriter.hpp>
#include <athena/FileWriter.hpp>
#include "../DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
@ -59,7 +59,7 @@ struct SCAN : BigYAML
Value<float> interval; // 0.0 - 1.0
Value<float> fadeDuration; // 0.0 - 1.0
void read(Athena::io::IStreamReader& __dna_reader)
void read(athena::io::IStreamReader& __dna_reader)
{
/* texture */
texture.read(__dna_reader);
@ -77,7 +77,7 @@ struct SCAN : BigYAML
fadeDuration = __dna_reader.readFloatBig();
}
void write(Athena::io::IStreamWriter& __dna_writer) const
void write(athena::io::IStreamWriter& __dna_writer) const
{
/* texture */
texture.write(__dna_writer);
@ -95,7 +95,7 @@ struct SCAN : BigYAML
__dna_writer.writeFloatBig(fadeDuration);
}
void read(Athena::io::YAMLDocReader& __dna_docin)
void read(athena::io::YAMLDocReader& __dna_docin)
{
/* texture */
__dna_docin.enumerate("texture", texture);
@ -120,7 +120,7 @@ struct SCAN : BigYAML
fadeDuration = __dna_docin.readFloat("fadeDuration");
}
void write(Athena::io::YAMLDocWriter& __dna_docout) const
void write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* texture */
__dna_docout.enumerate("texture", texture);
@ -141,7 +141,7 @@ struct SCAN : BigYAML
__dna_docout.writeFloat("fadeDuration", fadeDuration);
}
const char* DNAType() { return "Retro::DNAMP1::SCAN::Texture"; }
const char* DNAType() { return "urde::DNAMP1::SCAN::Texture"; }
size_t binarySize(size_t __isz) const
{
__isz = texture.binarySize(__isz);
@ -152,23 +152,23 @@ struct SCAN : BigYAML
Texture textures[4];
static bool Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
SCAN scan;
scan.read(rs);
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
scan.toYAMLFile(fp);
fclose(fp);
return true;
}
static bool Cook(const HECL::ProjectPath& inPath, const HECL::ProjectPath& outPath)
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
SCAN scan;
FILE* fp = HECL::Fopen(inPath.getAbsolutePath().c_str(), _S("rb"));
FILE* fp = hecl::Fopen(inPath.getAbsolutePath().c_str(), _S("rb"));
scan.fromYAMLFile(fp);
fclose(fp);
Athena::io::FileWriter ws(outPath.getAbsolutePath());
athena::io::FileWriter ws(outPath.getAbsolutePath());
scan.write(ws);
return true;
}
@ -183,7 +183,7 @@ struct SCAN : BigYAML
if (scan.string)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(scan.string);
ent->name = HECL::Format("SCAN_%s_strg", entry.id.toString().c_str());
ent->name = hecl::Format("SCAN_%s_strg", entry.id.toString().c_str());
}
for (int i=0 ; i<4 ; ++i)
{
@ -191,7 +191,7 @@ struct SCAN : BigYAML
if (tex.texture)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(tex.texture);
ent->name = HECL::Format("SCAN_%s_tex%d", entry.id.toString().c_str(), i+1);
ent->name = hecl::Format("SCAN_%s_tex%d", entry.id.toString().c_str(), i+1);
}
}
}

View File

@ -6,21 +6,21 @@ namespace DataSpec
namespace DNAMP1
{
void SCLY::read(Athena::io::IStreamReader& rs)
void SCLY::read(athena::io::IStreamReader& rs)
{
fourCC = rs.readUint32Little();
version = rs.readUint32Big();
layerCount = rs.readUint32Big();
rs.enumerateBig(layerSizes, layerCount);
atUint32 i = 0;
rs.enumerate<ScriptLayer>(layers, layerCount, [&i,this](Athena::io::IStreamReader& rs, ScriptLayer& layer) {
rs.enumerate<ScriptLayer>(layers, layerCount, [&i,this](athena::io::IStreamReader& rs, ScriptLayer& layer) {
atUint64 start = rs.position();
layer.read(rs);
rs.seek(start + layerSizes[i++], Athena::Begin);
rs.seek(start + layerSizes[i++], athena::Begin);
});
}
void SCLY::write(Athena::io::IStreamWriter& ws) const
void SCLY::write(athena::io::IStreamWriter& ws) const
{
ws.writeUint32Big(fourCC);
ws.writeUint32Big(version);
@ -40,14 +40,14 @@ void SCLY::exportToLayerDirectories(const PAK::Entry& entry, PAKRouter<PAKBridge
{
for (atUint32 i = 0; i < layerCount; i++)
{
HECL::ProjectPath layerPath = pakRouter.getAreaLayerWorking(entry.id, i);
if (layerPath.getPathType() == HECL::ProjectPath::Type::None)
hecl::ProjectPath layerPath = pakRouter.getAreaLayerWorking(entry.id, i);
if (layerPath.getPathType() == hecl::ProjectPath::Type::None)
layerPath.makeDir();
HECL::ProjectPath yamlFile = HECL::ProjectPath(layerPath, _S("objects.yaml"));
if (force || yamlFile.getPathType() == HECL::ProjectPath::Type::None)
hecl::ProjectPath yamlFile = hecl::ProjectPath(layerPath, _S("objects.yaml"));
if (force || yamlFile.getPathType() == hecl::ProjectPath::Type::None)
{
FILE* yaml = HECL::Fopen(yamlFile.getAbsolutePath().c_str(), _S("wb"));
FILE* yaml = hecl::Fopen(yamlFile.getAbsolutePath().c_str(), _S("wb"));
layers[i].toYAMLFile(yaml);
fclose(yaml);
}
@ -80,7 +80,7 @@ void SCLY::ScriptLayer::nameIDs(PAKRouter<PAKBridge>& pakRouter) const
obj->nameIDs(pakRouter);
}
void SCLY::read(Athena::io::YAMLDocReader& docin)
void SCLY::read(athena::io::YAMLDocReader& docin)
{
fourCC = docin.readUint32("fourCC");
version = docin.readUint32("version");
@ -88,7 +88,7 @@ void SCLY::read(Athena::io::YAMLDocReader& docin)
docin.enumerate("layers", layers);
}
void SCLY::write(Athena::io::YAMLDocWriter& docout) const
void SCLY::write(athena::io::YAMLDocWriter& docout) const
{
docout.writeUint32("fourCC", fourCC);
docout.writeUint32("version", version);
@ -98,13 +98,14 @@ void SCLY::write(Athena::io::YAMLDocWriter& docout) const
const char* SCLY::DNAType()
{
return "Retro::DNAMP1::SCLY";
return "urde::DNAMP1::SCLY";
}
void SCLY::ScriptLayer::read(Athena::io::IStreamReader& rs)
void SCLY::ScriptLayer::read(athena::io::IStreamReader& rs)
{
unknown = rs.readUByte();
objectCount = rs.readUint32Big();
objects.clear();
objects.reserve(objectCount);
for (atUint32 i = 0; i < objectCount; i++)
{
@ -123,15 +124,15 @@ void SCLY::ScriptLayer::read(Athena::io::IStreamReader& rs)
objects.push_back(std::move(obj));
size_t actualLen = rs.position() - start;
if (actualLen != len)
Log.report(LogVisor::FatalError, _S("Error while reading object of type 0x%.2X, did not read the expected amount of data, read 0x%x, expected 0x%x"), (atUint32)type, actualLen, len);
rs.seek(start + len, Athena::Begin);
Log.report(logvisor::Fatal, _S("Error while reading object of type 0x%.2X, did not read the expected amount of data, read 0x%x, expected 0x%x"), (atUint32)type, actualLen, len);
rs.seek(start + len, athena::Begin);
}
else
Log.report(LogVisor::FatalError, _S("Unable to find type 0x%X in object database"), (atUint32)type);
Log.report(logvisor::Fatal, _S("Unable to find type 0x%X in object database"), (atUint32)type);
}
}
void SCLY::ScriptLayer::read(Athena::io::YAMLDocReader& rs)
void SCLY::ScriptLayer::read(athena::io::YAMLDocReader& rs)
{
unknown = rs.readUByte("unknown");
size_t objCount;
@ -155,7 +156,7 @@ void SCLY::ScriptLayer::read(Athena::io::YAMLDocReader& rs)
objects.push_back(std::move(obj));
}
else
Log.report(LogVisor::FatalError, _S("Unable to find type 0x%X in object database"), (atUint32)type);
Log.report(logvisor::Fatal, _S("Unable to find type 0x%X in object database"), (atUint32)type);
rs.leaveSubRecord();
}
@ -165,7 +166,7 @@ void SCLY::ScriptLayer::read(Athena::io::YAMLDocReader& rs)
objectCount = 0;
}
void SCLY::ScriptLayer::write(Athena::io::IStreamWriter& ws) const
void SCLY::ScriptLayer::write(athena::io::IStreamWriter& ws) const
{
ws.writeUByte(unknown);
ws.writeUint32Big(objectCount);
@ -187,7 +188,7 @@ size_t SCLY::ScriptLayer::binarySize(size_t __isz) const
return __isz;
}
void SCLY::ScriptLayer::write(Athena::io::YAMLDocWriter& ws) const
void SCLY::ScriptLayer::write(athena::io::YAMLDocWriter& ws) const
{
ws.writeUByte("unknown", unknown);
ws.enterSubVector("objects");
@ -203,7 +204,7 @@ void SCLY::ScriptLayer::write(Athena::io::YAMLDocWriter& ws) const
const char* SCLY::ScriptLayer::DNAType()
{
return "Retro::DNAMP1::SCLY::ScriptLayer";
return "urde::DNAMP1::SCLY::ScriptLayer";
}
}

View File

@ -26,8 +26,8 @@ struct SCLY : BigYAML
Value<atUint8> unknown;
Value<atUint32> objectCount;
Vector<std::unique_ptr<IScriptObject>, DNA_COUNT(objectCount)> objects;
void read(Athena::io::IStreamReader &rs);
void write(Athena::io::IStreamWriter &ws) const;
void read(athena::io::IStreamReader &rs);
void write(athena::io::IStreamWriter &ws) const;
size_t binarySize(size_t __isz) const;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const;
@ -35,8 +35,8 @@ struct SCLY : BigYAML
};
Vector<ScriptLayer, DNA_COUNT(layerCount)> layers;
void read(Athena::io::IStreamReader &rs);
void write(Athena::io::IStreamWriter &ws) const;
void read(athena::io::IStreamReader &rs);
void write(athena::io::IStreamWriter &ws) const;
size_t binarySize(size_t __isz) const;
void exportToLayerDirectories(const PAK::Entry &, PAKRouter<PAKBridge>&, bool) const;

View File

@ -6,7 +6,7 @@ namespace DataSpec
namespace DNAMP1
{
void STRG::_read(Athena::io::IStreamReader& reader)
void STRG::_read(athena::io::IStreamReader& reader)
{
atUint32 langCount = reader.readUint32Big();
atUint32 strCount = reader.readUint32Big();
@ -38,20 +38,20 @@ void STRG::_read(Athena::io::IStreamReader& reader)
langMap.emplace(item.first, &item.second);
}
void STRG::read(Athena::io::IStreamReader& reader)
void STRG::read(athena::io::IStreamReader& reader)
{
atUint32 magic = reader.readUint32Big();
if (magic != 0x87654321)
Log.report(LogVisor::Error, "invalid STRG magic");
Log.report(logvisor::Error, "invalid STRG magic");
atUint32 version = reader.readUint32Big();
if (version != 0)
Log.report(LogVisor::Error, "invalid STRG version");
Log.report(logvisor::Error, "invalid STRG version");
_read(reader);
}
void STRG::write(Athena::io::IStreamWriter& writer) const
void STRG::write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(0x87654321);
writer.writeUint32Big(0);
@ -131,9 +131,9 @@ size_t STRG::binarySize(size_t __isz) const
return __isz;
}
void STRG::read(Athena::io::YAMLDocReader& reader)
void STRG::read(athena::io::YAMLDocReader& reader)
{
const Athena::io::YAMLNode* root = reader.getRootNode();
const athena::io::YAMLNode* root = reader.getRootNode();
/* Validate Pass */
if (root->m_type == YAML_MAPPING_NODE)
@ -142,19 +142,19 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
{
if (lang.first.size() != 4)
{
Log.report(LogVisor::Warning, "STRG language string '%s' must be exactly 4 characters; skipping", lang.first.c_str());
Log.report(logvisor::Warning, "STRG language string '%s' must be exactly 4 characters; skipping", lang.first.c_str());
return;
}
if (lang.second->m_type != YAML_SEQUENCE_NODE)
{
Log.report(LogVisor::Warning, "STRG language string '%s' must contain a sequence; skipping", lang.first.c_str());
Log.report(logvisor::Warning, "STRG language string '%s' must contain a sequence; skipping", lang.first.c_str());
return;
}
for (const auto& str : lang.second->m_seqChildren)
{
if (str->m_type != YAML_SCALAR_NODE)
{
Log.report(LogVisor::Warning, "STRG language '%s' must contain all scalars; skipping", lang.first.c_str());
Log.report(logvisor::Warning, "STRG language '%s' must contain all scalars; skipping", lang.first.c_str());
return;
}
}
@ -162,7 +162,7 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
}
else
{
Log.report(LogVisor::Warning, "STRG must have a mapping root node; skipping");
Log.report(logvisor::Warning, "STRG must have a mapping root node; skipping");
return;
}
@ -172,7 +172,7 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
{
std::vector<std::wstring> strs;
for (const auto& str : lang.second->m_seqChildren)
strs.emplace_back(HECL::UTF8ToWide(str->m_scalarString));
strs.emplace_back(hecl::UTF8ToWide(str->m_scalarString));
langs.emplace_back(FourCC(lang.first.c_str()), strs);
}
@ -182,7 +182,7 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
langMap.emplace(item.first, &item.second);
}
void STRG::write(Athena::io::YAMLDocWriter& writer) const
void STRG::write(athena::io::YAMLDocWriter& writer) const
{
for (const auto& lang : langs)
{
@ -195,7 +195,7 @@ void STRG::write(Athena::io::YAMLDocWriter& writer) const
const char* STRG::DNAType()
{
return "Retro::DNAMP1::STRG";
return "urde::DNAMP1::STRG";
}
}

View File

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

View File

@ -31,7 +31,7 @@ struct Oculus : IScriptObject
/* Trilogy addition */
Value<float> unknown8;
void read(Athena::io::IStreamReader& __dna_reader)
void read(athena::io::IStreamReader& __dna_reader)
{
IScriptObject::read(__dna_reader);
/* name */
@ -71,7 +71,7 @@ struct Oculus : IScriptObject
unknown8 = 0.0;
}
void write(Athena::io::IStreamWriter& __dna_writer) const
void write(athena::io::IStreamWriter& __dna_writer) const
{
IScriptObject::write(__dna_writer);
/* name */
@ -109,7 +109,7 @@ struct Oculus : IScriptObject
__dna_writer.writeFloatBig(unknown8);
}
void read(Athena::io::YAMLDocReader& __dna_docin)
void read(athena::io::YAMLDocReader& __dna_docin)
{
IScriptObject::read(__dna_docin);
/* name */
@ -149,7 +149,7 @@ struct Oculus : IScriptObject
unknown8 = 0.0;
}
void write(Athena::io::YAMLDocWriter& __dna_docout) const
void write(athena::io::YAMLDocWriter& __dna_docout) const
{
IScriptObject::write(__dna_docout);
/* name */
@ -189,7 +189,7 @@ struct Oculus : IScriptObject
static const char* DNAType()
{
return "Retro::DNAMP1::Oculus";
return "urde::DNAMP1::Oculus";
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,

View File

@ -10,7 +10,7 @@ UniqueID32 AnimationParameters::getCINF(PAKRouter<PAKBridge>& pakRouter) const
{
if (!animationCharacterSet)
return UniqueID32();
const NOD::Node* node;
const nod::Node* node;
const PAK::Entry* ancsEnt = pakRouter.lookupEntry(animationCharacterSet, &node);
ANCS ancs;
{

View File

@ -124,7 +124,7 @@ struct Ridley : IScriptObject
/* Trilogy addition */
DamageInfo damageInfo9;
void read(Athena::io::IStreamReader& __dna_reader)
void read(athena::io::IStreamReader& __dna_reader)
{
IScriptObject::read(__dna_reader);
/* name */
@ -234,7 +234,7 @@ struct Ridley : IScriptObject
damageInfo9.read(__dna_reader);
}
void write(Athena::io::IStreamWriter& __dna_writer) const
void write(athena::io::IStreamWriter& __dna_writer) const
{
IScriptObject::write(__dna_writer);
/* name */
@ -344,7 +344,7 @@ struct Ridley : IScriptObject
damageInfo9.write(__dna_writer);
}
void read(Athena::io::YAMLDocReader& __dna_docin)
void read(athena::io::YAMLDocReader& __dna_docin)
{
IScriptObject::read(__dna_docin);
/* name */
@ -454,7 +454,7 @@ struct Ridley : IScriptObject
__dna_docin.enumerate("damageInfo9", damageInfo9);
}
void write(Athena::io::YAMLDocWriter& __dna_docout) const
void write(athena::io::YAMLDocWriter& __dna_docout) const
{
IScriptObject::write(__dna_docout);
/* name */
@ -566,7 +566,7 @@ struct Ridley : IScriptObject
static const char* DNAType()
{
return "Retro::DNAMP1::Ridley";
return "urde::DNAMP1::Ridley";
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,

View File

@ -41,7 +41,7 @@ struct WorldTeleporter : IScriptObject
Value<float> unknown15;
Value<float> unknown16;
void read(Athena::io::IStreamReader& __dna_reader)
void read(athena::io::IStreamReader& __dna_reader)
{
IScriptObject::read(__dna_reader);
/* name */
@ -104,7 +104,7 @@ struct WorldTeleporter : IScriptObject
}
}
void write(Athena::io::IStreamWriter& __dna_writer) const
void write(athena::io::IStreamWriter& __dna_writer) const
{
IScriptObject::write(__dna_writer);
/* name */
@ -160,7 +160,7 @@ struct WorldTeleporter : IScriptObject
}
}
void read(Athena::io::YAMLDocReader& __dna_docin)
void read(athena::io::YAMLDocReader& __dna_docin)
{
IScriptObject::read(__dna_docin);
/* name */
@ -223,7 +223,7 @@ struct WorldTeleporter : IScriptObject
}
}
void write(Athena::io::YAMLDocWriter& __dna_docout) const
void write(athena::io::YAMLDocWriter& __dna_docout) const
{
IScriptObject::write(__dna_docout);
/* name */
@ -281,7 +281,7 @@ struct WorldTeleporter : IScriptObject
static const char* DNAType()
{
return "Retro::DNAMP1::WorldTeleporter";
return "urde::DNAMP1::WorldTeleporter";
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const

View File

@ -15,7 +15,7 @@ struct CTweakGame : ITweakGame
String<-1> m_ruinsArea; // ????
virtual const std::string& GetWorldPrefix() const { return m_worldPrefix; }
CTweakGame(Athena::io::IStreamReader& in) { this->read(in); }
CTweakGame(athena::io::IStreamReader& in) { this->read(in); }
};
}
}

View File

@ -15,7 +15,7 @@ struct CTweakParticle : ITweakParticle
String<-1> m_powerBeam;
String<-1> m_genThrust;
CTweakParticle(Athena::io::IStreamReader& reader) { this->read(reader); }
CTweakParticle(athena::io::IStreamReader& reader) { this->read(reader); }
};
}

View File

@ -15,7 +15,7 @@ struct CTweakPlayer : ITweakPlayer
Value<float> m_rightDiv;
float GetLeftLogicalThreshold() const {return m_leftDiv;}
float GetRightLogicalThreshold() const {return m_rightDiv;}
CTweakPlayer(Athena::io::IStreamReader& reader) {this->read(reader);}
CTweakPlayer(athena::io::IStreamReader& reader) {this->read(reader);}
};
}

View File

@ -13,7 +13,7 @@ struct CTweakPlayerControl : ITweakPlayerControl
DECL_YAML
Vector<atUint32, DNA_COUNT(65)> m_mappings;
atUint32 GetMapping(atUint32 command) const {return m_mappings[command];}
CTweakPlayerControl(Athena::io::IStreamReader& reader) {this->read(reader);}
CTweakPlayerControl(athena::io::IStreamReader& reader) {this->read(reader);}
};
}

View File

@ -5,7 +5,7 @@ namespace DataSpec
namespace DNAMP2
{
void ANCS::CharacterSet::CharacterInfo::read(Athena::io::IStreamReader& reader)
void ANCS::CharacterSet::CharacterInfo::read(athena::io::IStreamReader& reader)
{
idx = reader.readUint32Big();
atUint16 sectionCount = reader.readUint16Big();
@ -78,7 +78,7 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::IStreamReader& reader)
}
}
void ANCS::CharacterSet::CharacterInfo::write(Athena::io::IStreamWriter& writer) const
void ANCS::CharacterSet::CharacterInfo::write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(idx);
@ -238,7 +238,7 @@ size_t ANCS::CharacterSet::CharacterInfo::binarySize(size_t __isz) const
return __isz;
}
void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader)
void ANCS::CharacterSet::CharacterInfo::read(athena::io::YAMLDocReader& reader)
{
idx = reader.readUint32("idx");
atUint16 sectionCount = reader.readUint16("sectionCount");
@ -298,7 +298,7 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader)
}
}
void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer) const
void ANCS::CharacterSet::CharacterInfo::write(athena::io::YAMLDocWriter& writer) const
{
writer.writeUint32("idx", idx);
@ -373,10 +373,10 @@ void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer)
const char* ANCS::CharacterSet::CharacterInfo::DNAType()
{
return "Retro::DNAMP2::ANCS::CharacterSet::CharacterInfo";
return "urde::DNAMP2::ANCS::CharacterSet::CharacterInfo";
}
void ANCS::AnimationSet::read(Athena::io::IStreamReader& reader)
void ANCS::AnimationSet::read(athena::io::IStreamReader& reader)
{
atUint16 sectionCount = reader.readUint16Big();
@ -411,7 +411,7 @@ void ANCS::AnimationSet::read(Athena::io::IStreamReader& reader)
}
}
void ANCS::AnimationSet::write(Athena::io::IStreamWriter& writer) const
void ANCS::AnimationSet::write(athena::io::IStreamWriter& writer) const
{
atUint16 sectionCount;
if (evnts.size())
@ -494,7 +494,7 @@ size_t ANCS::AnimationSet::binarySize(size_t __isz) const
return __isz;
}
void ANCS::AnimationSet::read(Athena::io::YAMLDocReader& reader)
void ANCS::AnimationSet::read(athena::io::YAMLDocReader& reader)
{
atUint16 sectionCount = reader.readUint16("sectionCount");
@ -524,7 +524,7 @@ void ANCS::AnimationSet::read(Athena::io::YAMLDocReader& reader)
}
}
void ANCS::AnimationSet::write(Athena::io::YAMLDocWriter& writer) const
void ANCS::AnimationSet::write(athena::io::YAMLDocWriter& writer) const
{
atUint16 sectionCount;
if (evnts.size())
@ -538,16 +538,13 @@ void ANCS::AnimationSet::write(Athena::io::YAMLDocWriter& writer) const
writer.writeUint16("sectionCount", sectionCount);
writer.writeUint32("animationCount", animations.size());
writer.enumerate("animations", animations);
writer.writeUint32("transitionCount", transitions.size());
writer.enumerate("transitions", transitions);
writer.enumerate("defaultTransition", defaultTransition);
if (sectionCount > 1)
{
writer.writeUint32("additiveAnimCount", additiveAnims.size());
writer.enumerate("additiveAnims", additiveAnims);
writer.writeFloat("floatA", floatA);
writer.writeFloat("floatB", floatB);
@ -555,23 +552,21 @@ void ANCS::AnimationSet::write(Athena::io::YAMLDocWriter& writer) const
if (sectionCount > 2)
{
writer.writeUint32("halfTransitionCount", halfTransitions.size());
writer.enumerate("halfTransitions", halfTransitions);
}
if (sectionCount > 3)
{
writer.writeUint32("evntsCount", evnts.size());
writer.enumerate("evnts", evnts);
}
}
const char* ANCS::AnimationSet::DNAType()
{
return "Retro::DNAMP2::ANCS::AnimationSet";
return "urde::DNAMP2::ANCS::AnimationSet";
}
void ANCS::AnimationSet::EVNT::read(Athena::io::IStreamReader& reader)
void ANCS::AnimationSet::EVNT::read(athena::io::IStreamReader& reader)
{
version = reader.readUint32Big();
@ -592,7 +587,7 @@ void ANCS::AnimationSet::EVNT::read(Athena::io::IStreamReader& reader)
reader.enumerate(sfxEvents, sfxCount);
}
void ANCS::AnimationSet::EVNT::write(Athena::io::IStreamWriter& writer) const
void ANCS::AnimationSet::EVNT::write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(version);
@ -634,7 +629,7 @@ size_t ANCS::AnimationSet::EVNT::binarySize(size_t __isz) const
return __isz;
}
void ANCS::AnimationSet::EVNT::read(Athena::io::YAMLDocReader& reader)
void ANCS::AnimationSet::EVNT::read(athena::io::YAMLDocReader& reader)
{
version = reader.readUint32("version");
@ -651,7 +646,7 @@ void ANCS::AnimationSet::EVNT::read(Athena::io::YAMLDocReader& reader)
reader.enumerate("sfxEvents", sfxEvents);
}
void ANCS::AnimationSet::EVNT::write(Athena::io::YAMLDocWriter& writer) const
void ANCS::AnimationSet::EVNT::write(athena::io::YAMLDocWriter& writer) const
{
writer.writeUint32("version", version);
@ -669,7 +664,7 @@ void ANCS::AnimationSet::EVNT::write(Athena::io::YAMLDocWriter& writer) const
const char* ANCS::AnimationSet::EVNT::DNAType()
{
return "Retro::DNAMP2::ANCS::AnimationSet::EVNT";
return "urde::DNAMP2::ANCS::AnimationSet::EVNT";
}
}

View File

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

View File

@ -5,9 +5,9 @@ namespace DataSpec
namespace DNAMP2
{
using ANIMOutStream = HECL::BlenderConnection::PyOutStream::ANIMOutStream;
using ANIMOutStream = hecl::BlenderConnection::PyOutStream::ANIMOutStream;
void ANIM::IANIM::sendANIMToBlender(HECL::BlenderConnection::PyOutStream& os, const CINF& cinf) const
void ANIM::IANIM::sendANIMToBlender(hecl::BlenderConnection::PyOutStream& os, const CINF& cinf) const
{
os.format("act.hecl_fps = round(%f)\n", (1.0f / mainInterval));
@ -92,7 +92,7 @@ void ANIM::IANIM::sendANIMToBlender(HECL::BlenderConnection::PyOutStream& os, co
}
}
void ANIM::ANIM0::read(Athena::io::IStreamReader& reader)
void ANIM::ANIM0::read(athena::io::IStreamReader& reader)
{
Header head;
head.read(reader);
@ -215,7 +215,7 @@ void ANIM::ANIM0::read(Athena::io::IStreamReader& reader)
}
}
void ANIM::ANIM0::write(Athena::io::IStreamWriter& writer) const
void ANIM::ANIM0::write(athena::io::IStreamWriter& writer) const
{
Header head;
head.unk0 = 0;
@ -372,7 +372,7 @@ size_t ANIM::ANIM0::binarySize(size_t __isz) const
return __isz;
}
void ANIM::ANIM2::read(Athena::io::IStreamReader& reader)
void ANIM::ANIM2::read(athena::io::IStreamReader& reader)
{
Header head;
head.read(reader);
@ -450,7 +450,7 @@ void ANIM::ANIM2::read(Athena::io::IStreamReader& reader)
chanKeys = bsReader.read(bsData.get(), keyframeCount, channels, head.rotDiv, head.translationMult);
}
void ANIM::ANIM2::write(Athena::io::IStreamWriter& writer) const
void ANIM::ANIM2::write(athena::io::IStreamWriter& writer) const
{
Header head;
head.unk1 = 1;

View File

@ -27,7 +27,7 @@ struct ANIM : BigDNA
std::vector<std::vector<DNAANIM::Value>> chanKeys;
float mainInterval = 0.0;
void sendANIMToBlender(HECL::BlenderConnection::PyOutStream&, const CINF&) const;
void sendANIMToBlender(hecl::BlenderConnection::PyOutStream&, const CINF&) const;
};
struct ANIM0 : IANIM
@ -97,7 +97,7 @@ struct ANIM : BigDNA
Value<atUint16> initSZ = 0;
Value<atUint8> qSZ = 0;
void read(Athena::io::IStreamReader& reader)
void read(athena::io::IStreamReader& reader)
{
id = reader.readUByte();
keyCount1 = reader.readUint16Big();
@ -131,7 +131,7 @@ struct ANIM : BigDNA
qSZ = reader.readUByte();
}
}
void write(Athena::io::IStreamWriter& writer) const
void write(athena::io::IStreamWriter& writer) const
{
writer.writeUByte(id);
writer.writeUint16Big(keyCount1);
@ -180,7 +180,7 @@ struct ANIM : BigDNA
};
std::unique_ptr<IANIM> m_anim;
void read(Athena::io::IStreamReader& reader)
void read(athena::io::IStreamReader& reader)
{
atUint32 version = reader.readUint32Big();
switch (version)
@ -194,12 +194,12 @@ struct ANIM : BigDNA
m_anim->read(reader);
break;
default:
Log.report(LogVisor::FatalError, "unrecognized ANIM version");
Log.report(logvisor::Fatal, "unrecognized ANIM version");
break;
}
}
void write(Athena::io::IStreamWriter& writer) const
void write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(m_anim->m_version);
m_anim->write(writer);
@ -210,7 +210,7 @@ struct ANIM : BigDNA
return m_anim->binarySize(__isz + 4);
}
void sendANIMToBlender(HECL::BlenderConnection::PyOutStream& os, const CINF& cinf, bool) const
void sendANIMToBlender(hecl::BlenderConnection::PyOutStream& os, const CINF& cinf, bool) const
{
m_anim->sendANIMToBlender(os, cinf);
}

View File

@ -57,7 +57,7 @@ struct CINF : BigDNA
return nullptr;
}
void sendVertexGroupsToBlender(HECL::BlenderConnection::PyOutStream& os) const
void sendVertexGroupsToBlender(hecl::BlenderConnection::PyOutStream& os) const
{
for (atUint32 bid : boneIds)
{
@ -72,7 +72,7 @@ struct CINF : BigDNA
}
}
void sendCINFToBlender(HECL::BlenderConnection::PyOutStream& os, const UniqueID32& cinfId) const
void sendCINFToBlender(hecl::BlenderConnection::PyOutStream& os, const UniqueID32& cinfId) const
{
os.format("arm = bpy.data.armatures.new('CINF_%08X')\n"
"arm_obj = bpy.data.objects.new(arm.name, arm)\n"

View File

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

View File

@ -59,15 +59,15 @@ struct MaterialSet : BigDNA
};
Vector<Material, DNA_COUNT(head.materialCount)> materials;
static void RegisterMaterialProps(HECL::BlenderConnection::PyOutStream& out)
static void RegisterMaterialProps(hecl::BlenderConnection::PyOutStream& out)
{
DNAMP1::MaterialSet::RegisterMaterialProps(out);
}
static void ConstructMaterial(HECL::BlenderConnection::PyOutStream& out,
static void ConstructMaterial(hecl::BlenderConnection::PyOutStream& out,
const MaterialSet::Material& material,
unsigned groupIdx, unsigned matIdx);
void readToBlender(HECL::BlenderConnection::PyOutStream& os,
void readToBlender(hecl::BlenderConnection::PyOutStream& os,
const PAKRouter<PAKBridge>& pakRouter,
const PAKRouter<PAKBridge>::EntryType& entry,
unsigned setIdx)

View File

@ -20,7 +20,7 @@ struct CSKR : DNAMP1::CSKR
return nullptr;
}
void weightVertex(HECL::BlenderConnection::PyOutStream& os, const CINF& cinf, atUint32 idx) const
void weightVertex(hecl::BlenderConnection::PyOutStream& os, const CINF& cinf, atUint32 idx) const
{
atUint32 accum = 0;
for (const SkinningRule& rule : skinningRules)

View File

@ -13,7 +13,7 @@ namespace DataSpec
{
namespace DNAMP2
{
LogVisor::LogModule Log("Retro::DNAMP2");
logvisor::Module Log("urde::DNAMP2");
static bool GetNoShare(const std::string& name)
{
@ -24,12 +24,12 @@ static bool GetNoShare(const std::string& name)
return true;
}
PAKBridge::PAKBridge(HECL::Database::Project& project,
const NOD::Node& node,
PAKBridge::PAKBridge(hecl::Database::Project& project,
const nod::Node& node,
bool doExtract)
: m_project(project), m_node(node), m_pak(true, GetNoShare(node.getName())), m_doExtract(doExtract)
{
NOD::AthenaPartReadStream rs(node.beginReadStream());
nod::AthenaPartReadStream rs(node.beginReadStream());
m_pak.read(rs);
/* Append Level String */
@ -54,12 +54,12 @@ PAKBridge::PAKBridge(HECL::Database::Project& project,
}
}
static HECL::SystemString LayerName(const std::string& name)
static hecl::SystemString LayerName(const std::string& name)
{
#if HECL_UCS2
HECL::SystemString ret = HECL::UTF8ToWide(name);
hecl::SystemString ret = hecl::UTF8ToWide(name);
#else
HECL::SystemString ret = name;
hecl::SystemString ret = name;
#endif
for (auto& ch : ret)
if (ch == _S('/') || ch == _S('\\'))
@ -83,7 +83,7 @@ void PAKBridge::build()
}
bool named;
#if HECL_UCS2
level.name = HECL::UTF8ToWide(m_pak.bestEntryName(entry, named));
level.name = hecl::UTF8ToWide(m_pak.bestEntryName(entry));
#else
level.name = m_pak.bestEntryName(entry, named);
#endif
@ -96,7 +96,7 @@ void PAKBridge::build()
if (worldMapEnt)
{
PAKEntryReadStream rs = worldMapEnt->beginReadStream(m_node);
rs.seek(8, Athena::Current);
rs.seek(8, athena::Current);
atUint32 areaCount = rs.readUint32Big();
mapw.reserve(areaCount);
for (atUint32 i=0 ; i<areaCount ; ++i)
@ -131,21 +131,21 @@ void PAKBridge::build()
if (areaDeps.name.empty())
{
#if HECL_UCS2
areaDeps.name = HECL::UTF8ToWide(area.internalAreaName);
areaDeps.name = hecl::UTF8ToWide(area.internalAreaName);
#else
areaDeps.name = area.internalAreaName;
#endif
if (areaDeps.name.empty())
{
#if HECL_UCS2
areaDeps.name = _S("MREA_") + HECL::UTF8ToWide(area.areaMREAId.toString());
areaDeps.name = _S("MREA_") + hecl::UTF8ToWide(area.areaMREAId.toString());
#else
areaDeps.name = "MREA_" + area.areaMREAId.toString();
#endif
}
}
HECL::SystemChar num[16];
HECL::SNPrintf(num, 16, _S("%02u "), ai);
hecl::SystemChar num[16];
hecl::SNPrintf(num, 16, _S("%02u "), ai);
areaDeps.name = num + areaDeps.name;
areaDeps.layers.reserve(area.depLayerCount-1);
@ -164,7 +164,7 @@ void PAKBridge::build()
while (layer.name.size() && isspace(layer.name.back()))
layer.name.pop_back();
#endif
HECL::SNPrintf(num, 16, layer.active ? _S("%02ua ") : _S("%02u "), l-1);
hecl::SNPrintf(num, 16, layer.active ? _S("%02ua ") : _S("%02u "), l-1);
layer.name = num + layer.name;
layer.resources.reserve(area.depLayers[l] - r);

View File

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

View File

@ -65,11 +65,11 @@ struct DeafBabe : BigDNA
Value<atUint32> vertCount;
Vector<atVec3f, DNA_COUNT(vertCount)> verts;
static void BlenderInit(HECL::BlenderConnection::PyOutStream& os)
static void BlenderInit(hecl::BlenderConnection::PyOutStream& os)
{
DNAMP1::DeafBabe::BlenderInit(os);
}
void insertNoClimb(HECL::BlenderConnection::PyOutStream& os) const
void insertNoClimb(hecl::BlenderConnection::PyOutStream& os) const
{
for (atInt16 edgeIdx : noClimbEdges)
{
@ -82,7 +82,7 @@ struct DeafBabe : BigDNA
edge.verts[0], edge.verts[1]);
}
}
void sendToBlender(HECL::BlenderConnection::PyOutStream& os) const
void sendToBlender(hecl::BlenderConnection::PyOutStream& os) const
{
DeafBabeSendToBlender(os, *this);
}

View File

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

View File

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

View File

@ -1,4 +1,4 @@
#include <Athena/FileWriter.hpp>
#include <athena/FileWriter.hpp>
#include <lzo/lzo1x.h>
#include "MREA.hpp"
#include "../DNAMP1/MREA.hpp"
@ -13,7 +13,7 @@ namespace DNAMP2
void MREA::StreamReader::nextBlock()
{
if (m_nextBlk >= m_blkCount)
Log.report(LogVisor::FatalError, "MREA stream overrun");
Log.report(logvisor::Fatal, "MREA stream overrun");
BlockInfo& info = m_blockInfos[m_nextBlk++];
@ -68,7 +68,7 @@ void MREA::StreamReader::nextBlock()
m_blkSz = info.decompSize;
}
MREA::StreamReader::StreamReader(Athena::io::IStreamReader& source, atUint32 blkCount)
MREA::StreamReader::StreamReader(athena::io::IStreamReader& source, atUint32 blkCount)
: m_compBufSz(0x4120), m_compBuf(new atUint8[0x4120]),
m_decompBufSz(0x4120), m_decompBuf(new atUint8[0x4120]),
m_source(source), m_blkCount(blkCount)
@ -86,16 +86,16 @@ MREA::StreamReader::StreamReader(Athena::io::IStreamReader& source, atUint32 blk
nextBlock();
}
void MREA::StreamReader::seek(atInt64 diff, Athena::SeekOrigin whence)
void MREA::StreamReader::seek(atInt64 diff, athena::SeekOrigin whence)
{
atUint64 target = diff;
if (whence == Athena::Current)
if (whence == athena::Current)
target = m_pos + diff;
else if (whence == Athena::End)
else if (whence == athena::End)
target = m_totalDecompLen - diff;
if (target >= m_totalDecompLen)
Log.report(LogVisor::FatalError, "MREA stream seek overrun");
Log.report(logvisor::Fatal, "MREA stream seek overrun");
/* Determine which block contains position */
atUint32 dAccum = 0;
@ -117,7 +117,7 @@ void MREA::StreamReader::seek(atInt64 diff, Athena::SeekOrigin whence)
/* Seek source if needed */
if (bIdx != m_nextBlk-1)
{
m_source.seek(m_blkBase + cAccum, Athena::Begin);
m_source.seek(m_blkBase + cAccum, athena::Begin);
m_nextBlk = bIdx;
nextBlock();
}
@ -147,7 +147,7 @@ atUint64 MREA::StreamReader::readUBytesToBuf(void* buf, atUint64 len)
return len;
}
void MREA::StreamReader::writeDecompInfos(Athena::io::IStreamWriter& writer) const
void MREA::StreamReader::writeDecompInfos(athena::io::IStreamWriter& writer) const
{
for (const BlockInfo& info : m_blockInfos)
{
@ -159,18 +159,18 @@ void MREA::StreamReader::writeDecompInfos(Athena::io::IStreamWriter& writer) con
bool MREA::Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const DNAMP1::PAK::Entry& entry,
bool force,
std::function<void(const HECL::SystemChar*)>)
std::function<void(const hecl::SystemChar*)>)
{
using RigPair = std::pair<CSKR*, CINF*>;
RigPair dummy(nullptr, nullptr);
/* Rename MREA for consistency */
HECL::ProjectPath mreaPath(outPath.getParentPath(), _S("!area.blend"));
if (!force && mreaPath.getPathType() == HECL::ProjectPath::Type::File)
hecl::ProjectPath mreaPath(outPath.getParentPath(), _S("!area.blend"));
if (!force && mreaPath.getPathType() == hecl::ProjectPath::Type::File)
return true;
/* Do extract */
@ -180,7 +180,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* MREA decompression stream */
StreamReader drs(rs, head.compressedBlockCount);
Athena::io::FileWriter mreaDecompOut(pakRouter.getCooked(&entry).getWithExtension(_S(".decomp")).getAbsolutePath());
athena::io::FileWriter mreaDecompOut(pakRouter.getCooked(&entry).getWithExtension(_S(".decomp")).getAbsolutePath());
head.write(mreaDecompOut);
mreaDecompOut.seekAlign32();
drs.writeDecompInfos(mreaDecompOut);
@ -188,11 +188,11 @@ bool MREA::Extract(const SpecBase& dataSpec,
atUint64 decompLen = drs.length();
mreaDecompOut.writeBytes(drs.readBytes(decompLen).get(), decompLen);
mreaDecompOut.close();
drs.seek(0, Athena::Begin);
drs.seek(0, athena::Begin);
/* Start up blender connection */
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
if (!conn.createBlend(mreaPath, HECL::BlenderConnection::BlendType::Area))
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
if (!conn.createBlend(mreaPath, hecl::BlenderConnection::BlendType::Area))
return false;
/* Calculate offset to EGMC section */
@ -201,15 +201,15 @@ bool MREA::Extract(const SpecBase& dataSpec,
egmcOffset += head.secSizes[i];
/* Load EGMC if possible so we can assign meshes to scanIds */
drs.seek(egmcOffset, Athena::Begin);
drs.seek(egmcOffset, athena::Begin);
UniqueID32 egmcId(drs);
DNACommon::EGMC egmc;
bool hasEGMC = pakRouter.lookupAndReadDNA(egmcId, egmc);
drs.seek(0, Athena::Begin);
drs.seek(0, athena::Begin);
/* Open Py Stream and read sections */
HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"from mathutils import Vector\n"
@ -241,7 +241,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
atUint64 secStart = drs.position();
matSet.read(drs);
matSet.readToBlender(os, pakRouter, entry, 0);
drs.seek(secStart + head.secSizes[0], Athena::Begin);
drs.seek(secStart + head.secSizes[0], athena::Begin);
std::vector<DNACMDL::VertexAttributes> vertAttribs;
DNACMDL::GetVertexAttributes(matSet, vertAttribs);
@ -252,7 +252,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
MeshHeader mHeader;
secStart = drs.position();
mHeader.read(drs);
drs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
drs.seek(secStart + head.secSizes[curSec++], athena::Begin);
curSec += DNACMDL::ReadGeomSectionsToBlender<PAKRouter<PAKBridge>, MaterialSet, RigPair, DNACMDL::SurfaceHeader_2>
(os, drs, pakRouter, entry, dummy, true,
true, vertAttribs, m, head.secCount, 0, &head.secSizes[curSec]);
@ -266,25 +266,25 @@ bool MREA::Extract(const SpecBase& dataSpec,
mHeader.visorFlags.thermalLevelStr());
/* Seek through AROT-relation sections */
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
}
/* Skip AROT */
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
/* Skip BVH */
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
/* Skip Bitmap */
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
/* Skip SCLY (for now) */
for (atUint32 l=0 ; l<head.sclyLayerCount ; ++l)
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
/* Skip SCGN (for now) */
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
/* Read collision meshes */
DeafBabe collision;
@ -292,15 +292,15 @@ bool MREA::Extract(const SpecBase& dataSpec,
collision.read(drs);
DeafBabe::BlenderInit(os);
collision.sendToBlender(os);
drs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
drs.seek(secStart + head.secSizes[curSec++], athena::Begin);
/* Skip unknown section */
drs.seek(head.secSizes[curSec++], Athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
/* Read BABEDEAD Lights as Cycles emissives */
secStart = drs.position();
DNAMP1::MREA::ReadBabeDeadToBlender_1_2(os, drs);
drs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
drs.seek(secStart + head.secSizes[curSec++], athena::Begin);
/* Origins to center of mass */
os << "bpy.context.scene.layers[1] = True\n"

View File

@ -12,7 +12,7 @@ namespace DNAMP2
struct MREA
{
class StreamReader : public Athena::io::IStreamReader
class StreamReader : public athena::io::IStreamReader
{
protected:
struct BlockInfo : BigDNA
@ -29,7 +29,7 @@ struct MREA
std::unique_ptr<atUint8[]> m_compBuf;
size_t m_decompBufSz;
std::unique_ptr<atUint8[]> m_decompBuf;
Athena::io::IStreamReader& m_source;
athena::io::IStreamReader& m_source;
atUint64 m_blkBase;
atUint32 m_blkCount;
atUint32 m_totalDecompLen = 0;
@ -40,18 +40,18 @@ struct MREA
atUint32 m_blkSz = 0;
void nextBlock();
StreamReader(Athena::io::IStreamReader& source)
StreamReader(athena::io::IStreamReader& source)
: m_compBufSz(0x4120), m_compBuf(new atUint8[0x4120]),
m_decompBufSz(0x4120), m_decompBuf(new atUint8[0x4120]),
m_source(source) {} /* Empty constructor for inheriting */
public:
StreamReader(Athena::io::IStreamReader& source, atUint32 blkCount);
void seek(atInt64 diff, Athena::SeekOrigin whence);
StreamReader(athena::io::IStreamReader& source, atUint32 blkCount);
void seek(atInt64 diff, athena::SeekOrigin whence);
atUint64 position() const {return m_pos;}
atUint64 length() const {return m_totalDecompLen;}
atUint64 readUBytesToBuf(void* buf, atUint64 len);
void writeDecompInfos(Athena::io::IStreamWriter& writer) const;
void writeDecompInfos(athena::io::IStreamWriter& writer) const;
};
struct Header : BigDNA
@ -75,7 +75,7 @@ struct MREA
Value<atUint32> unk3SecIdx;
Value<atUint32> egmcSecIdx;
Value<atUint32> compressedBlockCount;
Seek<12, Athena::Current> align1;
Seek<12, athena::Current> align1;
Vector<atUint32, DNA_COUNT(secCount)> secSizes;
};
@ -119,11 +119,11 @@ struct MREA
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const DNAMP1::PAK::Entry& entry,
bool,
std::function<void(const HECL::SystemChar*)>);
std::function<void(const hecl::SystemChar*)>);
};
}

View File

@ -3,7 +3,7 @@
#include "../DNAMP1/PAK.hpp"
namespace Retro
namespace urde
{
namespace DNAMP2
{

View File

@ -6,7 +6,7 @@ namespace DataSpec
namespace DNAMP2
{
void STRG::_read(Athena::io::IStreamReader& reader)
void STRG::_read(athena::io::IStreamReader& reader)
{
atUint32 langCount = reader.readUint32Big();
atUint32 strCount = reader.readUint32Big();
@ -32,8 +32,8 @@ void STRG::_read(Athena::io::IStreamReader& reader)
}* nameIndex = (NameIdxEntry*)nameTableBuf.get();
for (atUint32 n=0 ; n<nameCount ; ++n)
{
const char* name = (char*)(nameTableBuf.get() + HECL::SBig(nameIndex[n].nameOff));
names[name] = HECL::SBig(nameIndex[n].strIdx);
const char* name = (char*)(nameTableBuf.get() + hecl::SBig(nameIndex[n].nameOff));
names[name] = hecl::SBig(nameIndex[n].strIdx);
}
langs.clear();
@ -53,20 +53,20 @@ void STRG::_read(Athena::io::IStreamReader& reader)
langMap.emplace(item.first, &item.second);
}
void STRG::read(Athena::io::IStreamReader& reader)
void STRG::read(athena::io::IStreamReader& reader)
{
atUint32 magic = reader.readUint32Big();
if (magic != 0x87654321)
Log.report(LogVisor::Error, "invalid STRG magic");
Log.report(logvisor::Error, "invalid STRG magic");
atUint32 version = reader.readUint32Big();
if (version != 1)
Log.report(LogVisor::Error, "invalid STRG version");
Log.report(logvisor::Error, "invalid STRG version");
_read(reader);
}
void STRG::write(Athena::io::IStreamWriter& writer) const
void STRG::write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(0x87654321);
writer.writeUint32Big(1);
@ -166,9 +166,9 @@ size_t STRG::binarySize(size_t __isz) const
return __isz;
}
void STRG::read(Athena::io::YAMLDocReader& reader)
void STRG::read(athena::io::YAMLDocReader& reader)
{
const Athena::io::YAMLNode* root = reader.getRootNode();
const athena::io::YAMLNode* root = reader.getRootNode();
/* Validate Pass */
if (root->m_type == YAML_MAPPING_NODE)
@ -179,19 +179,19 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
continue;
if (lang.first.size() != 4)
{
Log.report(LogVisor::Warning, "STRG language string '%s' must be exactly 4 characters; skipping", lang.first.c_str());
Log.report(logvisor::Warning, "STRG language string '%s' must be exactly 4 characters; skipping", lang.first.c_str());
return;
}
if (lang.second->m_type != YAML_SEQUENCE_NODE)
{
Log.report(LogVisor::Warning, "STRG language string '%s' must contain a sequence; skipping", lang.first.c_str());
Log.report(logvisor::Warning, "STRG language string '%s' must contain a sequence; skipping", lang.first.c_str());
return;
}
for (const auto& str : lang.second->m_seqChildren)
{
if (str->m_type != YAML_SCALAR_NODE)
{
Log.report(LogVisor::Warning, "STRG language '%s' must contain all scalars; skipping", lang.first.c_str());
Log.report(logvisor::Warning, "STRG language '%s' must contain all scalars; skipping", lang.first.c_str());
return;
}
}
@ -199,7 +199,7 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
}
else
{
Log.report(LogVisor::Warning, "STRG must have a mapping root node; skipping");
Log.report(logvisor::Warning, "STRG must have a mapping root node; skipping");
return;
}
@ -209,15 +209,15 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
{
std::vector<std::wstring> strs;
for (const auto& str : lang.second->m_seqChildren)
strs.emplace_back(HECL::UTF8ToWide(str->m_scalarString));
strs.emplace_back(hecl::UTF8ToWide(str->m_scalarString));
langs.emplace_back(FourCC(lang.first.c_str()), strs);
}
names.clear();
const Athena::io::YAMLNode* namesNode = root->findMapChild("names");
const athena::io::YAMLNode* namesNode = root->findMapChild("names");
if (namesNode)
for (const auto& item : namesNode->m_mapChildren)
names[item.first] = Athena::io::NodeToVal<atInt32>(item.second.get());
names[item.first] = athena::io::NodeToVal<atInt32>(item.second.get());
langMap.clear();
langMap.reserve(langs.size());
@ -225,7 +225,7 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
langMap.emplace(item.first, &item.second);
}
void STRG::write(Athena::io::YAMLDocWriter& writer) const
void STRG::write(athena::io::YAMLDocWriter& writer) const
{
for (const auto& lang : langs)
{
@ -249,7 +249,7 @@ void STRG::write(Athena::io::YAMLDocWriter& writer) const
const char* STRG::DNAType()
{
return "Retro::DNAMP2::STRG";
return "urde::DNAMP2::STRG";
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More