Merge branch 'shader-refactor'

This commit is contained in:
Jack Andersen 2018-10-15 17:17:37 -10:00
commit 3f4aeffb17
1013 changed files with 10142 additions and 18510 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ docs/*
.idea/dictionaries .idea/dictionaries
.idea/workspace.xml .idea/workspace.xml
.idea/misc.xml .idea/misc.xml
Editor/platforms/win/urde.rc

View File

@ -14,6 +14,8 @@
<mapping directory="$PROJECT_DIR$/hecl/extern/athena" vcs="Git" /> <mapping directory="$PROJECT_DIR$/hecl/extern/athena" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/boo" vcs="Git" /> <mapping directory="$PROJECT_DIR$/hecl/extern/boo" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/boo/glslang" vcs="Git" /> <mapping directory="$PROJECT_DIR$/hecl/extern/boo/glslang" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/boo/lib/graphicsdev/nx/libdrm_nouveau" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/boo/lib/graphicsdev/nx/mesa" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/boo/logvisor" vcs="Git" /> <mapping directory="$PROJECT_DIR$/hecl/extern/boo/logvisor" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/libSquish" vcs="Git" /> <mapping directory="$PROJECT_DIR$/hecl/extern/libSquish" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/libjpeg-turbo" vcs="Git" /> <mapping directory="$PROJECT_DIR$/hecl/extern/libjpeg-turbo" vcs="Git" />

View File

@ -9,14 +9,17 @@ if(APPLE AND NOT CMAKE_OSX_SYSROOT)
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
endif() endif()
project(urde) option(URDE_CROSSCOMPILING "Don't build tools; attempt package import" OFF)
option(URDE_CROSSCOMPILING "Don't build tools; attempt package import" Off)
if (URDE_CROSSCOMPILING) if (URDE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING On) set(CMAKE_CROSSCOMPILING On)
set(HAVE_WORDS_BIGENDIAN_EXITCODE 0)
endif() endif()
if(CMAKE_CROSSCOMPILING)
set(HAVE_WORDS_BIGENDIAN_EXITCODE 0 CACHE INTEGER "Makes soxr happy" FORCE)
endif()
project(urde)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Force shared libs off" FORCE) set(BUILD_SHARED_LIBS OFF CACHE BOOL "Force shared libs off" FORCE)
@ -30,7 +33,11 @@ if(NOT MSVC OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
include(cotire) include(cotire)
endif() endif()
set(URDE_VECTOR_ISA "sse2" CACHE STRING "Vector ISA to build for (sse2, sse3, sse41, avx, avx2)") if (NX)
set(URDE_VECTOR_ISA "neon")
else()
set(URDE_VECTOR_ISA "sse2" CACHE STRING "Vector ISA to build for (sse2, sse3, sse41, avx, avx2)")
endif()
if(MSVC) if(MSVC)
if(${URDE_VECTOR_ISA} STREQUAL "avx2") if(${URDE_VECTOR_ISA} STREQUAL "avx2")
@ -55,9 +62,12 @@ if(MSVC)
endif() endif()
# Shaddup 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 add_definitions(-DUNICODE=1 -D_UNICODE=1 -D__SSE__=1
-D_SCL_SECURE_NO_DEPRECATE=1 -D_CRT_NONSTDC_NO_WARNINGS=1 /IGNORE:4221 /wd4018 /wd4800 /wd4005 /wd4311 -D_CRT_SECURE_NO_WARNINGS=1 -DD_SCL_SECURE_NO_WARNINGS=1
/wd4267 /wd4244 /wd4200 /wd4305 /wd4067 /wd4146 /wd4309 /wd4805 ${VS_DEFINES}) -D_SCL_SECURE_NO_DEPRECATE=1 -D_CRT_NONSTDC_NO_WARNINGS=1
/IGNORE:4221 /wd4018 /wd4800 /wd4005 /wd4311
/wd4267 /wd4244 /wd4200 /wd4305 /wd4067 /wd4146 /wd4309 /wd4805
-D_ENABLE_EXTENDED_ALIGNED_STORAGE=1 ${VS_DEFINES})
if(WINDOWS_STORE) if(WINDOWS_STORE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /AI\"$ENV{PROGRAMFILES\(X86\)}/Microsoft Visual Studio/2017/Community/Common7/IDE/VC/vcpackages\" /AI\"$ENV{PROGRAMFILES\(X86\)}/Windows Kits/10/UnionMetadata\"") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /AI\"$ENV{PROGRAMFILES\(X86\)}/Microsoft Visual Studio/2017/Community/Common7/IDE/VC/vcpackages\" /AI\"$ENV{PROGRAMFILES\(X86\)}/Windows Kits/10/UnionMetadata\"")
@ -99,12 +109,14 @@ else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2")
message(STATUS "Building with SSE2 Vector ISA") message(STATUS "Building with SSE2 Vector ISA")
elseif(${URDE_VECTOR_ISA} STREQUAL "neon")
message(STATUS "Building with NEON Vector ISA")
else() else()
message(STATUS "Building with x87 Vector ISA") message(STATUS "Building with x87 Vector ISA")
endif() endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}\ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}\
-Wno-multichar -fno-exceptions -Wno-narrowing -Wno-nullability-completeness -Werror=return-type") -Wno-multichar -fno-exceptions -fno-rtti -Wno-narrowing -Wno-nullability-completeness -Werror=return-type")
if(APPLE) if(APPLE)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto=thin") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto=thin")
@ -141,13 +153,15 @@ if(USE_LD_GOLD AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_
endif() endif()
# Add discord-rpc here # Add discord-rpc here
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/include) if(NOT GEKKO AND NOT NX)
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/include)
if (NOT CMAKE_INSTALL_LIBDIR) set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc)
if (NOT CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR ${CMAKE_BINARY_DIR}/fake-prefix) set(CMAKE_INSTALL_LIBDIR ${CMAKE_BINARY_DIR}/fake-prefix)
endif()
add_subdirectory(discord-rpc/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc/include)
endif() endif()
add_subdirectory(discord-rpc/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc/include)
add_subdirectory(nod) add_subdirectory(nod)
set(NOD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/nod/include) set(NOD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/nod/include)
@ -185,6 +199,10 @@ set(HECL_DATASPEC_PUSHES
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3); hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3);
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3PC); hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3PC);
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3ORIG);") hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3ORIG);")
add_subdirectory(hecl/shaderc)
include(hecl/ApplicationTools.cmake)
add_subdirectory(specter/shaders)
add_subdirectory(Shaders)
add_subdirectory(hecl) add_subdirectory(hecl)
if(NOT TARGET bintoc) if(NOT TARGET bintoc)
@ -233,12 +251,14 @@ add_subdirectory(visigen)
add_dependencies(hecl visigen) add_dependencies(hecl visigen)
find_package(Qt5Widgets) if (NOT WINDOWS_STORE AND NOT NX)
if (Qt5Widgets_FOUND) find_package(Qt5Widgets)
if (Qt5Widgets_FOUND)
message(STATUS "Qt5 found, hecl-gui will be built") message(STATUS "Qt5 found, hecl-gui will be built")
add_subdirectory(hecl-gui) add_subdirectory(hecl-gui)
else() else()
message(STATUS "Qt5 not found, hecl-gui will not be built") message(STATUS "Qt5 not found, hecl-gui will not be built")
endif()
endif() endif()
unset(GIT_EXECUTABLE CACHE) unset(GIT_EXECUTABLE CACHE)

View File

@ -37,7 +37,7 @@ void LoadAssetMap(athena::io::MemoryReader& ar)
if (ar.length() >= 4) if (ar.length() >= 4)
ar.readBytesToBuf(&magic, 4); ar.readBytesToBuf(&magic, 4);
if (magic != FOURCC('AIDM')) if (magic != FOURCC('AIDM'))
Log.report(logvisor::Warning, _S("Unable to load asset map; Assets will not have proper filenames for most files.")); Log.report(logvisor::Warning, _SYS_STR("Unable to load asset map; Assets will not have proper filenames for most files."));
else else
{ {
uint32_t assetCount = ar.readUint32Big(); uint32_t assetCount = ar.readUint32Big();

View File

@ -1,5 +1,4 @@
#ifndef _DATASPEC_ASSETNAMEMAP_HPP_ #pragma once
#define _DATASPEC_ASSETNAMEMAP_HPP_
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
@ -11,4 +10,3 @@ void InitAssetNameMap();
const std::string* TranslateIdToName(const UniqueID32&); const std::string* TranslateIdToName(const UniqueID32&);
const std::string* TranslateIdToName(const UniqueID64&); const std::string* TranslateIdToName(const UniqueID64&);
} }
#endif // _DATASPEC_ASSETNAMEMAP_HPP_

View File

@ -1,5 +1,4 @@
#ifndef _RETRO_BLENDER_SUPPORT_HPP_ #pragma once
#define _RETRO_BLENDER_SUPPORT_HPP_
#include <hecl/hecl.hpp> #include <hecl/hecl.hpp>
@ -10,4 +9,3 @@ bool BuildMasterShader(const hecl::ProjectPath& path);
} }
#endif // _RETRO_BLENDER_SUPPORT_HPP_

View File

@ -26,7 +26,8 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn,
for (const auto& info : 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); const typename PAKRouter::EntryType* cmdlE =
pakRouter.lookupEntry(info.cmdl, &node, true, false);
if (cmdlE) if (cmdlE)
{ {
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE); hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
@ -55,6 +56,44 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn,
} }
} }
/* Extract attachment CMDL/CSKRs first */
auto attRange = pakRouter.lookupCharacterAttachmentRigs(entry.id);
for (auto it = attRange.first; it != attRange.second; ++it)
{
auto cmdlid = it->second.first.second;
const nod::Node* node;
const typename PAKRouter::EntryType* cmdlE =
pakRouter.lookupEntry(cmdlid, &node, true, false);
if (cmdlE)
{
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
if (force || cmdlPath.isNone())
{
if (!conn.createBlend(cmdlPath, hecl::blender::BlendType::Mesh))
return false;
std::string bestName = pakRouter.getBestEntryName(*cmdlE);
hecl::SystemStringConv bestNameView(bestName);
fileChanged(bestNameView.c_str());
const auto* rp = pakRouter.lookupCMDLRigPair(cmdlid);
typename ANCSDNA::CSKRType cskr;
pakRouter.lookupAndReadDNA(rp->first, cskr);
typename ANCSDNA::CINFType cinf;
pakRouter.lookupAndReadDNA(rp->second, cinf);
using RigPair = std::pair<typename ANCSDNA::CSKRType*, typename ANCSDNA::CINFType*>;
RigPair rigPair(&cskr, &cinf);
PAKEntryReadStream rs = cmdlE->beginReadStream(*node);
DNACMDL::ReadCMDLToBlender<PAKRouter, MaterialSet, RigPair, SurfaceHeader, CMDLVersion>
(conn, rs, pakRouter, *cmdlE, dataspec, rigPair);
conn.saveBlend();
}
}
}
std::string bestName = pakRouter.getBestEntryName(entry); std::string bestName = pakRouter.getBestEntryName(entry);
hecl::SystemStringConv bestNameView(bestName); hecl::SystemStringConv bestNameView(bestName);
fileChanged(bestNameView.c_str()); fileChanged(bestNameView.c_str());
@ -82,7 +121,8 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn,
" bpy.context.scene.objects.unlink(ob)\n" " bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n" " bpy.data.objects.remove(ob)\n"
"\n" "\n"
"actor_data = bpy.context.scene.hecl_sact_data\n", "actor_data = bpy.context.scene.hecl_sact_data\n"
"arm_obj = None\n",
pakRouter.getBestEntryName(entry).c_str()); pakRouter.getBestEntryName(entry).c_str());
std::unordered_set<typename PAKRouter::IDType> cinfsDone; std::unordered_set<typename PAKRouter::IDType> cinfsDone;
@ -111,7 +151,8 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn,
os << "actor_subtype.linked_armature = arm_obj.name\n"; os << "actor_subtype.linked_armature = arm_obj.name\n";
/* Link CMDL */ /* Link CMDL */
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(info.cmdl, nullptr, true, true); const typename PAKRouter::EntryType* cmdlE =
pakRouter.lookupEntry(info.cmdl, nullptr, true, false);
if (cmdlE) if (cmdlE)
{ {
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE); hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
@ -130,10 +171,11 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn,
for (const auto& overlay : info.overlays) for (const auto& overlay : info.overlays)
{ {
os << "overlay = actor_subtype.overlays.add()\n"; os << "overlay = actor_subtype.overlays.add()\n";
os.format("overlay.name = '%s'\n", overlay.first.toString().c_str()); os.format("overlay.name = '%s'\n", overlay.first.c_str());
/* Link CMDL */ /* Link CMDL */
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(overlay.second.first, nullptr, true, true); const typename PAKRouter::EntryType* cmdlE =
pakRouter.lookupEntry(overlay.second.first, nullptr, true, false);
if (cmdlE) if (cmdlE)
{ {
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE); hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
@ -149,6 +191,53 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn,
} }
} }
} }
/* Link attachments */
for (auto it = attRange.first; it != attRange.second; ++it)
{
os << "attachment = actor_data.attachments.add()\n";
os.format("attachment.name = '%s'\n", it->second.second.c_str());
auto cinfid = it->second.first.first;
auto cmdlid = it->second.first.second;
if (cinfid)
{
/* Build CINF if needed */
if (cinfsDone.find(cinfid) == cinfsDone.end())
{
typename ANCSDNA::CINFType cinf;
pakRouter.lookupAndReadDNA(cinfid, cinf);
cinf.sendCINFToBlender(os, cinfid);
if (cinfsDone.empty())
{
firstName = ANCSDNA::CINFType::GetCINFArmatureName(cinfid);
firstCinf = cinf;
}
cinfsDone.insert(cinfid);
}
else
os.format("arm_obj = bpy.data.objects['CINF_%s']\n", cinfid.toString().c_str());
os << "attachment.linked_armature = arm_obj.name\n";
}
/* Link CMDL */
const typename PAKRouter::EntryType* cmdlE =
pakRouter.lookupEntry(cmdlid, nullptr, true, false);
if (cmdlE)
{
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
os.linkBlend(cmdlPath.getAbsolutePathUTF8().data(),
pakRouter.getBestEntryName(*cmdlE).data(), true);
/* Attach CMDL to CINF */
os << "if obj.name not in bpy.context.scene.objects:\n"
" bpy.context.scene.objects.link(obj)\n"
"obj.parent = arm_obj\n"
"obj.parent_type = 'ARMATURE'\n"
"attachment.linked_mesh = obj.name\n\n";
}
}
} }
{ {

View File

@ -1,5 +1,4 @@
#ifndef _DNACOMMON_ANCS_HPP_ #pragma once
#define _DNACOMMON_ANCS_HPP_
#include <unordered_set> #include <unordered_set>
#include "DNACommon.hpp" #include "DNACommon.hpp"
@ -20,7 +19,7 @@ struct CharacterResInfo
IDTYPE cmdl; IDTYPE cmdl;
IDTYPE cskr; IDTYPE cskr;
IDTYPE cinf; IDTYPE cinf;
std::vector<std::pair<hecl::FourCC, std::pair<IDTYPE, IDTYPE>>> overlays; std::vector<std::pair<std::string, std::pair<IDTYPE, IDTYPE>>> overlays;
}; };
template <typename IDTYPE> template <typename IDTYPE>
@ -44,4 +43,3 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn,
} }
#endif // _DNACOMMON_ANCS_HPP_

View File

@ -1,5 +1,4 @@
#ifndef _DNACOMMON_ANIMBITSTREAM_HPP_ #pragma once
#define _DNACOMMON_ANIMBITSTREAM_HPP_
#include "DNACommon.hpp" #include "DNACommon.hpp"
#include <cmath> #include <cmath>
@ -99,4 +98,3 @@ public:
} }
#endif // _DNACOMMON_ANIMBITSTREAM_HPP_

View File

@ -1,5 +1,4 @@
#ifndef _DNACOMMON_AROTBUILDER_HPP_ #pragma once
#define _DNACOMMON_AROTBUILDER_HPP_
#include "DNACommon.hpp" #include "DNACommon.hpp"
#include "DeafBabe.hpp" #include "DeafBabe.hpp"
@ -59,4 +58,3 @@ struct AROTBuilder
} }
#endif // _DNACOMMON_AROTBUILDER_HPP_

View File

@ -1,5 +1,4 @@
#ifndef _DNACOMMON_ATBL_HPP_ #pragma once
#define _DNACOMMON_ATBL_HPP_
#include "DNACommon.hpp" #include "DNACommon.hpp"
#include "PAK.hpp" #include "PAK.hpp"
@ -16,4 +15,3 @@ public:
} }
#endif // _DNACOMMON_ATBL_HPP_

View File

@ -1,5 +1,4 @@
#ifndef _DNACOMMON_BABEDEAD_HPP_ #pragma once
#define _DNACOMMON_BABEDEAD_HPP_
#include "zeus/Math.hpp" #include "zeus/Math.hpp"
#include "hecl/hecl.hpp" #include "hecl/hecl.hpp"
@ -17,4 +16,3 @@ void WriteBabeDeadLightFromBlender(BabeDeadLight& lightOut, const hecl::blender:
} }
#endif // _DNACOMMON_BABEDEAD_HPP_

View File

@ -1,5 +1,4 @@
#ifndef _DNACOMMON_CMDL_HPP_ #pragma once
#define _DNACOMMON_CMDL_HPP_
#include "athena/FileWriter.hpp" #include "athena/FileWriter.hpp"
#include "hecl/Frontend.hpp" #include "hecl/Frontend.hpp"
@ -179,4 +178,3 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
} }
#endif // _DNACOMMON_CMDL_HPP_

View File

@ -1,5 +1,4 @@
#ifndef __COMMON_CRSC_HPP__ #pragma once
#define __COMMON_CRSC_HPP__
#include "ParticleCommon.hpp" #include "ParticleCommon.hpp"
#include "PAK.hpp" #include "PAK.hpp"
@ -29,4 +28,3 @@ bool ExtractCRSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType> template <class IDType>
bool WriteCRSM(const CRSM<IDType>& crsm, const hecl::ProjectPath& outPath); bool WriteCRSM(const CRSM<IDType>& crsm, const hecl::ProjectPath& outPath);
} }
#endif // __COMMON_CRSC_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __COMMON_DGRP_HPP__ #pragma once
#define __COMMON_DGRP_HPP__
#include "DNACommon.hpp" #include "DNACommon.hpp"
#include "PAK.hpp" #include "PAK.hpp"
@ -48,4 +47,3 @@ bool WriteDGRP(const DGRP<IDType>& dgrp, const hecl::ProjectPath& outPath);
} }
#endif // __COMMON_DGRP_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNA_COMMON_HPP__ #pragma once
#define __DNA_COMMON_HPP__
#include <cstdio> #include <cstdio>
#include "logvisor/logvisor.hpp" #include "logvisor/logvisor.hpp"
@ -428,6 +427,31 @@ public:
/** Resource cooker function */ /** 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;
/** Mappings of resources involved in extracting characters */
template <class IDType>
struct CharacterAssociations
{
using RigPair = std::pair<IDType, IDType>;
/* CMDL -> (CSKR, CINF) */
std::unordered_map<IDType, RigPair> m_cmdlRigs;
/* (CSKR, CINF) -> ANCS */
std::unordered_map<IDType, std::pair<IDType, std::string>> m_cskrCinfToCharacter;
/* ANCS -> (CINF, CMDL) */
std::unordered_multimap<IDType, std::pair<RigPair, std::string>> m_characterToAttachmentRigs;
using MultimapIteratorPair = std::pair<
typename std::unordered_multimap<IDType, std::pair<RigPair, std::string>>::const_iterator,
typename std::unordered_multimap<IDType, std::pair<RigPair, std::string>>::const_iterator>;
void addAttachmentRig(IDType character, IDType cinf, IDType cmdl, const char* name)
{
auto range = m_characterToAttachmentRigs.equal_range(character);
for (auto it = range.first; it != range.second; ++it)
if (it->second.second == name)
return;
m_characterToAttachmentRigs.insert(
std::make_pair(character, std::make_pair(std::make_pair(cinf, cmdl), name)));
}
};
} }
/* Hash template-specializations for UniqueID types */ /* Hash template-specializations for UniqueID types */
@ -462,4 +486,3 @@ struct hash<DataSpec::UniqueID128>
}; };
} }
#endif // __DNA_COMMON_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __COMMON_DPSC_HPP__ #pragma once
#define __COMMON_DPSC_HPP__
#include "ParticleCommon.hpp" #include "ParticleCommon.hpp"
#include "PAK.hpp" #include "PAK.hpp"
@ -55,4 +54,3 @@ bool WriteDPSM(const DPSM<IDType>& dpsm, const hecl::ProjectPath& outPath);
} }
#endif // __COMMON_DPSC_HPP__

View File

@ -1,5 +1,4 @@
#ifndef _DNACOMMON_DEAFBABE_HPP_ #pragma once
#define _DNACOMMON_DEAFBABE_HPP_
#include "DNACommon.hpp" #include "DNACommon.hpp"
@ -21,4 +20,3 @@ void DeafBabeBuildFromBlender(DEAFBABE& db, const hecl::blender::ColMesh& colMes
} }
#endif // _DNACOMMON_DEAFBABE_HPP_

View File

@ -1,5 +1,4 @@
#ifndef _DNACOMMON_EGMC_HPP_ #pragma once
#define _DNACOMMON_EGMC_HPP_
#include "DNACommon.hpp" #include "DNACommon.hpp"
@ -20,4 +19,3 @@ struct EGMC : public BigDNA
Vector<Object, AT_DNA_COUNT(count)> objects; Vector<Object, AT_DNA_COUNT(count)> objects;
}; };
} }
#endif // _DNACOMMON_EGMC_HPP_

View File

@ -1,5 +1,4 @@
#ifndef __COMMON_ELSC_HPP__ #pragma once
#define __COMMON_ELSC_HPP__
#include "ParticleCommon.hpp" #include "ParticleCommon.hpp"
#include "PAK.hpp" #include "PAK.hpp"
@ -43,4 +42,3 @@ template <class IDType>
bool WriteELSM(const ELSM<IDType>& elsm, const hecl::ProjectPath& outPath); bool WriteELSM(const ELSM<IDType>& elsm, const hecl::ProjectPath& outPath);
} }
#endif // __COMMON_ELSC_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __COMMON_FONT_HPP__ #pragma once
#define __COMMON_FONT_HPP__
#include "PAK.hpp" #include "PAK.hpp"
#include "athena/FileWriter.hpp" #include "athena/FileWriter.hpp"
@ -125,4 +124,3 @@ bool WriteFONT(const FONT<IDType>& font, const hecl::ProjectPath& outPath);
} }
#endif // __COMMON_FONT_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __COMMON_FSM2_HPP__ #pragma once
#define __COMMON_FSM2_HPP__
#include "PAK.hpp" #include "PAK.hpp"
#include "DNACommon.hpp" #include "DNACommon.hpp"
@ -153,4 +152,3 @@ template <class IDType>
bool WriteFSM2(const FSM2<IDType>& fsm2, const hecl::ProjectPath& outPath); bool WriteFSM2(const FSM2<IDType>& fsm2, const hecl::ProjectPath& outPath);
} }
#endif // __COMMON_FSM2_HPP__

View File

@ -1,7 +1,5 @@
#ifndef _DNACOMMON_GX_HPP_ #pragma once
#define _DNACOMMON_GX_HPP_
#include "hecl/Backend/GX.hpp" #include "hecl/Backend/GX.hpp"
using GX = hecl::Backend::GX; using GX = hecl::Backend::GX;
#endif // _DNACOMMON_GX_HPP_

View File

@ -379,7 +379,7 @@ bool Cook(const hecl::blender::MapArea& mapaIn, const hecl::ProjectPath& out)
{ {
if (mapaIn.verts.size() >= 256) if (mapaIn.verts.size() >= 256)
{ {
Log.report(logvisor::Error, _S("MAPA %s vertex range exceeded [%d/%d]"), Log.report(logvisor::Error, _SYS_STR("MAPA %s vertex range exceeded [%d/%d]"),
out.getRelativePath().data(), mapaIn.verts.size(), 255); out.getRelativePath().data(), mapaIn.verts.size(), 255);
return false; return false;
} }

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_MAPA_HPP__ #pragma once
#define __DNACOMMON_MAPA_HPP__
#include "DNACommon.hpp" #include "DNACommon.hpp"
#include "GX.hpp" #include "GX.hpp"
@ -191,4 +190,3 @@ bool Cook(const hecl::blender::MapArea& mapa, const hecl::ProjectPath& out);
} }
#endif // __DNACOMMON_MAPA_HPP__

View File

@ -125,7 +125,7 @@ bool MAPU::Cook(const hecl::blender::MapUniverse& mapuIn, const hecl::ProjectPat
mapu.worlds.emplace_back(); mapu.worlds.emplace_back();
MAPU::World& wldOut = mapu.worlds.back(); MAPU::World& wldOut = mapu.worlds.back();
wldOut.name = wld.name; wldOut.name = wld.name;
wldOut.mlvl = hecl::ProjectPath(wld.worldPath, _S("!world.*")); wldOut.mlvl = hecl::ProjectPath(wld.worldPath, _SYS_STR("!world.*"));
wldOut.transform.xf[0] = wld.xf.val[0]; wldOut.transform.xf[0] = wld.xf.val[0];
wldOut.transform.xf[1] = wld.xf.val[1]; wldOut.transform.xf[1] = wld.xf.val[1];
wldOut.transform.xf[2] = wld.xf.val[2]; wldOut.transform.xf[2] = wld.xf.val[2];

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_MAPU_HPP__ #pragma once
#define __DNACOMMON_MAPU_HPP__
#include "DNACommon.hpp" #include "DNACommon.hpp"
@ -42,4 +41,3 @@ bool ReadMAPUToBlender(hecl::blender::Connection& conn,
} }
#endif // __DNACOMMON_MAPU_HPP__

View File

@ -16,7 +16,7 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn,
bool force, bool force,
std::function<void(const hecl::SystemChar*)> fileChanged) std::function<void(const hecl::SystemChar*)> fileChanged)
{ {
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"), true); hecl::ProjectPath blendPath = outPath.getWithExtension(_SYS_STR(".blend"), true);
if (!force && blendPath.isFile()) if (!force && blendPath.isFile())
return true; return true;

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_MLVL_HPP__ #pragma once
#define __DNACOMMON_MLVL_HPP__
#include "DNACommon.hpp" #include "DNACommon.hpp"
#include "zeus/CVector3f.hpp" #include "zeus/CVector3f.hpp"
@ -18,4 +17,3 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn,
} }
#endif // __DNACOMMON_MLVL_HPP__

View File

@ -1,4 +1,4 @@
#include <athena/Types.hpp> #include "athena/Types.hpp"
#include "OBBTreeBuilder.hpp" #include "OBBTreeBuilder.hpp"
#include "zeus/CTransform.hpp" #include "zeus/CTransform.hpp"
#include "DataSpec/DNAMP1/DCLN.hpp" #include "DataSpec/DNAMP1/DCLN.hpp"
@ -48,7 +48,9 @@ static FittedOBB BuildFromCovarianceMatrix(gmm::dense_matrix<float>& C,
// extract the eigenvalues and eigenvectors from C // extract the eigenvalues and eigenvectors from C
gmm::dense_matrix<float> eigvec(3,3); gmm::dense_matrix<float> eigvec(3,3);
std::vector<float> eigval(3); std::vector<float> eigval(3);
gmm::symmetric_qr_algorithm(C, eigval, eigvec); using namespace gmm;
using MAT1 = gmm::dense_matrix<float>;
gmm::symmetric_qr_algorithm(C, eigval, eigvec, default_tol_for_qr);
// find the right, up and forward vectors from the eigenvectors // find the right, up and forward vectors from the eigenvectors
zeus::CVector3f r(eigvec(0,0), eigvec(1,0), eigvec(2,0)); zeus::CVector3f r(eigvec(0,0), eigvec(1,0), eigvec(2,0));

View File

@ -1,5 +1,4 @@
#ifndef DNACOMMON_OBBTREEBUILDER_HPP #pragma once
#define DNACOMMON_OBBTREEBUILDER_HPP
#include "DNACommon.hpp" #include "DNACommon.hpp"
@ -15,4 +14,3 @@ struct OBBTreeBuilder
} }
#endif // DNACOMMON_OBBTREEBUILDER_HPP

View File

@ -143,7 +143,7 @@ void PAKRouter<BRIDGETYPE>::build(std::vector<BRIDGETYPE>& bridges, std::functio
m_uniqueEntries.clear(); m_uniqueEntries.clear();
m_sharedEntries.clear(); m_sharedEntries.clear();
m_cmdlRigs.clear(); m_charAssoc.m_cmdlRigs.clear();
size_t count = 0; size_t count = 0;
float bridgesSz = bridges.size(); float bridgesSz = bridges.size();
@ -186,7 +186,7 @@ void PAKRouter<BRIDGETYPE>::build(std::vector<BRIDGETYPE>& bridges, std::functio
} }
/* Add RigPairs to global map */ /* Add RigPairs to global map */
bridge.addCMDLRigPairs(*this, m_cmdlRigs, m_cskrCinfToCharacter); bridge.addCMDLRigPairs(*this, m_charAssoc);
progress(++count / bridgesSz); progress(++count / bridgesSz);
++bridgeIdx; ++bridgeIdx;
@ -257,14 +257,14 @@ void PAKRouter<BRIDGETYPE>::enterPAKBridge(const BRIDGETYPE& pakBridge)
template <class BRIDGETYPE> template <class BRIDGETYPE>
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCharacterWorking(const EntryType* entry) const hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCharacterWorking(const EntryType* entry) const
{ {
auto characterSearch = m_cskrCinfToCharacter.find(entry->id); auto characterSearch = m_charAssoc.m_cskrCinfToCharacter.find(entry->id);
if (characterSearch != m_cskrCinfToCharacter.cend()) if (characterSearch != m_charAssoc.m_cskrCinfToCharacter.cend())
{ {
hecl::ProjectPath characterPath = getWorking(characterSearch->second.first); hecl::ProjectPath characterPath = getWorking(characterSearch->second.first);
if (entry->type == FOURCC('EVNT')) if (entry->type == FOURCC('EVNT'))
{ {
hecl::SystemStringConv wideStr(characterSearch->second.second); hecl::SystemStringConv wideStr(characterSearch->second.second);
return characterPath.getWithExtension((hecl::SystemString(_S(".")) + wideStr.c_str()).c_str(), true); return characterPath.getWithExtension((hecl::SystemString(_SYS_STR(".")) + wideStr.c_str()).c_str(), true);
} }
return characterPath.ensureAuxInfo(characterSearch->second.second); return characterPath.ensureAuxInfo(characterSearch->second.second);
} }
@ -299,12 +299,9 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
if (extractor.fileExts[0] && !extractor.fileExts[1]) if (extractor.fileExts[0] && !extractor.fileExts[1])
entName += extractor.fileExts[0]; entName += extractor.fileExts[0];
else if (extractor.fileExts[0]) else if (extractor.fileExts[0])
entName += _S(".*"); entName += _SYS_STR(".*");
else if (hecl::ProjectPath chWork = getCharacterWorking(entry)) else if (hecl::ProjectPath chWork = getCharacterWorking(entry))
{ return chWork;
entName = chWork.getLastComponent();
auxInfo = chWork.getAuxInfo();
}
return hecl::ProjectPath(pakPath, entName).ensureAuxInfo(auxInfo); return hecl::ProjectPath(pakPath, entName).ensureAuxInfo(auxInfo);
} }
} }
@ -323,12 +320,9 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
if (extractor.fileExts[0] && !extractor.fileExts[1]) if (extractor.fileExts[0] && !extractor.fileExts[1])
entName += extractor.fileExts[0]; entName += extractor.fileExts[0];
else if (extractor.fileExts[0]) else if (extractor.fileExts[0])
entName += _S(".*"); entName += _SYS_STR(".*");
else if (hecl::ProjectPath chWork = getCharacterWorking(entry)) else if (hecl::ProjectPath chWork = getCharacterWorking(entry))
{ return chWork;
entName = chWork.getLastComponent();
auxInfo = chWork.getAuxInfo();
}
if (bridge.getPAK().m_noShare) if (bridge.getPAK().m_noShare)
{ {
return hecl::ProjectPath(pakPath, entName).ensureAuxInfo(auxInfo); return hecl::ProjectPath(pakPath, entName).ensureAuxInfo(auxInfo);
@ -353,12 +347,9 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
if (extractor.fileExts[0] && !extractor.fileExts[1]) if (extractor.fileExts[0] && !extractor.fileExts[1])
entName += extractor.fileExts[0]; entName += extractor.fileExts[0];
else if (extractor.fileExts[0]) else if (extractor.fileExts[0])
entName += _S(".*"); entName += _SYS_STR(".*");
else if (hecl::ProjectPath chWork = getCharacterWorking(entry)) else if (hecl::ProjectPath chWork = getCharacterWorking(entry))
{ return chWork;
entName = chWork.getLastComponent();
auxInfo = chWork.getAuxInfo();
}
hecl::ProjectPath sharedPath(m_sharedWorking, entName); hecl::ProjectPath sharedPath(m_sharedWorking, entName);
return sharedPath.ensureAuxInfo(auxInfo); return sharedPath.ensureAuxInfo(auxInfo);
} }
@ -451,7 +442,7 @@ hecl::SystemString PAKRouter<BRIDGETYPE>::getResourceRelativePath(const EntryTyp
hecl::ProjectPath aPath = getWorking(&a, BRIDGETYPE::LookupExtractor(*node, *pak, a)); hecl::ProjectPath aPath = getWorking(&a, BRIDGETYPE::LookupExtractor(*node, *pak, a));
hecl::SystemString ret; hecl::SystemString ret;
for (int i=0 ; i<aPath.levelCount() ; ++i) for (int i=0 ; i<aPath.levelCount() ; ++i)
ret += _S("../"); ret += _SYS_STR("../");
hecl::ProjectPath bPath = getWorking(be, BRIDGETYPE::LookupExtractor(*node, *pak, *be)); hecl::ProjectPath bPath = getWorking(be, BRIDGETYPE::LookupExtractor(*node, *pak, *be));
ret += bPath.getRelativePath(); ret += bPath.getRelativePath();
return ret; return ret;
@ -552,7 +543,7 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
{ {
cooked.makeDirChain(false); cooked.makeDirChain(false);
PAKEntryReadStream s = entryPtr->beginReadStream(*node); PAKEntryReadStream s = entryPtr->beginReadStream(*node);
FILE* fout = hecl::Fopen(cooked.getAbsolutePath().data(), _S("wb")); FILE* fout = hecl::Fopen(cooked.getAbsolutePath().data(), _SYS_STR("wb"));
fwrite(s.data(), 1, s.length(), fout); fwrite(s.data(), 1, s.length(), fout);
fclose(fout); fclose(fout);
} }
@ -642,14 +633,22 @@ const typename BRIDGETYPE::PAKType::Entry* PAKRouter<BRIDGETYPE>::lookupEntry(co
} }
template <class BRIDGETYPE> template <class BRIDGETYPE>
const typename PAKRouter<BRIDGETYPE>::RigPair* PAKRouter<BRIDGETYPE>::lookupCMDLRigPair(const IDType& id) const const typename CharacterAssociations<typename PAKRouter<BRIDGETYPE>::IDType>::RigPair*
PAKRouter<BRIDGETYPE>::lookupCMDLRigPair(const IDType& id) const
{ {
auto search = m_cmdlRigs.find(id); auto search = m_charAssoc.m_cmdlRigs.find(id);
if (search == m_cmdlRigs.end()) if (search == m_charAssoc.m_cmdlRigs.end())
return nullptr; return nullptr;
return &search->second; return &search->second;
} }
template <class BRIDGETYPE>
const typename CharacterAssociations<typename PAKRouter<BRIDGETYPE>::IDType>::MultimapIteratorPair
PAKRouter<BRIDGETYPE>::lookupCharacterAttachmentRigs(const IDType& id) const
{
return m_charAssoc.m_characterToAttachmentRigs.equal_range(id);
}
template <class BRIDGETYPE> template <class BRIDGETYPE>
const zeus::CMatrix4f* PAKRouter<BRIDGETYPE>::lookupMAPATransform(const IDType& id) const const zeus::CMatrix4f* PAKRouter<BRIDGETYPE>::lookupMAPATransform(const IDType& id) const
{ {

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_PAK_HPP__ #pragma once
#define __DNACOMMON_PAK_HPP__
#include "DNACommon.hpp" #include "DNACommon.hpp"
#include "boo/ThreadLocalPtr.hpp" #include "boo/ThreadLocalPtr.hpp"
@ -155,7 +154,6 @@ public:
using PAKType = typename BRIDGETYPE::PAKType; using PAKType = typename BRIDGETYPE::PAKType;
using IDType = typename PAKType::IDType; using IDType = typename PAKType::IDType;
using EntryType = typename PAKType::Entry; using EntryType = typename PAKType::Entry;
using RigPair = std::pair<IDType, IDType>;
private: private:
const std::vector<BRIDGETYPE>* m_bridges = nullptr; const std::vector<BRIDGETYPE>* m_bridges = nullptr;
@ -170,8 +168,7 @@ private:
std::unordered_map<IDType, std::pair<size_t, const EntryType*>> m_uniqueEntries; std::unordered_map<IDType, std::pair<size_t, const EntryType*>> m_uniqueEntries;
std::unordered_map<IDType, std::pair<size_t, const EntryType*>> m_sharedEntries; std::unordered_map<IDType, std::pair<size_t, const EntryType*>> m_sharedEntries;
std::unordered_map<IDType, hecl::ProjectPath> m_overrideEntries; std::unordered_map<IDType, hecl::ProjectPath> m_overrideEntries;
std::unordered_map<IDType, RigPair> m_cmdlRigs; CharacterAssociations<IDType> m_charAssoc;
std::unordered_map<IDType, std::pair<IDType, std::string>> m_cskrCinfToCharacter;
std::unordered_map<IDType, zeus::CMatrix4f> m_mapaTransforms; std::unordered_map<IDType, zeus::CMatrix4f> m_mapaTransforms;
hecl::ProjectPath getCharacterWorking(const EntryType* entry) const; hecl::ProjectPath getCharacterWorking(const EntryType* entry) const;
@ -224,7 +221,8 @@ public:
return true; return true;
} }
const RigPair* lookupCMDLRigPair(const IDType& id) const; const typename CharacterAssociations<IDType>::RigPair* lookupCMDLRigPair(const IDType& id) const;
const typename CharacterAssociations<IDType>::MultimapIteratorPair lookupCharacterAttachmentRigs(const IDType& id) const;
const zeus::CMatrix4f* lookupMAPATransform(const IDType& mapaId) const; const zeus::CMatrix4f* lookupMAPATransform(const IDType& mapaId) const;
hecl::ProjectPath getAreaLayerWorking(const IDType& areaId, int layerIdx) const; hecl::ProjectPath getAreaLayerWorking(const IDType& areaId, int layerIdx) const;
@ -239,4 +237,3 @@ public:
} }
#endif // __DNACOMMON_PAK_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __COMMON_PART_HPP__ #pragma once
#define __COMMON_PART_HPP__
#include "ParticleCommon.hpp" #include "ParticleCommon.hpp"
#include "PAK.hpp" #include "PAK.hpp"
@ -115,4 +114,3 @@ bool WriteGPSM(const GPSM<IDType>& gpsm, const hecl::ProjectPath& outPath);
} }
#endif // __COMMON_PART_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __COMMON_PARTICLECOMMON_HPP__ #pragma once
#define __COMMON_PARTICLECOMMON_HPP__
#include "DNACommon.hpp" #include "DNACommon.hpp"
@ -902,4 +901,3 @@ struct ChildResourceFactory : BigDNA
} }
#endif // __COMMON_PARTICLECOMMON_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __COMMON_RIGINVERTER_HPP__ #pragma once
#define __COMMON_RIGINVERTER_HPP__
#include "zeus/CVector3f.hpp" #include "zeus/CVector3f.hpp"
#include "zeus/CMatrix3f.hpp" #include "zeus/CMatrix3f.hpp"
@ -43,4 +42,3 @@ public:
} }
#endif // __COMMON_RIGINVERTER_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __COMMON_SAVWCOMMON_HPP__ #pragma once
#define __COMMON_SAVWCOMMON_HPP__
#include "DNACommon.hpp" #include "DNACommon.hpp"
#include "PAK.hpp" #include "PAK.hpp"
@ -51,4 +50,3 @@ static bool ExtractSAVW(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath
} }
#endif // __COMMON_SAVWCOMMON_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __COMMON_STRG_HPP__ #pragma once
#define __COMMON_STRG_HPP__
#include <string> #include <string>
#include <fstream> #include <fstream>
@ -26,4 +25,3 @@ std::unique_ptr<ISTRG> LoadSTRG(athena::io::IStreamReader& reader);
} }
#endif // __COMMON_STRG_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __COMMON_SWHC_HPP__ #pragma once
#define __COMMON_SWHC_HPP__
#include "ParticleCommon.hpp" #include "ParticleCommon.hpp"
#include "PAK.hpp" #include "PAK.hpp"
@ -56,4 +55,3 @@ bool ExtractSWSH(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType> template <class IDType>
bool WriteSWSH(const SWSH<IDType>& gpsm, const hecl::ProjectPath& outPath); bool WriteSWSH(const SWSH<IDType>& gpsm, const hecl::ProjectPath& outPath);
} }
#endif // __COMMON_SWHC_HPP__

View File

@ -1013,11 +1013,11 @@ bool TXTR::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
uint16_t height = rs.readUint16Big(); uint16_t height = rs.readUint16Big();
uint32_t numMips = rs.readUint32Big(); uint32_t numMips = rs.readUint32Big();
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().data(), _S("wb")); FILE* fp = hecl::Fopen(outPath.getAbsolutePath().data(), _SYS_STR("wb"));
if (!fp) if (!fp)
{ {
Log.report(logvisor::Error, Log.report(logvisor::Error,
_S("Unable to open '%s' for writing"), _SYS_STR("Unable to open '%s' for writing"),
outPath.getAbsolutePath().data()); outPath.getAbsolutePath().data());
return false; return false;
} }
@ -1271,11 +1271,11 @@ static int GetNumPaletteEntriesForGCN(png_structp png, png_infop info)
bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{ {
FILE* inf = hecl::Fopen(inPath.getAbsolutePath().data(), _S("rb")); FILE* inf = hecl::Fopen(inPath.getAbsolutePath().data(), _SYS_STR("rb"));
if (!inf) if (!inf)
{ {
Log.report(logvisor::Error, Log.report(logvisor::Error,
_S("Unable to open '%s' for reading"), _SYS_STR("Unable to open '%s' for reading"),
inPath.getAbsolutePath().data()); inPath.getAbsolutePath().data());
return false; return false;
} }
@ -1285,7 +1285,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
fread(header, 1, 8, inf); fread(header, 1, 8, inf);
if (png_sig_cmp((png_const_bytep)header, 0, 8)) if (png_sig_cmp((png_const_bytep)header, 0, 8))
{ {
Log.report(logvisor::Error, _S("invalid PNG signature in '%s'"), Log.report(logvisor::Error, _SYS_STR("invalid PNG signature in '%s'"),
inPath.getAbsolutePath().data()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
return false; return false;
@ -1310,7 +1310,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
if (setjmp(png_jmpbuf(pngRead))) if (setjmp(png_jmpbuf(pngRead)))
{ {
Log.report(logvisor::Error, _S("unable to initialize libpng I/O for '%s'"), Log.report(logvisor::Error, _SYS_STR("unable to initialize libpng I/O for '%s'"),
inPath.getAbsolutePath().data()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr); png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1356,7 +1356,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
if (bitDepth != 8) if (bitDepth != 8)
{ {
Log.report(logvisor::Error, _S("'%s' is not 8 bits-per-channel"), Log.report(logvisor::Error, _SYS_STR("'%s' is not 8 bits-per-channel"),
inPath.getAbsolutePath().data()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr); png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1390,7 +1390,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
nComps = 1; nComps = 1;
break; break;
default: default:
Log.report(logvisor::Error, _S("unsupported color type in '%s'"), Log.report(logvisor::Error, _SYS_STR("unsupported color type in '%s'"),
inPath.getAbsolutePath().data()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr); png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1413,7 +1413,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
if (setjmp(png_jmpbuf(pngRead))) if (setjmp(png_jmpbuf(pngRead)))
{ {
Log.report(logvisor::Error, _S("unable to read image in '%s'"), Log.report(logvisor::Error, _SYS_STR("unable to read image in '%s'"),
inPath.getAbsolutePath().data()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr); png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1629,7 +1629,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
if (outf.hasError()) if (outf.hasError())
{ {
Log.report(logvisor::Error, Log.report(logvisor::Error,
_S("Unable to open '%s' for writing"), _SYS_STR("Unable to open '%s' for writing"),
outPath.getAbsolutePath().data()); outPath.getAbsolutePath().data());
return false; return false;
} }
@ -1645,11 +1645,11 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{ {
FILE* inf = hecl::Fopen(inPath.getAbsolutePath().data(), _S("rb")); FILE* inf = hecl::Fopen(inPath.getAbsolutePath().data(), _SYS_STR("rb"));
if (!inf) if (!inf)
{ {
Log.report(logvisor::Error, Log.report(logvisor::Error,
_S("Unable to open '%s' for reading"), _SYS_STR("Unable to open '%s' for reading"),
inPath.getAbsolutePath().data()); inPath.getAbsolutePath().data());
return false; return false;
} }
@ -1659,7 +1659,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
fread(header, 1, 8, inf); fread(header, 1, 8, inf);
if (png_sig_cmp((png_const_bytep)header, 0, 8)) if (png_sig_cmp((png_const_bytep)header, 0, 8))
{ {
Log.report(logvisor::Error, _S("invalid PNG signature in '%s'"), Log.report(logvisor::Error, _SYS_STR("invalid PNG signature in '%s'"),
inPath.getAbsolutePath().data()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
return false; return false;
@ -1684,7 +1684,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
if (setjmp(png_jmpbuf(pngRead))) if (setjmp(png_jmpbuf(pngRead)))
{ {
Log.report(logvisor::Error, _S("unable to initialize libpng I/O for '%s'"), Log.report(logvisor::Error, _SYS_STR("unable to initialize libpng I/O for '%s'"),
inPath.getAbsolutePath().data()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr); png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1722,7 +1722,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
if (bitDepth != 8) if (bitDepth != 8)
{ {
Log.report(logvisor::Error, _S("'%s' is not 8 bits-per-channel"), Log.report(logvisor::Error, _SYS_STR("'%s' is not 8 bits-per-channel"),
inPath.getAbsolutePath().data()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr); png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1754,7 +1754,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
paletteBuf = ReadPalette(pngRead, info, paletteSize); paletteBuf = ReadPalette(pngRead, info, paletteSize);
break; break;
default: default:
Log.report(logvisor::Error, _S("unsupported color type in '%s'"), Log.report(logvisor::Error, _SYS_STR("unsupported color type in '%s'"),
inPath.getAbsolutePath().data()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr); png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1775,7 +1775,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
if (setjmp(png_jmpbuf(pngRead))) if (setjmp(png_jmpbuf(pngRead)))
{ {
Log.report(logvisor::Error, _S("unable to read image in '%s'"), Log.report(logvisor::Error, _SYS_STR("unable to read image in '%s'"),
inPath.getAbsolutePath().data()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr); png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1908,7 +1908,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
if (outf.hasError()) if (outf.hasError())
{ {
Log.report(logvisor::Error, Log.report(logvisor::Error,
_S("Unable to open '%s' for writing"), _SYS_STR("Unable to open '%s' for writing"),
outPath.getAbsolutePath().data()); outPath.getAbsolutePath().data());
return false; return false;
} }

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_TXTR_HPP__ #pragma once
#define __DNACOMMON_TXTR_HPP__
#include "DNACommon.hpp" #include "DNACommon.hpp"
@ -16,4 +15,3 @@ struct TXTR
} }
#endif // __DNACOMMON_TXTR_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_ITWEAK_HPP__ #pragma once
#define __DNACOMMON_ITWEAK_HPP__
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
@ -16,4 +15,3 @@ struct ITweak : BigDNA
}; };
} }
#endif // __DNACOMMON_ITWEAK_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_ITWEAKAUTOMAPPER_HPP__ #pragma once
#define __DNACOMMON_ITWEAKAUTOMAPPER_HPP__
#include "ITweak.hpp" #include "ITweak.hpp"
@ -66,4 +65,3 @@ struct ITweakAutoMapper : public ITweak
} }
#endif // __DNACOMMON_ITWEAKAUTOMAPPER_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_ITWEAKBALL_HPP__ #pragma once
#define __DNACOMMON_ITWEAKBALL_HPP__
#include "ITweak.hpp" #include "ITweak.hpp"
@ -71,4 +70,3 @@ struct ITweakBall : ITweak
}; };
} }
#endif // __DNACOMMON_ITWEAKBALL_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_ITWEAKGAME_HPP__ #pragma once
#define __DNACOMMON_ITWEAKGAME_HPP__
#include "ITweak.hpp" #include "ITweak.hpp"
@ -28,4 +27,3 @@ struct ITweakGame : ITweak
}; };
} }
#endif

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_ITWEAKGUI_HPP__ #pragma once
#define __DNACOMMON_ITWEAKGUI_HPP__
#include "ITweak.hpp" #include "ITweak.hpp"
#include "zeus/CVector2f.hpp" #include "zeus/CVector2f.hpp"
@ -152,4 +151,3 @@ struct ITweakGui : ITweak
} }
#endif // __DNACOMMON_ITWEAKGUI_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_ITWEAKGUICOLORS_HPP__ #pragma once
#define __DNACOMMON_ITWEAKGUICOLORS_HPP__
#include "ITweak.hpp" #include "ITweak.hpp"
@ -106,4 +105,3 @@ struct ITweakGuiColors : ITweak
}; };
} }
#endif // __DNACOMMON_ITWEAKGUICOLORS_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_ITWEAKGUNRES_HPP__ #pragma once
#define __DNACOMMON_ITWEAKGUNRES_HPP__
#include "ITweak.hpp" #include "ITweak.hpp"
#include "Runtime/IFactory.hpp" #include "Runtime/IFactory.hpp"
@ -139,4 +138,3 @@ protected:
} }
#endif

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_ITWEAKPARTICLE_HPP__ #pragma once
#define __DNACOMMON_ITWEAKPARTICLE_HPP__
#include "ITweak.hpp" #include "ITweak.hpp"
@ -12,4 +11,3 @@ struct ITweakParticle : ITweak
} }
#endif

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_ITWEAKPLAYER_HPP__ #pragma once
#define __DNACOMMON_ITWEAKPLAYER_HPP__
#include "ITweak.hpp" #include "ITweak.hpp"
#include "zeus/CAABox.hpp" #include "zeus/CAABox.hpp"
@ -146,4 +145,3 @@ struct ITweakPlayer : ITweak
} }
#endif // __DNACOMMON_ITWEAKPLAYER_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_ITWEAKPLAYERCONTROL_HPP__ #pragma once
#define __DNACOMMON_ITWEAKPLAYERCONTROL_HPP__
#include "ITweak.hpp" #include "ITweak.hpp"
@ -13,4 +12,3 @@ struct ITweakPlayerControl : ITweak
} }
#endif // __DNACOMMON_ITWEAKPLAYERCONTROL_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_ITWEAKPLAYERGUN_HPP__ #pragma once
#define __DNACOMMON_ITWEAKPLAYERGUN_HPP__
#include "ITweak.hpp" #include "ITweak.hpp"
#include "zeus/CAABox.hpp" #include "zeus/CAABox.hpp"
@ -73,4 +72,3 @@ struct ITweakPlayerGun : ITweak
}; };
} }
#endif // __DNACOMMON_ITWEAKPLAYERGUN_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_ITWEAKPLAYERRES_HPP__ #pragma once
#define __DNACOMMON_ITWEAKPLAYERRES_HPP__
#include "ITweak.hpp" #include "ITweak.hpp"
#include "Runtime/IFactory.hpp" #include "Runtime/IFactory.hpp"
@ -165,4 +164,3 @@ protected:
} }
#endif // __DNACOMMON_ITWEAKPLAYERRES_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_ITWEAKSLIDESHOW_HPP__ #pragma once
#define __DNACOMMON_ITWEAKSLIDESHOW_HPP__
#include "ITweak.hpp" #include "ITweak.hpp"
@ -17,4 +16,3 @@ struct ITweakSlideShow : ITweak
} }
#endif // __DNACOMMON_ITWEAKSLIDESHOW_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_ITWEAKTARGETING_HPP__ #pragma once
#define __DNACOMMON_ITWEAKTARGETING_HPP__
#include "ITweak.hpp" #include "ITweak.hpp"
namespace DataSpec namespace DataSpec
@ -97,4 +96,3 @@ struct ITweakTargeting : public ITweak
}; };
} }
#endif // __DNACOMMON_ITWEAKTARGETING_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_TWEAKWRITER_HPP__ #pragma once
#define __DNACOMMON_TWEAKWRITER_HPP__
#include "../PAK.hpp" #include "../PAK.hpp"
@ -36,4 +35,3 @@ bool ExtractTweak(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
} }
#endif // __DNACOMMON_TWEAKWRITER_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __COMMON_WPSC_HPP__ #pragma once
#define __COMMON_WPSC_HPP__
#include "ParticleCommon.hpp" #include "ParticleCommon.hpp"
#include "PAK.hpp" #include "PAK.hpp"
@ -63,4 +62,3 @@ bool WriteWPSM(const WPSM<IDType>& wpsm, const hecl::ProjectPath& outPath);
} }
#endif // __COMMON_WPSC_HPP__

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_AFSM_HPP_ #pragma once
#define _DNAMP1_AFSM_HPP_
#include <athena/FileWriter.hpp> #include <athena/FileWriter.hpp>
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
@ -58,4 +57,3 @@ struct AFSM : public BigDNA
}; };
} }
#endif // _RETRO_AFSM_HPP_

View File

@ -195,7 +195,7 @@ bool AGSC::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& dir)
/* Write out project/pool */ /* Write out project/pool */
{ {
auto projd = group.getProj().toYAML(); auto projd = group.getProj().toYAML();
athena::io::FileWriter fo(hecl::ProjectPath(dir, _S("!project.yaml")).getAbsolutePath()); athena::io::FileWriter fo(hecl::ProjectPath(dir, _SYS_STR("!project.yaml")).getAbsolutePath());
if (fo.hasError()) if (fo.hasError())
return false; return false;
fo.writeUBytes(projd.data(), projd.size()); fo.writeUBytes(projd.data(), projd.size());
@ -203,7 +203,7 @@ bool AGSC::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& dir)
{ {
auto poold = group.getPool().toYAML(); auto poold = group.getPool().toYAML();
athena::io::FileWriter fo(hecl::ProjectPath(dir, _S("!pool.yaml")).getAbsolutePath()); athena::io::FileWriter fo(hecl::ProjectPath(dir, _SYS_STR("!pool.yaml")).getAbsolutePath());
if (fo.hasError()) if (fo.hasError())
return false; return false;
fo.writeUBytes(poold.data(), poold.size()); fo.writeUBytes(poold.data(), poold.size());

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_AGSC_HPP_ #pragma once
#define _DNAMP1_AGSC_HPP_
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp" #include "DNAMP1.hpp"
@ -22,4 +21,3 @@ public:
} }
#endif // _DNAMP1_AGSC_HPP_

View File

@ -399,8 +399,8 @@ void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::Read>(athena::io::IStr
if (sectionCount > 3) if (sectionCount > 3)
{ {
cmdlOverlay.read(reader); cmdlIce.read(reader);
cskrOverlay.read(reader); cskrIce.read(reader);
} }
animIdxs.clear(); animIdxs.clear();
@ -421,7 +421,7 @@ void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::Write>(athena::io::ISt
sectionCount = 6; sectionCount = 6;
else if (animIdxs.size()) else if (animIdxs.size())
sectionCount = 5; sectionCount = 5;
else if (cmdlOverlay) else if (cmdlIce)
sectionCount = 4; sectionCount = 4;
else if (effects.size()) else if (effects.size())
sectionCount = 3; sectionCount = 3;
@ -472,8 +472,8 @@ void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::Write>(athena::io::ISt
if (sectionCount > 3) if (sectionCount > 3)
{ {
cmdlOverlay.write(writer); cmdlIce.write(writer);
cskrOverlay.write(writer); cskrIce.write(writer);
} }
if (sectionCount > 4) if (sectionCount > 4)
@ -494,7 +494,7 @@ void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::BinarySize>(size_t& __
sectionCount = 6; sectionCount = 6;
else if (animIdxs.size()) else if (animIdxs.size())
sectionCount = 5; sectionCount = 5;
else if (cmdlOverlay) else if (cmdlIce)
sectionCount = 4; sectionCount = 4;
else if (effects.size()) else if (effects.size())
sectionCount = 3; sectionCount = 3;
@ -594,7 +594,7 @@ void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::ReadYaml>(athena::io::
if (sectionCount > 3) if (sectionCount > 3)
{ {
reader.enumerate("cmdlOverride", cmdlOverlay); reader.enumerate("cmdlIce", cmdlIce);
} }
animIdxs.clear(); animIdxs.clear();
@ -614,7 +614,7 @@ void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::WriteYaml>(athena::io:
sectionCount = 6; sectionCount = 6;
else if (animIdxs.size()) else if (animIdxs.size())
sectionCount = 5; sectionCount = 5;
else if (cmdlOverlay) else if (cmdlIce)
sectionCount = 4; sectionCount = 4;
else if (effects.size()) else if (effects.size())
sectionCount = 3; sectionCount = 3;
@ -656,7 +656,7 @@ void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::WriteYaml>(athena::io:
if (sectionCount > 3) if (sectionCount > 3)
{ {
writer.enumerate("cmdlOverride", cmdlOverlay); writer.enumerate("cmdlIce", cmdlIce);
} }
if (sectionCount > 4) if (sectionCount > 4)
@ -1089,9 +1089,9 @@ bool ANCS::Extract(const SpecBase& dataSpec,
hecl::blender::Token& btok, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged) std::function<void(const hecl::SystemChar*)> fileChanged)
{ {
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"), true); hecl::ProjectPath yamlPath = outPath.getWithExtension(_SYS_STR(".yaml"), true);
hecl::ProjectPath::Type yamlType = yamlPath.getPathType(); hecl::ProjectPath::Type yamlType = yamlPath.getPathType();
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"), true); hecl::ProjectPath blendPath = outPath.getWithExtension(_SYS_STR(".blend"), true);
hecl::ProjectPath::Type blendType = blendPath.getPathType(); hecl::ProjectPath::Type blendType = blendPath.getPathType();
ANCS ancs; ANCS ancs;
@ -1123,9 +1123,9 @@ bool ANCS::Extract(const SpecBase& dataSpec,
if (res.second.evntId) if (res.second.evntId)
{ {
hecl::SystemStringConv sysStr(res.second.name); hecl::SystemStringConv sysStr(res.second.name);
hecl::ProjectPath evntYamlPath = outPath.getWithExtension((hecl::SystemString(_S(".")) + hecl::ProjectPath evntYamlPath = outPath.getWithExtension((hecl::SystemString(_SYS_STR(".")) +
sysStr.c_str() + sysStr.c_str() +
_S(".evnt.yaml")).c_str(), true); _SYS_STR(".evnt.yaml")).c_str(), true);
hecl::ProjectPath::Type evntYamlType = evntYamlPath.getPathType(); hecl::ProjectPath::Type evntYamlType = evntYamlPath.getPathType();
if (force || evntYamlType == hecl::ProjectPath::Type::None) if (force || evntYamlType == hecl::ProjectPath::Type::None)
@ -1148,26 +1148,26 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
const DNAANCS::Actor& actor) const DNAANCS::Actor& actor)
{ {
/* Search for yaml */ /* Search for yaml */
hecl::ProjectPath yamlPath = inPath.getWithExtension(_S(".yaml"), true); hecl::ProjectPath yamlPath = inPath.getWithExtension(_SYS_STR(".yaml"), true);
if (!yamlPath.isFile()) if (!yamlPath.isFile())
Log.report(logvisor::Fatal, _S("'%s' not found as file"), Log.report(logvisor::Fatal, _SYS_STR("'%s' not found as file"),
yamlPath.getRelativePath().data()); yamlPath.getRelativePath().data());
athena::io::FileReader reader(yamlPath.getAbsolutePath()); athena::io::FileReader reader(yamlPath.getAbsolutePath());
if (!reader.isOpen()) if (!reader.isOpen())
Log.report(logvisor::Fatal, _S("can't open '%s' for reading"), Log.report(logvisor::Fatal, _SYS_STR("can't open '%s' for reading"),
yamlPath.getRelativePath().data()); yamlPath.getRelativePath().data());
if (!athena::io::ValidateFromYAMLStream<ANCS>(reader)) if (!athena::io::ValidateFromYAMLStream<ANCS>(reader))
{ {
Log.report(logvisor::Fatal, _S("'%s' is not urde::DNAMP1::ANCS type"), Log.report(logvisor::Fatal, _SYS_STR("'%s' is not urde::DNAMP1::ANCS type"),
yamlPath.getRelativePath().data()); yamlPath.getRelativePath().data());
} }
athena::io::YAMLDocReader yamlReader; athena::io::YAMLDocReader yamlReader;
if (!yamlReader.parse(&reader)) if (!yamlReader.parse(&reader))
{ {
Log.report(logvisor::Fatal, _S("unable to parse '%s'"), Log.report(logvisor::Fatal, _SYS_STR("unable to parse '%s'"),
yamlPath.getRelativePath().data()); yamlPath.getRelativePath().data());
} }
ANCS ancs; ANCS ancs;
@ -1179,11 +1179,11 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
ch.cmdl = UniqueID32{}; ch.cmdl = UniqueID32{};
ch.cskr = UniqueID32{}; ch.cskr = UniqueID32{};
ch.cinf = UniqueID32{}; ch.cinf = UniqueID32{};
ch.cmdlOverlay = UniqueID32Zero{}; ch.cmdlIce = UniqueID32Zero{};
ch.cskrOverlay = UniqueID32Zero{}; ch.cskrIce = UniqueID32Zero{};
hecl::SystemStringConv chSysName(ch.name); hecl::SystemStringConv chSysName(ch.name);
ch.cskr = inPath.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _S(".CSKR")); ch.cskr = inPath.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _SYS_STR(".CSKR"));
int subtypeIdx = 0; int subtypeIdx = 0;
ch.animAABBs.clear(); ch.animAABBs.clear();
@ -1207,14 +1207,16 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
{ {
const DNAANCS::Armature& arm = actor.armatures[sub.armature]; const DNAANCS::Armature& arm = actor.armatures[sub.armature];
hecl::SystemStringConv armSysName(arm.name); hecl::SystemStringConv armSysName(arm.name);
ch.cinf = inPath.ensureAuxInfo(hecl::SystemString(armSysName.sys_str()) + _S(".CINF")); ch.cinf = inPath.ensureAuxInfo(hecl::SystemString(armSysName.sys_str()) + _SYS_STR(".CINF"));
ch.cmdl = sub.mesh; ch.cmdl = sub.mesh;
if (sub.overlayMeshes.size()) auto search = std::find_if(sub.overlayMeshes.cbegin(), sub.overlayMeshes.cend(),
[](const auto& p) { return p.first == "ICE"; });
if (search != sub.overlayMeshes.cend())
{ {
hecl::SystemStringConv overlaySys(sub.overlayMeshes[0].first); hecl::SystemStringConv overlaySys(search->first);
ch.cmdlOverlay = sub.overlayMeshes[0].second; ch.cmdlIce = search->second;
ch.cskrOverlay = inPath.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _S('.') + ch.cskrIce = inPath.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _SYS_STR('.') +
overlaySys.c_str() + _S(".CSKR")); overlaySys.c_str() + _SYS_STR(".CSKR"));
} }
} }
@ -1233,7 +1235,7 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
ancs.enumeratePrimitives([&](AnimationSet::MetaAnimPrimitive& prim) -> bool ancs.enumeratePrimitives([&](AnimationSet::MetaAnimPrimitive& prim) -> bool
{ {
hecl::SystemStringConv sysStr(prim.animName); hecl::SystemStringConv sysStr(prim.animName);
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".ANIM")); hecl::ProjectPath pathOut = inPath.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _SYS_STR(".ANIM"));
prim.animId = pathOut; prim.animId = pathOut;
return true; return true;
}); });
@ -1243,16 +1245,16 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
for (const DNAANCS::Action& act : actor.actions) for (const DNAANCS::Action& act : actor.actions)
{ {
hecl::SystemStringConv sysStr(act.name); hecl::SystemStringConv sysStr(act.name);
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".ANIM")); hecl::ProjectPath pathOut = inPath.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _SYS_STR(".ANIM"));
ancs.animationSet.animResources.emplace_back(); ancs.animationSet.animResources.emplace_back();
ancs.animationSet.animResources.back().animId = pathOut; ancs.animationSet.animResources.back().animId = pathOut;
/* Check for associated EVNT YAML */ /* Check for associated EVNT YAML */
hecl::ProjectPath evntYamlPath = inPath.getWithExtension((hecl::SystemString(_S(".")) + hecl::ProjectPath evntYamlPath = inPath.getWithExtension((hecl::SystemString(_SYS_STR(".")) +
sysStr.c_str() + sysStr.c_str() +
_S(".evnt.yaml")).c_str(), true); _SYS_STR(".evnt.yaml")).c_str(), true);
evntYamlPath = evntYamlPath.ensureAuxInfo(_S("")); evntYamlPath = evntYamlPath.ensureAuxInfo(_SYS_STR(""));
if (evntYamlPath.isFile()) if (evntYamlPath.isFile())
ancs.animationSet.animResources.back().evntId = evntYamlPath; ancs.animationSet.animResources.back().evntId = evntYamlPath;
} }
@ -1297,7 +1299,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
hecl::SystemString subName(inPath.getAuxInfo().begin(), hecl::SystemString subName(inPath.getAuxInfo().begin(),
inPath.getAuxInfo().end() - 5); inPath.getAuxInfo().end() - 5);
hecl::SystemString overName; hecl::SystemString overName;
auto dotPos = subName.rfind(_S('.')); auto dotPos = subName.rfind(_SYS_STR('.'));
if (dotPos != hecl::SystemString::npos) if (dotPos != hecl::SystemString::npos)
{ {
overName = hecl::SystemString(subName.begin() + dotPos + 1, subName.end()); overName = hecl::SystemString(subName.begin() + dotPos + 1, subName.end());
@ -1314,6 +1316,8 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
} }
const DNAANCS::Actor::Subtype* subtype = nullptr; const DNAANCS::Actor::Subtype* subtype = nullptr;
if (subName != _SYS_STR("ATTACH"))
{
for (const DNAANCS::Actor::Subtype& sub : actor.subtypes) for (const DNAANCS::Actor::Subtype& sub : actor.subtypes)
{ {
if (!sub.name.compare(subNameView.str())) if (!sub.name.compare(subNameView.str()))
@ -1323,10 +1327,26 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
} }
} }
if (!subtype) if (!subtype)
Log.report(logvisor::Fatal, _S("unable to find subtype '%s'"), subName.c_str()); Log.report(logvisor::Fatal, _SYS_STR("unable to find subtype '%s'"), subName.c_str());
}
const hecl::ProjectPath* modelPath = nullptr; const hecl::ProjectPath* modelPath = nullptr;
if (overName.empty()) if (subName == _SYS_STR("ATTACH"))
{
const DNAANCS::Actor::Attachment* attachment = nullptr;
for (const DNAANCS::Actor::Attachment& att : actor.attachments)
{
if (!att.name.compare(overNameView.str()))
{
attachment = &att;
break;
}
}
if (!attachment)
Log.report(logvisor::Fatal, _SYS_STR("unable to find attachment '%s'"), overName.c_str());
modelPath = &attachment->mesh;
}
else if (overName.empty())
{ {
modelPath = &subtype->mesh; modelPath = &subtype->mesh;
} }
@ -1340,19 +1360,19 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
} }
} }
if (!modelPath) if (!modelPath)
Log.report(logvisor::Fatal, _S("unable to resolve model path of %s:%s"), subName.c_str(), overName.c_str()); Log.report(logvisor::Fatal, _SYS_STR("unable to resolve model path of %s:%s"), subName.c_str(), overName.c_str());
if (!modelPath->isFile()) if (!modelPath->isFile())
Log.report(logvisor::Fatal, _S("unable to resolve '%s'"), modelPath->getRelativePath().data()); Log.report(logvisor::Fatal, _SYS_STR("unable to resolve '%s'"), modelPath->getRelativePath().data());
hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1).getWithExtension(_S(".skinint")); hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1).getWithExtension(_SYS_STR(".skinint"));
if (!skinIntPath.isFileOrGlob() || skinIntPath.getModtime() < modelPath->getModtime()) if (!skinIntPath.isFileOrGlob() || skinIntPath.getModtime() < modelPath->getModtime())
if (!modelCookFunc(*modelPath)) if (!modelCookFunc(*modelPath))
Log.report(logvisor::Fatal, _S("unable to cook '%s'"), modelPath->getRelativePath().data()); Log.report(logvisor::Fatal, _SYS_STR("unable to cook '%s'"), modelPath->getRelativePath().data());
athena::io::FileReader skinIO(skinIntPath.getAbsolutePath(), 1024*32, false); athena::io::FileReader skinIO(skinIntPath.getAbsolutePath(), 1024*32, false);
if (skinIO.hasError()) if (skinIO.hasError())
Log.report(logvisor::Fatal, _S("unable to open '%s'"), skinIntPath.getRelativePath().data()); Log.report(logvisor::Fatal, _SYS_STR("unable to open '%s'"), skinIntPath.getRelativePath().data());
std::vector<std::string> boneNames; std::vector<std::string> boneNames;
uint32_t boneNameCount = skinIO.readUint32Big(); uint32_t boneNameCount = skinIO.readUint32Big();
@ -1417,7 +1437,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath,
hecl::SystemString subName(inPath.getAuxInfo().begin(), hecl::SystemString subName(inPath.getAuxInfo().begin(),
inPath.getAuxInfo().end() - 5); inPath.getAuxInfo().end() - 5);
hecl::SystemString overName; hecl::SystemString overName;
auto dotPos = subName.rfind(_S('.')); auto dotPos = subName.rfind(_SYS_STR('.'));
if (dotPos != hecl::SystemString::npos) if (dotPos != hecl::SystemString::npos)
{ {
overName = hecl::SystemString(subName.begin() + dotPos + 1, subName.end()); overName = hecl::SystemString(subName.begin() + dotPos + 1, subName.end());
@ -1434,6 +1454,8 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath,
} }
const DNAANCS::Actor::Subtype* subtype = nullptr; const DNAANCS::Actor::Subtype* subtype = nullptr;
if (subName != _SYS_STR("ATTACH"))
{
for (const DNAANCS::Actor::Subtype& sub : actor.subtypes) for (const DNAANCS::Actor::Subtype& sub : actor.subtypes)
{ {
if (!sub.name.compare(subNameView.str())) if (!sub.name.compare(subNameView.str()))
@ -1443,10 +1465,26 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath,
} }
} }
if (!subtype) if (!subtype)
Log.report(logvisor::Fatal, _S("unable to find subtype '%s'"), subName.c_str()); Log.report(logvisor::Fatal, _SYS_STR("unable to find subtype '%s'"), subName.c_str());
}
const hecl::ProjectPath* modelPath = nullptr; const hecl::ProjectPath* modelPath = nullptr;
if (overName.empty()) if (subName == _SYS_STR("ATTACH"))
{
const DNAANCS::Actor::Attachment* attachment = nullptr;
for (const DNAANCS::Actor::Attachment& att : actor.attachments)
{
if (!att.name.compare(overNameView.str()))
{
attachment = &att;
break;
}
}
if (!attachment)
Log.report(logvisor::Fatal, _SYS_STR("unable to find attachment '%s'"), overName.c_str());
modelPath = &attachment->mesh;
}
else if (overName.empty())
{ {
modelPath = &subtype->mesh; modelPath = &subtype->mesh;
} }
@ -1460,19 +1498,19 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath,
} }
} }
if (!modelPath) if (!modelPath)
Log.report(logvisor::Fatal, _S("unable to resolve model path of %s:%s"), subName.c_str(), overName.c_str()); Log.report(logvisor::Fatal, _SYS_STR("unable to resolve model path of %s:%s"), subName.c_str(), overName.c_str());
if (!modelPath->isFile()) if (!modelPath->isFile())
Log.report(logvisor::Fatal, _S("unable to resolve '%s'"), modelPath->getRelativePath().data()); Log.report(logvisor::Fatal, _SYS_STR("unable to resolve '%s'"), modelPath->getRelativePath().data());
hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1PC).getWithExtension(_S(".skinint")); hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1PC).getWithExtension(_SYS_STR(".skinint"));
if (!skinIntPath.isFileOrGlob() || skinIntPath.getModtime() < modelPath->getModtime()) if (!skinIntPath.isFileOrGlob() || skinIntPath.getModtime() < modelPath->getModtime())
if (!modelCookFunc(*modelPath)) if (!modelCookFunc(*modelPath))
Log.report(logvisor::Fatal, _S("unable to cook '%s'"), modelPath->getRelativePath().data()); Log.report(logvisor::Fatal, _SYS_STR("unable to cook '%s'"), modelPath->getRelativePath().data());
athena::io::FileReader skinIO(skinIntPath.getAbsolutePath(), 1024*32, false); athena::io::FileReader skinIO(skinIntPath.getAbsolutePath(), 1024*32, false);
if (skinIO.hasError()) if (skinIO.hasError())
Log.report(logvisor::Fatal, _S("unable to open '%s'"), skinIntPath.getRelativePath().data()); Log.report(logvisor::Fatal, _SYS_STR("unable to open '%s'"), skinIntPath.getRelativePath().data());
std::vector<std::vector<uint32_t>> skinBanks; std::vector<std::vector<uint32_t>> skinBanks;
uint32_t bankCount = skinIO.readUint32Big(); uint32_t bankCount = skinIO.readUint32Big();
@ -1567,7 +1605,7 @@ bool ANCS::CookANIM(const hecl::ProjectPath& outPath,
DNAANCS::Action action = ds.compileActionChannelsOnly(actNameView.str()); DNAANCS::Action action = ds.compileActionChannelsOnly(actNameView.str());
if (!actor.armatures.size()) if (!actor.armatures.size())
Log.report(logvisor::Fatal, _S("0 armatures in %s"), Log.report(logvisor::Fatal, _SYS_STR("0 armatures in %s"),
inPath.getRelativePath().data()); inPath.getRelativePath().data());
/* Build bone ID map */ /* Build bone ID map */
@ -1591,9 +1629,9 @@ bool ANCS::CookANIM(const hecl::ProjectPath& outPath,
ANIM anim(action, boneIdMap, *rigInv, pc); ANIM anim(action, boneIdMap, *rigInv, pc);
/* Check for associated EVNT YAML */ /* Check for associated EVNT YAML */
hecl::ProjectPath evntYamlPath = inPath.getWithExtension((hecl::SystemString(_S(".")) + actName + hecl::ProjectPath evntYamlPath = inPath.getWithExtension((hecl::SystemString(_SYS_STR(".")) + actName +
_S(".evnt.yaml")).c_str(), true); _SYS_STR(".evnt.yaml")).c_str(), true);
evntYamlPath = evntYamlPath.ensureAuxInfo(_S("")); evntYamlPath = evntYamlPath.ensureAuxInfo(_SYS_STR(""));
if (evntYamlPath.isFile()) if (evntYamlPath.isFile())
anim.m_anim->evnt = evntYamlPath; anim.m_anim->evnt = evntYamlPath;

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_ANCS_HPP_ #pragma once
#define _DNAMP1_ANCS_HPP_
#include <map> #include <map>
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
@ -140,8 +139,8 @@ struct ANCS : BigDNA
}; };
std::vector<Effect> effects; std::vector<Effect> effects;
UniqueID32Zero cmdlOverlay; UniqueID32Zero cmdlIce;
UniqueID32Zero cskrOverlay; UniqueID32Zero cskrIce;
std::vector<atUint32> animIdxs; std::vector<atUint32> animIdxs;
}; };
@ -432,8 +431,8 @@ struct ANCS : BigDNA
chOut.cskr = ci.cskr; chOut.cskr = ci.cskr;
chOut.cinf = ci.cinf; chOut.cinf = ci.cinf;
if (ci.cmdlOverlay) if (ci.cmdlIce)
chOut.overlays.emplace_back(FOURCC('OVER'), std::make_pair(ci.cmdlOverlay, ci.cskrOverlay)); chOut.overlays.emplace_back("ICE", std::make_pair(ci.cmdlIce, ci.cskrIce));
} }
} }
@ -518,4 +517,3 @@ struct ANCS : BigDNA
} }
#endif // _DNAMP1_ANCS_HPP_

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_ANIM_HPP_ #pragma once
#define _DNAMP1_ANIM_HPP_
#include "DNAMP1.hpp" #include "DNAMP1.hpp"
#include "DataSpec/DNACommon/ANIM.hpp" #include "DataSpec/DNACommon/ANIM.hpp"
@ -220,4 +219,3 @@ struct ANIM : BigDNA
} }
#endif // _DNAMP1_ANIM_HPP_

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_CINF_HPP_ #pragma once
#define _DNAMP1_CINF_HPP_
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/RigInverter.hpp" #include "DataSpec/DNACommon/RigInverter.hpp"
@ -53,4 +52,3 @@ struct CINF : BigDNA
} }
#endif // _DNAMP1_CINF_HPP_

View File

@ -14,7 +14,7 @@ bool CMDL::Extract(const SpecBase& dataSpec,
std::function<void(const hecl::SystemChar*)> fileChanged) std::function<void(const hecl::SystemChar*)> fileChanged)
{ {
/* Check for RigPair */ /* Check for RigPair */
const PAKRouter<PAKBridge>::RigPair* rp = pakRouter.lookupCMDLRigPair(entry.id); const typename CharacterAssociations<UniqueID32>::RigPair* rp = pakRouter.lookupCMDLRigPair(entry.id);
CINF cinf; CINF cinf;
CSKR cskr; CSKR cskr;
std::pair<CSKR*,CINF*> loadRp(nullptr, nullptr); std::pair<CSKR*,CINF*> loadRp(nullptr, nullptr);
@ -36,14 +36,14 @@ bool CMDL::Extract(const SpecBase& dataSpec,
#if 0 #if 0
/* Cook and re-extract test */ /* Cook and re-extract test */
hecl::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true); hecl::ProjectPath tempOut = outPath.getWithExtension(_SYS_STR(".recook"), true);
hecl::blender::Connection::DataStream ds = conn.beginData(); hecl::blender::Connection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(hecl::TopologyTriStrips, -1); DNACMDL::Mesh mesh = ds.compileMesh(hecl::TopologyTriStrips, -1);
ds.close(); ds.close();
DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, outPath, mesh); DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, outPath, mesh);
athena::io::FileReader reader(tempOut.getAbsolutePath()); athena::io::FileReader reader(tempOut.getAbsolutePath());
hecl::ProjectPath tempBlend = outPath.getWithExtension(_S(".recook.blend"), true); hecl::ProjectPath tempBlend = outPath.getWithExtension(_SYS_STR(".recook.blend"), true);
if (!conn.createBlend(tempBlend, hecl::blender::Connection::TypeMesh)) if (!conn.createBlend(tempBlend, hecl::blender::Connection::TypeMesh))
return false; return false;
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1_2, 2> DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1_2, 2>
@ -51,7 +51,7 @@ bool CMDL::Extract(const SpecBase& dataSpec,
return conn.saveBlend(); return conn.saveBlend();
#elif 0 #elif 0
/* HMDL cook test */ /* HMDL cook test */
hecl::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true); hecl::ProjectPath tempOut = outPath.getWithExtension(_SYS_STR(".recook"), true);
hecl::blender::Connection::DataStream ds = conn.beginData(); hecl::blender::Connection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(hecl::HMDLTopology::TriStrips, 16); DNACMDL::Mesh mesh = ds.compileMesh(hecl::HMDLTopology::TriStrips, 16);
ds.close(); ds.close();
@ -73,7 +73,7 @@ bool CMDL::Cook(const hecl::ProjectPath& outPath,
/* Output skinning intermediate */ /* Output skinning intermediate */
auto vertCountIt = skinMesh.contiguousSkinVertCounts.cbegin(); auto vertCountIt = skinMesh.contiguousSkinVertCounts.cbegin();
athena::io::FileWriter writer(outPath.getWithExtension(_S(".skinint")).getAbsolutePath()); athena::io::FileWriter writer(outPath.getWithExtension(_SYS_STR(".skinint")).getAbsolutePath());
writer.writeUint32Big(skinMesh.boneNames.size()); writer.writeUint32Big(skinMesh.boneNames.size());
for (const std::string& boneName : skinMesh.boneNames) for (const std::string& boneName : skinMesh.boneNames)
writer.writeString(boneName); writer.writeString(boneName);
@ -109,7 +109,7 @@ bool CMDL::HMDLCook(const hecl::ProjectPath& outPath,
return false; return false;
/* Output skinning intermediate */ /* Output skinning intermediate */
athena::io::FileWriter writer(outPath.getWithExtension(_S(".skinint")).getAbsolutePath()); athena::io::FileWriter writer(outPath.getWithExtension(_SYS_STR(".skinint")).getAbsolutePath());
writer.writeUint32Big(mesh.skinBanks.banks.size()); writer.writeUint32Big(mesh.skinBanks.banks.size());
for (const DNACMDL::Mesh::SkinBanks::Bank& sb : mesh.skinBanks.banks) for (const DNACMDL::Mesh::SkinBanks::Bank& sb : mesh.skinBanks.banks)
{ {

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_CMDL_HPP_ #pragma once
#define _DNAMP1_CMDL_HPP_
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/CMDL.hpp" #include "DataSpec/DNACommon/CMDL.hpp"
@ -43,4 +42,3 @@ struct CMDL
} }
#endif // _DNAMP1_CMDL_HPP_

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_CMDL_MATERIALS_HPP_ #pragma once
#define _DNAMP1_CMDL_MATERIALS_HPP_
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/GX.hpp" #include "DataSpec/DNACommon/GX.hpp"
@ -391,4 +390,3 @@ struct HMDLMaterialSet : BigDNA
} }
#endif // _DNAMP1_CMDL_MATERIALS_HPP_

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_CSKR_HPP_ #pragma once
#define _DNAMP1_CSKR_HPP_
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
#include "CINF.hpp" #include "CINF.hpp"
@ -36,4 +35,3 @@ struct CSKR : BigDNA
} }
#endif // _DNAMP1_CSKR_HPP_

View File

@ -6,8 +6,8 @@ namespace DataSpec::DNAMP1
bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{ {
hecl::ProjectPath midPath = outPath.getWithExtension(_S(".mid"), true); hecl::ProjectPath midPath = outPath.getWithExtension(_SYS_STR(".mid"), true);
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"), true); hecl::ProjectPath yamlPath = outPath.getWithExtension(_SYS_STR(".yaml"), true);
Header head; Header head;
head.read(rs); head.read(rs);
@ -38,9 +38,9 @@ bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
} }
/* Update !songs.yaml for Amuse editor */ /* Update !songs.yaml for Amuse editor */
hecl::ProjectPath audGrp(outPath.getParentPath().getParentPath(), _S("AudioGrp")); hecl::ProjectPath audGrp(outPath.getParentPath().getParentPath(), _SYS_STR("AudioGrp"));
audGrp.makeDirChain(true); audGrp.makeDirChain(true);
hecl::ProjectPath songsPath(audGrp, _S("!songs.yaml")); hecl::ProjectPath songsPath(audGrp, _SYS_STR("!songs.yaml"));
std::experimental::optional<athena::io::FileReader> r; std::experimental::optional<athena::io::FileReader> r;
if (songsPath.isFile()) if (songsPath.isFile())
r.emplace(songsPath.getAbsolutePath()); r.emplace(songsPath.getAbsolutePath());
@ -57,8 +57,8 @@ bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
bool CSNG::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) bool CSNG::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{ {
hecl::ProjectPath midPath = inPath.getWithExtension(_S(".mid"), true); hecl::ProjectPath midPath = inPath.getWithExtension(_SYS_STR(".mid"), true);
hecl::ProjectPath yamlPath = inPath.getWithExtension(_S(".yaml"), true); hecl::ProjectPath yamlPath = inPath.getWithExtension(_SYS_STR(".yaml"), true);
std::vector<uint8_t> sngData; std::vector<uint8_t> sngData;
{ {

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_CSNG_HPP_ #pragma once
#define _DNAMP1_CSNG_HPP_
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp" #include "DNAMP1.hpp"
@ -25,4 +24,3 @@ public:
} }
#endif // _DNAMP1_CSNG_HPP_

View File

@ -1,7 +1,6 @@
#ifndef __DNAMP1_DCLN_HPP__ #pragma once
#define __DNAMP1_DCLN_HPP__
#include <athena/Types.hpp> #include "athena/Types.hpp"
#include "DataSpec/DNACommon/DeafBabe.hpp" #include "DataSpec/DNACommon/DeafBabe.hpp"
#include "DataSpec/DNACommon/PAK.hpp" #include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/OBBTreeBuilder.hpp" #include "DataSpec/DNACommon/OBBTreeBuilder.hpp"
@ -110,4 +109,3 @@ struct DCLN : BigDNA
}; };
} }
#endif // __DNAMP1_DCLN_HPP__

View File

@ -83,7 +83,7 @@ PAKBridge::PAKBridge(const nod::Node& node, bool doExtract)
STRG mlvlName; STRG mlvlName;
mlvlName.read(rs); mlvlName.read(rs);
if (m_levelString.size()) if (m_levelString.size())
m_levelString += _S(", "); m_levelString += _SYS_STR(", ");
m_levelString += mlvlName.getSystemString(FOURCC('ENGL'), 0); m_levelString += mlvlName.getSystemString(FOURCC('ENGL'), 0);
} }
} }
@ -94,8 +94,8 @@ static hecl::SystemString LayerName(std::string_view name)
{ {
hecl::SystemString ret(hecl::SystemStringConv(name).sys_str()); hecl::SystemString ret(hecl::SystemStringConv(name).sys_str());
for (auto& ch : ret) for (auto& ch : ret)
if (ch == _S('/') || ch == _S('\\')) if (ch == _SYS_STR('/') || ch == _SYS_STR('\\'))
ch = _S('-'); ch = _SYS_STR('-');
return ret; return ret;
} }
@ -162,10 +162,10 @@ void PAKBridge::build()
if (areaDeps.name.empty()) if (areaDeps.name.empty())
{ {
std::string idStr = area.areaMREAId.toString(); std::string idStr = area.areaMREAId.toString();
areaDeps.name = hecl::SystemString(_S("MREA_")) + hecl::SystemStringConv(idStr).c_str(); areaDeps.name = hecl::SystemString(_SYS_STR("MREA_")) + hecl::SystemStringConv(idStr).c_str();
} }
hecl::SystemChar num[16]; hecl::SystemChar num[16];
hecl::SNPrintf(num, 16, _S("%02u "), ai); hecl::SNPrintf(num, 16, _SYS_STR("%02u "), ai);
areaDeps.name = num + areaDeps.name; areaDeps.name = num + areaDeps.name;
std::string lowerName(hecl::SystemUTF8Conv(areaDeps.name).str()); std::string lowerName(hecl::SystemUTF8Conv(areaDeps.name).str());
@ -191,7 +191,7 @@ void PAKBridge::build()
layer.active = layerFlags.flags >> (l-1) & 0x1; layer.active = layerFlags.flags >> (l-1) & 0x1;
layer.name = hecl::StringUtils::TrimWhitespace(layer.name); layer.name = hecl::StringUtils::TrimWhitespace(layer.name);
hecl::SNPrintf(num, 16, _S("%02u "), l-1); hecl::SNPrintf(num, 16, _SYS_STR("%02u "), l-1);
layer.name = num + layer.name; layer.name = num + layer.name;
layer.resources.reserve(area.depLayers[l] - r); layer.resources.reserve(area.depLayers[l] - r);
@ -216,9 +216,7 @@ void PAKBridge::build()
} }
} }
void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo,
std::unordered_map<UniqueID32, std::pair<UniqueID32, std::string>>& cskrCinfToAncs) const
{ {
for (const std::pair<UniqueID32, PAK::Entry>& entry : m_pak.m_entries) for (const std::pair<UniqueID32, PAK::Entry>& entry : m_pak.m_entries)
{ {
@ -229,23 +227,26 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
ancs.read(rs); ancs.read(rs);
for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters) for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters)
{ {
addTo[ci.cmdl] = std::make_pair(ci.cskr, ci.cinf); charAssoc.m_cmdlRigs[ci.cmdl] = std::make_pair(ci.cskr, ci.cinf);
cskrCinfToAncs[ci.cskr] = std::make_pair(entry.second.id, hecl::Format("%s.CSKR", ci.name.c_str())); charAssoc.m_cskrCinfToCharacter[ci.cskr] =
cskrCinfToAncs[ci.cinf] = std::make_pair(entry.second.id, hecl::Format("CINF_%08X.CINF", ci.cinf.toUint32())); std::make_pair(entry.second.id, hecl::Format("%s.CSKR", ci.name.c_str()));
charAssoc.m_cskrCinfToCharacter[ci.cinf] =
std::make_pair(entry.second.id, hecl::Format("CINF_%08X.CINF", ci.cinf.toUint32()));
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdl); PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdl);
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskr); PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskr);
PAK::Entry* cinfEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cinf); 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()); 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()); 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()); cinfEnt->name = hecl::Format("ANCS_%08X_%s_skel", entry.first.toUint32(), ci.name.c_str());
if (ci.cmdlOverlay && ci.cskrOverlay) if (ci.cmdlIce && ci.cskrIce)
{ {
addTo[ci.cmdlOverlay] = std::make_pair(ci.cskrOverlay, ci.cinf); charAssoc.m_cmdlRigs[ci.cmdlIce] = std::make_pair(ci.cskrIce, ci.cinf);
cskrCinfToAncs[ci.cskrOverlay] = std::make_pair(entry.second.id, hecl::Format("%s.OVER.CSKR", ci.name.c_str())); charAssoc.m_cskrCinfToCharacter[ci.cskrIce] =
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlOverlay); std::make_pair(entry.second.id, hecl::Format("%s.ICE.CSKR", ci.name.c_str()));
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrOverlay); PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlIce);
cmdlEnt->name = hecl::Format("ANCS_%08X_%s_overmodel", entry.first.toUint32(), ci.name.c_str()); PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrIce);
cskrEnt->name = hecl::Format("ANCS_%08X_%s_overskin", entry.first.toUint32(), ci.name.c_str()); cmdlEnt->name = hecl::Format("ANCS_%08X_%s_icemodel", entry.first.toUint32(), ci.name.c_str());
cskrEnt->name = hecl::Format("ANCS_%08X_%s_iceskin", entry.first.toUint32(), ci.name.c_str());
} }
} }
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animInfo; std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animInfo;
@ -254,19 +255,21 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
{ {
PAK::Entry* animEnt = (PAK::Entry*)m_pak.lookupEntry(ae.second.animId); 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());
cskrCinfToAncs[ae.second.animId] = std::make_pair(entry.second.id, hecl::Format("%s.ANIM", ae.second.name.c_str())); charAssoc.m_cskrCinfToCharacter[ae.second.animId] =
std::make_pair(entry.second.id, hecl::Format("%s.ANIM", ae.second.name.c_str()));
if (ae.second.evntId) if (ae.second.evntId)
{ {
PAK::Entry* evntEnt = (PAK::Entry*)m_pak.lookupEntry(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());
cskrCinfToAncs[ae.second.evntId] = std::make_pair(entry.second.id, hecl::Format("%s.evnt.yaml", ae.second.name.c_str())); charAssoc.m_cskrCinfToCharacter[ae.second.evntId] =
std::make_pair(entry.second.id, hecl::Format("%s.evnt.yaml", ae.second.name.c_str()));
} }
} }
} }
else if (entry.second.type == FOURCC('MREA')) else if (entry.second.type == FOURCC('MREA'))
{ {
PAKEntryReadStream rs = entry.second.beginReadStream(m_node); PAKEntryReadStream rs = entry.second.beginReadStream(m_node);
MREA::AddCMDLRigPairs(rs, pakRouter, addTo); MREA::AddCMDLRigPairs(rs, pakRouter, charAssoc);
} }
} }
} }
@ -304,7 +307,7 @@ void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
hecl::ProjectPath mlvlDirPath = pakRouter.getWorking(&entry.second).getParentPath(); hecl::ProjectPath mlvlDirPath = pakRouter.getWorking(&entry.second).getParentPath();
if (mlvl.worldNameId) if (mlvl.worldNameId)
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath, _S("!name.yaml")); pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath, _SYS_STR("!name.yaml"));
for (const MLVL::Area& area : mlvl.areas) for (const MLVL::Area& area : mlvl.areas)
{ {
@ -324,7 +327,7 @@ void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
hecl::ProjectPath areaDirPath = pakRouter.getWorking(area.areaMREAId).getParentPath(); hecl::ProjectPath areaDirPath = pakRouter.getWorking(area.areaMREAId).getParentPath();
if (area.areaNameId) if (area.areaNameId)
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath, _S("!name.yaml")); pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath, _SYS_STR("!name.yaml"));
} }
if (mlvl.worldMap) if (mlvl.worldMap)
@ -362,57 +365,57 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const nod::Node& pakNode, con
switch (entry.type) switch (entry.type)
{ {
case SBIG('STRG'): case SBIG('STRG'):
return {STRG::Extract, {_S(".yaml")}}; return {STRG::Extract, {_SYS_STR(".yaml")}};
case SBIG('SCAN'): case SBIG('SCAN'):
return {SCAN::Extract, {_S(".yaml")}, 0, SCAN::Name}; return {SCAN::Extract, {_SYS_STR(".yaml")}, 0, SCAN::Name};
case SBIG('HINT'): case SBIG('HINT'):
return {HINT::Extract, {_S(".yaml")}}; return {HINT::Extract, {_SYS_STR(".yaml")}};
case SBIG('SAVW'): case SBIG('SAVW'):
return {SAVWCommon::ExtractSAVW<SAVW>, {_S(".yaml")}}; return {SAVWCommon::ExtractSAVW<SAVW>, {_SYS_STR(".yaml")}};
case SBIG('TXTR'): case SBIG('TXTR'):
return {TXTR::Extract, {_S(".png")}}; return {TXTR::Extract, {_SYS_STR(".png")}};
case SBIG('AFSM'): case SBIG('AFSM'):
return {AFSM::Extract, {_S(".yaml")}}; return {AFSM::Extract, {_SYS_STR(".yaml")}};
case SBIG('FRME'): case SBIG('FRME'):
return {FRME::Extract, {_S(".blend")}, 2}; return {FRME::Extract, {_SYS_STR(".blend")}, 2};
case SBIG('CMDL'): case SBIG('CMDL'):
return {CMDL::Extract, {_S(".blend")}, 1, CMDL::Name}; return {CMDL::Extract, {_SYS_STR(".blend")}, 1, CMDL::Name};
case SBIG('DCLN'): case SBIG('DCLN'):
return {DCLN::Extract, {_S(".blend")}}; return {DCLN::Extract, {_SYS_STR(".blend")}};
case SBIG('ANCS'): case SBIG('ANCS'):
return {ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2}; return {ANCS::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 2};
case SBIG('MLVL'): case SBIG('MLVL'):
return {MLVL::Extract, {_S(".yaml"), _S(".blend")}, 3}; return {MLVL::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 3};
case SBIG('MREA'): case SBIG('MREA'):
return {MREA::Extract, {_S(".blend")}, 4, MREA::Name}; return {MREA::Extract, {_SYS_STR(".blend")}, 4, MREA::Name};
case SBIG('MAPA'): case SBIG('MAPA'):
return {MAPA::Extract, {_S(".blend")}, 4}; return {MAPA::Extract, {_SYS_STR(".blend")}, 4};
case SBIG('MAPU'): case SBIG('MAPU'):
return {MAPU::Extract, {_S(".blend")}, 5}; return {MAPU::Extract, {_SYS_STR(".blend")}, 5};
case SBIG('PATH'): case SBIG('PATH'):
return {PATH::Extract, {_S(".blend")}, 5}; return {PATH::Extract, {_SYS_STR(".blend")}, 5};
case SBIG('PART'): case SBIG('PART'):
return {DNAParticle::ExtractGPSM<UniqueID32>, {_S(".gpsm.yaml")}}; return {DNAParticle::ExtractGPSM<UniqueID32>, {_SYS_STR(".gpsm.yaml")}};
case SBIG('ELSC'): case SBIG('ELSC'):
return {DNAParticle::ExtractELSM<UniqueID32>, {_S(".elsm.yaml")}}; return {DNAParticle::ExtractELSM<UniqueID32>, {_SYS_STR(".elsm.yaml")}};
case SBIG('SWHC'): case SBIG('SWHC'):
return {DNAParticle::ExtractSWSH<UniqueID32>, {_S(".swsh.yaml")}}; return {DNAParticle::ExtractSWSH<UniqueID32>, {_SYS_STR(".swsh.yaml")}};
case SBIG('CRSC'): case SBIG('CRSC'):
return {DNAParticle::ExtractCRSM<UniqueID32>, {_S(".crsm.yaml")}}; return {DNAParticle::ExtractCRSM<UniqueID32>, {_SYS_STR(".crsm.yaml")}};
case SBIG('WPSC'): case SBIG('WPSC'):
return {DNAParticle::ExtractWPSM<UniqueID32>, {_S(".wpsm.yaml")}}; return {DNAParticle::ExtractWPSM<UniqueID32>, {_SYS_STR(".wpsm.yaml")}};
case SBIG('DPSC'): case SBIG('DPSC'):
return {DNAParticle::ExtractDPSM<UniqueID32>, {_S(".dpsm.yaml")}}; return {DNAParticle::ExtractDPSM<UniqueID32>, {_SYS_STR(".dpsm.yaml")}};
case SBIG('FONT'): case SBIG('FONT'):
return {DNAFont::ExtractFONT<UniqueID32>, {_S(".yaml")}}; return {DNAFont::ExtractFONT<UniqueID32>, {_SYS_STR(".yaml")}};
case SBIG('DGRP'): case SBIG('DGRP'):
return {DNADGRP::ExtractDGRP<UniqueID32>, {_S(".yaml")}}; return {DNADGRP::ExtractDGRP<UniqueID32>, {_SYS_STR(".yaml")}};
case SBIG('AGSC'): case SBIG('AGSC'):
return {AGSC::Extract, {}}; return {AGSC::Extract, {}};
case SBIG('CSNG'): case SBIG('CSNG'):
return {CSNG::Extract, {_S(".mid"), _S(".yaml")}}; return {CSNG::Extract, {_SYS_STR(".mid"), _SYS_STR(".yaml")}};
case SBIG('ATBL'): case SBIG('ATBL'):
return {DNAAudio::ATBL::Extract, {_S(".yaml")}}; return {DNAAudio::ATBL::Extract, {_SYS_STR(".yaml")}};
case SBIG('CTWK'): case SBIG('CTWK'):
case SBIG('DUMB'): case SBIG('DUMB'):
{ {
@ -421,37 +424,37 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const nod::Node& pakNode, con
if (named) if (named)
{ {
if (!name.compare("PlayerRes")) if (!name.compare("PlayerRes"))
return {ExtractTweak<CTweakPlayerRes>, {_S(".yaml")}}; return {ExtractTweak<CTweakPlayerRes>, {_SYS_STR(".yaml")}};
if (!name.compare("GunRes")) if (!name.compare("GunRes"))
return {ExtractTweak<CTweakGunRes>, {_S(".yaml")}}; return {ExtractTweak<CTweakGunRes>, {_SYS_STR(".yaml")}};
if (!name.compare("Player")) if (!name.compare("Player"))
return {ExtractTweak<CTweakPlayer>, {_S(".yaml")}}; return {ExtractTweak<CTweakPlayer>, {_SYS_STR(".yaml")}};
if (!name.compare("CameraBob")) if (!name.compare("CameraBob"))
return {ExtractTweak<CTweakCameraBob>, {_S(".yaml")}}; return {ExtractTweak<CTweakCameraBob>, {_SYS_STR(".yaml")}};
if (!name.compare("SlideShow")) if (!name.compare("SlideShow"))
return {ExtractTweak<CTweakSlideShow>, {_S(".yaml")}}; return {ExtractTweak<CTweakSlideShow>, {_SYS_STR(".yaml")}};
if (!name.compare("Game")) if (!name.compare("Game"))
return {ExtractTweak<CTweakGame>, {_S(".yaml")}}; return {ExtractTweak<CTweakGame>, {_SYS_STR(".yaml")}};
if (!name.compare("Targeting")) if (!name.compare("Targeting"))
return {ExtractTweak<CTweakTargeting>, {_S(".yaml")}}; return {ExtractTweak<CTweakTargeting>, {_SYS_STR(".yaml")}};
if (!name.compare("Gui")) if (!name.compare("Gui"))
return {ExtractTweak<CTweakGui>, {_S(".yaml")}}; return {ExtractTweak<CTweakGui>, {_SYS_STR(".yaml")}};
if (!name.compare("AutoMapper")) if (!name.compare("AutoMapper"))
return {ExtractTweak<CTweakAutoMapper>, {_S(".yaml")}}; return {ExtractTweak<CTweakAutoMapper>, {_SYS_STR(".yaml")}};
if (!name.compare("PlayerControls") || !name.compare("PlayerControls2")) if (!name.compare("PlayerControls") || !name.compare("PlayerControls2"))
return {ExtractTweak<CTweakPlayerControl>, {_S(".yaml")}}; return {ExtractTweak<CTweakPlayerControl>, {_SYS_STR(".yaml")}};
if (!name.compare("Ball")) if (!name.compare("Ball"))
return {ExtractTweak<CTweakBall>, {_S(".yaml")}}; return {ExtractTweak<CTweakBall>, {_SYS_STR(".yaml")}};
if (!name.compare("Particle")) if (!name.compare("Particle"))
return {ExtractTweak<CTweakParticle>, {_S(".yaml")}}; return {ExtractTweak<CTweakParticle>, {_SYS_STR(".yaml")}};
if (!name.compare("GuiColors")) if (!name.compare("GuiColors"))
return {ExtractTweak<CTweakGuiColors>, {_S(".yaml")}}; return {ExtractTweak<CTweakGuiColors>, {_SYS_STR(".yaml")}};
if (!name.compare("PlayerGun")) if (!name.compare("PlayerGun"))
return {ExtractTweak<CTweakPlayerGun>, {_S(".yaml")}}; return {ExtractTweak<CTweakPlayerGun>, {_SYS_STR(".yaml")}};
if (!name.compare("DUMB_MazeSeeds")) if (!name.compare("DUMB_MazeSeeds"))
return {ExtractTweak<MazeSeeds>, {_S(".yaml")}}; return {ExtractTweak<MazeSeeds>, {_SYS_STR(".yaml")}};
if (!name.compare("DUMB_SnowForces")) if (!name.compare("DUMB_SnowForces"))
return {ExtractTweak<SnowForces>, {_S(".yaml")}}; return {ExtractTweak<SnowForces>, {_SYS_STR(".yaml")}};
} }
break; break;
} }

View File

@ -1,5 +1,4 @@
#ifndef __DNAMP1_HPP__ #pragma once
#define __DNAMP1_HPP__
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
#include "PAK.hpp" #include "PAK.hpp"
@ -30,9 +29,7 @@ public:
const PAKType& getPAK() const {return m_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, void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const;
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo,
std::unordered_map<UniqueID32, std::pair<UniqueID32, std::string>>& cskrCinfToAncs) const;
void addPATHToMREA(PAKRouter<PAKBridge>& pakRouter, void addPATHToMREA(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, UniqueID32>& pathToMrea) const; std::unordered_map<UniqueID32, UniqueID32>& pathToMrea) const;
@ -44,4 +41,3 @@ public:
} }
#endif // __DNAMP1_HPP__

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_DEAFBABE_HPP_ #pragma once
#define _DNAMP1_DEAFBABE_HPP_
#include "DataSpec/DNACommon/DeafBabe.hpp" #include "DataSpec/DNACommon/DeafBabe.hpp"
@ -152,4 +151,3 @@ struct DeafBabe : BigDNA
} }
#endif // _DNAMP1_DEAFBABE_HPP_

View File

@ -1,5 +1,4 @@
#ifndef __DNAMP1_EVNT_HPP__ #pragma once
#define __DNAMP1_EVNT_HPP__
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp" #include "DNAMP1.hpp"
@ -110,4 +109,3 @@ struct EVNT : BigDNA
} }
#endif // __DNAMP1_EVNT_HPP__

View File

@ -73,7 +73,7 @@ void FRME::Widget::Enumerate<BigDNA::Read>(athena::io::IStreamReader& __dna_read
case SBIG('TBGP'): widgetInfo.reset(new TBGPInfo); break; case SBIG('TBGP'): widgetInfo.reset(new TBGPInfo); break;
case SBIG('SLGP'): widgetInfo.reset(new SLGPInfo); break; case SBIG('SLGP'): widgetInfo.reset(new SLGPInfo); break;
default: default:
Log.report(logvisor::Fatal, _S("Unsupported FRME widget type %.8X"), type.toUint32()); Log.report(logvisor::Fatal, _SYS_STR("Unsupported FRME widget type %.8X"), type.toUint32());
} }
/* widgetInfo */ /* widgetInfo */
@ -159,7 +159,7 @@ void FRME::Widget::CAMRInfo::Enumerate<BigDNA::Read>(athena::io::IStreamReader&
else if (projectionType == ProjectionType::Orthographic) else if (projectionType == ProjectionType::Orthographic)
projection.reset(new OrthographicProjection); projection.reset(new OrthographicProjection);
else else
Log.report(logvisor::Fatal, _S("Invalid CAMR projection mode! %i"), int(projectionType)); Log.report(logvisor::Fatal, _SYS_STR("Invalid CAMR projection mode! %i"), int(projectionType));
projection->read(__dna_reader); projection->read(__dna_reader);
} }
@ -168,9 +168,9 @@ template <>
void FRME::Widget::CAMRInfo::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& __dna_writer) void FRME::Widget::CAMRInfo::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& __dna_writer)
{ {
if (!projection) if (!projection)
Log.report(logvisor::Fatal, _S("Invalid CAMR projection object!")); Log.report(logvisor::Fatal, _SYS_STR("Invalid CAMR projection object!"));
if (projection->type != projectionType) if (projection->type != projectionType)
Log.report(logvisor::Fatal, _S("CAMR projection type does not match actual projection type!")); Log.report(logvisor::Fatal, _SYS_STR("CAMR projection type does not match actual projection type!"));
__dna_writer.writeUint32Big(atUint32(projectionType)); __dna_writer.writeUint32Big(atUint32(projectionType));
projection->write(__dna_writer); projection->write(__dna_writer);

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_FRME_HPP_ #pragma once
#define _DNAMP1_FRME_HPP_
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp" #include "DNAMP1.hpp"
@ -317,4 +316,3 @@ struct FRME : BigDNA
} }
#endif // _DNAMP1_FRME_HPP_

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_HINT_HPP_ #pragma once
#define _DNAMP1_HINT_HPP_
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/PAK.hpp" #include "DataSpec/DNACommon/PAK.hpp"
@ -56,4 +55,3 @@ struct HINT : BigDNA
} }
}; };
} }
#endif // _DNAMP1_HINT_HPP_

View File

@ -1,5 +1,4 @@
#ifndef __DNAMP1_MAPA_HPP__ #pragma once
#define __DNAMP1_MAPA_HPP__
#include <vector> #include <vector>
@ -38,4 +37,3 @@ struct MAPA : DNAMAPA::MAPA
}; };
} }
#endif

View File

@ -1,5 +1,4 @@
#ifndef __DNAMP1_MAPU_HPP__ #pragma once
#define __DNAMP1_MAPU_HPP__
#include <vector> #include <vector>
@ -29,4 +28,3 @@ struct MAPU : DNAMAPU::MAPU
}; };
} }
#endif

View File

@ -31,13 +31,13 @@ bool MLVL::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
{ {
hecl::ProjectPath areaDir = pakRouter.getWorking(area.areaMREAId).getParentPath(); hecl::ProjectPath areaDir = pakRouter.getWorking(area.areaMREAId).getParentPath();
{ {
athena::io::FileWriter fw(hecl::ProjectPath(areaDir, _S("!memoryid.yaml")).getAbsolutePath()); athena::io::FileWriter fw(hecl::ProjectPath(areaDir, _SYS_STR("!memoryid.yaml")).getAbsolutePath());
athena::io::YAMLDocWriter w(nullptr); athena::io::YAMLDocWriter w(nullptr);
w.writeUint32("memoryid", area.areaId); w.writeUint32("memoryid", area.areaId);
w.finish(&fw); w.finish(&fw);
} }
{ {
athena::io::FileWriter fw(hecl::ProjectPath(areaDir, _S("!memoryrelays.yaml")).getAbsolutePath()); athena::io::FileWriter fw(hecl::ProjectPath(areaDir, _SYS_STR("!memoryrelays.yaml")).getAbsolutePath());
athena::io::YAMLDocWriter w(nullptr); athena::io::YAMLDocWriter w(nullptr);
std::vector<atUint32> relayIds; std::vector<atUint32> relayIds;
@ -52,12 +52,12 @@ bool MLVL::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
w.finish(&fw); w.finish(&fw);
} }
if (pakRouter.mreaHasDupeResources(area.areaMREAId)) if (pakRouter.mreaHasDupeResources(area.areaMREAId))
athena::io::FileWriter(hecl::ProjectPath(areaDir, _S("!duperes")).getAbsolutePath()); athena::io::FileWriter(hecl::ProjectPath(areaDir, _SYS_STR("!duperes")).getAbsolutePath());
areaIdx++; areaIdx++;
} }
athena::io::FileWriter writer(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath()); athena::io::FileWriter writer(outPath.getWithExtension(_SYS_STR(".yaml"), true).getAbsolutePath());
athena::io::ToYAMLStream(mlvl, writer, &MLVL::writeMeta); athena::io::ToYAMLStream(mlvl, writer, &MLVL::writeMeta);
hecl::blender::Connection& conn = btok.getBlenderConnection(); hecl::blender::Connection& conn = btok.getBlenderConnection();
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter, entry, force, fileChanged); return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter, entry, force, fileChanged);
@ -98,18 +98,18 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
hecl::blender::Token& btok) hecl::blender::Token& btok)
{ {
MLVL mlvl = {}; MLVL mlvl = {};
athena::io::FileReader reader(inPath.getWithExtension(_S(".yaml"), true).getAbsolutePath()); athena::io::FileReader reader(inPath.getWithExtension(_SYS_STR(".yaml"), true).getAbsolutePath());
athena::io::FromYAMLStream(mlvl, reader, &MLVL::readMeta); athena::io::FromYAMLStream(mlvl, reader, &MLVL::readMeta);
mlvl.magic = 0xDEAFBABE; mlvl.magic = 0xDEAFBABE;
mlvl.version = 0x11; mlvl.version = 0x11;
hecl::ProjectPath namePath(inPath.getParentPath(), _S("!name.yaml")); hecl::ProjectPath namePath(inPath.getParentPath(), _SYS_STR("!name.yaml"));
if (namePath.isFile()) if (namePath.isFile())
mlvl.worldNameId = namePath; mlvl.worldNameId = namePath;
hecl::ProjectPath globPath = inPath.getWithExtension(_S(".*"), true); hecl::ProjectPath globPath = inPath.getWithExtension(_SYS_STR(".*"), true);
hecl::ProjectPath savwPath = globPath.ensureAuxInfo(_S("SAVW")); hecl::ProjectPath savwPath = globPath.ensureAuxInfo(_SYS_STR("SAVW"));
mlvl.saveWorldId = savwPath; mlvl.saveWorldId = savwPath;
hecl::ProjectPath mapwPath = globPath.ensureAuxInfo(_S("MAPW")); hecl::ProjectPath mapwPath = globPath.ensureAuxInfo(_SYS_STR("MAPW"));
mlvl.worldMap = mapwPath; mlvl.worldMap = mapwPath;
size_t areaIdx = 0; size_t areaIdx = 0;
@ -119,13 +119,13 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
if (area.path.getPathType() != hecl::ProjectPath::Type::Directory) if (area.path.getPathType() != hecl::ProjectPath::Type::Directory)
continue; continue;
hecl::ProjectPath areaPath(area.path, _S("!area.blend")); hecl::ProjectPath areaPath(area.path, _SYS_STR("!area.blend"));
if (!areaPath.isFile()) if (!areaPath.isFile())
continue; continue;
Log.report(logvisor::Info, _S("Visiting %s"), area.path.getRelativePath().data()); Log.report(logvisor::Info, _SYS_STR("Visiting %s"), area.path.getRelativePath().data());
hecl::ProjectPath memRelayPath(area.path, _S("!memoryrelays.yaml")); hecl::ProjectPath memRelayPath(area.path, _SYS_STR("!memoryrelays.yaml"));
std::vector<atUint32> memRelays; std::vector<atUint32> memRelays;
@ -155,7 +155,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
else else
layerName = hecl::StringUtils::TrimWhitespace(hecl::SystemString(endCh)); layerName = hecl::StringUtils::TrimWhitespace(hecl::SystemString(endCh));
hecl::ProjectPath objectsPath(area.path, e.m_name + _S("/!objects.yaml")); hecl::ProjectPath objectsPath(area.path, e.m_name + _SYS_STR("/!objects.yaml"));
if (objectsPath.isNone()) if (objectsPath.isNone())
continue; continue;
@ -177,7 +177,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
layerResources.beginLayer(); layerResources.beginLayer();
/* Set active flag state */ /* Set active flag state */
hecl::ProjectPath defActivePath(area.path, e.m_name + _S("/!defaultactive")); hecl::ProjectPath defActivePath(area.path, e.m_name + _SYS_STR("/!defaultactive"));
bool active = defActivePath.isNone() ? false : true; bool active = defActivePath.isNone() ? false : true;
if (!areaInit) if (!areaInit)
@ -189,7 +189,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
mlvl.areas.emplace_back(); mlvl.areas.emplace_back();
MLVL::Area& areaOut = mlvl.areas.back(); MLVL::Area& areaOut = mlvl.areas.back();
hecl::ProjectPath namePath(area.path, _S("!name.yaml")); hecl::ProjectPath namePath(area.path, _SYS_STR("!name.yaml"));
if (namePath.isFile()) if (namePath.isFile())
areaOut.areaNameId = namePath; areaOut.areaNameId = namePath;
@ -201,7 +201,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
areaOut.areaMREAId = areaPath; areaOut.areaMREAId = areaPath;
areaOut.areaId = 0xffffffff; areaOut.areaId = 0xffffffff;
hecl::ProjectPath memIdPath(area.path, _S("!memoryid.yaml")); hecl::ProjectPath memIdPath(area.path, _SYS_STR("!memoryid.yaml"));
if (memIdPath.isFile()) if (memIdPath.isFile())
{ {
athena::io::FileReader fr(memIdPath.getAbsolutePath()); athena::io::FileReader fr(memIdPath.getAbsolutePath());
@ -316,7 +316,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
} }
if (!areaInit) if (!areaInit)
Log.report(logvisor::Info, _S("No layer directories for area %s"), area.path.getRelativePath().data()); Log.report(logvisor::Info, _SYS_STR("No layer directories for area %s"), area.path.getRelativePath().data());
/* Build deplist */ /* Build deplist */
MLVL::Area& areaOut = mlvl.areas.back(); MLVL::Area& areaOut = mlvl.areas.back();
@ -369,7 +369,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
} }
} }
hecl::ProjectPath pathPath(areaPath.getParentPath(), _S("!path.blend")); hecl::ProjectPath pathPath(areaPath.getParentPath(), _SYS_STR("!path.blend"));
urde::SObjectTag pathTag = g_curSpec->buildTagFromPath(pathPath, btok); urde::SObjectTag pathTag = g_curSpec->buildTagFromPath(pathPath, btok);
if (pathTag.id.IsValid()) if (pathTag.id.IsValid())
{ {
@ -416,7 +416,7 @@ bool MLVL::CookMAPW(const hecl::ProjectPath& outPath,
continue; continue;
/* Area map */ /* Area map */
hecl::ProjectPath mapPath(area.path, _S("/!map.blend")); hecl::ProjectPath mapPath(area.path, _SYS_STR("/!map.blend"));
if (mapPath.isFile()) if (mapPath.isFile())
mapaTags.push_back(g_curSpec->buildTagFromPath(mapPath, btok)); mapaTags.push_back(g_curSpec->buildTagFromPath(mapPath, btok));
} }
@ -451,11 +451,11 @@ bool MLVL::CookSAVW(const hecl::ProjectPath& outPath,
if (area.path.getPathType() != hecl::ProjectPath::Type::Directory) if (area.path.getPathType() != hecl::ProjectPath::Type::Directory)
continue; continue;
hecl::ProjectPath areaPath(area.path, _S("/!area.blend")); hecl::ProjectPath areaPath(area.path, _SYS_STR("/!area.blend"));
if (!areaPath.isFile()) if (!areaPath.isFile())
continue; continue;
hecl::ProjectPath memRelayPath(area.path, _S("/!memoryrelays.yaml")); hecl::ProjectPath memRelayPath(area.path, _SYS_STR("/!memoryrelays.yaml"));
std::vector<atUint32> memRelays; std::vector<atUint32> memRelays;
if (memRelayPath.isFile()) if (memRelayPath.isFile())
{ {
@ -478,7 +478,7 @@ bool MLVL::CookSAVW(const hecl::ProjectPath& outPath,
else else
layerName = hecl::StringUtils::TrimWhitespace(hecl::SystemString(endCh)); layerName = hecl::StringUtils::TrimWhitespace(hecl::SystemString(endCh));
hecl::ProjectPath objectsPath(area.path, e.m_name + _S("/!objects.yaml")); hecl::ProjectPath objectsPath(area.path, e.m_name + _SYS_STR("/!objects.yaml"));
if (objectsPath.isNone()) if (objectsPath.isNone())
continue; continue;

View File

@ -1,5 +1,4 @@
#ifndef __DNAMP1_MLVL_HPP__ #pragma once
#define __DNAMP1_MLVL_HPP__
#include "DataSpec/DNACommon/PAK.hpp" #include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/MLVL.hpp" #include "DataSpec/DNACommon/MLVL.hpp"
@ -168,4 +167,3 @@ struct MLVL : BigDNA
} }
#endif // __DNAMP1_MLVL_HPP__

View File

@ -42,8 +42,7 @@ void MREA::ReadBabeDeadToBlender_1_2(hecl::blender::PyOutStream& os,
} }
void MREA::AddCMDLRigPairs(PAKEntryReadStream& rs, void MREA::AddCMDLRigPairs(PAKEntryReadStream& rs,
PAKRouter<PAKBridge>& pakRouter, PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc)
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo)
{ {
/* Do extract */ /* Do extract */
Header head; Header head;
@ -58,7 +57,7 @@ void MREA::AddCMDLRigPairs(PAKEntryReadStream& rs,
rs.seek(secStart, athena::Begin); rs.seek(secStart, athena::Begin);
SCLY scly; SCLY scly;
scly.read(rs); scly.read(rs);
scly.addCMDLRigPairs(pakRouter, addTo); scly.addCMDLRigPairs(pakRouter, charAssoc);
} }
UniqueID32 MREA::GetPATHId(PAKEntryReadStream& rs) UniqueID32 MREA::GetPATHId(PAKEntryReadStream& rs)
@ -324,7 +323,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
{ {
rs.seek(secStart, athena::Begin); rs.seek(secStart, athena::Begin);
auto visiData = rs.readUBytes(head.secSizes[curSec]); auto visiData = rs.readUBytes(head.secSizes[curSec]);
athena::io::FileWriter visiOut(outPath.getWithExtension(_S(".visi"), true).getAbsolutePath()); athena::io::FileWriter visiOut(outPath.getWithExtension(_SYS_STR(".visi"), true).getAbsolutePath());
visiOut.writeUBytes(visiData.get(), head.secSizes[curSec]); visiOut.writeUBytes(visiData.get(), head.secSizes[curSec]);
rs.seek(secStart + 4, athena::Begin); rs.seek(secStart + 4, athena::Begin);
} }
@ -341,7 +340,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
visiWriter.writeUint32(nullptr, entityId); visiWriter.writeUint32(nullptr, entityId);
} }
} }
hecl::ProjectPath visiMetadataPath(outPath.getParentPath(), _S("!visi.yaml")); hecl::ProjectPath visiMetadataPath(outPath.getParentPath(), _SYS_STR("!visi.yaml"));
athena::io::FileWriter visiMetadata(visiMetadataPath.getAbsolutePath()); athena::io::FileWriter visiMetadata(visiMetadataPath.getAbsolutePath());
visiWriter.finish(&visiMetadata); visiWriter.finish(&visiMetadata);
} }
@ -440,7 +439,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
false, false, true); false, false, true);
for (const hecl::DirectoryEnumerator::Entry& ent : dEnum) for (const hecl::DirectoryEnumerator::Entry& ent : dEnum)
{ {
hecl::ProjectPath layerScriptPath(areaDirPath, ent.m_name + _S("/!objects.yaml")); hecl::ProjectPath layerScriptPath(areaDirPath, ent.m_name + _SYS_STR("/!objects.yaml"));
if (layerScriptPath.isFile()) if (layerScriptPath.isFile())
layerScriptPaths.push_back(std::move(layerScriptPath)); layerScriptPaths.push_back(std::move(layerScriptPath));
} }
@ -524,7 +523,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
#if DUMP_OCTREE #if DUMP_OCTREE
hecl::blender::Connection& conn = btok.getBlenderConnection(); hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(inPath.getWithExtension(_S(".octree.blend"), true), hecl::blender::BlendType::Area)) if (!conn.createBlend(inPath.getWithExtension(_SYS_STR(".octree.blend"), true), hecl::blender::BlendType::Area))
return false; return false;
/* Open Py Stream and read sections */ /* Open Py Stream and read sections */
@ -595,7 +594,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
#if DUMP_OCTREE #if DUMP_OCTREE
hecl::blender::Connection& conn = btok.getBlenderConnection(); hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(inPath.getWithExtension(_S(".coctree.blend"), true), hecl::blender::BlendType::Area)) if (!conn.createBlend(inPath.getWithExtension(_SYS_STR(".coctree.blend"), true), hecl::blender::BlendType::Area))
return false; return false;
/* Open Py Stream and read sections */ /* Open Py Stream and read sections */
@ -667,7 +666,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
} }
/* VISI */ /* VISI */
hecl::ProjectPath visiMetadataPath(areaDirPath, _S("!visi.yaml")); hecl::ProjectPath visiMetadataPath(areaDirPath, _SYS_STR("!visi.yaml"));
bool visiGood = false; bool visiGood = false;
if (visiMetadataPath.isFile()) if (visiMetadataPath.isFile())
{ {
@ -699,7 +698,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
} }
// Check if pre-generated visi exists, recycle if able // Check if pre-generated visi exists, recycle if able
hecl::ProjectPath preVisiPath = inPath.getWithExtension(_S(".visi"), true); hecl::ProjectPath preVisiPath = inPath.getWithExtension(_SYS_STR(".visi"), true);
if (preVisiPath.getPathType() == hecl::ProjectPath::Type::File) if (preVisiPath.getPathType() == hecl::ProjectPath::Type::File)
{ {
athena::io::FileReader preVisiReader(preVisiPath.getAbsolutePath()); athena::io::FileReader preVisiReader(preVisiPath.getAbsolutePath());
@ -734,7 +733,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
#if !WINDOWS_STORE #if !WINDOWS_STORE
if (!visiGood) if (!visiGood)
{ {
hecl::ProjectPath visiIntOut = outPath.getWithExtension(_S(".visiint")); hecl::ProjectPath visiIntOut = outPath.getWithExtension(_SYS_STR(".visiint"));
athena::io::FileWriter w(visiIntOut.getAbsolutePath()); athena::io::FileWriter w(visiIntOut.getAbsolutePath());
w.writeUint32Big(meshes.size()); w.writeUint32Big(meshes.size());
for (const DNACMDL::Mesh& mesh : meshes) for (const DNACMDL::Mesh& mesh : meshes)
@ -776,17 +775,17 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
w.close(); w.close();
hecl::SystemString VisiGenPath = ExeDir + _S("/visigen"); hecl::SystemString VisiGenPath = ExeDir + _SYS_STR("/visigen");
#if _WIN32 #if _WIN32
VisiGenPath += _S(".exe"); VisiGenPath += _SYS_STR(".exe");
#endif #endif
hecl::SystemChar thrIdx[16]; hecl::SystemChar thrIdx[16];
hecl::SNPrintf(thrIdx, 16, _S("%d"), hecl::ClientProcess::GetThreadWorkerIdx()); hecl::SNPrintf(thrIdx, 16, _SYS_STR("%d"), hecl::ClientProcess::GetThreadWorkerIdx());
hecl::SystemChar parPid[32]; hecl::SystemChar parPid[32];
#if _WIN32 #if _WIN32
hecl::SNPrintf(parPid, 32, _S("%lluX"), reinterpret_cast<unsigned long long>(GetCurrentProcess())); hecl::SNPrintf(parPid, 32, _SYS_STR("%lluX"), reinterpret_cast<unsigned long long>(GetCurrentProcess()));
#else #else
hecl::SNPrintf(parPid, 32, _S("%lluX"), (unsigned long long)getpid()); hecl::SNPrintf(parPid, 32, _SYS_STR("%lluX"), (unsigned long long)getpid());
#endif #endif
const hecl::SystemChar* args[] = {VisiGenPath.c_str(), const hecl::SystemChar* args[] = {VisiGenPath.c_str(),
visiIntOut.getAbsolutePath().data(), visiIntOut.getAbsolutePath().data(),
@ -802,7 +801,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
} }
else else
{ {
Log.report(logvisor::Fatal, _S("Unable to launch %s"), VisiGenPath.c_str()); Log.report(logvisor::Fatal, _SYS_STR("Unable to launch %s"), VisiGenPath.c_str());
} }
} }
#endif #endif
@ -813,7 +812,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
/* PATH */ /* PATH */
{ {
hecl::ProjectPath pathPath(inPath.getParentPath(), _S("!path.blend")); hecl::ProjectPath pathPath(inPath.getParentPath(), _SYS_STR("!path.blend"));
UniqueID32 pathId = pathPath; UniqueID32 pathId = pathPath;
secs.emplace_back(4, 0); secs.emplace_back(4, 0);
athena::io::MemoryWriter w(secs.back().data(), secs.back().size()); athena::io::MemoryWriter w(secs.back().data(), secs.back().size());

View File

@ -1,5 +1,4 @@
#ifndef __DNAMP1_MREA_HPP__ #pragma once
#define __DNAMP1_MREA_HPP__
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
#include "CMDLMaterials.hpp" #include "CMDLMaterials.hpp"
@ -103,8 +102,7 @@ struct MREA
athena::io::IStreamReader& rs); athena::io::IStreamReader& rs);
static void AddCMDLRigPairs(PAKEntryReadStream& rs, static void AddCMDLRigPairs(PAKEntryReadStream& rs,
PAKRouter<PAKBridge>& pakRouter, PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc);
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo);
static UniqueID32 GetPATHId(PAKEntryReadStream& rs); static UniqueID32 GetPATHId(PAKEntryReadStream& rs);
@ -137,4 +135,3 @@ struct MREA
} }
#endif

View File

@ -1,5 +1,4 @@
#ifndef __DNAMP1_MAZESEEDS_HPP__ #pragma once
#define __DNAMP1_MAZESEEDS_HPP__
#include <vector> #include <vector>
@ -14,4 +13,3 @@ struct MazeSeeds : BigDNA
}; };
} }
#endif // __DNAMP1_MAZESEEDS_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNAMP1_PAK_HPP__ #pragma once
#define __DNAMP1_PAK_HPP__
#include <unordered_map> #include <unordered_map>
@ -63,4 +62,3 @@ struct PAK : BigDNA
} }
#endif // __DNAMP1_PAK_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNACOMMON_PATH_HPP__ #pragma once
#define __DNACOMMON_PATH_HPP__
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/PAK.hpp" #include "DataSpec/DNACommon/PAK.hpp"
@ -90,4 +89,3 @@ struct PATH : BigDNA
}; };
} }
#endif // __DNACOMMON_PATH_HPP__

View File

@ -1,5 +1,4 @@
#ifndef __DNAMP1_SAVW_HPP__ #pragma once
#define __DNAMP1_SAVW_HPP__
#include "DataSpec/DNACommon/SAVWCommon.hpp" #include "DataSpec/DNACommon/SAVWCommon.hpp"
#include "DNAMP1.hpp" #include "DNAMP1.hpp"
@ -33,4 +32,3 @@ struct SAVW : BigDNA
}; };
} }
#endif // __DNAMP1_SAVW_HPP__

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_SCAN_HPP_ #pragma once
#define _DNAMP1_SCAN_HPP_
#include <athena/FileWriter.hpp> #include <athena/FileWriter.hpp>
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
@ -113,4 +112,3 @@ struct SCAN : BigDNA
} }
#endif

View File

@ -51,10 +51,10 @@ void SCLY::exportToLayerDirectories(const PAK::Entry& entry, PAKRouter<PAKBridge
if (active) if (active)
{ {
hecl::ProjectPath activePath(layerPath, "!defaultactive"); hecl::ProjectPath activePath(layerPath, "!defaultactive");
fclose(hecl::Fopen(activePath.getAbsolutePath().data(), _S("wb"))); fclose(hecl::Fopen(activePath.getAbsolutePath().data(), _SYS_STR("wb")));
} }
hecl::ProjectPath yamlFile(layerPath, _S("!objects.yaml")); hecl::ProjectPath yamlFile(layerPath, _SYS_STR("!objects.yaml"));
if (force || yamlFile.isNone()) if (force || yamlFile.isNone())
{ {
athena::io::FileWriter writer(yamlFile.getAbsolutePath()); athena::io::FileWriter writer(yamlFile.getAbsolutePath());
@ -63,18 +63,16 @@ void SCLY::exportToLayerDirectories(const PAK::Entry& entry, PAKRouter<PAKBridge
} }
} }
void SCLY::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, void SCLY::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const
{ {
for (const ScriptLayer& layer : layers) for (const ScriptLayer& layer : layers)
layer.addCMDLRigPairs(pakRouter, addTo); layer.addCMDLRigPairs(pakRouter, charAssoc);
} }
void SCLY::ScriptLayer::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, void SCLY::ScriptLayer::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const
{ {
for (const std::unique_ptr<IScriptObject>& obj : objects) for (const std::unique_ptr<IScriptObject>& obj : objects)
obj->addCMDLRigPairs(pakRouter, addTo); obj->addCMDLRigPairs(pakRouter, charAssoc);
} }
void SCLY::nameIDs(PAKRouter<PAKBridge>& pakRouter) const void SCLY::nameIDs(PAKRouter<PAKBridge>& pakRouter) const
@ -136,11 +134,11 @@ void SCLY::ScriptLayer::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs)
objects.push_back(std::move(obj)); objects.push_back(std::move(obj));
size_t actualLen = rs.position() - start; size_t actualLen = rs.position() - start;
if (actualLen != len) if (actualLen != len)
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); Log.report(logvisor::Fatal, _SYS_STR("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); rs.seek(start + len, athena::Begin);
} }
else else
Log.report(logvisor::Fatal, _S("Unable to find type 0x%X in object database"), (atUint32)type); Log.report(logvisor::Fatal, _SYS_STR("Unable to find type 0x%X in object database"), (atUint32)type);
} }
} }
@ -170,7 +168,7 @@ void SCLY::ScriptLayer::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& r
objects.push_back(std::move(obj)); objects.push_back(std::move(obj));
} }
else else
Log.report(logvisor::Fatal, _S("Unable to find type 0x%X in object database"), (atUint32)type); Log.report(logvisor::Fatal, _SYS_STR("Unable to find type 0x%X in object database"), (atUint32)type);
} }
} }
} }

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_SCLY_HPP_ #pragma once
#define _DNAMP1_SCLY_HPP_
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
#include "ScriptObjects/IScriptObject.hpp" #include "ScriptObjects/IScriptObject.hpp"
@ -22,16 +21,13 @@ struct SCLY : BigDNA
Value<atUint8> unknown; Value<atUint8> unknown;
Value<atUint32> objectCount; Value<atUint32> objectCount;
Vector<std::unique_ptr<IScriptObject>, AT_DNA_COUNT(objectCount)> objects; Vector<std::unique_ptr<IScriptObject>, AT_DNA_COUNT(objectCount)> objects;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const;
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const; void nameIDs(PAKRouter<PAKBridge>& pakRouter) const;
}; };
Vector<ScriptLayer, AT_DNA_COUNT(layerCount)> layers; Vector<ScriptLayer, AT_DNA_COUNT(layerCount)> layers;
void exportToLayerDirectories(const PAK::Entry &, PAKRouter<PAKBridge>&, bool) const; void exportToLayerDirectories(const PAK::Entry &, PAKRouter<PAKBridge>&, bool) const;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const;
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const; void nameIDs(PAKRouter<PAKBridge>& pakRouter) const;
}; };
} }
#endif

View File

@ -1,5 +1,4 @@
#ifndef __DNAMP1_STRG_HPP__ #pragma once
#define __DNAMP1_STRG_HPP__
#include <unordered_map> #include <unordered_map>
#include "DataSpec/DNACommon/DNACommon.hpp" #include "DataSpec/DNACommon/DNACommon.hpp"
@ -87,4 +86,3 @@ struct STRG : ISTRG
} }
#endif // __DNAMP1_STRG_HPP__

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_AIJUMPPOINT_HPP_ #pragma once
#define _DNAMP1_AIJUMPPOINT_HPP_
#include "../../DNACommon/DNACommon.hpp" #include "../../DNACommon/DNACommon.hpp"
#include "IScriptObject.hpp" #include "IScriptObject.hpp"
@ -19,4 +18,3 @@ struct AIJumpPoint : IScriptObject
}; };
} }
#endif

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_AIKEYFRAME_HPP_ #pragma once
#define _DNAMP1_AIKEYFRAME_HPP_
#include "IScriptObject.hpp" #include "IScriptObject.hpp"
#include "Parameters.hpp" #include "Parameters.hpp"
@ -21,4 +20,3 @@ struct AIKeyframe : IScriptObject
}; };
} }
#endif

View File

@ -21,7 +21,7 @@ zeus::CAABox Actor::getVISIAABB(hecl::blender::Token& btok) const
{ {
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath( hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(
animationParameters.animationCharacterSet); animationParameters.animationCharacterSet);
conn.openBlend(path.getWithExtension(_S(".blend"), true)); conn.openBlend(path.getWithExtension(_SYS_STR(".blend"), true));
hecl::blender::DataStream ds = conn.beginData(); hecl::blender::DataStream ds = conn.beginData();
auto aabb = ds.getMeshAABB(); auto aabb = ds.getMeshAABB();
aabbOut = zeus::CAABox(aabb.first, aabb.second); aabbOut = zeus::CAABox(aabb.first, aabb.second);

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_ACTOR_HPP_ #pragma once
#define _DNAMP1_ACTOR_HPP_
#include "IScriptObject.hpp" #include "IScriptObject.hpp"
#include "Parameters.hpp" #include "Parameters.hpp"
@ -35,10 +34,9 @@ struct Actor : IScriptObject
Value<bool> scaleAdvancementDelta; Value<bool> scaleAdvancementDelta;
Value<bool> materialFlag54; Value<bool> materialFlag54;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const
{ {
actorParameters.addCMDLRigPairs(addTo, animationParameters.getCINF(pakRouter)); actorParameters.addCMDLRigPairs(pakRouter, charAssoc, animationParameters);
} }
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
@ -69,4 +67,3 @@ struct Actor : IScriptObject
}; };
} }
#endif

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_ACTORCONTRAPTION_HPP_ #pragma once
#define _DNAMP1_ACTORCONTRAPTION_HPP_
#include "../../DNACommon/DNACommon.hpp" #include "../../DNACommon/DNACommon.hpp"
#include "IScriptObject.hpp" #include "IScriptObject.hpp"
@ -27,10 +26,9 @@ struct ActorContraption : IScriptObject
DamageInfo damageInfo; DamageInfo damageInfo;
Value<bool> active; // needs verification Value<bool> active; // needs verification
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const
{ {
actorParameters.addCMDLRigPairs(addTo, animationParameters.getCINF(pakRouter)); actorParameters.addCMDLRigPairs(pakRouter, charAssoc, animationParameters);
} }
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
@ -59,4 +57,3 @@ struct ActorContraption : IScriptObject
}; };
} }
#endif

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_ACTORKEYFRAME_HPP_ #pragma once
#define _DNAMP1_ACTORKEYFRAME_HPP_
#include "../../DNACommon/DNACommon.hpp" #include "../../DNACommon/DNACommon.hpp"
#include "IScriptObject.hpp" #include "IScriptObject.hpp"
@ -21,4 +20,3 @@ struct ActorKeyframe : IScriptObject
}; };
} }
#endif

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_ACTORROTATE_HPP_ #pragma once
#define _DNAMP1_ACTORROTATE_HPP_
#include "../../DNACommon/DNACommon.hpp" #include "../../DNACommon/DNACommon.hpp"
#include "IScriptObject.hpp" #include "IScriptObject.hpp"
@ -20,4 +19,3 @@ struct ActorRotate : IScriptObject
}; };
} }
#endif

View File

@ -1,5 +1,4 @@
#ifndef _DNAMP1_AMBIENTAI_HPP_ #pragma once
#define _DNAMP1_AMBIENTAI_HPP_
#include "../../DNACommon/DNACommon.hpp" #include "../../DNACommon/DNACommon.hpp"
#include "IScriptObject.hpp" #include "IScriptObject.hpp"
@ -28,10 +27,9 @@ struct AmbientAI : IScriptObject
Value<atInt32> impactAnim; Value<atInt32> impactAnim;
Value<bool> active; Value<bool> active;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const
{ {
actorParameters.addCMDLRigPairs(addTo, animationParameters.getCINF(pakRouter)); actorParameters.addCMDLRigPairs(pakRouter, charAssoc, animationParameters);
} }
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
@ -54,4 +52,3 @@ struct AmbientAI : IScriptObject
}; };
} }
#endif

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