mirror of https://github.com/AxioDL/metaforce.git
Humungous refactor
This commit is contained in:
parent
552ec1db4a
commit
783fb4c4fe
|
@ -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)
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace DataSpec
|
|||
namespace DNAANCS
|
||||
{
|
||||
|
||||
using Actor = HECL::BlenderConnection::DataStream::Actor;
|
||||
using Actor = hecl::BlenderConnection::DataStream::Actor;
|
||||
|
||||
template <typename IDTYPE>
|
||||
struct CharacterResInfo
|
||||
|
@ -20,7 +20,7 @@ struct CharacterResInfo
|
|||
IDTYPE cmdl;
|
||||
IDTYPE cskr;
|
||||
IDTYPE cinf;
|
||||
std::vector<std::pair<HECL::FourCC, std::pair<IDTYPE, IDTYPE>>> overlays;
|
||||
std::vector<std::pair<hecl::FourCC, std::pair<IDTYPE, IDTYPE>>> overlays;
|
||||
};
|
||||
|
||||
template <typename IDTYPE>
|
||||
|
@ -33,13 +33,13 @@ struct AnimationResInfo
|
|||
};
|
||||
|
||||
template <class PAKRouter, class ANCSDNA, class MaterialSet, class SurfaceHeader, atUint32 CMDLVersion>
|
||||
bool ReadANCSToBlender(HECL::BlenderConnection& conn,
|
||||
bool ReadANCSToBlender(hecl::BlenderConnection& conn,
|
||||
const ANCSDNA& ancs,
|
||||
const HECL::ProjectPath& outPath,
|
||||
const hecl::ProjectPath& outPath,
|
||||
PAKRouter& pakRouter,
|
||||
const typename PAKRouter::EntryType& entry,
|
||||
const SpecBase& dataspec,
|
||||
std::function<void(const HECL::SystemChar*)> fileChanged,
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged,
|
||||
bool force=false)
|
||||
{
|
||||
/* Extract character CMDL/CSKR first */
|
||||
|
@ -47,17 +47,18 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
|
|||
ancs.getCharacterResInfo(chResInfo);
|
||||
for (const auto& info : chResInfo)
|
||||
{
|
||||
const NOD::Node* node;
|
||||
const nod::Node* node;
|
||||
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(info.cmdl, &node, true, true);
|
||||
if (cmdlE)
|
||||
{
|
||||
HECL::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
if (force || cmdlPath.getPathType() == HECL::ProjectPath::Type::None)
|
||||
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
if (force || cmdlPath.getPathType() == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
if (!conn.createBlend(cmdlPath, HECL::BlenderConnection::BlendType::Mesh))
|
||||
if (!conn.createBlend(cmdlPath, hecl::BlenderConnection::BlendType::Mesh))
|
||||
return false;
|
||||
|
||||
HECL::SystemStringView bestNameView(pakRouter.getBestEntryName(*cmdlE));
|
||||
std::string bestName = pakRouter.getBestEntryName(*cmdlE);
|
||||
hecl::SystemStringView bestNameView(bestName);
|
||||
fileChanged(bestNameView.sys_str().c_str());
|
||||
|
||||
typename ANCSDNA::CSKRType cskr;
|
||||
|
@ -76,13 +77,14 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
|
|||
}
|
||||
}
|
||||
|
||||
HECL::SystemStringView bestNameView(pakRouter.getBestEntryName(entry));
|
||||
std::string bestName = pakRouter.getBestEntryName(entry);
|
||||
hecl::SystemStringView bestNameView(bestName);
|
||||
fileChanged(bestNameView.sys_str().c_str());
|
||||
|
||||
/* Establish ANCS blend */
|
||||
if (!conn.createBlend(outPath, HECL::BlenderConnection::BlendType::Actor))
|
||||
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::Actor))
|
||||
return false;
|
||||
HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||
|
||||
os.format("import bpy\n"
|
||||
"from mathutils import Vector\n"
|
||||
|
@ -125,7 +127,7 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
|
|||
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(info.cmdl, nullptr, true, true);
|
||||
if (cmdlE)
|
||||
{
|
||||
HECL::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
os.linkBlend(cmdlPath.getAbsolutePathUTF8().c_str(),
|
||||
pakRouter.getBestEntryName(*cmdlE).c_str(), true);
|
||||
|
||||
|
@ -147,7 +149,7 @@ bool ReadANCSToBlender(HECL::BlenderConnection& conn,
|
|||
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(overlay.second.first, nullptr, true, true);
|
||||
if (cmdlE)
|
||||
{
|
||||
HECL::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
os.linkBlend(cmdlPath.getAbsolutePathUTF8().c_str(),
|
||||
pakRouter.getBestEntryName(*cmdlE).c_str(), true);
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#include "zeus/Math.hpp"
|
||||
#include "ANIM.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
|
@ -39,50 +38,50 @@ size_t ComputeBitstreamSize(size_t keyFrameCount, const std::vector<Channel>& ch
|
|||
|
||||
static inline QuantizedRot QuantizeRotation(const Value& quat, atUint32 div)
|
||||
{
|
||||
float q = M_PI / 2.0 / div;
|
||||
float q = M_PI / 2.0f / float(div);
|
||||
return
|
||||
{
|
||||
{
|
||||
atInt16(asinf(quat.v4.vec[1]) / q),
|
||||
atInt16(asinf(quat.v4.vec[2]) / q),
|
||||
atInt16(asinf(quat.v4.vec[3]) / q),
|
||||
atInt16(std::asin(quat.v4.vec[1]) / q),
|
||||
atInt16(std::asin(quat.v4.vec[2]) / q),
|
||||
atInt16(std::asin(quat.v4.vec[3]) / q),
|
||||
},
|
||||
(quat.v4.vec[0] < 0) ? true : false
|
||||
(quat.v4.vec[0] < 0.f) ? true : false
|
||||
};
|
||||
}
|
||||
|
||||
static inline Value DequantizeRotation(const QuantizedRot& v, atUint32 div)
|
||||
{
|
||||
float q = M_PI / 2.0 / div;
|
||||
float q = M_PI / 2.0f / float(div);
|
||||
Value retval =
|
||||
{
|
||||
0.0,
|
||||
sinf(v.v[0] * q),
|
||||
sinf(v.v[1] * q),
|
||||
sinf(v.v[2] * q),
|
||||
0.0f,
|
||||
std::sin(v.v[0] * q),
|
||||
std::sin(v.v[1] * q),
|
||||
std::sin(v.v[2] * q),
|
||||
};
|
||||
retval.v4.vec[0] = sqrtf(std::max((1.0 -
|
||||
retval.v4.vec[0] = std::sqrt(std::max((1.0f -
|
||||
(retval.v4.vec[1] * retval.v4.vec[1] +
|
||||
retval.v4.vec[2] * retval.v4.vec[2] +
|
||||
retval.v4.vec[3] * retval.v4.vec[3])), 0.0));
|
||||
retval.v4.vec[3] * retval.v4.vec[3])), 0.0f));
|
||||
retval.v4.vec[0] = v.w ? -retval.v4.vec[0] : retval.v4.vec[0];
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline Value DequantizeRotation_3(const QuantizedRot& v, atUint32 div)
|
||||
{
|
||||
float q = 1.0 / div;
|
||||
float q = 1.0f / float(div);
|
||||
Value retval =
|
||||
{
|
||||
0.0,
|
||||
0.0f,
|
||||
v.v[0] * q,
|
||||
v.v[1] * q,
|
||||
v.v[2] * q,
|
||||
};
|
||||
retval.v4.vec[0] = sqrtf(std::max((1.0 -
|
||||
retval.v4.vec[0] = std::sqrt(std::max((1.0f -
|
||||
(retval.v4.vec[1] * retval.v4.vec[1] +
|
||||
retval.v4.vec[2] * retval.v4.vec[2] +
|
||||
retval.v4.vec[3] * retval.v4.vec[3])), 0.0));
|
||||
retval.v4.vec[3] * retval.v4.vec[3])), 0.0f));
|
||||
retval.v4.vec[0] = v.w ? -retval.v4.vec[0] : retval.v4.vec[0];
|
||||
return retval;
|
||||
}
|
||||
|
@ -94,7 +93,7 @@ bool BitstreamReader::dequantizeBit(const atUint8* data)
|
|||
|
||||
/* Fill 32 bit buffer with region containing bits */
|
||||
/* Make them least significant */
|
||||
atUint32 tempBuf = HECL::SBig(*reinterpret_cast<const atUint32*>(data + byteCur)) >> bitRem;
|
||||
atUint32 tempBuf = hecl::SBig(*reinterpret_cast<const atUint32*>(data + byteCur)) >> bitRem;
|
||||
|
||||
/* That's it */
|
||||
m_bitCur += 1;
|
||||
|
@ -108,13 +107,13 @@ atInt16 BitstreamReader::dequantize(const atUint8* data, atUint8 q)
|
|||
|
||||
/* Fill 32 bit buffer with region containing bits */
|
||||
/* Make them least significant */
|
||||
atUint32 tempBuf = HECL::SBig(*reinterpret_cast<const atUint32*>(data + byteCur)) >> bitRem;
|
||||
atUint32 tempBuf = hecl::SBig(*reinterpret_cast<const atUint32*>(data + byteCur)) >> bitRem;
|
||||
|
||||
/* If this shift underflows the value, buffer the next 32 bits */
|
||||
/* And tack onto shifted buffer */
|
||||
if ((bitRem + q) > 32)
|
||||
{
|
||||
atUint32 tempBuf2 = HECL::SBig(*reinterpret_cast<const atUint32*>(data + byteCur + 4));
|
||||
atUint32 tempBuf2 = hecl::SBig(*reinterpret_cast<const atUint32*>(data + byteCur + 4));
|
||||
tempBuf |= (tempBuf2 << (32 - bitRem));
|
||||
}
|
||||
|
||||
|
@ -256,7 +255,7 @@ void BitstreamWriter::quantizeBit(atUint8* data, bool val)
|
|||
/* Fill 32 bit buffer with region containing bits */
|
||||
/* Make them least significant */
|
||||
*(atUint32*)(data + byteCur) =
|
||||
HECL::SBig(HECL::SBig(*(atUint32*)(data + byteCur)) | (val << bitRem));
|
||||
hecl::SBig(hecl::SBig(*(atUint32*)(data + byteCur)) | (val << bitRem));
|
||||
|
||||
m_bitCur += 1;
|
||||
}
|
||||
|
@ -271,14 +270,14 @@ void BitstreamWriter::quantize(atUint8* data, atUint8 q, atInt16 val)
|
|||
/* Fill 32 bit buffer with region containing bits */
|
||||
/* Make them least significant */
|
||||
*(atUint32*)(data + byteCur) =
|
||||
HECL::SBig(HECL::SBig(*(atUint32*)(data + byteCur)) | (masked << bitRem));
|
||||
hecl::SBig(hecl::SBig(*(atUint32*)(data + byteCur)) | (masked << bitRem));
|
||||
|
||||
/* If this shift underflows the value, buffer the next 32 bits */
|
||||
/* And tack onto shifted buffer */
|
||||
if ((bitRem + q) > 32)
|
||||
{
|
||||
*(atUint32*)(data + byteCur + 4) =
|
||||
HECL::SBig(HECL::SBig(*(atUint32*)(data + byteCur + 4)) | (masked >> (32 - bitRem)));
|
||||
hecl::SBig(hecl::SBig(*(atUint32*)(data + byteCur + 4)) | (masked >> (32 - bitRem)));
|
||||
}
|
||||
|
||||
m_bitCur += q;
|
||||
|
@ -295,7 +294,7 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
|
|||
rotDivOut = 32767; /* Normalized range of values */
|
||||
|
||||
/* Pre-pass to calculate translation multiplier */
|
||||
float maxTransDiff = 0.0;
|
||||
float maxTransDiff = 0.0f;
|
||||
auto kit = chanKeys.begin();
|
||||
for (Channel& chan : channels)
|
||||
{
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
#ifndef _DNACOMMON_BABEDEAD_HPP_
|
||||
#define _DNACOMMON_BABEDEAD_HPP_
|
||||
|
||||
#include <BlenderConnection.hpp>
|
||||
|
||||
#ifndef _USE_MATH_DEFINES
|
||||
#define _USE_MATH_DEFINES 1
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include "BlenderConnection.hpp"
|
||||
#include "zeus/Math.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
|
||||
template<class BabeDeadLight>
|
||||
void ReadBabeDeadLightToBlender(HECL::BlenderConnection::PyOutStream& os,
|
||||
void ReadBabeDeadLightToBlender(hecl::BlenderConnection::PyOutStream& os,
|
||||
const BabeDeadLight& light, unsigned s, unsigned l)
|
||||
{
|
||||
switch (light.lightType)
|
||||
|
@ -45,7 +41,7 @@ void ReadBabeDeadLightToBlender(HECL::BlenderConnection::PyOutStream& os,
|
|||
"lamp_obj.rotation_mode = 'QUATERNION'\n"
|
||||
"lamp_obj.rotation_quaternion = Vector((0,0,-1)).rotation_difference(Vector((%f,%f,%f)))\n"
|
||||
"\n", s, l,
|
||||
light.spotCutoff * M_PI / 180.f,
|
||||
zeus::degToRad(light.spotCutoff),
|
||||
light.direction.vec[0], light.direction.vec[1], light.direction.vec[2]);
|
||||
break;
|
||||
default: return;
|
||||
|
|
|
@ -5,8 +5,8 @@ namespace DataSpec
|
|||
namespace DNACMDL
|
||||
{
|
||||
|
||||
void InitGeomBlenderContext(HECL::BlenderConnection::PyOutStream& os,
|
||||
const HECL::ProjectPath& masterShaderPath)
|
||||
void InitGeomBlenderContext(hecl::BlenderConnection::PyOutStream& os,
|
||||
const hecl::ProjectPath& masterShaderPath)
|
||||
{
|
||||
os << "# Using 'Blender Game'\n"
|
||||
"bpy.context.scene.render.engine = 'BLENDER_GAME'\n"
|
||||
|
@ -87,7 +87,7 @@ void InitGeomBlenderContext(HECL::BlenderConnection::PyOutStream& os,
|
|||
"\n", masterShaderPath.getAbsolutePathUTF8().c_str());
|
||||
}
|
||||
|
||||
void FinishBlenderMesh(HECL::BlenderConnection::PyOutStream& os,
|
||||
void FinishBlenderMesh(hecl::BlenderConnection::PyOutStream& os,
|
||||
unsigned matSetCount, int meshIdx)
|
||||
{
|
||||
if (meshIdx < 0)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef _DNACOMMON_CMDL_HPP_
|
||||
#define _DNACOMMON_CMDL_HPP_
|
||||
|
||||
#include <Athena/FileWriter.hpp>
|
||||
#include <HECL/Frontend.hpp>
|
||||
#include <HECL/Backend/GX.hpp>
|
||||
#include <athena/FileWriter.hpp>
|
||||
#include <hecl/Frontend.hpp>
|
||||
#include <hecl/Backend/GX.hpp>
|
||||
#include "PAK.hpp"
|
||||
#include "BlenderConnection.hpp"
|
||||
#include "GX.hpp"
|
||||
|
@ -14,7 +14,7 @@ namespace DataSpec
|
|||
namespace DNACMDL
|
||||
{
|
||||
|
||||
using Mesh = HECL::BlenderConnection::DataStream::Mesh;
|
||||
using Mesh = hecl::BlenderConnection::DataStream::Mesh;
|
||||
|
||||
struct Header : BigDNA
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ struct SurfaceHeader_1 : BigDNA
|
|||
Value<atUint32> unk2 = 0;
|
||||
Value<atUint32> aabbSz = 0;
|
||||
Value<atVec3f> reflectionNormal;
|
||||
Seek<DNA_COUNT(aabbSz), Athena::Current> seek2;
|
||||
Seek<DNA_COUNT(aabbSz), athena::Current> seek2;
|
||||
Align<32> align;
|
||||
|
||||
static constexpr bool UseMatrixSkinning() {return false;}
|
||||
|
@ -69,7 +69,7 @@ struct SurfaceHeader_2 : BigDNA
|
|||
Value<atVec3f> reflectionNormal;
|
||||
Value<atInt16> skinMtxBankIdx;
|
||||
Value<atUint16> surfaceGroup;
|
||||
Seek<DNA_COUNT(aabbSz), Athena::Current> seek2;
|
||||
Seek<DNA_COUNT(aabbSz), athena::Current> seek2;
|
||||
Align<32> align;
|
||||
|
||||
static constexpr bool UseMatrixSkinning() {return false;}
|
||||
|
@ -89,7 +89,7 @@ struct SurfaceHeader_3 : BigDNA
|
|||
Value<atVec3f> reflectionNormal;
|
||||
Value<atInt16> skinMtxBankIdx;
|
||||
Value<atUint16> surfaceGroup;
|
||||
Seek<DNA_COUNT(aabbSz), Athena::Current> seek2;
|
||||
Seek<DNA_COUNT(aabbSz), athena::Current> seek2;
|
||||
Value<atUint8> unk3;
|
||||
Align<32> align;
|
||||
|
||||
|
@ -166,7 +166,7 @@ void GetVertexAttributes(const MaterialSet& matSet,
|
|||
}
|
||||
|
||||
template <class PAKRouter, class MaterialSet>
|
||||
void ReadMaterialSetToBlender_1_2(HECL::BlenderConnection::PyOutStream& os,
|
||||
void ReadMaterialSetToBlender_1_2(hecl::BlenderConnection::PyOutStream& os,
|
||||
const MaterialSet& matSet,
|
||||
const PAKRouter& pakRouter,
|
||||
const typename PAKRouter::EntryType& entry,
|
||||
|
@ -177,16 +177,16 @@ void ReadMaterialSetToBlender_1_2(HECL::BlenderConnection::PyOutStream& os,
|
|||
for (const UniqueID32& tex : matSet.head.textureIDs)
|
||||
{
|
||||
std::string texName = pakRouter.getBestEntryName(tex);
|
||||
const NOD::Node* node;
|
||||
const nod::Node* node;
|
||||
const typename PAKRouter::EntryType* texEntry = pakRouter.lookupEntry(tex, &node);
|
||||
HECL::ProjectPath txtrPath = pakRouter.getWorking(texEntry);
|
||||
if (txtrPath.getPathType() == HECL::ProjectPath::Type::None)
|
||||
hecl::ProjectPath txtrPath = pakRouter.getWorking(texEntry);
|
||||
if (txtrPath.getPathType() == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
PAKEntryReadStream rs = texEntry->beginReadStream(*node);
|
||||
TXTR::Extract(rs, txtrPath);
|
||||
}
|
||||
HECL::SystemString resPath = pakRouter.getResourceRelativePath(entry, tex);
|
||||
HECL::SystemUTF8View resPathView(resPath);
|
||||
hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, tex);
|
||||
hecl::SystemUTF8View resPathView(resPath);
|
||||
os.format("if '%s' in bpy.data.textures:\n"
|
||||
" image = bpy.data.images['%s']\n"
|
||||
" texture = bpy.data.textures[image.name]\n"
|
||||
|
@ -209,7 +209,7 @@ void ReadMaterialSetToBlender_1_2(HECL::BlenderConnection::PyOutStream& os,
|
|||
}
|
||||
|
||||
template <class PAKRouter, class MaterialSet>
|
||||
void ReadMaterialSetToBlender_3(HECL::BlenderConnection::PyOutStream& os,
|
||||
void ReadMaterialSetToBlender_3(hecl::BlenderConnection::PyOutStream& os,
|
||||
const MaterialSet& matSet,
|
||||
const PAKRouter& pakRouter,
|
||||
const typename PAKRouter::EntryType& entry,
|
||||
|
@ -251,7 +251,7 @@ public:
|
|||
}
|
||||
|
||||
template<class RigPair>
|
||||
void sendAdditionalVertsToBlender(HECL::BlenderConnection::PyOutStream& os,
|
||||
void sendAdditionalVertsToBlender(hecl::BlenderConnection::PyOutStream& os,
|
||||
const RigPair& rp) const
|
||||
{
|
||||
atUint32 nextVert = 1;
|
||||
|
@ -312,7 +312,7 @@ private:
|
|||
case GX::INDEX16:
|
||||
if ((m_cur - m_dl.get() + 1) >= intptr_t(m_dlSize))
|
||||
return 0;
|
||||
retval = HECL::SBig(*(atUint16*)m_cur);
|
||||
retval = hecl::SBig(*(atUint16*)m_cur);
|
||||
m_cur += 2;
|
||||
break;
|
||||
default: break;
|
||||
|
@ -346,7 +346,7 @@ public:
|
|||
|
||||
atUint16 readVertCount()
|
||||
{
|
||||
atUint16 retval = HECL::SBig(*(atUint16*)m_cur);
|
||||
atUint16 retval = hecl::SBig(*(atUint16*)m_cur);
|
||||
m_cur += 2;
|
||||
return retval;
|
||||
}
|
||||
|
@ -510,14 +510,14 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
void InitGeomBlenderContext(HECL::BlenderConnection::PyOutStream& os,
|
||||
const HECL::ProjectPath& masterShaderPath);
|
||||
void FinishBlenderMesh(HECL::BlenderConnection::PyOutStream& os,
|
||||
void InitGeomBlenderContext(hecl::BlenderConnection::PyOutStream& os,
|
||||
const hecl::ProjectPath& masterShaderPath);
|
||||
void FinishBlenderMesh(hecl::BlenderConnection::PyOutStream& os,
|
||||
unsigned matSetCount, int meshIdx);
|
||||
|
||||
template <class PAKRouter, class MaterialSet, class RigPair, class SurfaceHeader>
|
||||
atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os,
|
||||
Athena::io::IStreamReader& reader,
|
||||
atUint32 ReadGeomSectionsToBlender(hecl::BlenderConnection::PyOutStream& os,
|
||||
athena::io::IStreamReader& reader,
|
||||
PAKRouter& pakRouter,
|
||||
const typename PAKRouter::EntryType& entry,
|
||||
const RigPair& rp,
|
||||
|
@ -640,10 +640,10 @@ atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os,
|
|||
}
|
||||
|
||||
if (s < secCount - 1)
|
||||
reader.seek(secStart + secSizes[s], Athena::Begin);
|
||||
reader.seek(secStart + secSizes[s], athena::Begin);
|
||||
}
|
||||
|
||||
reader.seek(afterHeaderPos, Athena::Begin);
|
||||
reader.seek(afterHeaderPos, athena::Begin);
|
||||
|
||||
visitedDLOffsets = false;
|
||||
unsigned createdUVLayers = 0;
|
||||
|
@ -986,7 +986,7 @@ atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os,
|
|||
}
|
||||
|
||||
if (s < secCount - 1)
|
||||
reader.seek(secStart + secSizes[s], Athena::Begin);
|
||||
reader.seek(secStart + secSizes[s], athena::Begin);
|
||||
}
|
||||
|
||||
/* Finish Mesh */
|
||||
|
@ -999,8 +999,8 @@ atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os,
|
|||
}
|
||||
|
||||
template <class PAKRouter, class MaterialSet, class RigPair, class SurfaceHeader, atUint32 Version>
|
||||
bool ReadCMDLToBlender(HECL::BlenderConnection& conn,
|
||||
Athena::io::IStreamReader& reader,
|
||||
bool ReadCMDLToBlender(hecl::BlenderConnection& conn,
|
||||
athena::io::IStreamReader& reader,
|
||||
PAKRouter& pakRouter,
|
||||
const typename PAKRouter::EntryType& entry,
|
||||
const SpecBase& dataspec,
|
||||
|
@ -1011,18 +1011,18 @@ bool ReadCMDLToBlender(HECL::BlenderConnection& conn,
|
|||
|
||||
if (head.magic != 0xDEADBABE)
|
||||
{
|
||||
LogDNACommon.report(LogVisor::Error, "invalid CMDL magic");
|
||||
LogDNACommon.report(logvisor::Error, "invalid CMDL magic");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (head.version != Version)
|
||||
{
|
||||
LogDNACommon.report(LogVisor::Error, "invalid CMDL version");
|
||||
LogDNACommon.report(logvisor::Error, "invalid CMDL version");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Open Py Stream and read sections */
|
||||
HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||
os.format("import bpy\n"
|
||||
"import bmesh\n"
|
||||
"\n"
|
||||
|
@ -1046,14 +1046,14 @@ bool ReadCMDLToBlender(HECL::BlenderConnection& conn,
|
|||
}
|
||||
|
||||
template <class PAKRouter, class MaterialSet>
|
||||
void NameCMDL(Athena::io::IStreamReader& reader,
|
||||
void NameCMDL(athena::io::IStreamReader& reader,
|
||||
PAKRouter& pakRouter,
|
||||
typename PAKRouter::EntryType& entry,
|
||||
const SpecBase& dataspec)
|
||||
{
|
||||
Header head;
|
||||
head.read(reader);
|
||||
std::string bestName = HECL::Format("CMDL_%s", entry.id.toString().c_str());
|
||||
std::string bestName = hecl::Format("CMDL_%s", entry.id.toString().c_str());
|
||||
|
||||
/* Pre-read pass to determine maximum used vert indices */
|
||||
atUint32 matSecCount = 0;
|
||||
|
@ -1071,11 +1071,11 @@ void NameCMDL(Athena::io::IStreamReader& reader,
|
|||
}
|
||||
|
||||
if (s < head.secCount - 1)
|
||||
reader.seek(secStart + head.secSizes[s], Athena::Begin);
|
||||
reader.seek(secStart + head.secSizes[s], athena::Begin);
|
||||
}
|
||||
}
|
||||
|
||||
static void WriteDLVal(Athena::io::FileWriter& writer, GX::AttrType type, atUint32 val)
|
||||
static void WriteDLVal(athena::io::FileWriter& writer, GX::AttrType type, atUint32 val)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
@ -1091,7 +1091,7 @@ static void WriteDLVal(Athena::io::FileWriter& writer, GX::AttrType type, atUint
|
|||
}
|
||||
|
||||
template <class MaterialSet, class SurfaceHeader, atUint32 Version>
|
||||
bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath, const Mesh& mesh)
|
||||
bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const Mesh& mesh)
|
||||
{
|
||||
Header head;
|
||||
head.magic = 0xDEADBABE;
|
||||
|
@ -1110,23 +1110,23 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
|
|||
std::vector<MaterialSet> matSets;
|
||||
matSets.reserve(mesh.materialSets.size());
|
||||
{
|
||||
HECL::Frontend::Frontend FE;
|
||||
hecl::Frontend::Frontend FE;
|
||||
for (const std::vector<Mesh::Material>& mset : mesh.materialSets)
|
||||
{
|
||||
matSets.emplace_back();
|
||||
MaterialSet& targetMSet = matSets.back();
|
||||
std::vector<HECL::ProjectPath> texPaths;
|
||||
std::vector<HECL::Backend::GX> setBackends;
|
||||
std::vector<hecl::ProjectPath> texPaths;
|
||||
std::vector<hecl::Backend::GX> setBackends;
|
||||
setBackends.reserve(mset.size());
|
||||
|
||||
size_t endOff = 0;
|
||||
atUint32 nextGroupIdx = 0;
|
||||
for (const Mesh::Material& mat : mset)
|
||||
{
|
||||
std::string diagName = HECL::Format("%s:%s", inPath.getLastComponentUTF8(), mat.name.c_str());
|
||||
HECL::Frontend::IR matIR = FE.compileSource(mat.source, diagName);
|
||||
std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8(), mat.name.c_str());
|
||||
hecl::Frontend::IR matIR = FE.compileSource(mat.source, diagName);
|
||||
setBackends.emplace_back();
|
||||
HECL::Backend::GX& matGX = setBackends.back();
|
||||
hecl::Backend::GX& matGX = setBackends.back();
|
||||
matGX.reset(matIR, FE.getDiagnostics());
|
||||
|
||||
atUint32 groupIdx = -1;
|
||||
|
@ -1134,7 +1134,7 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
|
|||
{
|
||||
for (size_t i=0 ; i<setBackends.size()-1 ; ++i)
|
||||
{
|
||||
const HECL::Backend::GX& other = setBackends[i];
|
||||
const hecl::Backend::GX& other = setBackends[i];
|
||||
if (matGX == other)
|
||||
{
|
||||
groupIdx = i;
|
||||
|
@ -1153,16 +1153,16 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
|
|||
targetMSet.head.addMaterialEndOff(endOff);
|
||||
}
|
||||
|
||||
for (const HECL::ProjectPath& path : texPaths)
|
||||
for (const hecl::ProjectPath& path : texPaths)
|
||||
{
|
||||
const HECL::SystemString& relPath = path.getRelativePath();
|
||||
const hecl::SystemString& relPath = path.getRelativePath();
|
||||
|
||||
/* TODO: incorporate hecl hashes */
|
||||
size_t search = relPath.find(_S("TXTR_"));
|
||||
if (search != HECL::SystemString::npos)
|
||||
if (search != hecl::SystemString::npos)
|
||||
targetMSet.head.addTexture(relPath.c_str() + search + 5);
|
||||
else
|
||||
LogDNACommon.report(LogVisor::FatalError, "unable to get hash from path");
|
||||
LogDNACommon.report(logvisor::Fatal, "unable to get hash from path");
|
||||
}
|
||||
|
||||
size_t secSz = targetMSet.binarySize(0);
|
||||
|
@ -1220,7 +1220,7 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
|
|||
{
|
||||
size_t vertSz = matSets.at(0).materials.at(surf.materialIdx).getVAFlags().vertDLSize();
|
||||
if (surf.verts.size() > 65536)
|
||||
LogDNACommon.report(LogVisor::FatalError, "GX DisplayList overflow");
|
||||
LogDNACommon.report(logvisor::Fatal, "GX DisplayList overflow");
|
||||
size_t secSz = 67 + surf.verts.size() * vertSz;
|
||||
secSz32 = ROUND_UP_32(secSz);
|
||||
if (secSz32 == 0)
|
||||
|
@ -1232,7 +1232,7 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
|
|||
}
|
||||
|
||||
/* Write sections */
|
||||
Athena::io::FileWriter writer(outPath.getAbsolutePath());
|
||||
athena::io::FileWriter writer(outPath.getAbsolutePath());
|
||||
head.write(writer);
|
||||
std::vector<size_t>::const_iterator padIt = paddingSizes.cbegin();
|
||||
|
||||
|
@ -1280,12 +1280,12 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
|
|||
|
||||
/* Surfaces */
|
||||
GX::Primitive prim;
|
||||
if (mesh.topology == HECL::HMDLTopology::Triangles)
|
||||
if (mesh.topology == hecl::HMDLTopology::Triangles)
|
||||
prim = GX::TRIANGLES;
|
||||
else if (mesh.topology == HECL::HMDLTopology::TriStrips)
|
||||
else if (mesh.topology == hecl::HMDLTopology::TriStrips)
|
||||
prim = GX::TRIANGLESTRIP;
|
||||
else
|
||||
LogDNACommon.report(LogVisor::FatalError, "unrecognized mesh output mode");
|
||||
LogDNACommon.report(logvisor::Fatal, "unrecognized mesh output mode");
|
||||
for (const Mesh::Surface& surf : mesh.surfaces)
|
||||
{
|
||||
const typename MaterialSet::Material::VAFlags& vaFlags =
|
||||
|
@ -1335,7 +1335,7 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
|
|||
}
|
||||
|
||||
template <class MaterialSet, class SurfaceHeader, atUint32 Version>
|
||||
bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath, const Mesh& mesh)
|
||||
bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const Mesh& mesh)
|
||||
{
|
||||
Header head;
|
||||
head.magic = 0xDEADBABE;
|
||||
|
@ -1354,19 +1354,19 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
|
|||
std::vector<MaterialSet> matSets;
|
||||
matSets.reserve(mesh.materialSets.size());
|
||||
{
|
||||
HECL::Frontend::Frontend FE;
|
||||
hecl::Frontend::Frontend FE;
|
||||
for (const std::vector<Mesh::Material>& mset : mesh.materialSets)
|
||||
{
|
||||
matSets.emplace_back();
|
||||
MaterialSet& targetMSet = matSets.back();
|
||||
std::vector<HECL::ProjectPath> texPaths;
|
||||
std::vector<hecl::ProjectPath> texPaths;
|
||||
texPaths.reserve(mset.size()*4);
|
||||
for (const Mesh::Material& mat : mset)
|
||||
{
|
||||
for (const HECL::ProjectPath& path : mat.texs)
|
||||
for (const hecl::ProjectPath& path : mat.texs)
|
||||
{
|
||||
bool found = false;
|
||||
for (const HECL::ProjectPath& ePath : texPaths)
|
||||
for (const hecl::ProjectPath& ePath : texPaths)
|
||||
{
|
||||
if (path == ePath)
|
||||
{
|
||||
|
@ -1382,22 +1382,22 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
|
|||
size_t endOff = 0;
|
||||
for (const Mesh::Material& mat : mset)
|
||||
{
|
||||
std::string diagName = HECL::Format("%s:%s", inPath.getLastComponentUTF8(), mat.name.c_str());
|
||||
std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8(), mat.name.c_str());
|
||||
targetMSet.materials.emplace_back(FE, diagName, mat, mat.iprops, texPaths);
|
||||
endOff = targetMSet.materials.back().binarySize(endOff);
|
||||
targetMSet.head.addMaterialEndOff(endOff);
|
||||
}
|
||||
|
||||
for (const HECL::ProjectPath& path : texPaths)
|
||||
for (const hecl::ProjectPath& path : texPaths)
|
||||
{
|
||||
const HECL::SystemString& relPath = path.getRelativePath();
|
||||
const hecl::SystemString& relPath = path.getRelativePath();
|
||||
|
||||
/* TODO: incorporate hecl hashes */
|
||||
size_t search = relPath.find(_S("TXTR_"));
|
||||
if (search != HECL::SystemString::npos)
|
||||
if (search != hecl::SystemString::npos)
|
||||
targetMSet.head.addTexture(relPath.c_str() + search + 5);
|
||||
else
|
||||
LogDNACommon.report(LogVisor::FatalError, "unable to get hash from path");
|
||||
LogDNACommon.report(logvisor::Fatal, "unable to get hash from path");
|
||||
}
|
||||
|
||||
size_t secSz = targetMSet.binarySize(0);
|
||||
|
@ -1407,7 +1407,7 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
|
|||
}
|
||||
}
|
||||
|
||||
HECL::HMDLBuffers bufs = mesh.getHMDLBuffers();
|
||||
hecl::HMDLBuffers bufs = mesh.getHMDLBuffers();
|
||||
|
||||
/* Metadata */
|
||||
size_t secSz = bufs.m_meta.binarySize(0);
|
||||
|
@ -1445,7 +1445,7 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
|
|||
|
||||
/* Surfaces */
|
||||
size_t endOff = 0;
|
||||
for (const HECL::HMDLBuffers::Surface& surf : bufs.m_surfaces)
|
||||
for (const hecl::HMDLBuffers::Surface& surf : bufs.m_surfaces)
|
||||
{
|
||||
head.secSizes.push_back(64);
|
||||
paddingSizes.push_back(0);
|
||||
|
@ -1454,7 +1454,7 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
|
|||
}
|
||||
|
||||
/* Write sections */
|
||||
Athena::io::FileWriter writer(outPath.getAbsolutePath());
|
||||
athena::io::FileWriter writer(outPath.getAbsolutePath());
|
||||
head.write(writer);
|
||||
std::vector<size_t>::const_iterator padIt = paddingSizes.cbegin();
|
||||
|
||||
|
@ -1489,7 +1489,7 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
|
|||
++padIt;
|
||||
|
||||
/* Surfaces */
|
||||
for (const HECL::HMDLBuffers::Surface& surf : bufs.m_surfaces)
|
||||
for (const hecl::HMDLBuffers::Surface& surf : bufs.m_surfaces)
|
||||
{
|
||||
const Mesh::Surface& osurf = surf.m_origSurf;
|
||||
|
||||
|
@ -1506,7 +1506,7 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
|
|||
}
|
||||
|
||||
/* Ensure final surface's alignment writes zeros */
|
||||
writer.seek(-1, Athena::Current);
|
||||
writer.seek(-1, athena::Current);
|
||||
writer.writeUByte(0);
|
||||
writer.close();
|
||||
return true;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace DataSpec
|
||||
{
|
||||
|
||||
LogVisor::LogModule LogDNACommon("Retro::DNACommon");
|
||||
logvisor::Module LogDNACommon("urde::DNACommon");
|
||||
SpecBase* g_curSpec = nullptr;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,48 +2,48 @@
|
|||
#define __DNA_COMMON_HPP__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Athena/DNAYaml.hpp>
|
||||
#include <NOD/DiscBase.hpp>
|
||||
#include "HECL/HECL.hpp"
|
||||
#include "HECL/Database.hpp"
|
||||
#include <athena/DNAYaml.hpp>
|
||||
#include <nod/DiscBase.hpp>
|
||||
#include "hecl/hecl.hpp"
|
||||
#include "hecl/Database.hpp"
|
||||
#include "../SpecBase.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
|
||||
extern LogVisor::LogModule LogDNACommon;
|
||||
extern logvisor::Module LogDNACommon;
|
||||
extern SpecBase* g_curSpec;
|
||||
|
||||
/* This comes up a great deal */
|
||||
typedef Athena::io::DNA<Athena::BigEndian> BigDNA;
|
||||
typedef Athena::io::DNAYaml<Athena::BigEndian> BigYAML;
|
||||
typedef athena::io::DNA<athena::BigEndian> BigDNA;
|
||||
typedef athena::io::DNAYaml<athena::BigEndian> BigYAML;
|
||||
|
||||
/** FourCC with DNA read/write */
|
||||
class DNAFourCC final : public BigYAML, public HECL::FourCC
|
||||
class DNAFourCC final : public BigYAML, public hecl::FourCC
|
||||
{
|
||||
public:
|
||||
DNAFourCC() : HECL::FourCC() {}
|
||||
DNAFourCC(const HECL::FourCC& other)
|
||||
: HECL::FourCC() {num = other.toUint32();}
|
||||
DNAFourCC() : hecl::FourCC() {}
|
||||
DNAFourCC(const hecl::FourCC& other)
|
||||
: hecl::FourCC() {num = other.toUint32();}
|
||||
DNAFourCC(const char* name)
|
||||
: HECL::FourCC(name) {}
|
||||
: hecl::FourCC(name) {}
|
||||
DNAFourCC(uint32_t n)
|
||||
: HECL::FourCC(n) {}
|
||||
: hecl::FourCC(n) {}
|
||||
|
||||
Delete expl;
|
||||
void read(Athena::io::IStreamReader& reader)
|
||||
void read(athena::io::IStreamReader& reader)
|
||||
{reader.readUBytesToBuf(fcc, 4);}
|
||||
void write(Athena::io::IStreamWriter& writer) const
|
||||
void write(athena::io::IStreamWriter& writer) const
|
||||
{writer.writeUBytes((atUint8*)fcc, 4);}
|
||||
void read(Athena::io::YAMLDocReader& reader)
|
||||
void read(athena::io::YAMLDocReader& reader)
|
||||
{std::string rs = reader.readString(nullptr); strncpy(fcc, rs.c_str(), 4);}
|
||||
void write(Athena::io::YAMLDocWriter& writer) const
|
||||
void write(athena::io::YAMLDocWriter& writer) const
|
||||
{writer.writeString(nullptr, std::string(fcc, 4));}
|
||||
size_t binarySize(size_t __isz) const
|
||||
{return __isz + 4;}
|
||||
};
|
||||
|
||||
using FourCC = HECL::FourCC;
|
||||
using FourCC = hecl::FourCC;
|
||||
|
||||
/** PAK 32-bit Unique ID */
|
||||
class UniqueID32 : public BigYAML
|
||||
|
@ -52,18 +52,18 @@ class UniqueID32 : public BigYAML
|
|||
public:
|
||||
Delete expl;
|
||||
operator bool() const {return m_id != 0xffffffff && m_id != 0;}
|
||||
void read(Athena::io::IStreamReader& reader)
|
||||
void read(athena::io::IStreamReader& reader)
|
||||
{m_id = reader.readUint32Big();}
|
||||
void write(Athena::io::IStreamWriter& writer) const
|
||||
void write(athena::io::IStreamWriter& writer) const
|
||||
{writer.writeUint32Big(m_id);}
|
||||
void read(Athena::io::YAMLDocReader& reader)
|
||||
void read(athena::io::YAMLDocReader& reader)
|
||||
{m_id = reader.readUint32(nullptr);}
|
||||
void write(Athena::io::YAMLDocWriter& writer) const
|
||||
void write(athena::io::YAMLDocWriter& writer) const
|
||||
{writer.writeUint32(nullptr, m_id);}
|
||||
size_t binarySize(size_t __isz) const
|
||||
{return __isz + 4;}
|
||||
|
||||
UniqueID32& operator=(const HECL::ProjectPath& path)
|
||||
UniqueID32& operator=(const hecl::ProjectPath& path)
|
||||
{m_id = path.hash().val32(); return *this;}
|
||||
|
||||
bool operator!=(const UniqueID32& other) const {return m_id != other.m_id;}
|
||||
|
@ -78,8 +78,8 @@ public:
|
|||
void clear() {m_id = 0xffffffff;}
|
||||
|
||||
UniqueID32() = default;
|
||||
UniqueID32(Athena::io::IStreamReader& reader) {read(reader);}
|
||||
UniqueID32(const HECL::ProjectPath& path) {*this = path;}
|
||||
UniqueID32(athena::io::IStreamReader& reader) {read(reader);}
|
||||
UniqueID32(const hecl::ProjectPath& path) {*this = path;}
|
||||
UniqueID32(const char* hexStr)
|
||||
{
|
||||
char copy[9];
|
||||
|
@ -105,18 +105,18 @@ class UniqueID64 : public BigYAML
|
|||
public:
|
||||
Delete expl;
|
||||
operator bool() const {return m_id != 0xffffffffffffffff && m_id != 0;}
|
||||
void read(Athena::io::IStreamReader& reader)
|
||||
void read(athena::io::IStreamReader& reader)
|
||||
{m_id = reader.readUint64Big();}
|
||||
void write(Athena::io::IStreamWriter& writer) const
|
||||
void write(athena::io::IStreamWriter& writer) const
|
||||
{writer.writeUint64Big(m_id);}
|
||||
void read(Athena::io::YAMLDocReader& reader)
|
||||
void read(athena::io::YAMLDocReader& reader)
|
||||
{m_id = reader.readUint64(nullptr);}
|
||||
void write(Athena::io::YAMLDocWriter& writer) const
|
||||
void write(athena::io::YAMLDocWriter& writer) const
|
||||
{writer.writeUint64(nullptr, m_id);}
|
||||
size_t binarySize(size_t __isz) const
|
||||
{return __isz + 8;}
|
||||
|
||||
UniqueID64& operator=(const HECL::ProjectPath& path)
|
||||
UniqueID64& operator=(const hecl::ProjectPath& path)
|
||||
{m_id = path.hash().val64(); return *this;}
|
||||
|
||||
bool operator!=(const UniqueID64& other) const {return m_id != other.m_id;}
|
||||
|
@ -131,8 +131,8 @@ public:
|
|||
void clear() {m_id = 0xffffffffffffffff;}
|
||||
|
||||
UniqueID64() = default;
|
||||
UniqueID64(Athena::io::IStreamReader& reader) {read(reader);}
|
||||
UniqueID64(const HECL::ProjectPath& path) {*this = path;}
|
||||
UniqueID64(athena::io::IStreamReader& reader) {read(reader);}
|
||||
UniqueID64(const hecl::ProjectPath& path) {*this = path;}
|
||||
UniqueID64(const char* hexStr)
|
||||
{
|
||||
char copy[17];
|
||||
|
@ -174,17 +174,17 @@ public:
|
|||
UniqueID128() {m_id[0]=0xffffffffffffffff; m_id[1]=0xffffffffffffffff;}
|
||||
operator bool() const
|
||||
{return m_id[0] != 0xffffffffffffffff && m_id[0] != 0 && m_id[1] != 0xffffffffffffffff && m_id[1] != 0;}
|
||||
void read(Athena::io::IStreamReader& reader)
|
||||
void read(athena::io::IStreamReader& reader)
|
||||
{
|
||||
m_id[0] = reader.readUint64Big();
|
||||
m_id[1] = reader.readUint64Big();
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& writer) const
|
||||
void write(athena::io::IStreamWriter& writer) const
|
||||
{
|
||||
writer.writeUint64Big(m_id[0]);
|
||||
writer.writeUint64Big(m_id[1]);
|
||||
}
|
||||
void read(Athena::io::YAMLDocReader& reader)
|
||||
void read(athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
std::string str = reader.readString(nullptr);
|
||||
while (str.size() < 32)
|
||||
|
@ -194,7 +194,7 @@ public:
|
|||
m_id[0] = strtoull(hStr.c_str(), nullptr, 16);
|
||||
m_id[1] = strtoull(lStr.c_str(), nullptr, 16);
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& writer) const
|
||||
void write(athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
writer.writeString(nullptr, toString().c_str());
|
||||
}
|
||||
|
@ -238,31 +238,31 @@ public:
|
|||
template <class IDTYPE>
|
||||
class PAKPath : public BigYAML
|
||||
{
|
||||
HECL::ProjectPath m_path;
|
||||
hecl::ProjectPath m_path;
|
||||
IDTYPE m_id;
|
||||
public:
|
||||
HECL::ProjectPath getPath() const
|
||||
hecl::ProjectPath getPath() const
|
||||
{
|
||||
if (m_path)
|
||||
return m_path;
|
||||
if (!g_curSpec)
|
||||
LogDNACommon.report(LogVisor::FatalError, "current DataSpec not set for PAKPath");
|
||||
LogDNACommon.report(logvisor::Fatal, "current DataSpec not set for PAKPath");
|
||||
if (m_id)
|
||||
return g_curSpec->getWorking(m_id);
|
||||
return HECL::ProjectPath();
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
operator HECL::ProjectPath() const {return getPath();}
|
||||
operator hecl::ProjectPath() const {return getPath();}
|
||||
operator const IDTYPE&() const {return m_id;}
|
||||
|
||||
Delete _d;
|
||||
void read(Athena::io::IStreamReader& reader)
|
||||
void read(athena::io::IStreamReader& reader)
|
||||
{m_id.read(reader);}
|
||||
void write(Athena::io::IStreamWriter& writer) const
|
||||
void write(athena::io::IStreamWriter& writer) const
|
||||
{m_id.write(writer);}
|
||||
void read(Athena::io::YAMLDocReader& reader)
|
||||
void read(athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
if (!g_curSpec)
|
||||
LogDNACommon.report(LogVisor::FatalError, "current DataSpec not set for PAKPath");
|
||||
LogDNACommon.report(logvisor::Fatal, "current DataSpec not set for PAKPath");
|
||||
std::string path = reader.readString(nullptr);
|
||||
if (path.empty())
|
||||
{
|
||||
|
@ -273,7 +273,7 @@ public:
|
|||
m_path.assign(g_curSpec->getProject(), path);
|
||||
m_id = m_path;
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& writer) const
|
||||
void write(athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
if (m_path)
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ class WordBitmap
|
|||
std::vector<atUint32> m_words;
|
||||
size_t m_bitCount = 0;
|
||||
public:
|
||||
void read(Athena::io::IStreamReader& reader, size_t bitCount)
|
||||
void read(athena::io::IStreamReader& reader, size_t bitCount)
|
||||
{
|
||||
m_bitCount = bitCount;
|
||||
size_t wordCount = (bitCount + 31) / 32;
|
||||
|
@ -304,7 +304,7 @@ public:
|
|||
for (size_t w=0 ; w<wordCount ; ++w)
|
||||
m_words.push_back(reader.readUint32Big());
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& writer) const
|
||||
void write(athena::io::IStreamWriter& writer) const
|
||||
{
|
||||
for (atUint32 word : m_words)
|
||||
writer.writeUint32(word);
|
||||
|
@ -356,7 +356,7 @@ public:
|
|||
};
|
||||
|
||||
/** Resource cooker function */
|
||||
typedef std::function<bool(const HECL::ProjectPath&, const HECL::ProjectPath&)> ResCooker;
|
||||
typedef std::function<bool(const hecl::ProjectPath&, const hecl::ProjectPath&)> ResCooker;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace DataSpec
|
|||
{
|
||||
|
||||
template<class DEAFBABE>
|
||||
void DeafBabeSendToBlender(HECL::BlenderConnection::PyOutStream& os, const DEAFBABE& db)
|
||||
void DeafBabeSendToBlender(hecl::BlenderConnection::PyOutStream& os, const DEAFBABE& db)
|
||||
{
|
||||
os << "material_index = []\n"
|
||||
"col_bm = bmesh.new()\n";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _DNACOMMON_GX_HPP_
|
||||
#define _DNACOMMON_GX_HPP_
|
||||
|
||||
#include "HECL/Backend/GX.hpp"
|
||||
using GX = HECL::Backend::GX;
|
||||
#include "hecl/Backend/GX.hpp"
|
||||
using GX = hecl::Backend::GX;
|
||||
|
||||
#endif // _DNACOMMON_GX_HPP_
|
||||
|
|
|
@ -74,13 +74,13 @@ struct MAPA : BigDNA
|
|||
};
|
||||
|
||||
|
||||
void read(Athena::io::IStreamReader& __dna_reader)
|
||||
void read(athena::io::IStreamReader& __dna_reader)
|
||||
{
|
||||
/* magic */
|
||||
magic = __dna_reader.readUint32Big();
|
||||
if (magic != 0xDEADD00D)
|
||||
{
|
||||
LogDNACommon.report(LogVisor::Error, "invalid MAPA magic");
|
||||
LogDNACommon.report(logvisor::Error, "invalid MAPA magic");
|
||||
return;
|
||||
}
|
||||
/* version */
|
||||
|
@ -93,7 +93,7 @@ struct MAPA : BigDNA
|
|||
header.reset(new HeaderMP3);
|
||||
else
|
||||
{
|
||||
LogDNACommon.report(LogVisor::Error, "invalid MAPA version");
|
||||
LogDNACommon.report(logvisor::Error, "invalid MAPA version");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ struct MAPA : BigDNA
|
|||
__dna_reader.enumerate(surfaces, header->surfaceCount());
|
||||
}
|
||||
|
||||
void write(Athena::io::IStreamWriter& __dna_writer) const
|
||||
void write(athena::io::IStreamWriter& __dna_writer) const
|
||||
{
|
||||
/* magic */
|
||||
__dna_writer.writeUint32Big(magic);
|
||||
|
@ -189,9 +189,9 @@ struct MAPA : BigDNA
|
|||
Value<Type> type;
|
||||
Value<atUint32> unknown1;
|
||||
Value<atUint32> sclyId;
|
||||
Seek<DNA_COUNT(4), Athena::Current> seek1;
|
||||
Seek<DNA_COUNT(4), athena::Current> seek1;
|
||||
Value<atVec4f> transformMtx[3];
|
||||
Seek<DNA_COUNT(0x10), Athena::Current> seek2;
|
||||
Seek<DNA_COUNT(0x10), athena::Current> seek2;
|
||||
virtual ~MappableObjectMP1_2() {}
|
||||
};
|
||||
|
||||
|
@ -202,9 +202,9 @@ struct MAPA : BigDNA
|
|||
Value<atUint32> unknown1;
|
||||
Value<atUint32> sclyId;
|
||||
Buffer<DNA_COUNT(0x10)> unknownHash;
|
||||
Seek<DNA_COUNT(4), Athena::Current> seek1;
|
||||
Seek<DNA_COUNT(4), athena::Current> seek1;
|
||||
Value<atVec4f> transformMtx[3];
|
||||
Seek<DNA_COUNT(0x10), Athena::Current> seek2;
|
||||
Seek<DNA_COUNT(0x10), athena::Current> seek2;
|
||||
virtual ~MappableObjectMP3() {}
|
||||
};
|
||||
|
||||
|
@ -252,21 +252,21 @@ struct MAPA : BigDNA
|
|||
};
|
||||
|
||||
template <typename PAKRouter>
|
||||
bool ReadMAPAToBlender(HECL::BlenderConnection& conn,
|
||||
bool ReadMAPAToBlender(hecl::BlenderConnection& conn,
|
||||
const MAPA& mapa,
|
||||
const HECL::ProjectPath& outPath,
|
||||
const hecl::ProjectPath& outPath,
|
||||
PAKRouter& pakRouter,
|
||||
const typename PAKRouter::EntryType& entry,
|
||||
bool force)
|
||||
{
|
||||
/* Rename MAPA for consistency */
|
||||
HECL::ProjectPath mapaPath(outPath.getParentPath(), _S("!map.blend"));
|
||||
if (!force && mapaPath.getPathType() == HECL::ProjectPath::Type::File)
|
||||
hecl::ProjectPath mapaPath(outPath.getParentPath(), _S("!map.blend"));
|
||||
if (!force && mapaPath.getPathType() == hecl::ProjectPath::Type::File)
|
||||
return true;
|
||||
|
||||
if (!conn.createBlend(mapaPath, HECL::BlenderConnection::BlendType::MapArea))
|
||||
if (!conn.createBlend(mapaPath, hecl::BlenderConnection::BlendType::MapArea))
|
||||
return false;
|
||||
HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||
|
||||
os << "import bpy, bmesh\n"
|
||||
"from mathutils import Matrix\n"
|
||||
|
@ -450,8 +450,8 @@ bool ReadMAPAToBlender(HECL::BlenderConnection& conn,
|
|||
"bm.free()\n";
|
||||
|
||||
/* World background */
|
||||
HECL::ProjectPath worldBlend(outPath.getParentPath().getParentPath(), "!world.blend");
|
||||
if (worldBlend.getPathType() == HECL::ProjectPath::Type::File)
|
||||
hecl::ProjectPath worldBlend(outPath.getParentPath().getParentPath(), "!world.blend");
|
||||
if (worldBlend.getPathType() == hecl::ProjectPath::Type::File)
|
||||
os.linkBackground("//../!world.blend", "World");
|
||||
|
||||
os.centerView();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "DNACommon.hpp"
|
||||
#include "BlenderConnection.hpp"
|
||||
#include "CVector3f.hpp"
|
||||
#include "zeus/CVector3f.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
|
@ -11,31 +11,23 @@ namespace DNAMLVL
|
|||
{
|
||||
|
||||
template <class PAKRouter, typename MLVL>
|
||||
bool ReadMLVLToBlender(HECL::BlenderConnection& conn,
|
||||
bool ReadMLVLToBlender(hecl::BlenderConnection& conn,
|
||||
const MLVL& mlvl,
|
||||
const HECL::ProjectPath& outPath,
|
||||
const hecl::ProjectPath& outPath,
|
||||
PAKRouter& pakRouter,
|
||||
const typename PAKRouter::EntryType& entry,
|
||||
bool force,
|
||||
std::function<void(const HECL::SystemChar*)> fileChanged)
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||
{
|
||||
/* Rename MLVL for consistency */
|
||||
HECL::ProjectPath mlvlPath(outPath.getParentPath(), _S("!world.blend"));
|
||||
if (!force && mlvlPath.getPathType() == HECL::ProjectPath::Type::File)
|
||||
hecl::ProjectPath mlvlPath(outPath.getParentPath(), _S("!world.blend"));
|
||||
if (!force && mlvlPath.getPathType() == hecl::ProjectPath::Type::File)
|
||||
return true;
|
||||
|
||||
/* Link Skybox CMDL */
|
||||
const typename PAKRouter::EntryType* skyboxEntry = pakRouter.lookupEntry(mlvl.worldSkyboxId);
|
||||
if (skyboxEntry)
|
||||
{
|
||||
HECL::ProjectPath skyboxPath = pakRouter.getWorking(skyboxEntry);
|
||||
HECL::ProjectPath(outPath.getParentPath(), _S("!skybox.blend")).makeLinkTo(skyboxPath);
|
||||
}
|
||||
|
||||
/* Create World Blend */
|
||||
if (!conn.createBlend(mlvlPath, HECL::BlenderConnection::BlendType::World))
|
||||
if (!conn.createBlend(mlvlPath, hecl::BlenderConnection::BlendType::World))
|
||||
return false;
|
||||
HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||
os.format("import bpy\n"
|
||||
"import bmesh\n"
|
||||
"from mathutils import Matrix\n"
|
||||
|
@ -52,7 +44,7 @@ bool ReadMLVLToBlender(HECL::BlenderConnection& conn,
|
|||
for (const auto& area : mlvl.areas)
|
||||
{
|
||||
const typename PAKRouter::EntryType* mreaEntry = pakRouter.lookupEntry(area.areaMREAId);
|
||||
HECL::SystemUTF8View areaDirName(*mreaEntry->unique.m_areaName);
|
||||
hecl::SystemUTF8View areaDirName(*mreaEntry->unique.m_areaName);
|
||||
|
||||
os.AABBToBMesh(area.aabb[0], area.aabb[1]);
|
||||
os.format("box_mesh = bpy.data.meshes.new('''%s''')\n"
|
||||
|
@ -76,14 +68,14 @@ bool ReadMLVLToBlender(HECL::BlenderConnection& conn,
|
|||
for (const auto& dock : area.docks)
|
||||
{
|
||||
os << "bm = bmesh.new()\n";
|
||||
Zeus::CVector3f pvAvg;
|
||||
zeus::CVector3f pvAvg;
|
||||
for (const atVec3f& pv : dock.planeVerts)
|
||||
pvAvg += pv;
|
||||
pvAvg /= dock.planeVerts.size();
|
||||
int idx = 0;
|
||||
for (const atVec3f& pv : dock.planeVerts)
|
||||
{
|
||||
Zeus::CVector3f pvRel = Zeus::CVector3f(pv) - pvAvg;
|
||||
zeus::CVector3f pvRel = zeus::CVector3f(pv) - pvAvg;
|
||||
os.format("bm.verts.new((%f,%f,%f))\n"
|
||||
"bm.verts.ensure_lookup_table()\n",
|
||||
pvRel[0], pvRel[1], pvRel[2]);
|
||||
|
|
|
@ -16,7 +16,7 @@ struct NamedResourceCatalog : BigYAML
|
|||
String<-1> name;
|
||||
IDType uid;
|
||||
|
||||
void read(Athena::io::IStreamReader& __dna_reader)
|
||||
void read(athena::io::IStreamReader& __dna_reader)
|
||||
{
|
||||
/* type */
|
||||
type.read(__dna_reader);
|
||||
|
@ -26,7 +26,7 @@ struct NamedResourceCatalog : BigYAML
|
|||
uid.read(__dna_reader);
|
||||
}
|
||||
|
||||
void write(Athena::io::IStreamWriter& __dna_writer) const
|
||||
void write(athena::io::IStreamWriter& __dna_writer) const
|
||||
{
|
||||
/* type */
|
||||
type.write(__dna_writer);
|
||||
|
@ -36,7 +36,7 @@ struct NamedResourceCatalog : BigYAML
|
|||
uid.write(__dna_writer);
|
||||
}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& __dna_docin)
|
||||
void read(athena::io::YAMLDocReader& __dna_docin)
|
||||
{
|
||||
/* type */
|
||||
__dna_docin.enumerate("type", type);
|
||||
|
@ -46,7 +46,7 @@ struct NamedResourceCatalog : BigYAML
|
|||
__dna_docin.enumerate("uid", uid);
|
||||
}
|
||||
|
||||
void write(Athena::io::YAMLDocWriter& __dna_docout) const
|
||||
void write(athena::io::YAMLDocWriter& __dna_docout) const
|
||||
{
|
||||
/* type */
|
||||
__dna_docout.enumerate("type", type);
|
||||
|
@ -56,7 +56,7 @@ struct NamedResourceCatalog : BigYAML
|
|||
__dna_docout.enumerate("uid", uid);
|
||||
}
|
||||
|
||||
static const char* DNAType() { return "DataSpec::DNACommon::NameResourceCatalog::NamedResource"; }
|
||||
static const char* DNAType() { return "DataSpec::DNACommon::NameResourceCatalogvisor::NamedResource"; }
|
||||
|
||||
size_t binarySize(size_t __isz) const
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ struct NamedResourceCatalog : BigYAML
|
|||
};
|
||||
Vector<NamedResource, DNA_COUNT(namedResCount)> namedResources;
|
||||
|
||||
void read(Athena::io::IStreamReader& __dna_reader)
|
||||
void read(athena::io::IStreamReader& __dna_reader)
|
||||
{
|
||||
/* namedResCount */
|
||||
namedResCount = __dna_reader.readUint32Big();
|
||||
|
@ -76,7 +76,7 @@ struct NamedResourceCatalog : BigYAML
|
|||
__dna_reader.enumerate(namedResources, namedResCount);
|
||||
}
|
||||
|
||||
void write(Athena::io::IStreamWriter& __dna_writer) const
|
||||
void write(athena::io::IStreamWriter& __dna_writer) const
|
||||
{
|
||||
/* namedResCount */
|
||||
__dna_writer.writeUint32Big(namedResCount);
|
||||
|
@ -84,18 +84,14 @@ struct NamedResourceCatalog : BigYAML
|
|||
__dna_writer.enumerate(namedResources);
|
||||
}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& __dna_docin)
|
||||
void read(athena::io::YAMLDocReader& __dna_docin)
|
||||
{
|
||||
/* namedResCount */
|
||||
namedResCount = __dna_docin.readUint32("namedResCount");
|
||||
/* namedResources */
|
||||
__dna_docin.enumerate("namedResources", namedResources, namedResCount);
|
||||
namedResCount = __dna_docin.enumerate("namedResources", namedResources);
|
||||
}
|
||||
|
||||
void write(Athena::io::YAMLDocWriter& __dna_docout) const
|
||||
void write(athena::io::YAMLDocWriter& __dna_docout) const
|
||||
{
|
||||
/* namedResCount */
|
||||
__dna_docout.writeUint32("namedResCount", namedResCount);
|
||||
/* namedResources */
|
||||
__dna_docout.enumerate("namedResources", namedResources);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace DataSpec
|
|||
{
|
||||
|
||||
/* PAK entry stream reader */
|
||||
class PAKEntryReadStream : public Athena::io::IStreamReader
|
||||
class PAKEntryReadStream : public athena::io::IStreamReader
|
||||
{
|
||||
std::unique_ptr<atUint8[]> m_buf;
|
||||
atUint64 m_sz;
|
||||
|
@ -24,18 +24,18 @@ public:
|
|||
: m_buf(std::move(buf)), m_sz(sz), m_pos(pos)
|
||||
{
|
||||
if (m_pos >= m_sz)
|
||||
LogDNACommon.report(LogVisor::FatalError, "PAK stream cursor overrun");
|
||||
LogDNACommon.report(logvisor::Fatal, "PAK stream cursor overrun");
|
||||
}
|
||||
void seek(atInt64 pos, Athena::SeekOrigin origin)
|
||||
void seek(atInt64 pos, athena::SeekOrigin origin)
|
||||
{
|
||||
if (origin == Athena::Begin)
|
||||
if (origin == athena::Begin)
|
||||
m_pos = pos;
|
||||
else if (origin == Athena::Current)
|
||||
else if (origin == athena::Current)
|
||||
m_pos += pos;
|
||||
else if (origin == Athena::End)
|
||||
else if (origin == athena::End)
|
||||
m_pos = m_sz + pos;
|
||||
if (m_pos > m_sz)
|
||||
LogDNACommon.report(LogVisor::FatalError, "PAK stream cursor overrun");
|
||||
LogDNACommon.report(logvisor::Fatal, "PAK stream cursor overrun");
|
||||
}
|
||||
atUint64 position() const {return m_pos;}
|
||||
atUint64 length() const {return m_sz;}
|
||||
|
@ -61,9 +61,9 @@ struct UniqueResult
|
|||
Area,
|
||||
Layer
|
||||
} m_type = Type::NotFound;
|
||||
const HECL::SystemString* m_levelName = nullptr;
|
||||
const HECL::SystemString* m_areaName = nullptr;
|
||||
const HECL::SystemString* m_layerName = nullptr;
|
||||
const hecl::SystemString* m_levelName = nullptr;
|
||||
const hecl::SystemString* m_areaName = nullptr;
|
||||
const hecl::SystemString* m_layerName = nullptr;
|
||||
UniqueResult() = default;
|
||||
UniqueResult(Type tp) : m_type(tp) {}
|
||||
|
||||
|
@ -72,7 +72,7 @@ struct UniqueResult
|
|||
{
|
||||
UniqueResult::Type resultType = UniqueResult::Type::NotFound;
|
||||
bool foundOneLayer = false;
|
||||
const HECL::SystemString* levelName = nullptr;
|
||||
const hecl::SystemString* levelName = nullptr;
|
||||
typename PAKBRIDGE::PAKType::IDType levelId;
|
||||
typename PAKBRIDGE::PAKType::IDType areaId;
|
||||
unsigned layerIdx;
|
||||
|
@ -163,12 +163,12 @@ struct UniqueResult
|
|||
}
|
||||
}
|
||||
|
||||
HECL::ProjectPath uniquePath(const HECL::ProjectPath& pakPath) const
|
||||
hecl::ProjectPath uniquePath(const hecl::ProjectPath& pakPath) const
|
||||
{
|
||||
if (m_type == Type::Pak)
|
||||
return pakPath;
|
||||
|
||||
HECL::ProjectPath levelDir;
|
||||
hecl::ProjectPath levelDir;
|
||||
if (m_levelName)
|
||||
levelDir.assign(pakPath, *m_levelName);
|
||||
else
|
||||
|
@ -177,15 +177,15 @@ struct UniqueResult
|
|||
|
||||
if (m_type == Type::Area)
|
||||
{
|
||||
HECL::ProjectPath areaDir(levelDir, *m_areaName);
|
||||
hecl::ProjectPath areaDir(levelDir, *m_areaName);
|
||||
areaDir.makeDir();
|
||||
return areaDir;
|
||||
}
|
||||
else if (m_type == Type::Layer)
|
||||
{
|
||||
HECL::ProjectPath areaDir(levelDir, *m_areaName);
|
||||
hecl::ProjectPath areaDir(levelDir, *m_areaName);
|
||||
areaDir.makeDir();
|
||||
HECL::ProjectPath layerDir(areaDir, *m_layerName);
|
||||
hecl::ProjectPath layerDir(areaDir, *m_layerName);
|
||||
layerDir.makeDir();
|
||||
return layerDir;
|
||||
}
|
||||
|
@ -201,11 +201,11 @@ class PAKRouter;
|
|||
template <class PAKBRIDGE>
|
||||
struct ResExtractor
|
||||
{
|
||||
std::function<bool(PAKEntryReadStream&, const HECL::ProjectPath&)> func_a;
|
||||
std::function<bool(const SpecBase&, PAKEntryReadStream&, const HECL::ProjectPath&, PAKRouter<PAKBRIDGE>&,
|
||||
std::function<bool(PAKEntryReadStream&, const hecl::ProjectPath&)> func_a;
|
||||
std::function<bool(const SpecBase&, PAKEntryReadStream&, const hecl::ProjectPath&, PAKRouter<PAKBRIDGE>&,
|
||||
const typename PAKBRIDGE::PAKType::Entry&, bool,
|
||||
std::function<void(const HECL::SystemChar*)>)> func_b;
|
||||
const HECL::SystemChar* fileExts[4];
|
||||
std::function<void(const hecl::SystemChar*)>)> func_b;
|
||||
const hecl::SystemChar* fileExts[4];
|
||||
unsigned weight;
|
||||
std::function<void(const SpecBase&, PAKEntryReadStream&, PAKRouter<PAKBRIDGE>&,
|
||||
typename PAKBRIDGE::PAKType::Entry&)> func_name;
|
||||
|
@ -215,13 +215,13 @@ struct ResExtractor
|
|||
template <class IDType>
|
||||
struct Level
|
||||
{
|
||||
HECL::SystemString name;
|
||||
hecl::SystemString name;
|
||||
struct Area
|
||||
{
|
||||
HECL::SystemString name;
|
||||
hecl::SystemString name;
|
||||
struct Layer
|
||||
{
|
||||
HECL::SystemString name;
|
||||
hecl::SystemString name;
|
||||
bool active;
|
||||
std::unordered_set<IDType> resources;
|
||||
};
|
||||
|
@ -244,19 +244,19 @@ private:
|
|||
NamedResourceCatalog<IDType> m_catalog;
|
||||
const SpecBase& m_dataSpec;
|
||||
const std::vector<BRIDGETYPE>* m_bridges = nullptr;
|
||||
std::vector<std::pair<HECL::ProjectPath,HECL::ProjectPath>> m_bridgePaths;
|
||||
std::vector<std::pair<hecl::ProjectPath,hecl::ProjectPath>> m_bridgePaths;
|
||||
size_t m_curBridgeIdx = 0;
|
||||
const HECL::ProjectPath& m_gameWorking;
|
||||
const HECL::ProjectPath& m_gameCooked;
|
||||
HECL::ProjectPath m_sharedWorking;
|
||||
HECL::ProjectPath m_sharedCooked;
|
||||
const hecl::ProjectPath& m_gameWorking;
|
||||
const hecl::ProjectPath& m_gameCooked;
|
||||
hecl::ProjectPath m_sharedWorking;
|
||||
hecl::ProjectPath m_sharedCooked;
|
||||
const PAKType* m_pak = nullptr;
|
||||
const NOD::Node* m_node = nullptr;
|
||||
const nod::Node* m_node = nullptr;
|
||||
std::unordered_map<IDType, std::pair<size_t, EntryType*>> m_uniqueEntries;
|
||||
std::unordered_map<IDType, std::pair<size_t, EntryType*>> m_sharedEntries;
|
||||
std::unordered_map<IDType, RigPair> m_cmdlRigs;
|
||||
public:
|
||||
PAKRouter(const SpecBase& dataSpec, const HECL::ProjectPath& working, const HECL::ProjectPath& cooked)
|
||||
PAKRouter(const SpecBase& dataSpec, const hecl::ProjectPath& working, const hecl::ProjectPath& cooked)
|
||||
: m_dataSpec(dataSpec),
|
||||
m_gameWorking(working), m_gameCooked(cooked),
|
||||
m_sharedWorking(working, "Shared"), m_sharedCooked(cooked, "Shared") {}
|
||||
|
@ -277,13 +277,13 @@ public:
|
|||
for (BRIDGETYPE& bridge : bridges)
|
||||
{
|
||||
const std::string& name = bridge.getName();
|
||||
HECL::SystemStringView sysName(name);
|
||||
hecl::SystemStringView sysName(name);
|
||||
|
||||
HECL::SystemString::const_iterator extit = sysName.sys_str().end() - 4;
|
||||
HECL::SystemString baseName(sysName.sys_str().begin(), extit);
|
||||
hecl::SystemString::const_iterator extit = sysName.sys_str().end() - 4;
|
||||
hecl::SystemString baseName(sysName.sys_str().begin(), extit);
|
||||
|
||||
m_bridgePaths.emplace_back(std::make_pair(HECL::ProjectPath(m_gameWorking, baseName),
|
||||
HECL::ProjectPath(m_gameCooked, baseName)));
|
||||
m_bridgePaths.emplace_back(std::make_pair(hecl::ProjectPath(m_gameWorking, baseName),
|
||||
hecl::ProjectPath(m_gameCooked, baseName)));
|
||||
|
||||
/* Index this PAK */
|
||||
bridge.build();
|
||||
|
@ -319,8 +319,8 @@ public:
|
|||
++bridgeIdx;
|
||||
}
|
||||
|
||||
HECL::SystemString catalogPath = HECL::ProjectPath(m_gameCooked, "catalog.yaml").getAbsolutePath();
|
||||
FILE* catalog = HECL::Fopen(catalogPath.c_str(), _S("wb"));
|
||||
hecl::SystemString catalogPath = hecl::ProjectPath(m_gameCooked, "catalog.yaml").getAbsolutePath();
|
||||
FILE* catalog = hecl::Fopen(catalogPath.c_str(), _S("wb"));
|
||||
if (catalog)
|
||||
{
|
||||
m_catalog.toYAMLFile(catalog);
|
||||
|
@ -346,150 +346,132 @@ public:
|
|||
++pit;
|
||||
++bridgeIdx;
|
||||
}
|
||||
LogDNACommon.report(LogVisor::FatalError, "PAKBridge provided to PAKRouter::enterPAKBridge() was not part of build()");
|
||||
LogDNACommon.report(logvisor::Fatal, "PAKBridge provided to PAKRouter::enterPAKBridge() was not part of build()");
|
||||
}
|
||||
|
||||
HECL::ProjectPath getWorking(const EntryType* entry,
|
||||
hecl::ProjectPath getWorking(const EntryType* entry,
|
||||
const ResExtractor<BRIDGETYPE>& extractor) const
|
||||
{
|
||||
if (!m_pak)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::getWorkingPath()");
|
||||
if (m_pak->m_noShare)
|
||||
{
|
||||
const EntryType* singleSearch = m_pak->lookupEntry(entry->id);
|
||||
if (singleSearch)
|
||||
{
|
||||
const HECL::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].first;
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].first;
|
||||
pakPath.makeDir();
|
||||
#if HECL_UCS2
|
||||
HECL::SystemString entName = HECL::UTF8ToWide(m_pak->bestEntryName(*entry));
|
||||
hecl::SystemString entName = hecl::UTF8ToWide(m_pak->bestEntryName(*entry));
|
||||
#else
|
||||
HECL::SystemString entName = m_pak->bestEntryName(*entry);
|
||||
hecl::SystemString entName = m_pak->bestEntryName(*entry);
|
||||
#endif
|
||||
if (extractor.fileExts[0] && !extractor.fileExts[1])
|
||||
entName += extractor.fileExts[0];
|
||||
return HECL::ProjectPath(pakPath, entName);
|
||||
return hecl::ProjectPath(pakPath, entName);
|
||||
}
|
||||
}
|
||||
|
||||
auto uniqueSearch = m_uniqueEntries.find(entry->id);
|
||||
if (uniqueSearch != m_uniqueEntries.end())
|
||||
{
|
||||
const HECL::ProjectPath& pakPath = m_bridgePaths[uniqueSearch->second.first].first;
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[uniqueSearch->second.first].first;
|
||||
pakPath.makeDir();
|
||||
HECL::ProjectPath uniquePath = entry->unique.uniquePath(pakPath);
|
||||
hecl::ProjectPath uniquePath = entry->unique.uniquePath(pakPath);
|
||||
#if HECL_UCS2
|
||||
HECL::SystemString entName = HECL::UTF8ToWide(m_pak->bestEntryName(*entry));
|
||||
hecl::SystemString entName = hecl::UTF8ToWide(m_pak->bestEntryName(*entry));
|
||||
#else
|
||||
HECL::SystemString entName = m_pak->bestEntryName(*entry);
|
||||
hecl::SystemString entName = m_pak->bestEntryName(*entry);
|
||||
#endif
|
||||
if (extractor.fileExts[0] && !extractor.fileExts[1])
|
||||
entName += extractor.fileExts[0];
|
||||
return HECL::ProjectPath(uniquePath, entName);
|
||||
return hecl::ProjectPath(uniquePath, entName);
|
||||
}
|
||||
|
||||
auto sharedSearch = m_sharedEntries.find(entry->id);
|
||||
if (sharedSearch != m_sharedEntries.end())
|
||||
{
|
||||
const HECL::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].first;
|
||||
HECL::ProjectPath uniquePathPre = entry->unique.uniquePath(pakPath);
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].first;
|
||||
hecl::ProjectPath uniquePathPre = entry->unique.uniquePath(pakPath);
|
||||
#if HECL_UCS2
|
||||
HECL::SystemString entBase = HECL::UTF8ToWide(m_pak->bestEntryName(*entry));
|
||||
hecl::SystemString entBase = hecl::UTF8ToWide(m_pak->bestEntryName(*entry));
|
||||
#else
|
||||
HECL::SystemString entBase = m_pak->bestEntryName(*entry);
|
||||
hecl::SystemString entBase = m_pak->bestEntryName(*entry);
|
||||
#endif
|
||||
HECL::SystemString entName = entBase;
|
||||
hecl::SystemString entName = entBase;
|
||||
if (extractor.fileExts[0] && !extractor.fileExts[1])
|
||||
entName += extractor.fileExts[0];
|
||||
HECL::ProjectPath sharedPath(m_sharedWorking, entName);
|
||||
HECL::ProjectPath uniquePath(uniquePathPre, entName);
|
||||
if (extractor.func_a || extractor.func_b)
|
||||
{
|
||||
if (extractor.fileExts[0] && !extractor.fileExts[1])
|
||||
uniquePath.makeLinkTo(sharedPath);
|
||||
else
|
||||
{
|
||||
for (int e=0 ; e<4 ; ++e)
|
||||
{
|
||||
if (!extractor.fileExts[e])
|
||||
break;
|
||||
HECL::SystemString entName = entBase + extractor.fileExts[e];
|
||||
HECL::ProjectPath sharedPath(m_sharedWorking, entName);
|
||||
HECL::ProjectPath uniquePath(uniquePathPre, entName);
|
||||
uniquePath.makeLinkTo(sharedPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
hecl::ProjectPath sharedPath(m_sharedWorking, entName);
|
||||
m_sharedWorking.makeDir();
|
||||
return sharedPath;
|
||||
}
|
||||
|
||||
LogDNACommon.report(LogVisor::FatalError, "Unable to find entry %s", entry->id.toString().c_str());
|
||||
return HECL::ProjectPath();
|
||||
LogDNACommon.report(logvisor::Fatal, "Unable to find entry %s", entry->id.toString().c_str());
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
|
||||
HECL::ProjectPath getWorking(const EntryType* entry) const
|
||||
hecl::ProjectPath getWorking(const EntryType* entry) const
|
||||
{
|
||||
return getWorking(entry, BRIDGETYPE::LookupExtractor(*entry));
|
||||
}
|
||||
|
||||
HECL::ProjectPath getWorking(const IDType& id) const
|
||||
hecl::ProjectPath getWorking(const IDType& id) const
|
||||
{
|
||||
return getWorking(lookupEntry(id));
|
||||
}
|
||||
|
||||
HECL::ProjectPath getCooked(const EntryType* entry) const
|
||||
hecl::ProjectPath getCooked(const EntryType* entry) const
|
||||
{
|
||||
if (!m_pak)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::getCookedPath()");
|
||||
if (m_pak->m_noShare)
|
||||
{
|
||||
const EntryType* singleSearch = m_pak->lookupEntry(entry->id);
|
||||
if (singleSearch)
|
||||
{
|
||||
const HECL::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].second;
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[m_curBridgeIdx].second;
|
||||
pakPath.makeDir();
|
||||
return HECL::ProjectPath(pakPath, m_pak->bestEntryName(*entry));
|
||||
return hecl::ProjectPath(pakPath, m_pak->bestEntryName(*entry));
|
||||
}
|
||||
}
|
||||
auto uniqueSearch = m_uniqueEntries.find(entry->id);
|
||||
if (uniqueSearch != m_uniqueEntries.end())
|
||||
{
|
||||
const HECL::ProjectPath& pakPath = m_bridgePaths[uniqueSearch->second.first].second;
|
||||
const hecl::ProjectPath& pakPath = m_bridgePaths[uniqueSearch->second.first].second;
|
||||
pakPath.makeDir();
|
||||
HECL::ProjectPath uniquePath = entry->unique.uniquePath(pakPath);
|
||||
return HECL::ProjectPath(uniquePath, m_pak->bestEntryName(*entry));
|
||||
hecl::ProjectPath uniquePath = entry->unique.uniquePath(pakPath);
|
||||
return hecl::ProjectPath(uniquePath, m_pak->bestEntryName(*entry));
|
||||
}
|
||||
auto sharedSearch = m_sharedEntries.find(entry->id);
|
||||
if (sharedSearch != m_sharedEntries.end())
|
||||
{
|
||||
m_sharedCooked.makeDir();
|
||||
return HECL::ProjectPath(m_sharedCooked, m_pak->bestEntryName(*entry));
|
||||
return hecl::ProjectPath(m_sharedCooked, m_pak->bestEntryName(*entry));
|
||||
}
|
||||
LogDNACommon.report(LogVisor::FatalError, "Unable to find entry %s", entry->id.toString().c_str());
|
||||
return HECL::ProjectPath();
|
||||
LogDNACommon.report(logvisor::Fatal, "Unable to find entry %s", entry->id.toString().c_str());
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
|
||||
HECL::ProjectPath getCooked(const IDType& id) const
|
||||
hecl::ProjectPath getCooked(const IDType& id) const
|
||||
{
|
||||
return getCooked(lookupEntry(id));
|
||||
}
|
||||
|
||||
HECL::SystemString getResourceRelativePath(const EntryType& a, const IDType& b) const
|
||||
hecl::SystemString getResourceRelativePath(const EntryType& a, const IDType& b) const
|
||||
{
|
||||
if (!m_pak)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::getResourceRelativePath()");
|
||||
const typename BRIDGETYPE::PAKType::Entry* be = lookupEntry(b);
|
||||
if (!be)
|
||||
return HECL::SystemString();
|
||||
HECL::ProjectPath aPath = getWorking(&a, BRIDGETYPE::LookupExtractor(a));
|
||||
HECL::SystemString ret;
|
||||
return hecl::SystemString();
|
||||
hecl::ProjectPath aPath = getWorking(&a, BRIDGETYPE::LookupExtractor(a));
|
||||
hecl::SystemString ret;
|
||||
for (int i=0 ; i<aPath.levelCount() ; ++i)
|
||||
ret += _S("../");
|
||||
HECL::ProjectPath bPath = getWorking(be, BRIDGETYPE::LookupExtractor(*be));
|
||||
hecl::ProjectPath bPath = getWorking(be, BRIDGETYPE::LookupExtractor(*be));
|
||||
ret += bPath.getRelativePath();
|
||||
return ret;
|
||||
}
|
||||
|
@ -497,7 +479,7 @@ public:
|
|||
std::string getBestEntryName(const EntryType& entry) const
|
||||
{
|
||||
if (!m_pak)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::getBestEntryName()");
|
||||
return m_pak->bestEntryName(entry);
|
||||
}
|
||||
|
@ -505,7 +487,7 @@ public:
|
|||
std::string getBestEntryName(const IDType& entry) const
|
||||
{
|
||||
if (!m_pak)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::getBestEntryName()");
|
||||
const typename BRIDGETYPE::PAKType::Entry* e = m_pak->lookupEntry(entry);
|
||||
if (!e)
|
||||
|
@ -514,7 +496,7 @@ public:
|
|||
}
|
||||
|
||||
bool extractResources(const BRIDGETYPE& pakBridge, bool force,
|
||||
std::function<void(const HECL::SystemChar*, float)> progress)
|
||||
std::function<void(const hecl::SystemChar*, float)> progress)
|
||||
{
|
||||
enterPAKBridge(pakBridge);
|
||||
size_t count = 0;
|
||||
|
@ -529,24 +511,24 @@ public:
|
|||
continue;
|
||||
|
||||
std::string bestName = getBestEntryName(*item);
|
||||
HECL::SystemStringView bestNameView(bestName);
|
||||
hecl::SystemStringView bestNameView(bestName);
|
||||
float thisFac = ++count / fsz;
|
||||
progress(bestNameView.sys_str().c_str(), thisFac);
|
||||
|
||||
/* TODO: Position after extracted item */
|
||||
HECL::ProjectPath cooked = getCooked(item);
|
||||
if (force || cooked.getPathType() == HECL::ProjectPath::Type::None)
|
||||
hecl::ProjectPath cooked = getCooked(item);
|
||||
if (force || cooked.getPathType() == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
PAKEntryReadStream s = item->beginReadStream(*m_node);
|
||||
FILE* fout = HECL::Fopen(cooked.getAbsolutePath().c_str(), _S("wb"));
|
||||
FILE* fout = hecl::Fopen(cooked.getAbsolutePath().c_str(), _S("wb"));
|
||||
fwrite(s.data(), 1, s.length(), fout);
|
||||
fclose(fout);
|
||||
}
|
||||
|
||||
HECL::ProjectPath working = getWorking(item, extractor);
|
||||
hecl::ProjectPath working = getWorking(item, extractor);
|
||||
if (extractor.func_a) /* Doesn't need PAKRouter access */
|
||||
{
|
||||
if (force || working.getPathType() == HECL::ProjectPath::Type::None)
|
||||
if (force || working.getPathType() == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
PAKEntryReadStream s = item->beginReadStream(*m_node);
|
||||
extractor.func_a(s, working);
|
||||
|
@ -554,11 +536,11 @@ public:
|
|||
}
|
||||
else if (extractor.func_b) /* Needs PAKRouter access */
|
||||
{
|
||||
if (force || working.getPathType() == HECL::ProjectPath::Type::None)
|
||||
if (force || working.getPathType() == hecl::ProjectPath::Type::None)
|
||||
{
|
||||
PAKEntryReadStream s = item->beginReadStream(*m_node);
|
||||
extractor.func_b(m_dataSpec, s, working, *this, *item, force,
|
||||
[&progress, thisFac](const HECL::SystemChar* update)
|
||||
[&progress, thisFac](const hecl::SystemChar* update)
|
||||
{
|
||||
progress(update, thisFac);
|
||||
});
|
||||
|
@ -571,7 +553,7 @@ public:
|
|||
}
|
||||
|
||||
const typename BRIDGETYPE::PAKType::Entry* lookupEntry(const IDType& entry,
|
||||
const NOD::Node** nodeOut=nullptr,
|
||||
const nod::Node** nodeOut=nullptr,
|
||||
bool silenceWarnings=false,
|
||||
bool currentPAK=false) const
|
||||
{
|
||||
|
@ -579,7 +561,7 @@ public:
|
|||
return nullptr;
|
||||
|
||||
if (!m_bridges)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::build() must be called before PAKRouter::lookupEntry()");
|
||||
|
||||
if (m_pak)
|
||||
|
@ -596,7 +578,7 @@ public:
|
|||
if (currentPAK)
|
||||
{
|
||||
if (!silenceWarnings)
|
||||
LogDNACommon.report(LogVisor::Warning, "unable to find PAK entry %s in current PAK", entry.toString().c_str());
|
||||
LogDNACommon.report(logvisor::Warning, "unable to find PAK entry %s in current PAK", entry.toString().c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -613,7 +595,7 @@ public:
|
|||
}
|
||||
|
||||
if (!silenceWarnings)
|
||||
LogDNACommon.report(LogVisor::Warning, "unable to find PAK entry %s", entry.toString().c_str());
|
||||
LogDNACommon.report(logvisor::Warning, "unable to find PAK entry %s", entry.toString().c_str());
|
||||
if (nodeOut)
|
||||
*nodeOut = nullptr;
|
||||
return nullptr;
|
||||
|
@ -622,7 +604,7 @@ public:
|
|||
template <typename DNA>
|
||||
bool lookupAndReadDNA(const IDType& id, DNA& out, bool silenceWarnings=false)
|
||||
{
|
||||
const NOD::Node* node;
|
||||
const nod::Node* node;
|
||||
const EntryType* entry = lookupEntry(id, &node, silenceWarnings);
|
||||
if (!entry)
|
||||
return false;
|
||||
|
@ -639,10 +621,10 @@ public:
|
|||
return &search->second;
|
||||
}
|
||||
|
||||
HECL::ProjectPath getAreaLayerWorking(const IDType& areaId, int layerIdx) const
|
||||
hecl::ProjectPath getAreaLayerWorking(const IDType& areaId, int layerIdx) const
|
||||
{
|
||||
if (!m_bridges)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::build() must be called before PAKRouter::getAreaLayerWorking()");
|
||||
auto bridgePathIt = m_bridgePaths.cbegin();
|
||||
for (const BRIDGETYPE& bridge : *m_bridges)
|
||||
|
@ -651,21 +633,21 @@ public:
|
|||
for (const auto& area : level.second.areas)
|
||||
if (area.first == areaId)
|
||||
{
|
||||
HECL::ProjectPath levelPath(bridgePathIt->first, level.second.name);
|
||||
HECL::ProjectPath areaPath(levelPath, area.second.name);
|
||||
hecl::ProjectPath levelPath(bridgePathIt->first, level.second.name);
|
||||
hecl::ProjectPath areaPath(levelPath, area.second.name);
|
||||
if (layerIdx < 0)
|
||||
return areaPath;
|
||||
return HECL::ProjectPath(areaPath, area.second.layers.at(layerIdx).name);
|
||||
return hecl::ProjectPath(areaPath, area.second.layers.at(layerIdx).name);
|
||||
}
|
||||
++bridgePathIt;
|
||||
}
|
||||
return HECL::ProjectPath();
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
|
||||
HECL::ProjectPath getAreaLayerCooked(const IDType& areaId, int layerIdx) const
|
||||
hecl::ProjectPath getAreaLayerCooked(const IDType& areaId, int layerIdx) const
|
||||
{
|
||||
if (!m_bridges)
|
||||
LogDNACommon.report(LogVisor::FatalError,
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::build() must be called before PAKRouter::getAreaLayerCooked()");
|
||||
auto bridgePathIt = m_bridgePaths.cbegin();
|
||||
for (const BRIDGETYPE& bridge : *m_bridges)
|
||||
|
@ -674,15 +656,15 @@ public:
|
|||
for (const auto& area : level.second.areas)
|
||||
if (area.first == areaId)
|
||||
{
|
||||
HECL::ProjectPath levelPath(bridgePathIt->second, level.second.name);
|
||||
HECL::ProjectPath areaPath(levelPath, area.second.name);
|
||||
hecl::ProjectPath levelPath(bridgePathIt->second, level.second.name);
|
||||
hecl::ProjectPath areaPath(levelPath, area.second.name);
|
||||
if (layerIdx < 0)
|
||||
return areaPath;
|
||||
return HECL::ProjectPath(areaPath, area.second.layers.at(layerIdx).name);
|
||||
return hecl::ProjectPath(areaPath, area.second.layers.at(layerIdx).name);
|
||||
}
|
||||
++bridgePathIt;
|
||||
}
|
||||
return HECL::ProjectPath();
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "ParticleCommon.hpp"
|
||||
#include "PAK.hpp"
|
||||
#include "Athena/FileWriter.hpp"
|
||||
#include "athena/FileWriter.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ namespace DNAParticle
|
|||
template <class IDType>
|
||||
struct GPSM : BigYAML
|
||||
{
|
||||
static const char* DNAType() {return "Retro::GPSM";}
|
||||
static const char* DNAType() {return "urde::GPSM";}
|
||||
const char* DNATypeV() const {return DNAType();}
|
||||
|
||||
VectorElementFactory x0_PSIV;
|
||||
|
@ -107,13 +107,13 @@ struct GPSM : BigYAML
|
|||
x45_25_PMOO = true;
|
||||
}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
for (const auto& elem : r.getCurNode()->m_mapChildren)
|
||||
{
|
||||
if (elem.first.size() < 4)
|
||||
{
|
||||
LogModule.report(LogVisor::Warning, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Warning, "short FourCC in element '%s'", elem.first.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -366,7 +366,7 @@ struct GPSM : BigYAML
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (x0_PSIV)
|
||||
{
|
||||
|
@ -950,13 +950,13 @@ struct GPSM : BigYAML
|
|||
__isz = x128_ADV8.binarySize(__isz + 4);
|
||||
return __isz;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
if (clsId != SBIG('GPSM'))
|
||||
{
|
||||
LogModule.report(LogVisor::Warning, "non GPSM provided to GPSM parser");
|
||||
LogModule.report(logvisor::Warning, "non GPSM provided to GPSM parser");
|
||||
return;
|
||||
}
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
|
@ -1226,13 +1226,13 @@ struct GPSM : BigYAML
|
|||
xd8_SELC.read(r);
|
||||
break;
|
||||
default:
|
||||
LogModule.report(LogVisor::FatalError, "Unknown GPSM class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, "Unknown GPSM class %.4s @%" PRIi64, &clsId, r.position());
|
||||
break;
|
||||
}
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
}
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeBytes((atInt8*)"GPSM", 4);
|
||||
if (x0_PSIV)
|
||||
|
@ -1626,9 +1626,9 @@ struct GPSM : BigYAML
|
|||
};
|
||||
|
||||
template <class IDType>
|
||||
bool ExtractGPSM(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
|
||||
bool ExtractGPSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("w"));
|
||||
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("w"));
|
||||
if (fp)
|
||||
{
|
||||
GPSM<IDType> gpsm;
|
||||
|
@ -1641,9 +1641,9 @@ bool ExtractGPSM(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
|
|||
}
|
||||
|
||||
template <class IDType>
|
||||
bool WriteGPSM(const GPSM<IDType>& gpsm, const HECL::ProjectPath& outPath)
|
||||
bool WriteGPSM(const GPSM<IDType>& gpsm, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
Athena::io::FileWriter w(outPath.getAbsolutePath(), true, false);
|
||||
athena::io::FileWriter w(outPath.getAbsolutePath(), true, false);
|
||||
if (w.hasError())
|
||||
return false;
|
||||
gpsm.write(w);
|
||||
|
|
|
@ -4,9 +4,9 @@ namespace DataSpec
|
|||
{
|
||||
namespace DNAParticle
|
||||
{
|
||||
LogVisor::LogModule LogModule("Retro::DNAParticle");
|
||||
logvisor::Module LogModule("urde::DNAParticle");
|
||||
|
||||
void RealElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
void RealElementFactory::read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
||||
if (mapChildren.empty())
|
||||
|
@ -17,7 +17,7 @@ void RealElementFactory::read(Athena::io::YAMLDocReader& r)
|
|||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ void RealElementFactory::read(Athena::io::YAMLDocReader& r)
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
|
||||
void RealElementFactory::write(Athena::io::YAMLDocWriter& w) const
|
||||
void RealElementFactory::write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ size_t RealElementFactory::binarySize(size_t __isz) const
|
|||
return __isz + 4;
|
||||
}
|
||||
|
||||
void RealElementFactory::read(Athena::io::IStreamReader& r)
|
||||
void RealElementFactory::read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
|
@ -259,13 +259,13 @@ void RealElementFactory::read(Athena::io::IStreamReader& r)
|
|||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(LogVisor::FatalError, "Unknown RealElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, "Unknown RealElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
}
|
||||
|
||||
void RealElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
void RealElementFactory::write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
@ -277,7 +277,7 @@ void RealElementFactory::write(Athena::io::IStreamWriter& w) const
|
|||
}
|
||||
|
||||
|
||||
void IntElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
void IntElementFactory::read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
||||
if (mapChildren.empty())
|
||||
|
@ -288,7 +288,7 @@ void IntElementFactory::read(Athena::io::YAMLDocReader& r)
|
|||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
||||
{
|
||||
|
@ -353,7 +353,7 @@ void IntElementFactory::read(Athena::io::YAMLDocReader& r)
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
|
||||
void IntElementFactory::write(Athena::io::YAMLDocWriter& w) const
|
||||
void IntElementFactory::write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
@ -371,7 +371,7 @@ size_t IntElementFactory::binarySize(size_t __isz) const
|
|||
return __isz + 4;
|
||||
}
|
||||
|
||||
void IntElementFactory::read(Athena::io::IStreamReader& r)
|
||||
void IntElementFactory::read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
|
@ -434,13 +434,13 @@ void IntElementFactory::read(Athena::io::IStreamReader& r)
|
|||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(LogVisor::FatalError, "Unknown IntElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, "Unknown IntElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
}
|
||||
|
||||
void IntElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
void IntElementFactory::write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
@ -451,7 +451,7 @@ void IntElementFactory::write(Athena::io::IStreamWriter& w) const
|
|||
w.writeBytes((atInt8*)"NONE", 4);
|
||||
}
|
||||
|
||||
void VectorElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
void VectorElementFactory::read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
||||
if (mapChildren.empty())
|
||||
|
@ -462,7 +462,7 @@ void VectorElementFactory::read(Athena::io::YAMLDocReader& r)
|
|||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
||||
{
|
||||
|
@ -527,7 +527,7 @@ void VectorElementFactory::read(Athena::io::YAMLDocReader& r)
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
|
||||
void VectorElementFactory::write(Athena::io::YAMLDocWriter& w) const
|
||||
void VectorElementFactory::write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
@ -545,7 +545,7 @@ size_t VectorElementFactory::binarySize(size_t __isz) const
|
|||
return __isz + 4;
|
||||
}
|
||||
|
||||
void VectorElementFactory::read(Athena::io::IStreamReader& r)
|
||||
void VectorElementFactory::read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
|
@ -608,13 +608,13 @@ void VectorElementFactory::read(Athena::io::IStreamReader& r)
|
|||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(LogVisor::FatalError, "Unknown VectorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, "Unknown VectorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
}
|
||||
|
||||
void VectorElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
void VectorElementFactory::write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
@ -626,7 +626,7 @@ void VectorElementFactory::write(Athena::io::IStreamWriter& w) const
|
|||
}
|
||||
|
||||
|
||||
void ColorElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
void ColorElementFactory::read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
||||
if (mapChildren.empty())
|
||||
|
@ -637,7 +637,7 @@ void ColorElementFactory::read(Athena::io::YAMLDocReader& r)
|
|||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
||||
{
|
||||
|
@ -669,7 +669,7 @@ void ColorElementFactory::read(Athena::io::YAMLDocReader& r)
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
|
||||
void ColorElementFactory::write(Athena::io::YAMLDocWriter& w) const
|
||||
void ColorElementFactory::write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
@ -687,7 +687,7 @@ size_t ColorElementFactory::binarySize(size_t __isz) const
|
|||
return __isz + 4;
|
||||
}
|
||||
|
||||
void ColorElementFactory::read(Athena::io::IStreamReader& r)
|
||||
void ColorElementFactory::read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
|
@ -717,13 +717,13 @@ void ColorElementFactory::read(Athena::io::IStreamReader& r)
|
|||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(LogVisor::FatalError, "Unknown ColorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, "Unknown ColorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
}
|
||||
|
||||
void ColorElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
void ColorElementFactory::write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
@ -735,7 +735,7 @@ void ColorElementFactory::write(Athena::io::IStreamWriter& w) const
|
|||
}
|
||||
|
||||
|
||||
void ModVectorElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
void ModVectorElementFactory::read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
||||
if (mapChildren.empty())
|
||||
|
@ -746,7 +746,7 @@ void ModVectorElementFactory::read(Athena::io::YAMLDocReader& r)
|
|||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
||||
{
|
||||
|
@ -795,7 +795,7 @@ void ModVectorElementFactory::read(Athena::io::YAMLDocReader& r)
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
|
||||
void ModVectorElementFactory::write(Athena::io::YAMLDocWriter& w) const
|
||||
void ModVectorElementFactory::write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
@ -813,7 +813,7 @@ size_t ModVectorElementFactory::binarySize(size_t __isz) const
|
|||
return __isz + 4;
|
||||
}
|
||||
|
||||
void ModVectorElementFactory::read(Athena::io::IStreamReader& r)
|
||||
void ModVectorElementFactory::read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
|
@ -860,13 +860,13 @@ void ModVectorElementFactory::read(Athena::io::IStreamReader& r)
|
|||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(LogVisor::FatalError, "Unknown ModVectorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, "Unknown ModVectorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
}
|
||||
|
||||
void ModVectorElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
void ModVectorElementFactory::write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
@ -878,7 +878,7 @@ void ModVectorElementFactory::write(Athena::io::IStreamWriter& w) const
|
|||
}
|
||||
|
||||
|
||||
void EmitterElementFactory::read(Athena::io::YAMLDocReader& r)
|
||||
void EmitterElementFactory::read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
const auto& mapChildren = r.getCurNode()->m_mapChildren;
|
||||
if (mapChildren.empty())
|
||||
|
@ -889,7 +889,7 @@ void EmitterElementFactory::read(Athena::io::YAMLDocReader& r)
|
|||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(LogVisor::FatalError, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
|
||||
{
|
||||
|
@ -914,7 +914,7 @@ void EmitterElementFactory::read(Athena::io::YAMLDocReader& r)
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
|
||||
void EmitterElementFactory::write(Athena::io::YAMLDocWriter& w) const
|
||||
void EmitterElementFactory::write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
@ -932,7 +932,7 @@ size_t EmitterElementFactory::binarySize(size_t __isz) const
|
|||
return __isz + 4;
|
||||
}
|
||||
|
||||
void EmitterElementFactory::read(Athena::io::IStreamReader& r)
|
||||
void EmitterElementFactory::read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
|
@ -955,13 +955,13 @@ void EmitterElementFactory::read(Athena::io::IStreamReader& r)
|
|||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(LogVisor::FatalError, "Unknown EmitterElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, "Unknown EmitterElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
}
|
||||
|
||||
void EmitterElementFactory::write(Athena::io::IStreamWriter& w) const
|
||||
void EmitterElementFactory::write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace DataSpec
|
|||
{
|
||||
namespace DNAParticle
|
||||
{
|
||||
extern LogVisor::LogModule LogModule;
|
||||
extern logvisor::Module LogModule;
|
||||
|
||||
struct IElement : BigYAML
|
||||
{
|
||||
|
@ -23,11 +23,11 @@ struct RealElementFactory : BigYAML
|
|||
std::unique_ptr<IRealElement> m_elem;
|
||||
operator bool() const {return m_elem.operator bool();}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r);
|
||||
void write(Athena::io::YAMLDocWriter& w) const;
|
||||
void read(athena::io::YAMLDocReader& r);
|
||||
void write(athena::io::YAMLDocWriter& w) const;
|
||||
size_t binarySize(size_t __isz) const;
|
||||
void read(Athena::io::IStreamReader& r);
|
||||
void write(Athena::io::IStreamWriter& w) const;
|
||||
void read(athena::io::IStreamReader& r);
|
||||
void write(athena::io::IStreamWriter& w) const;
|
||||
};
|
||||
|
||||
struct IIntElement : IElement {Delete _d;};
|
||||
|
@ -37,11 +37,11 @@ struct IntElementFactory : BigYAML
|
|||
std::unique_ptr<IIntElement> m_elem;
|
||||
operator bool() const {return m_elem.operator bool();}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r);
|
||||
void write(Athena::io::YAMLDocWriter& w) const;
|
||||
void read(athena::io::YAMLDocReader& r);
|
||||
void write(athena::io::YAMLDocWriter& w) const;
|
||||
size_t binarySize(size_t __isz) const;
|
||||
void read(Athena::io::IStreamReader& r);
|
||||
void write(Athena::io::IStreamWriter& w) const;
|
||||
void read(athena::io::IStreamReader& r);
|
||||
void write(athena::io::IStreamWriter& w) const;
|
||||
};
|
||||
|
||||
struct IVectorElement : IElement {Delete _d;};
|
||||
|
@ -51,11 +51,11 @@ struct VectorElementFactory : BigYAML
|
|||
std::unique_ptr<IVectorElement> m_elem;
|
||||
operator bool() const {return m_elem.operator bool();}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r);
|
||||
void write(Athena::io::YAMLDocWriter& w) const;
|
||||
void read(athena::io::YAMLDocReader& r);
|
||||
void write(athena::io::YAMLDocWriter& w) const;
|
||||
size_t binarySize(size_t __isz) const;
|
||||
void read(Athena::io::IStreamReader& r);
|
||||
void write(Athena::io::IStreamWriter& w) const;
|
||||
void read(athena::io::IStreamReader& r);
|
||||
void write(athena::io::IStreamWriter& w) const;
|
||||
};
|
||||
|
||||
struct IColorElement : IElement {Delete _d;};
|
||||
|
@ -65,11 +65,11 @@ struct ColorElementFactory : BigYAML
|
|||
std::unique_ptr<IColorElement> m_elem;
|
||||
operator bool() const {return m_elem.operator bool();}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r);
|
||||
void write(Athena::io::YAMLDocWriter& w) const;
|
||||
void read(athena::io::YAMLDocReader& r);
|
||||
void write(athena::io::YAMLDocWriter& w) const;
|
||||
size_t binarySize(size_t __isz) const;
|
||||
void read(Athena::io::IStreamReader& r);
|
||||
void write(Athena::io::IStreamWriter& w) const;
|
||||
void read(athena::io::IStreamReader& r);
|
||||
void write(athena::io::IStreamWriter& w) const;
|
||||
};
|
||||
|
||||
struct IModVectorElement : IElement {Delete _d;};
|
||||
|
@ -79,11 +79,11 @@ struct ModVectorElementFactory : BigYAML
|
|||
std::unique_ptr<IModVectorElement> m_elem;
|
||||
operator bool() const {return m_elem.operator bool();}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r);
|
||||
void write(Athena::io::YAMLDocWriter& w) const;
|
||||
void read(athena::io::YAMLDocReader& r);
|
||||
void write(athena::io::YAMLDocWriter& w) const;
|
||||
size_t binarySize(size_t __isz) const;
|
||||
void read(Athena::io::IStreamReader& r);
|
||||
void write(Athena::io::IStreamWriter& w) const;
|
||||
void read(athena::io::IStreamReader& r);
|
||||
void write(athena::io::IStreamWriter& w) const;
|
||||
};
|
||||
|
||||
struct IEmitterElement : IElement {Delete _d;};
|
||||
|
@ -93,11 +93,11 @@ struct EmitterElementFactory : BigYAML
|
|||
std::unique_ptr<IEmitterElement> m_elem;
|
||||
operator bool() const {return m_elem.operator bool();}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r);
|
||||
void write(Athena::io::YAMLDocWriter& w) const;
|
||||
void read(athena::io::YAMLDocReader& r);
|
||||
void write(athena::io::YAMLDocWriter& w) const;
|
||||
size_t binarySize(size_t __isz) const;
|
||||
void read(Athena::io::IStreamReader& r);
|
||||
void write(Athena::io::IStreamWriter& w) const;
|
||||
void read(athena::io::IStreamReader& r);
|
||||
void write(athena::io::IStreamWriter& w) const;
|
||||
};
|
||||
|
||||
struct IUVElement : IElement {Delete _d;};
|
||||
|
@ -108,11 +108,11 @@ struct BoolHelper : IElement
|
|||
bool value = false;
|
||||
operator bool() const {return value;}
|
||||
BoolHelper& operator=(bool val) {value = val; return *this;}
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
value = r.readBool(nullptr);
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.writeBool(nullptr, value);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ struct BoolHelper : IElement
|
|||
{
|
||||
return __isz + 5;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
|
@ -129,7 +129,7 @@ struct BoolHelper : IElement
|
|||
else
|
||||
value = false;
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeBytes((atInt8*)"CNST", 4);
|
||||
w.writeBool(value);
|
||||
|
@ -150,11 +150,11 @@ struct REConstant : IRealElement
|
|||
Delete _d;
|
||||
Value<float> val;
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
val = r.readFloat(nullptr);
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.writeFloat(nullptr, val);
|
||||
}
|
||||
|
@ -162,11 +162,11 @@ struct REConstant : IRealElement
|
|||
{
|
||||
return __isz + 4;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
val = r.readFloatBig();
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeFloatBig(val);
|
||||
}
|
||||
|
@ -463,11 +463,11 @@ struct IEConstant : IIntElement
|
|||
Delete _d;
|
||||
Value<atUint32> val;
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
val = r.readUint32(nullptr);
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.writeUint32(nullptr, val);
|
||||
}
|
||||
|
@ -475,11 +475,11 @@ struct IEConstant : IIntElement
|
|||
{
|
||||
return __isz + 4;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
val = r.readUint32Big();
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeUint32Big(val);
|
||||
}
|
||||
|
@ -624,7 +624,7 @@ struct VEConstant : IVectorElement
|
|||
Delete _d;
|
||||
RealElementFactory comps[3];
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
{
|
||||
|
@ -633,7 +633,7 @@ struct VEConstant : IVectorElement
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.enterSubVector(nullptr);
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
|
@ -650,13 +650,13 @@ struct VEConstant : IVectorElement
|
|||
__isz = comps[1].binarySize(__isz);
|
||||
return comps[2].binarySize(__isz);
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
comps[0].read(r);
|
||||
comps[1].read(r);
|
||||
comps[2].read(r);
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
comps[0].write(w);
|
||||
comps[1].write(w);
|
||||
|
@ -772,7 +772,7 @@ struct CEConstant : IColorElement
|
|||
Delete _d;
|
||||
RealElementFactory comps[4];
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
{
|
||||
|
@ -781,7 +781,7 @@ struct CEConstant : IColorElement
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.enterSubVector(nullptr);
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
|
@ -799,14 +799,14 @@ struct CEConstant : IColorElement
|
|||
__isz = comps[2].binarySize(__isz);
|
||||
return comps[3].binarySize(__isz);
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
comps[0].read(r);
|
||||
comps[1].read(r);
|
||||
comps[2].read(r);
|
||||
comps[3].read(r);
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
comps[0].write(w);
|
||||
comps[1].write(w);
|
||||
|
@ -902,7 +902,7 @@ struct MVEConstant : IModVectorElement
|
|||
Delete _d;
|
||||
RealElementFactory comps[3];
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
{
|
||||
|
@ -911,7 +911,7 @@ struct MVEConstant : IModVectorElement
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.enterSubVector(nullptr);
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
|
@ -928,13 +928,13 @@ struct MVEConstant : IModVectorElement
|
|||
__isz = comps[1].binarySize(__isz);
|
||||
return comps[2].binarySize(__isz);
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
comps[0].read(r);
|
||||
comps[1].read(r);
|
||||
comps[2].read(r);
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
comps[0].write(w);
|
||||
comps[1].write(w);
|
||||
|
@ -1039,7 +1039,7 @@ struct EESimpleEmitterTR : EESimpleEmitter
|
|||
{
|
||||
Delete _d;
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
position.m_elem.reset();
|
||||
velocity.m_elem.reset();
|
||||
|
@ -1054,7 +1054,7 @@ struct EESimpleEmitterTR : EESimpleEmitter
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.enterSubRecord("ILOC");
|
||||
position.write(w);
|
||||
|
@ -1070,7 +1070,7 @@ struct EESimpleEmitterTR : EESimpleEmitter
|
|||
__isz = velocity.binarySize(__isz);
|
||||
return __isz;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
position.m_elem.reset();
|
||||
velocity.m_elem.reset();
|
||||
|
@ -1084,7 +1084,7 @@ struct EESimpleEmitterTR : EESimpleEmitter
|
|||
velocity.read(r);
|
||||
}
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeBytes((atInt8*)"ILOC", 4);
|
||||
position.write(w);
|
||||
|
@ -1099,7 +1099,7 @@ struct UVEConstant : IUVElement
|
|||
{
|
||||
Delete _d;
|
||||
IDType tex;
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
tex.clear();
|
||||
if (r.enterSubRecord("tex"))
|
||||
|
@ -1108,7 +1108,7 @@ struct UVEConstant : IUVElement
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.enterSubRecord("tex");
|
||||
tex.write(w);
|
||||
|
@ -1118,7 +1118,7 @@ struct UVEConstant : IUVElement
|
|||
{
|
||||
return tex.binarySize(__isz + 4);
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
tex.clear();
|
||||
uint32_t clsId;
|
||||
|
@ -1126,7 +1126,7 @@ struct UVEConstant : IUVElement
|
|||
if (clsId == SBIG('CNST'))
|
||||
tex.read(r);
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeBytes((atInt8*)"CNST", 4);
|
||||
tex.write(w);
|
||||
|
@ -1145,7 +1145,7 @@ struct UVEAnimTexture : IUVElement
|
|||
IntElementFactory strideH;
|
||||
IntElementFactory cycleFrames;
|
||||
Value<bool> loop = false;
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
tex.clear();
|
||||
if (r.enterSubRecord("tex"))
|
||||
|
@ -1184,7 +1184,7 @@ struct UVEAnimTexture : IUVElement
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.enterSubRecord("tex");
|
||||
tex.write(w);
|
||||
|
@ -1217,7 +1217,7 @@ struct UVEAnimTexture : IUVElement
|
|||
__isz = cycleFrames.binarySize(__isz);
|
||||
return __isz;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
tex.clear();
|
||||
uint32_t clsId;
|
||||
|
@ -1233,7 +1233,7 @@ struct UVEAnimTexture : IUVElement
|
|||
if (clsId == SBIG('CNST'))
|
||||
loop = r.readBool();
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
w.writeBytes((atInt8*)"CNST", 4);
|
||||
tex.write(w);
|
||||
|
@ -1255,7 +1255,7 @@ struct UVElementFactory : BigYAML
|
|||
std::unique_ptr<IUVElement> m_elem;
|
||||
operator bool() const {return m_elem.operator bool();}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
if (r.enterSubRecord("CNST"))
|
||||
{
|
||||
|
@ -1273,7 +1273,7 @@ struct UVElementFactory : BigYAML
|
|||
m_elem.reset();
|
||||
}
|
||||
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
@ -1291,7 +1291,7 @@ struct UVElementFactory : BigYAML
|
|||
return __isz + 4;
|
||||
}
|
||||
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
|
@ -1310,7 +1310,7 @@ struct UVElementFactory : BigYAML
|
|||
m_elem->read(r);
|
||||
}
|
||||
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (m_elem)
|
||||
{
|
||||
|
@ -1339,7 +1339,7 @@ struct SpawnSystemKeyframeData : BigYAML
|
|||
Value<atUint32> b;
|
||||
Value<atUint32> c;
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
if (r.enterSubRecord("id"))
|
||||
{
|
||||
|
@ -1362,7 +1362,7 @@ struct SpawnSystemKeyframeData : BigYAML
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
w.enterSubRecord("id");
|
||||
id.write(w);
|
||||
|
@ -1375,14 +1375,14 @@ struct SpawnSystemKeyframeData : BigYAML
|
|||
{
|
||||
return id.binarySize(__isz + 12);
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
id.read(r);
|
||||
a = r.readUint32Big();
|
||||
b = r.readUint32Big();
|
||||
c = r.readUint32Big();
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
id.write(w);
|
||||
w.writeUint32Big(a);
|
||||
|
@ -1393,7 +1393,7 @@ struct SpawnSystemKeyframeData : BigYAML
|
|||
|
||||
std::vector<std::pair<atUint32, std::vector<SpawnSystemKeyframeInfo>>> spawns;
|
||||
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
if (r.enterSubRecord("a"))
|
||||
{
|
||||
|
@ -1416,18 +1416,20 @@ struct SpawnSystemKeyframeData : BigYAML
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
spawns.clear();
|
||||
if (r.enterSubVector("spawns"))
|
||||
size_t spawnCount;
|
||||
if (r.enterSubVector("spawns", spawnCount))
|
||||
{
|
||||
spawns.reserve(r.getCurNode()->m_seqChildren.size());
|
||||
spawns.reserve(spawnCount);
|
||||
for (const auto& child : r.getCurNode()->m_seqChildren)
|
||||
{
|
||||
if (r.enterSubRecord(nullptr))
|
||||
{
|
||||
spawns.emplace_back();
|
||||
spawns.back().first = r.readUint32("startFrame");
|
||||
if (r.enterSubVector("systems"))
|
||||
size_t systemCount;
|
||||
if (r.enterSubVector("systems", systemCount))
|
||||
{
|
||||
spawns.back().second.reserve(r.getCurNode()->m_seqChildren.size());
|
||||
spawns.back().second.reserve(systemCount);
|
||||
for (const auto& in : r.getCurNode()->m_seqChildren)
|
||||
{
|
||||
spawns.back().second.emplace_back();
|
||||
|
@ -1444,7 +1446,7 @@ struct SpawnSystemKeyframeData : BigYAML
|
|||
r.leaveSubVector();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (spawns.empty())
|
||||
return;
|
||||
|
@ -1480,7 +1482,7 @@ struct SpawnSystemKeyframeData : BigYAML
|
|||
}
|
||||
return __isz;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
|
@ -1507,7 +1509,7 @@ struct SpawnSystemKeyframeData : BigYAML
|
|||
}
|
||||
}
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (spawns.empty())
|
||||
{
|
||||
|
@ -1537,7 +1539,7 @@ struct ChildResourceFactory : BigYAML
|
|||
{
|
||||
Delete _d;
|
||||
IDType id;
|
||||
void read(Athena::io::YAMLDocReader& r)
|
||||
void read(athena::io::YAMLDocReader& r)
|
||||
{
|
||||
id.clear();
|
||||
if (r.enterSubRecord("CNST"))
|
||||
|
@ -1546,7 +1548,7 @@ struct ChildResourceFactory : BigYAML
|
|||
r.leaveSubRecord();
|
||||
}
|
||||
}
|
||||
void write(Athena::io::YAMLDocWriter& w) const
|
||||
void write(athena::io::YAMLDocWriter& w) const
|
||||
{
|
||||
if (id)
|
||||
{
|
||||
|
@ -1562,7 +1564,7 @@ struct ChildResourceFactory : BigYAML
|
|||
else
|
||||
return __isz + 4;
|
||||
}
|
||||
void read(Athena::io::IStreamReader& r)
|
||||
void read(athena::io::IStreamReader& r)
|
||||
{
|
||||
id.clear();
|
||||
uint32_t clsId;
|
||||
|
@ -1570,7 +1572,7 @@ struct ChildResourceFactory : BigYAML
|
|||
if (clsId == SBIG('CNST'))
|
||||
id.read(r);
|
||||
}
|
||||
void write(Athena::io::IStreamWriter& w) const
|
||||
void write(athena::io::IStreamWriter& w) const
|
||||
{
|
||||
if (id)
|
||||
{
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
namespace DataSpec
|
||||
{
|
||||
|
||||
std::unique_ptr<ISTRG> LoadSTRG(Athena::io::IStreamReader& reader)
|
||||
std::unique_ptr<ISTRG> LoadSTRG(athena::io::IStreamReader& reader)
|
||||
{
|
||||
uint32_t magic = reader.readUint32Big();
|
||||
if (magic != 0x87654321)
|
||||
{
|
||||
LogDNACommon.report(LogVisor::Error, "invalid STRG magic");
|
||||
LogDNACommon.report(logvisor::Error, "invalid STRG magic");
|
||||
return std::unique_ptr<ISTRG>();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <HECL/HECL.hpp>
|
||||
#include <HECL/Database.hpp>
|
||||
#include <Athena/FileWriter.hpp>
|
||||
#include <hecl/hecl.hpp>
|
||||
#include <hecl/Database.hpp>
|
||||
#include <athena/FileWriter.hpp>
|
||||
#include "DNACommon.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
|
@ -17,10 +17,10 @@ struct ISTRG : BigYAML
|
|||
virtual size_t count() const=0;
|
||||
virtual std::string getUTF8(const FourCC& lang, size_t idx) const=0;
|
||||
virtual std::wstring getUTF16(const FourCC& lang, size_t idx) const=0;
|
||||
virtual HECL::SystemString getSystemString(const FourCC& lang, size_t idx) const=0;
|
||||
virtual hecl::SystemString getSystemString(const FourCC& lang, size_t idx) const=0;
|
||||
virtual int32_t lookupIdx(const std::string& name) const=0;
|
||||
};
|
||||
std::unique_ptr<ISTRG> LoadSTRG(Athena::io::IStreamReader& reader);
|
||||
std::unique_ptr<ISTRG> LoadSTRG(athena::io::IStreamReader& reader);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace DataSpec
|
||||
{
|
||||
|
||||
static LogVisor::LogModule Log("libpng");
|
||||
static logvisor::Module Log("libpng");
|
||||
|
||||
/* GX uses this upsampling technique to prevent banding on downsampled texture formats */
|
||||
static inline uint8_t Convert3To8(uint8_t v)
|
||||
|
@ -80,10 +80,10 @@ static inline void LookupRGBA8(const uint8_t* texels, int width, int x, int y,
|
|||
int bidx = (by * bwidth + bx) * 2;
|
||||
const uint16_t* artexels = (uint16_t*)&texels[32*bidx];
|
||||
const uint16_t* gbtexels = (uint16_t*)&texels[32*(bidx+1)];
|
||||
uint16_t ar = HECL::SBig(artexels[ry*4+rx]);
|
||||
uint16_t ar = hecl::SBig(artexels[ry*4+rx]);
|
||||
*a = ar >> 8 & 0xff;
|
||||
*r = ar & 0xff;
|
||||
uint16_t gb = HECL::SBig(gbtexels[ry*4+rx]);
|
||||
uint16_t gb = hecl::SBig(gbtexels[ry*4+rx]);
|
||||
*g = gb >> 8 & 0xff;
|
||||
*b = gb & 0xff;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ static void DecodeIA8(png_structrp png, png_infop info,
|
|||
static const uint8_t* DecodePalette(png_structrp png, png_infop info,
|
||||
int numEntries, const uint8_t* data)
|
||||
{
|
||||
uint32_t format = HECL::SBig(*(uint32_t*)data);
|
||||
uint32_t format = hecl::SBig(*(uint32_t*)data);
|
||||
data += 8;
|
||||
png_color cEntries[256];
|
||||
png_byte aEntries[256];
|
||||
|
@ -184,7 +184,7 @@ static const uint8_t* DecodePalette(png_structrp png, png_infop info,
|
|||
const uint16_t* data16 = (uint16_t*)data;
|
||||
for (int e=0 ; e<numEntries ; ++e)
|
||||
{
|
||||
uint16_t texel = HECL::SBig(data16[e]);
|
||||
uint16_t texel = hecl::SBig(data16[e]);
|
||||
cEntries[e].red = Convert5To8(texel >> 11 & 0x1f);
|
||||
cEntries[e].green = Convert6To8(texel >> 5 & 0x3f);
|
||||
cEntries[e].blue = Convert5To8(texel & 0x1f);
|
||||
|
@ -197,7 +197,7 @@ static const uint8_t* DecodePalette(png_structrp png, png_infop info,
|
|||
const uint16_t* data16 = (uint16_t*)data;
|
||||
for (int e=0 ; e<numEntries ; ++e)
|
||||
{
|
||||
uint16_t texel = HECL::SBig(data16[e]);
|
||||
uint16_t texel = hecl::SBig(data16[e]);
|
||||
if (texel & 0x8000)
|
||||
{
|
||||
cEntries[e].red = Convert5To8(texel >> 10 & 0x1f);
|
||||
|
@ -226,7 +226,7 @@ static const uint8_t* DecodePalette(png_structrp png, png_infop info,
|
|||
static const uint8_t* DecodePaletteSPLT(png_structrp png, png_infop info,
|
||||
int numEntries, const uint8_t* data)
|
||||
{
|
||||
uint32_t format = HECL::SBig(*(uint32_t*)data);
|
||||
uint32_t format = hecl::SBig(*(uint32_t*)data);
|
||||
data += 8;
|
||||
png_sPLT_entry entries[256] = {};
|
||||
png_sPLT_t GXEntry =
|
||||
|
@ -258,7 +258,7 @@ static const uint8_t* DecodePaletteSPLT(png_structrp png, png_infop info,
|
|||
const uint16_t* data16 = (uint16_t*)data;
|
||||
for (int e=0 ; e<numEntries ; ++e)
|
||||
{
|
||||
uint16_t texel = HECL::SBig(data16[e]);
|
||||
uint16_t texel = hecl::SBig(data16[e]);
|
||||
entries[e].red = Convert5To8(texel >> 11 & 0x1f);
|
||||
entries[e].green = Convert6To8(texel >> 5 & 0x3f);
|
||||
entries[e].blue = Convert5To8(texel & 0x1f);
|
||||
|
@ -273,7 +273,7 @@ static const uint8_t* DecodePaletteSPLT(png_structrp png, png_infop info,
|
|||
const uint16_t* data16 = (uint16_t*)data;
|
||||
for (int e=0 ; e<numEntries ; ++e)
|
||||
{
|
||||
uint16_t texel = HECL::SBig(data16[e]);
|
||||
uint16_t texel = hecl::SBig(data16[e]);
|
||||
if (texel & 0x8000)
|
||||
{
|
||||
entries[e].red = Convert5To8(texel >> 10 & 0x1f);
|
||||
|
@ -369,7 +369,7 @@ static void DecodeRGB565(png_structrp png, png_infop info,
|
|||
{
|
||||
for (int x=0 ; x<width ; ++x)
|
||||
{
|
||||
uint16_t texel = HECL::SBig(Lookup16BPP(texels, width, x, y));
|
||||
uint16_t texel = hecl::SBig(Lookup16BPP(texels, width, x, y));
|
||||
buf[x*3] = Convert5To8(texel >> 11 & 0x1f);
|
||||
buf[x*3+1] = Convert6To8(texel >> 5 & 0x3f);
|
||||
buf[x*3+2] = Convert5To8(texel & 0x1f);
|
||||
|
@ -390,7 +390,7 @@ static void DecodeRGB5A3(png_structrp png, png_infop info,
|
|||
{
|
||||
for (int x=0 ; x<width ; ++x)
|
||||
{
|
||||
uint16_t texel = HECL::SBig(Lookup16BPP(texels, width, x, y));
|
||||
uint16_t texel = hecl::SBig(Lookup16BPP(texels, width, x, y));
|
||||
if (texel & 0x8000)
|
||||
{
|
||||
buf[x*4] = Convert5To8(texel >> 10 & 0x1f);
|
||||
|
@ -473,25 +473,25 @@ static void DecodeCMPR(png_structrp png, png_infop info,
|
|||
|
||||
static void PNGErr(png_structp png, png_const_charp msg)
|
||||
{
|
||||
Log.report(LogVisor::Error, msg);
|
||||
Log.report(logvisor::Error, msg);
|
||||
}
|
||||
|
||||
static void PNGWarn(png_structp png, png_const_charp msg)
|
||||
{
|
||||
Log.report(LogVisor::Warning, msg);
|
||||
Log.report(logvisor::Warning, msg);
|
||||
}
|
||||
|
||||
bool TXTR::Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
|
||||
bool TXTR::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
uint32_t format = rs.readUint32Big();
|
||||
uint16_t width = rs.readUint16Big();
|
||||
uint16_t height = rs.readUint16Big();
|
||||
uint32_t numMips = rs.readUint32Big();
|
||||
|
||||
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
|
||||
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
|
||||
if (!fp)
|
||||
{
|
||||
Log.report(LogVisor::Error,
|
||||
Log.report(logvisor::Error,
|
||||
_S("Unable to open '%s' for writing"),
|
||||
outPath.getAbsolutePath().c_str());
|
||||
return false;
|
||||
|
@ -542,7 +542,7 @@ bool TXTR::Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool TXTR::Cook(const HECL::ProjectPath& inPath, const HECL::ProjectPath& outPath)
|
||||
bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ class PAKEntryReadStream;
|
|||
|
||||
struct TXTR
|
||||
{
|
||||
static bool Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath);
|
||||
static bool Cook(const HECL::ProjectPath& inPath, const HECL::ProjectPath& outPath);
|
||||
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
|
||||
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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,31 +120,27 @@ struct AFSM : public BigYAML
|
|||
__dna_writer.enumerate(triggers);
|
||||
}
|
||||
|
||||
void read(Athena::io::YAMLDocReader& __dna_docin)
|
||||
void read(athena::io::YAMLDocReader& __dna_docin)
|
||||
{
|
||||
/* triggerCount */
|
||||
triggerCount = __dna_docin.readUint32("triggerCount");
|
||||
int i = 0;
|
||||
/* triggers */
|
||||
__dna_docin.enumerate<Trigger>("triggers", triggers, triggerCount,
|
||||
[&](Athena::io::YAMLDocReader& in, Trigger& tr){
|
||||
triggerCount = __dna_docin.enumerate<Trigger>("triggers", triggers,
|
||||
[&](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
|
||||
{
|
||||
/* triggerCount */
|
||||
__dna_docout.writeUint32("triggerCount", triggerCount);
|
||||
/* triggers */
|
||||
__dna_docout.enumerate("triggers", triggers);
|
||||
}
|
||||
|
||||
static const char* DNAType()
|
||||
{
|
||||
return "Retro::DNAMP1::AFSM::Transition";
|
||||
return "urde::DNAMP1::AFSM::Transition";
|
||||
}
|
||||
|
||||
size_t binarySize(size_t __isz) const
|
||||
|
@ -159,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;
|
||||
|
|
|
@ -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,12 +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");
|
||||
reader.enterSubVector("parmVals");
|
||||
size_t parmCount;
|
||||
reader.enterSubVector("parmVals", parmCount);
|
||||
switch (DataType(parmType))
|
||||
{
|
||||
case DataType::Int32:
|
||||
|
@ -107,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);
|
||||
|
@ -138,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();
|
||||
|
@ -152,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);
|
||||
|
@ -179,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());
|
||||
|
@ -244,20 +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");
|
||||
atUint32 parmInfoCount = reader.readUint32("parmInfoCount");
|
||||
atUint32 animInfoCount = reader.readUint32("animInfoCount");
|
||||
|
||||
reader.enumerate("parmInfos", parmInfos, parmInfoCount);
|
||||
atUint32 parmInfoCount = reader.enumerate("parmInfos", parmInfos);
|
||||
|
||||
reader.enumerate<AnimInfo>("animInfos", animInfos, animInfoCount,
|
||||
[this, parmInfoCount](Athena::io::YAMLDocReader& reader, AnimInfo& ai)
|
||||
reader.enumerate<AnimInfo>("animInfos", animInfos,
|
||||
[this, parmInfoCount](athena::io::YAMLDocReader& reader, AnimInfo& ai)
|
||||
{
|
||||
ai.id = reader.readUint32("id");
|
||||
ai.parmVals.reserve(parmInfoCount);
|
||||
reader.enterSubVector("parmVals");
|
||||
size_t parmValCount;
|
||||
reader.enterSubVector("parmVals", parmValCount);
|
||||
for (const ParmInfo& pi : parmInfos)
|
||||
{
|
||||
switch (ParmInfo::DataType(pi.parmType))
|
||||
|
@ -282,16 +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.writeUint32("parmInfoCount", parmInfos.size());
|
||||
writer.writeUint32("animInfoCount", animInfos.size());
|
||||
|
||||
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();
|
||||
|
@ -325,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();
|
||||
|
@ -388,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);
|
||||
|
||||
|
@ -524,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");
|
||||
|
@ -533,25 +531,20 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader)
|
|||
reader.enumerate("cskr", cskr);
|
||||
reader.enumerate("cinf", cinf);
|
||||
|
||||
atUint32 animationCount = reader.readUint32("animationCount");
|
||||
reader.enumerate("animations", animations, animationCount);
|
||||
reader.enumerate("animations", animations);
|
||||
|
||||
reader.enumerate("pasDatabase", pasDatabase);
|
||||
|
||||
atUint32 partCount = reader.readUint32("partCount");
|
||||
reader.enumerate("part", partResData.part, partCount);
|
||||
reader.enumerate("part", partResData.part);
|
||||
|
||||
atUint32 swhcCount = reader.readUint32("swhcCount");
|
||||
reader.enumerate("swhc", partResData.swhc, swhcCount);
|
||||
reader.enumerate("swhc", partResData.swhc);
|
||||
|
||||
atUint32 unkCount = reader.readUint32("unkCount");
|
||||
reader.enumerate("unk", partResData.unk, unkCount);
|
||||
reader.enumerate("unk", partResData.unk);
|
||||
|
||||
partResData.elsc.clear();
|
||||
if (sectionCount > 5)
|
||||
{
|
||||
atUint32 elscCount = reader.readUint32("elscCount");
|
||||
reader.enumerate("elsc", partResData.elsc, elscCount);
|
||||
reader.enumerate("elsc", partResData.elsc);
|
||||
}
|
||||
|
||||
unk1 = reader.readUint32("unk1");
|
||||
|
@ -559,15 +552,13 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader)
|
|||
animAABBs.clear();
|
||||
if (sectionCount > 1)
|
||||
{
|
||||
atUint32 aabbCount = reader.readUint32("animAABBCount");
|
||||
reader.enumerate("part", animAABBs, aabbCount);
|
||||
reader.enumerate("part", animAABBs);
|
||||
}
|
||||
|
||||
effects.clear();
|
||||
if (sectionCount > 2)
|
||||
{
|
||||
atUint32 effectCount = reader.readUint32("effectCount");
|
||||
reader.enumerate("effects", effects, effectCount);
|
||||
reader.enumerate("effects", effects);
|
||||
}
|
||||
|
||||
if (sectionCount > 3)
|
||||
|
@ -579,12 +570,11 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader)
|
|||
animIdxs.clear();
|
||||
if (sectionCount > 4)
|
||||
{
|
||||
atUint32 animIdxCount = reader.readUint32("animIdxCount");
|
||||
reader.enumerate("animIdxs", animIdxs, animIdxCount);
|
||||
reader.enumerate("animIdxs", animIdxs);
|
||||
}
|
||||
}
|
||||
|
||||
void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer) const
|
||||
void ANCS::CharacterSet::CharacterInfo::write(athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
writer.writeUint32("idx", idx);
|
||||
|
||||
|
@ -608,23 +598,18 @@ void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer)
|
|||
writer.enumerate("cskr", cskr);
|
||||
writer.enumerate("cinf", cinf);
|
||||
|
||||
writer.writeUint32("animationCount", animations.size());
|
||||
writer.enumerate("animations", animations);
|
||||
|
||||
writer.enumerate("pasDatabase", pasDatabase);
|
||||
|
||||
writer.writeUint32("partCount", partResData.part.size());
|
||||
writer.enumerate("part", partResData.part);
|
||||
|
||||
writer.writeUint32("swhcCount", partResData.swhc.size());
|
||||
writer.enumerate("swhc", partResData.swhc);
|
||||
|
||||
writer.writeUint32("unkCount", partResData.unk.size());
|
||||
writer.enumerate("unk", partResData.unk);
|
||||
|
||||
if (sectionCount > 5)
|
||||
{
|
||||
writer.writeUint32("elscCount", partResData.elsc.size());
|
||||
writer.enumerate("elsc", partResData.elsc);
|
||||
}
|
||||
|
||||
|
@ -632,13 +617,11 @@ void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer)
|
|||
|
||||
if (sectionCount > 1)
|
||||
{
|
||||
writer.writeUint32("animAABBCount", animAABBs.size());
|
||||
writer.enumerate("animAABBs", animAABBs);
|
||||
}
|
||||
|
||||
if (sectionCount > 2)
|
||||
{
|
||||
writer.writeUint32("effectCount", effects.size());
|
||||
writer.enumerate("effects", effects);
|
||||
}
|
||||
|
||||
|
@ -650,17 +633,16 @@ void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer)
|
|||
|
||||
if (sectionCount > 4)
|
||||
{
|
||||
writer.writeUint32("animIdxCount", animIdxs.size());
|
||||
writer.enumerate("animIdxs", animIdxs);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -691,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;
|
||||
|
@ -706,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);
|
||||
|
@ -742,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;
|
||||
|
@ -752,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)
|
||||
|
@ -779,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)
|
||||
{
|
||||
|
@ -797,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);
|
||||
|
@ -823,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)
|
||||
{
|
||||
|
@ -836,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();
|
||||
|
||||
|
@ -874,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())
|
||||
|
@ -957,22 +939,19 @@ 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");
|
||||
|
||||
atUint32 animationCount = reader.readUint32("animationCount");
|
||||
reader.enumerate("animations", animations, animationCount);
|
||||
reader.enumerate("animations", animations);
|
||||
|
||||
atUint32 transitionCount = reader.readUint32("transitionCount");
|
||||
reader.enumerate("transitions", transitions, transitionCount);
|
||||
reader.enumerate("transitions", transitions);
|
||||
reader.enumerate("defaultTransition", defaultTransition);
|
||||
|
||||
additiveAnims.clear();
|
||||
if (sectionCount > 1)
|
||||
{
|
||||
atUint32 additiveAnimCount = reader.readUint32("additiveAnimCount");
|
||||
reader.enumerate("additiveAnims", additiveAnims, additiveAnimCount);
|
||||
reader.enumerate("additiveAnims", additiveAnims);
|
||||
floatA = reader.readFloat("floatA");
|
||||
floatB = reader.readFloat("floatB");
|
||||
}
|
||||
|
@ -980,19 +959,17 @@ void ANCS::AnimationSet::read(Athena::io::YAMLDocReader& reader)
|
|||
halfTransitions.clear();
|
||||
if (sectionCount > 2)
|
||||
{
|
||||
atUint32 halfTransitionCount = reader.readUint32("halfTransitionCount");
|
||||
reader.enumerate("halfTransitions", halfTransitions, halfTransitionCount);
|
||||
reader.enumerate("halfTransitions", halfTransitions);
|
||||
}
|
||||
|
||||
animResources.clear();
|
||||
if (sectionCount > 3)
|
||||
{
|
||||
atUint32 animResourcesCount = reader.readUint32("animResourcesCount");
|
||||
reader.enumerate("animResources", animResources, animResourcesCount);
|
||||
reader.enumerate("animResources", animResources);
|
||||
}
|
||||
}
|
||||
|
||||
void ANCS::AnimationSet::write(Athena::io::YAMLDocWriter& writer) const
|
||||
void ANCS::AnimationSet::write(athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
atUint16 sectionCount;
|
||||
if (animResources.size())
|
||||
|
@ -1006,16 +983,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);
|
||||
|
@ -1023,20 +997,18 @@ 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("animResourcesCount", animResources.size());
|
||||
writer.enumerate("animResources", animResources);
|
||||
}
|
||||
}
|
||||
|
||||
const char* ANCS::AnimationSet::DNAType()
|
||||
{
|
||||
return "Retro::DNAMP1::ANCS::AnimationSet";
|
||||
return "urde::DNAMP1::ANCS::AnimationSet";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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('\\'))
|
||||
|
@ -88,7 +88,7 @@ void PAKBridge::build()
|
|||
mlvl.read(rs);
|
||||
}
|
||||
#if HECL_UCS2
|
||||
level.name = HECL::UTF8ToWide(m_pak.bestEntryName(entry));
|
||||
level.name = hecl::UTF8ToWide(m_pak.bestEntryName(entry));
|
||||
#else
|
||||
level.name = m_pak.bestEntryName(entry);
|
||||
#endif
|
||||
|
@ -102,7 +102,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)
|
||||
|
@ -145,17 +145,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
|
||||
|
@ -187,7 +187,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);
|
||||
|
@ -228,16 +228,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;
|
||||
|
@ -245,11 +245,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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,50 +46,42 @@ 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");
|
||||
|
||||
atUint32 loopCount = reader.readUint32("loopCount");
|
||||
reader.enumerate("loopEvents", loopEvents, loopCount);
|
||||
reader.enumerate("loopEvents", loopEvents);
|
||||
|
||||
uevtEvents.clear();
|
||||
atUint32 uevtCount = reader.readUint32("uevtCount");
|
||||
reader.enumerate("uevtEvents", uevtEvents, uevtCount);
|
||||
reader.enumerate("uevtEvents", uevtEvents);
|
||||
|
||||
atUint32 effectCount = reader.readUint32("effectCount");
|
||||
reader.enumerate("effectEvents", effectEvents, effectCount);
|
||||
reader.enumerate("effectEvents", effectEvents);
|
||||
|
||||
if (version == 2)
|
||||
{
|
||||
atUint32 sfxCount = reader.readUint32("sfxCount");
|
||||
reader.enumerate("sfxEvents", sfxEvents, sfxCount);
|
||||
reader.enumerate("sfxEvents", sfxEvents);
|
||||
}
|
||||
}
|
||||
|
||||
void EVNT::write(Athena::io::YAMLDocWriter& writer) const
|
||||
void EVNT::write(athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
writer.writeUint32("version", version);
|
||||
|
||||
writer.writeUint32("loopCount", loopEvents.size());
|
||||
writer.enumerate("loopEvents", loopEvents);
|
||||
|
||||
writer.writeUint32("uevtCount", uevtEvents.size());
|
||||
writer.enumerate("uevtEvents", uevtEvents);
|
||||
|
||||
writer.writeUint32("effectCount", effectEvents.size());
|
||||
writer.enumerate("effectEvents", effectEvents);
|
||||
|
||||
if (version == 2)
|
||||
{
|
||||
writer.writeUint32("sfxCount", sfxEvents.size());
|
||||
writer.enumerate("sfxEvents", sfxEvents);
|
||||
}
|
||||
}
|
||||
|
||||
const char* EVNT::DNAType()
|
||||
{
|
||||
return "Retro::DNAMP1::EVNT";
|
||||
return "urde::DNAMP1::EVNT";
|
||||
}
|
||||
|
||||
size_t EVNT::binarySize(size_t __isz) const
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,33 +80,32 @@ 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");
|
||||
layerCount = docin.readUint32("layerCount");
|
||||
docin.enumerate("layerSizes", layerSizes, layerCount);
|
||||
docin.enumerate("layers", layers, layerCount);
|
||||
layerCount = docin.enumerate("layerSizes", layerSizes);
|
||||
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);
|
||||
docout.writeUint32("layerCount", layerCount);
|
||||
docout.enumerate("layerSizes", layerSizes);
|
||||
docout.enumerate("layers", layers);
|
||||
}
|
||||
|
||||
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++)
|
||||
{
|
||||
|
@ -125,20 +124,22 @@ 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");
|
||||
objectCount = rs.readUint32("objectCount");
|
||||
objects.reserve(objectCount);
|
||||
rs.enterSubVector("objects");
|
||||
size_t objCount;
|
||||
rs.enterSubVector("objects", objCount);
|
||||
objectCount = objCount;
|
||||
objects.clear();
|
||||
objects.reserve(objCount);
|
||||
for (atUint32 i = 0; i < objectCount; i++)
|
||||
{
|
||||
rs.enterSubRecord(nullptr);
|
||||
|
@ -154,14 +155,14 @@ 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();
|
||||
}
|
||||
rs.leaveSubVector();
|
||||
}
|
||||
|
||||
void SCLY::ScriptLayer::write(Athena::io::IStreamWriter& ws) const
|
||||
void SCLY::ScriptLayer::write(athena::io::IStreamWriter& ws) const
|
||||
{
|
||||
ws.writeUByte(unknown);
|
||||
ws.writeUint32Big(objectCount);
|
||||
|
@ -183,10 +184,9 @@ 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.writeUint32("objectCount", objectCount);
|
||||
ws.enterSubVector("objects");
|
||||
for (const std::unique_ptr<IScriptObject>& obj : objects)
|
||||
{
|
||||
|
@ -200,7 +200,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";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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); }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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);}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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);}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
@ -247,43 +247,34 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader)
|
|||
reader.enumerate("cskr", cskr);
|
||||
reader.enumerate("cinf", cinf);
|
||||
|
||||
atUint32 animationCount = reader.readUint32("animationCount");
|
||||
reader.enumerate("animations", animations, animationCount);
|
||||
reader.enumerate("animations", animations);
|
||||
|
||||
reader.enumerate("pasDatabase", pasDatabase);
|
||||
|
||||
atUint32 partCount = reader.readUint32("partCount");
|
||||
reader.enumerate("part", partResData.part, partCount);
|
||||
reader.enumerate("part", partResData.part);
|
||||
|
||||
atUint32 swhcCount = reader.readUint32("swhcCount");
|
||||
reader.enumerate("swhc", partResData.swhc, swhcCount);
|
||||
reader.enumerate("swhc", partResData.swhc);
|
||||
|
||||
atUint32 unkCount = reader.readUint32("unkCount");
|
||||
reader.enumerate("unk", partResData.unk, unkCount);
|
||||
reader.enumerate("unk", partResData.unk);
|
||||
|
||||
atUint32 elscCount = reader.readUint32("elscCount");
|
||||
reader.enumerate("elsc", partResData.elsc, elscCount);
|
||||
reader.enumerate("elsc", partResData.elsc);
|
||||
|
||||
atUint32 spscCount = reader.readUint32("spscCount");
|
||||
reader.enumerate("spsc", partResData.spsc, spscCount);
|
||||
reader.enumerate("spsc", partResData.spsc);
|
||||
|
||||
atUint32 unk2Count = reader.readUint32("unk2Count");
|
||||
reader.enumerate("unk2", partResData.unk2, unk2Count);
|
||||
reader.enumerate("unk2", partResData.unk2);
|
||||
|
||||
unk1 = reader.readUint32("unk1");
|
||||
|
||||
animAABBs.clear();
|
||||
if (sectionCount > 1)
|
||||
{
|
||||
atUint32 aabbCount = reader.readUint32("animAABBCount");
|
||||
reader.enumerate("part", animAABBs, aabbCount);
|
||||
reader.enumerate("part", animAABBs);
|
||||
}
|
||||
|
||||
effects.clear();
|
||||
if (sectionCount > 2)
|
||||
{
|
||||
atUint32 effectCount = reader.readUint32("effectCount");
|
||||
reader.enumerate("effects", effects, effectCount);
|
||||
reader.enumerate("effects", effects);
|
||||
}
|
||||
|
||||
if (sectionCount > 3)
|
||||
|
@ -295,8 +286,7 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader)
|
|||
animIdxs.clear();
|
||||
if (sectionCount > 4)
|
||||
{
|
||||
atUint32 animIdxCount = reader.readUint32("animIdxCount");
|
||||
reader.enumerate("animIdxs", animIdxs, animIdxCount);
|
||||
reader.enumerate("animIdxs", animIdxs);
|
||||
}
|
||||
|
||||
extents.clear();
|
||||
|
@ -304,12 +294,11 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader)
|
|||
{
|
||||
unk4 = reader.readUint32("unk4");
|
||||
unk5 = reader.readUByte("unk5");
|
||||
atUint32 extentsCount = reader.readUint32("extentsCount");
|
||||
reader.enumerate("extents", extents, extentsCount);
|
||||
reader.enumerate("extents", extents);
|
||||
}
|
||||
}
|
||||
|
||||
void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer) const
|
||||
void ANCS::CharacterSet::CharacterInfo::write(athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
writer.writeUint32("idx", idx);
|
||||
|
||||
|
@ -335,40 +324,31 @@ void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer)
|
|||
writer.enumerate("cskr", cskr);
|
||||
writer.enumerate("cinf", cinf);
|
||||
|
||||
writer.writeUint32("animationCount", animations.size());
|
||||
writer.enumerate("animations", animations);
|
||||
|
||||
writer.enumerate("pasDatabase", pasDatabase);
|
||||
|
||||
writer.writeUint32("partCount", partResData.part.size());
|
||||
writer.enumerate("part", partResData.part);
|
||||
|
||||
writer.writeUint32("swhcCount", partResData.swhc.size());
|
||||
writer.enumerate("swhc", partResData.swhc);
|
||||
|
||||
writer.writeUint32("unkCount", partResData.unk.size());
|
||||
writer.enumerate("unk", partResData.unk);
|
||||
|
||||
writer.writeUint32("elscCount", partResData.elsc.size());
|
||||
writer.enumerate("elsc", partResData.elsc);
|
||||
|
||||
writer.writeUint32("spscCount", partResData.spsc.size());
|
||||
writer.enumerate("spsc", partResData.spsc);
|
||||
|
||||
writer.writeUint32("unk2Count", partResData.unk2.size());
|
||||
writer.enumerate("unk2", partResData.unk2);
|
||||
|
||||
writer.writeUint32("unk1", unk1);
|
||||
|
||||
if (sectionCount > 1)
|
||||
{
|
||||
writer.writeUint32("animAABBCount", animAABBs.size());
|
||||
writer.enumerate("animAABBs", animAABBs);
|
||||
}
|
||||
|
||||
if (sectionCount > 2)
|
||||
{
|
||||
writer.writeUint32("effectCount", effects.size());
|
||||
writer.enumerate("effects", effects);
|
||||
}
|
||||
|
||||
|
@ -380,7 +360,6 @@ void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer)
|
|||
|
||||
if (sectionCount > 4)
|
||||
{
|
||||
writer.writeUint32("animIdxCount", animIdxs.size());
|
||||
writer.enumerate("animIdxs", animIdxs);
|
||||
}
|
||||
|
||||
|
@ -388,17 +367,16 @@ void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer)
|
|||
{
|
||||
writer.writeUint32("unk4", unk4);
|
||||
writer.writeUByte("unk5", unk5);
|
||||
writer.writeUint32("extentsCount", extents.size());
|
||||
writer.enumerate("extents", extents);
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
|
@ -433,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())
|
||||
|
@ -516,22 +494,19 @@ 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");
|
||||
|
||||
atUint32 animationCount = reader.readUint32("animationCount");
|
||||
reader.enumerate("animations", animations, animationCount);
|
||||
reader.enumerate("animations", animations);
|
||||
|
||||
atUint32 transitionCount = reader.readUint32("transitionCount");
|
||||
reader.enumerate("transitions", transitions, transitionCount);
|
||||
reader.enumerate("transitions", transitions);
|
||||
reader.enumerate("defaultTransition", defaultTransition);
|
||||
|
||||
additiveAnims.clear();
|
||||
if (sectionCount > 1)
|
||||
{
|
||||
atUint32 additiveAnimCount = reader.readUint32("additiveAnimCount");
|
||||
reader.enumerate("additiveAnims", additiveAnims, additiveAnimCount);
|
||||
reader.enumerate("additiveAnims", additiveAnims);
|
||||
floatA = reader.readFloat("floatA");
|
||||
floatB = reader.readFloat("floatB");
|
||||
}
|
||||
|
@ -539,19 +514,17 @@ void ANCS::AnimationSet::read(Athena::io::YAMLDocReader& reader)
|
|||
halfTransitions.clear();
|
||||
if (sectionCount > 2)
|
||||
{
|
||||
atUint32 halfTransitionCount = reader.readUint32("halfTransitionCount");
|
||||
reader.enumerate("halfTransitions", halfTransitions, halfTransitionCount);
|
||||
reader.enumerate("halfTransitions", halfTransitions);
|
||||
}
|
||||
|
||||
evnts.clear();
|
||||
if (sectionCount > 3)
|
||||
{
|
||||
atUint32 evntsCount = reader.readUint32("evntsCount");
|
||||
reader.enumerate("evnts", evnts, evntsCount);
|
||||
reader.enumerate("evnts", evnts);
|
||||
}
|
||||
}
|
||||
|
||||
void ANCS::AnimationSet::write(Athena::io::YAMLDocWriter& writer) const
|
||||
void ANCS::AnimationSet::write(athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
atUint16 sectionCount;
|
||||
if (evnts.size())
|
||||
|
@ -565,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);
|
||||
|
@ -582,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();
|
||||
|
||||
|
@ -619,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);
|
||||
|
||||
|
@ -661,50 +629,42 @@ 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");
|
||||
|
||||
atUint32 loopCount = reader.readUint32("loopCount");
|
||||
reader.enumerate("loopEvents", loopEvents, loopCount);
|
||||
reader.enumerate("loopEvents", loopEvents);
|
||||
|
||||
uevtEvents.clear();
|
||||
if (version == 2)
|
||||
{
|
||||
atUint32 uevtCount = reader.readUint32("uevtCount");
|
||||
reader.enumerate("uevtEvents", uevtEvents, uevtCount);
|
||||
reader.enumerate("uevtEvents", uevtEvents);
|
||||
}
|
||||
|
||||
atUint32 effectCount = reader.readUint32("effectCount");
|
||||
reader.enumerate("effectEvents", effectEvents, effectCount);
|
||||
reader.enumerate("effectEvents", effectEvents);
|
||||
|
||||
atUint32 sfxCount = reader.readUint32("sfxCount");
|
||||
reader.enumerate("sfxEvents", sfxEvents, sfxCount);
|
||||
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);
|
||||
|
||||
writer.writeUint32("loopCount", loopEvents.size());
|
||||
writer.enumerate("loopEvents", loopEvents);
|
||||
|
||||
if (version == 2)
|
||||
{
|
||||
writer.writeUint32("uevtCount", uevtEvents.size());
|
||||
writer.enumerate("uevtEvents", uevtEvents);
|
||||
}
|
||||
|
||||
writer.writeUint32("effectCount", effectEvents.size());
|
||||
writer.enumerate("effectEvents", effectEvents);
|
||||
|
||||
writer.writeUint32("sfxCount", sfxEvents.size());
|
||||
writer.enumerate("sfxEvents", sfxEvents);
|
||||
}
|
||||
|
||||
const char* ANCS::AnimationSet::EVNT::DNAType()
|
||||
{
|
||||
return "Retro::DNAMP2::ANCS::AnimationSet::EVNT";
|
||||
return "urde::DNAMP2::ANCS::AnimationSet::EVNT";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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('\\'))
|
||||
|
@ -82,7 +82,7 @@ void PAKBridge::build()
|
|||
mlvl.read(rs);
|
||||
}
|
||||
#if HECL_UCS2
|
||||
level.name = HECL::UTF8ToWide(m_pak.bestEntryName(entry));
|
||||
level.name = hecl::UTF8ToWide(m_pak.bestEntryName(entry));
|
||||
#else
|
||||
level.name = m_pak.bestEntryName(entry);
|
||||
#endif
|
||||
|
@ -95,7 +95,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)
|
||||
|
@ -130,21 +130,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);
|
||||
|
@ -163,7 +163,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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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*)>);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "../DNAMP1/PAK.hpp"
|
||||
|
||||
namespace Retro
|
||||
namespace urde
|
||||
{
|
||||
namespace DNAMP2
|
||||
{
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace DataSpec
|
|||
namespace DNAMP3
|
||||
{
|
||||
|
||||
void CHAR::AnimationInfo::EVNT::SFXEvent::read(Athena::io::IStreamReader& reader)
|
||||
void CHAR::AnimationInfo::EVNT::SFXEvent::read(athena::io::IStreamReader& reader)
|
||||
{
|
||||
EventBase::read(reader);
|
||||
caudId.read(reader);
|
||||
|
@ -17,10 +17,10 @@ void CHAR::AnimationInfo::EVNT::SFXEvent::read(Athena::io::IStreamReader& reader
|
|||
if (extraType == 1)
|
||||
extraFloat = reader.readFloatBig();
|
||||
else if (extraType == 2)
|
||||
reader.seek(35, Athena::Current);
|
||||
reader.seek(35, athena::Current);
|
||||
}
|
||||
|
||||
void CHAR::AnimationInfo::EVNT::SFXEvent::write(Athena::io::IStreamWriter& writer) const
|
||||
void CHAR::AnimationInfo::EVNT::SFXEvent::write(athena::io::IStreamWriter& writer) const
|
||||
{
|
||||
EventBase::write(writer);
|
||||
caudId.write(writer);
|
||||
|
@ -32,7 +32,7 @@ void CHAR::AnimationInfo::EVNT::SFXEvent::write(Athena::io::IStreamWriter& write
|
|||
if (extraType == 1)
|
||||
writer.writeFloatBig(extraFloat);
|
||||
else if (extraType == 2)
|
||||
writer.seek(35, Athena::Current);
|
||||
writer.seek(35, athena::Current);
|
||||
}
|
||||
|
||||
size_t CHAR::AnimationInfo::EVNT::SFXEvent::binarySize(size_t __isz) const
|
||||
|
@ -48,26 +48,24 @@ size_t CHAR::AnimationInfo::EVNT::SFXEvent::binarySize(size_t __isz) const
|
|||
return __isz;
|
||||
}
|
||||
|
||||
void CHAR::AnimationInfo::EVNT::SFXEvent::read(Athena::io::YAMLDocReader& reader)
|
||||
void CHAR::AnimationInfo::EVNT::SFXEvent::read(athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
EventBase::read(reader);
|
||||
reader.enumerate("caudId", caudId);
|
||||
unk1 = reader.readUint32("unk1");
|
||||
unk2 = reader.readUint32("unk2");
|
||||
unk3 = reader.readUint32("unk3");
|
||||
reader.enumerate("unk3Vals", unk3Vals, unk3);
|
||||
unk3 = reader.enumerate("unk3Vals", unk3Vals);
|
||||
extraType = reader.readUint32("extraType");
|
||||
if (extraType == 1)
|
||||
extraFloat = reader.readFloat("extraFloat");
|
||||
}
|
||||
|
||||
void CHAR::AnimationInfo::EVNT::SFXEvent::write(Athena::io::YAMLDocWriter& writer) const
|
||||
void CHAR::AnimationInfo::EVNT::SFXEvent::write(athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
EventBase::write(writer);
|
||||
writer.enumerate("caudId", caudId);
|
||||
writer.writeUint32("unk1", unk1);
|
||||
writer.writeUint32("unk2", unk2);
|
||||
writer.writeUint32("unk3", unk3);
|
||||
writer.enumerate("unk3Vals", unk3Vals);
|
||||
writer.writeUint32("extraType", extraType);
|
||||
if (extraType == 1)
|
||||
|
@ -76,10 +74,10 @@ void CHAR::AnimationInfo::EVNT::SFXEvent::write(Athena::io::YAMLDocWriter& write
|
|||
|
||||
const char* CHAR::AnimationInfo::EVNT::SFXEvent::DNAType()
|
||||
{
|
||||
return "Retro::DNAMP3::CHAR::AnimationInfo::EVNT::SFXEvent";
|
||||
return "urde::DNAMP3::CHAR::AnimationInfo::EVNT::SFXEvent";
|
||||
}
|
||||
|
||||
void CHAR::AnimationInfo::MetaAnimFactory::read(Athena::io::IStreamReader& reader)
|
||||
void CHAR::AnimationInfo::MetaAnimFactory::read(athena::io::IStreamReader& reader)
|
||||
{
|
||||
IMetaAnim::Type type(IMetaAnim::Type(reader.readUint32Big()));
|
||||
switch (type)
|
||||
|
@ -110,7 +108,7 @@ void CHAR::AnimationInfo::MetaAnimFactory::read(Athena::io::IStreamReader& reade
|
|||
}
|
||||
}
|
||||
|
||||
void CHAR::AnimationInfo::MetaAnimFactory::write(Athena::io::IStreamWriter& writer) const
|
||||
void CHAR::AnimationInfo::MetaAnimFactory::write(athena::io::IStreamWriter& writer) const
|
||||
{
|
||||
if (!m_anim)
|
||||
return;
|
||||
|
@ -125,7 +123,7 @@ size_t CHAR::AnimationInfo::MetaAnimFactory::binarySize(size_t __isz) const
|
|||
return m_anim->binarySize(__isz + 4);
|
||||
}
|
||||
|
||||
void CHAR::AnimationInfo::MetaAnimFactory::read(Athena::io::YAMLDocReader& reader)
|
||||
void CHAR::AnimationInfo::MetaAnimFactory::read(athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
std::string type = reader.readString("type");
|
||||
std::transform(type.begin(), type.end(), type.begin(), tolower);
|
||||
|
@ -161,7 +159,7 @@ void CHAR::AnimationInfo::MetaAnimFactory::read(Athena::io::YAMLDocReader& reade
|
|||
|
||||
}
|
||||
|
||||
void CHAR::AnimationInfo::MetaAnimFactory::write(Athena::io::YAMLDocWriter& writer) const
|
||||
void CHAR::AnimationInfo::MetaAnimFactory::write(athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
if (!m_anim)
|
||||
return;
|
||||
|
@ -171,7 +169,7 @@ void CHAR::AnimationInfo::MetaAnimFactory::write(Athena::io::YAMLDocWriter& writ
|
|||
|
||||
const char* CHAR::AnimationInfo::MetaAnimFactory::DNAType()
|
||||
{
|
||||
return "Retro::DNAMP3::CHAR::AnimationInfo::MetaAnimFactory";
|
||||
return "urde::DNAMP3::CHAR::AnimationInfo::MetaAnimFactory";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace DataSpec
|
|||
{
|
||||
namespace DNAMP3
|
||||
{
|
||||
LogVisor::LogModule Log("Retro::DNAMP3");
|
||||
logvisor::Module Log("urde::DNAMP3");
|
||||
|
||||
static bool GetNoShare(const std::string& name)
|
||||
{
|
||||
|
@ -25,16 +25,16 @@ static bool GetNoShare(const std::string& name)
|
|||
return true;
|
||||
}
|
||||
|
||||
PAKBridge::PAKBridge(HECL::Database::Project& project,
|
||||
const NOD::Node& node,
|
||||
PAKBridge::PAKBridge(hecl::Database::Project& project,
|
||||
const nod::Node& node,
|
||||
bool doExtract)
|
||||
: m_project(project), m_node(node), m_pak(GetNoShare(node.getName())), m_doExtract(doExtract)
|
||||
{
|
||||
NOD::AthenaPartReadStream rs(node.beginReadStream());
|
||||
nod::AthenaPartReadStream rs(node.beginReadStream());
|
||||
m_pak.read(rs);
|
||||
|
||||
/* Append Level String */
|
||||
std::set<HECL::SystemString, HECL::CaseInsensitiveCompare> uniq;
|
||||
std::set<hecl::SystemString, hecl::CaseInsensitiveCompare> uniq;
|
||||
for (PAK::Entry& entry : m_pak.m_entries)
|
||||
{
|
||||
if (entry.type == FOURCC('MLVL'))
|
||||
|
@ -53,7 +53,7 @@ PAKBridge::PAKBridge(HECL::Database::Project& project,
|
|||
}
|
||||
}
|
||||
bool comma = false;
|
||||
for (const HECL::SystemString& str : uniq)
|
||||
for (const hecl::SystemString& str : uniq)
|
||||
{
|
||||
if (comma)
|
||||
m_levelString += _S(", ");
|
||||
|
@ -62,12 +62,12 @@ PAKBridge::PAKBridge(HECL::Database::Project& project,
|
|||
}
|
||||
}
|
||||
|
||||
static HECL::SystemString LayerName(const std::string& name)
|
||||
static hecl::SystemString LayerName(const std::string& name)
|
||||
{
|
||||
#if HECL_UCS2
|
||||
HECL::SystemString ret = HECL::UTF8ToWide(name);
|
||||
hecl::SystemString ret = hecl::UTF8ToWide(name);
|
||||
#else
|
||||
HECL::SystemString ret = name;
|
||||
hecl::SystemString ret = name;
|
||||
#endif
|
||||
for (auto& ch : ret)
|
||||
if (ch == _S('/') || ch == _S('\\'))
|
||||
|
@ -90,7 +90,7 @@ void PAKBridge::build()
|
|||
mlvl.read(rs);
|
||||
}
|
||||
#if HECL_UCS2
|
||||
level.name = HECL::UTF8ToWide(m_pak.bestEntryName(entry));
|
||||
level.name = hecl::UTF8ToWide(m_pak.bestEntryName(entry));
|
||||
#else
|
||||
level.name = m_pak.bestEntryName(entry);
|
||||
#endif
|
||||
|
@ -103,7 +103,7 @@ void PAKBridge::build()
|
|||
if (worldMapEnt)
|
||||
{
|
||||
PAKEntryReadStream rs = worldMapEnt->beginReadStream(m_node);
|
||||
rs.seek(8, Athena::Current);
|
||||
rs.seek(8, athena::Current);
|
||||
atUint32 areaCount = rs.readUint32Big();
|
||||
mapw.reserve(areaCount);
|
||||
for (atUint32 i=0 ; i<areaCount ; ++i)
|
||||
|
@ -138,21 +138,21 @@ void PAKBridge::build()
|
|||
if (areaDeps.name.empty())
|
||||
{
|
||||
#if HECL_UCS2
|
||||
areaDeps.name = HECL::UTF8ToWide(area.internalAreaName);
|
||||
areaDeps.name = hecl::UTF8ToWide(area.internalAreaName);
|
||||
#else
|
||||
areaDeps.name = area.internalAreaName;
|
||||
#endif
|
||||
if (areaDeps.name.empty())
|
||||
{
|
||||
#if HECL_UCS2
|
||||
areaDeps.name = _S("MREA_") + HECL::UTF8ToWide(area.areaMREAId.toString());
|
||||
areaDeps.name = _S("MREA_") + hecl::UTF8ToWide(area.areaMREAId.toString());
|
||||
#else
|
||||
areaDeps.name = "MREA_" + area.areaMREAId.toString();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
HECL::SystemChar num[16];
|
||||
HECL::SNPrintf(num, 16, _S("%02u "), ai);
|
||||
hecl::SystemChar num[16];
|
||||
hecl::SNPrintf(num, 16, _S("%02u "), ai);
|
||||
areaDeps.name = num + areaDeps.name;
|
||||
|
||||
const MLVL::LayerFlags& layerFlags = *layerFlagsIt++;
|
||||
|
@ -173,7 +173,7 @@ void PAKBridge::build()
|
|||
while (layer.name.size() && isspace(layer.name.back()))
|
||||
layer.name.pop_back();
|
||||
#endif
|
||||
HECL::SNPrintf(num, 16, layer.active ? _S("%02ua ") : _S("%02u "), l-1);
|
||||
hecl::SNPrintf(num, 16, layer.active ? _S("%02ua ") : _S("%02u "), l-1);
|
||||
layer.name = num + layer.name;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -80,18 +80,18 @@ struct MLVL : BigYAML
|
|||
|
||||
static bool Extract(const SpecBase& dataSpec,
|
||||
PAKEntryReadStream& rs,
|
||||
const HECL::ProjectPath& outPath,
|
||||
const hecl::ProjectPath& outPath,
|
||||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool force,
|
||||
std::function<void(const HECL::SystemChar*)> fileChanged)
|
||||
std::function<void(const hecl::SystemChar*)> fileChanged)
|
||||
{
|
||||
MLVL mlvl;
|
||||
mlvl.read(rs);
|
||||
FILE* fp = HECL::Fopen(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath().c_str(), _S("wb"));
|
||||
FILE* fp = hecl::Fopen(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath().c_str(), _S("wb"));
|
||||
mlvl.toYAMLFile(fp);
|
||||
fclose(fp);
|
||||
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter,
|
||||
entry, force, fileChanged);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ struct STRG : ISTRG
|
|||
{
|
||||
DECL_YAML
|
||||
Delete expl;
|
||||
void _read(Athena::io::IStreamReader& reader);
|
||||
void _read(athena::io::IStreamReader& reader);
|
||||
std::vector<std::pair<DNAFourCC, std::vector<std::string>>> langs;
|
||||
std::unordered_map<DNAFourCC, std::vector<std::string>*> langMap;
|
||||
std::map<std::string, int32_t> names;
|
||||
|
@ -49,37 +49,37 @@ struct STRG : ISTRG
|
|||
{
|
||||
auto search = langMap.find(lang);
|
||||
if (search != langMap.end())
|
||||
return HECL::UTF8ToWide(search->second->at(idx));
|
||||
return hecl::UTF8ToWide(search->second->at(idx));
|
||||
return std::wstring();
|
||||
}
|
||||
inline HECL::SystemString getSystemString(const FourCC& lang, size_t idx) const
|
||||
inline hecl::SystemString getSystemString(const FourCC& lang, size_t idx) const
|
||||
{
|
||||
auto search = langMap.find(lang);
|
||||
if (search != langMap.end())
|
||||
#if HECL_UCS2
|
||||
return HECL::UTF8ToWide(search->second->at(idx));
|
||||
return hecl::UTF8ToWide(search->second->at(idx));
|
||||
#else
|
||||
return search->second->at(idx);
|
||||
#endif
|
||||
return HECL::SystemString();
|
||||
return hecl::SystemString();
|
||||
}
|
||||
|
||||
static bool Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
|
||||
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
std::unique_ptr<ISTRG> strg = LoadSTRG(rs);
|
||||
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
|
||||
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
|
||||
strg->toYAMLFile(fp);
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool Cook(const HECL::ProjectPath& inPath, const HECL::ProjectPath& outPath)
|
||||
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
STRG strg;
|
||||
FILE* fp = HECL::Fopen(inPath.getAbsolutePath().c_str(), _S("rb"));
|
||||
FILE* fp = hecl::Fopen(inPath.getAbsolutePath().c_str(), _S("rb"));
|
||||
strg.fromYAMLFile(fp);
|
||||
fclose(fp);
|
||||
Athena::io::FileWriter ws(outPath.getAbsolutePath());
|
||||
athena::io::FileWriter ws(outPath.getAbsolutePath());
|
||||
strg.write(ws);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
namespace DataSpec
|
||||
{
|
||||
|
||||
static LogVisor::LogModule Log("Retro::SpecBase");
|
||||
static logvisor::Module Log("urde::SpecBase");
|
||||
|
||||
static const HECL::SystemChar* MomErr[] =
|
||||
static const hecl::SystemChar* MomErr[] =
|
||||
{
|
||||
_S("Your metroid is in another castle"),
|
||||
_S("HECL is experiencing a PTSD attack"),
|
||||
|
@ -31,13 +31,13 @@ static const HECL::SystemChar* MomErr[] =
|
|||
};
|
||||
|
||||
constexpr uint32_t MomErrCount = 11;
|
||||
SpecBase::SpecBase(HECL::Database::Project& project)
|
||||
SpecBase::SpecBase(hecl::Database::Project& project)
|
||||
: m_project(project),
|
||||
m_masterShader(project.getProjectWorkingPath(), ".hecl/RetroMasterShader.blend") {}
|
||||
|
||||
bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport>& reps)
|
||||
{
|
||||
m_disc = NOD::OpenDiscFromImage(info.srcpath.c_str(), m_isWii);
|
||||
m_disc = nod::OpenDiscFromImage(info.srcpath.c_str(), m_isWii);
|
||||
if (!m_disc)
|
||||
return false;
|
||||
const char* gameID = m_disc->getHeader().m_gameID;
|
||||
|
@ -51,7 +51,7 @@ bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport
|
|||
#else
|
||||
int r = rand_r(&t) % MomErrCount;
|
||||
#endif
|
||||
Log.report(LogVisor::FatalError, MomErr[r]);
|
||||
Log.report(logvisor::Fatal, MomErr[r]);
|
||||
}
|
||||
|
||||
m_standalone = true;
|
||||
|
@ -62,11 +62,11 @@ bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport
|
|||
return false;
|
||||
|
||||
char region = m_disc->getHeader().m_gameID[3];
|
||||
static const HECL::SystemString regNONE = _S("");
|
||||
static const HECL::SystemString regE = _S("NTSC");
|
||||
static const HECL::SystemString regJ = _S("NTSC-J");
|
||||
static const HECL::SystemString regP = _S("PAL");
|
||||
const HECL::SystemString* regstr = ®NONE;
|
||||
static const hecl::SystemString regNONE = _S("");
|
||||
static const hecl::SystemString regE = _S("NTSC");
|
||||
static const hecl::SystemString regJ = _S("NTSC-J");
|
||||
static const hecl::SystemString regP = _S("PAL");
|
||||
const hecl::SystemString* regstr = ®NONE;
|
||||
switch (region)
|
||||
{
|
||||
case 'E':
|
||||
|
@ -90,13 +90,13 @@ void SpecBase::doExtract(const ExtractPassInfo& info, FProgress progress)
|
|||
{
|
||||
DataSpec::g_curSpec = this;
|
||||
if (!Blender::BuildMasterShader(m_masterShader))
|
||||
Log.report(LogVisor::FatalError, "Unable to build master shader blend");
|
||||
Log.report(logvisor::Fatal, "Unable to build master shader blend");
|
||||
if (m_isWii)
|
||||
{
|
||||
/* Extract update partition for repacking later */
|
||||
const HECL::SystemString& target = m_project.getProjectWorkingPath().getAbsolutePath();
|
||||
NOD::Partition* update = m_disc->getUpdatePartition();
|
||||
NOD::ExtractionContext ctx = {true, info.force, nullptr};
|
||||
const hecl::SystemString& target = m_project.getProjectWorkingPath().getAbsolutePath();
|
||||
nod::Partition* update = m_disc->getUpdatePartition();
|
||||
nod::ExtractionContext ctx = {true, info.force, nullptr};
|
||||
|
||||
if (update)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ void SpecBase::doExtract(const ExtractPassInfo& info, FProgress progress)
|
|||
progress(_S("Update Partition"), _S(""), 0, 0.0);
|
||||
const atUint64 nodeCount = update->getFSTRoot().rawEnd() - update->getFSTRoot().rawBegin();
|
||||
ctx.progressCB = [&](const std::string& name) {
|
||||
HECL::SystemStringView nameView(name);
|
||||
hecl::SystemStringView nameView(name);
|
||||
progress(_S("Update Partition"), nameView.sys_str().c_str(), 0, idx / (float)nodeCount);
|
||||
idx++;
|
||||
};
|
||||
|
@ -116,10 +116,10 @@ void SpecBase::doExtract(const ExtractPassInfo& info, FProgress progress)
|
|||
if (!m_standalone)
|
||||
{
|
||||
progress(_S("Trilogy Files"), _S(""), 1, 0.0);
|
||||
NOD::Partition* data = m_disc->getDataPartition();
|
||||
const NOD::Node& root = data->getFSTRoot();
|
||||
for (const NOD::Node& child : root)
|
||||
if (child.getKind() == NOD::Node::Kind::File)
|
||||
nod::Partition* data = m_disc->getDataPartition();
|
||||
const nod::Node& root = data->getFSTRoot();
|
||||
for (const nod::Node& child : root)
|
||||
if (child.getKind() == nod::Node::Kind::File)
|
||||
child.extractToDirectory(target, ctx);
|
||||
progress(_S("Trilogy Files"), _S(""), 1, 1.0);
|
||||
}
|
||||
|
@ -127,25 +127,25 @@ void SpecBase::doExtract(const ExtractPassInfo& info, FProgress progress)
|
|||
extractFromDisc(*m_disc, info.force, progress);
|
||||
}
|
||||
|
||||
bool SpecBase::canCook(const HECL::ProjectPath& path)
|
||||
bool SpecBase::canCook(const hecl::ProjectPath& path)
|
||||
{
|
||||
if (!checkPathPrefix(path))
|
||||
return false;
|
||||
if (HECL::IsPathBlend(path))
|
||||
if (hecl::IsPathBlend(path))
|
||||
{
|
||||
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
if (!conn.openBlend(path))
|
||||
return false;
|
||||
if (conn.getBlendType() != HECL::BlenderConnection::BlendType::None)
|
||||
if (conn.getBlendType() != hecl::BlenderConnection::BlendType::None)
|
||||
return true;
|
||||
}
|
||||
else if (HECL::IsPathPNG(path))
|
||||
else if (hecl::IsPathPNG(path))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (HECL::IsPathYAML(path))
|
||||
else if (hecl::IsPathYAML(path))
|
||||
{
|
||||
FILE* fp = HECL::Fopen(path.getAbsolutePath().c_str(), _S("r"));
|
||||
FILE* fp = hecl::Fopen(path.getAbsolutePath().c_str(), _S("r"));
|
||||
bool retval = validateYAMLDNAType(fp);
|
||||
fclose(fp);
|
||||
return retval;
|
||||
|
@ -153,41 +153,41 @@ bool SpecBase::canCook(const HECL::ProjectPath& path)
|
|||
return false;
|
||||
}
|
||||
|
||||
void SpecBase::doCook(const HECL::ProjectPath& path, const HECL::ProjectPath& cookedPath,
|
||||
void SpecBase::doCook(const hecl::ProjectPath& path, const hecl::ProjectPath& cookedPath,
|
||||
bool fast, FCookProgress progress)
|
||||
{
|
||||
DataSpec::g_curSpec = this;
|
||||
if (HECL::IsPathBlend(path))
|
||||
if (hecl::IsPathBlend(path))
|
||||
{
|
||||
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
|
||||
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
|
||||
if (!conn.openBlend(path))
|
||||
return;
|
||||
switch (conn.getBlendType())
|
||||
{
|
||||
case HECL::BlenderConnection::BlendType::Mesh:
|
||||
case hecl::BlenderConnection::BlendType::Mesh:
|
||||
{
|
||||
HECL::BlenderConnection::DataStream ds = conn.beginData();
|
||||
hecl::BlenderConnection::DataStream ds = conn.beginData();
|
||||
cookMesh(cookedPath, path, ds, fast, progress);
|
||||
break;
|
||||
}
|
||||
case HECL::BlenderConnection::BlendType::Actor:
|
||||
case hecl::BlenderConnection::BlendType::Actor:
|
||||
{
|
||||
HECL::BlenderConnection::DataStream ds = conn.beginData();
|
||||
hecl::BlenderConnection::DataStream ds = conn.beginData();
|
||||
cookActor(cookedPath, path, ds, fast, progress);
|
||||
break;
|
||||
}
|
||||
case HECL::BlenderConnection::BlendType::Area:
|
||||
case hecl::BlenderConnection::BlendType::Area:
|
||||
{
|
||||
HECL::BlenderConnection::DataStream ds = conn.beginData();
|
||||
hecl::BlenderConnection::DataStream ds = conn.beginData();
|
||||
cookArea(cookedPath, path, ds, fast, progress);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else if (HECL::IsPathYAML(path))
|
||||
else if (hecl::IsPathYAML(path))
|
||||
{
|
||||
FILE* fp = HECL::Fopen(path.getAbsolutePath().c_str(), _S("r"));
|
||||
FILE* fp = hecl::Fopen(path.getAbsolutePath().c_str(), _S("r"));
|
||||
cookYAML(cookedPath, path, fp, progress);
|
||||
}
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ bool SpecBase::canPackage(const PackagePassInfo& info)
|
|||
}
|
||||
|
||||
void SpecBase::gatherDependencies(const PackagePassInfo& info,
|
||||
std::unordered_set<HECL::ProjectPath>& implicitsOut)
|
||||
std::unordered_set<hecl::ProjectPath>& implicitsOut)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -3,71 +3,71 @@
|
|||
|
||||
#include <functional>
|
||||
|
||||
#include <HECL/Database.hpp>
|
||||
#include <NOD/NOD.hpp>
|
||||
#include <hecl/Database.hpp>
|
||||
#include <nod/nod.hpp>
|
||||
#include "BlenderConnection.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
|
||||
struct SpecBase : HECL::Database::IDataSpec
|
||||
struct SpecBase : hecl::Database::IDataSpec
|
||||
{
|
||||
/* HECL Adaptors */
|
||||
bool canExtract(const ExtractPassInfo& info, std::vector<ExtractReport>& reps);
|
||||
void doExtract(const ExtractPassInfo& info, FProgress progress);
|
||||
|
||||
bool canCook(const HECL::ProjectPath& path);
|
||||
void doCook(const HECL::ProjectPath& path, const HECL::ProjectPath& cookedPath, bool fast, FCookProgress progress);
|
||||
bool canCook(const hecl::ProjectPath& path);
|
||||
void doCook(const hecl::ProjectPath& path, const hecl::ProjectPath& cookedPath, bool fast, FCookProgress progress);
|
||||
|
||||
bool canPackage(const PackagePassInfo& info);
|
||||
void gatherDependencies(const PackagePassInfo& info,
|
||||
std::unordered_set<HECL::ProjectPath>& implicitsOut);
|
||||
std::unordered_set<hecl::ProjectPath>& implicitsOut);
|
||||
void doPackage(const PackagePassInfo& info);
|
||||
|
||||
/* Extract handlers */
|
||||
virtual bool checkStandaloneID(const char* id) const=0;
|
||||
virtual bool checkFromStandaloneDisc(NOD::DiscBase& disc,
|
||||
const HECL::SystemString& regstr,
|
||||
const std::vector<HECL::SystemString>& args,
|
||||
virtual bool checkFromStandaloneDisc(nod::DiscBase& disc,
|
||||
const hecl::SystemString& regstr,
|
||||
const std::vector<hecl::SystemString>& args,
|
||||
std::vector<ExtractReport>& reps)=0;
|
||||
virtual bool checkFromTrilogyDisc(NOD::DiscBase& disc,
|
||||
const HECL::SystemString& regstr,
|
||||
const std::vector<HECL::SystemString>& args,
|
||||
virtual bool checkFromTrilogyDisc(nod::DiscBase& disc,
|
||||
const hecl::SystemString& regstr,
|
||||
const std::vector<hecl::SystemString>& args,
|
||||
std::vector<ExtractReport>& reps)=0;
|
||||
virtual bool extractFromDisc(NOD::DiscBase& disc, bool force,
|
||||
virtual bool extractFromDisc(nod::DiscBase& disc, bool force,
|
||||
FProgress progress)=0;
|
||||
|
||||
/* Basic path check (game directory matching) */
|
||||
virtual bool checkPathPrefix(const HECL::ProjectPath& path)=0;
|
||||
virtual bool checkPathPrefix(const hecl::ProjectPath& path)=0;
|
||||
|
||||
/* Pre-cook handlers */
|
||||
virtual bool validateYAMLDNAType(FILE* fp) const=0;
|
||||
|
||||
/* Cook handlers */
|
||||
using BlendStream = HECL::BlenderConnection::DataStream;
|
||||
using BlendStream = hecl::BlenderConnection::DataStream;
|
||||
using Mesh = BlendStream::Mesh;
|
||||
using Actor = BlendStream::Actor;
|
||||
|
||||
virtual void cookMesh(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds, bool fast, FCookProgress progress) const=0;
|
||||
virtual void cookActor(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds, bool fast, FCookProgress progress) const=0;
|
||||
virtual void cookArea(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds, bool fast, FCookProgress progress) const=0;
|
||||
virtual void cookYAML(const HECL::ProjectPath& out, const HECL::ProjectPath& in, FILE* fin, FCookProgress progress) const=0;
|
||||
virtual void cookMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, FCookProgress progress) const=0;
|
||||
virtual void cookActor(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, FCookProgress progress) const=0;
|
||||
virtual void cookArea(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, FCookProgress progress) const=0;
|
||||
virtual void cookYAML(const hecl::ProjectPath& out, const hecl::ProjectPath& in, FILE* fin, FCookProgress progress) const=0;
|
||||
|
||||
const HECL::ProjectPath& getMasterShaderPath() const {return m_masterShader;}
|
||||
const hecl::ProjectPath& getMasterShaderPath() const {return m_masterShader;}
|
||||
|
||||
/* Support functions for resolving paths from IDs */
|
||||
virtual HECL::ProjectPath getWorking(class UniqueID32&) {return HECL::ProjectPath();}
|
||||
virtual HECL::ProjectPath getWorking(class UniqueID64&) {return HECL::ProjectPath();}
|
||||
virtual hecl::ProjectPath getWorking(class UniqueID32&) {return hecl::ProjectPath();}
|
||||
virtual hecl::ProjectPath getWorking(class UniqueID64&) {return hecl::ProjectPath();}
|
||||
|
||||
/* Project accessor */
|
||||
HECL::Database::Project& getProject() {return m_project;}
|
||||
hecl::Database::Project& getProject() {return m_project;}
|
||||
|
||||
SpecBase(HECL::Database::Project& project);
|
||||
SpecBase(hecl::Database::Project& project);
|
||||
protected:
|
||||
HECL::Database::Project& m_project;
|
||||
HECL::ProjectPath m_masterShader;
|
||||
hecl::Database::Project& m_project;
|
||||
hecl::ProjectPath m_masterShader;
|
||||
private:
|
||||
std::unique_ptr<NOD::DiscBase> m_disc;
|
||||
std::unique_ptr<nod::DiscBase> m_disc;
|
||||
bool m_isWii;
|
||||
bool m_standalone;
|
||||
};
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
namespace DataSpec
|
||||
{
|
||||
|
||||
static LogVisor::LogModule Log("Retro::SpecMP1");
|
||||
extern HECL::Database::DataSpecEntry SpecEntMP1;
|
||||
static logvisor::Module Log("urde::SpecMP1");
|
||||
extern hecl::Database::DataSpecEntry SpecEntMP1;
|
||||
|
||||
struct SpecMP1 : SpecBase
|
||||
{
|
||||
|
@ -25,27 +25,27 @@ struct SpecMP1 : SpecBase
|
|||
return false;
|
||||
}
|
||||
|
||||
std::vector<const NOD::Node*> m_nonPaks;
|
||||
std::vector<const nod::Node*> m_nonPaks;
|
||||
std::vector<DNAMP1::PAKBridge> m_paks;
|
||||
std::map<std::string, DNAMP1::PAKBridge*, HECL::CaseInsensitiveCompare> m_orderedPaks;
|
||||
std::map<std::string, DNAMP1::PAKBridge*, hecl::CaseInsensitiveCompare> m_orderedPaks;
|
||||
|
||||
HECL::ProjectPath m_workPath;
|
||||
HECL::ProjectPath m_cookPath;
|
||||
hecl::ProjectPath m_workPath;
|
||||
hecl::ProjectPath m_cookPath;
|
||||
PAKRouter<DNAMP1::PAKBridge> m_pakRouter;
|
||||
|
||||
SpecMP1(HECL::Database::Project& project)
|
||||
SpecMP1(hecl::Database::Project& project)
|
||||
: SpecBase(project),
|
||||
m_workPath(project.getProjectWorkingPath(), _S("MP1")),
|
||||
m_cookPath(project.getProjectCookedPath(SpecEntMP1), _S("MP1")),
|
||||
m_pakRouter(*this, m_workPath, m_cookPath) {}
|
||||
|
||||
void buildPaks(NOD::Node& root,
|
||||
const std::vector<HECL::SystemString>& args,
|
||||
void buildPaks(nod::Node& root,
|
||||
const std::vector<hecl::SystemString>& args,
|
||||
ExtractReport& rep)
|
||||
{
|
||||
m_nonPaks.clear();
|
||||
m_paks.clear();
|
||||
for (const NOD::Node& child : root)
|
||||
for (const nod::Node& child : root)
|
||||
{
|
||||
bool isPak = false;
|
||||
const std::string& name = child.getName();
|
||||
|
@ -67,8 +67,8 @@ struct SpecMP1 : SpecBase
|
|||
good = false;
|
||||
if (!lowerName.compare(0, 7, "metroid"))
|
||||
{
|
||||
HECL::SystemChar idxChar = lowerName[7];
|
||||
for (const HECL::SystemString& arg : args)
|
||||
hecl::SystemChar idxChar = lowerName[7];
|
||||
for (const hecl::SystemString& arg : args)
|
||||
{
|
||||
if (arg.size() == 1 && iswdigit(arg[0]))
|
||||
if (arg[0] == idxChar)
|
||||
|
@ -80,10 +80,10 @@ struct SpecMP1 : SpecBase
|
|||
|
||||
if (!good)
|
||||
{
|
||||
for (const HECL::SystemString& arg : args)
|
||||
for (const hecl::SystemString& arg : args)
|
||||
{
|
||||
#if HECL_UCS2
|
||||
std::string lowerArg = HECL::WideToUTF8(arg);
|
||||
std::string lowerArg = hecl::WideToUTF8(arg);
|
||||
#else
|
||||
std::string lowerArg = arg;
|
||||
#endif
|
||||
|
@ -116,18 +116,18 @@ struct SpecMP1 : SpecBase
|
|||
continue;
|
||||
rep.childOpts.emplace_back();
|
||||
ExtractReport& childRep = rep.childOpts.back();
|
||||
HECL::SystemStringView nameView(item.first);
|
||||
hecl::SystemStringView nameView(item.first);
|
||||
childRep.name = nameView;
|
||||
childRep.desc = item.second->getLevelString();
|
||||
}
|
||||
}
|
||||
|
||||
bool checkFromStandaloneDisc(NOD::DiscBase& disc,
|
||||
const HECL::SystemString& regstr,
|
||||
const std::vector<HECL::SystemString>& args,
|
||||
bool checkFromStandaloneDisc(nod::DiscBase& disc,
|
||||
const hecl::SystemString& regstr,
|
||||
const std::vector<hecl::SystemString>& args,
|
||||
std::vector<ExtractReport>& reps)
|
||||
{
|
||||
NOD::Partition* partition = disc.getDataPartition();
|
||||
nod::Partition* partition = disc.getDataPartition();
|
||||
std::unique_ptr<uint8_t[]> dolBuf = partition->getDOLBuf();
|
||||
const char* buildInfo = (char*)memmem(dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16) + 19;
|
||||
|
||||
|
@ -142,40 +142,40 @@ struct SpecMP1 : SpecBase
|
|||
if (buildInfo)
|
||||
{
|
||||
std::string buildStr(buildInfo);
|
||||
HECL::SystemStringView buildView(buildStr);
|
||||
hecl::SystemStringView buildView(buildStr);
|
||||
rep.desc += _S(" (") + buildView + _S(")");
|
||||
}
|
||||
|
||||
/* Iterate PAKs and build level options */
|
||||
NOD::Node& root = partition->getFSTRoot();
|
||||
nod::Node& root = partition->getFSTRoot();
|
||||
buildPaks(root, args, rep);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool checkFromTrilogyDisc(NOD::DiscBase& disc,
|
||||
const HECL::SystemString& regstr,
|
||||
const std::vector<HECL::SystemString>& args,
|
||||
bool checkFromTrilogyDisc(nod::DiscBase& disc,
|
||||
const hecl::SystemString& regstr,
|
||||
const std::vector<hecl::SystemString>& args,
|
||||
std::vector<ExtractReport>& reps)
|
||||
{
|
||||
std::vector<HECL::SystemString> mp1args;
|
||||
std::vector<hecl::SystemString> mp1args;
|
||||
bool doExtract = false;
|
||||
if (args.size())
|
||||
{
|
||||
/* Needs filter */
|
||||
for (const HECL::SystemString& arg : args)
|
||||
for (const hecl::SystemString& arg : args)
|
||||
{
|
||||
HECL::SystemString lowerArg = arg;
|
||||
HECL::ToLower(lowerArg);
|
||||
hecl::SystemString lowerArg = arg;
|
||||
hecl::ToLower(lowerArg);
|
||||
if (!lowerArg.compare(0, 3, _S("mp1")))
|
||||
{
|
||||
doExtract = true;
|
||||
mp1args.reserve(args.size());
|
||||
size_t slashPos = arg.find(_S('/'));
|
||||
if (slashPos == HECL::SystemString::npos)
|
||||
if (slashPos == hecl::SystemString::npos)
|
||||
slashPos = arg.find(_S('\\'));
|
||||
if (slashPos != HECL::SystemString::npos)
|
||||
mp1args.emplace_back(HECL::SystemString(arg.begin() + slashPos + 1, arg.end()));
|
||||
if (slashPos != hecl::SystemString::npos)
|
||||
mp1args.emplace_back(hecl::SystemString(arg.begin() + slashPos + 1, arg.end()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -185,9 +185,9 @@ struct SpecMP1 : SpecBase
|
|||
if (!doExtract)
|
||||
return false;
|
||||
|
||||
NOD::Partition* partition = disc.getDataPartition();
|
||||
NOD::Node& root = partition->getFSTRoot();
|
||||
NOD::Node::DirectoryIterator dolIt = root.find("rs5mp1_p.dol");
|
||||
nod::Partition* partition = disc.getDataPartition();
|
||||
nod::Node& root = partition->getFSTRoot();
|
||||
nod::Node::DirectoryIterator dolIt = root.find("rs5mp1_p.dol");
|
||||
if (dolIt == root.end())
|
||||
return false;
|
||||
|
||||
|
@ -202,12 +202,12 @@ struct SpecMP1 : SpecBase
|
|||
if (buildInfo)
|
||||
{
|
||||
std::string buildStr(buildInfo);
|
||||
HECL::SystemStringView buildView(buildStr);
|
||||
hecl::SystemStringView buildView(buildStr);
|
||||
rep.desc += _S(" (") + buildView + _S(")");
|
||||
}
|
||||
|
||||
/* Iterate PAKs and build level options */
|
||||
NOD::Node::DirectoryIterator mp1It = root.find("MP1");
|
||||
nod::Node::DirectoryIterator mp1It = root.find("MP1");
|
||||
if (mp1It == root.end())
|
||||
return false;
|
||||
buildPaks(*mp1It, mp1args, rep);
|
||||
|
@ -215,9 +215,9 @@ struct SpecMP1 : SpecBase
|
|||
return true;
|
||||
}
|
||||
|
||||
bool extractFromDisc(NOD::DiscBase&, bool force, FProgress progress)
|
||||
bool extractFromDisc(nod::DiscBase&, bool force, FProgress progress)
|
||||
{
|
||||
NOD::ExtractionContext ctx = {true, force, nullptr};
|
||||
nod::ExtractionContext ctx = {true, force, nullptr};
|
||||
|
||||
progress(_S("Indexing PAKs"), _S(""), 2, 0.0);
|
||||
m_pakRouter.build(m_paks, [&progress](float factor)
|
||||
|
@ -230,17 +230,17 @@ struct SpecMP1 : SpecBase
|
|||
progress(_S("MP1 Root"), _S(""), 3, 0.0);
|
||||
int prog = 0;
|
||||
ctx.progressCB = [&](const std::string& name) {
|
||||
HECL::SystemStringView nameView(name);
|
||||
hecl::SystemStringView nameView(name);
|
||||
progress(_S("MP1 Root"), nameView.sys_str().c_str(), 3, prog / (float)m_nonPaks.size());
|
||||
};
|
||||
for (const NOD::Node* node : m_nonPaks)
|
||||
for (const nod::Node* node : m_nonPaks)
|
||||
{
|
||||
node->extractToDirectory(m_workPath.getAbsolutePath(), ctx);
|
||||
prog++;
|
||||
}
|
||||
progress(_S("MP1 Root"), _S(""), 3, 1.0);
|
||||
|
||||
const HECL::ProjectPath& cookPath = m_project.getProjectCookedPath(SpecEntMP1);
|
||||
const hecl::ProjectPath& cookPath = m_project.getProjectCookedPath(SpecEntMP1);
|
||||
cookPath.makeDir();
|
||||
m_cookPath.makeDir();
|
||||
|
||||
|
@ -253,11 +253,11 @@ struct SpecMP1 : SpecBase
|
|||
continue;
|
||||
|
||||
const std::string& name = pak.getName();
|
||||
HECL::SystemStringView sysName(name);
|
||||
hecl::SystemStringView sysName(name);
|
||||
|
||||
progress(sysName.sys_str().c_str(), _S(""), compIdx, 0.0);
|
||||
m_pakRouter.extractResources(pak, force,
|
||||
[&progress, &sysName, &compIdx](const HECL::SystemChar* substr, float factor)
|
||||
[&progress, &sysName, &compIdx](const hecl::SystemChar* substr, float factor)
|
||||
{
|
||||
progress(sysName.sys_str().c_str(), substr, compIdx, factor);
|
||||
});
|
||||
|
@ -267,12 +267,12 @@ struct SpecMP1 : SpecBase
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual HECL::ProjectPath getWorking(class UniqueID32& id)
|
||||
virtual hecl::ProjectPath getWorking(class UniqueID32& id)
|
||||
{
|
||||
return m_pakRouter.getWorking(id);
|
||||
}
|
||||
|
||||
bool checkPathPrefix(const HECL::ProjectPath& path)
|
||||
bool checkPathPrefix(const hecl::ProjectPath& path)
|
||||
{
|
||||
return path.getRelativePath().compare(0, 4, _S("MP1/")) == 0;
|
||||
}
|
||||
|
@ -286,41 +286,41 @@ struct SpecMP1 : SpecBase
|
|||
return false;
|
||||
}
|
||||
|
||||
void cookMesh(const HECL::ProjectPath& out, const HECL::ProjectPath& in,
|
||||
void cookMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
||||
BlendStream& ds, bool fast, FCookProgress progress) const
|
||||
{
|
||||
Mesh mesh = ds.compileMesh(fast ? HECL::HMDLTopology::Triangles : HECL::HMDLTopology::TriStrips, -1,
|
||||
Mesh mesh = ds.compileMesh(fast ? hecl::HMDLTopology::Triangles : hecl::HMDLTopology::TriStrips, -1,
|
||||
[&progress](int surfCount)
|
||||
{
|
||||
progress(HECL::SysFormat(_S("%d"), surfCount).c_str());
|
||||
progress(hecl::SysFormat(_S("%d"), surfCount).c_str());
|
||||
});
|
||||
DNAMP1::CMDL::Cook(out, in, mesh);
|
||||
}
|
||||
|
||||
void cookActor(const HECL::ProjectPath& out, const HECL::ProjectPath& in,
|
||||
void cookActor(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
||||
BlendStream& ds, bool fast, FCookProgress progress) const
|
||||
{
|
||||
Actor actor = ds.compileActor();
|
||||
DNAMP1::ANCS::Cook(out, in, actor);
|
||||
}
|
||||
|
||||
void cookArea(const HECL::ProjectPath& out, const HECL::ProjectPath& in,
|
||||
void cookArea(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
||||
BlendStream& ds, bool fast, FCookProgress progress) const
|
||||
{
|
||||
}
|
||||
|
||||
void cookYAML(const HECL::ProjectPath& out, const HECL::ProjectPath& in,
|
||||
void cookYAML(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
|
||||
FILE* fin, FCookProgress progress) const
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
HECL::Database::DataSpecEntry SpecEntMP1 =
|
||||
hecl::Database::DataSpecEntry SpecEntMP1 =
|
||||
{
|
||||
_S("MP1"),
|
||||
_S("Data specification for original Metroid Prime engine"),
|
||||
[](HECL::Database::Project& project, HECL::Database::DataSpecTool)
|
||||
-> HECL::Database::IDataSpec* {return new struct SpecMP1(project);}
|
||||
[](hecl::Database::Project& project, hecl::Database::DataSpecTool)
|
||||
-> hecl::Database::IDataSpec* {return new struct SpecMP1(project);}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue