refactor: make use of IOutputPath in ObjWriting

This commit is contained in:
Jan
2025-01-11 13:06:48 +01:00
parent b584cd7423
commit 2d58054ffc
25 changed files with 143 additions and 171 deletions

View File

@ -17,11 +17,11 @@ using namespace IW3;
namespace
{
std::unique_ptr<Texture> LoadImageFromLoadDef(const GfxImage* image)
std::unique_ptr<Texture> LoadImageFromLoadDef(const GfxImage& image)
{
Dx9TextureLoader textureLoader;
const auto& loadDef = *image->texture.loadDef;
const auto& loadDef = *image.texture.loadDef;
textureLoader.Width(loadDef.dimensions[0]).Height(loadDef.dimensions[1]).Depth(loadDef.dimensions[2]);
if (loadDef.flags & iwi6::IMG_FLAG_VOLMAP)
@ -36,22 +36,22 @@ namespace
return textureLoader.LoadTexture(loadDef.data);
}
std::unique_ptr<Texture> LoadImageFromIwi(const GfxImage* image, ISearchPath* searchPath)
std::unique_ptr<Texture> LoadImageFromIwi(const GfxImage& image, ISearchPath& searchPath)
{
const auto imageFileName = std::format("images/{}.iwi", image->name);
const auto filePathImage = searchPath->Open(imageFileName);
const auto imageFileName = std::format("images/{}.iwi", image.name);
const auto filePathImage = searchPath.Open(imageFileName);
if (!filePathImage.IsOpen())
{
std::cerr << std::format("Could not find data for image \"{}\"\n", image->name);
std::cerr << std::format("Could not find data for image \"{}\"\n", image.name);
return nullptr;
}
return iwi::LoadIwi(*filePathImage.m_stream);
}
std::unique_ptr<Texture> LoadImageData(ISearchPath* searchPath, const GfxImage* image)
std::unique_ptr<Texture> LoadImageData(ISearchPath& searchPath, const GfxImage& image)
{
if (image->texture.loadDef && image->texture.loadDef->resourceSize > 0)
if (image.texture.loadDef && image.texture.loadDef->resourceSize > 0)
return LoadImageFromLoadDef(image);
return LoadImageFromIwi(image, searchPath);
@ -91,7 +91,7 @@ std::string AssetDumperGfxImage::GetAssetFileName(const XAssetInfo<GfxImage>& as
void AssetDumperGfxImage::DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset)
{
const auto* image = asset->Asset();
const auto texture = LoadImageData(context.m_obj_search_path, image);
const auto texture = LoadImageData(context.m_obj_search_path, *image);
if (!texture)
return;

View File

@ -3,7 +3,8 @@
#include "Dumping/Localize/StringFileDumper.h"
#include "Localize/LocalizeCommon.h"
#include <sstream>
#include <format>
#include <iostream>
using namespace IW3;
@ -12,11 +13,8 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool<
if (pool->m_asset_lookup.empty())
return;
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone->m_language);
std::ostringstream ss;
ss << language << "/localizedstrings/" << context.m_zone->m_name << ".str";
const auto assetFile = context.OpenAssetFile(ss.str());
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language);
const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name));
if (assetFile)
{
@ -38,6 +36,6 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool<
}
else
{
printf("Could not create string file for dumping localized strings of zone '%s'\n", context.m_zone->m_name.c_str());
std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name);
}
}

View File

@ -107,8 +107,8 @@ namespace
for (auto boneNum = 0u; boneNum < model->numBones; boneNum++)
{
XModelBone bone;
if (model->boneNames[boneNum] < context.m_zone->m_script_strings.Count())
bone.name = context.m_zone->m_script_strings[model->boneNames[boneNum]];
if (model->boneNames[boneNum] < context.m_zone.m_script_strings.Count())
bone.name = context.m_zone.m_script_strings[model->boneNames[boneNum]];
else
bone.name = "INVALID_BONE_NAME";
@ -426,7 +426,7 @@ namespace
if (!mtlFile)
return;
const auto writer = obj::CreateMtlWriter(*mtlFile, context.m_zone->m_game->GetShortName(), context.m_zone->m_name);
const auto writer = obj::CreateMtlWriter(*mtlFile, context.m_zone.m_game->GetShortName(), context.m_zone.m_name);
DistinctMapper<Material*> materialMapper(model->numsurfs);
writer->Write(common);
@ -440,8 +440,7 @@ namespace
if (!assetFile)
return;
const auto writer =
obj::CreateObjWriter(*assetFile, std::format("{}.mtl", model->name), context.m_zone->m_game->GetShortName(), context.m_zone->m_name);
const auto writer = obj::CreateObjWriter(*assetFile, std::format("{}.mtl", model->name), context.m_zone.m_game->GetShortName(), context.m_zone.m_name);
DistinctMapper<Material*> materialMapper(model->numsurfs);
writer->Write(common);
@ -455,7 +454,7 @@ namespace
if (!assetFile)
return;
const auto writer = xmodel_export::CreateWriterForVersion6(*assetFile, context.m_zone->m_game->GetShortName(), context.m_zone->m_name);
const auto writer = xmodel_export::CreateWriterForVersion6(*assetFile, context.m_zone.m_game->GetShortName(), context.m_zone.m_name);
writer->Write(common);
}
@ -470,7 +469,7 @@ namespace
return;
const auto output = std::make_unique<T>(*assetFile);
const auto writer = gltf::Writer::CreateWriter(output.get(), context.m_zone->m_game->GetShortName(), context.m_zone->m_name);
const auto writer = gltf::Writer::CreateWriter(output.get(), context.m_zone.m_game->GetShortName(), context.m_zone.m_name);
writer->Write(common);
}

View File

@ -23,7 +23,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
dumper.DumpPool(context, assetPools->poolName.get()); \
}
const auto* assetPools = dynamic_cast<GameAssetPoolIW3*>(context.m_zone->m_pools.get());
const auto* assetPools = dynamic_cast<GameAssetPoolIW3*>(context.m_zone.m_pools.get());
// DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset, ASSET_TYPE_PHYSPRESET)
// DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts, ASSET_TYPE_XANIMPARTS)

View File

@ -14,12 +14,12 @@ using namespace IW4;
namespace
{
std::unique_ptr<Texture> LoadImageFromLoadDef(const GfxImage* image)
std::unique_ptr<Texture> LoadImageFromLoadDef(const GfxImage& image)
{
Dx9TextureLoader textureLoader;
const auto& loadDef = *image->texture.loadDef;
textureLoader.Width(image->width).Height(image->height).Depth(image->depth);
const auto& loadDef = *image.texture.loadDef;
textureLoader.Width(image.width).Height(image.height).Depth(image.depth);
if ((loadDef.flags & iwi8::IMG_FLAG_MAPTYPE_MASK) == iwi8::IMG_FLAG_MAPTYPE_3D)
textureLoader.Type(TextureType::T_3D);
@ -33,22 +33,22 @@ namespace
return textureLoader.LoadTexture(loadDef.data);
}
std::unique_ptr<Texture> LoadImageFromIwi(const GfxImage* image, ISearchPath* searchPath)
std::unique_ptr<Texture> LoadImageFromIwi(const GfxImage& image, ISearchPath& searchPath)
{
const auto imageFileName = std::format("images/{}.iwi", image->name);
const auto filePathImage = searchPath->Open(imageFileName);
const auto imageFileName = std::format("images/{}.iwi", image.name);
const auto filePathImage = searchPath.Open(imageFileName);
if (!filePathImage.IsOpen())
{
std::cerr << std::format("Could not find data for image \"{}\"\n", image->name);
std::cerr << std::format("Could not find data for image \"{}\"\n", image.name);
return nullptr;
}
return iwi::LoadIwi(*filePathImage.m_stream);
}
std::unique_ptr<Texture> LoadImageData(ISearchPath* searchPath, const GfxImage* image)
std::unique_ptr<Texture> LoadImageData(ISearchPath& searchPath, const GfxImage& image)
{
if (image->texture.loadDef && image->texture.loadDef->resourceSize > 0)
if (image.texture.loadDef && image.texture.loadDef->resourceSize > 0)
return LoadImageFromLoadDef(image);
return LoadImageFromIwi(image, searchPath);
@ -88,7 +88,7 @@ std::string AssetDumperGfxImage::GetAssetFileName(const XAssetInfo<GfxImage>& as
void AssetDumperGfxImage::DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset)
{
const auto* image = asset->Asset();
const auto texture = LoadImageData(context.m_obj_search_path, image);
const auto texture = LoadImageData(context.m_obj_search_path, *image);
if (!texture)
return;

View File

@ -3,6 +3,7 @@
#include "Dumping/Localize/StringFileDumper.h"
#include "Localize/LocalizeCommon.h"
#include <format>
#include <sstream>
using namespace IW4;
@ -12,11 +13,8 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool<
if (pool->m_asset_lookup.empty())
return;
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone->m_language);
std::ostringstream ss;
ss << language << "/localizedstrings/" << context.m_zone->m_name << ".str";
const auto assetFile = context.OpenAssetFile(ss.str());
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language);
const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name));
if (assetFile)
{
@ -38,6 +36,6 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool<
}
else
{
printf("Could not create string file for dumping localized strings of zone '%s'\n", context.m_zone->m_name.c_str());
std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name);
}
}

View File

@ -102,8 +102,8 @@ namespace
for (auto boneNum = 0u; boneNum < model->numBones; boneNum++)
{
XModelBone bone;
if (model->boneNames[boneNum] < context.m_zone->m_script_strings.Count())
bone.name = context.m_zone->m_script_strings[model->boneNames[boneNum]];
if (model->boneNames[boneNum] < context.m_zone.m_script_strings.Count())
bone.name = context.m_zone.m_script_strings[model->boneNames[boneNum]];
else
bone.name = "INVALID_BONE_NAME";
@ -408,7 +408,7 @@ namespace
if (!mtlFile)
return;
const auto writer = obj::CreateMtlWriter(*mtlFile, context.m_zone->m_game->GetShortName(), context.m_zone->m_name);
const auto writer = obj::CreateMtlWriter(*mtlFile, context.m_zone.m_game->GetShortName(), context.m_zone.m_name);
DistinctMapper<Material*> materialMapper(model->numsurfs);
writer->Write(common);
@ -427,8 +427,7 @@ namespace
if (!assetFile)
return;
const auto writer =
obj::CreateObjWriter(*assetFile, std::format("{}.mtl", model->name), context.m_zone->m_game->GetShortName(), context.m_zone->m_name);
const auto writer = obj::CreateObjWriter(*assetFile, std::format("{}.mtl", model->name), context.m_zone.m_game->GetShortName(), context.m_zone.m_name);
DistinctMapper<Material*> materialMapper(model->numsurfs);
writer->Write(common);
@ -443,7 +442,7 @@ namespace
if (!assetFile)
return;
const auto writer = xmodel_export::CreateWriterForVersion6(*assetFile, context.m_zone->m_game->GetShortName(), context.m_zone->m_name);
const auto writer = xmodel_export::CreateWriterForVersion6(*assetFile, context.m_zone.m_game->GetShortName(), context.m_zone.m_name);
writer->Write(common);
}
@ -459,7 +458,7 @@ namespace
return;
const auto output = std::make_unique<T>(*assetFile);
const auto writer = gltf::Writer::CreateWriter(output.get(), context.m_zone->m_game->GetShortName(), context.m_zone->m_name);
const auto writer = gltf::Writer::CreateWriter(output.get(), context.m_zone.m_game->GetShortName(), context.m_zone.m_name);
writer->Write(common);
}

View File

@ -36,7 +36,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
dumper.DumpPool(context, assetPools->poolName.get()); \
}
const auto* assetPools = dynamic_cast<GameAssetPoolIW4*>(context.m_zone->m_pools.get());
const auto* assetPools = dynamic_cast<GameAssetPoolIW4*>(context.m_zone.m_pools.get());
DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset, ASSET_TYPE_PHYSPRESET)
DUMP_ASSET_POOL(AssetDumperPhysCollmap, m_phys_collmap, ASSET_TYPE_PHYSCOLLMAP)

View File

@ -14,13 +14,13 @@ using namespace IW5;
namespace
{
std::unique_ptr<Texture> LoadImageFromLoadDef(const GfxImage* image)
std::unique_ptr<Texture> LoadImageFromLoadDef(const GfxImage& image)
{
Dx9TextureLoader textureLoader;
const auto& loadDef = *image->texture.loadDef;
const auto& loadDef = *image.texture.loadDef;
textureLoader.Width(image->width).Height(image->height).Depth(image->depth);
textureLoader.Width(image.width).Height(image.height).Depth(image.depth);
if ((loadDef.flags & iwi8::IMG_FLAG_MAPTYPE_MASK) == iwi8::IMG_FLAG_MAPTYPE_3D)
textureLoader.Type(TextureType::T_3D);
@ -34,22 +34,22 @@ namespace
return textureLoader.LoadTexture(loadDef.data);
}
std::unique_ptr<Texture> LoadImageFromIwi(const GfxImage* image, ISearchPath* searchPath)
std::unique_ptr<Texture> LoadImageFromIwi(const GfxImage& image, ISearchPath& searchPath)
{
const auto imageFileName = std::format("images/{}.iwi", image->name);
const auto filePathImage = searchPath->Open(imageFileName);
const auto imageFileName = std::format("images/{}.iwi", image.name);
const auto filePathImage = searchPath.Open(imageFileName);
if (!filePathImage.IsOpen())
{
std::cerr << std::format("Could not find data for image \"{}\"\n", image->name);
std::cerr << std::format("Could not find data for image \"{}\"\n", image.name);
return nullptr;
}
return iwi::LoadIwi(*filePathImage.m_stream);
}
std::unique_ptr<Texture> LoadImageData(ISearchPath* searchPath, const GfxImage* image)
std::unique_ptr<Texture> LoadImageData(ISearchPath& searchPath, const GfxImage& image)
{
if (image->texture.loadDef && image->texture.loadDef->resourceSize > 0)
if (image.texture.loadDef && image.texture.loadDef->resourceSize > 0)
return LoadImageFromLoadDef(image);
return LoadImageFromIwi(image, searchPath);
@ -89,7 +89,7 @@ std::string AssetDumperGfxImage::GetAssetFileName(const XAssetInfo<GfxImage>& as
void AssetDumperGfxImage::DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset)
{
const auto* image = asset->Asset();
const auto texture = LoadImageData(context.m_obj_search_path, image);
const auto texture = LoadImageData(context.m_obj_search_path, *image);
if (!texture)
return;

View File

@ -3,7 +3,8 @@
#include "Dumping/Localize/StringFileDumper.h"
#include "Localize/LocalizeCommon.h"
#include <sstream>
#include <format>
#include <iostream>
using namespace IW5;
@ -12,11 +13,8 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool<
if (pool->m_asset_lookup.empty())
return;
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone->m_language);
std::ostringstream ss;
ss << language << "/localizedstrings/" << context.m_zone->m_name << ".str";
const auto assetFile = context.OpenAssetFile(ss.str());
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language);
const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name));
if (assetFile)
{
@ -38,6 +36,6 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool<
}
else
{
printf("Could not create string file for dumping localized strings of zone '%s'\n", context.m_zone->m_name.c_str());
std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name);
}
}

View File

@ -28,7 +28,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
dumper.DumpPool(context, assetPools->poolName.get()); \
}
const auto* assetPools = dynamic_cast<GameAssetPoolIW5*>(context.m_zone->m_pools.get());
const auto* assetPools = dynamic_cast<GameAssetPoolIW5*>(context.m_zone.m_pools.get());
// DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset, ASSET_TYPE_PHYSPRESET)
// DUMP_ASSET_POOL(AssetDumperPhysCollmap, m_phys_collmap, ASSET_TYPE_PHYSCOLLMAP)
// DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts, ASSET_TYPE_XANIMPARTS)

View File

@ -14,12 +14,12 @@ using namespace T5;
namespace
{
std::unique_ptr<Texture> LoadImageFromLoadDef(const GfxImage* image)
std::unique_ptr<Texture> LoadImageFromLoadDef(const GfxImage& image)
{
Dx9TextureLoader textureLoader;
const auto& loadDef = *image->texture.loadDef;
textureLoader.Width(image->width).Height(image->height).Depth(image->depth);
const auto& loadDef = *image.texture.loadDef;
textureLoader.Width(image.width).Height(image.height).Depth(image.depth);
if (loadDef.flags & iwi13::IMG_FLAG_VOLMAP)
textureLoader.Type(TextureType::T_3D);
@ -33,22 +33,22 @@ namespace
return textureLoader.LoadTexture(loadDef.data);
}
std::unique_ptr<Texture> LoadImageFromIwi(const GfxImage* image, ISearchPath* searchPath)
std::unique_ptr<Texture> LoadImageFromIwi(const GfxImage& image, ISearchPath& searchPath)
{
const auto imageFileName = std::format("images/{}.iwi", image->name);
const auto filePathImage = searchPath->Open(imageFileName);
const auto imageFileName = std::format("images/{}.iwi", image.name);
const auto filePathImage = searchPath.Open(imageFileName);
if (!filePathImage.IsOpen())
{
std::cerr << std::format("Could not find data for image \"{}\"\n", image->name);
std::cerr << std::format("Could not find data for image \"{}\"\n", image.name);
return nullptr;
}
return iwi::LoadIwi(*filePathImage.m_stream);
}
std::unique_ptr<Texture> LoadImageData(ISearchPath* searchPath, const GfxImage* image)
std::unique_ptr<Texture> LoadImageData(ISearchPath& searchPath, const GfxImage& image)
{
if (image->texture.loadDef && image->texture.loadDef->resourceSize > 0)
if (image.texture.loadDef && image.texture.loadDef->resourceSize > 0)
return LoadImageFromLoadDef(image);
return LoadImageFromIwi(image, searchPath);
@ -88,7 +88,7 @@ std::string AssetDumperGfxImage::GetAssetFileName(const XAssetInfo<GfxImage>& as
void AssetDumperGfxImage::DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset)
{
const auto* image = asset->Asset();
const auto texture = LoadImageData(context.m_obj_search_path, image);
const auto texture = LoadImageData(context.m_obj_search_path, *image);
if (!texture)
return;

View File

@ -3,7 +3,8 @@
#include "Dumping/Localize/StringFileDumper.h"
#include "Localize/LocalizeCommon.h"
#include <sstream>
#include <format>
#include <iostream>
using namespace T5;
@ -12,11 +13,8 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool<
if (pool->m_asset_lookup.empty())
return;
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone->m_language);
std::ostringstream ss;
ss << language << "/localizedstrings/" << context.m_zone->m_name << ".str";
const auto assetFile = context.OpenAssetFile(ss.str());
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language);
const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name));
if (assetFile)
{
@ -38,6 +36,6 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool<
}
else
{
printf("Could not create string file for dumping localized strings of zone '%s'\n", context.m_zone->m_name.c_str());
std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name);
}
}

View File

@ -23,7 +23,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
dumper.DumpPool(context, assetPools->poolName.get()); \
}
const auto* assetPools = dynamic_cast<GameAssetPoolT5*>(context.m_zone->m_pools.get());
const auto* assetPools = dynamic_cast<GameAssetPoolT5*>(context.m_zone.m_pools.get());
// DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset, ASSET_TYPE_PHYSPRESET)
// DUMP_ASSET_POOL(AssetDumperPhysConstraints, m_phys_constraints, ASSET_TYPE_PHYSCONSTRAINTS)

View File

@ -15,12 +15,12 @@ using namespace T6;
namespace
{
std::unique_ptr<Texture> LoadImageFromLoadDef(const GfxImage* image)
std::unique_ptr<Texture> LoadImageFromLoadDef(const GfxImage& image)
{
Dx12TextureLoader textureLoader;
const auto& loadDef = *image->texture.loadDef;
textureLoader.Width(image->width).Height(image->height).Depth(image->depth);
const auto& loadDef = *image.texture.loadDef;
textureLoader.Width(image.width).Height(image.height).Depth(image.depth);
if (loadDef.flags & iwi27::IMG_FLAG_VOLMAP)
textureLoader.Type(TextureType::T_3D);
@ -34,13 +34,13 @@ namespace
return textureLoader.LoadTexture(loadDef.data);
}
std::unique_ptr<Texture> LoadImageFromIwi(const GfxImage* image, ISearchPath* searchPath)
std::unique_ptr<Texture> LoadImageFromIwi(const GfxImage& image, ISearchPath& searchPath)
{
if (image->streamedPartCount > 0)
if (image.streamedPartCount > 0)
{
for (auto* ipak : IIPak::Repository)
{
auto ipakStream = ipak->GetEntryStream(image->hash, image->streamedParts[0].hash);
auto ipakStream = ipak->GetEntryStream(image.hash, image.streamedParts[0].hash);
if (ipakStream)
{
@ -53,20 +53,20 @@ namespace
}
}
const auto imageFileName = std::format("images/{}.iwi", image->name);
const auto filePathImage = searchPath->Open(imageFileName);
const auto imageFileName = std::format("images/{}.iwi", image.name);
const auto filePathImage = searchPath.Open(imageFileName);
if (!filePathImage.IsOpen())
{
std::cerr << std::format("Could not find data for image \"{}\"\n", image->name);
std::cerr << std::format("Could not find data for image \"{}\"\n", image.name);
return nullptr;
}
return iwi::LoadIwi(*filePathImage.m_stream);
}
std::unique_ptr<Texture> LoadImageData(ISearchPath* searchPath, const GfxImage* image)
std::unique_ptr<Texture> LoadImageData(ISearchPath& searchPath, const GfxImage& image)
{
if (image->texture.loadDef && image->texture.loadDef->resourceSize > 0)
if (image.texture.loadDef && image.texture.loadDef->resourceSize > 0)
return LoadImageFromLoadDef(image);
return LoadImageFromIwi(image, searchPath);
@ -106,7 +106,7 @@ std::string AssetDumperGfxImage::GetAssetFileName(const XAssetInfo<GfxImage>& as
void AssetDumperGfxImage::DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset)
{
const auto* image = asset->Asset();
const auto texture = LoadImageData(context.m_obj_search_path, image);
const auto texture = LoadImageData(context.m_obj_search_path, *image);
if (!texture)
return;

View File

@ -3,7 +3,8 @@
#include "Dumping/Localize/StringFileDumper.h"
#include "Localize/LocalizeCommon.h"
#include <sstream>
#include <format>
#include <iostream>
using namespace T6;
@ -12,11 +13,8 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool<
if (pool->m_asset_lookup.empty())
return;
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone->m_language);
std::ostringstream ss;
ss << language << "/localizedstrings/" << context.m_zone->m_name << ".str";
const auto assetFile = context.OpenAssetFile(ss.str());
const auto language = LocalizeCommon::GetNameOfLanguage(context.m_zone.m_language);
const auto assetFile = context.OpenAssetFile(std::format("{}/localizedstrings/{}.str", language, context.m_zone.m_name));
if (assetFile)
{
@ -38,6 +36,6 @@ void AssetDumperLocalizeEntry::DumpPool(AssetDumpingContext& context, AssetPool<
}
else
{
printf("Could not create string file for dumping localized strings of zone '%s'\n", context.m_zone->m_name.c_str());
std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name);
}
}

View File

@ -37,7 +37,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
dumper.DumpPool(context, assetPools->poolName.get()); \
}
const auto* assetPools = dynamic_cast<GameAssetPoolT6*>(context.m_zone->m_pools.get());
const auto* assetPools = dynamic_cast<GameAssetPoolT6*>(context.m_zone.m_pools.get());
DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset, ASSET_TYPE_PHYSPRESET)
DUMP_ASSET_POOL(AssetDumperPhysConstraints, m_phys_constraints, ASSET_TYPE_PHYSCONSTRAINTS)