mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-19 19:27:52 -05:00
Make dumpers works as gdt dumpers and raw dumpers
This commit is contained in:
@ -13,10 +13,10 @@ AssetDumperGfxImage::AssetDumperGfxImage()
|
||||
switch (ObjWriting::Configuration.ImageOutputFormat)
|
||||
{
|
||||
case ObjWriting::Configuration_t::ImageOutputFormat_e::DDS:
|
||||
m_writer = new DdsWriter();
|
||||
m_writer = std::make_unique<DdsWriter>();
|
||||
break;
|
||||
case ObjWriting::Configuration_t::ImageOutputFormat_e::IWI:
|
||||
m_writer = new iwi8::IwiWriter();
|
||||
m_writer = std::make_unique<iwi8::IwiWriter>();
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
@ -25,24 +25,23 @@ AssetDumperGfxImage::AssetDumperGfxImage()
|
||||
}
|
||||
}
|
||||
|
||||
AssetDumperGfxImage::~AssetDumperGfxImage()
|
||||
{
|
||||
delete m_writer;
|
||||
m_writer = nullptr;
|
||||
}
|
||||
|
||||
bool AssetDumperGfxImage::ShouldDump(XAssetInfo<GfxImage>* asset)
|
||||
{
|
||||
const auto* image = asset->Asset();
|
||||
return image->cardMemory.platform[0] > 0;
|
||||
}
|
||||
|
||||
bool AssetDumperGfxImage::CanDumpAsRaw()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AssetDumperGfxImage::GetFileNameForAsset(Zone* zone, XAssetInfo<GfxImage>* asset)
|
||||
{
|
||||
return "images/" + asset->m_name + m_writer->GetFileExtension();
|
||||
}
|
||||
|
||||
void AssetDumperGfxImage::DumpAsset(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream)
|
||||
void AssetDumperGfxImage::DumpRaw(AssetDumpingContext& context, XAssetInfo<GfxImage>* asset, std::ostream& stream)
|
||||
{
|
||||
const auto* image = asset->Asset();
|
||||
m_writer->DumpImage(stream, image->texture.texture);
|
||||
|
Reference in New Issue
Block a user