mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-10-30 10:06:57 +00:00
refactor: do not nest asset namespaces in game namespaces
* Duplicated namespace names are kind of annoying
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
#include <format>
|
||||
|
||||
using namespace T5;
|
||||
using namespace ::image;
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -37,7 +36,7 @@ namespace
|
||||
|
||||
std::unique_ptr<Texture> LoadImageFromIwi(const GfxImage& image, ISearchPath& searchPath)
|
||||
{
|
||||
const auto imageFileName = std::format("images/{}.iwi", image.name);
|
||||
const auto imageFileName = image::GetFileNameForAsset(image.name, ".iwi");
|
||||
const auto filePathImage = searchPath.Open(imageFileName);
|
||||
if (!filePathImage.IsOpen())
|
||||
{
|
||||
@@ -57,9 +56,9 @@ namespace
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace T5::image
|
||||
namespace image
|
||||
{
|
||||
Dumper::Dumper()
|
||||
DumperT5::DumperT5()
|
||||
{
|
||||
switch (ObjWriting::Configuration.ImageOutputFormat)
|
||||
{
|
||||
@@ -76,12 +75,12 @@ namespace T5::image
|
||||
}
|
||||
}
|
||||
|
||||
bool Dumper::ShouldDump(XAssetInfo<GfxImage>* asset)
|
||||
bool DumperT5::ShouldDump(XAssetInfo<GfxImage>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Dumper::DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset)
|
||||
void DumperT5::DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset)
|
||||
{
|
||||
const auto* image = asset->Asset();
|
||||
const auto texture = LoadImageData(context.m_obj_search_path, *image);
|
||||
@@ -96,4 +95,4 @@ namespace T5::image
|
||||
auto& stream = *assetFile;
|
||||
m_writer->DumpImage(stream, texture.get());
|
||||
}
|
||||
} // namespace T5::image
|
||||
} // namespace image
|
||||
|
||||
@@ -6,18 +6,18 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace T5::image
|
||||
namespace image
|
||||
{
|
||||
class Dumper final : public AbstractAssetDumper<GfxImage>
|
||||
class DumperT5 final : public AbstractAssetDumper<T5::GfxImage>
|
||||
{
|
||||
public:
|
||||
Dumper();
|
||||
DumperT5();
|
||||
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<GfxImage>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset) override;
|
||||
bool ShouldDump(XAssetInfo<T5::GfxImage>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<T5::GfxImage>* asset) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<IImageWriter> m_writer;
|
||||
};
|
||||
} // namespace T5::image
|
||||
} // namespace image
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
using namespace T5;
|
||||
|
||||
namespace T5::localize
|
||||
namespace localize
|
||||
{
|
||||
void Dumper::DumpPool(AssetDumpingContext& context, AssetPool<LocalizeEntry>* pool)
|
||||
void DumperT5::DumpPool(AssetDumpingContext& context, AssetPool<LocalizeEntry>* pool)
|
||||
{
|
||||
if (pool->m_asset_lookup.empty())
|
||||
return;
|
||||
@@ -41,4 +41,4 @@ namespace T5::localize
|
||||
std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name);
|
||||
}
|
||||
}
|
||||
} // namespace T5::localize
|
||||
} // namespace localize
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T5/T5.h"
|
||||
|
||||
namespace T5::localize
|
||||
namespace localize
|
||||
{
|
||||
class Dumper final : public IAssetDumper<LocalizeEntry>
|
||||
class DumperT5 final : public IAssetDumper<T5::LocalizeEntry>
|
||||
{
|
||||
public:
|
||||
void DumpPool(AssetDumpingContext& context, AssetPool<LocalizeEntry>* pool) override;
|
||||
void DumpPool(AssetDumpingContext& context, AssetPool<T5::LocalizeEntry>* pool) override;
|
||||
};
|
||||
} // namespace T5::localize
|
||||
} // namespace localize
|
||||
|
||||
@@ -26,10 +26,10 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
|
||||
// DUMP_ASSET_POOL(AssetDumperPhysConstraints, m_phys_constraints, ASSET_TYPE_PHYSCONSTRAINTS)
|
||||
// DUMP_ASSET_POOL(AssetDumperDestructibleDef, m_destructible_def, ASSET_TYPE_DESTRUCTIBLEDEF)
|
||||
// DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts, ASSET_TYPE_XANIMPARTS)
|
||||
DUMP_ASSET_POOL(xmodel::Dumper, m_xmodel, ASSET_TYPE_XMODEL)
|
||||
DUMP_ASSET_POOL(material::JsonDumper, m_material, ASSET_TYPE_MATERIAL)
|
||||
DUMP_ASSET_POOL(xmodel::DumperT5, m_xmodel, ASSET_TYPE_XMODEL)
|
||||
DUMP_ASSET_POOL(material::JsonDumperT5, m_material, ASSET_TYPE_MATERIAL)
|
||||
// DUMP_ASSET_POOL(AssetDumperTechniqueSet, m_technique_set, ASSET_TYPE_TECHNIQUE_SET)
|
||||
DUMP_ASSET_POOL(image::Dumper, m_image, ASSET_TYPE_IMAGE)
|
||||
DUMP_ASSET_POOL(image::DumperT5, m_image, ASSET_TYPE_IMAGE)
|
||||
// DUMP_ASSET_POOL(AssetDumperSndBank, m_sound_bank, ASSET_TYPE_SOUND)
|
||||
// DUMP_ASSET_POOL(AssetDumperSndPatch, m_sound_patch, ASSET_TYPE_SOUND_PATCH)
|
||||
// DUMP_ASSET_POOL(AssetDumperClipMap, m_clip_map, ASSET_TYPE_CLIPMAP_PVS)
|
||||
@@ -42,13 +42,13 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
|
||||
// DUMP_ASSET_POOL(AssetDumperFont, m_font, ASSET_TYPE_FONT)
|
||||
// DUMP_ASSET_POOL(AssetDumperMenuList, m_menu_list, ASSET_TYPE_MENULIST)
|
||||
// DUMP_ASSET_POOL(AssetDumperMenuDef, m_menu_def, ASSET_TYPE_MENU)
|
||||
DUMP_ASSET_POOL(localize::Dumper, m_localize, ASSET_TYPE_LOCALIZE_ENTRY)
|
||||
DUMP_ASSET_POOL(localize::DumperT5, m_localize, ASSET_TYPE_LOCALIZE_ENTRY)
|
||||
// DUMP_ASSET_POOL(AssetDumperWeapon, m_weapon, ASSET_TYPE_WEAPON)
|
||||
// DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS)
|
||||
// DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX)
|
||||
// DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table, ASSET_TYPE_IMPACT_FX)
|
||||
DUMP_ASSET_POOL(raw_file::Dumper, m_raw_file, ASSET_TYPE_RAWFILE)
|
||||
DUMP_ASSET_POOL(string_table::Dumper, m_string_table, ASSET_TYPE_STRINGTABLE)
|
||||
DUMP_ASSET_POOL(raw_file::DumperT5, m_raw_file, ASSET_TYPE_RAWFILE)
|
||||
DUMP_ASSET_POOL(string_table::DumperT5, m_string_table, ASSET_TYPE_STRINGTABLE)
|
||||
// DUMP_ASSET_POOL(AssetDumperPackIndex, m_pack_index, ASSET_TYPE_PACK_INDEX)
|
||||
// DUMP_ASSET_POOL(AssetDumperXGlobals, m_xglobals, ASSET_TYPE_XGLOBALS)
|
||||
// DUMP_ASSET_POOL(AssetDumperDDLRoot, m_ddl, ASSET_TYPE_DDL)
|
||||
|
||||
@@ -93,14 +93,14 @@ namespace
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace T5::raw_file
|
||||
namespace raw_file
|
||||
{
|
||||
bool Dumper::ShouldDump(XAssetInfo<RawFile>* asset)
|
||||
bool DumperT5::ShouldDump(XAssetInfo<RawFile>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Dumper::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset)
|
||||
void DumperT5::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset)
|
||||
{
|
||||
const auto* rawFile = asset->Asset();
|
||||
const auto assetFile = context.OpenAssetFile(asset->m_name);
|
||||
@@ -118,4 +118,4 @@ namespace T5::raw_file
|
||||
else
|
||||
stream.write(rawFile->buffer, rawFile->len);
|
||||
}
|
||||
} // namespace T5::raw_file
|
||||
} // namespace raw_file
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T5/T5.h"
|
||||
|
||||
namespace T5::raw_file
|
||||
namespace raw_file
|
||||
{
|
||||
class Dumper final : public AbstractAssetDumper<RawFile>
|
||||
class DumperT5 final : public AbstractAssetDumper<T5::RawFile>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<RawFile>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset) override;
|
||||
bool ShouldDump(XAssetInfo<T5::RawFile>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<T5::RawFile>* asset) override;
|
||||
};
|
||||
} // namespace T5::raw_file
|
||||
} // namespace raw_file
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
|
||||
using namespace T5;
|
||||
|
||||
namespace T5::string_table
|
||||
namespace string_table
|
||||
{
|
||||
bool Dumper::ShouldDump(XAssetInfo<StringTable>* asset)
|
||||
bool DumperT5::ShouldDump(XAssetInfo<StringTable>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Dumper::DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset)
|
||||
void DumperT5::DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset)
|
||||
{
|
||||
const auto* stringTable = asset->Asset();
|
||||
const auto assetFile = context.OpenAssetFile(asset->m_name);
|
||||
@@ -39,4 +39,4 @@ namespace T5::string_table
|
||||
csv.NextRow();
|
||||
}
|
||||
}
|
||||
} // namespace T5::string_table
|
||||
} // namespace string_table
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T5/T5.h"
|
||||
|
||||
namespace T5::string_table
|
||||
namespace string_table
|
||||
{
|
||||
class Dumper final : public AbstractAssetDumper<StringTable>
|
||||
class DumperT5 final : public AbstractAssetDumper<T5::StringTable>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<StringTable>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<StringTable>* asset) override;
|
||||
bool ShouldDump(XAssetInfo<T5::StringTable>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<T5::StringTable>* asset) override;
|
||||
};
|
||||
} // namespace T5::string_table
|
||||
} // namespace string_table
|
||||
|
||||
Reference in New Issue
Block a user