mirror of https://github.com/AxioDL/metaforce.git
commit
56cebfbacd
|
@ -32,7 +32,7 @@ void LoadAssetMap(athena::io::MemoryReader& ar) {
|
||||||
ar.readBytesToBuf(&magic, 4);
|
ar.readBytesToBuf(&magic, 4);
|
||||||
if (magic != FOURCC('AIDM'))
|
if (magic != FOURCC('AIDM'))
|
||||||
Log.report(logvisor::Warning,
|
Log.report(logvisor::Warning,
|
||||||
fmt(_SYS_STR("Unable to load asset map; Assets will not have proper filenames for most files.")));
|
FMT_STRING(_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();
|
||||||
g_AssetNameMap.reserve(assetCount);
|
g_AssetNameMap.reserve(assetCount);
|
||||||
|
@ -50,7 +50,7 @@ void InitAssetNameMap() {
|
||||||
if (g_AssetNameMapInit)
|
if (g_AssetNameMapInit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Log.report(logvisor::Info, fmt("Initializing asset name database..."));
|
Log.report(logvisor::Info, FMT_STRING("Initializing asset name database..."));
|
||||||
|
|
||||||
/* First load the 32bit map for MP1/2 */
|
/* First load the 32bit map for MP1/2 */
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,7 +99,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
||||||
{
|
{
|
||||||
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
||||||
|
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"import bpy\n"
|
"import bpy\n"
|
||||||
"from mathutils import Vector\n"
|
"from mathutils import Vector\n"
|
||||||
"bpy.context.scene.name = '{}'\n"
|
"bpy.context.scene.name = '{}'\n"
|
||||||
|
@ -116,7 +116,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
||||||
std::unordered_set<typename PAKRouter::IDType> cinfsDone;
|
std::unordered_set<typename PAKRouter::IDType> cinfsDone;
|
||||||
for (const auto& info : chResInfo) {
|
for (const auto& info : chResInfo) {
|
||||||
/* Provide data to add-on */
|
/* Provide data to add-on */
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"actor_subtype = actor_data.subtypes.add()\n"
|
"actor_subtype = actor_data.subtypes.add()\n"
|
||||||
"actor_subtype.name = '{}'\n\n"),
|
"actor_subtype.name = '{}'\n\n"),
|
||||||
info.name);
|
info.name);
|
||||||
|
@ -125,7 +125,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
||||||
if (cinfsDone.find(info.cinf) == cinfsDone.end()) {
|
if (cinfsDone.find(info.cinf) == cinfsDone.end()) {
|
||||||
if (const typename PAKRouter::EntryType* cinfE = pakRouter.lookupEntry(info.cinf, nullptr, true, false)) {
|
if (const typename PAKRouter::EntryType* cinfE = pakRouter.lookupEntry(info.cinf, nullptr, true, false)) {
|
||||||
hecl::ProjectPath cinfPath = pakRouter.getWorking(cinfE);
|
hecl::ProjectPath cinfPath = pakRouter.getWorking(cinfE);
|
||||||
os.linkArmature(cinfPath.getAbsolutePathUTF8(), fmt::format(fmt("CINF_{}"), info.cinf));
|
os.linkArmature(cinfPath.getAbsolutePathUTF8(), fmt::format(FMT_STRING("CINF_{}"), info.cinf));
|
||||||
os << "if obj.name not in bpy.context.scene.objects:\n"
|
os << "if obj.name not in bpy.context.scene.objects:\n"
|
||||||
" bpy.context.scene.collection.objects.link(obj)\n";
|
" bpy.context.scene.collection.objects.link(obj)\n";
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
||||||
}
|
}
|
||||||
cinfsDone.insert(info.cinf);
|
cinfsDone.insert(info.cinf);
|
||||||
}
|
}
|
||||||
os.format(fmt("arm_obj = bpy.data.objects['CINF_{}']\n"), info.cinf);
|
os.format(FMT_STRING("arm_obj = bpy.data.objects['CINF_{}']\n"), info.cinf);
|
||||||
os << "actor_subtype.linked_armature = arm_obj.name\n";
|
os << "actor_subtype.linked_armature = arm_obj.name\n";
|
||||||
|
|
||||||
/* Link CMDL */
|
/* Link CMDL */
|
||||||
|
@ -154,7 +154,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
||||||
/* Link overlays */
|
/* Link overlays */
|
||||||
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(fmt("overlay.name = '{}'\n"), overlay.first);
|
os.format(FMT_STRING("overlay.name = '{}'\n"), overlay.first);
|
||||||
|
|
||||||
/* Link CMDL */
|
/* Link CMDL */
|
||||||
if (const typename PAKRouter::EntryType* cmdlE =
|
if (const typename PAKRouter::EntryType* cmdlE =
|
||||||
|
@ -175,7 +175,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
||||||
/* Link attachments */
|
/* Link attachments */
|
||||||
for (auto it = attRange.first; it != attRange.second; ++it) {
|
for (auto it = attRange.first; it != attRange.second; ++it) {
|
||||||
os << "attachment = actor_data.attachments.add()\n";
|
os << "attachment = actor_data.attachments.add()\n";
|
||||||
os.format(fmt("attachment.name = '{}'\n"), it->second.second);
|
os.format(FMT_STRING("attachment.name = '{}'\n"), it->second.second);
|
||||||
|
|
||||||
auto cinfid = it->second.first.cinf;
|
auto cinfid = it->second.first.cinf;
|
||||||
auto cmdlid = it->second.first.cmdl;
|
auto cmdlid = it->second.first.cmdl;
|
||||||
|
@ -185,7 +185,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
||||||
if (cinfsDone.find(cinfid) == cinfsDone.end()) {
|
if (cinfsDone.find(cinfid) == cinfsDone.end()) {
|
||||||
if (const typename PAKRouter::EntryType* cinfE = pakRouter.lookupEntry(cinfid, nullptr, true, false)) {
|
if (const typename PAKRouter::EntryType* cinfE = pakRouter.lookupEntry(cinfid, nullptr, true, false)) {
|
||||||
hecl::ProjectPath cinfPath = pakRouter.getWorking(cinfE);
|
hecl::ProjectPath cinfPath = pakRouter.getWorking(cinfE);
|
||||||
os.linkArmature(cinfPath.getAbsolutePathUTF8(), fmt::format(fmt("CINF_{}"), cinfid));
|
os.linkArmature(cinfPath.getAbsolutePathUTF8(), fmt::format(FMT_STRING("CINF_{}"), cinfid));
|
||||||
os << "if obj.name not in bpy.context.scene.objects:\n"
|
os << "if obj.name not in bpy.context.scene.objects:\n"
|
||||||
" bpy.context.scene.collection.objects.link(obj)\n";
|
" bpy.context.scene.collection.objects.link(obj)\n";
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
||||||
}
|
}
|
||||||
cinfsDone.insert(cinfid);
|
cinfsDone.insert(cinfid);
|
||||||
}
|
}
|
||||||
os.format(fmt("arm_obj = bpy.data.objects['CINF_{}']\n"), cinfid);
|
os.format(FMT_STRING("arm_obj = bpy.data.objects['CINF_{}']\n"), cinfid);
|
||||||
os << "attachment.linked_armature = arm_obj.name\n";
|
os << "attachment.linked_armature = arm_obj.name\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
||||||
for (const auto& id : animResInfo) {
|
for (const auto& id : animResInfo) {
|
||||||
typename ANCSDNA::ANIMType anim;
|
typename ANCSDNA::ANIMType anim;
|
||||||
if (pakRouter.lookupAndReadDNA(id.second.animId, anim, true)) {
|
if (pakRouter.lookupAndReadDNA(id.second.animId, anim, true)) {
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"act = bpy.data.actions.new('{}')\n"
|
"act = bpy.data.actions.new('{}')\n"
|
||||||
"act.use_fake_user = True\n"
|
"act.use_fake_user = True\n"
|
||||||
"act.anim_id = '{}'\n"),
|
"act.anim_id = '{}'\n"),
|
||||||
|
@ -238,7 +238,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
||||||
anim.sendANIMToBlender(os, inverter, id.second.additive);
|
anim.sendANIMToBlender(os, inverter, id.second.additive);
|
||||||
}
|
}
|
||||||
|
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"actor_action = actor_data.actions.add()\n"
|
"actor_action = actor_data.actions.add()\n"
|
||||||
"actor_action.name = '{}'\n"),
|
"actor_action.name = '{}'\n"),
|
||||||
id.second.name);
|
id.second.name);
|
||||||
|
|
|
@ -175,7 +175,7 @@ std::vector<std::vector<Value>> BitstreamReader::read(const atUint8* data, size_
|
||||||
|
|
||||||
for (size_t f = 0; f < keyFrameCount; ++f) {
|
for (size_t f = 0; f < keyFrameCount; ++f) {
|
||||||
#if DUMP_KEYS
|
#if DUMP_KEYS
|
||||||
fmt::print(stderr, fmt("\nFRAME {} {} {}\n"), f, (m_bitCur / 32) * 4, m_bitCur % 32);
|
fmt::print(stderr, FMT_STRING("\nFRAME {} {} {}\n"), f, (m_bitCur / 32) * 4, m_bitCur % 32);
|
||||||
int lastId = -1;
|
int lastId = -1;
|
||||||
#endif
|
#endif
|
||||||
auto kit = chanKeys.begin();
|
auto kit = chanKeys.begin();
|
||||||
|
@ -197,7 +197,7 @@ std::vector<std::vector<Value>> BitstreamReader::read(const atUint8* data, size_
|
||||||
QuantizedRot qr = {{p[0], p[1], p[2]}, wBit};
|
QuantizedRot qr = {{p[0], p[1], p[2]}, wBit};
|
||||||
kit->emplace_back(DequantizeRotation(qr, rotDiv));
|
kit->emplace_back(DequantizeRotation(qr, rotDiv));
|
||||||
#if DUMP_KEYS
|
#if DUMP_KEYS
|
||||||
fmt::print(stderr, fmt("{} R: {} {} {} {}\t"), chan.id, wBit, p[0], p[1], p[2]);
|
fmt::print(stderr, FMT_STRING("{} R: {} {} {} {}\t"), chan.id, wBit, p[0], p[1], p[2]);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ std::vector<std::vector<Value>> BitstreamReader::read(const atUint8* data, size_
|
||||||
p[2] += val3;
|
p[2] += val3;
|
||||||
kit->push_back({p[0] * transMult, p[1] * transMult, p[2] * transMult});
|
kit->push_back({p[0] * transMult, p[1] * transMult, p[2] * transMult});
|
||||||
#if DUMP_KEYS
|
#if DUMP_KEYS
|
||||||
fmt::print(stderr, fmt("{} T: {} {} {}\t"), chan.id, p[0], p[1], p[2]);
|
fmt::print(stderr, FMT_STRING("{} T: {} {} {}\t"), chan.id, p[0], p[1], p[2]);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ std::vector<std::vector<Value>> BitstreamReader::read(const atUint8* data, size_
|
||||||
p[2] += dequantize(data, chan.q[2]);
|
p[2] += dequantize(data, chan.q[2]);
|
||||||
kit->push_back({p[0] * scaleMult, p[1] * scaleMult, p[2] * scaleMult});
|
kit->push_back({p[0] * scaleMult, p[1] * scaleMult, p[2] * scaleMult});
|
||||||
#if DUMP_KEYS
|
#if DUMP_KEYS
|
||||||
fmt::print(stderr, fmt("{} S: {} {} {}\t"), chan.id, p[0], p[1], p[2]);
|
fmt::print(stderr, FMT_STRING("{} S: {} {} {}\t"), chan.id, p[0], p[1], p[2]);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ void AROTBuilder::Node::nodeCount(size_t& sz, size_t& idxRefs, BitmapPool& bmpPo
|
||||||
sz += 1;
|
sz += 1;
|
||||||
poolIdx = bmpPool.addIndices(childIndices);
|
poolIdx = bmpPool.addIndices(childIndices);
|
||||||
if (poolIdx > 65535)
|
if (poolIdx > 65535)
|
||||||
Log.report(logvisor::Fatal, fmt("AROT bitmap exceeds 16-bit node addressing; area too complex"));
|
Log.report(logvisor::Fatal, FMT_STRING("AROT bitmap exceeds 16-bit node addressing; area too complex"));
|
||||||
|
|
||||||
uint32_t childCount = AROTChildCounts[compSubdivs];
|
uint32_t childCount = AROTChildCounts[compSubdivs];
|
||||||
nodeOff = curOff;
|
nodeOff = curOff;
|
||||||
|
@ -180,7 +180,7 @@ void AROTBuilder::Node::writeNodes(athena::io::MemoryWriter& w, int nodeIdx) {
|
||||||
if (childNodes.size()) {
|
if (childNodes.size()) {
|
||||||
int curIdx = nodeIdx + 1;
|
int curIdx = nodeIdx + 1;
|
||||||
if (curIdx > 65535)
|
if (curIdx > 65535)
|
||||||
Log.report(logvisor::Fatal, fmt("AROT node exceeds 16-bit node addressing; area too complex"));
|
Log.report(logvisor::Fatal, FMT_STRING("AROT node exceeds 16-bit node addressing; area too complex"));
|
||||||
|
|
||||||
std::array<int, 8> childIndices;
|
std::array<int, 8> childIndices;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ bool ATBL::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
|
||||||
uint16_t idx = rs.readUint16Big();
|
uint16_t idx = rs.readUint16Big();
|
||||||
if (idx == 0xffff)
|
if (idx == 0xffff)
|
||||||
continue;
|
continue;
|
||||||
w.writeUint16(fmt::format(fmt("0x{:04X}"), i), idx);
|
w.writeUint16(fmt::format(FMT_STRING("0x{:04X}"), i), idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
athena::io::FileWriter fw(outPath.getAbsolutePath());
|
athena::io::FileWriter fw(outPath.getAbsolutePath());
|
||||||
|
|
|
@ -18,13 +18,13 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os, const BabeDeadLi
|
||||||
switch (light.lightType) {
|
switch (light.lightType) {
|
||||||
case BabeDeadLight::LightType::LocalAmbient:
|
case BabeDeadLight::LightType::LocalAmbient:
|
||||||
case BabeDeadLight::LightType::LocalAmbient2:
|
case BabeDeadLight::LightType::LocalAmbient2:
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"bg_node.inputs[0].default_value = ({},{},{},1.0)\n"
|
"bg_node.inputs[0].default_value = ({},{},{},1.0)\n"
|
||||||
"bg_node.inputs[1].default_value = {}\n"),
|
"bg_node.inputs[1].default_value = {}\n"),
|
||||||
light.color.simd[0], light.color.simd[1], light.color.simd[2], light.q / 8.f);
|
light.color.simd[0], light.color.simd[1], light.color.simd[2], light.q / 8.f);
|
||||||
return;
|
return;
|
||||||
case BabeDeadLight::LightType::Directional:
|
case BabeDeadLight::LightType::Directional:
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'SUN')\n"
|
"lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'SUN')\n"
|
||||||
"lamp.color = ({},{},{})\n"
|
"lamp.color = ({},{},{})\n"
|
||||||
"lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n"
|
"lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n"
|
||||||
|
@ -36,7 +36,7 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os, const BabeDeadLi
|
||||||
light.direction.simd[1], light.direction.simd[2], light.castShadows ? "True" : "False");
|
light.direction.simd[1], light.direction.simd[2], light.castShadows ? "True" : "False");
|
||||||
return;
|
return;
|
||||||
case BabeDeadLight::LightType::Custom:
|
case BabeDeadLight::LightType::Custom:
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'POINT')\n"
|
"lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'POINT')\n"
|
||||||
"lamp.color = ({},{},{})\n"
|
"lamp.color = ({},{},{})\n"
|
||||||
"lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n"
|
"lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n"
|
||||||
|
@ -48,7 +48,7 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os, const BabeDeadLi
|
||||||
break;
|
break;
|
||||||
case BabeDeadLight::LightType::Spot:
|
case BabeDeadLight::LightType::Spot:
|
||||||
case BabeDeadLight::LightType::Spot2:
|
case BabeDeadLight::LightType::Spot2:
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'SPOT')\n"
|
"lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'SPOT')\n"
|
||||||
"lamp.color = ({},{},{})\n"
|
"lamp.color = ({},{},{})\n"
|
||||||
"lamp.spot_size = {:.6g}\n"
|
"lamp.spot_size = {:.6g}\n"
|
||||||
|
@ -66,7 +66,7 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os, const BabeDeadLi
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"lamp.retro_layer = {}\n"
|
"lamp.retro_layer = {}\n"
|
||||||
"lamp.retro_origtype = {}\n"
|
"lamp.retro_origtype = {}\n"
|
||||||
"lamp.falloff_type = 'INVERSE_COEFFICIENTS'\n"
|
"lamp.falloff_type = 'INVERSE_COEFFICIENTS'\n"
|
||||||
|
@ -90,17 +90,17 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os, const BabeDeadLi
|
||||||
os << "falloff_node.inputs[0].default_value *= 150.0\n"
|
os << "falloff_node.inputs[0].default_value *= 150.0\n"
|
||||||
"lamp.node_tree.links.new(falloff_node.outputs[2], lamp.node_tree.nodes['Emission'].inputs[1])\n";
|
"lamp.node_tree.links.new(falloff_node.outputs[2], lamp.node_tree.nodes['Emission'].inputs[1])\n";
|
||||||
if (light.q > FLT_EPSILON)
|
if (light.q > FLT_EPSILON)
|
||||||
os.format(fmt("lamp.constant_coefficient = 2.0 / {}\n"), light.q);
|
os.format(FMT_STRING("lamp.constant_coefficient = 2.0 / {}\n"), light.q);
|
||||||
break;
|
break;
|
||||||
case BabeDeadLight::Falloff::Linear:
|
case BabeDeadLight::Falloff::Linear:
|
||||||
os << "lamp.node_tree.links.new(falloff_node.outputs[1], lamp.node_tree.nodes['Emission'].inputs[1])\n";
|
os << "lamp.node_tree.links.new(falloff_node.outputs[1], lamp.node_tree.nodes['Emission'].inputs[1])\n";
|
||||||
if (light.q > FLT_EPSILON)
|
if (light.q > FLT_EPSILON)
|
||||||
os.format(fmt("lamp.linear_coefficient = 250 / {}\n"), light.q);
|
os.format(FMT_STRING("lamp.linear_coefficient = 250 / {}\n"), light.q);
|
||||||
break;
|
break;
|
||||||
case BabeDeadLight::Falloff::Quadratic:
|
case BabeDeadLight::Falloff::Quadratic:
|
||||||
os << "lamp.node_tree.links.new(falloff_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[1])\n";
|
os << "lamp.node_tree.links.new(falloff_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[1])\n";
|
||||||
if (light.q > FLT_EPSILON)
|
if (light.q > FLT_EPSILON)
|
||||||
os.format(fmt("lamp.quadratic_coefficient = 25000 / {}\n"), light.q);
|
os.format(FMT_STRING("lamp.quadratic_coefficient = 25000 / {}\n"), light.q);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -84,7 +84,7 @@ void ReadMaterialSetToBlender_1_2(hecl::blender::PyOutStream& os, const Material
|
||||||
}
|
}
|
||||||
hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, tex);
|
hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, tex);
|
||||||
hecl::SystemUTF8Conv resPathView(resPath);
|
hecl::SystemUTF8Conv resPathView(resPath);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"if '{}' in bpy.data.images:\n"
|
"if '{}' in bpy.data.images:\n"
|
||||||
" image = bpy.data.images['{}']\n"
|
" image = bpy.data.images['{}']\n"
|
||||||
"else:\n"
|
"else:\n"
|
||||||
|
@ -148,7 +148,7 @@ public:
|
||||||
for (const std::pair<atUint16, std::vector<std::pair<atInt16, atUint16>>>& ev : m_extraVerts) {
|
for (const std::pair<atUint16, std::vector<std::pair<atInt16, atUint16>>>& ev : m_extraVerts) {
|
||||||
for (const std::pair<atInt16, atUint16>& se : ev.second) {
|
for (const std::pair<atInt16, atUint16>& se : ev.second) {
|
||||||
if (se.second == nextVert) {
|
if (se.second == nextVert) {
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"bm.verts.ensure_lookup_table()\n"
|
"bm.verts.ensure_lookup_table()\n"
|
||||||
"orig_vert = bm.verts[{}]\n"
|
"orig_vert = bm.verts[{}]\n"
|
||||||
"vert = bm.verts.new(orig_vert.co)\n"),
|
"vert = bm.verts.new(orig_vert.co)\n"),
|
||||||
|
@ -466,7 +466,7 @@ void InitGeomBlenderContext(hecl::blender::PyOutStream& os, const hecl::ProjectP
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
/* Link master shader library */
|
/* Link master shader library */
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"# Master shader library\n"
|
"# Master shader library\n"
|
||||||
"with bpy.data.libraries.load('{}', link=True, relative=True) as (data_from, data_to):\n"
|
"with bpy.data.libraries.load('{}', link=True, relative=True) as (data_from, data_to):\n"
|
||||||
" data_to.node_groups = data_from.node_groups\n"
|
" data_to.node_groups = data_from.node_groups\n"
|
||||||
|
@ -485,13 +485,13 @@ void FinishBlenderMesh(hecl::blender::PyOutStream& os, unsigned matSetCount, int
|
||||||
"obj = bpy.data.objects.new(mesh.name, mesh)\n"
|
"obj = bpy.data.objects.new(mesh.name, mesh)\n"
|
||||||
"obj.show_transparent = True\n"
|
"obj.show_transparent = True\n"
|
||||||
"coll.objects.link(obj)\n";
|
"coll.objects.link(obj)\n";
|
||||||
os.format(fmt("mesh.hecl_material_count = {}\n"), matSetCount);
|
os.format(FMT_STRING("mesh.hecl_material_count = {}\n"), matSetCount);
|
||||||
} else {
|
} else {
|
||||||
os.format(fmt("mesh = bpy.data.meshes.new(bpy.context.scene.name + '_{:03d}')\n"), meshIdx);
|
os.format(FMT_STRING("mesh = bpy.data.meshes.new(bpy.context.scene.name + '_{:03d}')\n"), meshIdx);
|
||||||
os << "obj = bpy.data.objects.new(mesh.name, mesh)\n"
|
os << "obj = bpy.data.objects.new(mesh.name, mesh)\n"
|
||||||
"obj.show_transparent = True\n"
|
"obj.show_transparent = True\n"
|
||||||
"coll.objects.link(obj)\n";
|
"coll.objects.link(obj)\n";
|
||||||
os.format(fmt("mesh.hecl_material_count = {}\n"), matSetCount);
|
os.format(FMT_STRING("mesh.hecl_material_count = {}\n"), matSetCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "mesh.use_auto_smooth = True\n"
|
os << "mesh.use_auto_smooth = True\n"
|
||||||
|
@ -701,7 +701,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
for (atUint16 i = 0; i <= maxIdxs.pos; ++i) {
|
for (atUint16 i = 0; i <= maxIdxs.pos; ++i) {
|
||||||
positions.push_back(reader.readVec3fBig());
|
positions.push_back(reader.readVec3fBig());
|
||||||
const atVec3f& pos = positions.back();
|
const atVec3f& pos = positions.back();
|
||||||
os.format(fmt("vert = bm.verts.new(({},{},{}))\n"), pos.simd[0], pos.simd[1], pos.simd[2]);
|
os.format(FMT_STRING("vert = bm.verts.new(({},{},{}))\n"), pos.simd[0], pos.simd[1], pos.simd[2]);
|
||||||
if (rp.first.second) {
|
if (rp.first.second) {
|
||||||
if (SurfaceHeader::UseMatrixSkinning() && !skinIndices.empty())
|
if (SurfaceHeader::UseMatrixSkinning() && !skinIndices.empty())
|
||||||
rp.first.second->weightVertex(os, *rp.second.second, skinIndices[i]);
|
rp.first.second->weightVertex(os, *rp.second.second, skinIndices[i]);
|
||||||
|
@ -711,10 +711,10 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
}
|
}
|
||||||
if (rp.first.second && SurfaceHeader::UseMatrixSkinning() && !skinIndices.empty())
|
if (rp.first.second && SurfaceHeader::UseMatrixSkinning() && !skinIndices.empty())
|
||||||
vertCount += extraTracker.sendAdditionalVertsToBlender(os, rp, 0);
|
vertCount += extraTracker.sendAdditionalVertsToBlender(os, rp, 0);
|
||||||
os.format(fmt("two_face_vert = {}\n"), vertCount);
|
os.format(FMT_STRING("two_face_vert = {}\n"), vertCount);
|
||||||
for (atUint16 i = 0; i <= maxIdxs.pos; ++i) {
|
for (atUint16 i = 0; i <= maxIdxs.pos; ++i) {
|
||||||
const atVec3f& pos = positions[i];
|
const atVec3f& pos = positions[i];
|
||||||
os.format(fmt("vert = bm.verts.new(({},{},{}))\n"), pos.simd[0], pos.simd[1], pos.simd[2]);
|
os.format(FMT_STRING("vert = bm.verts.new(({},{},{}))\n"), pos.simd[0], pos.simd[1], pos.simd[2]);
|
||||||
if (rp.first.second) {
|
if (rp.first.second) {
|
||||||
if (SurfaceHeader::UseMatrixSkinning() && !skinIndices.empty())
|
if (SurfaceHeader::UseMatrixSkinning() && !skinIndices.empty())
|
||||||
rp.first.second->weightVertex(os, *rp.second.second, skinIndices[i]);
|
rp.first.second->weightVertex(os, *rp.second.second, skinIndices[i]);
|
||||||
|
@ -735,13 +735,13 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
float x = reader.readInt16Big() / 16384.0f;
|
float x = reader.readInt16Big() / 16384.0f;
|
||||||
float y = reader.readInt16Big() / 16384.0f;
|
float y = reader.readInt16Big() / 16384.0f;
|
||||||
float z = reader.readInt16Big() / 16384.0f;
|
float z = reader.readInt16Big() / 16384.0f;
|
||||||
os.format(fmt("norm_list.append(({},{},{}))\n"), x, y, z);
|
os.format(FMT_STRING("norm_list.append(({},{},{}))\n"), x, y, z);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
atUint32 normCount = secSizes[s] / 12;
|
atUint32 normCount = secSizes[s] / 12;
|
||||||
for (atUint32 i = 0; i < normCount; ++i) {
|
for (atUint32 i = 0; i < normCount; ++i) {
|
||||||
const atVec3f norm = reader.readVec3fBig();
|
const atVec3f norm = reader.readVec3fBig();
|
||||||
os.format(fmt("norm_list.append(({},{},{}))\n"), norm.simd[0], norm.simd[1], norm.simd[2]);
|
os.format(FMT_STRING("norm_list.append(({},{},{}))\n"), norm.simd[0], norm.simd[1], norm.simd[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -756,7 +756,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
atUint32 uvCount = secSizes[s] / 8;
|
atUint32 uvCount = secSizes[s] / 8;
|
||||||
for (atUint32 i = 0; i < uvCount; ++i) {
|
for (atUint32 i = 0; i < uvCount; ++i) {
|
||||||
const atVec2f uv = reader.readVec2fBig();
|
const atVec2f uv = reader.readVec2fBig();
|
||||||
os.format(fmt("uv_list.append(({},{}))\n"), uv.simd[0], uv.simd[1]);
|
os.format(FMT_STRING("uv_list.append(({},{}))\n"), uv.simd[0], uv.simd[1]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -772,7 +772,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
for (atUint32 i = 0; i < uvCount; ++i) {
|
for (atUint32 i = 0; i < uvCount; ++i) {
|
||||||
float x = reader.readInt16Big() / 32768.0f;
|
float x = reader.readInt16Big() / 32768.0f;
|
||||||
float y = reader.readInt16Big() / 32768.0f;
|
float y = reader.readInt16Big() / 32768.0f;
|
||||||
os.format(fmt("suv_list.append(({},{}))\n"), x, y);
|
os.format(FMT_STRING("suv_list.append(({},{}))\n"), x, y);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -799,10 +799,10 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
if (SurfaceHeader::UseMatrixSkinning() && rp.first.second)
|
if (SurfaceHeader::UseMatrixSkinning() && rp.first.second)
|
||||||
bankIn = rp.first.second->getMatrixBank(sHead.skinMatrixBankIdx());
|
bankIn = rp.first.second->getMatrixBank(sHead.skinMatrixBankIdx());
|
||||||
|
|
||||||
os.format(fmt("materials[{}].pass_index = {}\n"), sHead.matIdx, surfIdx++);
|
os.format(FMT_STRING("materials[{}].pass_index = {}\n"), sHead.matIdx, surfIdx++);
|
||||||
if (matUVCount > createdUVLayers) {
|
if (matUVCount > createdUVLayers) {
|
||||||
for (unsigned l = createdUVLayers; l < matUVCount; ++l)
|
for (unsigned l = createdUVLayers; l < matUVCount; ++l)
|
||||||
os.format(fmt("bm.loops.layers.uv.new('UV_{}')\n"), l);
|
os.format(FMT_STRING("bm.loops.layers.uv.new('UV_{}')\n"), l);
|
||||||
createdUVLayers = matUVCount;
|
createdUVLayers = matUVCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,7 +824,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
atUint8 flip = 0;
|
atUint8 flip = 0;
|
||||||
for (int v = 0; v < vertCount - 2; ++v) {
|
for (int v = 0; v < vertCount - 2; ++v) {
|
||||||
if (flip) {
|
if (flip) {
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, "
|
"last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, "
|
||||||
"two_face_vert)\n"),
|
"two_face_vert)\n"),
|
||||||
primVerts[c % 3].pos, primVerts[(c + 2) % 3].pos, primVerts[(c + 1) % 3].pos, primVerts[c % 3].norm,
|
primVerts[c % 3].pos, primVerts[(c + 2) % 3].pos, primVerts[(c + 1) % 3].pos, primVerts[c % 3].norm,
|
||||||
|
@ -833,7 +833,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
os << "if last_face is not None:\n";
|
os << "if last_face is not None:\n";
|
||||||
for (unsigned j = 0; j < matUVCount; ++j) {
|
for (unsigned j = 0; j < matUVCount; ++j) {
|
||||||
if (j == 0 && matShortUVs)
|
if (j == 0 && matShortUVs)
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], "
|
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], "
|
||||||
"suv_list[{}])\n"
|
"suv_list[{}])\n"
|
||||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||||
|
@ -845,7 +845,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
primVerts[c % 3].uvs[j], primVerts[(c + 2) % 3].uvs[j], primVerts[(c + 1) % 3].uvs[j],
|
primVerts[c % 3].uvs[j], primVerts[(c + 2) % 3].uvs[j], primVerts[(c + 1) % 3].uvs[j],
|
||||||
primVerts[c % 3].pos, j, primVerts[(c + 2) % 3].pos, j, primVerts[(c + 1) % 3].pos, j);
|
primVerts[c % 3].pos, j, primVerts[(c + 2) % 3].pos, j, primVerts[(c + 1) % 3].pos, j);
|
||||||
else
|
else
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||||
"uv_list[{}]\n"
|
"uv_list[{}]\n"
|
||||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||||
|
@ -857,7 +857,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, "
|
"last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, "
|
||||||
"two_face_vert)\n"),
|
"two_face_vert)\n"),
|
||||||
primVerts[c % 3].pos, primVerts[(c + 1) % 3].pos, primVerts[(c + 2) % 3].pos, primVerts[c % 3].norm,
|
primVerts[c % 3].pos, primVerts[(c + 1) % 3].pos, primVerts[(c + 2) % 3].pos, primVerts[c % 3].norm,
|
||||||
|
@ -866,7 +866,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
os << "if last_face is not None:\n";
|
os << "if last_face is not None:\n";
|
||||||
for (unsigned j = 0; j < matUVCount; ++j) {
|
for (unsigned j = 0; j < matUVCount; ++j) {
|
||||||
if (j == 0 && matShortUVs)
|
if (j == 0 && matShortUVs)
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], "
|
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], "
|
||||||
"suv_list[{}])\n"
|
"suv_list[{}])\n"
|
||||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||||
|
@ -878,7 +878,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
primVerts[c % 3].uvs[j], primVerts[(c + 1) % 3].uvs[j], primVerts[(c + 2) % 3].uvs[j],
|
primVerts[c % 3].uvs[j], primVerts[(c + 1) % 3].uvs[j], primVerts[(c + 2) % 3].uvs[j],
|
||||||
primVerts[c % 3].pos, j, primVerts[(c + 1) % 3].pos, j, primVerts[(c + 2) % 3].pos, j);
|
primVerts[c % 3].pos, j, primVerts[(c + 1) % 3].pos, j, primVerts[(c + 2) % 3].pos, j);
|
||||||
else
|
else
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||||
"uv_list[{}]\n"
|
"uv_list[{}]\n"
|
||||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||||
|
@ -901,7 +901,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
} else if (ptype == GX::TRIANGLES) {
|
} else if (ptype == GX::TRIANGLES) {
|
||||||
for (int v = 0; v < vertCount; v += 3) {
|
for (int v = 0; v < vertCount; v += 3) {
|
||||||
|
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, "
|
"last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, "
|
||||||
"two_face_vert)\n"),
|
"two_face_vert)\n"),
|
||||||
primVerts[0].pos, primVerts[1].pos, primVerts[2].pos, primVerts[0].norm, primVerts[1].norm,
|
primVerts[0].pos, primVerts[1].pos, primVerts[2].pos, primVerts[0].norm, primVerts[1].norm,
|
||||||
|
@ -910,7 +910,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
os << "if last_face is not None:\n";
|
os << "if last_face is not None:\n";
|
||||||
for (unsigned j = 0; j < matUVCount; ++j) {
|
for (unsigned j = 0; j < matUVCount; ++j) {
|
||||||
if (j == 0 && matShortUVs)
|
if (j == 0 && matShortUVs)
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], "
|
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], "
|
||||||
"suv_list[{}])\n"
|
"suv_list[{}])\n"
|
||||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||||
|
@ -922,7 +922,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
primVerts[0].uvs[j], primVerts[1].uvs[j], primVerts[2].uvs[j], primVerts[0].pos, j,
|
primVerts[0].uvs[j], primVerts[1].uvs[j], primVerts[2].uvs[j], primVerts[0].pos, j,
|
||||||
primVerts[1].pos, j, primVerts[2].pos, j);
|
primVerts[1].pos, j, primVerts[2].pos, j);
|
||||||
else
|
else
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||||
"uv_list[{}]\n"
|
"uv_list[{}]\n"
|
||||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||||
|
@ -945,7 +945,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
} else if (ptype == GX::TRIANGLEFAN) {
|
} else if (ptype == GX::TRIANGLEFAN) {
|
||||||
++c;
|
++c;
|
||||||
for (int v = 0; v < vertCount - 2; ++v) {
|
for (int v = 0; v < vertCount - 2; ++v) {
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, "
|
"last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, "
|
||||||
"two_face_vert)\n"),
|
"two_face_vert)\n"),
|
||||||
firstPrimVert.pos, primVerts[c % 3].pos, primVerts[(c + 1) % 3].pos, firstPrimVert.norm,
|
firstPrimVert.pos, primVerts[c % 3].pos, primVerts[(c + 1) % 3].pos, firstPrimVert.norm,
|
||||||
|
@ -954,7 +954,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
os << "if last_face is not None:\n";
|
os << "if last_face is not None:\n";
|
||||||
for (unsigned j = 0; j < matUVCount; ++j) {
|
for (unsigned j = 0; j < matUVCount; ++j) {
|
||||||
if (j == 0 && matShortUVs)
|
if (j == 0 && matShortUVs)
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], "
|
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], "
|
||||||
"suv_list[{}])\n"
|
"suv_list[{}])\n"
|
||||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||||
|
@ -966,7 +966,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
firstPrimVert.uvs[j], primVerts[c % 3].uvs[j], primVerts[(c + 1) % 3].uvs[j], firstPrimVert.pos,
|
firstPrimVert.uvs[j], primVerts[c % 3].uvs[j], primVerts[(c + 1) % 3].uvs[j], firstPrimVert.pos,
|
||||||
j, primVerts[c % 3].pos, j, primVerts[(c + 1) % 3].pos, j);
|
j, primVerts[c % 3].pos, j, primVerts[(c + 1) % 3].pos, j);
|
||||||
else
|
else
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||||
"uv_list[{}]\n"
|
"uv_list[{}]\n"
|
||||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||||
|
@ -1002,7 +1002,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
||||||
FinishBlenderMesh(os, matSetCount, meshIdx);
|
FinishBlenderMesh(os, matSetCount, meshIdx);
|
||||||
|
|
||||||
if (rp.first.second) {
|
if (rp.first.second) {
|
||||||
os.format(fmt("mesh.cskr_id = '{}'\n"), rp.first.first);
|
os.format(FMT_STRING("mesh.cskr_id = '{}'\n"), rp.first.first);
|
||||||
rp.second.second->sendVertexGroupsToBlender(os);
|
rp.second.second->sendVertexGroupsToBlender(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1016,18 +1016,18 @@ bool ReadCMDLToBlender(hecl::blender::Connection& conn, athena::io::IStreamReade
|
||||||
head.read(reader);
|
head.read(reader);
|
||||||
|
|
||||||
if (head.magic != 0xDEADBABE) {
|
if (head.magic != 0xDEADBABE) {
|
||||||
LogDNACommon.report(logvisor::Error, fmt("invalid CMDL magic"));
|
LogDNACommon.report(logvisor::Error, FMT_STRING("invalid CMDL magic"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (head.version != Version) {
|
if (head.version != Version) {
|
||||||
LogDNACommon.report(logvisor::Error, fmt("invalid CMDL version"));
|
LogDNACommon.report(logvisor::Error, FMT_STRING("invalid CMDL version"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open Py Stream and read sections */
|
/* Open Py Stream and read sections */
|
||||||
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"import bpy\n"
|
"import bpy\n"
|
||||||
"import bmesh\n"
|
"import bmesh\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -1078,7 +1078,7 @@ void NameCMDL(athena::io::IStreamReader& reader, PAKRouter& pakRouter, typename
|
||||||
const SpecBase& dataspec) {
|
const SpecBase& dataspec) {
|
||||||
Header head;
|
Header head;
|
||||||
head.read(reader);
|
head.read(reader);
|
||||||
std::string bestName = fmt::format(fmt("CMDL_{}"), entry.id);
|
std::string bestName = fmt::format(FMT_STRING("CMDL_{}"), entry.id);
|
||||||
|
|
||||||
/* Pre-read pass to determine maximum used vert indices */
|
/* Pre-read pass to determine maximum used vert indices */
|
||||||
atUint32 matSecCount = 0;
|
atUint32 matSecCount = 0;
|
||||||
|
@ -1152,7 +1152,7 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
|
||||||
|
|
||||||
size_t endOff = 0;
|
size_t endOff = 0;
|
||||||
for (const Material& mat : mset) {
|
for (const Material& mat : mset) {
|
||||||
std::string diagName = fmt::format(fmt("{}:{}"), inPath.getLastComponentUTF8(), mat.name);
|
std::string diagName = fmt::format(FMT_STRING("{}:{}"), inPath.getLastComponentUTF8(), mat.name);
|
||||||
hecl::Frontend::IR matIR = FE.compileSource(mat.source, diagName);
|
hecl::Frontend::IR matIR = FE.compileSource(mat.source, diagName);
|
||||||
setBackends.emplace_back();
|
setBackends.emplace_back();
|
||||||
hecl::Backend::GX& matGX = setBackends.back();
|
hecl::Backend::GX& matGX = setBackends.back();
|
||||||
|
@ -1245,7 +1245,7 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
|
||||||
for (const Mesh::Surface& surf : mesh.surfaces) {
|
for (const Mesh::Surface& surf : mesh.surfaces) {
|
||||||
size_t vertSz = matSets.at(0).materials.at(surf.materialIdx).getVAFlags().vertDLSize();
|
size_t vertSz = matSets.at(0).materials.at(surf.materialIdx).getVAFlags().vertDLSize();
|
||||||
if (surf.verts.size() > 65536)
|
if (surf.verts.size() > 65536)
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("GX DisplayList overflow"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("GX DisplayList overflow"));
|
||||||
size_t secSz = 64;
|
size_t secSz = 64;
|
||||||
for (auto it = surf.verts.cbegin(); it != surf.verts.cend();) {
|
for (auto it = surf.verts.cbegin(); it != surf.verts.cend();) {
|
||||||
atUint16 vertCount = 0;
|
atUint16 vertCount = 0;
|
||||||
|
@ -1339,7 +1339,7 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
|
||||||
else if (mesh.topology == hecl::HMDLTopology::TriStrips)
|
else if (mesh.topology == hecl::HMDLTopology::TriStrips)
|
||||||
prim = GX::TRIANGLESTRIP;
|
prim = GX::TRIANGLESTRIP;
|
||||||
else
|
else
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("unrecognized mesh output mode"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("unrecognized mesh output mode"));
|
||||||
auto surfSizeIt = head.secSizes.begin() + firstSurfSec;
|
auto surfSizeIt = head.secSizes.begin() + firstSurfSec;
|
||||||
for (const Mesh::Surface& surf : mesh.surfaces) {
|
for (const Mesh::Surface& surf : mesh.surfaces) {
|
||||||
const typename MaterialSet::Material::VAFlags& vaFlags = matSets.at(0).materials.at(surf.materialIdx).getVAFlags();
|
const typename MaterialSet::Material::VAFlags& vaFlags = matSets.at(0).materials.at(surf.materialIdx).getVAFlags();
|
||||||
|
@ -1787,7 +1787,7 @@ bool WriteMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::Proje
|
||||||
else if (mesh.topology == hecl::HMDLTopology::TriStrips)
|
else if (mesh.topology == hecl::HMDLTopology::TriStrips)
|
||||||
prim = GX::TRIANGLESTRIP;
|
prim = GX::TRIANGLESTRIP;
|
||||||
else
|
else
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("unrecognized mesh output mode"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("unrecognized mesh output mode"));
|
||||||
auto surfEndOffIt = surfEndOffs.begin();
|
auto surfEndOffIt = surfEndOffs.begin();
|
||||||
size_t lastEndOff = 0;
|
size_t lastEndOff = 0;
|
||||||
for (const Mesh::Surface& surf : mesh.surfaces) {
|
for (const Mesh::Surface& surf : mesh.surfaces) {
|
||||||
|
|
|
@ -26,11 +26,11 @@ hecl::ProjectPath UniqueIDBridge::TranslatePakIdToPath(const IDType& id, bool si
|
||||||
if (!project) {
|
if (!project) {
|
||||||
if (pakRouter) {
|
if (pakRouter) {
|
||||||
if (hecl::VerbosityLevel >= 1 && !silenceWarnings && id.isValid())
|
if (hecl::VerbosityLevel >= 1 && !silenceWarnings && id.isValid())
|
||||||
LogDNACommon.report(logvisor::Warning, fmt("unable to translate {} to path"), id);
|
LogDNACommon.report(logvisor::Warning, FMT_STRING("unable to translate {} to path"), id);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
LogDNACommon.report(logvisor::Fatal,
|
LogDNACommon.report(logvisor::Fatal,
|
||||||
fmt("g_PakRouter or s_Project must be set to non-null before "
|
FMT_STRING("g_PakRouter or s_Project must be set to non-null before "
|
||||||
"calling UniqueIDBridge::TranslatePakIdToPath"));
|
"calling UniqueIDBridge::TranslatePakIdToPath"));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ hecl::ProjectPath UniqueIDBridge::TranslatePakIdToPath(const IDType& id, bool si
|
||||||
const hecl::ProjectPath* search = project->lookupBridgePath(id.toUint64());
|
const hecl::ProjectPath* search = project->lookupBridgePath(id.toUint64());
|
||||||
if (!search) {
|
if (!search) {
|
||||||
if (hecl::VerbosityLevel >= 1 && !silenceWarnings && id.isValid())
|
if (hecl::VerbosityLevel >= 1 && !silenceWarnings && id.isValid())
|
||||||
LogDNACommon.report(logvisor::Warning, fmt("unable to translate {} to path"), id);
|
LogDNACommon.report(logvisor::Warning, FMT_STRING("unable to translate {} to path"), id);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return *search;
|
return *search;
|
||||||
|
@ -53,7 +53,7 @@ hecl::ProjectPath UniqueIDBridge::MakePathFromString(std::string_view str) {
|
||||||
return {};
|
return {};
|
||||||
hecl::Database::Project* project = s_Project.get();
|
hecl::Database::Project* project = s_Project.get();
|
||||||
if (!project)
|
if (!project)
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("UniqueIDBridge::setGlobalProject must be called before MakePathFromString"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("UniqueIDBridge::setGlobalProject must be called before MakePathFromString"));
|
||||||
hecl::ProjectPath path = hecl::ProjectPath(*project, str);
|
hecl::ProjectPath path = hecl::ProjectPath(*project, str);
|
||||||
project->addBridgePathToCache(IDType(path).toUint64(), path);
|
project->addBridgePathToCache(IDType(path).toUint64(), path);
|
||||||
return path;
|
return path;
|
||||||
|
@ -91,7 +91,7 @@ void UniqueID32::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UniqueID32::toString() const {
|
std::string UniqueID32::toString() const {
|
||||||
return fmt::format(fmt("{}"), *this);
|
return fmt::format(FMT_STRING("{}"), *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
@ -143,7 +143,7 @@ void UniqueID64::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UniqueID64::toString() const {
|
std::string UniqueID64::toString() const {
|
||||||
return fmt::format(fmt("{}"), *this);
|
return fmt::format(FMT_STRING("{}"), *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PAK 128-bit Unique ID */
|
/** PAK 128-bit Unique ID */
|
||||||
|
@ -176,7 +176,7 @@ void UniqueID128::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UniqueID128::toString() const {
|
std::string UniqueID128::toString() const {
|
||||||
return fmt::format(fmt("{}"), *this);
|
return fmt::format(FMT_STRING("{}"), *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Word Bitmap reader/writer */
|
/** Word Bitmap reader/writer */
|
||||||
|
|
|
@ -79,15 +79,15 @@ public:
|
||||||
PAKRouterBase(const SpecBase& dataSpec) : m_dataSpec(dataSpec) {}
|
PAKRouterBase(const SpecBase& dataSpec) : m_dataSpec(dataSpec) {}
|
||||||
hecl::Database::Project& getProject() const { return m_dataSpec.getProject(); }
|
hecl::Database::Project& getProject() const { return m_dataSpec.getProject(); }
|
||||||
virtual hecl::ProjectPath getWorking(const UniqueID32&, bool silenceWarnings = false) const {
|
virtual hecl::ProjectPath getWorking(const UniqueID32&, bool silenceWarnings = false) const {
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter IDType mismatch; expected UniqueID32 specialization"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter IDType mismatch; expected UniqueID32 specialization"));
|
||||||
return hecl::ProjectPath();
|
return hecl::ProjectPath();
|
||||||
}
|
}
|
||||||
virtual hecl::ProjectPath getWorking(const UniqueID64&, bool silenceWarnings = false) const {
|
virtual hecl::ProjectPath getWorking(const UniqueID64&, bool silenceWarnings = false) const {
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter IDType mismatch; expected UniqueID64 specialization"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter IDType mismatch; expected UniqueID64 specialization"));
|
||||||
return hecl::ProjectPath();
|
return hecl::ProjectPath();
|
||||||
}
|
}
|
||||||
virtual hecl::ProjectPath getWorking(const UniqueID128&, bool silenceWarnings = false) const {
|
virtual hecl::ProjectPath getWorking(const UniqueID128&, bool silenceWarnings = false) const {
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter IDType mismatch; expected UniqueID128 specialization"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter IDType mismatch; expected UniqueID128 specialization"));
|
||||||
return hecl::ProjectPath();
|
return hecl::ProjectPath();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,7 +22,7 @@ void DeafBabeSendToBlender(hecl::blender::PyOutStream& os, const DEAFBABE& db, b
|
||||||
"col_bm = bmesh.new()\n";
|
"col_bm = bmesh.new()\n";
|
||||||
for (const atVec3f& vert : db.verts) {
|
for (const atVec3f& vert : db.verts) {
|
||||||
zeus::simd_floats f(vert.simd);
|
zeus::simd_floats f(vert.simd);
|
||||||
os.format(fmt("col_bm.verts.new(({},{},{}))\n"), f[0], f[1], f[2]);
|
os.format(FMT_STRING("col_bm.verts.new(({},{},{}))\n"), f[0], f[1], f[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "col_bm.verts.ensure_lookup_table()\n";
|
os << "col_bm.verts.ensure_lookup_table()\n";
|
||||||
|
@ -49,11 +49,11 @@ void DeafBabeSendToBlender(hecl::blender::PyOutStream& os, const DEAFBABE& db, b
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "tri_verts = []\n";
|
os << "tri_verts = []\n";
|
||||||
os.format(fmt("tri_verts.append(col_bm.verts[{}])\n"), vindices[0]);
|
os.format(FMT_STRING("tri_verts.append(col_bm.verts[{}])\n"), vindices[0]);
|
||||||
os.format(fmt("tri_verts.append(col_bm.verts[{}])\n"), vindices[1]);
|
os.format(FMT_STRING("tri_verts.append(col_bm.verts[{}])\n"), vindices[1]);
|
||||||
os.format(fmt("tri_verts.append(col_bm.verts[{}])\n"), vindices[2]);
|
os.format(FMT_STRING("tri_verts.append(col_bm.verts[{}])\n"), vindices[2]);
|
||||||
|
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"face = col_bm.faces.get(tri_verts)\n"
|
"face = col_bm.faces.get(tri_verts)\n"
|
||||||
"if face is None:\n"
|
"if face is None:\n"
|
||||||
" face = col_bm.faces.new(tri_verts)\n"
|
" face = col_bm.faces.new(tri_verts)\n"
|
||||||
|
@ -72,7 +72,7 @@ void DeafBabeSendToBlender(hecl::blender::PyOutStream& os, const DEAFBABE& db, b
|
||||||
db.insertNoClimb(os);
|
db.insertNoClimb(os);
|
||||||
|
|
||||||
if (isDcln)
|
if (isDcln)
|
||||||
os.format(fmt("col_mesh = bpy.data.meshes.new('CMESH_{}')\n"), idx);
|
os.format(FMT_STRING("col_mesh = bpy.data.meshes.new('CMESH_{}')\n"), idx);
|
||||||
else
|
else
|
||||||
os << "col_mesh = bpy.data.meshes.new('CMESH')\n";
|
os << "col_mesh = bpy.data.meshes.new('CMESH')\n";
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ void FONT<IDType>::_read(athena::io::IStreamReader& __dna_reader) {
|
||||||
DNAFourCC magic;
|
DNAFourCC magic;
|
||||||
magic.read(__dna_reader);
|
magic.read(__dna_reader);
|
||||||
if (magic != SBIG('FONT')) {
|
if (magic != SBIG('FONT')) {
|
||||||
LogModule.report(logvisor::Fatal, fmt("Invalid FONT magic '{}'"), magic);
|
LogModule.report(logvisor::Fatal, FMT_STRING("Invalid FONT magic '{}'"), magic);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* version */
|
/* version */
|
||||||
|
|
|
@ -16,7 +16,7 @@ template <class Op>
|
||||||
void FSM2<IDType>::Enumerate(typename Op::StreamT& s) {
|
void FSM2<IDType>::Enumerate(typename Op::StreamT& s) {
|
||||||
Do<Op>(athena::io::PropId{"header"}, header, s);
|
Do<Op>(athena::io::PropId{"header"}, header, s);
|
||||||
if (header.magic != SBIG('FSM2')) {
|
if (header.magic != SBIG('FSM2')) {
|
||||||
LogDNAFSM2.report(logvisor::Fatal, fmt("Invalid FSM2 magic '{}' expected 'FSM2'"), header.magic);
|
LogDNAFSM2.report(logvisor::Fatal, FMT_STRING("Invalid FSM2 magic '{}' expected 'FSM2'"), header.magic);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ void FSM2<IDType>::Enumerate(typename Op::StreamT& s) {
|
||||||
detail.reset(new FSMV2);
|
detail.reset(new FSMV2);
|
||||||
Do<Op>(athena::io::PropId{"detail"}, static_cast<FSMV2&>(*detail), s);
|
Do<Op>(athena::io::PropId{"detail"}, static_cast<FSMV2&>(*detail), s);
|
||||||
} else {
|
} else {
|
||||||
LogDNAFSM2.report(logvisor::Fatal, fmt("Invalid FSM2 version '{}'"), header.version);
|
LogDNAFSM2.report(logvisor::Fatal, FMT_STRING("Invalid FSM2 version '{}'"), header.version);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ void MAPA::Enumerate<BigDNA::Read>(typename Read::StreamT& __dna_reader) {
|
||||||
/* magic */
|
/* magic */
|
||||||
magic = __dna_reader.readUint32Big();
|
magic = __dna_reader.readUint32Big();
|
||||||
if (magic != 0xDEADD00D) {
|
if (magic != 0xDEADD00D) {
|
||||||
LogDNACommon.report(logvisor::Error, fmt("invalid MAPA magic"));
|
LogDNACommon.report(logvisor::Error, FMT_STRING("invalid MAPA magic"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* version */
|
/* version */
|
||||||
|
@ -33,7 +33,7 @@ void MAPA::Enumerate<BigDNA::Read>(typename Read::StreamT& __dna_reader) {
|
||||||
else if (version == 5)
|
else if (version == 5)
|
||||||
header = std::make_unique<HeaderMP3>();
|
header = std::make_unique<HeaderMP3>();
|
||||||
else {
|
else {
|
||||||
LogDNACommon.report(logvisor::Error, fmt("invalid MAPA version"));
|
LogDNACommon.report(logvisor::Error, FMT_STRING("invalid MAPA version"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
||||||
" edge.seam = True\n"
|
" edge.seam = True\n"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"bpy.context.scene.name = 'MAPA_{}'\n"
|
"bpy.context.scene.name = 'MAPA_{}'\n"
|
||||||
"bpy.context.scene.retro_map_vis_mode = '{}'\n"),
|
"bpy.context.scene.retro_map_vis_mode = '{}'\n"),
|
||||||
entry.id, RetroMapVisModes[mapa.header->visMode()]);
|
entry.id, RetroMapVisModes[mapa.header->visMode()]);
|
||||||
|
@ -159,7 +159,7 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
||||||
zeus::simd_floats mtxF[3];
|
zeus::simd_floats mtxF[3];
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
moMP12->transformMtx[i].simd.copy_to(mtxF[i]);
|
moMP12->transformMtx[i].simd.copy_to(mtxF[i]);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"obj = bpy.data.objects.new('MAPOBJ_{:02d}', None)\n"
|
"obj = bpy.data.objects.new('MAPOBJ_{:02d}', None)\n"
|
||||||
"bpy.context.scene.collection.objects.link(obj)\n"
|
"bpy.context.scene.collection.objects.link(obj)\n"
|
||||||
"obj.retro_mappable_type = {}\n"
|
"obj.retro_mappable_type = {}\n"
|
||||||
|
@ -181,7 +181,7 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
||||||
zeus::simd_floats mtxF[3];
|
zeus::simd_floats mtxF[3];
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
moMP3->transformMtx[i].simd.copy_to(mtxF[i]);
|
moMP3->transformMtx[i].simd.copy_to(mtxF[i]);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"obj = bpy.data.objects.new('MAPOBJ_{:02d}', None)\n"
|
"obj = bpy.data.objects.new('MAPOBJ_{:02d}', None)\n"
|
||||||
"bpy.context.scene.collection.objects.link(obj)\n"
|
"bpy.context.scene.collection.objects.link(obj)\n"
|
||||||
"obj.retro_mappable_type = {}\n"
|
"obj.retro_mappable_type = {}\n"
|
||||||
|
@ -208,7 +208,7 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
||||||
/* Read in verts */
|
/* Read in verts */
|
||||||
for (const atVec3f& vert : mapa.vertices) {
|
for (const atVec3f& vert : mapa.vertices) {
|
||||||
zeus::simd_floats f(vert.simd);
|
zeus::simd_floats f(vert.simd);
|
||||||
os.format(fmt("bm.verts.new(({},{},{}))\n"), f[0], f[1], f[2]);
|
os.format(FMT_STRING("bm.verts.new(({},{},{}))\n"), f[0], f[1], f[2]);
|
||||||
}
|
}
|
||||||
os << "bm.verts.ensure_lookup_table()\n";
|
os << "bm.verts.ensure_lookup_table()\n";
|
||||||
|
|
||||||
|
@ -225,10 +225,10 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
||||||
atUint8 flip = 0;
|
atUint8 flip = 0;
|
||||||
for (size_t v = 0; v < prim.indexCount - 2; ++v) {
|
for (size_t v = 0; v < prim.indexCount - 2; ++v) {
|
||||||
if (flip) {
|
if (flip) {
|
||||||
os.format(fmt("add_triangle(bm, ({},{},{}))\n"), primVerts[c % 3], primVerts[(c + 2) % 3],
|
os.format(FMT_STRING("add_triangle(bm, ({},{},{}))\n"), primVerts[c % 3], primVerts[(c + 2) % 3],
|
||||||
primVerts[(c + 1) % 3]);
|
primVerts[(c + 1) % 3]);
|
||||||
} else {
|
} else {
|
||||||
os.format(fmt("add_triangle(bm, ({},{},{}))\n"), primVerts[c % 3], primVerts[(c + 1) % 3],
|
os.format(FMT_STRING("add_triangle(bm, ({},{},{}))\n"), primVerts[c % 3], primVerts[(c + 1) % 3],
|
||||||
primVerts[(c + 2) % 3]);
|
primVerts[(c + 2) % 3]);
|
||||||
}
|
}
|
||||||
flip ^= 1;
|
flip ^= 1;
|
||||||
|
@ -248,7 +248,7 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
||||||
}
|
}
|
||||||
} else if (GX::Primitive(prim.type) == GX::TRIANGLES) {
|
} else if (GX::Primitive(prim.type) == GX::TRIANGLES) {
|
||||||
for (size_t v = 0; v < prim.indexCount; v += 3) {
|
for (size_t v = 0; v < prim.indexCount; v += 3) {
|
||||||
os.format(fmt("add_triangle(bm, ({},{},{}))\n"), primVerts[0], primVerts[1], primVerts[2]);
|
os.format(FMT_STRING("add_triangle(bm, ({},{},{}))\n"), primVerts[0], primVerts[1], primVerts[2]);
|
||||||
|
|
||||||
/* Break if done */
|
/* Break if done */
|
||||||
if (v + 3 >= prim.indexCount)
|
if (v + 3 >= prim.indexCount)
|
||||||
|
@ -264,7 +264,7 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
||||||
for (const typename MAPA::Surface::Border& border : surf.borders) {
|
for (const typename MAPA::Surface::Border& border : surf.borders) {
|
||||||
auto iit = border.indices.cbegin();
|
auto iit = border.indices.cbegin();
|
||||||
for (size_t i = 0; i < border.indexCount - 1; ++i) {
|
for (size_t i = 0; i < border.indexCount - 1; ++i) {
|
||||||
os.format(fmt("add_border(bm, ({},{}))\n"), *iit, *(iit + 1));
|
os.format(FMT_STRING("add_border(bm, ({},{}))\n"), *iit, *(iit + 1));
|
||||||
++iit;
|
++iit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
||||||
|
|
||||||
const zeus::CMatrix4f* tmpMtx = pakRouter.lookupMAPATransform(entry.id);
|
const zeus::CMatrix4f* tmpMtx = pakRouter.lookupMAPATransform(entry.id);
|
||||||
const zeus::CMatrix4f& mtx = tmpMtx ? *tmpMtx : zeus::skIdentityMatrix4f;
|
const zeus::CMatrix4f& mtx = tmpMtx ? *tmpMtx : zeus::skIdentityMatrix4f;
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n"
|
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n"
|
||||||
"mtxd = mtx.decompose()\n"
|
"mtxd = mtx.decompose()\n"
|
||||||
"obj.rotation_mode = 'QUATERNION'\n"
|
"obj.rotation_mode = 'QUATERNION'\n"
|
||||||
|
@ -294,7 +294,7 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
||||||
if (hecl::StringUtils::BeginsWith(ent.m_name, _SYS_STR("!world_")) &&
|
if (hecl::StringUtils::BeginsWith(ent.m_name, _SYS_STR("!world_")) &&
|
||||||
hecl::StringUtils::EndsWith(ent.m_name, _SYS_STR(".blend"))) {
|
hecl::StringUtils::EndsWith(ent.m_name, _SYS_STR(".blend"))) {
|
||||||
hecl::SystemUTF8Conv conv(ent.m_name);
|
hecl::SystemUTF8Conv conv(ent.m_name);
|
||||||
os.linkBackground(fmt::format(fmt("//../{}"), conv), "World"sv);
|
os.linkBackground(fmt::format(FMT_STRING("//../{}"), conv), "World"sv);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,7 @@ template bool ReadMAPAToBlender<PAKRouter<DNAMP3::PAKBridge>>(hecl::blender::Con
|
||||||
template <typename MAPAType>
|
template <typename MAPAType>
|
||||||
bool Cook(const hecl::blender::MapArea& mapaIn, const hecl::ProjectPath& out) {
|
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, fmt(_SYS_STR("MAPA {} vertex range exceeded [{}/{}]")), out.getRelativePath(),
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("MAPA {} vertex range exceeded [{}/{}]")), out.getRelativePath(),
|
||||||
mapaIn.verts.size(), 255);
|
mapaIn.verts.size(), 255);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ bool ReadMAPUToBlender(hecl::blender::Connection& conn, const MAPU& mapu, const
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
wldXf.xf[i].simd.copy_to(wldXfF[i]);
|
wldXf.xf[i].simd.copy_to(wldXfF[i]);
|
||||||
zeus::simd_floats hexColorF(wld.hexColor.mSimd);
|
zeus::simd_floats hexColorF(wld.hexColor.mSimd);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"wldObj = bpy.data.objects.new('{}', None)\n"
|
"wldObj = bpy.data.objects.new('{}', None)\n"
|
||||||
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n"
|
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n"
|
||||||
"mtxd = mtx.decompose()\n"
|
"mtxd = mtx.decompose()\n"
|
||||||
|
@ -62,7 +62,7 @@ bool ReadMAPUToBlender(hecl::blender::Connection& conn, const MAPU& mapu, const
|
||||||
zeus::simd_floats hexXfF[3];
|
zeus::simd_floats hexXfF[3];
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
hexXf.xf[i].simd.copy_to(hexXfF[i]);
|
hexXf.xf[i].simd.copy_to(hexXfF[i]);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"obj = bpy.data.objects.new('{}_{}', hexMesh)\n"
|
"obj = bpy.data.objects.new('{}_{}', hexMesh)\n"
|
||||||
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n"
|
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n"
|
||||||
"mtxd = mtx.decompose()\n"
|
"mtxd = mtx.decompose()\n"
|
||||||
|
|
|
@ -41,7 +41,7 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn, const MLVL& mlvl, const
|
||||||
zeus::simd_floats xfMtxF[3];
|
zeus::simd_floats xfMtxF[3];
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
area.transformMtx[i].simd.copy_to(xfMtxF[i]);
|
area.transformMtx[i].simd.copy_to(xfMtxF[i]);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"box_mesh = bpy.data.meshes.new('''{}''')\n"
|
"box_mesh = bpy.data.meshes.new('''{}''')\n"
|
||||||
"bm.to_mesh(box_mesh)\n"
|
"bm.to_mesh(box_mesh)\n"
|
||||||
"bm.free()\n"
|
"bm.free()\n"
|
||||||
|
@ -67,7 +67,7 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn, const MLVL& mlvl, const
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (const atVec3f& pv : dock.planeVerts) {
|
for (const atVec3f& pv : dock.planeVerts) {
|
||||||
const zeus::CVector3f pvRel = zeus::CVector3f(pv) - pvAvg;
|
const zeus::CVector3f pvRel = zeus::CVector3f(pv) - pvAvg;
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"bm.verts.new(({},{},{}))\n"
|
"bm.verts.new(({},{},{}))\n"
|
||||||
"bm.verts.ensure_lookup_table()\n"),
|
"bm.verts.ensure_lookup_table()\n"),
|
||||||
pvRel[0], pvRel[1], pvRel[2]);
|
pvRel[0], pvRel[1], pvRel[2]);
|
||||||
|
@ -76,13 +76,13 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn, const MLVL& mlvl, const
|
||||||
++idx;
|
++idx;
|
||||||
}
|
}
|
||||||
os << "bm.edges.new((bm.verts[-1], bm.verts[0]))\n";
|
os << "bm.edges.new((bm.verts[-1], bm.verts[0]))\n";
|
||||||
os.format(fmt("dockMesh = bpy.data.meshes.new('DOCK_{:02d}_{:02d}')\n"), areaIdx, dockIdx);
|
os.format(FMT_STRING("dockMesh = bpy.data.meshes.new('DOCK_{:02d}_{:02d}')\n"), areaIdx, dockIdx);
|
||||||
os << "dockObj = bpy.data.objects.new(dockMesh.name, dockMesh)\n"
|
os << "dockObj = bpy.data.objects.new(dockMesh.name, dockMesh)\n"
|
||||||
"bpy.context.scene.collection.objects.link(dockObj)\n"
|
"bpy.context.scene.collection.objects.link(dockObj)\n"
|
||||||
"bm.to_mesh(dockMesh)\n"
|
"bm.to_mesh(dockMesh)\n"
|
||||||
"bm.free()\n"
|
"bm.free()\n"
|
||||||
"dockObj.parent = box\n";
|
"dockObj.parent = box\n";
|
||||||
os.format(fmt("dockObj.location = ({},{},{})\n"), float(pvAvg[0]), float(pvAvg[1]), float(pvAvg[2]));
|
os.format(FMT_STRING("dockObj.location = ({},{},{})\n"), float(pvAvg[0]), float(pvAvg[1]), float(pvAvg[2]));
|
||||||
++dockIdx;
|
++dockIdx;
|
||||||
}
|
}
|
||||||
++areaIdx;
|
++areaIdx;
|
||||||
|
|
|
@ -207,7 +207,7 @@ void PAKRouter<BRIDGETYPE>::enterPAKBridge(const BRIDGETYPE& pakBridge) {
|
||||||
++pit;
|
++pit;
|
||||||
++bridgeIdx;
|
++bridgeIdx;
|
||||||
}
|
}
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKBridge provided to PAKRouter::enterPAKBridge() was not part of build()"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKBridge provided to PAKRouter::enterPAKBridge() was not part of build()"));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class BRIDGETYPE>
|
template <class BRIDGETYPE>
|
||||||
|
@ -287,7 +287,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
|
||||||
return sharedPath.ensureAuxInfo(auxInfo);
|
return sharedPath.ensureAuxInfo(auxInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("Unable to find entry {}"), entry->id);
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("Unable to find entry {}"), entry->id);
|
||||||
return hecl::ProjectPath();
|
return hecl::ProjectPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCooked(const EntryType* entry) const
|
||||||
if (sharedSearch != m_sharedEntries.end()) {
|
if (sharedSearch != m_sharedEntries.end()) {
|
||||||
return hecl::ProjectPath(m_sharedCooked, getBestEntryName(*entry));
|
return hecl::ProjectPath(m_sharedCooked, getBestEntryName(*entry));
|
||||||
}
|
}
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("Unable to find entry {}"), entry->id);
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("Unable to find entry {}"), entry->id);
|
||||||
return hecl::ProjectPath();
|
return hecl::ProjectPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ hecl::SystemString PAKRouter<BRIDGETYPE>::getResourceRelativePath(const EntryTyp
|
||||||
const PAKType* pak = m_pak.get();
|
const PAKType* pak = m_pak.get();
|
||||||
if (!pak)
|
if (!pak)
|
||||||
LogDNACommon.report(logvisor::Fatal,
|
LogDNACommon.report(logvisor::Fatal,
|
||||||
fmt("PAKRouter::enterPAKBridge() must be called before PAKRouter::getResourceRelativePath()"));
|
FMT_STRING("PAKRouter::enterPAKBridge() must be called before PAKRouter::getResourceRelativePath()"));
|
||||||
const typename BRIDGETYPE::PAKType::Entry* be = lookupEntry(b);
|
const typename BRIDGETYPE::PAKType::Entry* be = lookupEntry(b);
|
||||||
if (!be)
|
if (!be)
|
||||||
return hecl::SystemString();
|
return hecl::SystemString();
|
||||||
|
@ -377,17 +377,17 @@ std::string PAKRouter<BRIDGETYPE>::getBestEntryName(const EntryType& entry, bool
|
||||||
|
|
||||||
if (stdOverride && !pak.m_noShare) {
|
if (stdOverride && !pak.m_noShare) {
|
||||||
if (entry.type == FOURCC('MLVL'))
|
if (entry.type == FOURCC('MLVL'))
|
||||||
return fmt::format(fmt("!world_{}"), entry.id);
|
return fmt::format(FMT_STRING("!world_{}"), entry.id);
|
||||||
else if (entry.type == FOURCC('MREA'))
|
else if (entry.type == FOURCC('MREA'))
|
||||||
return fmt::format(fmt("!area_{}"), entry.id);
|
return fmt::format(FMT_STRING("!area_{}"), entry.id);
|
||||||
else if (entry.type == FOURCC('MAPA'))
|
else if (entry.type == FOURCC('MAPA'))
|
||||||
return fmt::format(fmt("!map_{}"), entry.id);
|
return fmt::format(FMT_STRING("!map_{}"), entry.id);
|
||||||
else if (entry.type == FOURCC('PATH'))
|
else if (entry.type == FOURCC('PATH'))
|
||||||
return fmt::format(fmt("!path_{}"), entry.id);
|
return fmt::format(FMT_STRING("!path_{}"), entry.id);
|
||||||
else if (entry.type == FOURCC('MAPW'))
|
else if (entry.type == FOURCC('MAPW'))
|
||||||
return fmt::format(fmt("!mapw_{}"), entry.id);
|
return fmt::format(FMT_STRING("!mapw_{}"), entry.id);
|
||||||
else if (entry.type == FOURCC('SAVW'))
|
else if (entry.type == FOURCC('SAVW'))
|
||||||
return fmt::format(fmt("!savw_{}"), entry.id);
|
return fmt::format(FMT_STRING("!savw_{}"), entry.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string catalogueName;
|
std::string catalogueName;
|
||||||
|
@ -409,17 +409,17 @@ std::string PAKRouter<BRIDGETYPE>::getBestEntryName(const IDType& entry, bool st
|
||||||
|
|
||||||
if (stdOverride && !pak.m_noShare) {
|
if (stdOverride && !pak.m_noShare) {
|
||||||
if (e->type == FOURCC('MLVL'))
|
if (e->type == FOURCC('MLVL'))
|
||||||
return fmt::format(fmt("!world_{}"), e->id);
|
return fmt::format(FMT_STRING("!world_{}"), e->id);
|
||||||
else if (e->type == FOURCC('MREA'))
|
else if (e->type == FOURCC('MREA'))
|
||||||
return fmt::format(fmt("!area_{}"), e->id);
|
return fmt::format(FMT_STRING("!area_{}"), e->id);
|
||||||
else if (e->type == FOURCC('MAPA'))
|
else if (e->type == FOURCC('MAPA'))
|
||||||
return fmt::format(fmt("!map_{}"), e->id);
|
return fmt::format(FMT_STRING("!map_{}"), e->id);
|
||||||
else if (e->type == FOURCC('PATH'))
|
else if (e->type == FOURCC('PATH'))
|
||||||
return fmt::format(fmt("!path_{}"), e->id);
|
return fmt::format(FMT_STRING("!path_{}"), e->id);
|
||||||
else if (e->type == FOURCC('MAPW'))
|
else if (e->type == FOURCC('MAPW'))
|
||||||
return fmt::format(fmt("!mapw_{}"), e->id);
|
return fmt::format(FMT_STRING("!mapw_{}"), e->id);
|
||||||
else if (e->type == FOURCC('SAVW'))
|
else if (e->type == FOURCC('SAVW'))
|
||||||
return fmt::format(fmt("!savw_{}"), e->id);
|
return fmt::format(FMT_STRING("!savw_{}"), e->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string catalogueName;
|
std::string catalogueName;
|
||||||
|
@ -495,7 +495,7 @@ const typename BRIDGETYPE::PAKType::Entry* PAKRouter<BRIDGETYPE>::lookupEntry(co
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!m_bridges)
|
if (!m_bridges)
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter::build() must be called before PAKRouter::lookupEntry()"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter::build() must be called before PAKRouter::lookupEntry()"));
|
||||||
|
|
||||||
const PAKType* pak = m_pak.get();
|
const PAKType* pak = m_pak.get();
|
||||||
const nod::Node* node = m_node.get();
|
const nod::Node* node = m_node.get();
|
||||||
|
@ -511,7 +511,7 @@ const typename BRIDGETYPE::PAKType::Entry* PAKRouter<BRIDGETYPE>::lookupEntry(co
|
||||||
if (currentPAK) {
|
if (currentPAK) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (!silenceWarnings)
|
if (!silenceWarnings)
|
||||||
LogDNACommon.report(logvisor::Warning, fmt("unable to find PAK entry {} in current PAK"), entry);
|
LogDNACommon.report(logvisor::Warning, FMT_STRING("unable to find PAK entry {} in current PAK"), entry);
|
||||||
#endif
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -528,7 +528,7 @@ const typename BRIDGETYPE::PAKType::Entry* PAKRouter<BRIDGETYPE>::lookupEntry(co
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (!silenceWarnings)
|
if (!silenceWarnings)
|
||||||
LogDNACommon.report(logvisor::Warning, fmt("unable to find PAK entry {}"), entry);
|
LogDNACommon.report(logvisor::Warning, FMT_STRING("unable to find PAK entry {}"), entry);
|
||||||
#endif
|
#endif
|
||||||
if (nodeOut)
|
if (nodeOut)
|
||||||
*nodeOut = nullptr;
|
*nodeOut = nullptr;
|
||||||
|
@ -561,7 +561,7 @@ const zeus::CMatrix4f* PAKRouter<BRIDGETYPE>::lookupMAPATransform(const IDType&
|
||||||
template <class BRIDGETYPE>
|
template <class BRIDGETYPE>
|
||||||
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerWorking(const IDType& areaId, int layerIdx) const {
|
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerWorking(const IDType& areaId, int layerIdx) const {
|
||||||
if (!m_bridges)
|
if (!m_bridges)
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter::build() must be called before PAKRouter::getAreaLayerWorking()"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter::build() must be called before PAKRouter::getAreaLayerWorking()"));
|
||||||
auto bridgePathIt = m_bridgePaths.cbegin();
|
auto bridgePathIt = m_bridgePaths.cbegin();
|
||||||
for (const BRIDGETYPE& bridge : *m_bridges) {
|
for (const BRIDGETYPE& bridge : *m_bridges) {
|
||||||
for (const auto& level : bridge.m_levelDeps)
|
for (const auto& level : bridge.m_levelDeps)
|
||||||
|
@ -583,7 +583,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerWorking(const IDType& areaI
|
||||||
bool& activeOut) const {
|
bool& activeOut) const {
|
||||||
activeOut = false;
|
activeOut = false;
|
||||||
if (!m_bridges)
|
if (!m_bridges)
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter::build() must be called before PAKRouter::getAreaLayerWorking()"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter::build() must be called before PAKRouter::getAreaLayerWorking()"));
|
||||||
auto bridgePathIt = m_bridgePaths.cbegin();
|
auto bridgePathIt = m_bridgePaths.cbegin();
|
||||||
for (const BRIDGETYPE& bridge : *m_bridges) {
|
for (const BRIDGETYPE& bridge : *m_bridges) {
|
||||||
for (const auto& level : bridge.m_levelDeps)
|
for (const auto& level : bridge.m_levelDeps)
|
||||||
|
@ -605,7 +605,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerWorking(const IDType& areaI
|
||||||
template <class BRIDGETYPE>
|
template <class BRIDGETYPE>
|
||||||
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerCooked(const IDType& areaId, int layerIdx) const {
|
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerCooked(const IDType& areaId, int layerIdx) const {
|
||||||
if (!m_bridges)
|
if (!m_bridges)
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter::build() must be called before PAKRouter::getAreaLayerCooked()"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter::build() must be called before PAKRouter::getAreaLayerCooked()"));
|
||||||
auto bridgePathIt = m_bridgePaths.cbegin();
|
auto bridgePathIt = m_bridgePaths.cbegin();
|
||||||
for (const BRIDGETYPE& bridge : *m_bridges) {
|
for (const BRIDGETYPE& bridge : *m_bridges) {
|
||||||
for (const auto& level : bridge.m_levelDeps)
|
for (const auto& level : bridge.m_levelDeps)
|
||||||
|
@ -626,7 +626,7 @@ template <class BRIDGETYPE>
|
||||||
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerCooked(const IDType& areaId, int layerIdx, bool& activeOut) const {
|
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerCooked(const IDType& areaId, int layerIdx, bool& activeOut) const {
|
||||||
activeOut = false;
|
activeOut = false;
|
||||||
if (!m_bridges)
|
if (!m_bridges)
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter::build() must be called before PAKRouter::getAreaLayerCooked()"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter::build() must be called before PAKRouter::getAreaLayerCooked()"));
|
||||||
auto bridgePathIt = m_bridgePaths.cbegin();
|
auto bridgePathIt = m_bridgePaths.cbegin();
|
||||||
for (const BRIDGETYPE& bridge : *m_bridges) {
|
for (const BRIDGETYPE& bridge : *m_bridges) {
|
||||||
for (const auto& level : bridge.m_levelDeps)
|
for (const auto& level : bridge.m_levelDeps)
|
||||||
|
@ -648,7 +648,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerCooked(const IDType& areaId
|
||||||
template <class BRIDGETYPE>
|
template <class BRIDGETYPE>
|
||||||
void PAKRouter<BRIDGETYPE>::enumerateResources(const std::function<bool(const EntryType*)>& func) {
|
void PAKRouter<BRIDGETYPE>::enumerateResources(const std::function<bool(const EntryType*)>& func) {
|
||||||
if (!m_bridges)
|
if (!m_bridges)
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter::build() must be called before PAKRouter::enumerateResources()"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAKRouter::build() must be called before PAKRouter::enumerateResources()"));
|
||||||
for (const auto& entryPair : m_uniqueEntries)
|
for (const auto& entryPair : m_uniqueEntries)
|
||||||
if (!func(entryPair.second.second))
|
if (!func(entryPair.second.second))
|
||||||
return;
|
return;
|
||||||
|
@ -662,7 +662,7 @@ bool PAKRouter<BRIDGETYPE>::mreaHasDupeResources(const IDType& id) const {
|
||||||
const PAKType* pak = m_pak.get();
|
const PAKType* pak = m_pak.get();
|
||||||
if (!pak)
|
if (!pak)
|
||||||
LogDNACommon.report(logvisor::Fatal,
|
LogDNACommon.report(logvisor::Fatal,
|
||||||
fmt("PAKRouter::enterPAKBridge() must be called before PAKRouter::mreaHasDupeResources()"));
|
FMT_STRING("PAKRouter::enterPAKBridge() must be called before PAKRouter::mreaHasDupeResources()"));
|
||||||
return pak->mreaHasDupeResources(id);
|
return pak->mreaHasDupeResources(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
PAKEntryReadStream(std::unique_ptr<atUint8[]>&& buf, atUint64 sz, atUint64 pos)
|
PAKEntryReadStream(std::unique_ptr<atUint8[]>&& buf, atUint64 sz, atUint64 pos)
|
||||||
: m_buf(std::move(buf)), m_sz(sz), m_pos(pos) {
|
: m_buf(std::move(buf)), m_sz(sz), m_pos(pos) {
|
||||||
if (m_pos >= m_sz)
|
if (m_pos >= m_sz)
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("PAK stream cursor overrun"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAK stream cursor overrun"));
|
||||||
}
|
}
|
||||||
void seek(atInt64 pos, athena::SeekOrigin origin) override {
|
void seek(atInt64 pos, athena::SeekOrigin origin) override {
|
||||||
if (origin == athena::SeekOrigin::Begin) {
|
if (origin == athena::SeekOrigin::Begin) {
|
||||||
|
@ -42,7 +42,7 @@ public:
|
||||||
m_pos = m_sz + pos;
|
m_pos = m_sz + pos;
|
||||||
}
|
}
|
||||||
if (m_pos > m_sz) {
|
if (m_pos > m_sz) {
|
||||||
LogDNACommon.report(logvisor::Fatal, fmt("PAK stream cursor overrun"));
|
LogDNACommon.report(logvisor::Fatal, FMT_STRING("PAK stream cursor overrun"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
atUint64 position() const override { return m_pos; }
|
atUint64 position() const override { return m_pos; }
|
||||||
|
|
|
@ -70,7 +70,7 @@ void PATH<PAKBridge>::sendToBlender(hecl::blender::Connection& conn, std::string
|
||||||
" material_index.append(key)\n"
|
" material_index.append(key)\n"
|
||||||
" return len(material_index)-1\n"
|
" return len(material_index)-1\n"
|
||||||
"\n";
|
"\n";
|
||||||
os.format(fmt("bpy.context.scene.name = '{}'\n"), entryName);
|
os.format(FMT_STRING("bpy.context.scene.name = '{}'\n"), entryName);
|
||||||
os << "# Clear Scene\n"
|
os << "# Clear Scene\n"
|
||||||
"if len(bpy.data.collections):\n"
|
"if len(bpy.data.collections):\n"
|
||||||
" bpy.data.collections.remove(bpy.data.collections[0])\n"
|
" bpy.data.collections.remove(bpy.data.collections[0])\n"
|
||||||
|
@ -80,7 +80,7 @@ void PATH<PAKBridge>::sendToBlender(hecl::blender::Connection& conn, std::string
|
||||||
|
|
||||||
for (const Node& n : nodes) {
|
for (const Node& n : nodes) {
|
||||||
zeus::simd_floats f(n.position.simd);
|
zeus::simd_floats f(n.position.simd);
|
||||||
os.format(fmt("bm.verts.new(({},{},{}))\n"), f[0], f[1], f[2]);
|
os.format(FMT_STRING("bm.verts.new(({},{},{}))\n"), f[0], f[1], f[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "bm.verts.ensure_lookup_table()\n";
|
os << "bm.verts.ensure_lookup_table()\n";
|
||||||
|
@ -88,9 +88,9 @@ void PATH<PAKBridge>::sendToBlender(hecl::blender::Connection& conn, std::string
|
||||||
for (const Region& r : regions) {
|
for (const Region& r : regions) {
|
||||||
os << "tri_verts = []\n";
|
os << "tri_verts = []\n";
|
||||||
for (atUint32 i = 0; i < r.nodeCount; ++i)
|
for (atUint32 i = 0; i < r.nodeCount; ++i)
|
||||||
os.format(fmt("tri_verts.append(bm.verts[{}])\n"), r.nodeStart + i);
|
os.format(FMT_STRING("tri_verts.append(bm.verts[{}])\n"), r.nodeStart + i);
|
||||||
|
|
||||||
os.format(fmt("face = bm.faces.get(tri_verts)\n"
|
os.format(FMT_STRING("face = bm.faces.get(tri_verts)\n"
|
||||||
"if face is None:\n"
|
"if face is None:\n"
|
||||||
" face = bm.faces.new(tri_verts)\n"
|
" face = bm.faces.new(tri_verts)\n"
|
||||||
" face.normal_flip()\n"
|
" face.normal_flip()\n"
|
||||||
|
@ -103,7 +103,7 @@ void PATH<PAKBridge>::sendToBlender(hecl::blender::Connection& conn, std::string
|
||||||
#if 0
|
#if 0
|
||||||
const zeus::CVector3f center = xf->multiplyOneOverW(r.centroid);
|
const zeus::CVector3f center = xf->multiplyOneOverW(r.centroid);
|
||||||
zeus::CAABox aabb(xf->multiplyOneOverW(r.aabb[0]), xf->multiplyOneOverW(r.aabb[1]));
|
zeus::CAABox aabb(xf->multiplyOneOverW(r.aabb[0]), xf->multiplyOneOverW(r.aabb[1]));
|
||||||
os.format(fmt("aabb = bpy.data.objects.new('AABB', None)\n")
|
os.format(FMT_STRING("aabb = bpy.data.objects.new('AABB', None)\n")
|
||||||
"aabb.location = (%f,%f,%f)\n"
|
"aabb.location = (%f,%f,%f)\n"
|
||||||
"aabb.scale = (%f,%f,%f)\n"
|
"aabb.scale = (%f,%f,%f)\n"
|
||||||
"aabb.empty_display_type = 'CUBE'\n"
|
"aabb.empty_display_type = 'CUBE'\n"
|
||||||
|
@ -125,7 +125,7 @@ void PATH<PAKBridge>::sendToBlender(hecl::blender::Connection& conn, std::string
|
||||||
for (const Node& n : nodes) {
|
for (const Node& n : nodes) {
|
||||||
zeus::simd_floats f(n.position.simd);
|
zeus::simd_floats f(n.position.simd);
|
||||||
zeus::simd_floats no(n.position.simd + n.normal.simd);
|
zeus::simd_floats no(n.position.simd + n.normal.simd);
|
||||||
os.format(fmt("v = bm.verts.new((%f,%f,%f))\n")
|
os.format(FMT_STRING("v = bm.verts.new((%f,%f,%f))\n")
|
||||||
"v2 = bm.verts.new((%f,%f,%f))\n"
|
"v2 = bm.verts.new((%f,%f,%f))\n"
|
||||||
"bm.edges.new((v, v2))\n", f[0], f[1], f[2], no[0], no[1], no[2]);
|
"bm.edges.new((v, v2))\n", f[0], f[1], f[2], no[0], no[1], no[2]);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ void PATH<PAKBridge>::sendToBlender(hecl::blender::Connection& conn, std::string
|
||||||
zeus::simd_floats xfMtxF[4];
|
zeus::simd_floats xfMtxF[4];
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
w.m[i].mSimd.copy_to(xfMtxF[i]);
|
w.m[i].mSimd.copy_to(xfMtxF[i]);
|
||||||
os.format(fmt("mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n"
|
os.format(FMT_STRING("mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n"
|
||||||
"mtxd = mtx.decompose()\n"
|
"mtxd = mtx.decompose()\n"
|
||||||
"path_mesh_obj.rotation_mode = 'QUATERNION'\n"
|
"path_mesh_obj.rotation_mode = 'QUATERNION'\n"
|
||||||
"path_mesh_obj.location = mtxd[0]\n"
|
"path_mesh_obj.location = mtxd[0]\n"
|
||||||
|
@ -171,7 +171,7 @@ void PATH<PAKBridge>::sendToBlender(hecl::blender::Connection& conn, std::string
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
os.linkBackground(fmt::format(fmt("//{}"), areaPath));
|
os.linkBackground(fmt::format(FMT_STRING("//{}"), areaPath));
|
||||||
os.centerView();
|
os.centerView();
|
||||||
os.close();
|
os.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct PPImpl : BigDNA, _Basis {
|
||||||
constexpr FourCC RefType = uint32_t(_Basis::Type);
|
constexpr FourCC RefType = uint32_t(_Basis::Type);
|
||||||
DNAFourCC clsId(r);
|
DNAFourCC clsId(r);
|
||||||
if (clsId != RefType) {
|
if (clsId != RefType) {
|
||||||
LogModule.report(logvisor::Warning, fmt("non {} provided to {} parser"), RefType, RefType);
|
LogModule.report(logvisor::Warning, FMT_STRING("non {} provided to {} parser"), RefType, RefType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
clsId.read(r);
|
clsId.read(r);
|
||||||
|
@ -68,7 +68,7 @@ struct PPImpl : BigDNA, _Basis {
|
||||||
p.read(r);
|
p.read(r);
|
||||||
}
|
}
|
||||||
})) {
|
})) {
|
||||||
LogModule.report(logvisor::Fatal, fmt("Unknown {} class {} @{}"), RefType, clsId, r.position());
|
LogModule.report(logvisor::Fatal, FMT_STRING("Unknown {} class {} @{}"), RefType, clsId, r.position());
|
||||||
}
|
}
|
||||||
clsId.read(r);
|
clsId.read(r);
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ struct PPImpl : BigDNA, _Basis {
|
||||||
if (key == "DNAType"sv)
|
if (key == "DNAType"sv)
|
||||||
continue;
|
continue;
|
||||||
if (key.size() < 4) {
|
if (key.size() < 4) {
|
||||||
LogModule.report(logvisor::Warning, fmt("short FourCC in element '{}'"), key);
|
LogModule.report(logvisor::Warning, FMT_STRING("short FourCC in element '{}'"), key);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ struct PPImpl : BigDNA, _Basis {
|
||||||
p.read(r);
|
p.read(r);
|
||||||
}
|
}
|
||||||
})) {
|
})) {
|
||||||
LogModule.report(logvisor::Fatal, fmt("Unknown {} class {}"), RefType, clsId);
|
LogModule.report(logvisor::Fatal, FMT_STRING("Unknown {} class {}"), RefType, clsId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ struct PEImpl : BigDNA {
|
||||||
m_elem = std::make_unique<typename Tp::Type>();
|
m_elem = std::make_unique<typename Tp::Type>();
|
||||||
m_elem->read(r);
|
m_elem->read(r);
|
||||||
})) {
|
})) {
|
||||||
LogModule.report(logvisor::Fatal, fmt("Unknown {} class {} @{}"), _PtrType::TypeName, clsId, r.position());
|
LogModule.report(logvisor::Fatal, FMT_STRING("Unknown {} class {} @{}"), _PtrType::TypeName, clsId, r.position());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ struct PEImpl : BigDNA {
|
||||||
|
|
||||||
const auto& [key, value] = mapChildren[0];
|
const auto& [key, value] = mapChildren[0];
|
||||||
if (key.size() < 4)
|
if (key.size() < 4)
|
||||||
LogModule.report(logvisor::Fatal, fmt("short FourCC in element '{}'"), key);
|
LogModule.report(logvisor::Fatal, FMT_STRING("short FourCC in element '{}'"), key);
|
||||||
|
|
||||||
if (auto rec = r.enterSubRecord(key)) {
|
if (auto rec = r.enterSubRecord(key)) {
|
||||||
const DNAFourCC clsId = key.c_str();
|
const DNAFourCC clsId = key.c_str();
|
||||||
|
@ -238,7 +238,7 @@ struct PEImpl : BigDNA {
|
||||||
m_elem = std::make_unique<typename Tp::Type>();
|
m_elem = std::make_unique<typename Tp::Type>();
|
||||||
m_elem->read(r);
|
m_elem->read(r);
|
||||||
})) {
|
})) {
|
||||||
LogModule.report(logvisor::Fatal, fmt("Unknown {} class {}"), _PtrType::TypeName, clsId);
|
LogModule.report(logvisor::Fatal, FMT_STRING("Unknown {} class {}"), _PtrType::TypeName, clsId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ void ISTRG::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const {
|
||||||
std::unique_ptr<ISTRG> LoadSTRG(athena::io::IStreamReader& reader) {
|
std::unique_ptr<ISTRG> LoadSTRG(athena::io::IStreamReader& reader) {
|
||||||
uint32_t magic = reader.readUint32Big();
|
uint32_t magic = reader.readUint32Big();
|
||||||
if (magic != 0x87654321) {
|
if (magic != 0x87654321) {
|
||||||
LogDNACommon.report(logvisor::Error, fmt("invalid STRG magic"));
|
LogDNACommon.report(logvisor::Error, FMT_STRING("invalid STRG magic"));
|
||||||
return std::unique_ptr<ISTRG>();
|
return std::unique_ptr<ISTRG>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -826,9 +826,9 @@ static void EncodeCMPR(const uint8_t* rgbaIn, uint8_t* texels, int width, int he
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PNGErr(png_structp png, png_const_charp msg) { Log.report(logvisor::Error, fmt("{}"), msg); }
|
static void PNGErr(png_structp png, png_const_charp msg) { Log.report(logvisor::Error, FMT_STRING("{}"), msg); }
|
||||||
|
|
||||||
static void PNGWarn(png_structp png, png_const_charp msg) { Log.report(logvisor::Warning, fmt("{}"), msg); }
|
static void PNGWarn(png_structp png, png_const_charp msg) { Log.report(logvisor::Warning, FMT_STRING("{}"), msg); }
|
||||||
|
|
||||||
bool TXTR::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
|
bool TXTR::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
|
||||||
const uint32_t format = rs.readUint32Big();
|
const uint32_t format = rs.readUint32Big();
|
||||||
|
@ -838,7 +838,7 @@ bool TXTR::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
|
||||||
|
|
||||||
auto fp = hecl::FopenUnique(outPath.getAbsolutePath().data(), _SYS_STR("wb"));
|
auto fp = hecl::FopenUnique(outPath.getAbsolutePath().data(), _SYS_STR("wb"));
|
||||||
if (fp == nullptr) {
|
if (fp == nullptr) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("Unable to open '{}' for writing")), outPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("Unable to open '{}' for writing")), outPath.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, PNGErr, PNGWarn);
|
png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, PNGErr, PNGWarn);
|
||||||
|
@ -1041,7 +1041,7 @@ 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) {
|
||||||
auto inf = hecl::FopenUnique(inPath.getAbsolutePath().data(), _SYS_STR("rb"));
|
auto inf = hecl::FopenUnique(inPath.getAbsolutePath().data(), _SYS_STR("rb"));
|
||||||
if (inf == nullptr) {
|
if (inf == nullptr) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("Unable to open '{}' for reading")), inPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("Unable to open '{}' for reading")), inPath.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1049,25 +1049,25 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
||||||
char header[8];
|
char header[8];
|
||||||
std::fread(header, 1, sizeof(header), inf.get());
|
std::fread(header, 1, sizeof(header), inf.get());
|
||||||
if (png_sig_cmp((png_const_bytep)header, 0, 8)) {
|
if (png_sig_cmp((png_const_bytep)header, 0, 8)) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("invalid PNG signature in '{}'")), inPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("invalid PNG signature in '{}'")), inPath.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup PNG reader */
|
/* Setup PNG reader */
|
||||||
png_structp pngRead = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
png_structp pngRead = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||||
if (!pngRead) {
|
if (!pngRead) {
|
||||||
Log.report(logvisor::Error, fmt("unable to initialize libpng"));
|
Log.report(logvisor::Error, FMT_STRING("unable to initialize libpng"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
png_infop info = png_create_info_struct(pngRead);
|
png_infop info = png_create_info_struct(pngRead);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
Log.report(logvisor::Error, fmt("unable to initialize libpng info"));
|
Log.report(logvisor::Error, FMT_STRING("unable to initialize libpng info"));
|
||||||
png_destroy_read_struct(&pngRead, nullptr, nullptr);
|
png_destroy_read_struct(&pngRead, nullptr, nullptr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf(pngRead))) {
|
if (setjmp(png_jmpbuf(pngRead))) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("unable to initialize libpng I/O for '{}'")), inPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to initialize libpng I/O for '{}'")), inPath.getAbsolutePath());
|
||||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1083,7 +1083,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
||||||
const png_byte bitDepth = png_get_bit_depth(pngRead, info);
|
const png_byte bitDepth = png_get_bit_depth(pngRead, info);
|
||||||
|
|
||||||
if (width < 4 || height < 4) {
|
if (width < 4 || height < 4) {
|
||||||
Log.report(logvisor::Error, fmt("image must be 4x4 or larger"));
|
Log.report(logvisor::Error, FMT_STRING("image must be 4x4 or larger"));
|
||||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1112,7 +1112,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bitDepth != 8) {
|
if (bitDepth != 8) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("'{}' is not 8 bits-per-channel")), inPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("'{}' is not 8 bits-per-channel")), inPath.getAbsolutePath());
|
||||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1143,7 +1143,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
||||||
nComps = 1;
|
nComps = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("unsupported color type in '{}'")), inPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unsupported color type in '{}'")), inPath.getAbsolutePath());
|
||||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1163,7 +1163,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
||||||
bufOut.reset(new uint8_t[bufLen]);
|
bufOut.reset(new uint8_t[bufLen]);
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf(pngRead))) {
|
if (setjmp(png_jmpbuf(pngRead))) {
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to read image in '{}'")), inPath.getAbsolutePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to read image in '{}'")), inPath.getAbsolutePath());
|
||||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1344,7 +1344,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
||||||
/* Do write out */
|
/* Do write out */
|
||||||
athena::io::FileWriter outf(outPath.getAbsolutePath(), true, false);
|
athena::io::FileWriter outf(outPath.getAbsolutePath(), true, false);
|
||||||
if (outf.hasError()) {
|
if (outf.hasError()) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("Unable to open '{}' for writing")), outPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("Unable to open '{}' for writing")), outPath.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1360,7 +1360,7 @@ 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) {
|
||||||
auto inf = hecl::FopenUnique(inPath.getAbsolutePath().data(), _SYS_STR("rb"));
|
auto inf = hecl::FopenUnique(inPath.getAbsolutePath().data(), _SYS_STR("rb"));
|
||||||
if (inf == nullptr) {
|
if (inf == nullptr) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("Unable to open '{}' for reading")), inPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("Unable to open '{}' for reading")), inPath.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1368,25 +1368,25 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
||||||
char header[8];
|
char header[8];
|
||||||
std::fread(header, 1, sizeof(header), inf.get());
|
std::fread(header, 1, sizeof(header), inf.get());
|
||||||
if (png_sig_cmp((png_const_bytep)header, 0, 8)) {
|
if (png_sig_cmp((png_const_bytep)header, 0, 8)) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("invalid PNG signature in '{}'")), inPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("invalid PNG signature in '{}'")), inPath.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup PNG reader */
|
/* Setup PNG reader */
|
||||||
png_structp pngRead = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
png_structp pngRead = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||||
if (!pngRead) {
|
if (!pngRead) {
|
||||||
Log.report(logvisor::Error, fmt("unable to initialize libpng"));
|
Log.report(logvisor::Error, FMT_STRING("unable to initialize libpng"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
png_infop info = png_create_info_struct(pngRead);
|
png_infop info = png_create_info_struct(pngRead);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
Log.report(logvisor::Error, fmt("unable to initialize libpng info"));
|
Log.report(logvisor::Error, FMT_STRING("unable to initialize libpng info"));
|
||||||
png_destroy_read_struct(&pngRead, nullptr, nullptr);
|
png_destroy_read_struct(&pngRead, nullptr, nullptr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf(pngRead))) {
|
if (setjmp(png_jmpbuf(pngRead))) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("unable to initialize libpng I/O for '{}'")), inPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to initialize libpng I/O for '{}'")), inPath.getAbsolutePath());
|
||||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1425,7 +1425,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bitDepth != 8) {
|
if (bitDepth != 8) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("'{}' is not 8 bits-per-channel")), inPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("'{}' is not 8 bits-per-channel")), inPath.getAbsolutePath());
|
||||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1454,7 +1454,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, fmt(_SYS_STR("unsupported color type in '{}'")), inPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unsupported color type in '{}'")), inPath.getAbsolutePath());
|
||||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1472,7 +1472,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
||||||
bufOut.reset(new uint8_t[bufLen]);
|
bufOut.reset(new uint8_t[bufLen]);
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf(pngRead))) {
|
if (setjmp(png_jmpbuf(pngRead))) {
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to read image in '{}'")), inPath.getAbsolutePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to read image in '{}'")), inPath.getAbsolutePath());
|
||||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1593,7 +1593,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
||||||
/* Do write out */
|
/* Do write out */
|
||||||
athena::io::FileWriter outf(outPath.getAbsolutePath(), true, false);
|
athena::io::FileWriter outf(outPath.getAbsolutePath(), true, false);
|
||||||
if (outf.hasError()) {
|
if (outf.hasError()) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("Unable to open '{}' for writing")), outPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("Unable to open '{}' for writing")), outPath.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -988,19 +988,19 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||||
/* Search for yaml */
|
/* Search for yaml */
|
||||||
hecl::ProjectPath yamlPath = inPath.getWithExtension(_SYS_STR(".yaml"), true);
|
hecl::ProjectPath yamlPath = inPath.getWithExtension(_SYS_STR(".yaml"), true);
|
||||||
if (!yamlPath.isFile())
|
if (!yamlPath.isFile())
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("'{}' not found as file")), yamlPath.getRelativePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("'{}' not found as file")), yamlPath.getRelativePath());
|
||||||
|
|
||||||
athena::io::FileReader reader(yamlPath.getAbsolutePath());
|
athena::io::FileReader reader(yamlPath.getAbsolutePath());
|
||||||
if (!reader.isOpen())
|
if (!reader.isOpen())
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("can't open '{}' for reading")), yamlPath.getRelativePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("can't open '{}' for reading")), yamlPath.getRelativePath());
|
||||||
|
|
||||||
if (!athena::io::ValidateFromYAMLStream<ANCS>(reader)) {
|
if (!athena::io::ValidateFromYAMLStream<ANCS>(reader)) {
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("'{}' is not urde::DNAMP1::ANCS type")), yamlPath.getRelativePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("'{}' is not urde::DNAMP1::ANCS type")), yamlPath.getRelativePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
athena::io::YAMLDocReader yamlReader;
|
athena::io::YAMLDocReader yamlReader;
|
||||||
if (!yamlReader.parse(&reader)) {
|
if (!yamlReader.parse(&reader)) {
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to parse '{}'")), yamlPath.getRelativePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to parse '{}'")), yamlPath.getRelativePath());
|
||||||
}
|
}
|
||||||
ANCS ancs;
|
ANCS ancs;
|
||||||
ancs.read(yamlReader);
|
ancs.read(yamlReader);
|
||||||
|
@ -1020,9 +1020,9 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||||
hecl::SystemStringConv chSysName(ch.name);
|
hecl::SystemStringConv chSysName(ch.name);
|
||||||
if (!sub.cskrId.empty()) {
|
if (!sub.cskrId.empty()) {
|
||||||
hecl::SystemStringConv cskrSysName(sub.cskrId);
|
hecl::SystemStringConv cskrSysName(sub.cskrId);
|
||||||
ch.cskr = inPath.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.CSKR")), chSysName, cskrSysName));
|
ch.cskr = inPath.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}_{}.CSKR")), chSysName, cskrSysName));
|
||||||
} else {
|
} else {
|
||||||
ch.cskr = inPath.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}.CSKR")), chSysName));
|
ch.cskr = inPath.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.CSKR")), chSysName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add subtype AABBs */
|
/* Add subtype AABBs */
|
||||||
|
@ -1048,10 +1048,10 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||||
if (!search->cskrId.empty()) {
|
if (!search->cskrId.empty()) {
|
||||||
hecl::SystemStringConv cskrSys(search->cskrId);
|
hecl::SystemStringConv cskrSys(search->cskrId);
|
||||||
ch.cskrIce = inPath.ensureAuxInfo(
|
ch.cskrIce = inPath.ensureAuxInfo(
|
||||||
fmt::format(fmt(_SYS_STR("{}.{}_{}.CSKR")), chSysName, overlaySys, cskrSys));
|
fmt::format(FMT_STRING(_SYS_STR("{}.{}_{}.CSKR")), chSysName, overlaySys, cskrSys));
|
||||||
} else {
|
} else {
|
||||||
ch.cskrIce = inPath.ensureAuxInfo(
|
ch.cskrIce = inPath.ensureAuxInfo(
|
||||||
fmt::format(fmt(_SYS_STR("{}.{}.CSKR")), chSysName, overlaySys));
|
fmt::format(FMT_STRING(_SYS_STR("{}.{}.CSKR")), chSysName, overlaySys));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1074,9 +1074,9 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||||
hecl::ProjectPath pathOut;
|
hecl::ProjectPath pathOut;
|
||||||
if (!act.animId.empty()) {
|
if (!act.animId.empty()) {
|
||||||
hecl::SystemStringConv idSys(act.animId);
|
hecl::SystemStringConv idSys(act.animId);
|
||||||
pathOut = inPath.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.ANIM")), sysStr, idSys));
|
pathOut = inPath.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}_{}.ANIM")), sysStr, idSys));
|
||||||
} else {
|
} else {
|
||||||
inPath.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}.ANIM")), sysStr));
|
inPath.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.ANIM")), sysStr));
|
||||||
}
|
}
|
||||||
prim.animId = pathOut;
|
prim.animId = pathOut;
|
||||||
break;
|
break;
|
||||||
|
@ -1093,9 +1093,9 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||||
hecl::ProjectPath pathOut;
|
hecl::ProjectPath pathOut;
|
||||||
if (!act.animId.empty()) {
|
if (!act.animId.empty()) {
|
||||||
hecl::SystemStringConv animIdSys(act.animId);
|
hecl::SystemStringConv animIdSys(act.animId);
|
||||||
pathOut = inPath.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.ANIM")), sysStr, animIdSys));
|
pathOut = inPath.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}_{}.ANIM")), sysStr, animIdSys));
|
||||||
} else {
|
} else {
|
||||||
pathOut = inPath.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}.ANIM")), sysStr));
|
pathOut = inPath.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.ANIM")), sysStr));
|
||||||
}
|
}
|
||||||
|
|
||||||
ancs.animationSet.animResources.emplace_back();
|
ancs.animationSet.animResources.emplace_back();
|
||||||
|
@ -1103,7 +1103,7 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||||
|
|
||||||
/* Check for associated EVNT YAML */
|
/* Check for associated EVNT YAML */
|
||||||
hecl::SystemString testPrefix(inPath.getWithExtension(
|
hecl::SystemString testPrefix(inPath.getWithExtension(
|
||||||
fmt::format(fmt(_SYS_STR(".{}_")), sysStr).c_str(), true).getLastComponent());
|
fmt::format(FMT_STRING(_SYS_STR(".{}_")), sysStr).c_str(), true).getLastComponent());
|
||||||
hecl::ProjectPath evntYamlPath;
|
hecl::ProjectPath evntYamlPath;
|
||||||
for (const auto& ent : dEnum) {
|
for (const auto& ent : dEnum) {
|
||||||
if (hecl::StringUtils::BeginsWith(ent.m_name, testPrefix.c_str()) &&
|
if (hecl::StringUtils::BeginsWith(ent.m_name, testPrefix.c_str()) &&
|
||||||
|
@ -1163,7 +1163,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!subtype)
|
if (!subtype)
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to find subtype '{}'")), subName);
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to find subtype '{}'")), subName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const hecl::ProjectPath* modelPath = nullptr;
|
const hecl::ProjectPath* modelPath = nullptr;
|
||||||
|
@ -1176,7 +1176,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!attachment)
|
if (!attachment)
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to find attachment '{}'")), overName);
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to find attachment '{}'")), overName);
|
||||||
modelPath = &attachment->mesh;
|
modelPath = &attachment->mesh;
|
||||||
} else if (overName.empty()) {
|
} else if (overName.empty()) {
|
||||||
modelPath = &subtype->mesh;
|
modelPath = &subtype->mesh;
|
||||||
|
@ -1188,15 +1188,15 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!modelPath)
|
if (!modelPath)
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to resolve model path of {}:{}")), subName, overName);
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to resolve model path of {}:{}")), subName, overName);
|
||||||
|
|
||||||
if (!modelPath->isFile())
|
if (!modelPath->isFile())
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to resolve '{}'")), modelPath->getRelativePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to resolve '{}'")), modelPath->getRelativePath());
|
||||||
|
|
||||||
hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1).getWithExtension(_SYS_STR(".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, fmt(_SYS_STR("unable to cook '{}'")), modelPath->getRelativePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to cook '{}'")), modelPath->getRelativePath());
|
||||||
|
|
||||||
std::vector<std::pair<std::vector<std::pair<uint32_t, float>>, uint32_t>> skins;
|
std::vector<std::pair<std::vector<std::pair<uint32_t, float>>, uint32_t>> skins;
|
||||||
uint32_t posCount = 0;
|
uint32_t posCount = 0;
|
||||||
|
@ -1221,7 +1221,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
|
||||||
const std::string& name = boneNames[bIdx];
|
const std::string& name = boneNames[bIdx];
|
||||||
auto search = boneIdMap.find(name);
|
auto search = boneIdMap.find(name);
|
||||||
if (search == boneIdMap.cend())
|
if (search == boneIdMap.cend())
|
||||||
Log.report(logvisor::Fatal, fmt("unable to find bone '{}' in {}"), name,
|
Log.report(logvisor::Fatal, FMT_STRING("unable to find bone '{}' in {}"), name,
|
||||||
inPath.getRelativePathUTF8());
|
inPath.getRelativePathUTF8());
|
||||||
virtualBone.first.emplace_back(search->second, weight);
|
virtualBone.first.emplace_back(search->second, weight);
|
||||||
}
|
}
|
||||||
|
@ -1287,7 +1287,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!subtype)
|
if (!subtype)
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to find subtype '{}'")), subName);
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to find subtype '{}'")), subName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const hecl::ProjectPath* modelPath = nullptr;
|
const hecl::ProjectPath* modelPath = nullptr;
|
||||||
|
@ -1300,7 +1300,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!attachment)
|
if (!attachment)
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to find attachment '{}'")), overName);
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to find attachment '{}'")), overName);
|
||||||
modelPath = &attachment->mesh;
|
modelPath = &attachment->mesh;
|
||||||
} else if (overName.empty()) {
|
} else if (overName.empty()) {
|
||||||
modelPath = &subtype->mesh;
|
modelPath = &subtype->mesh;
|
||||||
|
@ -1312,15 +1312,15 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!modelPath)
|
if (!modelPath)
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to resolve model path of {}:{}")), subName, overName);
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to resolve model path of {}:{}")), subName, overName);
|
||||||
|
|
||||||
if (!modelPath->isFile())
|
if (!modelPath->isFile())
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to resolve '{}'")), modelPath->getRelativePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to resolve '{}'")), modelPath->getRelativePath());
|
||||||
|
|
||||||
hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1PC).getWithExtension(_SYS_STR(".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, fmt(_SYS_STR("unable to cook '{}'")), modelPath->getRelativePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to cook '{}'")), modelPath->getRelativePath());
|
||||||
|
|
||||||
uint32_t bankCount = 0;
|
uint32_t bankCount = 0;
|
||||||
std::vector<std::vector<uint32_t>> skinBanks;
|
std::vector<std::vector<uint32_t>> skinBanks;
|
||||||
|
@ -1360,7 +1360,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath&
|
||||||
const std::string& name = boneNames[bIdx];
|
const std::string& name = boneNames[bIdx];
|
||||||
auto search = boneIdMap.find(name);
|
auto search = boneIdMap.find(name);
|
||||||
if (search == boneIdMap.cend())
|
if (search == boneIdMap.cend())
|
||||||
Log.report(logvisor::Fatal, fmt("unable to find bone '{}' in {}"), name,
|
Log.report(logvisor::Fatal, FMT_STRING("unable to find bone '{}' in {}"), name,
|
||||||
inPath.getRelativePathUTF8());
|
inPath.getRelativePathUTF8());
|
||||||
virtualBone.emplace_back(search->second, weight);
|
virtualBone.emplace_back(search->second, weight);
|
||||||
}
|
}
|
||||||
|
@ -1381,7 +1381,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath&
|
||||||
const std::string& name = boneNames[bIdx];
|
const std::string& name = boneNames[bIdx];
|
||||||
auto search = boneIdMap.find(name);
|
auto search = boneIdMap.find(name);
|
||||||
if (search == boneIdMap.cend())
|
if (search == boneIdMap.cend())
|
||||||
Log.report(logvisor::Fatal, fmt("unable to find bone '{}' in {}"), name,
|
Log.report(logvisor::Fatal, FMT_STRING("unable to find bone '{}' in {}"), name,
|
||||||
inPath.getRelativePathUTF8());
|
inPath.getRelativePathUTF8());
|
||||||
skinOut.writeUint32Big(search->second);
|
skinOut.writeUint32Big(search->second);
|
||||||
}
|
}
|
||||||
|
@ -1420,7 +1420,7 @@ bool ANCS::CookANIM(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
|
||||||
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, fmt(_SYS_STR("0 armatures in {}")), inPath.getRelativePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("0 armatures in {}")), inPath.getRelativePath());
|
||||||
|
|
||||||
/* Build bone ID map */
|
/* Build bone ID map */
|
||||||
std::unordered_map<std::string, atInt32> boneIdMap;
|
std::unordered_map<std::string, atInt32> boneIdMap;
|
||||||
|
@ -1440,7 +1440,7 @@ bool ANCS::CookANIM(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
|
||||||
|
|
||||||
/* Check for associated EVNT YAML */
|
/* Check for associated EVNT YAML */
|
||||||
hecl::SystemString testPrefix(inPath.getWithExtension(
|
hecl::SystemString testPrefix(inPath.getWithExtension(
|
||||||
fmt::format(fmt(_SYS_STR(".{}_")), actName).c_str(), true).getLastComponent());
|
fmt::format(FMT_STRING(_SYS_STR(".{}_")), actName).c_str(), true).getLastComponent());
|
||||||
hecl::ProjectPath evntYamlPath;
|
hecl::ProjectPath evntYamlPath;
|
||||||
for (const auto& ent : hecl::DirectoryEnumerator(inPath.getParentPath().getAbsolutePath())) {
|
for (const auto& ent : hecl::DirectoryEnumerator(inPath.getParentPath().getAbsolutePath())) {
|
||||||
if (hecl::StringUtils::BeginsWith(ent.m_name, testPrefix.c_str()) &&
|
if (hecl::StringUtils::BeginsWith(ent.m_name, testPrefix.c_str()) &&
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace DataSpec::DNAMP1 {
|
||||||
using ANIMOutStream = hecl::blender::ANIMOutStream;
|
using ANIMOutStream = hecl::blender::ANIMOutStream;
|
||||||
|
|
||||||
void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig) const {
|
void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig) const {
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"act.hecl_fps = round({})\n"
|
"act.hecl_fps = round({})\n"
|
||||||
"act.hecl_looping = {}\n"),
|
"act.hecl_looping = {}\n"),
|
||||||
(1.0f / mainInterval), looping ? "True" : "False");
|
(1.0f / mainInterval), looping ? "True" : "False");
|
||||||
|
@ -26,7 +26,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
os.format(fmt("bone_string = '{}'\n"), *bName);
|
os.format(FMT_STRING("bone_string = '{}'\n"), *bName);
|
||||||
os << "action_group = act.groups.new(bone_string)\n"
|
os << "action_group = act.groups.new(bone_string)\n"
|
||||||
"\n"
|
"\n"
|
||||||
"rotCurves = []\n"
|
"rotCurves = []\n"
|
||||||
|
@ -111,7 +111,7 @@ UniqueID32 ANIM::GetEVNTId(athena::io::IStreamReader& reader) {
|
||||||
reader.seek(4);
|
reader.seek(4);
|
||||||
return reader.readUint32Big();
|
return reader.readUint32Big();
|
||||||
default:
|
default:
|
||||||
Log.report(logvisor::Error, fmt("unrecognized ANIM version"));
|
Log.report(logvisor::Error, FMT_STRING("unrecognized ANIM version"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
|
@ -134,7 +134,7 @@ void ANIM::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
|
||||||
m_anim->read(reader);
|
m_anim->read(reader);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.report(logvisor::Error, fmt("unrecognized ANIM version"));
|
Log.report(logvisor::Error, FMT_STRING("unrecognized ANIM version"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -559,7 +559,7 @@ ANIM::ANIM(const BlenderAction& act, const std::unordered_map<std::string, atInt
|
||||||
for (const BlenderAction::Channel& chan : act.channels) {
|
for (const BlenderAction::Channel& chan : act.channels) {
|
||||||
auto search = idMap.find(chan.boneName);
|
auto search = idMap.find(chan.boneName);
|
||||||
if (search == idMap.cend()) {
|
if (search == idMap.cend()) {
|
||||||
Log.report(logvisor::Warning, fmt("unable to find id for bone '{}'"), chan.boneName);
|
Log.report(logvisor::Warning, FMT_STRING("unable to find id for bone '{}'"), chan.boneName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (addedBones.find(search->second) != addedBones.cend())
|
if (addedBones.find(search->second) != addedBones.cend())
|
||||||
|
|
|
@ -192,7 +192,7 @@ struct ANIM : BigDNA {
|
||||||
if (m_anim->evnt.isValid()) {
|
if (m_anim->evnt.isValid()) {
|
||||||
hecl::SystemStringConv sysStr(animInfo.name);
|
hecl::SystemStringConv sysStr(animInfo.name);
|
||||||
hecl::ProjectPath evntYamlPath = outPath.getWithExtension(
|
hecl::ProjectPath evntYamlPath = outPath.getWithExtension(
|
||||||
fmt::format(fmt(_SYS_STR(".{}_{}.evnt.yaml")), sysStr, m_anim->evnt).c_str(), true);
|
fmt::format(FMT_STRING(_SYS_STR(".{}_{}.evnt.yaml")), sysStr, m_anim->evnt).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) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ void CINF::sendVertexGroupsToBlender(hecl::blender::PyOutStream& os) const {
|
||||||
for (atUint32 bid : boneIds) {
|
for (atUint32 bid : boneIds) {
|
||||||
for (const Name& name : names) {
|
for (const Name& name : names) {
|
||||||
if (name.boneId == bid) {
|
if (name.boneId == bid) {
|
||||||
os.format(fmt("obj.vertex_groups.new(name='{}')\n"), name.name);
|
os.format(FMT_STRING("obj.vertex_groups.new(name='{}')\n"), name.name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ void CINF::sendVertexGroupsToBlender(hecl::blender::PyOutStream& os) const {
|
||||||
void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& cinfId) const {
|
void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& cinfId) const {
|
||||||
DNAANIM::RigInverter<CINF> inverter(*this);
|
DNAANIM::RigInverter<CINF> inverter(*this);
|
||||||
|
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"arm = bpy.data.armatures.new('CINF_{}')\n"
|
"arm = bpy.data.armatures.new('CINF_{}')\n"
|
||||||
"arm_obj = bpy.data.objects.new(arm.name, arm)\n"
|
"arm_obj = bpy.data.objects.new(arm.name, arm)\n"
|
||||||
"bpy.context.scene.collection.objects.link(arm_obj)\n"
|
"bpy.context.scene.collection.objects.link(arm_obj)\n"
|
||||||
|
@ -56,7 +56,7 @@ void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& c
|
||||||
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones()) {
|
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones()) {
|
||||||
zeus::simd_floats originF(bone.m_origBone.origin.simd);
|
zeus::simd_floats originF(bone.m_origBone.origin.simd);
|
||||||
zeus::simd_floats tailF(bone.m_tail.mSimd);
|
zeus::simd_floats tailF(bone.m_tail.mSimd);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"bone = arm.edit_bones.new('{}')\n"
|
"bone = arm.edit_bones.new('{}')\n"
|
||||||
"bone.head = ({},{},{})\n"
|
"bone.head = ({},{},{})\n"
|
||||||
"bone.tail = ({},{},{})\n"
|
"bone.tail = ({},{},{})\n"
|
||||||
|
@ -68,16 +68,16 @@ void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& c
|
||||||
|
|
||||||
for (const Bone& bone : bones)
|
for (const Bone& bone : bones)
|
||||||
if (bone.parentId != 2)
|
if (bone.parentId != 2)
|
||||||
os.format(fmt("arm_bone_table[{}].parent = arm_bone_table[{}]\n"), bone.id, bone.parentId);
|
os.format(FMT_STRING("arm_bone_table[{}].parent = arm_bone_table[{}]\n"), bone.id, bone.parentId);
|
||||||
|
|
||||||
os << "bpy.ops.object.mode_set(mode='OBJECT')\n";
|
os << "bpy.ops.object.mode_set(mode='OBJECT')\n";
|
||||||
|
|
||||||
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones())
|
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones())
|
||||||
os.format(fmt("arm_obj.pose.bones['{}'].rotation_mode = 'QUATERNION'\n"),
|
os.format(FMT_STRING("arm_obj.pose.bones['{}'].rotation_mode = 'QUATERNION'\n"),
|
||||||
*getBoneNameFromId(bone.m_origBone.id));
|
*getBoneNameFromId(bone.m_origBone.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CINF::GetCINFArmatureName(const UniqueID32& cinfId) { return fmt::format(fmt("CINF_{}"), cinfId); }
|
std::string CINF::GetCINFArmatureName(const UniqueID32& cinfId) { return fmt::format(FMT_STRING("CINF_{}"), cinfId); }
|
||||||
|
|
||||||
int CINF::RecursiveAddArmatureBone(const Armature& armature, const BlenderBone* bone, int parent, int& curId,
|
int CINF::RecursiveAddArmatureBone(const Armature& armature, const BlenderBone* bone, int parent, int& curId,
|
||||||
std::unordered_map<std::string, atInt32>& idMap,
|
std::unordered_map<std::string, atInt32>& idMap,
|
||||||
|
@ -167,7 +167,7 @@ bool CINF::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
return false;
|
return false;
|
||||||
auto os = conn.beginPythonOut(true);
|
auto os = conn.beginPythonOut(true);
|
||||||
|
|
||||||
os.format(fmt("import bpy\n"
|
os.format(FMT_STRING("import bpy\n"
|
||||||
"from mathutils import Vector\n"
|
"from mathutils import Vector\n"
|
||||||
"bpy.context.scene.name = 'CINF_{}'\n"
|
"bpy.context.scene.name = 'CINF_{}'\n"
|
||||||
"bpy.context.scene.hecl_arm_obj = bpy.context.scene.name\n"
|
"bpy.context.scene.hecl_arm_obj = bpy.context.scene.name\n"
|
||||||
|
|
|
@ -26,7 +26,7 @@ void Material::AddTexture(Stream& out, GX::TexGenSrc type, int mtxIdx, uint32_t
|
||||||
if (mtxIdx == -1)
|
if (mtxIdx == -1)
|
||||||
mtxLabel = "IDENTITY";
|
mtxLabel = "IDENTITY";
|
||||||
else
|
else
|
||||||
mtxLabel = fmt::format(fmt("MTX_{}"), mtxIdx);
|
mtxLabel = fmt::format(FMT_STRING("MTX_{}"), mtxIdx);
|
||||||
|
|
||||||
std::string texLabel;
|
std::string texLabel;
|
||||||
if (diffuse)
|
if (diffuse)
|
||||||
|
@ -34,14 +34,14 @@ void Material::AddTexture(Stream& out, GX::TexGenSrc type, int mtxIdx, uint32_t
|
||||||
else
|
else
|
||||||
texLabel = "Texture";
|
texLabel = "Texture";
|
||||||
|
|
||||||
out.format(fmt("# Texture\n"
|
out.format(FMT_STRING("# Texture\n"
|
||||||
"tex_node = new_nodetree.nodes.new('ShaderNodeTexImage')\n"
|
"tex_node = new_nodetree.nodes.new('ShaderNodeTexImage')\n"
|
||||||
"tex_node.label = '{} {}'\n"
|
"tex_node.label = '{} {}'\n"
|
||||||
"texture_nodes.append(tex_node)\n"),
|
"texture_nodes.append(tex_node)\n"),
|
||||||
texLabel, texIdx);
|
texLabel, texIdx);
|
||||||
|
|
||||||
if (texIdx != 0xff)
|
if (texIdx != 0xff)
|
||||||
out.format(fmt("tex_node.image = tex_maps[{}]\n"), texIdx);
|
out.format(FMT_STRING("tex_node.image = tex_maps[{}]\n"), texIdx);
|
||||||
|
|
||||||
if (type == GX::TG_POS)
|
if (type == GX::TG_POS)
|
||||||
out << "tex_uv_node = new_nodetree.nodes.new('ShaderNodeTexCoord')\n"
|
out << "tex_uv_node = new_nodetree.nodes.new('ShaderNodeTexCoord')\n"
|
||||||
|
@ -51,13 +51,13 @@ void Material::AddTexture(Stream& out, GX::TexGenSrc type, int mtxIdx, uint32_t
|
||||||
"tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['Normal'], tex_node.inputs['Vector']))\n";
|
"tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['Normal'], tex_node.inputs['Vector']))\n";
|
||||||
else if (type >= GX::TG_TEX0 && type <= GX::TG_TEX7) {
|
else if (type >= GX::TG_TEX0 && type <= GX::TG_TEX7) {
|
||||||
uint8_t texIdx = type - GX::TG_TEX0;
|
uint8_t texIdx = type - GX::TG_TEX0;
|
||||||
out.format(fmt("tex_uv_node = new_nodetree.nodes.new('ShaderNodeUVMap')\n"
|
out.format(FMT_STRING("tex_uv_node = new_nodetree.nodes.new('ShaderNodeUVMap')\n"
|
||||||
"tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['UV'], tex_node.inputs['Vector']))\n"
|
"tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['UV'], tex_node.inputs['Vector']))\n"
|
||||||
"tex_uv_node.uv_map = 'UV_{}'\n"),
|
"tex_uv_node.uv_map = 'UV_{}'\n"),
|
||||||
texIdx);
|
texIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
out.format(fmt("tex_uv_node.label = '{}'\n"), mtxLabel);
|
out.format(FMT_STRING("tex_uv_node.label = '{}'\n"), mtxLabel);
|
||||||
|
|
||||||
out << "gridder.place_node(tex_uv_node, 0)\n"
|
out << "gridder.place_node(tex_uv_node, 0)\n"
|
||||||
"gridder.place_node(tex_node, 0)\n"
|
"gridder.place_node(tex_node, 0)\n"
|
||||||
|
@ -70,7 +70,7 @@ void Material::AddTexture(Stream& out, GX::TexGenSrc type, int mtxIdx, uint32_t
|
||||||
void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx, const float* vals) {
|
void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx, const float* vals) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case UVAnimation::Mode::MvInvNoTranslation:
|
case UVAnimation::Mode::MvInvNoTranslation:
|
||||||
out.format(fmt("for link in list(tex_links):\n"
|
out.format(FMT_STRING("for link in list(tex_links):\n"
|
||||||
" if link.from_node.label == 'MTX_{}':\n"
|
" if link.from_node.label == 'MTX_{}':\n"
|
||||||
" tex_links.remove(link)\n"
|
" tex_links.remove(link)\n"
|
||||||
" soc_from = link.from_socket\n"
|
" soc_from = link.from_socket\n"
|
||||||
|
@ -85,7 +85,7 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
||||||
idx);
|
idx);
|
||||||
break;
|
break;
|
||||||
case UVAnimation::Mode::MvInv:
|
case UVAnimation::Mode::MvInv:
|
||||||
out.format(fmt("for link in list(tex_links):\n"
|
out.format(FMT_STRING("for link in list(tex_links):\n"
|
||||||
" if link.from_node.label == 'MTX_{}':\n"
|
" if link.from_node.label == 'MTX_{}':\n"
|
||||||
" tex_links.remove(link)\n"
|
" tex_links.remove(link)\n"
|
||||||
" soc_from = link.from_socket\n"
|
" soc_from = link.from_socket\n"
|
||||||
|
@ -100,7 +100,7 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
||||||
idx);
|
idx);
|
||||||
break;
|
break;
|
||||||
case UVAnimation::Mode::Scroll:
|
case UVAnimation::Mode::Scroll:
|
||||||
out.format(fmt("for link in list(tex_links):\n"
|
out.format(FMT_STRING("for link in list(tex_links):\n"
|
||||||
" if link.from_node.label == 'MTX_{}':\n"
|
" if link.from_node.label == 'MTX_{}':\n"
|
||||||
" tex_links.remove(link)\n"
|
" tex_links.remove(link)\n"
|
||||||
" soc_from = link.from_socket\n"
|
" soc_from = link.from_socket\n"
|
||||||
|
@ -117,7 +117,7 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
||||||
idx, vals[0], vals[1], vals[2], vals[3]);
|
idx, vals[0], vals[1], vals[2], vals[3]);
|
||||||
break;
|
break;
|
||||||
case UVAnimation::Mode::Rotation:
|
case UVAnimation::Mode::Rotation:
|
||||||
out.format(fmt("for link in list(tex_links):\n"
|
out.format(FMT_STRING("for link in list(tex_links):\n"
|
||||||
" if link.from_node.label == 'MTX_{}':\n"
|
" if link.from_node.label == 'MTX_{}':\n"
|
||||||
" tex_links.remove(link)\n"
|
" tex_links.remove(link)\n"
|
||||||
" soc_from = link.from_socket\n"
|
" soc_from = link.from_socket\n"
|
||||||
|
@ -134,7 +134,7 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
||||||
idx, vals[0], vals[1]);
|
idx, vals[0], vals[1]);
|
||||||
break;
|
break;
|
||||||
case UVAnimation::Mode::HStrip:
|
case UVAnimation::Mode::HStrip:
|
||||||
out.format(fmt("for link in list(tex_links):\n"
|
out.format(FMT_STRING("for link in list(tex_links):\n"
|
||||||
" if link.from_node.label == 'MTX_{}':\n"
|
" if link.from_node.label == 'MTX_{}':\n"
|
||||||
" tex_links.remove(link)\n"
|
" tex_links.remove(link)\n"
|
||||||
" soc_from = link.from_socket\n"
|
" soc_from = link.from_socket\n"
|
||||||
|
@ -153,7 +153,7 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
||||||
idx, vals[0], vals[1], vals[2], vals[3]);
|
idx, vals[0], vals[1], vals[2], vals[3]);
|
||||||
break;
|
break;
|
||||||
case UVAnimation::Mode::VStrip:
|
case UVAnimation::Mode::VStrip:
|
||||||
out.format(fmt("for link in list(tex_links):\n"
|
out.format(FMT_STRING("for link in list(tex_links):\n"
|
||||||
" if link.from_node.label == 'MTX_{}':\n"
|
" if link.from_node.label == 'MTX_{}':\n"
|
||||||
" tex_links.remove(link)\n"
|
" tex_links.remove(link)\n"
|
||||||
" soc_from = link.from_socket\n"
|
" soc_from = link.from_socket\n"
|
||||||
|
@ -172,7 +172,7 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
||||||
idx, vals[0], vals[1], vals[2], vals[3]);
|
idx, vals[0], vals[1], vals[2], vals[3]);
|
||||||
break;
|
break;
|
||||||
case UVAnimation::Mode::Model:
|
case UVAnimation::Mode::Model:
|
||||||
out.format(fmt("for link in list(tex_links):\n"
|
out.format(FMT_STRING("for link in list(tex_links):\n"
|
||||||
" if link.from_node.label == 'MTX_{}':\n"
|
" if link.from_node.label == 'MTX_{}':\n"
|
||||||
" tex_links.remove(link)\n"
|
" tex_links.remove(link)\n"
|
||||||
" soc_from = link.from_socket\n"
|
" soc_from = link.from_socket\n"
|
||||||
|
@ -187,7 +187,7 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
||||||
idx);
|
idx);
|
||||||
break;
|
break;
|
||||||
case UVAnimation::Mode::CylinderEnvironment:
|
case UVAnimation::Mode::CylinderEnvironment:
|
||||||
out.format(fmt("for link in list(tex_links):\n"
|
out.format(FMT_STRING("for link in list(tex_links):\n"
|
||||||
" if link.from_node.label == 'MTX_{}':\n"
|
" if link.from_node.label == 'MTX_{}':\n"
|
||||||
" tex_links.remove(link)\n"
|
" tex_links.remove(link)\n"
|
||||||
" soc_from = link.from_socket\n"
|
" soc_from = link.from_socket\n"
|
||||||
|
@ -204,7 +204,7 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
||||||
idx, vals[0], vals[1]);
|
idx, vals[0], vals[1]);
|
||||||
break;
|
break;
|
||||||
case UVAnimation::Mode::Eight:
|
case UVAnimation::Mode::Eight:
|
||||||
out.format(fmt("for link in list(tex_links):\n"
|
out.format(FMT_STRING("for link in list(tex_links):\n"
|
||||||
" if link.from_node.label == 'MTX_{}':\n"
|
" if link.from_node.label == 'MTX_{}':\n"
|
||||||
" tex_links.remove(link)\n"
|
" tex_links.remove(link)\n"
|
||||||
" soc_from = link.from_socket\n"
|
" soc_from = link.from_socket\n"
|
||||||
|
@ -233,7 +233,7 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
||||||
}
|
}
|
||||||
|
|
||||||
void Material::AddKcolor(Stream& out, const GX::Color& col, unsigned idx) {
|
void Material::AddKcolor(Stream& out, const GX::Color& col, unsigned idx) {
|
||||||
out.format(fmt("kcolors[{}] = ({}, {}, {}, {})\n"
|
out.format(FMT_STRING("kcolors[{}] = ({}, {}, {}, {})\n"
|
||||||
"kalphas[{}] = {}\n"
|
"kalphas[{}] = {}\n"
|
||||||
"\n"),
|
"\n"),
|
||||||
idx, (float)col.color[0] / (float)0xff, (float)col.color[1] / (float)0xff,
|
idx, (float)col.color[0] / (float)0xff, (float)col.color[1] / (float)0xff,
|
||||||
|
@ -343,14 +343,14 @@ template <class MAT>
|
||||||
static void _DescribeTEV(const MAT& mat) {
|
static void _DescribeTEV(const MAT& mat) {
|
||||||
for (uint32_t i = 0; i < mat.tevStageCount; ++i) {
|
for (uint32_t i = 0; i < mat.tevStageCount; ++i) {
|
||||||
const auto& stage = mat.tevStages[i];
|
const auto& stage = mat.tevStages[i];
|
||||||
fmt::print(stderr, fmt("A:{} B:{} C:{} D:{} -> {} | A:{} B:{} C:{} D:{} -> {}\n"), ToString(stage.colorInA()),
|
fmt::print(stderr, FMT_STRING("A:{} B:{} C:{} D:{} -> {} | A:{} B:{} C:{} D:{} -> {}\n"), ToString(stage.colorInA()),
|
||||||
ToString(stage.colorInB()), ToString(stage.colorInC()), ToString(stage.colorInD()),
|
ToString(stage.colorInB()), ToString(stage.colorInC()), ToString(stage.colorInD()),
|
||||||
ToString(stage.colorOpOutReg()), ToString(stage.alphaInA()), ToString(stage.alphaInB()),
|
ToString(stage.colorOpOutReg()), ToString(stage.alphaInA()), ToString(stage.alphaInB()),
|
||||||
ToString(stage.alphaInC()), ToString(stage.alphaInD()), ToString(stage.alphaOpOutReg()));
|
ToString(stage.alphaInC()), ToString(stage.alphaInD()), ToString(stage.alphaOpOutReg()));
|
||||||
}
|
}
|
||||||
bool hasInd = mat.flags.samusReflectionIndirectTexture();
|
bool hasInd = mat.flags.samusReflectionIndirectTexture();
|
||||||
bool hasLm = mat.flags.lightmap();
|
bool hasLm = mat.flags.lightmap();
|
||||||
fmt::print(stderr, fmt("HasIndirect: {} HasLightmap: {}\n"), hasInd, hasLm);
|
fmt::print(stderr, FMT_STRING("HasIndirect: {} HasLightmap: {}\n"), hasInd, hasLm);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TexLink {
|
struct TexLink {
|
||||||
|
@ -440,7 +440,7 @@ template <class MAT>
|
||||||
static void _ConstructMaterial(Stream& out, const MAT& material, unsigned groupIdx, unsigned matIdx) {
|
static void _ConstructMaterial(Stream& out, const MAT& material, unsigned groupIdx, unsigned matIdx) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
out.format(fmt("new_material = bpy.data.materials.new('MAT_{}_{}')\n"), groupIdx, matIdx);
|
out.format(FMT_STRING("new_material = bpy.data.materials.new('MAT_{}_{}')\n"), groupIdx, matIdx);
|
||||||
out << "new_material.use_fake_user = True\n"
|
out << "new_material.use_fake_user = True\n"
|
||||||
"new_material.use_nodes = True\n"
|
"new_material.use_nodes = True\n"
|
||||||
"new_material.use_backface_culling = True\n"
|
"new_material.use_backface_culling = True\n"
|
||||||
|
@ -458,7 +458,7 @@ static void _ConstructMaterial(Stream& out, const MAT& material, unsigned groupI
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
/* Material Flags */
|
/* Material Flags */
|
||||||
out.format(fmt("new_material.retro_depth_sort = {}\n"
|
out.format(FMT_STRING("new_material.retro_depth_sort = {}\n"
|
||||||
"new_material.retro_alpha_test = {}\n"
|
"new_material.retro_alpha_test = {}\n"
|
||||||
"new_material.retro_samus_reflection = {}\n"
|
"new_material.retro_samus_reflection = {}\n"
|
||||||
"new_material.retro_depth_write = {}\n"
|
"new_material.retro_depth_write = {}\n"
|
||||||
|
@ -477,7 +477,7 @@ static void _ConstructMaterial(Stream& out, const MAT& material, unsigned groupI
|
||||||
/* Texture Indices */
|
/* Texture Indices */
|
||||||
out << "tex_maps = []\n";
|
out << "tex_maps = []\n";
|
||||||
for (atUint32 idx : material.textureIdxs)
|
for (atUint32 idx : material.textureIdxs)
|
||||||
out.format(fmt("tex_maps.append(texmap_list[{}])\n"), idx);
|
out.format(FMT_STRING("tex_maps.append(texmap_list[{}])\n"), idx);
|
||||||
|
|
||||||
/* KColor entries */
|
/* KColor entries */
|
||||||
if (material.flags.konstValuesEnabled()) {
|
if (material.flags.konstValuesEnabled()) {
|
||||||
|
@ -784,7 +784,7 @@ static void _ConstructMaterial(Stream& out, const MAT& material, unsigned groupI
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_DescribeTEV(material);
|
_DescribeTEV(material);
|
||||||
Log.report(logvisor::Fatal, fmt("Unable to resolve shader hash {:08X}\n"), hash);
|
Log.report(logvisor::Fatal, FMT_STRING("Unable to resolve shader hash {:08X}\n"), hash);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1132,7 +1132,7 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
|
||||||
else if (gameFunction == "RetroUVMode2Node") {
|
else if (gameFunction == "RetroUVMode2Node") {
|
||||||
mode = Mode::Scroll;
|
mode = Mode::Scroll;
|
||||||
if (gameArgs.size() < 2)
|
if (gameArgs.size() < 2)
|
||||||
Log.report(logvisor::Fatal, fmt("Mode2 UV anim requires 2 vector arguments"));
|
Log.report(logvisor::Fatal, FMT_STRING("Mode2 UV anim requires 2 vector arguments"));
|
||||||
vals[0] = gameArgs[0].simd[0];
|
vals[0] = gameArgs[0].simd[0];
|
||||||
vals[1] = gameArgs[0].simd[1];
|
vals[1] = gameArgs[0].simd[1];
|
||||||
vals[2] = gameArgs[1].simd[0];
|
vals[2] = gameArgs[1].simd[0];
|
||||||
|
@ -1140,13 +1140,13 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
|
||||||
} else if (gameFunction == "RetroUVMode3Node") {
|
} else if (gameFunction == "RetroUVMode3Node") {
|
||||||
mode = Mode::Rotation;
|
mode = Mode::Rotation;
|
||||||
if (gameArgs.size() < 2)
|
if (gameArgs.size() < 2)
|
||||||
Log.report(logvisor::Fatal, fmt("Mode3 UV anim requires 2 arguments"));
|
Log.report(logvisor::Fatal, FMT_STRING("Mode3 UV anim requires 2 arguments"));
|
||||||
vals[0] = gameArgs[0].simd[0];
|
vals[0] = gameArgs[0].simd[0];
|
||||||
vals[1] = gameArgs[1].simd[0];
|
vals[1] = gameArgs[1].simd[0];
|
||||||
} else if (gameFunction == "RetroUVMode4Node") {
|
} else if (gameFunction == "RetroUVMode4Node") {
|
||||||
mode = Mode::HStrip;
|
mode = Mode::HStrip;
|
||||||
if (gameArgs.size() < 4)
|
if (gameArgs.size() < 4)
|
||||||
Log.report(logvisor::Fatal, fmt("Mode4 UV anim requires 4 arguments"));
|
Log.report(logvisor::Fatal, FMT_STRING("Mode4 UV anim requires 4 arguments"));
|
||||||
vals[0] = gameArgs[0].simd[0];
|
vals[0] = gameArgs[0].simd[0];
|
||||||
vals[1] = gameArgs[1].simd[0];
|
vals[1] = gameArgs[1].simd[0];
|
||||||
vals[2] = gameArgs[2].simd[0];
|
vals[2] = gameArgs[2].simd[0];
|
||||||
|
@ -1154,7 +1154,7 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
|
||||||
} else if (gameFunction == "RetroUVMode5Node") {
|
} else if (gameFunction == "RetroUVMode5Node") {
|
||||||
mode = Mode::VStrip;
|
mode = Mode::VStrip;
|
||||||
if (gameArgs.size() < 4)
|
if (gameArgs.size() < 4)
|
||||||
Log.report(logvisor::Fatal, fmt("Mode5 UV anim requires 4 arguments"));
|
Log.report(logvisor::Fatal, FMT_STRING("Mode5 UV anim requires 4 arguments"));
|
||||||
vals[0] = gameArgs[0].simd[0];
|
vals[0] = gameArgs[0].simd[0];
|
||||||
vals[1] = gameArgs[1].simd[0];
|
vals[1] = gameArgs[1].simd[0];
|
||||||
vals[2] = gameArgs[2].simd[0];
|
vals[2] = gameArgs[2].simd[0];
|
||||||
|
@ -1164,11 +1164,11 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
|
||||||
else if (gameFunction == "RetroUVMode7NodeN") {
|
else if (gameFunction == "RetroUVMode7NodeN") {
|
||||||
mode = Mode::CylinderEnvironment;
|
mode = Mode::CylinderEnvironment;
|
||||||
if (gameArgs.size() < 2)
|
if (gameArgs.size() < 2)
|
||||||
Log.report(logvisor::Fatal, fmt("Mode7 UV anim requires 2 arguments"));
|
Log.report(logvisor::Fatal, FMT_STRING("Mode7 UV anim requires 2 arguments"));
|
||||||
vals[0] = gameArgs[0].simd[0];
|
vals[0] = gameArgs[0].simd[0];
|
||||||
vals[1] = gameArgs[1].simd[0];
|
vals[1] = gameArgs[1].simd[0];
|
||||||
} else
|
} else
|
||||||
Log.report(logvisor::Fatal, fmt("unsupported UV anim '{}'"), gameFunction);
|
Log.report(logvisor::Fatal, FMT_STRING("unsupported UV anim '{}'"), gameFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Op>
|
template <class Op>
|
||||||
|
|
|
@ -506,9 +506,9 @@ struct MaterialSet : BigDNA {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (setIdx < 0)
|
if (setIdx < 0)
|
||||||
texEntry->name = fmt::format(fmt("{}_{}_{}"), prefix, matIdx, stageIdx);
|
texEntry->name = fmt::format(FMT_STRING("{}_{}_{}"), prefix, matIdx, stageIdx);
|
||||||
else
|
else
|
||||||
texEntry->name = fmt::format(fmt("{}_{}_{}_{}"), prefix, setIdx, matIdx, stageIdx);
|
texEntry->name = fmt::format(FMT_STRING("{}_{}_{}_{}"), prefix, setIdx, matIdx, stageIdx);
|
||||||
|
|
||||||
if (mat.flags.lightmap() && stageIdx == 0) {
|
if (mat.flags.lightmap() && stageIdx == 0) {
|
||||||
texEntry->name += "light";
|
texEntry->name += "light";
|
||||||
|
|
|
@ -8,7 +8,7 @@ void CSKR::weightVertex(hecl::blender::PyOutStream& os, const CINF& cinf, atUint
|
||||||
for (const SkinningRule& rule : skinningRules) {
|
for (const SkinningRule& rule : skinningRules) {
|
||||||
if (idx >= accum && idx < accum + rule.vertCount)
|
if (idx >= accum && idx < accum + rule.vertCount)
|
||||||
for (const SkinningRule::Weight& weight : rule.weights)
|
for (const SkinningRule::Weight& weight : rule.weights)
|
||||||
os.format(fmt("vert[dvert_lay][{}] = {}\n"), cinf.getBoneIdxFromId(weight.boneId), weight.weight);
|
os.format(FMT_STRING("vert[dvert_lay][{}] = {}\n"), cinf.getBoneIdxFromId(weight.boneId), weight.weight);
|
||||||
accum += rule.vertCount;
|
accum += rule.vertCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,8 @@ bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
|
||||||
r.emplace(songsPath.getAbsolutePath());
|
r.emplace(songsPath.getAbsolutePath());
|
||||||
athena::io::YAMLDocWriter ydw("amuse::Songs", r ? &*r : nullptr);
|
athena::io::YAMLDocWriter ydw("amuse::Songs", r ? &*r : nullptr);
|
||||||
r = std::nullopt;
|
r = std::nullopt;
|
||||||
ydw.writeString(fmt::format(fmt("{:04X}"), head.midiSetupId),
|
ydw.writeString(fmt::format(FMT_STRING("{:04X}"), head.midiSetupId),
|
||||||
fmt::format(fmt("../MidiData/{}"), midPath.getLastComponentUTF8()));
|
fmt::format(FMT_STRING("../MidiData/{}"), midPath.getLastComponentUTF8()));
|
||||||
athena::io::FileWriter w(songsPath.getAbsolutePath());
|
athena::io::FileWriter w(songsPath.getAbsolutePath());
|
||||||
ydw.finish(&w);
|
ydw.finish(&w);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ void DCLN::Collision::Node::sendToBlender(hecl::blender::PyOutStream& os) const
|
||||||
void DCLN::sendToBlender(hecl::blender::Connection& conn, std::string_view entryName) {
|
void DCLN::sendToBlender(hecl::blender::Connection& conn, std::string_view entryName) {
|
||||||
/* Open Py Stream and read sections */
|
/* Open Py Stream and read sections */
|
||||||
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"import bpy\n"
|
"import bpy\n"
|
||||||
"import bmesh\n"
|
"import bmesh\n"
|
||||||
"from mathutils import Vector, Matrix\n"
|
"from mathutils import Vector, Matrix\n"
|
||||||
|
|
|
@ -154,7 +154,7 @@ void PAKBridge::build() {
|
||||||
std::string idStr = area.areaMREAId.toString();
|
std::string idStr = area.areaMREAId.toString();
|
||||||
areaDeps.name = hecl::SystemString(_SYS_STR("MREA_")) + hecl::SystemStringConv(idStr).c_str();
|
areaDeps.name = hecl::SystemString(_SYS_STR("MREA_")) + hecl::SystemStringConv(idStr).c_str();
|
||||||
}
|
}
|
||||||
hecl::SystemString num = fmt::format(fmt(_SYS_STR("{:02d} ")), ai);
|
hecl::SystemString num = fmt::format(FMT_STRING(_SYS_STR("{:02d} ")), 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());
|
||||||
|
@ -178,7 +178,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);
|
||||||
|
|
||||||
num = fmt::format(fmt(_SYS_STR("{:02d} ")), l - 1);
|
num = fmt::format(FMT_STRING(_SYS_STR("{:02d} ")), 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);
|
||||||
|
@ -210,35 +210,35 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssoci
|
||||||
for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters) {
|
for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters) {
|
||||||
charAssoc.m_cmdlRigs[ci.cmdl] = {ci.cskr, ci.cinf};
|
charAssoc.m_cmdlRigs[ci.cmdl] = {ci.cskr, ci.cinf};
|
||||||
charAssoc.m_cskrToCharacter[ci.cskr] =
|
charAssoc.m_cskrToCharacter[ci.cskr] =
|
||||||
std::make_pair(entry.id, fmt::format(fmt("{}_{}.CSKR"), ci.name, ci.cskr));
|
std::make_pair(entry.id, fmt::format(FMT_STRING("{}_{}.CSKR"), ci.name, ci.cskr));
|
||||||
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 = fmt::format(fmt("ANCS_{}_{}_model"), id, ci.name);
|
cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_model"), id, ci.name);
|
||||||
cskrEnt->name = fmt::format(fmt("ANCS_{}_{}_skin"), id, ci.name);
|
cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skin"), id, ci.name);
|
||||||
cinfEnt->name = fmt::format(fmt("ANCS_{}_{}_skel"), id, ci.name);
|
cinfEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skel"), id, ci.name);
|
||||||
if (ci.cmdlIce.isValid() && ci.cskrIce.isValid()) {
|
if (ci.cmdlIce.isValid() && ci.cskrIce.isValid()) {
|
||||||
charAssoc.m_cmdlRigs[ci.cmdlIce] = {ci.cskrIce, ci.cinf};
|
charAssoc.m_cmdlRigs[ci.cmdlIce] = {ci.cskrIce, ci.cinf};
|
||||||
charAssoc.m_cskrToCharacter[ci.cskrIce] =
|
charAssoc.m_cskrToCharacter[ci.cskrIce] =
|
||||||
std::make_pair(entry.id, fmt::format(fmt("{}.ICE_{}.CSKR"), ci.name, ci.cskrIce));
|
std::make_pair(entry.id, fmt::format(FMT_STRING("{}.ICE_{}.CSKR"), ci.name, ci.cskrIce));
|
||||||
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlIce);
|
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlIce);
|
||||||
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrIce);
|
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrIce);
|
||||||
cmdlEnt->name = fmt::format(fmt("ANCS_{}_{}_icemodel"), id, ci.name);
|
cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_icemodel"), id, ci.name);
|
||||||
cskrEnt->name = fmt::format(fmt("ANCS_{}_{}_iceskin"), id, ci.name);
|
cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_iceskin"), id, ci.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animInfo;
|
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animInfo;
|
||||||
ancs.getAnimationResInfo(&pakRouter, animInfo);
|
ancs.getAnimationResInfo(&pakRouter, animInfo);
|
||||||
for (auto& [animIdx, animResInfo] : animInfo) {
|
for (auto& [animIdx, animResInfo] : animInfo) {
|
||||||
PAK::Entry* animEnt = (PAK::Entry*)m_pak.lookupEntry(animResInfo.animId);
|
PAK::Entry* animEnt = (PAK::Entry*)m_pak.lookupEntry(animResInfo.animId);
|
||||||
animEnt->name = fmt::format(fmt("ANCS_{}_{}"), id, animResInfo.name);
|
animEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}"), id, animResInfo.name);
|
||||||
charAssoc.m_cskrToCharacter[animResInfo.animId] =
|
charAssoc.m_cskrToCharacter[animResInfo.animId] =
|
||||||
std::make_pair(entry.id, fmt::format(fmt("{}_{}.ANIM"), animResInfo.name, animResInfo.animId));
|
std::make_pair(entry.id, fmt::format(FMT_STRING("{}_{}.ANIM"), animResInfo.name, animResInfo.animId));
|
||||||
if (animResInfo.evntId.isValid()) {
|
if (animResInfo.evntId.isValid()) {
|
||||||
PAK::Entry* evntEnt = (PAK::Entry*)m_pak.lookupEntry(animResInfo.evntId);
|
PAK::Entry* evntEnt = (PAK::Entry*)m_pak.lookupEntry(animResInfo.evntId);
|
||||||
evntEnt->name = fmt::format(fmt("ANCS_{}_{}_evnt"), id, animResInfo.name);
|
evntEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_evnt"), id, animResInfo.name);
|
||||||
charAssoc.m_cskrToCharacter[animResInfo.evntId] =
|
charAssoc.m_cskrToCharacter[animResInfo.evntId] =
|
||||||
std::make_pair(entry.id, fmt::format(fmt("{}_{}.evnt.yaml"), animResInfo.name, animResInfo.evntId));
|
std::make_pair(entry.id, fmt::format(FMT_STRING("{}_{}.evnt.yaml"), animResInfo.name, animResInfo.evntId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (entry.type == FOURCC('MREA')) {
|
} else if (entry.type == FOURCC('MREA')) {
|
||||||
|
@ -276,7 +276,7 @@ void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
|
||||||
|
|
||||||
if (mlvl.worldNameId.isValid())
|
if (mlvl.worldNameId.isValid())
|
||||||
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath,
|
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath,
|
||||||
fmt::format(fmt(_SYS_STR("!name_{}.yaml")), mlvl.worldNameId));
|
fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), mlvl.worldNameId));
|
||||||
|
|
||||||
for (const MLVL::Area& area : mlvl.areas) {
|
for (const MLVL::Area& area : mlvl.areas) {
|
||||||
{
|
{
|
||||||
|
@ -293,7 +293,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.isValid())
|
if (area.areaNameId.isValid())
|
||||||
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath,
|
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath,
|
||||||
fmt::format(fmt(_SYS_STR("!name_{}.yaml")), area.areaNameId));
|
fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), area.areaNameId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mlvl.worldMap.isValid()) {
|
if (mlvl.worldMap.isValid()) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ void FRME::Widget::Enumerate<BigDNA::Read>(athena::io::IStreamReader& __dna_read
|
||||||
widgetInfo = std::make_unique<SLGPInfo>();
|
widgetInfo = std::make_unique<SLGPInfo>();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unsupported FRME widget type {}")), type);
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unsupported FRME widget type {}")), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* widgetInfo */
|
/* widgetInfo */
|
||||||
|
@ -174,7 +174,7 @@ void FRME::Widget::CAMRInfo::Enumerate<BigDNA::Read>(athena::io::IStreamReader&
|
||||||
} else if (projectionType == ProjectionType::Orthographic) {
|
} else if (projectionType == ProjectionType::Orthographic) {
|
||||||
projection = std::make_unique<OrthographicProjection>();
|
projection = std::make_unique<OrthographicProjection>();
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Invalid CAMR projection mode! {}")), int(projectionType));
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Invalid CAMR projection mode! {}")), int(projectionType));
|
||||||
}
|
}
|
||||||
|
|
||||||
projection->read(__dna_reader);
|
projection->read(__dna_reader);
|
||||||
|
@ -183,9 +183,9 @@ void FRME::Widget::CAMRInfo::Enumerate<BigDNA::Read>(athena::io::IStreamReader&
|
||||||
template <>
|
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, fmt(_SYS_STR("Invalid CAMR projection object!")));
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Invalid CAMR projection object!")));
|
||||||
if (projection->type != projectionType)
|
if (projection->type != projectionType)
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("CAMR projection type does not match actual projection type!")));
|
Log.report(logvisor::Fatal, FMT_STRING(_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);
|
||||||
|
@ -306,7 +306,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
" bpy.context.scene.collection.objects.link(ob_new)\n"
|
" bpy.context.scene.collection.objects.link(ob_new)\n"
|
||||||
" return ob_new\n";
|
" return ob_new\n";
|
||||||
|
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"bpy.context.scene.name = '{}'\n"
|
"bpy.context.scene.name = '{}'\n"
|
||||||
"bpy.context.scene.render.resolution_x = 640\n"
|
"bpy.context.scene.render.resolution_x = 640\n"
|
||||||
"bpy.context.scene.render.resolution_y = 480\n"
|
"bpy.context.scene.render.resolution_y = 480\n"
|
||||||
|
@ -321,7 +321,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
"angle = Quaternion((1.0, 0.0, 0.0), 0)\n";
|
"angle = Quaternion((1.0, 0.0, 0.0), 0)\n";
|
||||||
if (w.type == SBIG('CAMR')) {
|
if (w.type == SBIG('CAMR')) {
|
||||||
using CAMRInfo = Widget::CAMRInfo;
|
using CAMRInfo = Widget::CAMRInfo;
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"cam = bpy.data.cameras.new(name='{}')\n"
|
"cam = bpy.data.cameras.new(name='{}')\n"
|
||||||
"binding = cam\n"),
|
"binding = cam\n"),
|
||||||
w.header.name);
|
w.header.name);
|
||||||
|
@ -329,7 +329,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
if (info->projectionType == CAMRInfo::ProjectionType::Orthographic) {
|
if (info->projectionType == CAMRInfo::ProjectionType::Orthographic) {
|
||||||
CAMRInfo::OrthographicProjection* proj =
|
CAMRInfo::OrthographicProjection* proj =
|
||||||
static_cast<CAMRInfo::OrthographicProjection*>(info->projection.get());
|
static_cast<CAMRInfo::OrthographicProjection*>(info->projection.get());
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"cam.type = 'ORTHO'\n"
|
"cam.type = 'ORTHO'\n"
|
||||||
"cam.ortho_scale = {}\n"
|
"cam.ortho_scale = {}\n"
|
||||||
"cam.clip_start = {}\n"
|
"cam.clip_start = {}\n"
|
||||||
|
@ -337,7 +337,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
std::fabs(proj->right - proj->left), proj->znear, proj->zfar);
|
std::fabs(proj->right - proj->left), proj->znear, proj->zfar);
|
||||||
} else if (info->projectionType == CAMRInfo::ProjectionType::Perspective) {
|
} else if (info->projectionType == CAMRInfo::ProjectionType::Perspective) {
|
||||||
CAMRInfo::PerspectiveProjection* proj = static_cast<CAMRInfo::PerspectiveProjection*>(info->projection.get());
|
CAMRInfo::PerspectiveProjection* proj = static_cast<CAMRInfo::PerspectiveProjection*>(info->projection.get());
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"cam.type = 'PERSP'\n"
|
"cam.type = 'PERSP'\n"
|
||||||
"cam.lens_unit = 'FOV'\n"
|
"cam.lens_unit = 'FOV'\n"
|
||||||
"cam.clip_start = {}\n"
|
"cam.clip_start = {}\n"
|
||||||
|
@ -345,10 +345,10 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
"bpy.context.scene.render.resolution_x = 480 * {}\n"),
|
"bpy.context.scene.render.resolution_x = 480 * {}\n"),
|
||||||
proj->znear, proj->zfar, proj->aspect);
|
proj->znear, proj->zfar, proj->aspect);
|
||||||
if (proj->aspect > 1.f)
|
if (proj->aspect > 1.f)
|
||||||
os.format(fmt("cam.angle = math.atan2({}, 1.0 / math.tan(math.radians({} / 2.0))) * 2.0\n"), proj->aspect,
|
os.format(FMT_STRING("cam.angle = math.atan2({}, 1.0 / math.tan(math.radians({} / 2.0))) * 2.0\n"), proj->aspect,
|
||||||
proj->fov);
|
proj->fov);
|
||||||
else
|
else
|
||||||
os.format(fmt("cam.angle = math.radians({})\n"), proj->fov);
|
os.format(FMT_STRING("cam.angle = math.radians({})\n"), proj->fov);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os << "angle = Quaternion((1.0, 0.0, 0.0), math.radians(90.0))\n";
|
os << "angle = Quaternion((1.0, 0.0, 0.0), math.radians(90.0))\n";
|
||||||
|
@ -358,7 +358,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
switch (info->type) {
|
switch (info->type) {
|
||||||
case LITEInfo::ELightType::LocalAmbient: {
|
case LITEInfo::ELightType::LocalAmbient: {
|
||||||
zeus::simd_floats colorF(w.header.color.simd);
|
zeus::simd_floats colorF(w.header.color.simd);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"bg_node.inputs[0].default_value = ({},{},{},1.0)\n"
|
"bg_node.inputs[0].default_value = ({},{},{},1.0)\n"
|
||||||
"bg_node.inputs[1].default_value = {}\n"),
|
"bg_node.inputs[1].default_value = {}\n"),
|
||||||
colorF[0], colorF[1], colorF[2], info->distQ / 8.0);
|
colorF[0], colorF[1], colorF[2], info->distQ / 8.0);
|
||||||
|
@ -370,7 +370,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
default: {
|
default: {
|
||||||
zeus::simd_floats colorF(w.header.color.simd);
|
zeus::simd_floats colorF(w.header.color.simd);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"lamp = bpy.data.lights.new(name='{}', type='POINT')\n"
|
"lamp = bpy.data.lights.new(name='{}', type='POINT')\n"
|
||||||
"lamp.color = ({}, {}, {})\n"
|
"lamp.color = ({}, {}, {})\n"
|
||||||
"lamp.hecl_falloff_constant = {}\n"
|
"lamp.hecl_falloff_constant = {}\n"
|
||||||
|
@ -384,7 +384,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
w.header.name, colorF[0], colorF[1], colorF[2], info->distC, info->distL, info->distQ, info->angC,
|
w.header.name, colorF[0], colorF[1], colorF[2], info->distC, info->distL, info->distQ, info->angC,
|
||||||
info->angL, info->angQ, info->loadedIdx);
|
info->angL, info->angQ, info->loadedIdx);
|
||||||
if (info->type == LITEInfo::ELightType::Spot)
|
if (info->type == LITEInfo::ELightType::Spot)
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"lamp.type = 'SPOT'\n"
|
"lamp.type = 'SPOT'\n"
|
||||||
"lamp.spot_size = {}\n"),
|
"lamp.spot_size = {}\n"),
|
||||||
info->cutoff);
|
info->cutoff);
|
||||||
|
@ -413,7 +413,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
|
|
||||||
if (resPath.size()) {
|
if (resPath.size()) {
|
||||||
hecl::SystemUTF8Conv resPathView(resPath);
|
hecl::SystemUTF8Conv resPathView(resPath);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"if '{}' in bpy.data.images:\n"
|
"if '{}' in bpy.data.images:\n"
|
||||||
" image = bpy.data.images['{}']\n"
|
" image = bpy.data.images['{}']\n"
|
||||||
"else:\n"
|
"else:\n"
|
||||||
|
@ -424,7 +424,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
os << "image = None\n";
|
os << "image = None\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"material = bpy.data.materials.new('{}')\n"
|
"material = bpy.data.materials.new('{}')\n"
|
||||||
"material.use_nodes = True\n"
|
"material.use_nodes = True\n"
|
||||||
"new_nodetree = material.node_tree\n"
|
"new_nodetree = material.node_tree\n"
|
||||||
|
@ -445,7 +445,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
else
|
else
|
||||||
ti = i;
|
ti = i;
|
||||||
zeus::simd_floats f(info->quadCoords[ti].simd);
|
zeus::simd_floats f(info->quadCoords[ti].simd);
|
||||||
os.format(fmt("verts.append(bm.verts.new(({},{},{})))\n"), f[0], f[1], f[2]);
|
os.format(FMT_STRING("verts.append(bm.verts.new(({},{},{})))\n"), f[0], f[1], f[2]);
|
||||||
}
|
}
|
||||||
os << "bm.faces.new(verts)\n"
|
os << "bm.faces.new(verts)\n"
|
||||||
"bm.loops.layers.uv.new('UV')\n"
|
"bm.loops.layers.uv.new('UV')\n"
|
||||||
|
@ -459,9 +459,9 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
else
|
else
|
||||||
ti = i;
|
ti = i;
|
||||||
zeus::simd_floats f(info->uvCoords[ti].simd);
|
zeus::simd_floats f(info->uvCoords[ti].simd);
|
||||||
os.format(fmt("bm.verts[{}].link_loops[0][bm.loops.layers.uv[0]].uv = ({},{})\n"), i, f[0], f[1]);
|
os.format(FMT_STRING("bm.verts[{}].link_loops[0][bm.loops.layers.uv[0]].uv = ({},{})\n"), i, f[0], f[1]);
|
||||||
}
|
}
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"binding = bpy.data.meshes.new('{}')\n"
|
"binding = bpy.data.meshes.new('{}')\n"
|
||||||
"bm.to_mesh(binding)\n"
|
"bm.to_mesh(binding)\n"
|
||||||
"bm.free()\n"
|
"bm.free()\n"
|
||||||
|
@ -471,7 +471,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
}
|
}
|
||||||
|
|
||||||
zeus::simd_floats colorF(w.header.color.simd);
|
zeus::simd_floats colorF(w.header.color.simd);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"frme_obj = bpy.data.objects.new(name='{}', object_data=binding)\n"
|
"frme_obj = bpy.data.objects.new(name='{}', object_data=binding)\n"
|
||||||
"frme_obj.pass_index = {}\n"
|
"frme_obj.pass_index = {}\n"
|
||||||
"parentName = '{}'\n"
|
"parentName = '{}'\n"
|
||||||
|
@ -501,7 +501,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
|
|
||||||
os.linkMesh(modelPath.getAbsolutePathUTF8(), pakRouter.getBestEntryName(*cmdlE));
|
os.linkMesh(modelPath.getAbsolutePathUTF8(), pakRouter.getBestEntryName(*cmdlE));
|
||||||
|
|
||||||
os.format(fmt("frme_obj.retro_model_light_mask = {}\n"), info->lightMask);
|
os.format(FMT_STRING("frme_obj.retro_model_light_mask = {}\n"), info->lightMask);
|
||||||
os << "print(obj.name)\n"
|
os << "print(obj.name)\n"
|
||||||
"copy_obj = duplicateObject(obj)\n"
|
"copy_obj = duplicateObject(obj)\n"
|
||||||
"copy_obj.parent = frme_obj\n"
|
"copy_obj.parent = frme_obj\n"
|
||||||
|
@ -516,7 +516,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
using PANEInfo = Widget::PANEInfo;
|
using PANEInfo = Widget::PANEInfo;
|
||||||
if (PANEInfo* info = static_cast<PANEInfo*>(w.widgetInfo.get())) {
|
if (PANEInfo* info = static_cast<PANEInfo*>(w.widgetInfo.get())) {
|
||||||
zeus::simd_floats f(info->scaleCenter.simd);
|
zeus::simd_floats f(info->scaleCenter.simd);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"frme_obj.retro_pane_dimensions = ({},{})\n"
|
"frme_obj.retro_pane_dimensions = ({},{})\n"
|
||||||
"frme_obj.retro_pane_scale_center = ({},{},{})\n"),
|
"frme_obj.retro_pane_scale_center = ({},{},{})\n"),
|
||||||
info->xDim, info->zDim, f[0], f[1], f[2]);
|
info->xDim, info->zDim, f[0], f[1], f[2]);
|
||||||
|
@ -533,7 +533,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
zeus::simd_floats fillF(info->fillColor.simd);
|
zeus::simd_floats fillF(info->fillColor.simd);
|
||||||
zeus::simd_floats outlineF(info->outlineColor.simd);
|
zeus::simd_floats outlineF(info->outlineColor.simd);
|
||||||
zeus::simd_floats extentF(info->blockExtent.simd);
|
zeus::simd_floats extentF(info->blockExtent.simd);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"frme_obj.retro_pane_dimensions = ({},{})\n"
|
"frme_obj.retro_pane_dimensions = ({},{})\n"
|
||||||
"frme_obj.retro_pane_scale_center = ({},{},{})\n"
|
"frme_obj.retro_pane_scale_center = ({},{},{})\n"
|
||||||
"frme_obj.retro_textpane_font_path = '{}'\n"
|
"frme_obj.retro_textpane_font_path = '{}'\n"
|
||||||
|
@ -557,7 +557,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
} else if (w.type == SBIG('TBGP')) {
|
} else if (w.type == SBIG('TBGP')) {
|
||||||
using TBGPInfo = Widget::TBGPInfo;
|
using TBGPInfo = Widget::TBGPInfo;
|
||||||
if (TBGPInfo* info = static_cast<TBGPInfo*>(w.widgetInfo.get())) {
|
if (TBGPInfo* info = static_cast<TBGPInfo*>(w.widgetInfo.get())) {
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"frme_obj.retro_tablegroup_elem_count = {}\n"
|
"frme_obj.retro_tablegroup_elem_count = {}\n"
|
||||||
"frme_obj.retro_tablegroup_elem_default = {}\n"
|
"frme_obj.retro_tablegroup_elem_default = {}\n"
|
||||||
"frme_obj.retro_tablegroup_wraparound = {}\n"),
|
"frme_obj.retro_tablegroup_wraparound = {}\n"),
|
||||||
|
@ -566,12 +566,12 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
} else if (w.type == SBIG('GRUP')) {
|
} else if (w.type == SBIG('GRUP')) {
|
||||||
using GRUPInfo = Widget::GRUPInfo;
|
using GRUPInfo = Widget::GRUPInfo;
|
||||||
if (GRUPInfo* info = static_cast<GRUPInfo*>(w.widgetInfo.get())) {
|
if (GRUPInfo* info = static_cast<GRUPInfo*>(w.widgetInfo.get())) {
|
||||||
os.format(fmt("frme_obj.retro_group_default_worker = {}\n"), info->defaultWorker);
|
os.format(FMT_STRING("frme_obj.retro_group_default_worker = {}\n"), info->defaultWorker);
|
||||||
}
|
}
|
||||||
} else if (w.type == SBIG('SLGP')) {
|
} else if (w.type == SBIG('SLGP')) {
|
||||||
using SLGPInfo = Widget::SLGPInfo;
|
using SLGPInfo = Widget::SLGPInfo;
|
||||||
if (SLGPInfo* info = static_cast<SLGPInfo*>(w.widgetInfo.get())) {
|
if (SLGPInfo* info = static_cast<SLGPInfo*>(w.widgetInfo.get())) {
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"frme_obj.retro_slider_min = {}\n"
|
"frme_obj.retro_slider_min = {}\n"
|
||||||
"frme_obj.retro_slider_max = {}\n"
|
"frme_obj.retro_slider_max = {}\n"
|
||||||
"frme_obj.retro_slider_default = {}\n"
|
"frme_obj.retro_slider_default = {}\n"
|
||||||
|
@ -583,12 +583,12 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
if (ENRGInfo* info = static_cast<ENRGInfo*>(w.widgetInfo.get())) {
|
if (ENRGInfo* info = static_cast<ENRGInfo*>(w.widgetInfo.get())) {
|
||||||
hecl::ProjectPath txtrPath = pakRouter.getWorking(info->texture);
|
hecl::ProjectPath txtrPath = pakRouter.getWorking(info->texture);
|
||||||
if (txtrPath)
|
if (txtrPath)
|
||||||
os.format(fmt("frme_obj.retro_energybar_texture_path = '{}'\n"), txtrPath.getRelativePathUTF8());
|
os.format(FMT_STRING("frme_obj.retro_energybar_texture_path = '{}'\n"), txtrPath.getRelativePathUTF8());
|
||||||
}
|
}
|
||||||
} else if (w.type == SBIG('METR')) {
|
} else if (w.type == SBIG('METR')) {
|
||||||
using METRInfo = Widget::METRInfo;
|
using METRInfo = Widget::METRInfo;
|
||||||
if (METRInfo* info = static_cast<METRInfo*>(w.widgetInfo.get())) {
|
if (METRInfo* info = static_cast<METRInfo*>(w.widgetInfo.get())) {
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"frme_obj.retro_meter_no_round_up = {}\n"
|
"frme_obj.retro_meter_no_round_up = {}\n"
|
||||||
"frme_obj.retro_meter_max_capacity = {}\n"
|
"frme_obj.retro_meter_max_capacity = {}\n"
|
||||||
"frme_obj.retro_meter_worker_count = {}\n"),
|
"frme_obj.retro_meter_worker_count = {}\n"),
|
||||||
|
@ -600,7 +600,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
w.basis[i].simd.copy_to(xfMtxF[i]);
|
w.basis[i].simd.copy_to(xfMtxF[i]);
|
||||||
zeus::simd_floats originF(w.origin.simd);
|
zeus::simd_floats originF(w.origin.simd);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n"
|
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n"
|
||||||
"mtxd = mtx.decompose()\n"
|
"mtxd = mtx.decompose()\n"
|
||||||
"frme_obj.rotation_mode = 'QUATERNION'\n"
|
"frme_obj.rotation_mode = 'QUATERNION'\n"
|
||||||
|
|
|
@ -137,7 +137,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||||
if (!areaPath.isFile())
|
if (!areaPath.isFile())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Log.report(logvisor::Info, fmt(_SYS_STR("Visiting {}")), area.path.getRelativePath());
|
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("Visiting {}")), area.path.getRelativePath());
|
||||||
|
|
||||||
hecl::ProjectPath memRelayPath(area.path, _SYS_STR("!memoryrelays.yaml"));
|
hecl::ProjectPath memRelayPath(area.path, _SYS_STR("!memoryrelays.yaml"));
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!areaInit)
|
if (!areaInit)
|
||||||
Log.report(logvisor::Info, fmt(_SYS_STR("No layer directories for area {}")), area.path.getRelativePath());
|
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("No layer directories for area {}")), area.path.getRelativePath());
|
||||||
|
|
||||||
/* Build deplist */
|
/* Build deplist */
|
||||||
MLVL::Area& areaOut = mlvl.areas.back();
|
MLVL::Area& areaOut = mlvl.areas.back();
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace DataSpec::DNAMP1 {
|
||||||
void MREA::ReadBabeDeadToBlender_1_2(hecl::blender::PyOutStream& os, athena::io::IStreamReader& rs) {
|
void MREA::ReadBabeDeadToBlender_1_2(hecl::blender::PyOutStream& os, athena::io::IStreamReader& rs) {
|
||||||
atUint32 bdMagic = rs.readUint32Big();
|
atUint32 bdMagic = rs.readUint32Big();
|
||||||
if (bdMagic != 0xBABEDEAD)
|
if (bdMagic != 0xBABEDEAD)
|
||||||
Log.report(logvisor::Fatal, fmt("invalid BABEDEAD magic"));
|
Log.report(logvisor::Fatal, FMT_STRING("invalid BABEDEAD magic"));
|
||||||
os << "bpy.context.scene.world.use_nodes = True\n"
|
os << "bpy.context.scene.world.use_nodes = True\n"
|
||||||
"bg_node = bpy.context.scene.world.node_tree.nodes['Background']\n"
|
"bg_node = bpy.context.scene.world.node_tree.nodes['Background']\n"
|
||||||
"bg_node.inputs[1].default_value = 0.0\n";
|
"bg_node.inputs[1].default_value = 0.0\n";
|
||||||
|
@ -202,7 +202,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
"from mathutils import Vector\n"
|
"from mathutils import Vector\n"
|
||||||
"bpy.context.scene.render.fps = 60\n"
|
"bpy.context.scene.render.fps = 60\n"
|
||||||
"\n";
|
"\n";
|
||||||
os.format(fmt("bpy.context.scene.name = '{}'\n"),
|
os.format(FMT_STRING("bpy.context.scene.name = '{}'\n"),
|
||||||
pakRouter.getBestEntryName(entry, false));
|
pakRouter.getBestEntryName(entry, false));
|
||||||
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath());
|
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath());
|
||||||
MaterialSet::RegisterMaterialProps(os);
|
MaterialSet::RegisterMaterialProps(os);
|
||||||
|
@ -244,7 +244,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
rs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
|
rs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
|
||||||
curSec += DNACMDL::ReadGeomSectionsToBlender<PAKRouter<PAKBridge>, MaterialSet, RigPair, DNACMDL::SurfaceHeader_1>(
|
curSec += DNACMDL::ReadGeomSectionsToBlender<PAKRouter<PAKBridge>, MaterialSet, RigPair, DNACMDL::SurfaceHeader_1>(
|
||||||
os, rs, pakRouter, entry, dummy, true, true, vertAttribs, m, head.secCount, 0, &head.secSizes[curSec]);
|
os, rs, pakRouter, entry, dummy, true, true, vertAttribs, m, head.secCount, 0, &head.secSizes[curSec]);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"obj.retro_disable_enviro_visor = {}\n"
|
"obj.retro_disable_enviro_visor = {}\n"
|
||||||
"obj.retro_disable_thermal_visor = {}\n"
|
"obj.retro_disable_thermal_visor = {}\n"
|
||||||
"obj.retro_disable_xray_visor = {}\n"
|
"obj.retro_disable_xray_visor = {}\n"
|
||||||
|
@ -314,7 +314,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
"bpy.context.view_layer.layer_collection.children['Collision'].hide_viewport = True\n";
|
"bpy.context.view_layer.layer_collection.children['Collision'].hide_viewport = True\n";
|
||||||
|
|
||||||
/* Link MLVL scene as background */
|
/* Link MLVL scene as background */
|
||||||
os.linkBackground(fmt::format(fmt("//../!world_{}.blend"),
|
os.linkBackground(fmt::format(FMT_STRING("//../!world_{}.blend"),
|
||||||
pakRouter.getCurrentBridge().getLevelId()), "World"sv);
|
pakRouter.getCurrentBridge().getLevelId()), "World"sv);
|
||||||
|
|
||||||
os.centerView();
|
os.centerView();
|
||||||
|
@ -332,7 +332,7 @@ void MREA::Name(const SpecBase& dataSpec, PAKEntryReadStream& rs, PAKRouter<PAKB
|
||||||
atUint64 secStart = rs.position();
|
atUint64 secStart = rs.position();
|
||||||
MaterialSet matSet;
|
MaterialSet matSet;
|
||||||
matSet.read(rs);
|
matSet.read(rs);
|
||||||
matSet.nameTextures(pakRouter, fmt::format(fmt("MREA_{}"), entry.id).c_str(), -1);
|
matSet.nameTextures(pakRouter, fmt::format(FMT_STRING("MREA_{}"), entry.id).c_str(), -1);
|
||||||
rs.seek(secStart + head.secSizes[0], athena::SeekOrigin::Begin);
|
rs.seek(secStart + head.secSizes[0], athena::SeekOrigin::Begin);
|
||||||
|
|
||||||
/* Skip to SCLY */
|
/* Skip to SCLY */
|
||||||
|
@ -700,12 +700,12 @@ bool MREA::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
VisiGenPath += _SYS_STR(".exe");
|
VisiGenPath += _SYS_STR(".exe");
|
||||||
#endif
|
#endif
|
||||||
hecl::SystemString thrIdx = fmt::format(fmt(_SYS_STR("{}")), hecl::ClientProcess::GetThreadWorkerIdx());
|
hecl::SystemString thrIdx = fmt::format(FMT_STRING(_SYS_STR("{}")), hecl::ClientProcess::GetThreadWorkerIdx());
|
||||||
hecl::SystemString parPid;
|
hecl::SystemString parPid;
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
parPid = fmt::format(fmt(_SYS_STR("{}")), reinterpret_cast<unsigned long long>(GetCurrentProcess()));
|
parPid = fmt::format(FMT_STRING(_SYS_STR("{}")), reinterpret_cast<unsigned long long>(GetCurrentProcess()));
|
||||||
#else
|
#else
|
||||||
parPid = fmt::format(fmt(_SYS_STR("{}")), (unsigned long long)getpid());
|
parPid = fmt::format(FMT_STRING(_SYS_STR("{}")), (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(),
|
||||||
|
@ -720,7 +720,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||||
r.readBytesToBuf(secs.back().data(), length);
|
r.readBytesToBuf(secs.back().data(), length);
|
||||||
visiGood = true;
|
visiGood = true;
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unable to launch {}")), VisiGenPath);
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to launch {}")), VisiGenPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10,7 +10,7 @@ template <>
|
||||||
void PAK::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
|
void PAK::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
|
||||||
atUint32 version = reader.readUint32Big();
|
atUint32 version = reader.readUint32Big();
|
||||||
if (version != 0x00030005)
|
if (version != 0x00030005)
|
||||||
Log.report(logvisor::Fatal, fmt("unexpected PAK magic"));
|
Log.report(logvisor::Fatal, FMT_STRING("unexpected PAK magic"));
|
||||||
reader.readUint32Big();
|
reader.readUint32Big();
|
||||||
|
|
||||||
atUint32 nameCount = reader.readUint32Big();
|
atUint32 nameCount = reader.readUint32Big();
|
||||||
|
@ -147,6 +147,7 @@ const PAK::Entry* PAK::lookupEntry(const UniqueID32& id) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
const PAK::Entry* PAK::lookupEntry(std::string_view name) const {
|
const PAK::Entry* PAK::lookupEntry(std::string_view name) const {
|
||||||
|
// TODO: Heterogeneous lookup when C++20 available
|
||||||
auto result = m_nameMap.find(name.data());
|
auto result = m_nameMap.find(name.data());
|
||||||
if (result != m_nameMap.end()) {
|
if (result != m_nameMap.end()) {
|
||||||
auto result1 = m_entries.find(result->second);
|
auto result1 = m_entries.find(result->second);
|
||||||
|
@ -164,19 +165,19 @@ std::string PAK::bestEntryName(const nod::Node& pakNode, const Entry& entry, std
|
||||||
AGSC::Header header;
|
AGSC::Header header;
|
||||||
header.read(rs);
|
header.read(rs);
|
||||||
catalogueName = header.groupName;
|
catalogueName = header.groupName;
|
||||||
return fmt::format(fmt("{}_{}"), header.groupName, entry.id);
|
return fmt::format(FMT_STRING("{}_{}"), header.groupName, entry.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prefer named entries first */
|
/* Prefer named entries first */
|
||||||
for (const NameEntry& nentry : m_nameEntries) {
|
for (const NameEntry& nentry : m_nameEntries) {
|
||||||
if (nentry.id == entry.id) {
|
if (nentry.id == entry.id) {
|
||||||
catalogueName = nentry.name;
|
catalogueName = nentry.name;
|
||||||
return fmt::format(fmt("{}_{}"), nentry.name, entry.id);
|
return fmt::format(FMT_STRING("{}_{}"), nentry.name, entry.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise return ID format string */
|
/* Otherwise return ID format string */
|
||||||
return fmt::format(fmt("{}_{}"), entry.type, entry.id);
|
return fmt::format(FMT_STRING("{}_{}"), entry.type, entry.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DataSpec::DNAMP1
|
} // namespace DataSpec::DNAMP1
|
||||||
|
|
|
@ -87,13 +87,13 @@ struct SCAN : BigDNA {
|
||||||
scan.read(rs);
|
scan.read(rs);
|
||||||
if (scan.string.isValid()) {
|
if (scan.string.isValid()) {
|
||||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(scan.string);
|
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(scan.string);
|
||||||
ent->name = fmt::format(fmt("SCAN_{}_strg"), entry.id);
|
ent->name = fmt::format(FMT_STRING("SCAN_{}_strg"), entry.id);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
const Texture& tex = scan.textures[i];
|
const Texture& tex = scan.textures[i];
|
||||||
if (tex.texture.isValid()) {
|
if (tex.texture.isValid()) {
|
||||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(tex.texture);
|
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(tex.texture);
|
||||||
ent->name = fmt::format(fmt("SCAN_{}_tex{}"), entry.id, i + 1);
|
ent->name = fmt::format(FMT_STRING("SCAN_{}_tex{}"), entry.id, i + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,12 +115,12 @@ void SCLY::ScriptLayer::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs) {
|
||||||
size_t actualLen = rs.position() - start;
|
size_t actualLen = rs.position() - start;
|
||||||
if (actualLen != len)
|
if (actualLen != len)
|
||||||
Log.report(logvisor::Fatal,
|
Log.report(logvisor::Fatal,
|
||||||
fmt(_SYS_STR("Error while reading object of type 0x{:02X}, did not read the expected amount of "
|
FMT_STRING(_SYS_STR("Error while reading object of type 0x{:02X}, did not read the expected amount of "
|
||||||
"data, read 0x{:x}, expected 0x{:x}")),
|
"data, read 0x{:x}, expected 0x{:x}")),
|
||||||
(atUint32)type, actualLen, len);
|
(atUint32)type, actualLen, len);
|
||||||
rs.seek(start + len, athena::SeekOrigin::Begin);
|
rs.seek(start + len, athena::SeekOrigin::Begin);
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find type 0x{:X} in object database")), (atUint32)type);
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to find type 0x{:X} in object database")), (atUint32)type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ void SCLY::ScriptLayer::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& r
|
||||||
obj->type = type;
|
obj->type = type;
|
||||||
objects.push_back(std::move(obj));
|
objects.push_back(std::move(obj));
|
||||||
} else
|
} else
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find type 0x{:X} in object database")), (atUint32)type);
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to find type 0x{:X} in object database")), (atUint32)type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -165,7 +165,7 @@ void SCLY::ScriptLayer::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& ws)
|
||||||
obj->write(ws);
|
obj->write(ws);
|
||||||
auto wrote = ws.position() - start;
|
auto wrote = ws.position() - start;
|
||||||
if (wrote != expLen)
|
if (wrote != expLen)
|
||||||
Log.report(logvisor::Error, fmt("expected writing {} byte SCLY obj; wrote {}"), expLen, wrote);
|
Log.report(logvisor::Error, FMT_STRING("expected writing {} byte SCLY obj; wrote {}"), expLen, wrote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ static std::u16string_view::const_iterator CookTextureList(std::u16string& ret,
|
||||||
while (true) {
|
while (true) {
|
||||||
auto end = str.find_first_of(u",;", it - str.begin());
|
auto end = str.find_first_of(u",;", it - str.begin());
|
||||||
if (end == std::u16string::npos)
|
if (end == std::u16string::npos)
|
||||||
Log.report(logvisor::Fatal, fmt("Missing comma/semicolon token while pasing font tag"));
|
Log.report(logvisor::Fatal, FMT_STRING("Missing comma/semicolon token while pasing font tag"));
|
||||||
auto endIt = str.begin() + end;
|
auto endIt = str.begin() + end;
|
||||||
hecl::ProjectPath path =
|
hecl::ProjectPath path =
|
||||||
UniqueIDBridge::MakePathFromString<UniqueID32>(hecl::Char16ToUTF8(std::u16string(it, endIt)));
|
UniqueIDBridge::MakePathFromString<UniqueID32>(hecl::Char16ToUTF8(std::u16string(it, endIt)));
|
||||||
|
@ -92,7 +92,7 @@ static std::u16string_view::const_iterator GatherTextureList(std::vector<hecl::P
|
||||||
while (true) {
|
while (true) {
|
||||||
auto end = str.find_first_of(u",;", it - str.begin());
|
auto end = str.find_first_of(u",;", it - str.begin());
|
||||||
if (end == std::u16string::npos)
|
if (end == std::u16string::npos)
|
||||||
Log.report(logvisor::Fatal, fmt("Missing comma/semicolon token while pasing font tag"));
|
Log.report(logvisor::Fatal, FMT_STRING("Missing comma/semicolon token while pasing font tag"));
|
||||||
auto endIt = str.begin() + end;
|
auto endIt = str.begin() + end;
|
||||||
hecl::ProjectPath path =
|
hecl::ProjectPath path =
|
||||||
UniqueIDBridge::MakePathFromString<UniqueID32>(hecl::Char16ToUTF8(std::u16string(it, endIt)));
|
UniqueIDBridge::MakePathFromString<UniqueID32>(hecl::Char16ToUTF8(std::u16string(it, endIt)));
|
||||||
|
@ -198,7 +198,7 @@ static std::u16string CookString(std::u16string_view str) {
|
||||||
it += 5;
|
it += 5;
|
||||||
auto scpos = str.find(u';', it - str.begin());
|
auto scpos = str.find(u';', it - str.begin());
|
||||||
if (scpos == std::u16string::npos)
|
if (scpos == std::u16string::npos)
|
||||||
Log.report(logvisor::Fatal, fmt("Missing semicolon token while pasing font tag"));
|
Log.report(logvisor::Fatal, FMT_STRING("Missing semicolon token while pasing font tag"));
|
||||||
hecl::ProjectPath path =
|
hecl::ProjectPath path =
|
||||||
UniqueIDBridge::MakePathFromString<UniqueID32>(hecl::Char16ToUTF8(std::u16string(it, str.begin() + scpos)));
|
UniqueIDBridge::MakePathFromString<UniqueID32>(hecl::Char16ToUTF8(std::u16string(it, str.begin() + scpos)));
|
||||||
ret.append(hecl::UTF8ToChar16(UniqueID32(path).toString()));
|
ret.append(hecl::UTF8ToChar16(UniqueID32(path).toString()));
|
||||||
|
@ -249,7 +249,7 @@ void STRG::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const {
|
||||||
it += 5;
|
it += 5;
|
||||||
auto scpos = str.find(u';', it - strView.begin());
|
auto scpos = str.find(u';', it - strView.begin());
|
||||||
if (scpos == std::u16string::npos)
|
if (scpos == std::u16string::npos)
|
||||||
Log.report(logvisor::Fatal, fmt("Missing semicolon token while pasing font tag"));
|
Log.report(logvisor::Fatal, FMT_STRING("Missing semicolon token while pasing font tag"));
|
||||||
hecl::ProjectPath path = UniqueIDBridge::MakePathFromString<UniqueID32>(
|
hecl::ProjectPath path = UniqueIDBridge::MakePathFromString<UniqueID32>(
|
||||||
hecl::Char16ToUTF8(std::u16string(it, strView.begin() + scpos)));
|
hecl::Char16ToUTF8(std::u16string(it, strView.begin() + scpos)));
|
||||||
if (path)
|
if (path)
|
||||||
|
@ -311,11 +311,11 @@ template <>
|
||||||
void STRG::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
|
void STRG::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
|
||||||
atUint32 magic = reader.readUint32Big();
|
atUint32 magic = reader.readUint32Big();
|
||||||
if (magic != 0x87654321)
|
if (magic != 0x87654321)
|
||||||
Log.report(logvisor::Error, fmt("invalid STRG magic"));
|
Log.report(logvisor::Error, FMT_STRING("invalid STRG magic"));
|
||||||
|
|
||||||
atUint32 version = reader.readUint32Big();
|
atUint32 version = reader.readUint32Big();
|
||||||
if (version != 0)
|
if (version != 0)
|
||||||
Log.report(logvisor::Error, fmt("invalid STRG version"));
|
Log.report(logvisor::Error, FMT_STRING("invalid STRG version"));
|
||||||
|
|
||||||
_read(reader);
|
_read(reader);
|
||||||
}
|
}
|
||||||
|
@ -412,22 +412,22 @@ void STRG::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& reader) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (lang.first.size() != 4) {
|
if (lang.first.size() != 4) {
|
||||||
Log.report(logvisor::Warning, fmt("STRG language string '{}' must be exactly 4 characters; skipping"), lang.first);
|
Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must be exactly 4 characters; skipping"), lang.first);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (lang.second->m_type != YAML_SEQUENCE_NODE) {
|
if (lang.second->m_type != YAML_SEQUENCE_NODE) {
|
||||||
Log.report(logvisor::Warning, fmt("STRG language string '{}' must contain a sequence; skipping"), lang.first);
|
Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must contain a sequence; skipping"), lang.first);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const auto& str : lang.second->m_seqChildren) {
|
for (const auto& str : lang.second->m_seqChildren) {
|
||||||
if (str->m_type != YAML_SCALAR_NODE) {
|
if (str->m_type != YAML_SCALAR_NODE) {
|
||||||
Log.report(logvisor::Warning, fmt("STRG language '{}' must contain all scalars; skipping"), lang.first);
|
Log.report(logvisor::Warning, FMT_STRING("STRG language '{}' must contain all scalars; skipping"), lang.first);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Warning, fmt("STRG must have a mapping root node; skipping"));
|
Log.report(logvisor::Warning, FMT_STRING("STRG must have a mapping root node; skipping"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ struct Babygoth : IScriptObject {
|
||||||
charAssoc.m_cmdlRigs[noShellModel] = {noShellSkin, cinf};
|
charAssoc.m_cmdlRigs[noShellModel] = {noShellSkin, cinf};
|
||||||
charAssoc.m_cskrToCharacter[noShellSkin] =
|
charAssoc.m_cskrToCharacter[noShellSkin] =
|
||||||
std::make_pair(patternedInfo.animationParameters.animationCharacterSet,
|
std::make_pair(patternedInfo.animationParameters.animationCharacterSet,
|
||||||
fmt::format(fmt("ATTACH.SHELLESS_{}.CSKR"), noShellSkin));
|
fmt::format(FMT_STRING("ATTACH.SHELLESS_{}.CSKR"), noShellSkin));
|
||||||
charAssoc.addAttachmentRig(patternedInfo.animationParameters.animationCharacterSet, {}, noShellModel, "SHELLESS");
|
charAssoc.addAttachmentRig(patternedInfo.animationParameters.animationCharacterSet, {}, noShellModel, "SHELLESS");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct Magdolite : IScriptObject {
|
||||||
charAssoc.m_cmdlRigs[cmdlHeadless] = {cskrHeadless, cinf};
|
charAssoc.m_cmdlRigs[cmdlHeadless] = {cskrHeadless, cinf};
|
||||||
charAssoc.m_cskrToCharacter[cskrHeadless] =
|
charAssoc.m_cskrToCharacter[cskrHeadless] =
|
||||||
std::make_pair(patternedInfo.animationParameters.animationCharacterSet,
|
std::make_pair(patternedInfo.animationParameters.animationCharacterSet,
|
||||||
fmt::format(fmt("ATTACH.HEADLESS_{}.CSKR"), cskrHeadless));
|
fmt::format(FMT_STRING("ATTACH.HEADLESS_{}.CSKR"), cskrHeadless));
|
||||||
charAssoc.addAttachmentRig(patternedInfo.animationParameters.animationCharacterSet, {}, cmdlHeadless, "HEADLESS");
|
charAssoc.addAttachmentRig(patternedInfo.animationParameters.animationCharacterSet, {}, cmdlHeadless, "HEADLESS");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct OmegaPirate : IScriptObject {
|
||||||
charAssoc.m_cmdlRigs[cmdlPhazonVeins] = {cskrPhazonVeins, cinfPhazonVeins};
|
charAssoc.m_cmdlRigs[cmdlPhazonVeins] = {cskrPhazonVeins, cinfPhazonVeins};
|
||||||
charAssoc.m_cskrToCharacter[cskrPhazonVeins] =
|
charAssoc.m_cskrToCharacter[cskrPhazonVeins] =
|
||||||
std::make_pair(patternedInfo.animationParameters.animationCharacterSet,
|
std::make_pair(patternedInfo.animationParameters.animationCharacterSet,
|
||||||
fmt::format(fmt("ATTACH.VEINS_{}.CSKR"), cskrPhazonVeins));
|
fmt::format(FMT_STRING("ATTACH.VEINS_{}.CSKR"), cskrPhazonVeins));
|
||||||
charAssoc.addAttachmentRig(patternedInfo.animationParameters.animationCharacterSet, cinfPhazonVeins,
|
charAssoc.addAttachmentRig(patternedInfo.animationParameters.animationCharacterSet, cinfPhazonVeins,
|
||||||
cmdlPhazonVeins, "VEINS");
|
cmdlPhazonVeins, "VEINS");
|
||||||
}
|
}
|
||||||
|
|
|
@ -380,13 +380,13 @@ struct ActorParameters : BigDNA {
|
||||||
if (cmdlXray.isValid() && cskrXray.isValid()) {
|
if (cmdlXray.isValid() && cskrXray.isValid()) {
|
||||||
charAssoc.m_cmdlRigs[cmdlXray] = {cskrXray, cinf};
|
charAssoc.m_cmdlRigs[cmdlXray] = {cskrXray, cinf};
|
||||||
charAssoc.m_cskrToCharacter[cskrXray] = std::make_pair(animParms.animationCharacterSet,
|
charAssoc.m_cskrToCharacter[cskrXray] = std::make_pair(animParms.animationCharacterSet,
|
||||||
fmt::format(fmt("ATTACH.XRAY_{}.CSKR"), cskrXray));
|
fmt::format(FMT_STRING("ATTACH.XRAY_{}.CSKR"), cskrXray));
|
||||||
charAssoc.addAttachmentRig(animParms.animationCharacterSet, {}, cmdlXray, "XRAY");
|
charAssoc.addAttachmentRig(animParms.animationCharacterSet, {}, cmdlXray, "XRAY");
|
||||||
}
|
}
|
||||||
if (cmdlThermal.isValid() && cskrThermal.isValid()) {
|
if (cmdlThermal.isValid() && cskrThermal.isValid()) {
|
||||||
charAssoc.m_cmdlRigs[cmdlThermal] = {cskrThermal, cinf};
|
charAssoc.m_cmdlRigs[cmdlThermal] = {cskrThermal, cinf};
|
||||||
charAssoc.m_cskrToCharacter[cskrThermal] =
|
charAssoc.m_cskrToCharacter[cskrThermal] =
|
||||||
std::make_pair(animParms.animationCharacterSet, fmt::format(fmt("ATTACH.THERMAL_{}.CSKR"), cskrThermal));
|
std::make_pair(animParms.animationCharacterSet, fmt::format(FMT_STRING("ATTACH.THERMAL_{}.CSKR"), cskrThermal));
|
||||||
charAssoc.addAttachmentRig(animParms.animationCharacterSet, {}, cmdlThermal, "THERMAL");
|
charAssoc.addAttachmentRig(animParms.animationCharacterSet, {}, cmdlThermal, "THERMAL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace DataSpec::DNAMP2 {
|
||||||
using ANIMOutStream = hecl::blender::ANIMOutStream;
|
using ANIMOutStream = hecl::blender::ANIMOutStream;
|
||||||
|
|
||||||
void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig) const {
|
void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig) const {
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"act.hecl_fps = round({})\n"
|
"act.hecl_fps = round({})\n"
|
||||||
"act.hecl_looping = {}\n"),
|
"act.hecl_looping = {}\n"),
|
||||||
(1.0f / mainInterval), looping ? "True" : "False");
|
(1.0f / mainInterval), looping ? "True" : "False");
|
||||||
|
@ -28,7 +28,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
os.format(fmt("bone_string = '{}'\n"), *bName);
|
os.format(FMT_STRING("bone_string = '{}'\n"), *bName);
|
||||||
os << "action_group = act.groups.new(bone_string)\n"
|
os << "action_group = act.groups.new(bone_string)\n"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ void ANIM::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
|
||||||
m_anim->read(reader);
|
m_anim->read(reader);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.report(logvisor::Fatal, fmt("unrecognized ANIM version"));
|
Log.report(logvisor::Fatal, FMT_STRING("unrecognized ANIM version"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ void CINF::sendVertexGroupsToBlender(hecl::blender::PyOutStream& os) const {
|
||||||
for (atUint32 bid : boneIds) {
|
for (atUint32 bid : boneIds) {
|
||||||
for (const Name& name : names) {
|
for (const Name& name : names) {
|
||||||
if (name.boneId == bid) {
|
if (name.boneId == bid) {
|
||||||
os.format(fmt("obj.vertex_groups.new(name='{}')\n"), name.name);
|
os.format(FMT_STRING("obj.vertex_groups.new(name='{}')\n"), name.name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ template <class PAKBridge>
|
||||||
void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const typename PAKBridge::PAKType::IDType& cinfId) const {
|
void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const typename PAKBridge::PAKType::IDType& cinfId) const {
|
||||||
DNAANIM::RigInverter<CINF> inverter(*this);
|
DNAANIM::RigInverter<CINF> inverter(*this);
|
||||||
|
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"arm = bpy.data.armatures.new('CINF_{}')\n"
|
"arm = bpy.data.armatures.new('CINF_{}')\n"
|
||||||
"arm_obj = bpy.data.objects.new(arm.name, arm)\n"
|
"arm_obj = bpy.data.objects.new(arm.name, arm)\n"
|
||||||
"bpy.context.scene.collection.objects.link(arm_obj)\n"
|
"bpy.context.scene.collection.objects.link(arm_obj)\n"
|
||||||
|
@ -58,7 +58,7 @@ void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const typename PAKB
|
||||||
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones()) {
|
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones()) {
|
||||||
zeus::simd_floats originF(bone.m_origBone.origin.simd);
|
zeus::simd_floats originF(bone.m_origBone.origin.simd);
|
||||||
zeus::simd_floats tailF(bone.m_tail.mSimd);
|
zeus::simd_floats tailF(bone.m_tail.mSimd);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"bone = arm.edit_bones.new('{}')\n"
|
"bone = arm.edit_bones.new('{}')\n"
|
||||||
"bone.head = ({},{},{})\n"
|
"bone.head = ({},{},{})\n"
|
||||||
"bone.tail = ({},{},{})\n"
|
"bone.tail = ({},{},{})\n"
|
||||||
|
@ -73,18 +73,18 @@ void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const typename PAKB
|
||||||
atUint32 nullId = bones[0].parentId;
|
atUint32 nullId = bones[0].parentId;
|
||||||
for (const Bone& bone : bones)
|
for (const Bone& bone : bones)
|
||||||
if (bone.parentId != nullId)
|
if (bone.parentId != nullId)
|
||||||
os.format(fmt("arm_bone_table[{}].parent = arm_bone_table[{}]\n"), bone.id, bone.parentId);
|
os.format(FMT_STRING("arm_bone_table[{}].parent = arm_bone_table[{}]\n"), bone.id, bone.parentId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (const Bone& bone : bones)
|
for (const Bone& bone : bones)
|
||||||
if (bone.parentId != 97)
|
if (bone.parentId != 97)
|
||||||
os.format(fmt("arm_bone_table[{}].parent = arm_bone_table[{}]\n"), bone.id, bone.parentId);
|
os.format(FMT_STRING("arm_bone_table[{}].parent = arm_bone_table[{}]\n"), bone.id, bone.parentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "bpy.ops.object.mode_set(mode='OBJECT')\n";
|
os << "bpy.ops.object.mode_set(mode='OBJECT')\n";
|
||||||
|
|
||||||
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones())
|
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones())
|
||||||
os.format(fmt("arm_obj.pose.bones['{}'].rotation_mode = 'QUATERNION'\n"),
|
os.format(FMT_STRING("arm_obj.pose.bones['{}'].rotation_mode = 'QUATERNION'\n"),
|
||||||
*getBoneNameFromId(bone.m_origBone.id));
|
*getBoneNameFromId(bone.m_origBone.id));
|
||||||
}
|
}
|
||||||
template void CINF::sendCINFToBlender<PAKBridge>(hecl::blender::PyOutStream& os, const UniqueID32& cinfId) const;
|
template void CINF::sendCINFToBlender<PAKBridge>(hecl::blender::PyOutStream& os, const UniqueID32& cinfId) const;
|
||||||
|
@ -92,7 +92,7 @@ template void CINF::sendCINFToBlender<DNAMP3::PAKBridge>(hecl::blender::PyOutStr
|
||||||
const UniqueID64& cinfId) const;
|
const UniqueID64& cinfId) const;
|
||||||
|
|
||||||
template <class UniqueID>
|
template <class UniqueID>
|
||||||
std::string CINF::GetCINFArmatureName(const UniqueID& cinfId) { return fmt::format(fmt("CINF_{}"), cinfId); }
|
std::string CINF::GetCINFArmatureName(const UniqueID& cinfId) { return fmt::format(FMT_STRING("CINF_{}"), cinfId); }
|
||||||
template std::string CINF::GetCINFArmatureName(const UniqueID32& cinfId);
|
template std::string CINF::GetCINFArmatureName(const UniqueID32& cinfId);
|
||||||
template std::string CINF::GetCINFArmatureName(const UniqueID64& cinfId);
|
template std::string CINF::GetCINFArmatureName(const UniqueID64& cinfId);
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ bool CINF::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
return false;
|
return false;
|
||||||
auto os = conn.beginPythonOut(true);
|
auto os = conn.beginPythonOut(true);
|
||||||
|
|
||||||
os.format(fmt("import bpy\n"
|
os.format(FMT_STRING("import bpy\n"
|
||||||
"from mathutils import Vector\n"
|
"from mathutils import Vector\n"
|
||||||
"bpy.context.scene.name = 'CINF_{}'\n"
|
"bpy.context.scene.name = 'CINF_{}'\n"
|
||||||
"bpy.context.scene.hecl_arm_obj = bpy.context.scene.name\n"
|
"bpy.context.scene.hecl_arm_obj = bpy.context.scene.name\n"
|
||||||
|
|
|
@ -8,7 +8,7 @@ void CSKR::weightVertex(hecl::blender::PyOutStream& os, const CINF& cinf, atUint
|
||||||
for (const SkinningRule& rule : skinningRules) {
|
for (const SkinningRule& rule : skinningRules) {
|
||||||
if (idx >= accum && idx < accum + rule.vertCount)
|
if (idx >= accum && idx < accum + rule.vertCount)
|
||||||
for (const SkinningRule::Weight& weight : rule.weights)
|
for (const SkinningRule::Weight& weight : rule.weights)
|
||||||
os.format(fmt("vert[dvert_lay][{}] = {}\n"), cinf.getBoneIdxFromId(weight.boneId), weight.weight);
|
os.format(FMT_STRING("vert[dvert_lay][{}] = {}\n"), cinf.getBoneIdxFromId(weight.boneId), weight.weight);
|
||||||
accum += rule.vertCount;
|
accum += rule.vertCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ void PAKBridge::build() {
|
||||||
areaDeps.name = hecl::SystemString(_SYS_STR("MREA_")) + hecl::SystemStringConv(idStr).c_str();
|
areaDeps.name = hecl::SystemString(_SYS_STR("MREA_")) + hecl::SystemStringConv(idStr).c_str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hecl::SystemString num = fmt::format(fmt(_SYS_STR("{:02d} ")), ai);
|
hecl::SystemString num = fmt::format(FMT_STRING(_SYS_STR("{:02d} ")), ai);
|
||||||
areaDeps.name = num + areaDeps.name;
|
areaDeps.name = num + areaDeps.name;
|
||||||
|
|
||||||
areaDeps.layers.reserve(area.depLayerCount - 1);
|
areaDeps.layers.reserve(area.depLayerCount - 1);
|
||||||
|
@ -130,7 +130,7 @@ void PAKBridge::build() {
|
||||||
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
|
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
|
||||||
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);
|
||||||
num = fmt::format(fmt(_SYS_STR("{:02d} ")), l - 1);
|
num = fmt::format(FMT_STRING(_SYS_STR("{:02d} ")), 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);
|
||||||
|
@ -163,11 +163,11 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssoci
|
||||||
for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters) {
|
for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters) {
|
||||||
charAssoc.m_cmdlRigs[ci.cmdl] = {ci.cskr, ci.cinf};
|
charAssoc.m_cmdlRigs[ci.cmdl] = {ci.cskr, ci.cinf};
|
||||||
charAssoc.m_cskrToCharacter[ci.cskr] =
|
charAssoc.m_cskrToCharacter[ci.cskr] =
|
||||||
std::make_pair(entry.second.id, fmt::format(fmt("{}_{}.CSKR"), ci.name, ci.cskr));
|
std::make_pair(entry.second.id, fmt::format(FMT_STRING("{}_{}.CSKR"), ci.name, ci.cskr));
|
||||||
if (ci.cmdlIce.isValid()) {
|
if (ci.cmdlIce.isValid()) {
|
||||||
charAssoc.m_cmdlRigs[ci.cmdlIce] = {ci.cskrIce, ci.cinf};
|
charAssoc.m_cmdlRigs[ci.cmdlIce] = {ci.cskrIce, ci.cinf};
|
||||||
charAssoc.m_cskrToCharacter[ci.cskrIce] =
|
charAssoc.m_cskrToCharacter[ci.cskrIce] =
|
||||||
std::make_pair(entry.second.id, fmt::format(fmt("{}.ICE_{}.CSKR"), ci.name, ci.cskrIce));
|
std::make_pair(entry.second.id, fmt::format(FMT_STRING("{}.ICE_{}.CSKR"), ci.name, ci.cskrIce));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
|
||||||
|
|
||||||
if (mlvl.worldNameId.isValid())
|
if (mlvl.worldNameId.isValid())
|
||||||
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath,
|
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath,
|
||||||
fmt::format(fmt(_SYS_STR("!name_{}.yaml")), mlvl.worldNameId));
|
fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), mlvl.worldNameId));
|
||||||
|
|
||||||
for (const MLVL::Area& area : mlvl.areas) {
|
for (const MLVL::Area& area : mlvl.areas) {
|
||||||
{
|
{
|
||||||
|
@ -218,7 +218,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.isValid())
|
if (area.areaNameId.isValid())
|
||||||
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath,
|
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath,
|
||||||
fmt::format(fmt(_SYS_STR("!name_{}.yaml")), area.areaNameId));
|
fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), area.areaNameId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mlvl.worldMap.isValid()) {
|
if (mlvl.worldMap.isValid()) {
|
||||||
|
|
|
@ -265,7 +265,7 @@ void DeafBabe::insertNoClimb(hecl::blender::PyOutStream& os) const {
|
||||||
if (edgeIdx == -1)
|
if (edgeIdx == -1)
|
||||||
continue;
|
continue;
|
||||||
const Edge& edge = edgeVertConnections[edgeIdx];
|
const Edge& edge = edgeVertConnections[edgeIdx];
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"edge = col_bm.edges.get((col_bm.verts[{}], col_bm.verts[{}]))\n"
|
"edge = col_bm.edges.get((col_bm.verts[{}], col_bm.verts[{}]))\n"
|
||||||
"if edge:\n"
|
"if edge:\n"
|
||||||
" edge.seam = True\n"),
|
" edge.seam = True\n"),
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace DNAMP2 {
|
||||||
|
|
||||||
void MREA::StreamReader::nextBlock() {
|
void MREA::StreamReader::nextBlock() {
|
||||||
if (m_nextBlk >= m_blkCount)
|
if (m_nextBlk >= m_blkCount)
|
||||||
Log.report(logvisor::Fatal, fmt("MREA stream overrun"));
|
Log.report(logvisor::Fatal, FMT_STRING("MREA stream overrun"));
|
||||||
|
|
||||||
BlockInfo& info = m_blockInfos[m_nextBlk++];
|
BlockInfo& info = m_blockInfos[m_nextBlk++];
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ void MREA::StreamReader::seek(atInt64 diff, athena::SeekOrigin whence) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target >= m_totalDecompLen)
|
if (target >= m_totalDecompLen)
|
||||||
Log.report(logvisor::Fatal, fmt("MREA stream seek overrun"));
|
Log.report(logvisor::Fatal, FMT_STRING("MREA stream seek overrun"));
|
||||||
|
|
||||||
/* Determine which block contains position */
|
/* Determine which block contains position */
|
||||||
atUint32 dAccum = 0;
|
atUint32 dAccum = 0;
|
||||||
|
@ -225,7 +225,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
|
|
||||||
/* Open Py Stream and read sections */
|
/* Open Py Stream and read sections */
|
||||||
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"import bpy\n"
|
"import bpy\n"
|
||||||
"import bmesh\n"
|
"import bmesh\n"
|
||||||
"from mathutils import Vector\n"
|
"from mathutils import Vector\n"
|
||||||
|
@ -272,7 +272,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
drs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
|
drs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
|
||||||
curSec += DNACMDL::ReadGeomSectionsToBlender<PAKRouter<PAKBridge>, MaterialSet, RigPair, DNACMDL::SurfaceHeader_2>(
|
curSec += DNACMDL::ReadGeomSectionsToBlender<PAKRouter<PAKBridge>, MaterialSet, RigPair, DNACMDL::SurfaceHeader_2>(
|
||||||
os, drs, pakRouter, entry, dummy, true, true, vertAttribs, m, head.secCount, 0, &head.secSizes[curSec]);
|
os, drs, pakRouter, entry, dummy, true, true, vertAttribs, m, head.secCount, 0, &head.secSizes[curSec]);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"obj.retro_disable_enviro_visor = {}\n"
|
"obj.retro_disable_enviro_visor = {}\n"
|
||||||
"obj.retro_disable_thermal_visor = {}\n"
|
"obj.retro_disable_thermal_visor = {}\n"
|
||||||
"obj.retro_disable_xray_visor = {}\n"
|
"obj.retro_disable_xray_visor = {}\n"
|
||||||
|
|
|
@ -11,7 +11,7 @@ std::string PAK::bestEntryName(const nod::Node& pakNode, const Entry& entry, std
|
||||||
AGSC::Header header;
|
AGSC::Header header;
|
||||||
header.read(rs);
|
header.read(rs);
|
||||||
catalogueName = header.groupName;
|
catalogueName = header.groupName;
|
||||||
return fmt::format(fmt("{}_{}"), header.groupName, entry.id);
|
return fmt::format(FMT_STRING("{}_{}"), header.groupName, entry.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DNAMP1::PAK::bestEntryName(pakNode, entry, catalogueName);
|
return DNAMP1::PAK::bestEntryName(pakNode, entry, catalogueName);
|
||||||
|
|
|
@ -49,11 +49,11 @@ template <>
|
||||||
void STRG::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader) {
|
void STRG::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader) {
|
||||||
atUint32 magic = reader.readUint32Big();
|
atUint32 magic = reader.readUint32Big();
|
||||||
if (magic != 0x87654321)
|
if (magic != 0x87654321)
|
||||||
Log.report(logvisor::Error, fmt("invalid STRG magic"));
|
Log.report(logvisor::Error, FMT_STRING("invalid STRG magic"));
|
||||||
|
|
||||||
atUint32 version = reader.readUint32Big();
|
atUint32 version = reader.readUint32Big();
|
||||||
if (version != 1)
|
if (version != 1)
|
||||||
Log.report(logvisor::Error, fmt("invalid STRG version"));
|
Log.report(logvisor::Error, FMT_STRING("invalid STRG version"));
|
||||||
|
|
||||||
_read(reader);
|
_read(reader);
|
||||||
}
|
}
|
||||||
|
@ -158,22 +158,22 @@ void STRG::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& reader) {
|
||||||
if (lang.first == "names")
|
if (lang.first == "names")
|
||||||
continue;
|
continue;
|
||||||
if (lang.first.size() != 4) {
|
if (lang.first.size() != 4) {
|
||||||
Log.report(logvisor::Warning, fmt("STRG language string '{}' must be exactly 4 characters; skipping"), lang.first);
|
Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must be exactly 4 characters; skipping"), lang.first);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (lang.second->m_type != YAML_SEQUENCE_NODE) {
|
if (lang.second->m_type != YAML_SEQUENCE_NODE) {
|
||||||
Log.report(logvisor::Warning, fmt("STRG language string '{}' must contain a sequence; skipping"), lang.first);
|
Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must contain a sequence; skipping"), lang.first);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const auto& str : lang.second->m_seqChildren) {
|
for (const auto& str : lang.second->m_seqChildren) {
|
||||||
if (str->m_type != YAML_SCALAR_NODE) {
|
if (str->m_type != YAML_SCALAR_NODE) {
|
||||||
Log.report(logvisor::Warning, fmt("STRG language '{}' must contain all scalars; skipping"), lang.first);
|
Log.report(logvisor::Warning, FMT_STRING("STRG language '{}' must contain all scalars; skipping"), lang.first);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Warning, fmt("STRG must have a mapping root node; skipping"));
|
Log.report(logvisor::Warning, FMT_STRING("STRG must have a mapping root node; skipping"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ struct STRG : ISTRG {
|
||||||
std::map<std::string, int32_t> names;
|
std::map<std::string, int32_t> names;
|
||||||
|
|
||||||
int32_t lookupIdx(std::string_view name) const override {
|
int32_t lookupIdx(std::string_view name) const override {
|
||||||
|
// TODO: Heterogeneous lookup when C++20 available
|
||||||
auto search = names.find(name.data());
|
auto search = names.find(name.data());
|
||||||
if (search == names.end())
|
if (search == names.end())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -9,7 +9,7 @@ using ANIMOutStream = hecl::blender::ANIMOutStream;
|
||||||
|
|
||||||
void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig,
|
void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig,
|
||||||
bool additive) const {
|
bool additive) const {
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"act.hecl_fps = round({})\n"
|
"act.hecl_fps = round({})\n"
|
||||||
"act.hecl_additive = {}\n"
|
"act.hecl_additive = {}\n"
|
||||||
"act.hecl_looping = {}\n"),
|
"act.hecl_looping = {}\n"),
|
||||||
|
@ -32,7 +32,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
os.format(fmt("bone_string = '{}'\n"), *bName);
|
os.format(FMT_STRING("bone_string = '{}'\n"), *bName);
|
||||||
os << "action_group = act.groups.new(bone_string)\n"
|
os << "action_group = act.groups.new(bone_string)\n"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ void ANIM::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
|
||||||
m_anim->read(reader);
|
m_anim->read(reader);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.report(logvisor::Fatal, fmt("unrecognized ANIM version"));
|
Log.report(logvisor::Fatal, FMT_STRING("unrecognized ANIM version"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ static void LoadTexture(Stream& out, const UniqueID64& tex,
|
||||||
}
|
}
|
||||||
hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, tex);
|
hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, tex);
|
||||||
hecl::SystemUTF8Conv resPathView(resPath);
|
hecl::SystemUTF8Conv resPathView(resPath);
|
||||||
out.format(fmt("if '{}' in bpy.data.images:\n"
|
out.format(FMT_STRING("if '{}' in bpy.data.images:\n"
|
||||||
" image = bpy.data.images['{}']\n"
|
" image = bpy.data.images['{}']\n"
|
||||||
"else:\n"
|
"else:\n"
|
||||||
" image = bpy.data.images.load('''//{}''')\n"
|
" image = bpy.data.images.load('''//{}''')\n"
|
||||||
|
@ -71,7 +71,7 @@ static void LoadTexture(Stream& out, const UniqueID64& tex,
|
||||||
|
|
||||||
void MaterialSet::ConstructMaterial(Stream& out, const PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry,
|
void MaterialSet::ConstructMaterial(Stream& out, const PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry,
|
||||||
const Material& material, unsigned groupIdx, unsigned matIdx) {
|
const Material& material, unsigned groupIdx, unsigned matIdx) {
|
||||||
out.format(fmt("new_material = bpy.data.materials.new('MAT_{}_{}')\n"), groupIdx, matIdx);
|
out.format(FMT_STRING("new_material = bpy.data.materials.new('MAT_{}_{}')\n"), groupIdx, matIdx);
|
||||||
out << "new_material.use_fake_user = True\n"
|
out << "new_material.use_fake_user = True\n"
|
||||||
"new_material.use_nodes = True\n"
|
"new_material.use_nodes = True\n"
|
||||||
"new_material.use_backface_culling = True\n"
|
"new_material.use_backface_culling = True\n"
|
||||||
|
@ -91,7 +91,7 @@ void MaterialSet::ConstructMaterial(Stream& out, const PAKRouter<PAKBridge>& pak
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
/* Material Flags */
|
/* Material Flags */
|
||||||
out.format(fmt(
|
out.format(FMT_STRING(
|
||||||
"new_material.retro_enable_bloom = {}\n"
|
"new_material.retro_enable_bloom = {}\n"
|
||||||
"new_material.retro_force_lighting_stage = {}\n"
|
"new_material.retro_force_lighting_stage = {}\n"
|
||||||
"new_material.retro_pre_inca_transparency = {}\n"
|
"new_material.retro_pre_inca_transparency = {}\n"
|
||||||
|
@ -146,14 +146,14 @@ void MaterialSet::ConstructMaterial(Stream& out, const PAKRouter<PAKBridge>& pak
|
||||||
"tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['Normal'], tex_node.inputs['Vector']))\n";
|
"tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['Normal'], tex_node.inputs['Vector']))\n";
|
||||||
break;
|
break;
|
||||||
case Material::UVAnimationUVSource::UV:
|
case Material::UVAnimationUVSource::UV:
|
||||||
out.format(fmt("tex_uv_node = new_nodetree.nodes.new('ShaderNodeUVMap')\n"
|
out.format(FMT_STRING("tex_uv_node = new_nodetree.nodes.new('ShaderNodeUVMap')\n"
|
||||||
"tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['UV'], tex_node.inputs['Vector']))\n"
|
"tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['UV'], tex_node.inputs['Vector']))\n"
|
||||||
"tex_uv_node.uv_map = 'UV_{}'\n"), pass->uvSrc);
|
"tex_uv_node.uv_map = 'UV_{}'\n"), pass->uvSrc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
out.format(fmt("tex_uv_node.label = 'MTX_{}'\n"), texMtxIdx);
|
out.format(FMT_STRING("tex_uv_node.label = 'MTX_{}'\n"), texMtxIdx);
|
||||||
} else {
|
} else {
|
||||||
out.format(fmt("tex_uv_node = new_nodetree.nodes.new('ShaderNodeUVMap')\n"
|
out.format(FMT_STRING("tex_uv_node = new_nodetree.nodes.new('ShaderNodeUVMap')\n"
|
||||||
"tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['UV'], tex_node.inputs['Vector']))\n"
|
"tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['UV'], tex_node.inputs['Vector']))\n"
|
||||||
"tex_uv_node.uv_map = 'UV_{}'\n"), pass->uvSrc);
|
"tex_uv_node.uv_map = 'UV_{}'\n"), pass->uvSrc);
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ void MaterialSet::ConstructMaterial(Stream& out, const PAKRouter<PAKBridge>& pak
|
||||||
"separate_node.location[0] += 350\n"
|
"separate_node.location[0] += 350\n"
|
||||||
"separate_node.location[1] += 350\n"
|
"separate_node.location[1] += 350\n"
|
||||||
"new_nodetree.links.new(tex_node.outputs['Color'], separate_node.inputs[0])\n";
|
"new_nodetree.links.new(tex_node.outputs['Color'], separate_node.inputs[0])\n";
|
||||||
out.format(fmt("swap_output = separate_node.outputs[{}]\n"), int(pass->flags.swapColorComponent()));
|
out.format(FMT_STRING("swap_output = separate_node.outputs[{}]\n"), int(pass->flags.swapColorComponent()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ void MaterialSet::ConstructMaterial(Stream& out, const PAKRouter<PAKBridge>& pak
|
||||||
DoSwap();
|
DoSwap();
|
||||||
out << "new_nodetree.links.new(swap_output, pnode.inputs['INCAA'])\n";
|
out << "new_nodetree.links.new(swap_output, pnode.inputs['INCAA'])\n";
|
||||||
}
|
}
|
||||||
out.format(fmt("new_material.retro_inca_color_mod = {}\n"), pass->flags.INCAColorMod() ? "True" : "False");
|
out.format(FMT_STRING("new_material.retro_inca_color_mod = {}\n"), pass->flags.INCAColorMod() ? "True" : "False");
|
||||||
break;
|
break;
|
||||||
case Subtype::RFLV:
|
case Subtype::RFLV:
|
||||||
out << "new_nodetree.links.new(tex_node.outputs['Color'], pnode.inputs['RFLV'])\n";
|
out << "new_nodetree.links.new(tex_node.outputs['Color'], pnode.inputs['RFLV'])\n";
|
||||||
|
@ -244,7 +244,7 @@ void MaterialSet::ConstructMaterial(Stream& out, const PAKRouter<PAKBridge>& pak
|
||||||
"new_nodetree.links.new(swap_output, pnode.inputs['XRAYA'])\n";
|
"new_nodetree.links.new(swap_output, pnode.inputs['XRAYA'])\n";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.report(logvisor::Fatal, fmt("Unknown PASS subtype"));
|
Log.report(logvisor::Fatal, FMT_STRING("Unknown PASS subtype"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (const Material::CLR* clr = chunk.get_if<Material::CLR>()) {
|
} else if (const Material::CLR* clr = chunk.get_if<Material::CLR>()) {
|
||||||
|
@ -253,39 +253,39 @@ void MaterialSet::ConstructMaterial(Stream& out, const PAKRouter<PAKBridge>& pak
|
||||||
clr->color.toVec4f().simd.copy_to(vec4);
|
clr->color.toVec4f().simd.copy_to(vec4);
|
||||||
switch (Subtype(clr->subtype.toUint32())) {
|
switch (Subtype(clr->subtype.toUint32())) {
|
||||||
case Subtype::CLR:
|
case Subtype::CLR:
|
||||||
out.format(fmt("pnode.inputs['CLR'].default_value = ({}, {}, {}, 1.0)\n"
|
out.format(FMT_STRING("pnode.inputs['CLR'].default_value = ({}, {}, {}, 1.0)\n"
|
||||||
"pnode.inputs['CLRA'].default_value = {}\n"),
|
"pnode.inputs['CLRA'].default_value = {}\n"),
|
||||||
vec4[0], vec4[1], vec4[2], vec4[3]);
|
vec4[0], vec4[1], vec4[2], vec4[3]);
|
||||||
break;
|
break;
|
||||||
case Subtype::DIFB:
|
case Subtype::DIFB:
|
||||||
out.format(fmt("pnode.inputs['DIFBC'].default_value = ({}, {}, {}, 1.0)\n"
|
out.format(FMT_STRING("pnode.inputs['DIFBC'].default_value = ({}, {}, {}, 1.0)\n"
|
||||||
"pnode.inputs['DIFBA'].default_value = {}\n"),
|
"pnode.inputs['DIFBA'].default_value = {}\n"),
|
||||||
vec4[0], vec4[1], vec4[2], vec4[3]);
|
vec4[0], vec4[1], vec4[2], vec4[3]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.report(logvisor::Fatal, fmt("Unknown CLR subtype"));
|
Log.report(logvisor::Fatal, FMT_STRING("Unknown CLR subtype"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (const Material::INT* val = chunk.get_if<Material::INT>()) {
|
} else if (const Material::INT* val = chunk.get_if<Material::INT>()) {
|
||||||
using Subtype = Material::INT::Subtype;
|
using Subtype = Material::INT::Subtype;
|
||||||
switch (Subtype(val->subtype.toUint32())) {
|
switch (Subtype(val->subtype.toUint32())) {
|
||||||
case Subtype::OPAC:
|
case Subtype::OPAC:
|
||||||
out.format(fmt("pnode.inputs['OPAC'].default_value = {}\n"), val->value / 255.f);
|
out.format(FMT_STRING("pnode.inputs['OPAC'].default_value = {}\n"), val->value / 255.f);
|
||||||
break;
|
break;
|
||||||
case Subtype::BLOD:
|
case Subtype::BLOD:
|
||||||
out.format(fmt("pnode.inputs['BLOD'].default_value = {}\n"), val->value / 255.f);
|
out.format(FMT_STRING("pnode.inputs['BLOD'].default_value = {}\n"), val->value / 255.f);
|
||||||
break;
|
break;
|
||||||
case Subtype::BLOI:
|
case Subtype::BLOI:
|
||||||
out.format(fmt("pnode.inputs['BLOI'].default_value = {}\n"), val->value / 255.f);
|
out.format(FMT_STRING("pnode.inputs['BLOI'].default_value = {}\n"), val->value / 255.f);
|
||||||
break;
|
break;
|
||||||
case Subtype::BNIF:
|
case Subtype::BNIF:
|
||||||
out.format(fmt("pnode.inputs['BNIF'].default_value = {}\n"), val->value / 255.f);
|
out.format(FMT_STRING("pnode.inputs['BNIF'].default_value = {}\n"), val->value / 255.f);
|
||||||
break;
|
break;
|
||||||
case Subtype::XRBR:
|
case Subtype::XRBR:
|
||||||
out.format(fmt("pnode.inputs['XRBR'].default_value = {}\n"), val->value / 255.f);
|
out.format(FMT_STRING("pnode.inputs['XRBR'].default_value = {}\n"), val->value / 255.f);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.report(logvisor::Fatal, fmt("Unknown INT subtype"));
|
Log.report(logvisor::Fatal, FMT_STRING("Unknown INT subtype"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ void CSKR::weightVertex(hecl::blender::PyOutStream& os, const CINF& cinf, atInt1
|
||||||
return;
|
return;
|
||||||
const DNAMP2::CSKR::SkinningRule& rule = data.skinningRules[skinIdx];
|
const DNAMP2::CSKR::SkinningRule& rule = data.skinningRules[skinIdx];
|
||||||
for (const DNAMP2::CSKR::SkinningRule::Weight& weight : rule.weights)
|
for (const DNAMP2::CSKR::SkinningRule::Weight& weight : rule.weights)
|
||||||
os.format(fmt("vert[dvert_lay][{}] = {}\n"), cinf.getBoneIdxFromId(weight.boneId), weight.weight);
|
os.format(FMT_STRING("vert[dvert_lay][{}] = {}\n"), cinf.getBoneIdxFromId(weight.boneId), weight.weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DataSpec::DNAMP3
|
} // namespace DataSpec::DNAMP3
|
||||||
|
|
|
@ -124,7 +124,7 @@ void PAKBridge::build() {
|
||||||
areaDeps.name = hecl::SystemString(_SYS_STR("MREA_")) + hecl::SystemStringConv(idStr).c_str();
|
areaDeps.name = hecl::SystemString(_SYS_STR("MREA_")) + hecl::SystemStringConv(idStr).c_str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hecl::SystemString num = fmt::format(fmt(_SYS_STR("{:02d} ")), ai);
|
hecl::SystemString num = fmt::format(FMT_STRING(_SYS_STR("{:02d} ")), ai);
|
||||||
areaDeps.name = num + areaDeps.name;
|
areaDeps.name = num + areaDeps.name;
|
||||||
|
|
||||||
const MLVL::LayerFlags& layerFlags = *layerFlagsIt++;
|
const MLVL::LayerFlags& layerFlags = *layerFlagsIt++;
|
||||||
|
@ -136,7 +136,7 @@ void PAKBridge::build() {
|
||||||
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
|
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
|
||||||
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);
|
||||||
num = fmt::format(fmt(_SYS_STR("{:02d} ")), l - 1);
|
num = fmt::format(FMT_STRING(_SYS_STR("{:02d} ")), l - 1);
|
||||||
layer.name = num + layer.name;
|
layer.name = num + layer.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,11 +170,11 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssoci
|
||||||
const CHAR::CharacterInfo& ci = aChar.characterInfo;
|
const CHAR::CharacterInfo& ci = aChar.characterInfo;
|
||||||
charAssoc.m_cmdlRigs[ci.cmdl] = {ci.cskr, ci.cinf};
|
charAssoc.m_cmdlRigs[ci.cmdl] = {ci.cskr, ci.cinf};
|
||||||
charAssoc.m_cskrToCharacter[ci.cskr] =
|
charAssoc.m_cskrToCharacter[ci.cskr] =
|
||||||
std::make_pair(entry.second.id, fmt::format(fmt("{}_{}.CSKR"), ci.name, ci.cskr));
|
std::make_pair(entry.second.id, fmt::format(FMT_STRING("{}_{}.CSKR"), ci.name, ci.cskr));
|
||||||
for (const CHAR::CharacterInfo::Overlay& overlay : ci.overlays) {
|
for (const CHAR::CharacterInfo::Overlay& overlay : ci.overlays) {
|
||||||
charAssoc.m_cmdlRigs[overlay.cmdl] = {overlay.cskr, ci.cinf};
|
charAssoc.m_cmdlRigs[overlay.cmdl] = {overlay.cskr, ci.cinf};
|
||||||
charAssoc.m_cskrToCharacter[overlay.cskr] =
|
charAssoc.m_cskrToCharacter[overlay.cskr] =
|
||||||
std::make_pair(entry.second.id, fmt::format(fmt("{}.{}_{}.CSKR"), ci.name, overlay.type, overlay.cskr));
|
std::make_pair(entry.second.id, fmt::format(FMT_STRING("{}.{}_{}.CSKR"), ci.name, overlay.type, overlay.cskr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
|
||||||
|
|
||||||
if (mlvl.worldNameId.isValid())
|
if (mlvl.worldNameId.isValid())
|
||||||
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath,
|
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath,
|
||||||
fmt::format(fmt(_SYS_STR("!name_{}.yaml")), mlvl.worldNameId));
|
fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), mlvl.worldNameId));
|
||||||
|
|
||||||
for (const MLVL::Area& area : mlvl.areas) {
|
for (const MLVL::Area& area : mlvl.areas) {
|
||||||
{
|
{
|
||||||
|
@ -212,7 +212,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.isValid())
|
if (area.areaNameId.isValid())
|
||||||
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath,
|
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath,
|
||||||
fmt::format(fmt(_SYS_STR("!name_{}.yaml")), area.areaNameId));
|
fmt::format(FMT_STRING(_SYS_STR("!name_{}.yaml")), area.areaNameId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mlvl.worldMap.isValid()) {
|
if (mlvl.worldMap.isValid()) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ bool MREA::StreamReader::seekToSection(FourCC sec, const std::vector<atUint32>&
|
||||||
void MREA::ReadBabeDeadToBlender_3(hecl::blender::PyOutStream& os, athena::io::IStreamReader& rs) {
|
void MREA::ReadBabeDeadToBlender_3(hecl::blender::PyOutStream& os, athena::io::IStreamReader& rs) {
|
||||||
atUint32 bdMagic = rs.readUint32Big();
|
atUint32 bdMagic = rs.readUint32Big();
|
||||||
if (bdMagic != 0xBABEDEAD)
|
if (bdMagic != 0xBABEDEAD)
|
||||||
Log.report(logvisor::Fatal, fmt("invalid BABEDEAD magic"));
|
Log.report(logvisor::Fatal, FMT_STRING("invalid BABEDEAD magic"));
|
||||||
os << "bpy.context.scene.world.use_nodes = True\n"
|
os << "bpy.context.scene.world.use_nodes = True\n"
|
||||||
"bg_node = bpy.context.scene.world.node_tree.nodes['Background']\n"
|
"bg_node = bpy.context.scene.world.node_tree.nodes['Background']\n"
|
||||||
"bg_node.inputs[1].default_value = 0.0\n";
|
"bg_node.inputs[1].default_value = 0.0\n";
|
||||||
|
@ -100,7 +100,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
|
|
||||||
/* Open Py Stream and read sections */
|
/* Open Py Stream and read sections */
|
||||||
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
||||||
os.format(fmt(
|
os.format(FMT_STRING(
|
||||||
"import bpy\n"
|
"import bpy\n"
|
||||||
"import bmesh\n"
|
"import bmesh\n"
|
||||||
"from mathutils import Vector\n"
|
"from mathutils import Vector\n"
|
||||||
|
|
|
@ -9,7 +9,7 @@ template <>
|
||||||
void PAK::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader) {
|
void PAK::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader) {
|
||||||
m_header.read(reader);
|
m_header.read(reader);
|
||||||
if (m_header.version != 2)
|
if (m_header.version != 2)
|
||||||
Log.report(logvisor::Fatal, fmt("unexpected PAK magic"));
|
Log.report(logvisor::Fatal, FMT_STRING("unexpected PAK magic"));
|
||||||
|
|
||||||
reader.seek(8, athena::SeekOrigin::Current);
|
reader.seek(8, athena::SeekOrigin::Current);
|
||||||
atUint32 strgSz = reader.readUint32Big();
|
atUint32 strgSz = reader.readUint32Big();
|
||||||
|
@ -141,7 +141,7 @@ std::unique_ptr<atUint8[]> PAK::Entry::getBuffer(const nod::Node& pak, atUint64&
|
||||||
} head;
|
} head;
|
||||||
strm->read(&head, 8);
|
strm->read(&head, 8);
|
||||||
if (head.magic != CMPD) {
|
if (head.magic != CMPD) {
|
||||||
Log.report(logvisor::Error, fmt("invalid CMPD block"));
|
Log.report(logvisor::Error, FMT_STRING("invalid CMPD block"));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
head.blockCount = hecl::SBig(head.blockCount);
|
head.blockCount = hecl::SBig(head.blockCount);
|
||||||
|
@ -206,6 +206,7 @@ const PAK::Entry* PAK::lookupEntry(const UniqueID64& id) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
const PAK::Entry* PAK::lookupEntry(std::string_view name) const {
|
const PAK::Entry* PAK::lookupEntry(std::string_view name) const {
|
||||||
|
// TODO: Heterogeneous lookup when C++20 available
|
||||||
auto result = m_nameMap.find(name.data());
|
auto result = m_nameMap.find(name.data());
|
||||||
if (result != m_nameMap.end()) {
|
if (result != m_nameMap.end()) {
|
||||||
auto result1 = m_entries.find(result->second);
|
auto result1 = m_entries.find(result->second);
|
||||||
|
@ -220,11 +221,11 @@ std::string PAK::bestEntryName(const nod::Node& pakNode, const Entry& entry, std
|
||||||
for (const NameEntry& nentry : m_nameEntries)
|
for (const NameEntry& nentry : m_nameEntries)
|
||||||
if (nentry.id == entry.id) {
|
if (nentry.id == entry.id) {
|
||||||
catalogueName = nentry.name;
|
catalogueName = nentry.name;
|
||||||
return fmt::format(fmt("{}_{}"), nentry.name, entry.id);
|
return fmt::format(FMT_STRING("{}_{}"), nentry.name, entry.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise return ID format string */
|
/* Otherwise return ID format string */
|
||||||
return fmt::format(fmt("{}_{}"), entry.type, entry.id);
|
return fmt::format(FMT_STRING("{}_{}"), entry.type, entry.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DataSpec::DNAMP3
|
} // namespace DataSpec::DNAMP3
|
||||||
|
|
|
@ -59,13 +59,13 @@ template <>
|
||||||
void STRG::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader) {
|
void STRG::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader) {
|
||||||
atUint32 magic = reader.readUint32Big();
|
atUint32 magic = reader.readUint32Big();
|
||||||
if (magic != 0x87654321) {
|
if (magic != 0x87654321) {
|
||||||
Log.report(logvisor::Error, fmt("invalid STRG magic"));
|
Log.report(logvisor::Error, FMT_STRING("invalid STRG magic"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
atUint32 version = reader.readUint32Big();
|
atUint32 version = reader.readUint32Big();
|
||||||
if (version != 3) {
|
if (version != 3) {
|
||||||
Log.report(logvisor::Error, fmt("invalid STRG version"));
|
Log.report(logvisor::Error, FMT_STRING("invalid STRG version"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,22 +82,22 @@ void STRG::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& reader) {
|
||||||
if (lang.first == "names")
|
if (lang.first == "names")
|
||||||
continue;
|
continue;
|
||||||
if (lang.first.size() != 4) {
|
if (lang.first.size() != 4) {
|
||||||
Log.report(logvisor::Warning, fmt("STRG language string '{}' must be exactly 4 characters; skipping"), lang.first);
|
Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must be exactly 4 characters; skipping"), lang.first);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (lang.second->m_type != YAML_SEQUENCE_NODE) {
|
if (lang.second->m_type != YAML_SEQUENCE_NODE) {
|
||||||
Log.report(logvisor::Warning, fmt("STRG language string '{}' must contain a sequence; skipping"), lang.first);
|
Log.report(logvisor::Warning, FMT_STRING("STRG language string '{}' must contain a sequence; skipping"), lang.first);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const auto& str : lang.second->m_seqChildren) {
|
for (const auto& str : lang.second->m_seqChildren) {
|
||||||
if (str->m_type != YAML_SCALAR_NODE) {
|
if (str->m_type != YAML_SCALAR_NODE) {
|
||||||
Log.report(logvisor::Warning, fmt("STRG language '{}' must contain all scalars; skipping"), lang.first);
|
Log.report(logvisor::Warning, FMT_STRING("STRG language '{}' must contain all scalars; skipping"), lang.first);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Warning, fmt("STRG must have a mapping root node; skipping"));
|
Log.report(logvisor::Warning, FMT_STRING("STRG must have a mapping root node; skipping"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ struct STRG : ISTRG {
|
||||||
std::map<std::string, int32_t> names;
|
std::map<std::string, int32_t> names;
|
||||||
|
|
||||||
int32_t lookupIdx(std::string_view name) const override {
|
int32_t lookupIdx(std::string_view name) const override {
|
||||||
|
// TODO: Heterogeneous lookup when C++20 available
|
||||||
auto search = names.find(name.data());
|
auto search = names.find(name.data());
|
||||||
if (search == names.end())
|
if (search == names.end())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -65,7 +65,7 @@ bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport
|
||||||
if (!memcmp(gameID, "R3O", 3)) {
|
if (!memcmp(gameID, "R3O", 3)) {
|
||||||
std::srand(std::time(0));
|
std::srand(std::time(0));
|
||||||
int r = std::rand() % MomErrCount;
|
int r = std::rand() % MomErrCount;
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("{}")), MomErr[r]);
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{}")), MomErr[r]);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_standalone = true;
|
m_standalone = true;
|
||||||
|
@ -99,7 +99,7 @@ void SpecBase::doExtract(const ExtractPassInfo& info, const hecl::MultiProgressP
|
||||||
setThreadProject();
|
setThreadProject();
|
||||||
DataSpec::g_curSpec.reset(this);
|
DataSpec::g_curSpec.reset(this);
|
||||||
if (!Blender::BuildMasterShader(m_masterShader))
|
if (!Blender::BuildMasterShader(m_masterShader))
|
||||||
Log.report(logvisor::Fatal, fmt("Unable to build master shader blend"));
|
Log.report(logvisor::Fatal, FMT_STRING("Unable to build master shader blend"));
|
||||||
if (m_isWii) {
|
if (m_isWii) {
|
||||||
/* Extract root files for repacking later */
|
/* Extract root files for repacking later */
|
||||||
hecl::ProjectPath outDir(m_project.getProjectWorkingPath(), _SYS_STR("out"));
|
hecl::ProjectPath outDir(m_project.getProjectWorkingPath(), _SYS_STR("out"));
|
||||||
|
@ -182,7 +182,7 @@ const hecl::Database::DataSpecEntry* SpecBase::overrideDataSpec(const hecl::Proj
|
||||||
|
|
||||||
hecl::blender::BlendType type = hecl::blender::GetBlendType(asBlend.getAbsolutePath());
|
hecl::blender::BlendType type = hecl::blender::GetBlendType(asBlend.getAbsolutePath());
|
||||||
if (type == hecl::blender::BlendType::None) {
|
if (type == hecl::blender::BlendType::None) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("unable to cook '{}'")), path.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to cook '{}'")), path.getAbsolutePath());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (type == hecl::blender::BlendType::Mesh || type == hecl::blender::BlendType::Area)
|
if (type == hecl::blender::BlendType::Mesh || type == hecl::blender::BlendType::Area)
|
||||||
|
@ -309,9 +309,9 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in, std::vector
|
||||||
hecl::SystemStringConv chSysName(sub.name);
|
hecl::SystemStringConv chSysName(sub.name);
|
||||||
if (!sub.cskrId.empty()) {
|
if (!sub.cskrId.empty()) {
|
||||||
hecl::SystemStringConv cskrSysName(sub.cskrId);
|
hecl::SystemStringConv cskrSysName(sub.cskrId);
|
||||||
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.CSKR")), chSysName, cskrSysName)));
|
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}_{}.CSKR")), chSysName, cskrSysName)));
|
||||||
} else {
|
} else {
|
||||||
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}.CSKR")), chSysName)));
|
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.CSKR")), chSysName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& arm = actor.armatures[sub.armature];
|
const auto& arm = actor.armatures[sub.armature];
|
||||||
|
@ -325,7 +325,7 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in, std::vector
|
||||||
flattenDependenciesBlend(overlay.mesh, pathsOut, btok);
|
flattenDependenciesBlend(overlay.mesh, pathsOut, btok);
|
||||||
pathsOut.push_back(overlay.mesh);
|
pathsOut.push_back(overlay.mesh);
|
||||||
}
|
}
|
||||||
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}.{}_{}.CSKR")), chSysName, overlaySys, overlayCskrId)));
|
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.{}_{}.CSKR")), chSysName, overlaySys, overlayCskrId)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -343,7 +343,7 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in, std::vector
|
||||||
|
|
||||||
hecl::SystemStringConv chSysName(att.name);
|
hecl::SystemStringConv chSysName(att.name);
|
||||||
hecl::SystemStringConv sysCskrId(att.cskrId);
|
hecl::SystemStringConv sysCskrId(att.cskrId);
|
||||||
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("ATTACH.{}_{}.CSKR")), chSysName, sysCskrId)));
|
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("ATTACH.{}_{}.CSKR")), chSysName, sysCskrId)));
|
||||||
|
|
||||||
if (att.armature >= 0) {
|
if (att.armature >= 0) {
|
||||||
const auto& arm = actor.armatures[att.armature];
|
const auto& arm = actor.armatures[att.armature];
|
||||||
|
@ -355,9 +355,9 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in, std::vector
|
||||||
for (const auto& act : actNames) {
|
for (const auto& act : actNames) {
|
||||||
hecl::SystemStringConv actSysName(act.first);
|
hecl::SystemStringConv actSysName(act.first);
|
||||||
hecl::SystemStringConv actAnimId(act.second);
|
hecl::SystemStringConv actAnimId(act.second);
|
||||||
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.ANIM")), actSysName, actAnimId)));
|
pathsOut.push_back(asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}_{}.ANIM")), actSysName, actAnimId)));
|
||||||
hecl::SystemString searchPrefix(asGlob.getWithExtension(
|
hecl::SystemString searchPrefix(asGlob.getWithExtension(
|
||||||
fmt::format(fmt(_SYS_STR(".{}_")), actSysName).c_str(), true).getLastComponent());
|
fmt::format(FMT_STRING(_SYS_STR(".{}_")), actSysName).c_str(), true).getLastComponent());
|
||||||
hecl::ProjectPath evntPath;
|
hecl::ProjectPath evntPath;
|
||||||
for (const auto& ent : dEnum) {
|
for (const auto& ent : dEnum) {
|
||||||
if (hecl::StringUtils::BeginsWith(ent.m_name, searchPrefix.c_str()) &&
|
if (hecl::StringUtils::BeginsWith(ent.m_name, searchPrefix.c_str()) &&
|
||||||
|
@ -468,7 +468,7 @@ void SpecBase::copyBuildListData(std::vector<std::tuple<size_t, size_t, bool>>&
|
||||||
fileIndex.reserve(buildList.size());
|
fileIndex.reserve(buildList.size());
|
||||||
int loadIdx = 0;
|
int loadIdx = 0;
|
||||||
for (const auto& tag : buildList) {
|
for (const auto& tag : buildList) {
|
||||||
hecl::SystemString str = fmt::format(fmt(_SYS_STR("Copying {}")), tag);
|
hecl::SystemString str = fmt::format(FMT_STRING(_SYS_STR("Copying {}")), tag);
|
||||||
progress.print(str.c_str(), nullptr, ++loadIdx / float(buildList.size()));
|
progress.print(str.c_str(), nullptr, ++loadIdx / float(buildList.size()));
|
||||||
|
|
||||||
auto& [positionOut, sizeOut, compressedOut] = fileIndex.emplace_back();
|
auto& [positionOut, sizeOut, compressedOut] = fileIndex.emplace_back();
|
||||||
|
@ -476,7 +476,7 @@ void SpecBase::copyBuildListData(std::vector<std::tuple<size_t, size_t, bool>>&
|
||||||
if (tag.type == FOURCC('MLVL')) {
|
if (tag.type == FOURCC('MLVL')) {
|
||||||
auto search = mlvlData.find(tag.id);
|
auto search = mlvlData.find(tag.id);
|
||||||
if (search == mlvlData.end())
|
if (search == mlvlData.end())
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find MLVL {}")), tag.id);
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to find MLVL {}")), tag.id);
|
||||||
|
|
||||||
positionOut = pakOut.position();
|
positionOut = pakOut.position();
|
||||||
sizeOut = ROUND_UP_32(search->second.size());
|
sizeOut = ROUND_UP_32(search->second.size());
|
||||||
|
@ -492,7 +492,7 @@ void SpecBase::copyBuildListData(std::vector<std::tuple<size_t, size_t, bool>>&
|
||||||
hecl::ProjectPath cooked = getCookedPath(path, true);
|
hecl::ProjectPath cooked = getCookedPath(path, true);
|
||||||
athena::io::FileReader r(cooked.getAbsolutePath());
|
athena::io::FileReader r(cooked.getAbsolutePath());
|
||||||
if (r.hasError())
|
if (r.hasError())
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unable to open resource {}")), cooked.getRelativePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to open resource {}")), cooked.getRelativePath());
|
||||||
atUint64 size = r.length();
|
atUint64 size = r.length();
|
||||||
auto data = r.readUBytes(size);
|
auto data = r.readUBytes(size);
|
||||||
auto compData = compressPakData(tag, data.get(), size);
|
auto compData = compressPakData(tag, data.get(), size);
|
||||||
|
@ -616,7 +616,7 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
|
||||||
|
|
||||||
/* Async cook resource list if using ClientProcess */
|
/* Async cook resource list if using ClientProcess */
|
||||||
if (cp) {
|
if (cp) {
|
||||||
Log.report(logvisor::Info, fmt(_SYS_STR("Validating resources")));
|
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("Validating resources")));
|
||||||
progress.setMainIndeterminate(true);
|
progress.setMainIndeterminate(true);
|
||||||
std::vector<urde::SObjectTag> cookTags;
|
std::vector<urde::SObjectTag> cookTags;
|
||||||
cookTags.reserve(buildList.size());
|
cookTags.reserve(buildList.size());
|
||||||
|
@ -640,7 +640,7 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
|
||||||
for (auto& tag : cookTags) {
|
for (auto& tag : cookTags) {
|
||||||
hecl::ProjectPath depPath = pathFromTag(tag);
|
hecl::ProjectPath depPath = pathFromTag(tag);
|
||||||
if (!depPath)
|
if (!depPath)
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unable to resolve {}")), tag);
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to resolve {}")), tag);
|
||||||
m_project.cookPath(depPath, progress, false, false, fast, entry, cp);
|
m_project.cookPath(depPath, progress, false, false, fast, entry, cp);
|
||||||
}
|
}
|
||||||
progress.setMainIndeterminate(false);
|
progress.setMainIndeterminate(false);
|
||||||
|
@ -650,7 +650,7 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
|
||||||
|
|
||||||
/* Write resource data and build file index */
|
/* Write resource data and build file index */
|
||||||
std::vector<std::tuple<size_t, size_t, bool>> fileIndex;
|
std::vector<std::tuple<size_t, size_t, bool>> fileIndex;
|
||||||
Log.report(logvisor::Info, fmt(_SYS_STR("Copying data into {}")), outPath.getRelativePath());
|
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("Copying data into {}")), outPath.getRelativePath());
|
||||||
copyBuildListData(fileIndex, buildList, entry, fast, progress, pakOut, mlvlData);
|
copyBuildListData(fileIndex, buildList, entry, fast, progress, pakOut, mlvlData);
|
||||||
|
|
||||||
/* Write file index */
|
/* Write file index */
|
||||||
|
@ -688,9 +688,9 @@ hecl::ProjectPath SpecBase::getCookedPath(const hecl::ProjectPath& working, bool
|
||||||
return working.getCookedPath(*spec);
|
return working.getCookedPath(*spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PNGErr(png_structp png, png_const_charp msg) { Log.report(logvisor::Error, fmt("{}"), msg); }
|
static void PNGErr(png_structp png, png_const_charp msg) { Log.report(logvisor::Error, FMT_STRING("{}"), msg); }
|
||||||
|
|
||||||
static void PNGWarn(png_structp png, png_const_charp msg) { Log.report(logvisor::Warning, fmt("{}"), msg); }
|
static void PNGWarn(png_structp png, png_const_charp msg) { Log.report(logvisor::Warning, FMT_STRING("{}"), msg); }
|
||||||
|
|
||||||
constexpr uint8_t Convert4To8(uint8_t v) {
|
constexpr uint8_t Convert4To8(uint8_t v) {
|
||||||
/* Swizzle bits: 00001234 -> 12341234 */
|
/* Swizzle bits: 00001234 -> 12341234 */
|
||||||
|
@ -703,12 +703,12 @@ void SpecBase::extractRandomStaticEntropy(const uint8_t* buf, const hecl::Projec
|
||||||
entropyPath.makeDirChain(false);
|
entropyPath.makeDirChain(false);
|
||||||
|
|
||||||
if (const auto fp = hecl::FopenUnique(catalogPath.getAbsolutePath().data(), _SYS_STR("a"))) {
|
if (const auto fp = hecl::FopenUnique(catalogPath.getAbsolutePath().data(), _SYS_STR("a"))) {
|
||||||
fmt::print(fp.get(), fmt("RandomStaticEntropy: {}\n"), entropyPath.getRelativePathUTF8());
|
fmt::print(fp.get(), FMT_STRING("RandomStaticEntropy: {}\n"), entropyPath.getRelativePathUTF8());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto fp = hecl::FopenUnique(entropyPath.getAbsolutePath().data(), _SYS_STR("wb"));
|
auto fp = hecl::FopenUnique(entropyPath.getAbsolutePath().data(), _SYS_STR("wb"));
|
||||||
if (fp == nullptr) {
|
if (fp == nullptr) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("Unable to open '{}' for writing")), entropyPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("Unable to open '{}' for writing")), entropyPath.getAbsolutePath());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, PNGErr, PNGWarn);
|
png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, PNGErr, PNGWarn);
|
||||||
|
@ -852,7 +852,7 @@ void SpecBase::enumerateNamedResources(
|
||||||
|
|
||||||
static void WriteTag(athena::io::YAMLDocWriter& cacheWriter, const urde::SObjectTag& pathTag,
|
static void WriteTag(athena::io::YAMLDocWriter& cacheWriter, const urde::SObjectTag& pathTag,
|
||||||
const hecl::ProjectPath& path) {
|
const hecl::ProjectPath& path) {
|
||||||
auto key = fmt::format(fmt("{}"), pathTag.id);
|
auto key = fmt::format(FMT_STRING("{}"), pathTag.id);
|
||||||
if (auto* existing = cacheWriter.getCurNode()->findMapChild(key)) {
|
if (auto* existing = cacheWriter.getCurNode()->findMapChild(key)) {
|
||||||
existing->m_seqChildren.emplace_back(athena::io::ValToNode(path.getEncodableStringUTF8()));
|
existing->m_seqChildren.emplace_back(athena::io::ValToNode(path.getEncodableStringUTF8()));
|
||||||
} else if (auto v = cacheWriter.enterSubVector(key)) {
|
} else if (auto v = cacheWriter.enterSubVector(key)) {
|
||||||
|
@ -863,7 +863,7 @@ static void WriteTag(athena::io::YAMLDocWriter& cacheWriter, const urde::SObject
|
||||||
|
|
||||||
static void WriteNameTag(athena::io::YAMLDocWriter& nameWriter, const urde::SObjectTag& pathTag,
|
static void WriteNameTag(athena::io::YAMLDocWriter& nameWriter, const urde::SObjectTag& pathTag,
|
||||||
std::string_view name) {
|
std::string_view name) {
|
||||||
nameWriter.writeString(name.data(), fmt::format(fmt("{}"), pathTag.id));
|
nameWriter.writeString(name.data(), fmt::format(FMT_STRING("{}"), pathTag.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpecBase::readCatalog(const hecl::ProjectPath& catalogPath, athena::io::YAMLDocWriter& nameWriter) {
|
void SpecBase::readCatalog(const hecl::ProjectPath& catalogPath, athena::io::YAMLDocWriter& nameWriter) {
|
||||||
|
@ -907,7 +907,7 @@ void SpecBase::readCatalog(const hecl::ProjectPath& catalogPath, athena::io::YAM
|
||||||
|
|
||||||
WriteNameTag(nameWriter, pathTag, p.first);
|
WriteNameTag(nameWriter, pathTag, p.first);
|
||||||
#if 0
|
#if 0
|
||||||
fmt::print(stderr, fmt("{} {} {:08X}\n"), p.first, pathTag.type.toString(), pathTag.id.Value());
|
fmt::print(stderr, FMT_STRING("{} {} {:08X}\n"), p.first, pathTag.type.toString(), pathTag.id.Value());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -948,7 +948,7 @@ void SpecBase::insertPathTag(athena::io::YAMLDocWriter& cacheWriter, const urde:
|
||||||
if (search != m_tagToPath.end() && search->second != path &&
|
if (search != m_tagToPath.end() && search->second != path &&
|
||||||
tag.type != FOURCC('CINF') && tag.type != FOURCC('CSKR') &&
|
tag.type != FOURCC('CINF') && tag.type != FOURCC('CSKR') &&
|
||||||
tag.type != FOURCC('ANIM') && tag.type != FOURCC('EVNT')) {
|
tag.type != FOURCC('ANIM') && tag.type != FOURCC('EVNT')) {
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("'{}|{}' already exists for tag {} as '{}|{}'")),
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("'{}|{}' already exists for tag {} as '{}|{}'")),
|
||||||
path.getRelativePath(), path.getAuxInfo(), tag,
|
path.getRelativePath(), path.getAuxInfo(), tag,
|
||||||
search->second.getRelativePath(), search->second.getAuxInfo());
|
search->second.getRelativePath(), search->second.getAuxInfo());
|
||||||
}
|
}
|
||||||
|
@ -958,7 +958,7 @@ void SpecBase::insertPathTag(athena::io::YAMLDocWriter& cacheWriter, const urde:
|
||||||
WriteTag(cacheWriter, tag, path);
|
WriteTag(cacheWriter, tag, path);
|
||||||
#if DUMP_CACHE_FILL
|
#if DUMP_CACHE_FILL
|
||||||
if (dump)
|
if (dump)
|
||||||
fmt::print(stderr, fmt("{} {}\n"), tag, path.getRelativePathUTF8());
|
fmt::print(stderr, FMT_STRING("{} {}\n"), tag, path.getRelativePathUTF8());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -997,9 +997,9 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path, athena::io::YAMLDoc
|
||||||
hecl::ProjectPath subPath;
|
hecl::ProjectPath subPath;
|
||||||
if (!sub.second.empty()) {
|
if (!sub.second.empty()) {
|
||||||
hecl::SystemStringConv cskrId(sub.second);
|
hecl::SystemStringConv cskrId(sub.second);
|
||||||
subPath = asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.CSKR")), subName, cskrId));
|
subPath = asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}_{}.CSKR")), subName, cskrId));
|
||||||
} else {
|
} else {
|
||||||
subPath = asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}.CSKR")), subName));
|
subPath = asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.CSKR")), subName));
|
||||||
}
|
}
|
||||||
insertPathTag(cacheWriter, buildTagFromPath(subPath), subPath);
|
insertPathTag(cacheWriter, buildTagFromPath(subPath), subPath);
|
||||||
|
|
||||||
|
@ -1009,10 +1009,10 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path, athena::io::YAMLDoc
|
||||||
hecl::SystemStringConv overlayCskrId(overlay.second);
|
hecl::SystemStringConv overlayCskrId(overlay.second);
|
||||||
if (!overlay.second.empty()) {
|
if (!overlay.second.empty()) {
|
||||||
subPath =
|
subPath =
|
||||||
asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}.{}_{}.CSKR")), subName, overlaySys, overlayCskrId));
|
asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.{}_{}.CSKR")), subName, overlaySys, overlayCskrId));
|
||||||
} else {
|
} else {
|
||||||
subPath =
|
subPath =
|
||||||
asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}.{}.CSKR")), subName, overlaySys));
|
asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.{}.CSKR")), subName, overlaySys));
|
||||||
}
|
}
|
||||||
insertPathTag(cacheWriter, buildTagFromPath(subPath), subPath);
|
insertPathTag(cacheWriter, buildTagFromPath(subPath), subPath);
|
||||||
}
|
}
|
||||||
|
@ -1025,10 +1025,10 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path, athena::io::YAMLDoc
|
||||||
hecl::ProjectPath subPath;
|
hecl::ProjectPath subPath;
|
||||||
if (!attachment.second.empty()) {
|
if (!attachment.second.empty()) {
|
||||||
subPath =
|
subPath =
|
||||||
asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("ATTACH.{}_{}.CSKR")), attachmentSys, attachmentCskrId));
|
asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("ATTACH.{}_{}.CSKR")), attachmentSys, attachmentCskrId));
|
||||||
} else {
|
} else {
|
||||||
subPath =
|
subPath =
|
||||||
asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("ATTACH.{}.CSKR")), attachmentSys));
|
asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("ATTACH.{}.CSKR")), attachmentSys));
|
||||||
}
|
}
|
||||||
insertPathTag(cacheWriter, buildTagFromPath(subPath), subPath);
|
insertPathTag(cacheWriter, buildTagFromPath(subPath), subPath);
|
||||||
}
|
}
|
||||||
|
@ -1038,9 +1038,9 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path, athena::io::YAMLDoc
|
||||||
hecl::SystemStringConv animId(act.second);
|
hecl::SystemStringConv animId(act.second);
|
||||||
hecl::ProjectPath subPath;
|
hecl::ProjectPath subPath;
|
||||||
if (!act.second.empty()) {
|
if (!act.second.empty()) {
|
||||||
subPath = asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}_{}.ANIM")), sysStr, animId));
|
subPath = asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}_{}.ANIM")), sysStr, animId));
|
||||||
} else {
|
} else {
|
||||||
subPath = asGlob.ensureAuxInfo(fmt::format(fmt(_SYS_STR("{}.ANIM")), sysStr));
|
subPath = asGlob.ensureAuxInfo(fmt::format(FMT_STRING(_SYS_STR("{}.ANIM")), sysStr));
|
||||||
}
|
}
|
||||||
insertPathTag(cacheWriter, buildTagFromPath(subPath), subPath);
|
insertPathTag(cacheWriter, buildTagFromPath(subPath), subPath);
|
||||||
}
|
}
|
||||||
|
@ -1108,7 +1108,7 @@ void SpecBase::backgroundIndexProc() {
|
||||||
if (tagCachePath.isFile()) {
|
if (tagCachePath.isFile()) {
|
||||||
athena::io::FileReader reader(tagCachePath.getAbsolutePath());
|
athena::io::FileReader reader(tagCachePath.getAbsolutePath());
|
||||||
if (reader.isOpen()) {
|
if (reader.isOpen()) {
|
||||||
Log.report(logvisor::Info, fmt(_SYS_STR("Cache index of '{}' loading")), getOriginalSpec().m_name);
|
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("Cache index of '{}' loading")), getOriginalSpec().m_name);
|
||||||
athena::io::YAMLDocReader cacheReader;
|
athena::io::YAMLDocReader cacheReader;
|
||||||
if (cacheReader.parse(&reader)) {
|
if (cacheReader.parse(&reader)) {
|
||||||
std::unique_lock lk(m_backgroundIndexMutex);
|
std::unique_lock lk(m_backgroundIndexMutex);
|
||||||
|
@ -1134,16 +1134,16 @@ void SpecBase::backgroundIndexProc() {
|
||||||
|
|
||||||
++loadIdx;
|
++loadIdx;
|
||||||
if (!(loadIdx % 100))
|
if (!(loadIdx % 100))
|
||||||
fmt::print(stderr, fmt("\r {} / {}"), loadIdx, tagCount);
|
fmt::print(stderr, FMT_STRING("\r {} / {}"), loadIdx, tagCount);
|
||||||
}
|
}
|
||||||
fmt::print(stderr, fmt("\r {} / {}\n"), loadIdx, tagCount);
|
fmt::print(stderr, FMT_STRING("\r {} / {}\n"), loadIdx, tagCount);
|
||||||
}
|
}
|
||||||
Log.report(logvisor::Info, fmt(_SYS_STR("Cache index of '{}' loaded; {} tags")), getOriginalSpec().m_name,
|
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("Cache index of '{}' loaded; {} tags")), getOriginalSpec().m_name,
|
||||||
m_tagToPath.size());
|
m_tagToPath.size());
|
||||||
|
|
||||||
if (nameCachePath.isFile()) {
|
if (nameCachePath.isFile()) {
|
||||||
/* Read in name cache */
|
/* Read in name cache */
|
||||||
Log.report(logvisor::Info, fmt(_SYS_STR("Name index of '{}' loading")), getOriginalSpec().m_name);
|
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("Name index of '{}' loading")), getOriginalSpec().m_name);
|
||||||
athena::io::FileReader nreader(nameCachePath.getAbsolutePath());
|
athena::io::FileReader nreader(nameCachePath.getAbsolutePath());
|
||||||
athena::io::YAMLDocReader nameReader;
|
athena::io::YAMLDocReader nameReader;
|
||||||
if (nameReader.parse(&nreader)) {
|
if (nameReader.parse(&nreader)) {
|
||||||
|
@ -1162,13 +1162,13 @@ void SpecBase::backgroundIndexProc() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.report(logvisor::Info, fmt(_SYS_STR("Name index of '{}' loaded; {} names")), getOriginalSpec().m_name,
|
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("Name index of '{}' loaded; {} names")), getOriginalSpec().m_name,
|
||||||
m_catalogNameToTag.size());
|
m_catalogNameToTag.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.report(logvisor::Info, fmt(_SYS_STR("Background index of '{}' started")), getOriginalSpec().m_name);
|
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("Background index of '{}' started")), getOriginalSpec().m_name);
|
||||||
backgroundIndexRecursiveProc(specRoot, cacheWriter, nameWriter, 0);
|
backgroundIndexRecursiveProc(specRoot, cacheWriter, nameWriter, 0);
|
||||||
|
|
||||||
tagCachePath.makeDirChain(false);
|
tagCachePath.makeDirChain(false);
|
||||||
|
@ -1179,7 +1179,7 @@ void SpecBase::backgroundIndexProc() {
|
||||||
nameWriter.finish(&nwriter);
|
nameWriter.finish(&nwriter);
|
||||||
|
|
||||||
m_backgroundBlender.shutdown();
|
m_backgroundBlender.shutdown();
|
||||||
Log.report(logvisor::Info, fmt(_SYS_STR("Background index of '{}' complete; {} tags, {} names")),
|
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("Background index of '{}' complete; {} tags, {} names")),
|
||||||
getOriginalSpec().m_name, m_tagToPath.size(), m_catalogNameToTag.size());
|
getOriginalSpec().m_name, m_tagToPath.size(), m_catalogNameToTag.size());
|
||||||
m_backgroundRunning = false;
|
m_backgroundRunning = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,10 +69,10 @@ struct TextureCache {
|
||||||
texturePath.makeDirChain(false);
|
texturePath.makeDirChain(false);
|
||||||
|
|
||||||
if (const auto fp = hecl::FopenUnique(catalogPath.getAbsolutePath().data(), _SYS_STR("a"))) {
|
if (const auto fp = hecl::FopenUnique(catalogPath.getAbsolutePath().data(), _SYS_STR("a"))) {
|
||||||
fmt::print(fp.get(), fmt("TextureCache: {}\n"), texturePath.getRelativePathUTF8());
|
fmt::print(fp.get(), FMT_STRING("TextureCache: {}\n"), texturePath.getRelativePathUTF8());
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.report(logvisor::Level::Info, fmt("Gathering Texture metadata (this can take up to 10 seconds)..."));
|
Log.report(logvisor::Level::Info, FMT_STRING("Gathering Texture metadata (this can take up to 10 seconds)..."));
|
||||||
std::unordered_map<UniqueID32, TXTR::Meta> metaMap;
|
std::unordered_map<UniqueID32, TXTR::Meta> metaMap;
|
||||||
|
|
||||||
pakRouter.enumerateResources([&](const DNAMP1::PAK::Entry* ent) {
|
pakRouter.enumerateResources([&](const DNAMP1::PAK::Entry* ent) {
|
||||||
|
@ -92,7 +92,7 @@ struct TextureCache {
|
||||||
|
|
||||||
athena::io::FileWriter fileW(texturePath.getAbsolutePath());
|
athena::io::FileWriter fileW(texturePath.getAbsolutePath());
|
||||||
yamlW.finish(&fileW);
|
yamlW.finish(&fileW);
|
||||||
Log.report(logvisor::Level::Info, fmt("Done..."));
|
Log.report(logvisor::Level::Info, FMT_STRING("Done..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
|
static void Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
|
||||||
|
@ -740,7 +740,7 @@ struct SpecMP1 : SpecBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!colMesh)
|
if (!colMesh)
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to find mesh named 'CMESH' in {}")), in.getAbsolutePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to find mesh named 'CMESH' in {}")), in.getAbsolutePath());
|
||||||
|
|
||||||
std::vector<Light> lights = ds.compileLights();
|
std::vector<Light> lights = ds.compileLights();
|
||||||
|
|
||||||
|
@ -978,7 +978,7 @@ struct SpecMP1 : SpecBase {
|
||||||
{
|
{
|
||||||
athena::io::FileReader r(worldPathCooked.getAbsolutePath());
|
athena::io::FileReader r(worldPathCooked.getAbsolutePath());
|
||||||
if (r.hasError())
|
if (r.hasError())
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unable to open world {}")), worldPathCooked.getRelativePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to open world {}")), worldPathCooked.getRelativePath());
|
||||||
mlvl.read(r);
|
mlvl.read(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1074,10 +1074,10 @@ struct SpecMP1 : SpecBase {
|
||||||
if (hecl::ProjectPath mapCookedPath = getCookedPath(mapPath, true)) {
|
if (hecl::ProjectPath mapCookedPath = getCookedPath(mapPath, true)) {
|
||||||
athena::io::FileReader r(mapCookedPath.getAbsolutePath());
|
athena::io::FileReader r(mapCookedPath.getAbsolutePath());
|
||||||
if (r.hasError())
|
if (r.hasError())
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unable to open {}")), mapCookedPath.getRelativePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to open {}")), mapCookedPath.getRelativePath());
|
||||||
|
|
||||||
if (r.readUint32Big() != 0xDEADF00D)
|
if (r.readUint32Big() != 0xDEADF00D)
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Corrupt MAPW {}")), mapCookedPath.getRelativePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Corrupt MAPW {}")), mapCookedPath.getRelativePath());
|
||||||
r.readUint32Big();
|
r.readUint32Big();
|
||||||
atUint32 mapaCount = r.readUint32Big();
|
atUint32 mapaCount = r.readUint32Big();
|
||||||
for (atUint32 i = 0; i < mapaCount; ++i) {
|
for (atUint32 i = 0; i < mapaCount; ++i) {
|
||||||
|
@ -1100,7 +1100,7 @@ struct SpecMP1 : SpecBase {
|
||||||
for (const auto& tex : textures) {
|
for (const auto& tex : textures) {
|
||||||
urde::SObjectTag texTag = tagFromPath(tex);
|
urde::SObjectTag texTag = tagFromPath(tex);
|
||||||
if (!texTag)
|
if (!texTag)
|
||||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unable to resolve {}")), tex.getRelativePath());
|
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Unable to resolve {}")), tex.getRelativePath());
|
||||||
listOut.push_back(texTag);
|
listOut.push_back(texTag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,10 +35,10 @@ struct TextureCache {
|
||||||
texturePath.makeDirChain(false);
|
texturePath.makeDirChain(false);
|
||||||
|
|
||||||
if (const auto fp = hecl::FopenUnique(catalogPath.getAbsolutePath().data(), _SYS_STR("a"))) {
|
if (const auto fp = hecl::FopenUnique(catalogPath.getAbsolutePath().data(), _SYS_STR("a"))) {
|
||||||
fmt::print(fp.get(), fmt("TextureCache: {}\n"), texturePath.getRelativePathUTF8());
|
fmt::print(fp.get(), FMT_STRING("TextureCache: {}\n"), texturePath.getRelativePathUTF8());
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.report(logvisor::Level::Info, fmt("Gathering Texture metadata (this can take up to 10 seconds)..."));
|
Log.report(logvisor::Level::Info, FMT_STRING("Gathering Texture metadata (this can take up to 10 seconds)..."));
|
||||||
std::unordered_map<UniqueID32, TXTR::Meta> metaMap;
|
std::unordered_map<UniqueID32, TXTR::Meta> metaMap;
|
||||||
|
|
||||||
pakRouter.enumerateResources([&](const DNAMP2::PAK::Entry* ent) {
|
pakRouter.enumerateResources([&](const DNAMP2::PAK::Entry* ent) {
|
||||||
|
@ -58,7 +58,7 @@ struct TextureCache {
|
||||||
|
|
||||||
athena::io::FileWriter fileW(texturePath.getAbsolutePath());
|
athena::io::FileWriter fileW(texturePath.getAbsolutePath());
|
||||||
yamlW.finish(&fileW);
|
yamlW.finish(&fileW);
|
||||||
Log.report(logvisor::Level::Info, fmt("Done..."));
|
Log.report(logvisor::Level::Info, FMT_STRING("Done..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
|
static void Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
|
||||||
|
|
|
@ -32,10 +32,10 @@ struct TextureCache {
|
||||||
texturePath.makeDirChain(false);
|
texturePath.makeDirChain(false);
|
||||||
|
|
||||||
if (const auto fp = hecl::FopenUnique(catalogPath.getAbsolutePath().data(), _SYS_STR("a"))) {
|
if (const auto fp = hecl::FopenUnique(catalogPath.getAbsolutePath().data(), _SYS_STR("a"))) {
|
||||||
fmt::print(fp.get(), fmt("TextureCache: {}\n"), texturePath.getRelativePathUTF8());
|
fmt::print(fp.get(), FMT_STRING("TextureCache: {}\n"), texturePath.getRelativePathUTF8());
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.report(logvisor::Level::Info, fmt("Gathering Texture metadata (this can take up to 10 seconds)..."));
|
Log.report(logvisor::Level::Info, FMT_STRING("Gathering Texture metadata (this can take up to 10 seconds)..."));
|
||||||
std::unordered_map<UniqueID64, TXTR::Meta> metaMap;
|
std::unordered_map<UniqueID64, TXTR::Meta> metaMap;
|
||||||
|
|
||||||
pakRouter.enumerateResources([&](const DNAMP3::PAK::Entry* ent) {
|
pakRouter.enumerateResources([&](const DNAMP3::PAK::Entry* ent) {
|
||||||
|
@ -55,7 +55,7 @@ struct TextureCache {
|
||||||
|
|
||||||
athena::io::FileWriter fileW(texturePath.getAbsolutePath());
|
athena::io::FileWriter fileW(texturePath.getAbsolutePath());
|
||||||
yamlW.finish(&fileW);
|
yamlW.finish(&fileW);
|
||||||
Log.report(logvisor::Level::Info, fmt("Done..."));
|
Log.report(logvisor::Level::Info, FMT_STRING("Done..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
|
static void Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ ProjectManager::ProjectManager(ViewManager& vm)
|
||||||
bool ProjectManager::newProject(hecl::SystemStringView path) {
|
bool ProjectManager::newProject(hecl::SystemStringView path) {
|
||||||
hecl::ProjectRootPath projPath = hecl::SearchForProject(path);
|
hecl::ProjectRootPath projPath = hecl::SearchForProject(path);
|
||||||
if (projPath) {
|
if (projPath) {
|
||||||
Log.report(logvisor::Warning, fmt(_SYS_STR("project already exists at '{}'")), path);
|
Log.report(logvisor::Warning, FMT_STRING(_SYS_STR("project already exists at '{}'")), path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ bool ProjectManager::newProject(hecl::SystemStringView path) {
|
||||||
m_vm.SetupEditorView();
|
m_vm.SetupEditorView();
|
||||||
saveProject();
|
saveProject();
|
||||||
|
|
||||||
m_vm.m_mainWindow->setTitle(fmt::format(fmt(_SYS_STR("{} - URDE [{}]")),
|
m_vm.m_mainWindow->setTitle(fmt::format(FMT_STRING(_SYS_STR("{} - URDE [{}]")),
|
||||||
m_proj->getProjectRootPath().getLastComponent(), m_vm.platformName()));
|
m_proj->getProjectRootPath().getLastComponent(), m_vm.platformName()));
|
||||||
m_vm.DismissSplash();
|
m_vm.DismissSplash();
|
||||||
m_vm.FadeInEditors();
|
m_vm.FadeInEditors();
|
||||||
|
@ -75,7 +75,7 @@ bool ProjectManager::openProject(hecl::SystemStringView path) {
|
||||||
hecl::SystemString subPath;
|
hecl::SystemString subPath;
|
||||||
hecl::ProjectRootPath projPath = hecl::SearchForProject(path, subPath);
|
hecl::ProjectRootPath projPath = hecl::SearchForProject(path, subPath);
|
||||||
if (!projPath) {
|
if (!projPath) {
|
||||||
Log.report(logvisor::Warning, fmt(_SYS_STR("project doesn't exist at '{}'")), path);
|
Log.report(logvisor::Warning, FMT_STRING(_SYS_STR("project doesn't exist at '{}'")), path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ bool ProjectManager::openProject(hecl::SystemStringView path) {
|
||||||
if (needsSave)
|
if (needsSave)
|
||||||
saveProject();
|
saveProject();
|
||||||
|
|
||||||
m_vm.m_mainWindow->setTitle(fmt::format(fmt(_SYS_STR("{} - URDE [{}]")),
|
m_vm.m_mainWindow->setTitle(fmt::format(FMT_STRING(_SYS_STR("{} - URDE [{}]")),
|
||||||
m_proj->getProjectRootPath().getLastComponent(), m_vm.platformName()));
|
m_proj->getProjectRootPath().getLastComponent(), m_vm.platformName()));
|
||||||
m_vm.DismissSplash();
|
m_vm.DismissSplash();
|
||||||
m_vm.FadeInEditors();
|
m_vm.FadeInEditors();
|
||||||
|
|
|
@ -22,7 +22,7 @@ void ProjectResourceFactoryBase::BeginBackgroundIndex(hecl::Database::Project& p
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProjectResourceFactoryBase::SyncCook(const hecl::ProjectPath& working) {
|
bool ProjectResourceFactoryBase::SyncCook(const hecl::ProjectPath& working) {
|
||||||
Log.report(logvisor::Warning, fmt(_SYS_STR("sync-cooking {}")), working.getRelativePath());
|
Log.report(logvisor::Warning, FMT_STRING(_SYS_STR("sync-cooking {}")), working.getRelativePath());
|
||||||
return m_clientProc.syncCook(working, m_cookSpec.get(), hecl::blender::SharedBlenderToken, false, false);
|
return m_clientProc.syncCook(working, m_cookSpec.get(), hecl::blender::SharedBlenderToken, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,12 +38,12 @@ CFactoryFnReturn ProjectResourceFactoryBase::BuildSync(const SObjectTag& tag, co
|
||||||
u32 length = fr->length();
|
u32 length = fr->length();
|
||||||
std::unique_ptr<u8[]> memBuf = fr->readUBytes(length);
|
std::unique_ptr<u8[]> memBuf = fr->readUBytes(length);
|
||||||
CFactoryFnReturn ret = m_factoryMgr.MakeObjectFromMemory(tag, std::move(memBuf), length, false, paramXfer, selfRef);
|
CFactoryFnReturn ret = m_factoryMgr.MakeObjectFromMemory(tag, std::move(memBuf), length, false, paramXfer, selfRef);
|
||||||
Log.report(logvisor::Info, fmt("sync-built {}"), tag);
|
Log.report(logvisor::Info, FMT_STRING("sync-built {}"), tag);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFactoryFnReturn ret = m_factoryMgr.MakeObject(tag, *fr, paramXfer, selfRef);
|
CFactoryFnReturn ret = m_factoryMgr.MakeObject(tag, *fr, paramXfer, selfRef);
|
||||||
Log.report(logvisor::Info, fmt("sync-built {}"), tag);
|
Log.report(logvisor::Info, FMT_STRING("sync-built {}"), tag);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ void ProjectResourceFactoryBase::AsyncTask::EnsurePath(const urde::SObjectTag& t
|
||||||
|
|
||||||
/* Ensure requested resource is on the filesystem */
|
/* Ensure requested resource is on the filesystem */
|
||||||
if (!path.isFileOrGlob()) {
|
if (!path.isFileOrGlob()) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("unable to find resource path '{}'")), path.getRelativePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to find resource path '{}'")), path.getRelativePath());
|
||||||
m_failed = true;
|
m_failed = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ void ProjectResourceFactoryBase::AsyncTask::EnsurePath(const urde::SObjectTag& t
|
||||||
/* Last chance type validation */
|
/* Last chance type validation */
|
||||||
urde::SObjectTag verifyTag = m_parent.TagFromPath(path);
|
urde::SObjectTag verifyTag = m_parent.TagFromPath(path);
|
||||||
if (verifyTag.type != tag.type) {
|
if (verifyTag.type != tag.type) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("{}: expected type '{}', found '{}'")), path.getRelativePath(),
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("{}: expected type '{}', found '{}'")), path.getRelativePath(),
|
||||||
tag.type, verifyTag.type);
|
tag.type, verifyTag.type);
|
||||||
m_failed = true;
|
m_failed = true;
|
||||||
return;
|
return;
|
||||||
|
@ -91,7 +91,7 @@ void ProjectResourceFactoryBase::AsyncTask::CookComplete() {
|
||||||
/* Ensure cooked rep is on the filesystem */
|
/* Ensure cooked rep is on the filesystem */
|
||||||
athena::io::FileReader fr(m_cookedPath.getAbsolutePath(), 32 * 1024, false);
|
athena::io::FileReader fr(m_cookedPath.getAbsolutePath(), 32 * 1024, false);
|
||||||
if (fr.hasError()) {
|
if (fr.hasError()) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("unable to open cooked resource path '{}'")), m_cookedPath.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to open cooked resource path '{}'")), m_cookedPath.getAbsolutePath());
|
||||||
m_failed = true;
|
m_failed = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ bool ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag, const he
|
||||||
std::optional<athena::io::FileReader>& fr) {
|
std::optional<athena::io::FileReader>& fr) {
|
||||||
/* Ensure requested resource is on the filesystem */
|
/* Ensure requested resource is on the filesystem */
|
||||||
if (!path.isFileOrGlob()) {
|
if (!path.isFileOrGlob()) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("unable to find resource path '{}'")), path.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to find resource path '{}'")), path.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ bool ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag, const he
|
||||||
/* Last chance type validation */
|
/* Last chance type validation */
|
||||||
urde::SObjectTag verifyTag = TagFromPath(path);
|
urde::SObjectTag verifyTag = TagFromPath(path);
|
||||||
if (verifyTag.type != tag.type) {
|
if (verifyTag.type != tag.type) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("{}: expected type '{}', found '{}'")), path.getRelativePath(),
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("{}: expected type '{}', found '{}'")), path.getRelativePath(),
|
||||||
tag.type, verifyTag.type);
|
tag.type, verifyTag.type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ bool ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag, const he
|
||||||
if (!cooked.isFile() || cooked.getModtime() < path.getModtime()) {
|
if (!cooked.isFile() || cooked.getModtime() < path.getModtime()) {
|
||||||
/* Do a blocking cook here */
|
/* Do a blocking cook here */
|
||||||
if (!SyncCook(path)) {
|
if (!SyncCook(path)) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("unable to cook resource path '{}'")), path.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to cook resource path '{}'")), path.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ bool ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag, const he
|
||||||
/* Ensure cooked rep is on the filesystem */
|
/* Ensure cooked rep is on the filesystem */
|
||||||
fr.emplace(cooked.getAbsolutePath(), 32 * 1024, false);
|
fr.emplace(cooked.getAbsolutePath(), 32 * 1024, false);
|
||||||
if (fr->hasError()) {
|
if (fr->hasError()) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("unable to open cooked resource path '{}'")), cooked.getAbsolutePath());
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to open cooked resource path '{}'")), cooked.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ std::unique_ptr<urde::IObj> ProjectResourceFactoryBase::Build(const urde::SObjec
|
||||||
const urde::CVParamTransfer& paramXfer,
|
const urde::CVParamTransfer& paramXfer,
|
||||||
CObjectReference* selfRef) {
|
CObjectReference* selfRef) {
|
||||||
if (!tag.id.IsValid())
|
if (!tag.id.IsValid())
|
||||||
Log.report(logvisor::Fatal, fmt("attempted to access null id on type '{}'"), tag.type);
|
Log.report(logvisor::Fatal, FMT_STRING("attempted to access null id on type '{}'"), tag.type);
|
||||||
|
|
||||||
const hecl::ProjectPath* resPath = nullptr;
|
const hecl::ProjectPath* resPath = nullptr;
|
||||||
if (!WaitForTagReady(tag, resPath))
|
if (!WaitForTagReady(tag, resPath))
|
||||||
|
@ -243,14 +243,14 @@ std::unique_ptr<urde::IObj> ProjectResourceFactoryBase::Build(const urde::SObjec
|
||||||
}
|
}
|
||||||
|
|
||||||
//*task.xc_targetObjPtr = newObj.get();
|
//*task.xc_targetObjPtr = newObj.get();
|
||||||
Log.report(logvisor::Warning, fmt("spin-built {}"), task.x0_tag);
|
Log.report(logvisor::Warning, FMT_STRING("spin-built {}"), task.x0_tag);
|
||||||
|
|
||||||
_RemoveTask(asyncSearch);
|
_RemoveTask(asyncSearch);
|
||||||
return newObj;
|
return newObj;
|
||||||
} else if (task.m_complete) {
|
} else if (task.m_complete) {
|
||||||
Log.report(logvisor::Error, fmt("unable to spin-build {}; Resource requested as cook-only"), task.x0_tag);
|
Log.report(logvisor::Error, FMT_STRING("unable to spin-build {}; Resource requested as cook-only"), task.x0_tag);
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Error, fmt("unable to spin-build {}"), task.x0_tag);
|
Log.report(logvisor::Error, FMT_STRING("unable to spin-build {}"), task.x0_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
_RemoveTask(asyncSearch);
|
_RemoveTask(asyncSearch);
|
||||||
|
@ -273,14 +273,14 @@ std::shared_ptr<AsyncTask> ProjectResourceFactoryBase::BuildAsyncInternal(const
|
||||||
void ProjectResourceFactoryBase::BuildAsync(const urde::SObjectTag& tag, const urde::CVParamTransfer& paramXfer,
|
void ProjectResourceFactoryBase::BuildAsync(const urde::SObjectTag& tag, const urde::CVParamTransfer& paramXfer,
|
||||||
std::unique_ptr<urde::IObj>* objOut, CObjectReference* selfRef) {
|
std::unique_ptr<urde::IObj>* objOut, CObjectReference* selfRef) {
|
||||||
if (!tag.id.IsValid())
|
if (!tag.id.IsValid())
|
||||||
Log.report(logvisor::Fatal, fmt("attempted to access null id on type '{}'"), tag.type);
|
Log.report(logvisor::Fatal, FMT_STRING("attempted to access null id on type '{}'"), tag.type);
|
||||||
|
|
||||||
BuildAsyncInternal(tag, paramXfer, objOut, selfRef);
|
BuildAsyncInternal(tag, paramXfer, objOut, selfRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 ProjectResourceFactoryBase::ResourceSize(const SObjectTag& tag) {
|
u32 ProjectResourceFactoryBase::ResourceSize(const SObjectTag& tag) {
|
||||||
if (!tag.id.IsValid())
|
if (!tag.id.IsValid())
|
||||||
Log.report(logvisor::Fatal, fmt("attempted to access null id on type '{}'"), tag.type);
|
Log.report(logvisor::Fatal, FMT_STRING("attempted to access null id on type '{}'"), tag.type);
|
||||||
|
|
||||||
/* Ensure resource at requested path is indexed and not cooking */
|
/* Ensure resource at requested path is indexed and not cooking */
|
||||||
const hecl::ProjectPath* resPath = nullptr;
|
const hecl::ProjectPath* resPath = nullptr;
|
||||||
|
@ -298,7 +298,7 @@ u32 ProjectResourceFactoryBase::ResourceSize(const SObjectTag& tag) {
|
||||||
std::shared_ptr<urde::IDvdRequest> ProjectResourceFactoryBase::LoadResourceAsync(const urde::SObjectTag& tag,
|
std::shared_ptr<urde::IDvdRequest> ProjectResourceFactoryBase::LoadResourceAsync(const urde::SObjectTag& tag,
|
||||||
void* target) {
|
void* target) {
|
||||||
if (!tag.id.IsValid())
|
if (!tag.id.IsValid())
|
||||||
Log.report(logvisor::Fatal, fmt("attempted to access null id"));
|
Log.report(logvisor::Fatal, FMT_STRING("attempted to access null id"));
|
||||||
if (m_asyncLoadMap.find(tag) != m_asyncLoadMap.end())
|
if (m_asyncLoadMap.find(tag) != m_asyncLoadMap.end())
|
||||||
return {};
|
return {};
|
||||||
return std::static_pointer_cast<urde::IDvdRequest>(
|
return std::static_pointer_cast<urde::IDvdRequest>(
|
||||||
|
@ -308,7 +308,7 @@ std::shared_ptr<urde::IDvdRequest> ProjectResourceFactoryBase::LoadResourceAsync
|
||||||
std::shared_ptr<urde::IDvdRequest> ProjectResourceFactoryBase::LoadResourcePartAsync(const urde::SObjectTag& tag,
|
std::shared_ptr<urde::IDvdRequest> ProjectResourceFactoryBase::LoadResourcePartAsync(const urde::SObjectTag& tag,
|
||||||
u32 off, u32 size, void* target) {
|
u32 off, u32 size, void* target) {
|
||||||
if (!tag.id.IsValid())
|
if (!tag.id.IsValid())
|
||||||
Log.report(logvisor::Fatal, fmt("attempted to access null id"));
|
Log.report(logvisor::Fatal, FMT_STRING("attempted to access null id"));
|
||||||
if (m_asyncLoadMap.find(tag) != m_asyncLoadMap.end())
|
if (m_asyncLoadMap.find(tag) != m_asyncLoadMap.end())
|
||||||
return {};
|
return {};
|
||||||
return std::static_pointer_cast<urde::IDvdRequest>(
|
return std::static_pointer_cast<urde::IDvdRequest>(
|
||||||
|
@ -317,7 +317,7 @@ std::shared_ptr<urde::IDvdRequest> ProjectResourceFactoryBase::LoadResourcePartA
|
||||||
|
|
||||||
std::unique_ptr<u8[]> ProjectResourceFactoryBase::LoadResourceSync(const urde::SObjectTag& tag) {
|
std::unique_ptr<u8[]> ProjectResourceFactoryBase::LoadResourceSync(const urde::SObjectTag& tag) {
|
||||||
if (!tag.id.IsValid())
|
if (!tag.id.IsValid())
|
||||||
Log.report(logvisor::Fatal, fmt("attempted to access null id"));
|
Log.report(logvisor::Fatal, FMT_STRING("attempted to access null id"));
|
||||||
|
|
||||||
/* Ensure resource at requested path is indexed and not cooking */
|
/* Ensure resource at requested path is indexed and not cooking */
|
||||||
const hecl::ProjectPath* resPath = nullptr;
|
const hecl::ProjectPath* resPath = nullptr;
|
||||||
|
@ -335,7 +335,7 @@ std::unique_ptr<u8[]> ProjectResourceFactoryBase::LoadResourceSync(const urde::S
|
||||||
std::unique_ptr<u8[]> ProjectResourceFactoryBase::LoadNewResourcePartSync(const urde::SObjectTag& tag, u32 off,
|
std::unique_ptr<u8[]> ProjectResourceFactoryBase::LoadNewResourcePartSync(const urde::SObjectTag& tag, u32 off,
|
||||||
u32 size) {
|
u32 size) {
|
||||||
if (!tag.id.IsValid())
|
if (!tag.id.IsValid())
|
||||||
Log.report(logvisor::Fatal, fmt("attempted to access null id"));
|
Log.report(logvisor::Fatal, FMT_STRING("attempted to access null id"));
|
||||||
|
|
||||||
/* Ensure resource at requested path is indexed and not cooking */
|
/* Ensure resource at requested path is indexed and not cooking */
|
||||||
const hecl::ProjectPath* resPath = nullptr;
|
const hecl::ProjectPath* resPath = nullptr;
|
||||||
|
@ -354,7 +354,7 @@ std::unique_ptr<u8[]> ProjectResourceFactoryBase::LoadNewResourcePartSync(const
|
||||||
|
|
||||||
std::shared_ptr<AsyncTask> ProjectResourceFactoryBase::CookResourceAsync(const urde::SObjectTag& tag) {
|
std::shared_ptr<AsyncTask> ProjectResourceFactoryBase::CookResourceAsync(const urde::SObjectTag& tag) {
|
||||||
if (!tag.id.IsValid())
|
if (!tag.id.IsValid())
|
||||||
Log.report(logvisor::Fatal, fmt("attempted to access null id"));
|
Log.report(logvisor::Fatal, FMT_STRING("attempted to access null id"));
|
||||||
if (m_asyncLoadMap.find(tag) != m_asyncLoadMap.end())
|
if (m_asyncLoadMap.find(tag) != m_asyncLoadMap.end())
|
||||||
return {};
|
return {};
|
||||||
return _AddTask(std::make_shared<AsyncTask>(*this, tag));
|
return _AddTask(std::make_shared<AsyncTask>(*this, tag));
|
||||||
|
@ -364,7 +364,7 @@ void ProjectResourceFactoryBase::CancelBuild(const urde::SObjectTag& tag) { _Rem
|
||||||
|
|
||||||
bool ProjectResourceFactoryBase::CanBuild(const urde::SObjectTag& tag) {
|
bool ProjectResourceFactoryBase::CanBuild(const urde::SObjectTag& tag) {
|
||||||
if (!tag.id.IsValid())
|
if (!tag.id.IsValid())
|
||||||
Log.report(logvisor::Fatal, fmt("attempted to access null id"));
|
Log.report(logvisor::Fatal, FMT_STRING("attempted to access null id"));
|
||||||
|
|
||||||
const hecl::ProjectPath* resPath = nullptr;
|
const hecl::ProjectPath* resPath = nullptr;
|
||||||
if (!WaitForTagReady(tag, resPath))
|
if (!WaitForTagReady(tag, resPath))
|
||||||
|
@ -400,7 +400,7 @@ bool ProjectResourceFactoryBase::AsyncPumpTask(ItType& it) {
|
||||||
hecl::ProjectPath path = static_cast<DataSpec::SpecBase&>(*m_cookSpec).pathFromTag(task.x0_tag);
|
hecl::ProjectPath path = static_cast<DataSpec::SpecBase&>(*m_cookSpec).pathFromTag(task.x0_tag);
|
||||||
if (!path) {
|
if (!path) {
|
||||||
if (!static_cast<DataSpec::SpecBase&>(*m_cookSpec).backgroundIndexRunning()) {
|
if (!static_cast<DataSpec::SpecBase&>(*m_cookSpec).backgroundIndexRunning()) {
|
||||||
Log.report(logvisor::Error, fmt(_SYS_STR("unable to find async load resource ({})")), task.x0_tag);
|
Log.report(logvisor::Error, FMT_STRING(_SYS_STR("unable to find async load resource ({})")), task.x0_tag);
|
||||||
it = _RemoveTask(it);
|
it = _RemoveTask(it);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -423,14 +423,14 @@ bool ProjectResourceFactoryBase::AsyncPumpTask(ItType& it) {
|
||||||
}
|
}
|
||||||
|
|
||||||
*task.xc_targetObjPtr = std::move(newObj);
|
*task.xc_targetObjPtr = std::move(newObj);
|
||||||
Log.report(logvisor::Info, fmt("async-built {}"), task.x0_tag);
|
Log.report(logvisor::Info, FMT_STRING("async-built {}"), task.x0_tag);
|
||||||
} else if (task.xc_targetDataPtr) {
|
} else if (task.xc_targetDataPtr) {
|
||||||
/* Buffer only */
|
/* Buffer only */
|
||||||
*task.xc_targetDataPtr = std::move(task.x10_loadBuffer);
|
*task.xc_targetDataPtr = std::move(task.x10_loadBuffer);
|
||||||
Log.report(logvisor::Info, fmt("async-loaded {}"), task.x0_tag);
|
Log.report(logvisor::Info, FMT_STRING("async-loaded {}"), task.x0_tag);
|
||||||
} else if (task.xc_targetDataRawPtr) {
|
} else if (task.xc_targetDataRawPtr) {
|
||||||
/* Buffer only raw */
|
/* Buffer only raw */
|
||||||
Log.report(logvisor::Info, fmt("async-loaded {}"), task.x0_tag);
|
Log.report(logvisor::Info, FMT_STRING("async-loaded {}"), task.x0_tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ specter::View* SplitSpace::buildContentView(specter::ViewResources& res) {
|
||||||
|
|
||||||
void SplitSpace::setChildSlot(unsigned slot, std::unique_ptr<Space>&& space) {
|
void SplitSpace::setChildSlot(unsigned slot, std::unique_ptr<Space>&& space) {
|
||||||
if (slot > 1)
|
if (slot > 1)
|
||||||
Log.report(logvisor::Fatal, fmt("invalid slot {} for SplitView"), slot);
|
Log.report(logvisor::Fatal, FMT_STRING("invalid slot {} for SplitView"), slot);
|
||||||
m_slots[slot] = std::move(space);
|
m_slots[slot] = std::move(space);
|
||||||
m_slots[slot]->m_parent = this;
|
m_slots[slot]->m_parent = this;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ std::unique_ptr<Space> RootSpace::exchangeSpaceSplitJoin(Space* removeSpace, std
|
||||||
m_spaceTree.swap(ret);
|
m_spaceTree.swap(ret);
|
||||||
m_spaceTree->m_parent = this;
|
m_spaceTree->m_parent = this;
|
||||||
} else
|
} else
|
||||||
Log.report(logvisor::Fatal, fmt("RootSpace::exchangeSpaceSplitJoin() failure"));
|
Log.report(logvisor::Fatal, FMT_STRING("RootSpace::exchangeSpaceSplitJoin() failure"));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ std::unique_ptr<Space> SplitSpace::exchangeSpaceSplitJoin(Space* removeSpace, st
|
||||||
m_slots[1].swap(ret);
|
m_slots[1].swap(ret);
|
||||||
m_slots[1]->m_parent = this;
|
m_slots[1]->m_parent = this;
|
||||||
} else
|
} else
|
||||||
Log.report(logvisor::Fatal, fmt("SplitSpace::exchangeSpaceSplitJoin() failure"));
|
Log.report(logvisor::Fatal, FMT_STRING("SplitSpace::exchangeSpaceSplitJoin() failure"));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,12 +36,12 @@ SplashScreen::SplashScreen(ViewManager& vm, specter::ViewResources& res)
|
||||||
if (GIT_COMMIT_DATE[0] != '\0' && GIT_COMMIT_HASH[0] != '\0' && GIT_BRANCH[0] != '\0') {
|
if (GIT_COMMIT_DATE[0] != '\0' && GIT_COMMIT_HASH[0] != '\0' && GIT_BRANCH[0] != '\0') {
|
||||||
#ifdef URDE_DLPACKAGE
|
#ifdef URDE_DLPACKAGE
|
||||||
if ((URDE_DLPACKAGE)[0])
|
if ((URDE_DLPACKAGE)[0])
|
||||||
m_buildInfoStr = fmt::format(fmt("{}: {}\n{}: {}\n{}: {}"), vm.translate<locale::release>(),
|
m_buildInfoStr = fmt::format(FMT_STRING("{}: {}\n{}: {}\n{}: {}"), vm.translate<locale::release>(),
|
||||||
URDE_DLPACKAGE, vm.translate<locale::commit>(), GIT_COMMIT_HASH,
|
URDE_DLPACKAGE, vm.translate<locale::commit>(), GIT_COMMIT_HASH,
|
||||||
vm.translate<locale::date>(), GIT_COMMIT_DATE);
|
vm.translate<locale::date>(), GIT_COMMIT_DATE);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
m_buildInfoStr = fmt::format(fmt("{}: {}\n{}: {}\n{}: {}"), vm.translate<locale::branch>(), GIT_BRANCH,
|
m_buildInfoStr = fmt::format(FMT_STRING("{}: {}\n{}: {}\n{}: {}"), vm.translate<locale::branch>(), GIT_BRANCH,
|
||||||
vm.translate<locale::commit>(), GIT_COMMIT_HASH,
|
vm.translate<locale::commit>(), GIT_COMMIT_HASH,
|
||||||
vm.translate<locale::date>(), GIT_COMMIT_DATE);
|
vm.translate<locale::date>(), GIT_COMMIT_DATE);
|
||||||
}
|
}
|
||||||
|
@ -65,15 +65,15 @@ void SplashScreen::think() {
|
||||||
m_openButt.m_view->think();
|
m_openButt.m_view->think();
|
||||||
|
|
||||||
if (m_newProjBind.m_deferPath.size()) {
|
if (m_newProjBind.m_deferPath.size()) {
|
||||||
Log.report(logvisor::Info, fmt(_SYS_STR("Making project '{}'")), m_newProjBind.m_deferPath);
|
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("Making project '{}'")), m_newProjBind.m_deferPath);
|
||||||
m_vm.projectManager().newProject(m_newProjBind.m_deferPath);
|
m_vm.projectManager().newProject(m_newProjBind.m_deferPath);
|
||||||
m_newProjBind.m_deferPath.clear();
|
m_newProjBind.m_deferPath.clear();
|
||||||
} else if (m_openProjBind.m_deferPath.size()) {
|
} else if (m_openProjBind.m_deferPath.size()) {
|
||||||
Log.report(logvisor::Info, fmt(_SYS_STR("Opening project '{}'")), m_openProjBind.m_deferPath);
|
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("Opening project '{}'")), m_openProjBind.m_deferPath);
|
||||||
m_vm.projectManager().openProject(m_openProjBind.m_deferPath);
|
m_vm.projectManager().openProject(m_openProjBind.m_deferPath);
|
||||||
m_openProjBind.m_deferPath.clear();
|
m_openProjBind.m_deferPath.clear();
|
||||||
} else if (m_extractProjBind.m_deferPath.size()) {
|
} else if (m_extractProjBind.m_deferPath.size()) {
|
||||||
Log.report(logvisor::Info, fmt(_SYS_STR("Extracting game '{}'")), m_extractProjBind.m_deferPath);
|
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("Extracting game '{}'")), m_extractProjBind.m_deferPath);
|
||||||
m_vm.projectManager().extractGame(m_extractProjBind.m_deferPath);
|
m_vm.projectManager().extractGame(m_extractProjBind.m_deferPath);
|
||||||
m_extractProjBind.m_deferPath.clear();
|
m_extractProjBind.m_deferPath.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,14 +70,14 @@ void ViewManager::TestGameView::think() {
|
||||||
const hecl::CVar* showResourceStats = hecl::CVarManager::instance()->findCVar("debugOverlay.showResourceStats");
|
const hecl::CVar* showResourceStats = hecl::CVarManager::instance()->findCVar("debugOverlay.showResourceStats");
|
||||||
if (g_StateManager) {
|
if (g_StateManager) {
|
||||||
if (showFrameIdx && showFrameIdx->toBoolean())
|
if (showFrameIdx && showFrameIdx->toBoolean())
|
||||||
overlayText += fmt::format(fmt("Frame: {}\n"), g_StateManager->GetUpdateFrameIndex());
|
overlayText += fmt::format(FMT_STRING("Frame: {}\n"), g_StateManager->GetUpdateFrameIndex());
|
||||||
|
|
||||||
if (showInGameTime && showInGameTime->toBoolean()) {
|
if (showInGameTime && showInGameTime->toBoolean()) {
|
||||||
double igt = g_GameState->GetTotalPlayTime();
|
double igt = g_GameState->GetTotalPlayTime();
|
||||||
u32 ms = u64(igt * 1000) % 1000;
|
u32 ms = u64(igt * 1000) % 1000;
|
||||||
auto pt = std::div(igt, 3600);
|
auto pt = std::div(igt, 3600);
|
||||||
overlayText +=
|
overlayText +=
|
||||||
fmt::format(fmt("PlayTime: {:02d}:{:02d}:{:02d}.{:03d}\n"), pt.quot, pt.rem / 60, pt.rem % 60, ms);
|
fmt::format(FMT_STRING("PlayTime: {:02d}:{:02d}:{:02d}.{:03d}\n"), pt.quot, pt.rem / 60, pt.rem % 60, ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_StateManager->Player() && playerInfo && playerInfo->toBoolean()) {
|
if (g_StateManager->Player() && playerInfo && playerInfo->toBoolean()) {
|
||||||
|
@ -85,7 +85,7 @@ void ViewManager::TestGameView::think() {
|
||||||
const zeus::CQuaternion plQ = zeus::CQuaternion(pl.GetTransform().getRotation().buildMatrix3f());
|
const zeus::CQuaternion plQ = zeus::CQuaternion(pl.GetTransform().getRotation().buildMatrix3f());
|
||||||
const zeus::CTransform camXf = g_StateManager->GetCameraManager()->GetCurrentCameraTransform(*g_StateManager);
|
const zeus::CTransform camXf = g_StateManager->GetCameraManager()->GetCurrentCameraTransform(*g_StateManager);
|
||||||
const zeus::CQuaternion camQ = zeus::CQuaternion(camXf.getRotation().buildMatrix3f());
|
const zeus::CQuaternion camQ = zeus::CQuaternion(camXf.getRotation().buildMatrix3f());
|
||||||
overlayText += fmt::format(fmt("Player Position: x {}, y {}, z {}\n"
|
overlayText += fmt::format(FMT_STRING("Player Position: x {}, y {}, z {}\n"
|
||||||
" Roll: {}, Pitch: {}, Yaw: {}\n"
|
" Roll: {}, Pitch: {}, Yaw: {}\n"
|
||||||
" Momentum: x {}, y: {}, z: {}\n"
|
" Momentum: x {}, y: {}, z: {}\n"
|
||||||
" Velocity: x {}, y: {}, z: {}\n"
|
" Velocity: x {}, y: {}, z: {}\n"
|
||||||
|
@ -102,7 +102,7 @@ void ViewManager::TestGameView::think() {
|
||||||
TLockedToken<CStringTable> tbl =
|
TLockedToken<CStringTable> tbl =
|
||||||
g_SimplePool->GetObj({FOURCC('STRG'), g_StateManager->GetWorld()->IGetStringTableAssetId()});
|
g_SimplePool->GetObj({FOURCC('STRG'), g_StateManager->GetWorld()->IGetStringTableAssetId()});
|
||||||
const urde::TAreaId aId = g_GameState->CurrentWorldState().GetCurrentAreaId();
|
const urde::TAreaId aId = g_GameState->CurrentWorldState().GetCurrentAreaId();
|
||||||
overlayText += fmt::format(fmt("World: 0x{}{}, Area: {}\n"), g_GameState->CurrentWorldAssetId(),
|
overlayText += fmt::format(FMT_STRING("World: 0x{}{}, Area: {}\n"), g_GameState->CurrentWorldAssetId(),
|
||||||
(tbl.IsLoaded() ? (" " + hecl::Char16ToUTF8(tbl->GetString(0))).c_str() : ""), aId);
|
(tbl.IsLoaded() ? (" " + hecl::Char16ToUTF8(tbl->GetString(0))).c_str() : ""), aId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ void ViewManager::TestGameView::think() {
|
||||||
} else
|
} else
|
||||||
layerBits += "0";
|
layerBits += "0";
|
||||||
}
|
}
|
||||||
overlayText += fmt::format(fmt("Area AssetId: 0x{}, Total Objects: {}\n"
|
overlayText += fmt::format(FMT_STRING("Area AssetId: 0x{}, Total Objects: {}\n"
|
||||||
"Active Layer bits: {}\n"),
|
"Active Layer bits: {}\n"),
|
||||||
g_StateManager->GetWorld()->GetArea(aId)->GetAreaAssetId(),
|
g_StateManager->GetWorld()->GetArea(aId)->GetAreaAssetId(),
|
||||||
g_StateManager->GetAllObjectList().size(), layerBits);
|
g_StateManager->GetAllObjectList().size(), layerBits);
|
||||||
|
@ -127,7 +127,7 @@ void ViewManager::TestGameView::think() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showResourceStats && showResourceStats->toBoolean())
|
if (showResourceStats && showResourceStats->toBoolean())
|
||||||
overlayText += fmt::format(fmt("Resource Objects: {}\n"), g_SimplePool->GetLiveObjects());
|
overlayText += fmt::format(FMT_STRING("Resource Objects: {}\n"), g_SimplePool->GetLiveObjects());
|
||||||
|
|
||||||
if (!overlayText.empty())
|
if (!overlayText.empty())
|
||||||
m_debugText->typesetGlyphs(overlayText);
|
m_debugText->typesetGlyphs(overlayText);
|
||||||
|
@ -200,8 +200,8 @@ ViewManager::ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarMan
|
||||||
, m_projManager(*this)
|
, m_projManager(*this)
|
||||||
, m_fontCache(fileMgr)
|
, m_fontCache(fileMgr)
|
||||||
, m_locale(locale::SystemLocaleOrEnglish())
|
, m_locale(locale::SystemLocaleOrEnglish())
|
||||||
, m_recentProjectsPath(fmt::format(fmt(_SYS_STR("{}/recent_projects.txt")), fileMgr.getStoreRoot()))
|
, m_recentProjectsPath(fmt::format(FMT_STRING(_SYS_STR("{}/recent_projects.txt")), fileMgr.getStoreRoot()))
|
||||||
, m_recentFilesPath(fmt::format(fmt(_SYS_STR("{}/recent_files.txt")), fileMgr.getStoreRoot())) {
|
, m_recentFilesPath(fmt::format(FMT_STRING(_SYS_STR("{}/recent_files.txt")), fileMgr.getStoreRoot())) {
|
||||||
Space::SpaceMenuNode::InitializeStrings(*this);
|
Space::SpaceMenuNode::InitializeStrings(*this);
|
||||||
char path[2048];
|
char path[2048];
|
||||||
hecl::Sstat theStat;
|
hecl::Sstat theStat;
|
||||||
|
@ -246,7 +246,7 @@ void ViewManager::pushRecentProject(hecl::SystemStringView path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const hecl::SystemString& pPath : m_recentProjects) {
|
for (const hecl::SystemString& pPath : m_recentProjects) {
|
||||||
fmt::print(fp.get(), fmt("{}\n"), hecl::SystemUTF8Conv(pPath));
|
fmt::print(fp.get(), FMT_STRING("{}\n"), hecl::SystemUTF8Conv(pPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ void ViewManager::pushRecentFile(hecl::SystemStringView path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const hecl::SystemString& pPath : m_recentFiles) {
|
for (const hecl::SystemString& pPath : m_recentFiles) {
|
||||||
fmt::print(fp.get(), fmt("{}\n"), hecl::SystemUTF8Conv(pPath));
|
fmt::print(fp.get(), FMT_STRING("{}\n"), hecl::SystemUTF8Conv(pPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ void ViewManager::init(boo::IApplication* app) {
|
||||||
m_pipelineConv = hecl::NewPipelineConverter(m_mainBooFactory);
|
m_pipelineConv = hecl::NewPipelineConverter(m_mainBooFactory);
|
||||||
hecl::conv = m_pipelineConv.get();
|
hecl::conv = m_pipelineConv.get();
|
||||||
m_mainPlatformName = m_mainBooFactory->platformName();
|
m_mainPlatformName = m_mainBooFactory->platformName();
|
||||||
m_mainWindow->setTitle(fmt::format(fmt(_SYS_STR("URDE [{}]")), m_mainPlatformName));
|
m_mainWindow->setTitle(fmt::format(FMT_STRING(_SYS_STR("URDE [{}]")), m_mainPlatformName));
|
||||||
m_mainCommandQueue = m_mainWindow->getCommandQueue();
|
m_mainCommandQueue = m_mainWindow->getCommandQueue();
|
||||||
m_viewResources.init(m_mainBooFactory, &m_fontCache, &m_themeData, pixelFactor);
|
m_viewResources.init(m_mainBooFactory, &m_fontCache, &m_themeData, pixelFactor);
|
||||||
InitializeIcons(m_viewResources);
|
InitializeIcons(m_viewResources);
|
||||||
|
|
|
@ -16,7 +16,7 @@ void InitializeBadging(specter::ViewResources& viewRes) {
|
||||||
|
|
||||||
size_t fmt = r.readUint32Big();
|
size_t fmt = r.readUint32Big();
|
||||||
if (fmt != 16)
|
if (fmt != 16)
|
||||||
Log.report(logvisor::Fatal, fmt("incorrect icon texture format"));
|
Log.report(logvisor::Fatal, FMT_STRING("incorrect icon texture format"));
|
||||||
size_t width = r.readUint16Big();
|
size_t width = r.readUint16Big();
|
||||||
size_t height = r.readUint16Big();
|
size_t height = r.readUint16Big();
|
||||||
size_t mips = r.readUint32Big();
|
size_t mips = r.readUint32Big();
|
||||||
|
@ -26,7 +26,7 @@ void InitializeBadging(specter::ViewResources& viewRes) {
|
||||||
uLongf destSz = decompSz;
|
uLongf destSz = decompSz;
|
||||||
size_t pos = r.position();
|
size_t pos = r.position();
|
||||||
if (uncompress(texels.get(), &destSz, URDE_BADGE + pos, URDE_BADGE_SZ - pos) != Z_OK)
|
if (uncompress(texels.get(), &destSz, URDE_BADGE + pos, URDE_BADGE_SZ - pos) != Z_OK)
|
||||||
Log.report(logvisor::Fatal, fmt("unable to decompress badge"));
|
Log.report(logvisor::Fatal, FMT_STRING("unable to decompress badge"));
|
||||||
|
|
||||||
viewRes.m_factory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) {
|
viewRes.m_factory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||||
specter::IconAtlas<1, 1> atlas;
|
specter::IconAtlas<1, 1> atlas;
|
||||||
|
|
|
@ -14,7 +14,7 @@ void InitializeIcons(specter::ViewResources& viewRes) {
|
||||||
athena::io::MemoryReader r(URDE_ICONS, URDE_ICONS_SZ);
|
athena::io::MemoryReader r(URDE_ICONS, URDE_ICONS_SZ);
|
||||||
size_t fmt = r.readUint32Big();
|
size_t fmt = r.readUint32Big();
|
||||||
if (fmt != 16)
|
if (fmt != 16)
|
||||||
Log.report(logvisor::Fatal, fmt("incorrect icon texture format"));
|
Log.report(logvisor::Fatal, FMT_STRING("incorrect icon texture format"));
|
||||||
size_t width = r.readUint16Big();
|
size_t width = r.readUint16Big();
|
||||||
size_t height = r.readUint16Big();
|
size_t height = r.readUint16Big();
|
||||||
size_t mips = r.readUint32Big();
|
size_t mips = r.readUint32Big();
|
||||||
|
@ -24,7 +24,7 @@ void InitializeIcons(specter::ViewResources& viewRes) {
|
||||||
uLongf destSz = decompSz;
|
uLongf destSz = decompSz;
|
||||||
size_t pos = r.position();
|
size_t pos = r.position();
|
||||||
if (uncompress(texels.get(), &destSz, URDE_ICONS + pos, URDE_ICONS_SZ - pos) != Z_OK)
|
if (uncompress(texels.get(), &destSz, URDE_ICONS + pos, URDE_ICONS_SZ - pos) != Z_OK)
|
||||||
Log.report(logvisor::Fatal, fmt("unable to decompress icons"));
|
Log.report(logvisor::Fatal, FMT_STRING("unable to decompress icons"));
|
||||||
|
|
||||||
viewRes.m_factory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) {
|
viewRes.m_factory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||||
g_IconAtlas.initializeAtlas(ctx.newStaticTexture(width, height, mips, boo::TextureFormat::RGBA8,
|
g_IconAtlas.initializeAtlas(ctx.newStaticTexture(width, height, mips, boo::TextureFormat::RGBA8,
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 9b765b58cf7389014f7e89a9dfb92da98ce89962
|
Subproject commit c595cf725f657f3542264d7a244c14716ec41bfa
|
|
@ -94,16 +94,16 @@ struct Application : boo::IApplicationCallback {
|
||||||
if (arg.find(_SYS_STR("--verbosity=")) == 0 || arg.find(_SYS_STR("-v=")) == 0) {
|
if (arg.find(_SYS_STR("--verbosity=")) == 0 || arg.find(_SYS_STR("-v=")) == 0) {
|
||||||
hecl::SystemUTF8Conv utf8Arg(arg.substr(arg.find_last_of('=') + 1));
|
hecl::SystemUTF8Conv utf8Arg(arg.substr(arg.find_last_of('=') + 1));
|
||||||
hecl::VerbosityLevel = atoi(utf8Arg.c_str());
|
hecl::VerbosityLevel = atoi(utf8Arg.c_str());
|
||||||
hecl::LogModule.report(logvisor::Info, fmt("Set verbosity level to {}"), hecl::VerbosityLevel);
|
hecl::LogModule.report(logvisor::Info, FMT_STRING("Set verbosity level to {}"), hecl::VerbosityLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cvarManager.parseCommandLine(app->getArgs());
|
m_cvarManager.parseCommandLine(app->getArgs());
|
||||||
|
|
||||||
const zeus::CPUInfo& cpuInf = zeus::cpuFeatures();
|
const zeus::CPUInfo& cpuInf = zeus::cpuFeatures();
|
||||||
Log.report(logvisor::Info, fmt("CPU Name: {}"), cpuInf.cpuBrand);
|
Log.report(logvisor::Info, FMT_STRING("CPU Name: {}"), cpuInf.cpuBrand);
|
||||||
Log.report(logvisor::Info, fmt("CPU Vendor: {}"), cpuInf.cpuVendor);
|
Log.report(logvisor::Info, FMT_STRING("CPU Vendor: {}"), cpuInf.cpuVendor);
|
||||||
Log.report(logvisor::Info, fmt(_SYS_STR("CPU Features: {}")), CPUFeatureString(cpuInf));
|
Log.report(logvisor::Info, FMT_STRING(_SYS_STR("CPU Features: {}")), CPUFeatureString(cpuInf));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getGraphicsApi() const { return m_cvarCommons.getGraphicsApi(); }
|
std::string getGraphicsApi() const { return m_cvarCommons.getGraphicsApi(); }
|
||||||
|
@ -145,11 +145,11 @@ static void SetupBasics(bool logging) {
|
||||||
auto result = zeus::validateCPU();
|
auto result = zeus::validateCPU();
|
||||||
if (!result.first) {
|
if (!result.first) {
|
||||||
#if _WIN32 && !WINDOWS_STORE
|
#if _WIN32 && !WINDOWS_STORE
|
||||||
std::wstring msg = fmt::format(fmt(L"ERROR: This build of URDE requires the following CPU features:\n{}\n"),
|
std::wstring msg = fmt::format(FMT_STRING(L"ERROR: This build of URDE requires the following CPU features:\n{}\n"),
|
||||||
urde::CPUFeatureString(result.second));
|
urde::CPUFeatureString(result.second));
|
||||||
MessageBoxW(nullptr, msg.c_str(), L"CPU error", MB_OK | MB_ICONERROR);
|
MessageBoxW(nullptr, msg.c_str(), L"CPU error", MB_OK | MB_ICONERROR);
|
||||||
#else
|
#else
|
||||||
fmt::print(stderr, fmt("ERROR: This build of URDE requires the following CPU features:\n{}\n"),
|
fmt::print(stderr, FMT_STRING("ERROR: This build of URDE requires the following CPU features:\n{}\n"),
|
||||||
urde::CPUFeatureString(result.second));
|
urde::CPUFeatureString(result.second));
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -176,7 +176,7 @@ int main(int argc, const boo::SystemChar** argv)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (argc > 1 && !hecl::StrCmp(argv[1], _SYS_STR("--dlpackage"))) {
|
if (argc > 1 && !hecl::StrCmp(argv[1], _SYS_STR("--dlpackage"))) {
|
||||||
fmt::print(fmt("{}\n"), URDE_DLPACKAGE);
|
fmt::print(FMT_STRING("{}\n"), URDE_DLPACKAGE);
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ static logvisor::Module Log("CNESEmulator");
|
||||||
|
|
||||||
CNESEmulator::CNESEmulator() {
|
CNESEmulator::CNESEmulator() {
|
||||||
if (EmulatorConstructed)
|
if (EmulatorConstructed)
|
||||||
Log.report(logvisor::Fatal, fmt("Attempted constructing more than 1 CNESEmulator"));
|
Log.report(logvisor::Fatal, FMT_STRING("Attempted constructing more than 1 CNESEmulator"));
|
||||||
EmulatorConstructed = true;
|
EmulatorConstructed = true;
|
||||||
|
|
||||||
CDvdFile NESEmuFile("NESemuP.rel");
|
CDvdFile NESEmuFile("NESemuP.rel");
|
||||||
|
@ -191,7 +191,7 @@ CNESEmulator::CNESEmulator() {
|
||||||
m_nesEmuPBuf.reset(new u8[0x20000]);
|
m_nesEmuPBuf.reset(new u8[0x20000]);
|
||||||
m_dvdReq = NESEmuFile.AsyncSeekRead(m_nesEmuPBuf.get(), 0x20000, ESeekOrigin::Begin, NESEMUP_ROM_OFFSET);
|
m_dvdReq = NESEmuFile.AsyncSeekRead(m_nesEmuPBuf.get(), 0x20000, ESeekOrigin::Begin, NESEMUP_ROM_OFFSET);
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Fatal, fmt("Unable to open NESemuP.rel"));
|
Log.report(logvisor::Fatal, FMT_STRING("Unable to open NESemuP.rel"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ s16 s_DefaultVolumeScale = 0x7f;
|
||||||
CAudioSys* CAudioSys::g_SharedSys = nullptr;
|
CAudioSys* CAudioSys::g_SharedSys = nullptr;
|
||||||
|
|
||||||
TLockedToken<CAudioGroupSet> CAudioSys::FindGroupSet(std::string_view name) {
|
TLockedToken<CAudioGroupSet> CAudioSys::FindGroupSet(std::string_view name) {
|
||||||
|
// TODO: Heterogeneous lookup when C++20 available
|
||||||
auto search = mpGroupSetDB.find(name.data());
|
auto search = mpGroupSetDB.find(name.data());
|
||||||
if (search == mpGroupSetDB.cend())
|
if (search == mpGroupSetDB.cend())
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -1048,15 +1048,15 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
|
||||||
x308_textpane_instructions2->TextSupport().SetText(u"");
|
x308_textpane_instructions2->TextSupport().SetText(u"");
|
||||||
} else {
|
} else {
|
||||||
x2fc_textpane_hint->TextSupport().SetText(u"");
|
x2fc_textpane_hint->TextSupport().SetText(u"");
|
||||||
std::u16string str = fmt::format(fmt(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x24_lStick[x2e4_lStickPos]);
|
std::u16string str = fmt::format(FMT_STRING(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x24_lStick[x2e4_lStickPos]);
|
||||||
str += g_MainStringTable->GetString(46); // Rotate
|
str += g_MainStringTable->GetString(46); // Rotate
|
||||||
x300_textpane_instructions->TextSupport().SetText(str);
|
x300_textpane_instructions->TextSupport().SetText(str);
|
||||||
str = fmt::format(fmt(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x4c_cStick[x2e8_rStickPos]);
|
str = fmt::format(FMT_STRING(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x4c_cStick[x2e8_rStickPos]);
|
||||||
str += g_MainStringTable->GetString(47); // Move
|
str += g_MainStringTable->GetString(47); // Move
|
||||||
x304_textpane_instructions1->TextSupport().SetText(str);
|
x304_textpane_instructions1->TextSupport().SetText(str);
|
||||||
str = fmt::format(fmt(u"&image={};"), g_tweakPlayerRes->x74_lTrigger[x2ec_lTriggerPos]);
|
str = fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->x74_lTrigger[x2ec_lTriggerPos]);
|
||||||
str += g_MainStringTable->GetString(48); // Zoom
|
str += g_MainStringTable->GetString(48); // Zoom
|
||||||
str += fmt::format(fmt(u"&image={};"), g_tweakPlayerRes->x80_rTrigger[x2f0_rTriggerPos]);
|
str += fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->x80_rTrigger[x2f0_rTriggerPos]);
|
||||||
x308_textpane_instructions2->TextSupport().SetText(str);
|
x308_textpane_instructions2->TextSupport().SetText(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1129,7 +1129,7 @@ void CAutoMapper::Update(float dt, CStateManager& mgr) {
|
||||||
std::u16string string;
|
std::u16string string;
|
||||||
if (x1bc_state == EAutoMapperState::MapScreenUniverse ||
|
if (x1bc_state == EAutoMapperState::MapScreenUniverse ||
|
||||||
(x1bc_state == EAutoMapperState::MapScreen && HasCurrentMapUniverseWorld()))
|
(x1bc_state == EAutoMapperState::MapScreen && HasCurrentMapUniverseWorld()))
|
||||||
string = fmt::format(fmt(u"&image={};"), g_tweakPlayerRes->x98_aButton[x2f4_aButtonPos]);
|
string = fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->x98_aButton[x2f4_aButtonPos]);
|
||||||
right1->TextSupport().SetText(string);
|
right1->TextSupport().SetText(string);
|
||||||
CGuiTextPane* right = static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_right"));
|
CGuiTextPane* right = static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_right"));
|
||||||
if (x1bc_state == EAutoMapperState::MapScreenUniverse)
|
if (x1bc_state == EAutoMapperState::MapScreenUniverse)
|
||||||
|
|
|
@ -44,7 +44,7 @@ u8* CGameAllocator::Alloc(size_t len) {
|
||||||
void CGameAllocator::Free(u8* ptr) {
|
void CGameAllocator::Free(u8* ptr) {
|
||||||
SChunkDescription* info = reinterpret_cast<SChunkDescription*>(ptr - sizeof(SChunkDescription));
|
SChunkDescription* info = reinterpret_cast<SChunkDescription*>(ptr - sizeof(SChunkDescription));
|
||||||
if (info->magic != 0xE8E8E8E8 || info->sentinal != 0xEFEFEFEF) {
|
if (info->magic != 0xE8E8E8E8 || info->sentinal != 0xEFEFEFEF) {
|
||||||
AllocLog.report(logvisor::Fatal, fmt(_SYS_STR("Invalid chunk description, memory corruption!")));
|
AllocLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("Invalid chunk description, memory corruption!")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
bool ReadFromMemoryCard(std::string_view name) { return true; }
|
bool ReadFromMemoryCard(std::string_view name) { return true; }
|
||||||
|
|
||||||
static std::string GetIdentifierForMidiEvent(CAssetId world, CAssetId area, std::string_view midiObj) {
|
static std::string GetIdentifierForMidiEvent(CAssetId world, CAssetId area, std::string_view midiObj) {
|
||||||
return fmt::format(fmt("World {} Area {} MidiObject: {}"), world, area, midiObj);
|
return fmt::format(FMT_STRING("World {} Area {} MidiObject: {}"), world, area, midiObj);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,13 +11,13 @@ kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlo
|
||||||
/* XDG-selected data path */
|
/* XDG-selected data path */
|
||||||
kabufuda::SystemString path =
|
kabufuda::SystemString path =
|
||||||
((dataHome && dataHome[0] == '/') ? dataHome : hecl::SystemString(home)) + "/.local/share/dolphin-emu";
|
((dataHome && dataHome[0] == '/') ? dataHome : hecl::SystemString(home)) + "/.local/share/dolphin-emu";
|
||||||
path += fmt::format(fmt("/GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
path += fmt::format(FMT_STRING("/GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
|
|
||||||
hecl::Sstat theStat;
|
hecl::Sstat theStat;
|
||||||
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode)) {
|
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode)) {
|
||||||
/* legacy case for older dolphin versions */
|
/* legacy case for older dolphin versions */
|
||||||
path = home;
|
path = home;
|
||||||
path += fmt::format(fmt("/.dolphin-emu/GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
path += fmt::format(FMT_STRING("/.dolphin-emu/GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
|
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot sl
|
||||||
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
path += fmt::format(fmt("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
path += fmt::format(FMT_STRING("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
|
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
|
||||||
if (fp == nullptr) {
|
if (fp == nullptr) {
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -8,7 +8,7 @@ kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlo
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
kabufuda::SystemString path = home;
|
kabufuda::SystemString path = home;
|
||||||
path += fmt::format(fmt("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw"),
|
path += fmt::format(FMT_STRING("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw"),
|
||||||
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
|
|
||||||
hecl::Sstat theStat;
|
hecl::Sstat theStat;
|
||||||
|
@ -28,7 +28,7 @@ kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot sl
|
||||||
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
path += fmt::format(fmt("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
path += fmt::format(FMT_STRING("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
|
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
|
||||||
if (fp == nullptr) {
|
if (fp == nullptr) {
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -48,7 +48,7 @@ kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlo
|
||||||
kabufuda::SystemString path(localFolder->Path->Data());
|
kabufuda::SystemString path(localFolder->Path->Data());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
path += fmt::format(fmt(_SYS_STR("/GC/MemoryCard{}.USA.raw")),
|
path += fmt::format(FMT_STRING(_SYS_STR("/GC/MemoryCard{}.USA.raw")),
|
||||||
slot == kabufuda::ECardSlot::SlotA ? _SYS_STR('A') : _SYS_STR('B'));
|
slot == kabufuda::ECardSlot::SlotA ? _SYS_STR('A') : _SYS_STR('B'));
|
||||||
|
|
||||||
hecl::Sstat theStat;
|
hecl::Sstat theStat;
|
||||||
|
@ -99,7 +99,7 @@ kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot sl
|
||||||
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
path += fmt::format(fmt(_SYS_STR("/MemoryCard{}.USA.raw")),
|
path += fmt::format(FMT_STRING(_SYS_STR("/MemoryCard{}.USA.raw")),
|
||||||
slot == kabufuda::ECardSlot::SlotA ? _SYS_STR('A') : _SYS_STR('B'));
|
slot == kabufuda::ECardSlot::SlotA ? _SYS_STR('A') : _SYS_STR('B'));
|
||||||
const auto fp = hecl::FopenUnique(path.c_str(), _SYS_STR("wb"));
|
const auto fp = hecl::FopenUnique(path.c_str(), _SYS_STR("wb"));
|
||||||
if (fp == nullptr) {
|
if (fp == nullptr) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ void CObjectList::AddObject(CEntity& entity) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (x0_list[entity.GetUniqueId().Value()].entity != nullptr &&
|
if (x0_list[entity.GetUniqueId().Value()].entity != nullptr &&
|
||||||
x0_list[entity.GetUniqueId().Value()].entity != &entity)
|
x0_list[entity.GetUniqueId().Value()].entity != &entity)
|
||||||
Log.report(logvisor::Level::Fatal, fmt("INVALID USAGE DETECTED: Attempting to assign entity '{} ({})' to existing node '{}'!!!"),
|
Log.report(logvisor::Level::Fatal, FMT_STRING("INVALID USAGE DETECTED: Attempting to assign entity '{} ({})' to existing node '{}'!!!"),
|
||||||
entity.GetName(), entity.GetEditorId(), entity.GetUniqueId().Value());
|
entity.GetName(), entity.GetEditorId(), entity.GetUniqueId().Value());
|
||||||
#endif
|
#endif
|
||||||
s16 prevFirst = -1;
|
s16 prevFirst = -1;
|
||||||
|
|
|
@ -5,7 +5,7 @@ static logvisor::Module Log("urde::CPakFile");
|
||||||
|
|
||||||
CPakFile::CPakFile(std::string_view filename, bool buildDepList, bool worldPak, bool override) : CDvdFile(filename) {
|
CPakFile::CPakFile(std::string_view filename, bool buildDepList, bool worldPak, bool override) : CDvdFile(filename) {
|
||||||
if (!CDvdFile::operator bool())
|
if (!CDvdFile::operator bool())
|
||||||
Log.report(logvisor::Fatal, fmt("{}: Unable to open"), GetPath());
|
Log.report(logvisor::Fatal, FMT_STRING("{}: Unable to open"), GetPath());
|
||||||
x28_24_buildDepList = buildDepList;
|
x28_24_buildDepList = buildDepList;
|
||||||
//x28_24_buildDepList = true; // Always do this so URDE can rapidly pre-warm shaders
|
//x28_24_buildDepList = true; // Always do this so URDE can rapidly pre-warm shaders
|
||||||
x28_25_aramFile = false;
|
x28_25_aramFile = false;
|
||||||
|
@ -67,7 +67,7 @@ void CPakFile::InitialHeaderLoad() {
|
||||||
u32 version = r.readUint32Big();
|
u32 version = r.readUint32Big();
|
||||||
if (version != 0x80030005) {
|
if (version != 0x80030005) {
|
||||||
Log.report(logvisor::Fatal,
|
Log.report(logvisor::Fatal,
|
||||||
fmt("{}: Incompatible pak file version -- Current version is {:08X}, you're using {:08X}"),
|
FMT_STRING("{}: Incompatible pak file version -- Current version is {:08X}, you're using {:08X}"),
|
||||||
GetPath(), 0x80030005, version);
|
GetPath(), 0x80030005, version);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ CFactoryFnReturn CResFactory::BuildSync(const SObjectTag& tag, const CVParamTran
|
||||||
else
|
else
|
||||||
ret = std::make_unique<TObjOwnerDerivedFromIObjUntyped>(nullptr);
|
ret = std::make_unique<TObjOwnerDerivedFromIObjUntyped>(nullptr);
|
||||||
}
|
}
|
||||||
Log.report(logvisor::Warning, fmt("sync-built {}"), tag);
|
Log.report(logvisor::Warning, FMT_STRING("sync-built {}"), tag);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ bool CResFactory::PumpResource(SLoadingData& data) {
|
||||||
*data.xc_targetPtr =
|
*data.xc_targetPtr =
|
||||||
x5c_factoryMgr.MakeObjectFromMemory(data.x0_tag, std::move(data.x10_loadBuffer), data.x14_resSize,
|
x5c_factoryMgr.MakeObjectFromMemory(data.x0_tag, std::move(data.x10_loadBuffer), data.x14_resSize,
|
||||||
data.m_compressed, data.x18_cvXfer, data.m_selfRef);
|
data.m_compressed, data.x18_cvXfer, data.m_selfRef);
|
||||||
Log.report(logvisor::Info, fmt("async-built {}"), data.x0_tag);
|
Log.report(logvisor::Info, FMT_STRING("async-built {}"), data.x0_tag);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -210,7 +210,7 @@ bool CResLoader::FindResource(CAssetId id) const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.report(logvisor::Warning, fmt("Unable to find asset {}"), id);
|
Log.report(logvisor::Warning, FMT_STRING("Unable to find asset {}"), id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ CPakFile* CResLoader::FindResourceForLoad(CAssetId id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.report(logvisor::Error, fmt("Unable to find asset {}"), id);
|
Log.report(logvisor::Error, FMT_STRING("Unable to find asset {}"), id);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -916,7 +916,7 @@ void CStateManager::DrawActorCubeFaces(CActor& actor, int& cubeInst) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int f = 0; f < 6; ++f) {
|
for (int f = 0; f < 6; ++f) {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CStateManager::DrawActorCubeFaces [{}] {} {} {}"), f,
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CStateManager::DrawActorCubeFaces [{}] {} {} {}"), f,
|
||||||
actor.GetUniqueId(), actor.GetEditorId(), actor.GetName())
|
actor.GetUniqueId(), actor.GetEditorId(), actor.GetName())
|
||||||
.c_str(),
|
.c_str(),
|
||||||
zeus::skOrange);
|
zeus::skOrange);
|
||||||
|
@ -1211,7 +1211,7 @@ void CStateManager::RecursiveDrawTree(TUniqueId node) {
|
||||||
void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMessage msg) {
|
void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMessage msg) {
|
||||||
if (dest && !dest->x30_26_scriptingBlocked) {
|
if (dest && !dest->x30_26_scriptingBlocked) {
|
||||||
if (sm_logScripting && sm_logScripting->toBoolean())
|
if (sm_logScripting && sm_logScripting->toBoolean())
|
||||||
LogModule.report(logvisor::Info, fmt("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
|
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
|
||||||
dest->GetName(), dest->GetUniqueId());
|
dest->GetName(), dest->GetUniqueId());
|
||||||
dest->AcceptScriptMsg(msg, src, *this);
|
dest->AcceptScriptMsg(msg, src, *this);
|
||||||
}
|
}
|
||||||
|
@ -1226,7 +1226,7 @@ void CStateManager::SendScriptMsgAlways(TUniqueId dest, TUniqueId src, EScriptOb
|
||||||
CEntity* dst = ObjectById(dest);
|
CEntity* dst = ObjectById(dest);
|
||||||
if (dst) {
|
if (dst) {
|
||||||
if (sm_logScripting && sm_logScripting->toBoolean())
|
if (sm_logScripting && sm_logScripting->toBoolean())
|
||||||
LogModule.report(logvisor::Info, fmt("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
|
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
|
||||||
dst->GetName(), dst->GetUniqueId());
|
dst->GetName(), dst->GetUniqueId());
|
||||||
dst->AcceptScriptMsg(msg, src, *this);
|
dst->AcceptScriptMsg(msg, src, *this);
|
||||||
}
|
}
|
||||||
|
@ -1282,7 +1282,7 @@ void CStateManager::FreeScriptObject(TUniqueId id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sm_logScripting && sm_logScripting->toBoolean())
|
if (sm_logScripting && sm_logScripting->toBoolean())
|
||||||
LogModule.report(logvisor::Info, fmt("Removed '{}'"), ent->GetName());
|
LogModule.report(logvisor::Info, FMT_STRING("Removed '{}'"), ent->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<const SScriptObjectStream*, TEditorId> CStateManager::GetBuildForScript(TEditorId id) const {
|
std::pair<const SScriptObjectStream*, TEditorId> CStateManager::GetBuildForScript(TEditorId id) const {
|
||||||
|
@ -1374,16 +1374,16 @@ std::pair<TEditorId, TUniqueId> CStateManager::LoadScriptObject(TAreaId aid, ESc
|
||||||
|
|
||||||
u32 readAmt = in.position() - startPos;
|
u32 readAmt = in.position() - startPos;
|
||||||
if (readAmt > length)
|
if (readAmt > length)
|
||||||
LogModule.report(logvisor::Fatal, fmt("Script object overread while reading {}"), ScriptObjectTypeToStr(type));
|
LogModule.report(logvisor::Fatal, FMT_STRING("Script object overread while reading {}"), ScriptObjectTypeToStr(type));
|
||||||
u32 leftover = length - readAmt;
|
u32 leftover = length - readAmt;
|
||||||
for (u32 i = 0; i < leftover; ++i)
|
for (u32 i = 0; i < leftover; ++i)
|
||||||
in.readByte();
|
in.readByte();
|
||||||
|
|
||||||
if (error || ent == nullptr) {
|
if (error || ent == nullptr) {
|
||||||
LogModule.report(logvisor::Error, fmt("Script load error while loading {}"), ScriptObjectTypeToStr(type));
|
LogModule.report(logvisor::Error, FMT_STRING("Script load error while loading {}"), ScriptObjectTypeToStr(type));
|
||||||
return {kInvalidEditorId, kInvalidUniqueId};
|
return {kInvalidEditorId, kInvalidUniqueId};
|
||||||
} else {
|
} else {
|
||||||
LogModule.report(logvisor::Info, fmt("Loaded {} in area {}"), ent->GetName(), ent->GetAreaIdAlways());
|
LogModule.report(logvisor::Info, FMT_STRING("Loaded {} in area {}"), ent->GetName(), ent->GetAreaIdAlways());
|
||||||
return {id, ent->GetUniqueId()};
|
return {id, ent->GetUniqueId()};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2471,7 +2471,7 @@ void CStateManager::AddObject(CEntity& ent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sm_logScripting && sm_logScripting->toBoolean())
|
if (sm_logScripting && sm_logScripting->toBoolean())
|
||||||
LogModule.report(logvisor::Info, fmt("Added '{}'"), ent.GetName());
|
LogModule.report(logvisor::Info, FMT_STRING("Added '{}'"), ent.GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStateManager::AddObject(CEntity* ent) {
|
void CStateManager::AddObject(CEntity* ent) {
|
||||||
|
@ -2516,7 +2516,7 @@ TUniqueId CStateManager::AllocateUniqueId() {
|
||||||
ourIndex = x0_nextFreeIndex;
|
ourIndex = x0_nextFreeIndex;
|
||||||
x0_nextFreeIndex = (x0_nextFreeIndex + 1) & 0x3ff;
|
x0_nextFreeIndex = (x0_nextFreeIndex + 1) & 0x3ff;
|
||||||
if (x0_nextFreeIndex == lastIndex)
|
if (x0_nextFreeIndex == lastIndex)
|
||||||
LogModule.report(logvisor::Fatal, fmt("Object List Full!"));
|
LogModule.report(logvisor::Fatal, FMT_STRING("Object List Full!"));
|
||||||
} while (GetAllObjectList().GetObjectByIndex(ourIndex) != nullptr);
|
} while (GetAllObjectList().GetObjectByIndex(ourIndex) != nullptr);
|
||||||
|
|
||||||
x8_idArr[ourIndex] = (x8_idArr[ourIndex] + 1) & 0x3f;
|
x8_idArr[ourIndex] = (x8_idArr[ourIndex] + 1) & 0x3f;
|
||||||
|
|
|
@ -13,7 +13,7 @@ public:
|
||||||
double t = std::chrono::duration_cast<std::chrono::microseconds>(
|
double t = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||||
std::chrono::steady_clock::now() - m_start).count() / 1000000.0;
|
std::chrono::steady_clock::now() - m_start).count() / 1000000.0;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
fmt::print(fmt("{} {}\n"), name, t);
|
fmt::print(FMT_STRING("{} {}\n"), name, t);
|
||||||
#endif
|
#endif
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ public:
|
||||||
std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
|
std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
|
||||||
double t = std::chrono::duration_cast<std::chrono::microseconds>(now - m_start).count() / 1000000.0;
|
double t = std::chrono::duration_cast<std::chrono::microseconds>(now - m_start).count() / 1000000.0;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
fmt::print(fmt("{} {}\n"), name, t);
|
fmt::print(FMT_STRING("{} {}\n"), name, t);
|
||||||
#endif
|
#endif
|
||||||
m_start = now;
|
m_start = now;
|
||||||
return t;
|
return t;
|
||||||
|
|
|
@ -21,7 +21,7 @@ void CAnimFormatUnion::SubConstruct(u8* storage, EAnimFormat fmt, CInputStream&
|
||||||
new (storage) CFBStreamedCompression(in, store, true);
|
new (storage) CFBStreamedCompression(in, store, true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.report(logvisor::Fatal, fmt("unable to read ANIM format {}"), int(fmt));
|
Log.report(logvisor::Fatal, FMT_STRING("unable to read ANIM format {}"), int(fmt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ CAnimData::CAnimData(CAssetId id, const CCharacterInfo& character, int defaultAn
|
||||||
|
|
||||||
if (defaultAnim == -1) {
|
if (defaultAnim == -1) {
|
||||||
defaultAnim = 0;
|
defaultAnim = 0;
|
||||||
Log.report(logvisor::Warning, fmt("Character {} has invalid initial animation, so defaulting to first."),
|
Log.report(logvisor::Warning, FMT_STRING("Character {} has invalid initial animation, so defaulting to first."),
|
||||||
character.GetCharacterName());
|
character.GetCharacterName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ CModelData::CModelData(const CStaticRes& res, int instCount)
|
||||||
: x0_scale(res.GetScale()), x14_24_renderSorted(false), x14_25_sortThermal(false), m_drawInstCount(instCount) {
|
: x0_scale(res.GetScale()), x14_24_renderSorted(false), x14_25_sortThermal(false), m_drawInstCount(instCount) {
|
||||||
x1c_normalModel = g_SimplePool->GetObj({SBIG('CMDL'), res.GetId()});
|
x1c_normalModel = g_SimplePool->GetObj({SBIG('CMDL'), res.GetId()});
|
||||||
if (!x1c_normalModel)
|
if (!x1c_normalModel)
|
||||||
Log.report(logvisor::Fatal, fmt("unable to find CMDL {}"), res.GetId());
|
Log.report(logvisor::Fatal, FMT_STRING("unable to find CMDL {}"), res.GetId());
|
||||||
m_normalModelInst = x1c_normalModel->MakeNewInstance(0, instCount);
|
m_normalModelInst = x1c_normalModel->MakeNewInstance(0, instCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ void CModelData::SetXRayModel(const std::pair<CAssetId, CAssetId>& modelSkin) {
|
||||||
} else {
|
} else {
|
||||||
x2c_xrayModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first});
|
x2c_xrayModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first});
|
||||||
if (!x2c_xrayModel)
|
if (!x2c_xrayModel)
|
||||||
Log.report(logvisor::Fatal, fmt("unable to find CMDL {}"), modelSkin.first);
|
Log.report(logvisor::Fatal, FMT_STRING("unable to find CMDL {}"), modelSkin.first);
|
||||||
m_xrayModelInst = x2c_xrayModel->MakeNewInstance(0, m_drawInstCount);
|
m_xrayModelInst = x2c_xrayModel->MakeNewInstance(0, m_drawInstCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ void CModelData::SetInfraModel(const std::pair<CAssetId, CAssetId>& modelSkin) {
|
||||||
} else {
|
} else {
|
||||||
x3c_infraModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first});
|
x3c_infraModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first});
|
||||||
if (!x3c_infraModel)
|
if (!x3c_infraModel)
|
||||||
Log.report(logvisor::Fatal, fmt("unable to find CMDL {}"), modelSkin.first);
|
Log.report(logvisor::Fatal, FMT_STRING("unable to find CMDL {}"), modelSkin.first);
|
||||||
m_infraModelInst = x3c_infraModel->MakeNewInstance(0, m_drawInstCount);
|
m_infraModelInst = x3c_infraModel->MakeNewInstance(0, m_drawInstCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,6 +273,7 @@ void CParticleDatabase::AddToRendererClipped(const zeus::CFrustum& frustum) cons
|
||||||
}
|
}
|
||||||
|
|
||||||
CParticleGenInfo* CParticleDatabase::GetParticleEffect(std::string_view name) const {
|
CParticleGenInfo* CParticleDatabase::GetParticleEffect(std::string_view name) const {
|
||||||
|
// TODO: Heterogeneous lookup when C++20 available
|
||||||
auto search = x3c_rendererDrawLoop.find(name.data());
|
auto search = x3c_rendererDrawLoop.find(name.data());
|
||||||
if (search != x3c_rendererDrawLoop.end())
|
if (search != x3c_rendererDrawLoop.end())
|
||||||
return search->second.get();
|
return search->second.get();
|
||||||
|
|
|
@ -148,7 +148,7 @@ void Buckets::Sort() {
|
||||||
if (bucket.size() < bucket.capacity())
|
if (bucket.size() < bucket.capacity())
|
||||||
bucket.push_back(&drawable);
|
bucket.push_back(&drawable);
|
||||||
// else
|
// else
|
||||||
// Log.report(logvisor::Fatal, fmt("Full bucket!!!"));
|
// Log.report(logvisor::Fatal, FMT_STRING("Full bucket!!!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 bucketIdx = u16(sBuckets->size());
|
u16 bucketIdx = u16(sBuckets->size());
|
||||||
|
@ -183,7 +183,7 @@ void Buckets::InsertPlaneObject(float closeDist, float farDist, const zeus::CAAB
|
||||||
void Buckets::Insert(const zeus::CVector3f& pos, const zeus::CAABox& aabb, EDrawableType dtype, void* data,
|
void Buckets::Insert(const zeus::CVector3f& pos, const zeus::CAABox& aabb, EDrawableType dtype, void* data,
|
||||||
const zeus::CPlane& plane, u16 extraSort) {
|
const zeus::CPlane& plane, u16 extraSort) {
|
||||||
if (sData->size() == sData->capacity()) {
|
if (sData->size() == sData->capacity()) {
|
||||||
Log.report(logvisor::Fatal, fmt("Rendering buckets filled to capacity"));
|
Log.report(logvisor::Fatal, FMT_STRING("Rendering buckets filled to capacity"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, EPrimitive
|
||||||
const boo::ObjToken<boo::ITexture>& texture, bool additive, bool zTest, bool zGEqual)
|
const boo::ObjToken<boo::ITexture>& texture, bool additive, bool zTest, bool zGEqual)
|
||||||
: m_mode(mode), m_maxVerts(maxVerts) {
|
: m_mode(mode), m_maxVerts(maxVerts) {
|
||||||
if (maxVerts < 2) {
|
if (maxVerts < 2) {
|
||||||
LineRendererLog.report(logvisor::Fatal, fmt(_SYS_STR("maxVerts < 2, maxVerts = {}")), maxVerts);
|
LineRendererLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("maxVerts < 2, maxVerts = {}")), maxVerts);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_textured = bool(texture);
|
m_textured = bool(texture);
|
||||||
|
@ -55,7 +55,7 @@ CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const boo::ObjTo
|
||||||
bool additive, bool zTest, bool zGEqual)
|
bool additive, bool zTest, bool zGEqual)
|
||||||
: m_mode(mode), m_maxVerts(maxVerts) {
|
: m_mode(mode), m_maxVerts(maxVerts) {
|
||||||
if (maxVerts < 2) {
|
if (maxVerts < 2) {
|
||||||
LineRendererLog.report(logvisor::Fatal, fmt(_SYS_STR("maxVerts < 2, maxVerts = {}")), maxVerts);
|
LineRendererLog.report(logvisor::Fatal, FMT_STRING(_SYS_STR("maxVerts < 2, maxVerts = {}")), maxVerts);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_textured = bool(texture);
|
m_textured = bool(texture);
|
||||||
|
|
|
@ -268,7 +268,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_instances.size() >= 512) {
|
if (m_instances.size() >= 512) {
|
||||||
Log.report(logvisor::Fatal, fmt("Model buffer overflow"));
|
Log.report(logvisor::Fatal, FMT_STRING("Model buffer overflow"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelInstance& newInst = m_instances.emplace_back();
|
ModelInstance& newInst = m_instances.emplace_back();
|
||||||
|
@ -640,7 +640,7 @@ static EExtendedShader ResolveExtendedShader(const MaterialSet::Material& data,
|
||||||
|
|
||||||
void CBooModel::DrawSurface(const CBooSurface& surf, const CModelFlags& flags) const {
|
void CBooModel::DrawSurface(const CBooSurface& surf, const CModelFlags& flags) const {
|
||||||
// if (m_uniUpdateCount == 0)
|
// if (m_uniUpdateCount == 0)
|
||||||
// Log.report(logvisor::Fatal, fmt("UpdateUniformData() not called"));
|
// Log.report(logvisor::Fatal, FMT_STRING("UpdateUniformData() not called"));
|
||||||
if (m_uniUpdateCount == 0 || m_uniUpdateCount > m_instances.size())
|
if (m_uniUpdateCount == 0 || m_uniUpdateCount > m_instances.size())
|
||||||
return;
|
return;
|
||||||
const ModelInstance& inst = m_instances[m_uniUpdateCount - 1];
|
const ModelInstance& inst = m_instances[m_uniUpdateCount - 1];
|
||||||
|
@ -1175,7 +1175,7 @@ CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* stor
|
||||||
u32 version = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x4));
|
u32 version = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x4));
|
||||||
m_flags = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x8));
|
m_flags = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x8));
|
||||||
if (version != 0x10002)
|
if (version != 0x10002)
|
||||||
Log.report(logvisor::Fatal, fmt("invalid CMDL for loading with boo"));
|
Log.report(logvisor::Fatal, FMT_STRING("invalid CMDL for loading with boo"));
|
||||||
|
|
||||||
u32 secCount = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x24));
|
u32 secCount = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x24));
|
||||||
u32 matSetCount = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x28));
|
u32 matSetCount = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x28));
|
||||||
|
|
|
@ -12,13 +12,13 @@ CSkinnedModel::CSkinnedModel(TLockedToken<CModel> model, TLockedToken<CSkinRules
|
||||||
TLockedToken<CCharLayoutInfo> layoutInfo, int shaderIdx, int drawInsts)
|
TLockedToken<CCharLayoutInfo> layoutInfo, int shaderIdx, int drawInsts)
|
||||||
: x4_model(std::move(model)), x10_skinRules(std::move(skinRules)), x1c_layoutInfo(std::move(layoutInfo)) {
|
: x4_model(std::move(model)), x10_skinRules(std::move(skinRules)), x1c_layoutInfo(std::move(layoutInfo)) {
|
||||||
if (!x4_model) {
|
if (!x4_model) {
|
||||||
Log.report(logvisor::Fatal, fmt("bad model token provided to CSkinnedModel"));
|
Log.report(logvisor::Fatal, FMT_STRING("bad model token provided to CSkinnedModel"));
|
||||||
}
|
}
|
||||||
if (!x10_skinRules) {
|
if (!x10_skinRules) {
|
||||||
Log.report(logvisor::Fatal, fmt("bad skin token provided to CSkinnedModel"));
|
Log.report(logvisor::Fatal, FMT_STRING("bad skin token provided to CSkinnedModel"));
|
||||||
}
|
}
|
||||||
if (!x1c_layoutInfo) {
|
if (!x1c_layoutInfo) {
|
||||||
Log.report(logvisor::Fatal, fmt("bad character layout token provided to CSkinnedModel"));
|
Log.report(logvisor::Fatal, FMT_STRING("bad character layout token provided to CSkinnedModel"));
|
||||||
}
|
}
|
||||||
m_modelInst = x4_model->MakeNewInstance(shaderIdx, drawInsts);
|
m_modelInst = x4_model->MakeNewInstance(shaderIdx, drawInsts);
|
||||||
}
|
}
|
||||||
|
|
|
@ -552,7 +552,7 @@ void CTexture::BuildRGBA8(const void* data, size_t length) {
|
||||||
size_t texelCount = ComputeMippedTexelCount();
|
size_t texelCount = ComputeMippedTexelCount();
|
||||||
size_t expectedSize = texelCount * 4;
|
size_t expectedSize = texelCount * 4;
|
||||||
if (expectedSize > length)
|
if (expectedSize > length)
|
||||||
Log.report(logvisor::Fatal, fmt("insufficient TXTR length ({}/{})"), length, expectedSize);
|
Log.report(logvisor::Fatal, FMT_STRING("insufficient TXTR length ({}/{})"), length, expectedSize);
|
||||||
|
|
||||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||||
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat, data,
|
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat, data,
|
||||||
|
@ -565,7 +565,7 @@ void CTexture::BuildRGBA8(const void* data, size_t length) {
|
||||||
void CTexture::BuildC8(const void* data, size_t length) {
|
void CTexture::BuildC8(const void* data, size_t length) {
|
||||||
size_t texelCount = ComputeMippedTexelCount();
|
size_t texelCount = ComputeMippedTexelCount();
|
||||||
if (texelCount > length)
|
if (texelCount > length)
|
||||||
Log.report(logvisor::Fatal, fmt("insufficient TXTR length ({}/{})"), length, texelCount);
|
Log.report(logvisor::Fatal, FMT_STRING("insufficient TXTR length ({}/{})"), length, texelCount);
|
||||||
|
|
||||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||||
uint32_t nentries = hecl::SBig(*reinterpret_cast<const uint32_t*>(data));
|
uint32_t nentries = hecl::SBig(*reinterpret_cast<const uint32_t*>(data));
|
||||||
|
@ -763,7 +763,7 @@ CTexture::CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex, const CTex
|
||||||
BuildDXT3(owned.get() + 12, length - 12);
|
BuildDXT3(owned.get() + 12, length - 12);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.report(logvisor::Fatal, fmt("invalid texture type {} for boo"), int(x0_fmt));
|
Log.report(logvisor::Fatal, FMT_STRING("invalid texture type {} for boo"), int(x0_fmt));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (otex)
|
if (otex)
|
||||||
|
@ -775,7 +775,7 @@ void CTexture::Load(int slot, EClampMode clamp) const {}
|
||||||
std::unique_ptr<u8[]> CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut,
|
std::unique_ptr<u8[]> CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut,
|
||||||
std::unique_ptr<u8[]>& paletteOut) const {
|
std::unique_ptr<u8[]>& paletteOut) const {
|
||||||
if (!m_otex)
|
if (!m_otex)
|
||||||
Log.report(logvisor::Fatal, fmt("MemoryCard TXTR not loaded with 'otex'"));
|
Log.report(logvisor::Fatal, FMT_STRING("MemoryCard TXTR not loaded with 'otex'"));
|
||||||
|
|
||||||
size_t texelCount = x4_w * x6_h;
|
size_t texelCount = x4_w * x6_h;
|
||||||
std::unique_ptr<u8[]> ret;
|
std::unique_ptr<u8[]> ret;
|
||||||
|
@ -851,7 +851,7 @@ std::unique_ptr<u8[]> CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
Log.report(logvisor::Fatal, fmt("MemoryCard texture may only use RGBA8PC or C8PC format"));
|
Log.report(logvisor::Fatal, FMT_STRING("MemoryCard texture may only use RGBA8PC or C8PC format"));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ void CAuiEnergyBarT01::Draw(const CGuiWidgetDrawParms& drawParms) {
|
||||||
if (!xbc_tex || !xbc_tex.IsLoaded() || !xd8_coordFunc) {
|
if (!xbc_tex || !xbc_tex.IsLoaded() || !xd8_coordFunc) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CAuiEnergyBarT01::Draw {}"), m_name).c_str(), zeus::skCyan);
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CAuiEnergyBarT01::Draw {}"), m_name).c_str(), zeus::skCyan);
|
||||||
|
|
||||||
CGraphics::SetModelMatrix(x34_worldXF);
|
CGraphics::SetModelMatrix(x34_worldXF);
|
||||||
m_energyBarShader.updateModelMatrix();
|
m_energyBarShader.updateModelMatrix();
|
||||||
|
|
|
@ -106,7 +106,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) {
|
||||||
if (!GetIsVisible() || !xb8_tex0Tok.IsLoaded()) {
|
if (!GetIsVisible() || !xb8_tex0Tok.IsLoaded()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CAuiImagePane::Draw {}"), m_name).c_str(), zeus::skCyan);
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CAuiImagePane::Draw {}"), m_name).c_str(), zeus::skCyan);
|
||||||
GetIsFinishedLoadingWidgetSpecific();
|
GetIsFinishedLoadingWidgetSpecific();
|
||||||
if (!m_filters || m_filters->m_texId != xb8_tex0Tok.GetObjectTag()->id) {
|
if (!m_filters || m_filters->m_texId != xb8_tex0Tok.GetObjectTag()->id) {
|
||||||
m_filters.emplace(xb8_tex0Tok);
|
m_filters.emplace(xb8_tex0Tok);
|
||||||
|
|
|
@ -65,7 +65,7 @@ CCompoundTargetReticle::CCompoundTargetReticle(const CStateManager& mgr)
|
||||||
, x208_lockonTimer(g_tweakTargeting->GetLockonDuration()) {
|
, x208_lockonTimer(g_tweakTargeting->GetLockonDuration()) {
|
||||||
xe0_outerBeamIconSquares.reserve(9);
|
xe0_outerBeamIconSquares.reserve(9);
|
||||||
for (u32 i = 0; i < 9; ++i)
|
for (u32 i = 0; i < 9; ++i)
|
||||||
xe0_outerBeamIconSquares.emplace_back(fmt::format(fmt("{}{}"), skOuterBeamIconSquareNameBase, i));
|
xe0_outerBeamIconSquares.emplace_back(fmt::format(FMT_STRING("{}{}"), skOuterBeamIconSquareNameBase, i));
|
||||||
x34_crosshairs.Lock();
|
x34_crosshairs.Lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ void CGuiFrame::Reset() {
|
||||||
void CGuiFrame::Update(float dt) { xc_headWidget->Update(dt); }
|
void CGuiFrame::Update(float dt) { xc_headWidget->Update(dt); }
|
||||||
|
|
||||||
void CGuiFrame::Draw(const CGuiWidgetDrawParms& parms) const {
|
void CGuiFrame::Draw(const CGuiWidgetDrawParms& parms) const {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CGuiFrame::Draw FRME_{}"), x0_id).c_str(), zeus::skMagenta);
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CGuiFrame::Draw FRME_{}"), x0_id).c_str(), zeus::skMagenta);
|
||||||
CGraphics::SetCullMode(ERglCullMode::None);
|
CGraphics::SetCullMode(ERglCullMode::None);
|
||||||
CGraphics::SetAmbientColor(zeus::skWhite);
|
CGraphics::SetAmbientColor(zeus::skWhite);
|
||||||
DisableLights();
|
DisableLights();
|
||||||
|
|
|
@ -51,7 +51,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetIsVisible()) {
|
if (GetIsVisible()) {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CGuiModel::Draw {}"), m_name).c_str(), zeus::skCyan);
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CGuiModel::Draw {}"), m_name).c_str(), zeus::skCyan);
|
||||||
zeus::CColor moduCol = xa8_color2;
|
zeus::CColor moduCol = xa8_color2;
|
||||||
moduCol.a() *= parms.x0_alphaMod;
|
moduCol.a() *= parms.x0_alphaMod;
|
||||||
xb0_frame->EnableLights(xcc_lightMask, model->GetInstance());
|
xb0_frame->EnableLights(xcc_lightMask, model->GetInstance());
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue