mirror of https://github.com/AxioDL/metaforce.git
Use template function for SAVW
This commit is contained in:
parent
b188c4892a
commit
162994ca39
|
@ -1,6 +1,7 @@
|
|||
#ifndef __COMMON_SAVWCOMMON_HPP__
|
||||
#define __COMMON_SAVWCOMMON_HPP__
|
||||
#include "DNACommon.hpp"
|
||||
#include "PAK.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
|
@ -38,6 +39,18 @@ struct Layer : BigYAML
|
|||
Value<atUint32> areaId;
|
||||
Value<atUint32> layer;
|
||||
};
|
||||
|
||||
template <class SAVW>
|
||||
static bool ExtractSAVW(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
SAVW savw;
|
||||
savw.read(rs);
|
||||
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
|
||||
savw.toYAMLFile(fp);
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK::Entry& entry)
|
|||
case SBIG('SCAN'):
|
||||
return {SCAN::Extract, nullptr, {_S(".yaml")}, 0, SCAN::Name};
|
||||
case SBIG('SAVW'):
|
||||
return {DNAMP1::ExtractSAVW, nullptr, {_S(".yaml")}};
|
||||
return {SAVWCommon::ExtractSAVW<SAVW>, nullptr, {_S(".yaml")}};
|
||||
case SBIG('TXTR'):
|
||||
return {TXTR::Extract, nullptr, {_S(".png")}};
|
||||
case SBIG('AFSM'):
|
||||
|
|
|
@ -30,16 +30,6 @@ struct SAVW : BigYAML
|
|||
Value<atUint32> scanCount;
|
||||
Vector<Scan, DNA_COUNT(scanCount)> scans;
|
||||
};
|
||||
|
||||
static bool ExtractSAVW(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
SAVW savw;
|
||||
savw.read(rs);
|
||||
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
|
||||
savw.toYAMLFile(fp);
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const DNAMP1::PAK::Entry& ent
|
|||
case SBIG('AFSM'):
|
||||
return {AFSM::Extract, nullptr, {_S(".yaml")}};
|
||||
case SBIG('SAVW'):
|
||||
return {DNAMP2::ExtractSAVW, nullptr, {_S(".yaml")}};
|
||||
return {SAVWCommon::ExtractSAVW<SAVW>, nullptr, {_S(".yaml")}};
|
||||
case SBIG('CMDL'):
|
||||
return {nullptr, CMDL::Extract, {_S(".blend")}, 1};
|
||||
case SBIG('ANCS'):
|
||||
|
|
|
@ -18,16 +18,6 @@ struct SAVW : DNAMP1::SAVW
|
|||
Value<atUint32> gameObjectCount;
|
||||
Vector<atUint32, DNA_COUNT(gameObjectCount)> gameObjects;
|
||||
};
|
||||
|
||||
static bool ExtractSAVW(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
SAVW savw;
|
||||
savw.read(rs);
|
||||
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
|
||||
savw.toYAMLFile(fp);
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK::Entry& entry)
|
|||
case SBIG('TXTR'):
|
||||
return {TXTR::Extract, nullptr, {_S(".png")}};
|
||||
case SBIG('SAVW'):
|
||||
return {DNAMP3::ExtractSAVW, nullptr, {_S(".yaml")}};
|
||||
return {SAVWCommon::ExtractSAVW<SAVW>, nullptr, {_S(".yaml")}};
|
||||
case SBIG('CMDL'):
|
||||
return {nullptr, CMDL::Extract, {_S(".blend")}, 1};
|
||||
case SBIG('CHAR'):
|
||||
|
|
|
@ -48,16 +48,6 @@ struct SAVW : BigYAML
|
|||
Value<atUint32> gameObjectCount;
|
||||
Vector<SavedState, DNA_COUNT(gameObjectCount)> gameObjects;
|
||||
};
|
||||
|
||||
static bool ExtractSAVW(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
SAVW savw;
|
||||
savw.read(rs);
|
||||
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
|
||||
savw.toYAMLFile(fp);
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue