mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-01-12 03:31:49 +00:00
refactor: streamline rawfile dumping
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
#include "AssetDumperRawFile.h"
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
bool AssetDumperRawFile::ShouldDump(XAssetInfo<RawFile>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset)
|
||||
{
|
||||
const auto* rawFile = asset->Asset();
|
||||
const auto assetFile = context.OpenAssetFile(asset->m_name);
|
||||
|
||||
if (!assetFile)
|
||||
return;
|
||||
|
||||
auto& stream = *assetFile;
|
||||
stream.write(rawFile->buffer, rawFile->len);
|
||||
}
|
||||
23
src/ObjWriting/Game/IW3/RawFile/RawFileDumperIW3.cpp
Normal file
23
src/ObjWriting/Game/IW3/RawFile/RawFileDumperIW3.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "RawFileDumperIW3.h"
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
namespace IW3::raw_file
|
||||
{
|
||||
bool Dumper::ShouldDump(XAssetInfo<RawFile>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Dumper::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset)
|
||||
{
|
||||
const auto* rawFile = asset->Asset();
|
||||
const auto assetFile = context.OpenAssetFile(asset->m_name);
|
||||
|
||||
if (!assetFile)
|
||||
return;
|
||||
|
||||
auto& stream = *assetFile;
|
||||
stream.write(rawFile->buffer, rawFile->len);
|
||||
}
|
||||
} // namespace IW3::raw_file
|
||||
@@ -3,12 +3,12 @@
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/IW3/IW3.h"
|
||||
|
||||
namespace IW3
|
||||
namespace IW3::raw_file
|
||||
{
|
||||
class AssetDumperRawFile final : public AbstractAssetDumper<RawFile>
|
||||
class Dumper final : public AbstractAssetDumper<RawFile>
|
||||
{
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<RawFile>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<RawFile>* asset) override;
|
||||
};
|
||||
} // namespace IW3
|
||||
} // namespace IW3::raw_file
|
||||
Reference in New Issue
Block a user