mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-25 22:27:53 -05:00
Unlinker: Make zone files creators game dependent and in the unlinker project instead of the ObjWriting component
This commit is contained in:
21
src/Unlinker/ContentLister/ContentPrinter.cpp
Normal file
21
src/Unlinker/ContentLister/ContentPrinter.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include "ContentPrinter.h"
|
||||
|
||||
ContentPrinter::ContentPrinter(Zone* zone)
|
||||
{
|
||||
m_zone = zone;
|
||||
}
|
||||
|
||||
void ContentPrinter::PrintContent() const
|
||||
{
|
||||
const ZoneContent content = m_zone->GetPools()->GetContent();
|
||||
|
||||
printf("Zone '%s' (%s)\n", m_zone->m_name.c_str(), content.m_game_name.c_str());
|
||||
puts("Content:");
|
||||
|
||||
for(const auto& asset : content.m_assets)
|
||||
{
|
||||
printf("%s, %s\n", asset.m_asset_type_name.c_str(), asset.m_asset_name.c_str());
|
||||
}
|
||||
|
||||
puts("");
|
||||
}
|
13
src/Unlinker/ContentLister/ContentPrinter.h
Normal file
13
src/Unlinker/ContentLister/ContentPrinter.h
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
class ContentPrinter
|
||||
{
|
||||
Zone* m_zone;
|
||||
|
||||
public:
|
||||
explicit ContentPrinter(Zone* zone);
|
||||
|
||||
void PrintContent() const;
|
||||
};
|
39
src/Unlinker/ContentLister/ZoneDefWriter.cpp
Normal file
39
src/Unlinker/ContentLister/ZoneDefWriter.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
#include "ZoneDefWriter.h"
|
||||
|
||||
const std::string AbstractZoneDefWriter::META_DATA_KEY_GAME = "game";
|
||||
|
||||
AbstractZoneDefWriter::AbstractZoneDefWriter(Zone* zone, FileAPI::IFile* file)
|
||||
{
|
||||
m_zone = zone;
|
||||
m_file = file;
|
||||
}
|
||||
|
||||
void AbstractZoneDefWriter::EmptyLine() const
|
||||
{
|
||||
m_file->Printf("\n");
|
||||
}
|
||||
|
||||
void AbstractZoneDefWriter::WriteComment(const std::string& comment) const
|
||||
{
|
||||
m_file->Printf("// %s\n", comment.c_str());
|
||||
}
|
||||
|
||||
void AbstractZoneDefWriter::WriteMetaData(const std::string& metaDataKey, const std::string& metaDataValue) const
|
||||
{
|
||||
m_file->Printf(">%s,%s\n", metaDataKey.c_str(), metaDataValue.c_str());
|
||||
}
|
||||
|
||||
void AbstractZoneDefWriter::WriteEntry(const std::string& entryKey, const std::string& entryValue) const
|
||||
{
|
||||
m_file->Printf("%s,%s\n", entryKey.c_str(), entryValue.c_str());
|
||||
}
|
||||
|
||||
void AbstractZoneDefWriter::WriteContent() const
|
||||
{
|
||||
auto zoneContent = m_zone->GetPools()->GetContent();
|
||||
|
||||
for(const auto& asset : zoneContent.m_assets)
|
||||
{
|
||||
WriteEntry(asset.m_asset_type_name, asset.m_asset_name);
|
||||
}
|
||||
}
|
30
src/Unlinker/ContentLister/ZoneDefWriter.h
Normal file
30
src/Unlinker/ContentLister/ZoneDefWriter.h
Normal file
@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
#include "Utils/FileAPI.h"
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
class AbstractZoneDefWriter
|
||||
{
|
||||
protected:
|
||||
Zone* m_zone;
|
||||
FileAPI::IFile* m_file;
|
||||
|
||||
static const std::string META_DATA_KEY_GAME;
|
||||
|
||||
void EmptyLine() const;
|
||||
void WriteComment(const std::string& comment) const;
|
||||
void WriteMetaData(const std::string& metaDataKey, const std::string& metaDataValue) const;
|
||||
void WriteEntry(const std::string& entryKey, const std::string& entryValue) const;
|
||||
void WriteContent() const;
|
||||
|
||||
AbstractZoneDefWriter(Zone* zone, FileAPI::IFile* file);
|
||||
|
||||
public:
|
||||
virtual void WriteZoneDef() = 0;
|
||||
};
|
||||
|
||||
class IZoneDefWriter
|
||||
{
|
||||
public:
|
||||
virtual bool CanHandleZone(Zone* zone) const = 0;
|
||||
virtual void WriteZoneDef(Zone* zone, FileAPI::IFile* file) const = 0;
|
||||
};
|
Reference in New Issue
Block a user