mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-01-08 09:51:48 +00:00
Merge pull request #642 from Laupetin/refactor/zcg-template-asset-marker
refactor: zcg template asset marker
This commit is contained in:
@@ -229,11 +229,16 @@ function ZoneCode:allMarkFiles()
|
||||
result = {}
|
||||
|
||||
for game, assets in pairs(self.Assets) do
|
||||
|
||||
-- PerAsset
|
||||
for i, assetName in ipairs(assets) do
|
||||
local assetNameLower = string.lower(assetName)
|
||||
table.insert(result, "%{wks.location}/src/ZoneCode/Game/" .. game .. "/XAssets/" .. assetNameLower .. "/" .. assetNameLower .. "_mark_db.cpp")
|
||||
table.insert(result, "%{wks.location}/src/ZoneCode/Game/" .. game .. "/XAssets/" .. assetNameLower .. "/" .. assetNameLower .. "_mark_db.h")
|
||||
end
|
||||
|
||||
-- PerTemplate
|
||||
table.insert(result, "%{wks.location}/src/ZoneCode/Game/" .. game .. "/AssetMarker" .. game .. ".h")
|
||||
end
|
||||
|
||||
return result
|
||||
@@ -320,11 +325,11 @@ function ZoneCode:project()
|
||||
.. ' --no-color'
|
||||
.. ' -h "' .. path.join(path.getabsolute(ProjectFolder()), 'ZoneCode/Game/%{file.basename}/%{file.basename}_ZoneCode.h') .. '"'
|
||||
.. ' -c "' .. path.join(path.getabsolute(ProjectFolder()), 'ZoneCode/Game/%{file.basename}/%{file.basename}_Commands.txt') .. '"'
|
||||
.. ' -o "%{wks.location}/src/ZoneCode/Game/%{file.basename}/XAssets"'
|
||||
.. ' -g "*" ZoneLoad'
|
||||
.. ' -g "*" ZoneMark'
|
||||
.. ' -g "*" ZoneWrite'
|
||||
.. ' -g "*" AssetStructTests'
|
||||
.. ' -o "%{wks.location}/src/ZoneCode/Game/%{file.basename}"'
|
||||
.. ' -g ZoneLoad'
|
||||
.. ' -g ZoneMark'
|
||||
.. ' -g ZoneWrite'
|
||||
.. ' -g AssetStructTests'
|
||||
}
|
||||
buildinputs {
|
||||
path.join(ProjectFolder(), "ZoneCode/Game/%{file.basename}/%{file.basename}_ZoneCode.h"),
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
#include "Templates/ZoneMarkTemplate.h"
|
||||
#include "Templates/ZoneWriteTemplate.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
#include "Utils/StringUtils.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <format>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
@@ -28,9 +28,9 @@ void CodeGenerator::SetupTemplates()
|
||||
m_template_mapping["assetstructtests"] = std::make_unique<AssetStructTestsTemplate>();
|
||||
}
|
||||
|
||||
bool CodeGenerator::GenerateCodeForTemplate(const RenderingContext& context, ICodeTemplate* codeTemplate) const
|
||||
bool CodeGenerator::GenerateCodeOncePerTemplate(const OncePerTemplateRenderingContext& context, ICodeTemplate* codeTemplate) const
|
||||
{
|
||||
for (const auto& codeFile : codeTemplate->GetFilesToRender(context))
|
||||
for (const auto& codeFile : codeTemplate->GetFilesToRenderOncePerTemplate(context))
|
||||
{
|
||||
fs::path p(m_args->m_output_directory);
|
||||
p.append(codeFile.m_file_name);
|
||||
@@ -47,7 +47,7 @@ bool CodeGenerator::GenerateCodeForTemplate(const RenderingContext& context, ICo
|
||||
return false;
|
||||
}
|
||||
|
||||
codeTemplate->RenderFile(stream, codeFile.m_tag, context);
|
||||
codeTemplate->RenderOncePerTemplateFile(stream, codeFile.m_tag, context);
|
||||
|
||||
stream.close();
|
||||
}
|
||||
@@ -55,7 +55,34 @@ bool CodeGenerator::GenerateCodeForTemplate(const RenderingContext& context, ICo
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CodeGenerator::GetAssetWithName(IDataRepository* repository, const std::string& name, StructureInformation*& asset)
|
||||
bool CodeGenerator::GenerateCodeOncePerAsset(const OncePerAssetRenderingContext& context, ICodeTemplate* codeTemplate) const
|
||||
{
|
||||
for (const auto& codeFile : codeTemplate->GetFilesToRenderOncePerAsset(context))
|
||||
{
|
||||
fs::path p(m_args->m_output_directory);
|
||||
p.append(codeFile.m_file_name);
|
||||
|
||||
auto parentFolder(p);
|
||||
parentFolder.remove_filename();
|
||||
create_directories(parentFolder);
|
||||
|
||||
std::ofstream stream(p, std::fstream::out | std::fstream::binary);
|
||||
|
||||
if (!stream.is_open())
|
||||
{
|
||||
con::error("Failed to open file '{}'", p.string());
|
||||
return false;
|
||||
}
|
||||
|
||||
codeTemplate->RenderOncePerAssetFile(stream, codeFile.m_tag, context);
|
||||
|
||||
stream.close();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CodeGenerator::GetAssetWithName(const IDataRepository* repository, const std::string& name, StructureInformation*& asset)
|
||||
{
|
||||
auto* def = repository->GetDataDefinitionByName(name);
|
||||
if (def == nullptr)
|
||||
@@ -64,7 +91,7 @@ bool CodeGenerator::GetAssetWithName(IDataRepository* repository, const std::str
|
||||
return false;
|
||||
}
|
||||
|
||||
auto* defWithMembers = dynamic_cast<DefinitionWithMembers*>(def);
|
||||
const auto* defWithMembers = dynamic_cast<DefinitionWithMembers*>(def);
|
||||
asset = defWithMembers != nullptr ? repository->GetInformationFor(defWithMembers) : nullptr;
|
||||
if (asset == nullptr)
|
||||
{
|
||||
@@ -81,7 +108,7 @@ bool CodeGenerator::GetAssetWithName(IDataRepository* repository, const std::str
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CodeGenerator::GenerateCode(IDataRepository* repository)
|
||||
bool CodeGenerator::GenerateCode(const IDataRepository* repository)
|
||||
{
|
||||
std::vector<StructureInformation*> assets;
|
||||
|
||||
@@ -93,42 +120,39 @@ bool CodeGenerator::GenerateCode(IDataRepository* repository)
|
||||
}
|
||||
|
||||
const auto start = std::chrono::steady_clock::now();
|
||||
for (const auto& generationTask : m_args->m_generation_tasks)
|
||||
for (const auto& templateName : m_args->m_template_names)
|
||||
{
|
||||
auto templateName = generationTask.m_template_name;
|
||||
for (auto& c : templateName)
|
||||
c = static_cast<char>(tolower(c));
|
||||
std::string lowerTemplateName(templateName);
|
||||
utils::MakeStringLowerCase(lowerTemplateName);
|
||||
|
||||
const auto foundTemplate = m_template_mapping.find(templateName);
|
||||
const auto foundTemplate = m_template_mapping.find(lowerTemplateName);
|
||||
if (foundTemplate == m_template_mapping.end())
|
||||
{
|
||||
con::error("Unknown template '{}'.", generationTask.m_template_name);
|
||||
con::error("Unknown template '{}'", templateName);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (generationTask.m_all_assets)
|
||||
for (auto* asset : assets)
|
||||
{
|
||||
for (auto* asset : assets)
|
||||
auto context = OncePerAssetRenderingContext::BuildContext(repository, asset);
|
||||
if (!GenerateCodeOncePerAsset(*context, foundTemplate->second.get()))
|
||||
{
|
||||
auto context = RenderingContext::BuildContext(repository, asset);
|
||||
if (!GenerateCodeForTemplate(*context, foundTemplate->second.get()))
|
||||
{
|
||||
con::error("Failed to generate code for asset '{}' with preset '{}'", asset->m_definition->GetFullName(), foundTemplate->first);
|
||||
return false;
|
||||
}
|
||||
|
||||
con::info("Successfully generated code for asset '{}' with preset '{}'", asset->m_definition->GetFullName(), foundTemplate->first);
|
||||
con::error("Failed to generate code for asset '{}' with preset '{}'", asset->m_definition->GetFullName(), foundTemplate->first);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StructureInformation* asset;
|
||||
if (!GetAssetWithName(repository, generationTask.m_asset_name, asset))
|
||||
return false;
|
||||
|
||||
auto context = RenderingContext::BuildContext(repository, asset);
|
||||
if (!GenerateCodeForTemplate(*context, foundTemplate->second.get()))
|
||||
con::info("Successfully generated code for asset '{}' with preset '{}'", asset->m_definition->GetFullName(), foundTemplate->first);
|
||||
}
|
||||
|
||||
{
|
||||
auto context = OncePerTemplateRenderingContext::BuildContext(repository);
|
||||
if (!GenerateCodeOncePerTemplate(*context, foundTemplate->second.get()))
|
||||
{
|
||||
con::error("Failed to generate code with preset '{}'", foundTemplate->first);
|
||||
return false;
|
||||
}
|
||||
|
||||
con::info("Successfully generated code with preset '{}'", foundTemplate->first);
|
||||
}
|
||||
}
|
||||
const auto end = std::chrono::steady_clock::now();
|
||||
|
||||
@@ -12,13 +12,15 @@ class CodeGenerator
|
||||
public:
|
||||
explicit CodeGenerator(const ZoneCodeGeneratorArguments* args);
|
||||
|
||||
bool GenerateCode(IDataRepository* repository);
|
||||
bool GenerateCode(const IDataRepository* repository);
|
||||
|
||||
private:
|
||||
void SetupTemplates();
|
||||
|
||||
bool GenerateCodeForTemplate(const RenderingContext& context, ICodeTemplate* codeTemplate) const;
|
||||
static bool GetAssetWithName(IDataRepository* repository, const std::string& name, StructureInformation*& asset);
|
||||
bool GenerateCodeOncePerTemplate(const OncePerTemplateRenderingContext& context, ICodeTemplate* codeTemplate) const;
|
||||
bool GenerateCodeOncePerAsset(const OncePerAssetRenderingContext& context, ICodeTemplate* codeTemplate) const;
|
||||
|
||||
static bool GetAssetWithName(const IDataRepository* repository, const std::string& name, StructureInformation*& asset);
|
||||
|
||||
const ZoneCodeGeneratorArguments* m_args;
|
||||
std::unordered_map<std::string, std::unique_ptr<ICodeTemplate>> m_template_mapping;
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "RenderingContext.h"
|
||||
#include "OncePerAssetRenderingContext.h"
|
||||
#include "OncePerTemplateRenderingContext.h"
|
||||
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
typedef unsigned CodeTemplateFileTag;
|
||||
|
||||
class CodeTemplateFile
|
||||
{
|
||||
public:
|
||||
CodeTemplateFile(std::string fileName, const int tag)
|
||||
CodeTemplateFile(std::string fileName, const CodeTemplateFileTag tag)
|
||||
: m_file_name(std::move(fileName)),
|
||||
m_tag(tag)
|
||||
{
|
||||
}
|
||||
|
||||
std::string m_file_name;
|
||||
int m_tag;
|
||||
CodeTemplateFileTag m_tag;
|
||||
};
|
||||
|
||||
class ICodeTemplate
|
||||
@@ -29,6 +32,17 @@ public:
|
||||
ICodeTemplate& operator=(const ICodeTemplate& other) = default;
|
||||
ICodeTemplate& operator=(ICodeTemplate&& other) noexcept = default;
|
||||
|
||||
virtual std::vector<CodeTemplateFile> GetFilesToRender(const RenderingContext& context) = 0;
|
||||
virtual void RenderFile(std::ostream& stream, int fileTag, const RenderingContext& context) = 0;
|
||||
virtual std::vector<CodeTemplateFile> GetFilesToRenderOncePerTemplate(const OncePerTemplateRenderingContext& context)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
virtual void RenderOncePerTemplateFile(std::ostream& stream, CodeTemplateFileTag fileTag, const OncePerTemplateRenderingContext& context) {}
|
||||
|
||||
virtual std::vector<CodeTemplateFile> GetFilesToRenderOncePerAsset(const OncePerAssetRenderingContext& context)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
virtual void RenderOncePerAssetFile(std::ostream& stream, CodeTemplateFileTag fileTag, const OncePerAssetRenderingContext& context) {}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "RenderingContext.h"
|
||||
#include "OncePerAssetRenderingContext.h"
|
||||
|
||||
#include "Domain/Computations/MemberComputations.h"
|
||||
#include "Domain/Computations/StructureComputations.h"
|
||||
@@ -18,7 +18,9 @@ RenderingUsedType::RenderingUsedType(const DataDefinition* type, StructureInform
|
||||
{
|
||||
}
|
||||
|
||||
RenderingContext::RenderingContext(std::string game, const Architecture gameArchitecture, std::vector<const FastFileBlock*> fastFileBlocks)
|
||||
OncePerAssetRenderingContext::OncePerAssetRenderingContext(std::string game,
|
||||
const Architecture gameArchitecture,
|
||||
std::vector<const FastFileBlock*> fastFileBlocks)
|
||||
: m_game(std::move(game)),
|
||||
m_architecture_mismatch(gameArchitecture != OWN_ARCHITECTURE),
|
||||
m_pointer_size(GetPointerSizeForArchitecture(gameArchitecture)),
|
||||
@@ -40,7 +42,7 @@ RenderingContext::RenderingContext(std::string game, const Architecture gameArch
|
||||
}
|
||||
}
|
||||
|
||||
RenderingUsedType* RenderingContext::AddUsedType(std::unique_ptr<RenderingUsedType> usedType)
|
||||
RenderingUsedType* OncePerAssetRenderingContext::AddUsedType(std::unique_ptr<RenderingUsedType> usedType)
|
||||
{
|
||||
auto* result = usedType.get();
|
||||
m_used_types.push_back(usedType.get());
|
||||
@@ -49,7 +51,7 @@ RenderingUsedType* RenderingContext::AddUsedType(std::unique_ptr<RenderingUsedTy
|
||||
return result;
|
||||
}
|
||||
|
||||
RenderingUsedType* RenderingContext::GetBaseType(const IDataRepository* repository, MemberComputations* computations, RenderingUsedType* usedType)
|
||||
RenderingUsedType* OncePerAssetRenderingContext::GetBaseType(const IDataRepository* repository, MemberComputations* computations, RenderingUsedType* usedType)
|
||||
{
|
||||
if (usedType->m_type->GetType() == DataDefinitionType::TYPEDEF)
|
||||
{
|
||||
@@ -77,7 +79,7 @@ RenderingUsedType* RenderingContext::GetBaseType(const IDataRepository* reposito
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void RenderingContext::AddMembersToContext(const IDataRepository* repository, StructureInformation* info)
|
||||
void OncePerAssetRenderingContext::AddMembersToContext(const IDataRepository* repository, StructureInformation* info)
|
||||
{
|
||||
for (const auto& member : info->m_ordered_members)
|
||||
{
|
||||
@@ -121,7 +123,7 @@ void RenderingContext::AddMembersToContext(const IDataRepository* repository, St
|
||||
}
|
||||
}
|
||||
|
||||
void RenderingContext::ScanUsedTypeIfNeeded(const IDataRepository* repository, MemberComputations* computations, RenderingUsedType* usedType)
|
||||
void OncePerAssetRenderingContext::ScanUsedTypeIfNeeded(const IDataRepository* repository, MemberComputations* computations, RenderingUsedType* usedType)
|
||||
{
|
||||
if (usedType->m_info != nullptr && !StructureComputations(usedType->m_info).IsAsset() && !computations->IsInRuntimeBlock() && !usedType->m_members_loaded)
|
||||
{
|
||||
@@ -130,7 +132,7 @@ void RenderingContext::ScanUsedTypeIfNeeded(const IDataRepository* repository, M
|
||||
}
|
||||
}
|
||||
|
||||
void RenderingContext::MakeAsset(const IDataRepository* repository, StructureInformation* asset)
|
||||
void OncePerAssetRenderingContext::MakeAsset(const IDataRepository* repository, StructureInformation* asset)
|
||||
{
|
||||
m_asset = asset;
|
||||
AddUsedType(std::make_unique<RenderingUsedType>(asset->m_definition, asset));
|
||||
@@ -138,7 +140,7 @@ void RenderingContext::MakeAsset(const IDataRepository* repository, StructureInf
|
||||
AddMembersToContext(repository, asset);
|
||||
}
|
||||
|
||||
void RenderingContext::CreateUsedTypeCollections()
|
||||
void OncePerAssetRenderingContext::CreateUsedTypeCollections()
|
||||
{
|
||||
for (auto* usedType : m_used_types)
|
||||
{
|
||||
@@ -165,7 +167,7 @@ void RenderingContext::CreateUsedTypeCollections()
|
||||
}
|
||||
}
|
||||
|
||||
bool RenderingContext::UsedTypeHasActions(const RenderingUsedType* usedType) const
|
||||
bool OncePerAssetRenderingContext::UsedTypeHasActions(const RenderingUsedType* usedType) const
|
||||
{
|
||||
const StructureComputations computations(usedType->m_info);
|
||||
|
||||
@@ -190,10 +192,10 @@ bool RenderingContext::UsedTypeHasActions(const RenderingUsedType* usedType) con
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_ptr<RenderingContext> RenderingContext::BuildContext(const IDataRepository* repository, StructureInformation* asset)
|
||||
std::unique_ptr<OncePerAssetRenderingContext> OncePerAssetRenderingContext::BuildContext(const IDataRepository* repository, StructureInformation* asset)
|
||||
{
|
||||
auto context =
|
||||
std::make_unique<RenderingContext>(RenderingContext(repository->GetGameName(), repository->GetArchitecture(), repository->GetAllFastFileBlocks()));
|
||||
auto context = std::make_unique<OncePerAssetRenderingContext>(
|
||||
OncePerAssetRenderingContext(repository->GetGameName(), repository->GetArchitecture(), repository->GetAllFastFileBlocks()));
|
||||
|
||||
context->MakeAsset(repository, asset);
|
||||
context->CreateUsedTypeCollections();
|
||||
@@ -24,10 +24,10 @@ public:
|
||||
bool m_pointer_array_reference_is_reusable;
|
||||
};
|
||||
|
||||
class RenderingContext
|
||||
class OncePerAssetRenderingContext
|
||||
{
|
||||
public:
|
||||
static std::unique_ptr<RenderingContext> BuildContext(const IDataRepository* repository, StructureInformation* asset);
|
||||
static std::unique_ptr<OncePerAssetRenderingContext> BuildContext(const IDataRepository* repository, StructureInformation* asset);
|
||||
|
||||
std::string m_game;
|
||||
bool m_architecture_mismatch;
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
const FastFileBlock* m_default_temp_block;
|
||||
|
||||
private:
|
||||
RenderingContext(std::string game, Architecture gameArchitecture, std::vector<const FastFileBlock*> fastFileBlocks);
|
||||
OncePerAssetRenderingContext(std::string game, Architecture gameArchitecture, std::vector<const FastFileBlock*> fastFileBlocks);
|
||||
|
||||
RenderingUsedType* AddUsedType(std::unique_ptr<RenderingUsedType> usedType);
|
||||
RenderingUsedType* GetBaseType(const IDataRepository* repository, MemberComputations* computations, RenderingUsedType* usedType);
|
||||
@@ -0,0 +1,44 @@
|
||||
#include "OncePerTemplateRenderingContext.h"
|
||||
|
||||
#include "Domain/Computations/StructureComputations.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
OncePerTemplateRenderingContext::OncePerTemplateRenderingContext(std::string game,
|
||||
const Architecture gameArchitecture,
|
||||
std::vector<const FastFileBlock*> fastFileBlocks,
|
||||
std::vector<StructureInformation*> assets)
|
||||
: m_game(std::move(game)),
|
||||
m_architecture_mismatch(gameArchitecture != OWN_ARCHITECTURE),
|
||||
m_pointer_size(GetPointerSizeForArchitecture(gameArchitecture)),
|
||||
m_blocks(std::move(fastFileBlocks)),
|
||||
m_assets(std::move(assets)),
|
||||
m_default_normal_block(nullptr),
|
||||
m_default_temp_block(nullptr)
|
||||
{
|
||||
for (const auto* block : m_blocks)
|
||||
{
|
||||
if (block->m_is_default)
|
||||
{
|
||||
if (block->m_type == FastFileBlockType::NORMAL && m_default_normal_block == nullptr)
|
||||
m_default_normal_block = block;
|
||||
else if (block->m_type == FastFileBlockType::TEMP && m_default_temp_block == nullptr)
|
||||
m_default_temp_block = block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<OncePerTemplateRenderingContext> OncePerTemplateRenderingContext::BuildContext(const IDataRepository* repository)
|
||||
{
|
||||
std::vector<StructureInformation*> assetInformation;
|
||||
for (auto* info : repository->GetAllStructureInformation())
|
||||
{
|
||||
if (!StructureComputations(info).IsAsset())
|
||||
continue;
|
||||
|
||||
assetInformation.emplace_back(info);
|
||||
}
|
||||
|
||||
return std::make_unique<OncePerTemplateRenderingContext>(
|
||||
OncePerTemplateRenderingContext(repository->GetGameName(), repository->GetArchitecture(), repository->GetAllFastFileBlocks(), assetInformation));
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include "Persistence/IDataRepository.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class OncePerTemplateRenderingContext
|
||||
{
|
||||
public:
|
||||
static std::unique_ptr<OncePerTemplateRenderingContext> BuildContext(const IDataRepository* repository);
|
||||
|
||||
std::string m_game;
|
||||
bool m_architecture_mismatch;
|
||||
unsigned m_pointer_size;
|
||||
std::vector<const FastFileBlock*> m_blocks;
|
||||
std::vector<StructureInformation*> m_assets;
|
||||
|
||||
const FastFileBlock* m_default_normal_block;
|
||||
const FastFileBlock* m_default_temp_block;
|
||||
|
||||
private:
|
||||
OncePerTemplateRenderingContext(std::string game,
|
||||
Architecture gameArchitecture,
|
||||
std::vector<const FastFileBlock*> fastFileBlocks,
|
||||
std::vector<StructureInformation*> assets);
|
||||
};
|
||||
@@ -11,22 +11,19 @@ namespace
|
||||
{
|
||||
constexpr int TAG_SOURCE = 1;
|
||||
|
||||
class Template final : BaseTemplate
|
||||
class PerAsset final : BaseTemplate
|
||||
{
|
||||
public:
|
||||
Template(std::ostream& stream, const RenderingContext& context)
|
||||
: BaseTemplate(stream, context)
|
||||
PerAsset(std::ostream& stream, const OncePerAssetRenderingContext& context)
|
||||
: BaseTemplate(stream),
|
||||
m_env(context)
|
||||
{
|
||||
}
|
||||
|
||||
void Source()
|
||||
{
|
||||
LINE("// ====================================================================")
|
||||
LINE("// This file has been generated by ZoneCodeGenerator.")
|
||||
LINE("// Do not modify.")
|
||||
LINE("// Any changes will be discarded when regenerating.")
|
||||
LINE("// ====================================================================")
|
||||
LINE("")
|
||||
AddGeneratedHint();
|
||||
|
||||
LINEF("#include \"Game/{0}/{0}.h\"", m_env.m_game)
|
||||
LINE("")
|
||||
LINE("#include <catch2/catch_test_macros.hpp>")
|
||||
@@ -78,24 +75,26 @@ namespace
|
||||
m_intendation--;
|
||||
LINE("}")
|
||||
}
|
||||
|
||||
const OncePerAssetRenderingContext& m_env;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
std::vector<CodeTemplateFile> AssetStructTestsTemplate::GetFilesToRender(const RenderingContext& context)
|
||||
std::vector<CodeTemplateFile> AssetStructTestsTemplate::GetFilesToRenderOncePerAsset(const OncePerAssetRenderingContext& context)
|
||||
{
|
||||
std::vector<CodeTemplateFile> files;
|
||||
|
||||
auto assetName = context.m_asset->m_definition->m_name;
|
||||
utils::MakeStringLowerCase(assetName);
|
||||
|
||||
files.emplace_back(std::format("{0}/{0}_struct_test.cpp", assetName), TAG_SOURCE);
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_struct_test.cpp", assetName), TAG_SOURCE);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
void AssetStructTestsTemplate::RenderFile(std::ostream& stream, const int fileTag, const RenderingContext& context)
|
||||
void AssetStructTestsTemplate::RenderOncePerAssetFile(std::ostream& stream, const CodeTemplateFileTag fileTag, const OncePerAssetRenderingContext& context)
|
||||
{
|
||||
Template t(stream, context);
|
||||
PerAsset t(stream, context);
|
||||
|
||||
assert(fileTag == TAG_SOURCE);
|
||||
if (fileTag == TAG_SOURCE)
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "Generating/ICodeTemplate.h"
|
||||
|
||||
class AssetStructTestsTemplate final : public ICodeTemplate
|
||||
{
|
||||
public:
|
||||
std::vector<CodeTemplateFile> GetFilesToRender(const RenderingContext& context) override;
|
||||
void RenderFile(std::ostream& stream, int fileTag, const RenderingContext& context) override;
|
||||
std::vector<CodeTemplateFile> GetFilesToRenderOncePerAsset(const OncePerAssetRenderingContext& context) override;
|
||||
void RenderOncePerAssetFile(std::ostream& stream, CodeTemplateFileTag fileTag, const OncePerAssetRenderingContext& context) override;
|
||||
};
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
BaseTemplate::BaseTemplate(std::ostream& stream, const RenderingContext& context)
|
||||
BaseTemplate::BaseTemplate(std::ostream& stream)
|
||||
: m_out(stream),
|
||||
m_env(context),
|
||||
m_intendation(0u)
|
||||
{
|
||||
}
|
||||
@@ -18,6 +17,17 @@ void BaseTemplate::DoIntendation() const
|
||||
m_out << INTENDATION;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void BaseTemplate::AddGeneratedHint() const
|
||||
{
|
||||
LINE("// ====================================================================")
|
||||
LINE("// This file has been generated by ZoneCodeGenerator.")
|
||||
LINE("// Do not modify.")
|
||||
LINE("// Any changes will be discarded when regenerating.")
|
||||
LINE("// ====================================================================")
|
||||
LINE("")
|
||||
} // clang-format on
|
||||
|
||||
std::string BaseTemplate::Upper(std::string str)
|
||||
{
|
||||
for (auto& c : str)
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "Domain/Evaluation/OperandDynamic.h"
|
||||
#include "Domain/Evaluation/OperandStatic.h"
|
||||
#include "Domain/Evaluation/Operation.h"
|
||||
#include "Generating/RenderingContext.h"
|
||||
|
||||
#include <format>
|
||||
#include <ostream>
|
||||
@@ -15,10 +14,12 @@ class BaseTemplate
|
||||
protected:
|
||||
static constexpr auto INTENDATION = " ";
|
||||
|
||||
BaseTemplate(std::ostream& stream, const RenderingContext& context);
|
||||
explicit BaseTemplate(std::ostream& stream);
|
||||
|
||||
void DoIntendation() const;
|
||||
|
||||
void AddGeneratedHint() const;
|
||||
|
||||
static std::string Upper(std::string str);
|
||||
static std::string Lower(std::string str);
|
||||
static std::string MakeTypeVarName(const DataDefinition* def);
|
||||
@@ -37,7 +38,6 @@ protected:
|
||||
static std::string MakeEvaluation(const IEvaluation* evaluation);
|
||||
|
||||
std::ostream& m_out;
|
||||
const RenderingContext& m_env;
|
||||
unsigned m_intendation;
|
||||
|
||||
private:
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "Utils/StringUtils.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
namespace
|
||||
@@ -14,22 +13,19 @@ namespace
|
||||
constexpr int TAG_HEADER = 1;
|
||||
constexpr int TAG_SOURCE = 2;
|
||||
|
||||
class Template final : BaseTemplate
|
||||
class PerAsset final : BaseTemplate
|
||||
{
|
||||
public:
|
||||
Template(std::ostream& stream, const RenderingContext& context)
|
||||
: BaseTemplate(stream, context)
|
||||
PerAsset(std::ostream& stream, const OncePerAssetRenderingContext& context)
|
||||
: BaseTemplate(stream),
|
||||
m_env(context)
|
||||
{
|
||||
}
|
||||
|
||||
void Header()
|
||||
{
|
||||
LINE("// ====================================================================")
|
||||
LINE("// This file has been generated by ZoneCodeGenerator.")
|
||||
LINE("// Do not modify.")
|
||||
LINE("// Any changes will be discarded when regenerating.")
|
||||
LINE("// ====================================================================")
|
||||
LINE("")
|
||||
AddGeneratedHint();
|
||||
|
||||
LINE("#pragma once")
|
||||
LINE("")
|
||||
LINEF("#include \"Game/{0}/{0}.h\"", m_env.m_game)
|
||||
@@ -137,12 +133,8 @@ namespace
|
||||
|
||||
void Source()
|
||||
{
|
||||
LINE("// ====================================================================")
|
||||
LINE("// This file has been generated by ZoneCodeGenerator.")
|
||||
LINE("// Do not modify.")
|
||||
LINE("// Any changes will be discarded when regenerating.")
|
||||
LINE("// ====================================================================")
|
||||
LINE("")
|
||||
AddGeneratedHint();
|
||||
|
||||
LINEF("#include \"{0}_load_db.h\"", Lower(m_env.m_asset->m_definition->m_name))
|
||||
LINE("")
|
||||
LINEF("#include \"Game/{0}/AssetMarker{0}.h\"", m_env.m_game)
|
||||
@@ -2195,25 +2187,27 @@ namespace
|
||||
m_intendation--;
|
||||
LINE("}")
|
||||
}
|
||||
|
||||
const OncePerAssetRenderingContext& m_env;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
std::vector<CodeTemplateFile> ZoneLoadTemplate::GetFilesToRender(const RenderingContext& context)
|
||||
std::vector<CodeTemplateFile> ZoneLoadTemplate::GetFilesToRenderOncePerAsset(const OncePerAssetRenderingContext& context)
|
||||
{
|
||||
std::vector<CodeTemplateFile> files;
|
||||
|
||||
auto assetName = context.m_asset->m_definition->m_name;
|
||||
utils::MakeStringLowerCase(assetName);
|
||||
|
||||
files.emplace_back(std::format("{0}/{0}_load_db.h", assetName), TAG_HEADER);
|
||||
files.emplace_back(std::format("{0}/{0}_load_db.cpp", assetName), TAG_SOURCE);
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_load_db.h", assetName), TAG_HEADER);
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_load_db.cpp", assetName), TAG_SOURCE);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
void ZoneLoadTemplate::RenderFile(std::ostream& stream, const int fileTag, const RenderingContext& context)
|
||||
void ZoneLoadTemplate::RenderOncePerAssetFile(std::ostream& stream, const CodeTemplateFileTag fileTag, const OncePerAssetRenderingContext& context)
|
||||
{
|
||||
Template t(stream, context);
|
||||
PerAsset t(stream, context);
|
||||
|
||||
if (fileTag == TAG_HEADER)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "Generating/ICodeTemplate.h"
|
||||
|
||||
class ZoneLoadTemplate final : public ICodeTemplate
|
||||
{
|
||||
public:
|
||||
std::vector<CodeTemplateFile> GetFilesToRender(const RenderingContext& context) override;
|
||||
void RenderFile(std::ostream& stream, int fileTag, const RenderingContext& context) override;
|
||||
std::vector<CodeTemplateFile> GetFilesToRenderOncePerAsset(const OncePerAssetRenderingContext& context) override;
|
||||
void RenderOncePerAssetFile(std::ostream& stream, CodeTemplateFileTag fileTag, const OncePerAssetRenderingContext& context) override;
|
||||
};
|
||||
|
||||
@@ -12,23 +12,50 @@ namespace
|
||||
{
|
||||
constexpr int TAG_HEADER = 1;
|
||||
constexpr int TAG_SOURCE = 2;
|
||||
constexpr int TAG_ALL_MARKERS = 3;
|
||||
|
||||
class Template final : BaseTemplate
|
||||
class PerTemplate final : BaseTemplate
|
||||
{
|
||||
public:
|
||||
Template(std::ostream& stream, const RenderingContext& context)
|
||||
: BaseTemplate(stream, context)
|
||||
PerTemplate(std::ostream& stream, const OncePerTemplateRenderingContext& context)
|
||||
: BaseTemplate(stream),
|
||||
m_env(context)
|
||||
{
|
||||
}
|
||||
|
||||
void AllMarkers() const
|
||||
{
|
||||
AddGeneratedHint();
|
||||
|
||||
LINE("#pragma once")
|
||||
LINE("")
|
||||
|
||||
for (const auto* asset : m_env.m_assets)
|
||||
{
|
||||
auto lowerAssetName = asset->m_definition->m_name;
|
||||
utils::MakeStringLowerCase(lowerAssetName);
|
||||
|
||||
LINEF("#include \"Game/{0}/XAssets/{1}/{1}_mark_db.h\"", m_env.m_game, lowerAssetName)
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
const OncePerTemplateRenderingContext& m_env;
|
||||
};
|
||||
|
||||
class PerAsset final : BaseTemplate
|
||||
{
|
||||
public:
|
||||
PerAsset(std::ostream& stream, const OncePerAssetRenderingContext& context)
|
||||
: BaseTemplate(stream),
|
||||
m_env(context)
|
||||
{
|
||||
}
|
||||
|
||||
void Header()
|
||||
{
|
||||
LINE("// ====================================================================")
|
||||
LINE("// This file has been generated by ZoneCodeGenerator.")
|
||||
LINE("// Do not modify.")
|
||||
LINE("// Any changes will be discarded when regenerating.")
|
||||
LINE("// ====================================================================")
|
||||
LINE("")
|
||||
AddGeneratedHint();
|
||||
|
||||
LINE("#pragma once")
|
||||
LINE("")
|
||||
LINEF("#include \"Game/{0}/{0}.h\"", m_env.m_game)
|
||||
@@ -113,12 +140,8 @@ namespace
|
||||
|
||||
void Source()
|
||||
{
|
||||
LINE("// ====================================================================")
|
||||
LINE("// This file has been generated by ZoneCodeGenerator.")
|
||||
LINE("// Do not modify.")
|
||||
LINE("// Any changes will be discarded when regenerating.")
|
||||
LINE("// ====================================================================")
|
||||
LINE("")
|
||||
AddGeneratedHint();
|
||||
|
||||
LINEF("#include \"{0}_mark_db.h\"", Lower(m_env.m_asset->m_definition->m_name))
|
||||
|
||||
if (!m_env.m_referenced_assets.empty())
|
||||
@@ -761,25 +784,44 @@ namespace
|
||||
m_intendation--;
|
||||
LINE("}")
|
||||
}
|
||||
|
||||
const OncePerAssetRenderingContext& m_env;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
std::vector<CodeTemplateFile> ZoneMarkTemplate::GetFilesToRender(const RenderingContext& context)
|
||||
std::vector<CodeTemplateFile> ZoneMarkTemplate::GetFilesToRenderOncePerTemplate(const OncePerTemplateRenderingContext& context)
|
||||
{
|
||||
std::vector<CodeTemplateFile> files;
|
||||
|
||||
files.emplace_back(std::format("AssetMarker{0}.h", context.m_game), TAG_ALL_MARKERS);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
void ZoneMarkTemplate::RenderOncePerTemplateFile(std::ostream& stream, const CodeTemplateFileTag fileTag, const OncePerTemplateRenderingContext& context)
|
||||
{
|
||||
assert(fileTag == TAG_ALL_MARKERS);
|
||||
|
||||
PerTemplate t(stream, context);
|
||||
t.AllMarkers();
|
||||
}
|
||||
|
||||
std::vector<CodeTemplateFile> ZoneMarkTemplate::GetFilesToRenderOncePerAsset(const OncePerAssetRenderingContext& context)
|
||||
{
|
||||
std::vector<CodeTemplateFile> files;
|
||||
|
||||
auto assetName = context.m_asset->m_definition->m_name;
|
||||
utils::MakeStringLowerCase(assetName);
|
||||
|
||||
files.emplace_back(std::format("{0}/{0}_mark_db.h", assetName), TAG_HEADER);
|
||||
files.emplace_back(std::format("{0}/{0}_mark_db.cpp", assetName), TAG_SOURCE);
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_mark_db.h", assetName), TAG_HEADER);
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_mark_db.cpp", assetName), TAG_SOURCE);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
void ZoneMarkTemplate::RenderFile(std::ostream& stream, const int fileTag, const RenderingContext& context)
|
||||
void ZoneMarkTemplate::RenderOncePerAssetFile(std::ostream& stream, const CodeTemplateFileTag fileTag, const OncePerAssetRenderingContext& context)
|
||||
{
|
||||
Template t(stream, context);
|
||||
PerAsset t(stream, context);
|
||||
|
||||
if (fileTag == TAG_HEADER)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Generating/ICodeTemplate.h"
|
||||
|
||||
class ZoneMarkTemplate final : public ICodeTemplate
|
||||
{
|
||||
public:
|
||||
std::vector<CodeTemplateFile> GetFilesToRender(const RenderingContext& context) override;
|
||||
void RenderFile(std::ostream& stream, int fileTag, const RenderingContext& context) override;
|
||||
std::vector<CodeTemplateFile> GetFilesToRenderOncePerTemplate(const OncePerTemplateRenderingContext& context) override;
|
||||
void RenderOncePerTemplateFile(std::ostream& stream, CodeTemplateFileTag fileTag, const OncePerTemplateRenderingContext& context) override;
|
||||
|
||||
std::vector<CodeTemplateFile> GetFilesToRenderOncePerAsset(const OncePerAssetRenderingContext& context) override;
|
||||
void RenderOncePerAssetFile(std::ostream& stream, CodeTemplateFileTag fileTag, const OncePerAssetRenderingContext& context) override;
|
||||
};
|
||||
|
||||
@@ -9,25 +9,22 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr int TAG_HEADER = 1;
|
||||
constexpr int TAG_SOURCE = 2;
|
||||
constexpr CodeTemplateFileTag TAG_HEADER = 1;
|
||||
constexpr CodeTemplateFileTag TAG_SOURCE = 2;
|
||||
|
||||
class Template final : BaseTemplate
|
||||
class PerAsset final : BaseTemplate
|
||||
{
|
||||
public:
|
||||
Template(std::ostream& stream, const RenderingContext& context)
|
||||
: BaseTemplate(stream, context)
|
||||
PerAsset(std::ostream& stream, const OncePerAssetRenderingContext& context)
|
||||
: BaseTemplate(stream),
|
||||
m_env(context)
|
||||
{
|
||||
}
|
||||
|
||||
void Header()
|
||||
{
|
||||
LINE("// ====================================================================")
|
||||
LINE("// This file has been generated by ZoneCodeGenerator.")
|
||||
LINE("// Do not modify.")
|
||||
LINE("// Any changes will be discarded when regenerating.")
|
||||
LINE("// ====================================================================")
|
||||
LINE("")
|
||||
AddGeneratedHint();
|
||||
|
||||
LINE("#pragma once")
|
||||
LINE("")
|
||||
LINEF("#include \"Game/{0}/{0}.h\"", m_env.m_game)
|
||||
@@ -112,12 +109,8 @@ namespace
|
||||
|
||||
void Source()
|
||||
{
|
||||
LINE("// ====================================================================")
|
||||
LINE("// This file has been generated by ZoneCodeGenerator.")
|
||||
LINE("// Do not modify.")
|
||||
LINE("// Any changes will be discarded when regenerating.")
|
||||
LINE("// ====================================================================")
|
||||
LINE("")
|
||||
AddGeneratedHint();
|
||||
|
||||
LINEF("#include \"{0}_write_db.h\"", Lower(m_env.m_asset->m_definition->m_name))
|
||||
|
||||
if (!m_env.m_referenced_assets.empty())
|
||||
@@ -1230,10 +1223,12 @@ namespace
|
||||
m_intendation--;
|
||||
LINE("}")
|
||||
}
|
||||
|
||||
const OncePerAssetRenderingContext& m_env;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
std::vector<CodeTemplateFile> ZoneWriteTemplate::GetFilesToRender(const RenderingContext& context)
|
||||
std::vector<CodeTemplateFile> ZoneWriteTemplate::GetFilesToRenderOncePerAsset(const OncePerAssetRenderingContext& context)
|
||||
{
|
||||
std::vector<CodeTemplateFile> files;
|
||||
|
||||
@@ -1241,15 +1236,15 @@ std::vector<CodeTemplateFile> ZoneWriteTemplate::GetFilesToRender(const Renderin
|
||||
for (auto& c : assetName)
|
||||
c = static_cast<char>(tolower(c));
|
||||
|
||||
files.emplace_back(std::format("{0}/{0}_write_db.h", assetName), TAG_HEADER);
|
||||
files.emplace_back(std::format("{0}/{0}_write_db.cpp", assetName), TAG_SOURCE);
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_write_db.h", assetName), TAG_HEADER);
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_write_db.cpp", assetName), TAG_SOURCE);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
void ZoneWriteTemplate::RenderFile(std::ostream& stream, const int fileTag, const RenderingContext& context)
|
||||
void ZoneWriteTemplate::RenderOncePerAssetFile(std::ostream& stream, const CodeTemplateFileTag fileTag, const OncePerAssetRenderingContext& context)
|
||||
{
|
||||
Template t(stream, context);
|
||||
PerAsset t(stream, context);
|
||||
|
||||
if (fileTag == TAG_HEADER)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "Generating/ICodeTemplate.h"
|
||||
|
||||
class ZoneWriteTemplate final : public ICodeTemplate
|
||||
{
|
||||
public:
|
||||
std::vector<CodeTemplateFile> GetFilesToRender(const RenderingContext& context) override;
|
||||
void RenderFile(std::ostream& stream, int fileTag, const RenderingContext& context) override;
|
||||
std::vector<CodeTemplateFile> GetFilesToRenderOncePerAsset(const OncePerAssetRenderingContext& context) override;
|
||||
void RenderOncePerAssetFile(std::ostream& stream, CodeTemplateFileTag fileTag, const OncePerAssetRenderingContext& context) override;
|
||||
};
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <format>
|
||||
#include <iostream>
|
||||
#include <type_traits>
|
||||
|
||||
// clang-format off
|
||||
@@ -81,9 +80,8 @@ const CommandLineOption* const OPTION_GENERATE =
|
||||
CommandLineOption::Builder::Create()
|
||||
.WithShortName("g")
|
||||
.WithLongName("generate")
|
||||
.WithDescription("Generates a specified asset/preset combination. Can be used multiple times. Available presets: ZoneLoad, ZoneWrite, AssetStructTests")
|
||||
.WithDescription("Generates a specified preset. Can be used multiple times. Available presets: ZoneLoad, ZoneWrite, AssetStructTests")
|
||||
.WithCategory(CATEGORY_OUTPUT)
|
||||
.WithParameter("assetName")
|
||||
.WithParameter("preset")
|
||||
.Reusable()
|
||||
.Build();
|
||||
@@ -103,28 +101,10 @@ const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr unsigned FLAG_TASK_GENERATE = 1 << 0;
|
||||
static constexpr unsigned FLAG_TASK_PRINT = 1 << 1;
|
||||
constexpr unsigned FLAG_TASK_GENERATE = 1 << 0;
|
||||
constexpr unsigned FLAG_TASK_PRINT = 1 << 1;
|
||||
} // namespace
|
||||
|
||||
GenerationTask::GenerationTask()
|
||||
: m_all_assets(false)
|
||||
{
|
||||
}
|
||||
|
||||
GenerationTask::GenerationTask(std::string templateName)
|
||||
: m_all_assets(true),
|
||||
m_template_name(std::move(templateName))
|
||||
{
|
||||
}
|
||||
|
||||
GenerationTask::GenerationTask(std::string assetName, std::string templateName)
|
||||
: m_all_assets(false),
|
||||
m_asset_name(std::move(assetName)),
|
||||
m_template_name(std::move(templateName))
|
||||
{
|
||||
}
|
||||
|
||||
ZoneCodeGeneratorArguments::ZoneCodeGeneratorArguments()
|
||||
: m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>),
|
||||
m_task_flags(0u)
|
||||
@@ -217,17 +197,7 @@ bool ZoneCodeGeneratorArguments::ParseArgs(const int argc, const char** argv, bo
|
||||
if (m_argument_parser.IsOptionSpecified(OPTION_GENERATE))
|
||||
{
|
||||
m_task_flags |= FLAG_TASK_GENERATE;
|
||||
const auto generateParameterValues = m_argument_parser.GetParametersForOption(OPTION_GENERATE);
|
||||
for (auto i = 0u; i < generateParameterValues.size(); i += 2)
|
||||
{
|
||||
const auto& assetName = generateParameterValues[i];
|
||||
const auto& templateName = generateParameterValues[i + 1];
|
||||
|
||||
if (assetName == "*")
|
||||
m_generation_tasks.emplace_back(templateName);
|
||||
else
|
||||
m_generation_tasks.emplace_back(assetName, templateName);
|
||||
}
|
||||
m_template_names = m_argument_parser.GetParametersForOption(OPTION_GENERATE);
|
||||
}
|
||||
|
||||
if (m_task_flags == 0)
|
||||
|
||||
@@ -5,18 +5,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class GenerationTask
|
||||
{
|
||||
public:
|
||||
bool m_all_assets;
|
||||
std::string m_asset_name;
|
||||
std::string m_template_name;
|
||||
|
||||
GenerationTask();
|
||||
explicit GenerationTask(std::string templateName);
|
||||
GenerationTask(std::string assetName, std::string templateName);
|
||||
};
|
||||
|
||||
class ZoneCodeGeneratorArguments
|
||||
{
|
||||
public:
|
||||
@@ -30,7 +18,7 @@ public:
|
||||
std::vector<std::string> m_command_paths;
|
||||
std::string m_output_directory;
|
||||
|
||||
std::vector<GenerationTask> m_generation_tasks;
|
||||
std::vector<std::string> m_template_names;
|
||||
|
||||
private:
|
||||
void PrintUsage() const;
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Game/IW3/XAssets/clipmap_t/clipmap_t_mark_db.h"
|
||||
#include "Game/IW3/XAssets/comworld/comworld_mark_db.h"
|
||||
#include "Game/IW3/XAssets/font_s/font_s_mark_db.h"
|
||||
#include "Game/IW3/XAssets/fxeffectdef/fxeffectdef_mark_db.h"
|
||||
#include "Game/IW3/XAssets/fximpacttable/fximpacttable_mark_db.h"
|
||||
#include "Game/IW3/XAssets/gameworldmp/gameworldmp_mark_db.h"
|
||||
#include "Game/IW3/XAssets/gameworldsp/gameworldsp_mark_db.h"
|
||||
#include "Game/IW3/XAssets/gfximage/gfximage_mark_db.h"
|
||||
#include "Game/IW3/XAssets/gfxlightdef/gfxlightdef_mark_db.h"
|
||||
#include "Game/IW3/XAssets/gfxworld/gfxworld_mark_db.h"
|
||||
#include "Game/IW3/XAssets/loadedsound/loadedsound_mark_db.h"
|
||||
#include "Game/IW3/XAssets/localizeentry/localizeentry_mark_db.h"
|
||||
#include "Game/IW3/XAssets/mapents/mapents_mark_db.h"
|
||||
#include "Game/IW3/XAssets/material/material_mark_db.h"
|
||||
#include "Game/IW3/XAssets/materialtechniqueset/materialtechniqueset_mark_db.h"
|
||||
#include "Game/IW3/XAssets/menudef_t/menudef_t_mark_db.h"
|
||||
#include "Game/IW3/XAssets/menulist/menulist_mark_db.h"
|
||||
#include "Game/IW3/XAssets/physpreset/physpreset_mark_db.h"
|
||||
#include "Game/IW3/XAssets/rawfile/rawfile_mark_db.h"
|
||||
#include "Game/IW3/XAssets/snd_alias_list_t/snd_alias_list_t_mark_db.h"
|
||||
#include "Game/IW3/XAssets/sndcurve/sndcurve_mark_db.h"
|
||||
#include "Game/IW3/XAssets/stringtable/stringtable_mark_db.h"
|
||||
#include "Game/IW3/XAssets/weapondef/weapondef_mark_db.h"
|
||||
#include "Game/IW3/XAssets/xanimparts/xanimparts_mark_db.h"
|
||||
#include "Game/IW3/XAssets/xmodel/xmodel_mark_db.h"
|
||||
@@ -1,37 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Game/IW4/XAssets/addonmapents/addonmapents_mark_db.h"
|
||||
#include "Game/IW4/XAssets/clipmap_t/clipmap_t_mark_db.h"
|
||||
#include "Game/IW4/XAssets/comworld/comworld_mark_db.h"
|
||||
#include "Game/IW4/XAssets/font_s/font_s_mark_db.h"
|
||||
#include "Game/IW4/XAssets/fxeffectdef/fxeffectdef_mark_db.h"
|
||||
#include "Game/IW4/XAssets/fximpacttable/fximpacttable_mark_db.h"
|
||||
#include "Game/IW4/XAssets/fxworld/fxworld_mark_db.h"
|
||||
#include "Game/IW4/XAssets/gameworldmp/gameworldmp_mark_db.h"
|
||||
#include "Game/IW4/XAssets/gameworldsp/gameworldsp_mark_db.h"
|
||||
#include "Game/IW4/XAssets/gfximage/gfximage_mark_db.h"
|
||||
#include "Game/IW4/XAssets/gfxlightdef/gfxlightdef_mark_db.h"
|
||||
#include "Game/IW4/XAssets/gfxworld/gfxworld_mark_db.h"
|
||||
#include "Game/IW4/XAssets/leaderboarddef/leaderboarddef_mark_db.h"
|
||||
#include "Game/IW4/XAssets/loadedsound/loadedsound_mark_db.h"
|
||||
#include "Game/IW4/XAssets/localizeentry/localizeentry_mark_db.h"
|
||||
#include "Game/IW4/XAssets/mapents/mapents_mark_db.h"
|
||||
#include "Game/IW4/XAssets/material/material_mark_db.h"
|
||||
#include "Game/IW4/XAssets/materialpixelshader/materialpixelshader_mark_db.h"
|
||||
#include "Game/IW4/XAssets/materialtechniqueset/materialtechniqueset_mark_db.h"
|
||||
#include "Game/IW4/XAssets/materialvertexdeclaration/materialvertexdeclaration_mark_db.h"
|
||||
#include "Game/IW4/XAssets/materialvertexshader/materialvertexshader_mark_db.h"
|
||||
#include "Game/IW4/XAssets/menudef_t/menudef_t_mark_db.h"
|
||||
#include "Game/IW4/XAssets/menulist/menulist_mark_db.h"
|
||||
#include "Game/IW4/XAssets/physcollmap/physcollmap_mark_db.h"
|
||||
#include "Game/IW4/XAssets/physpreset/physpreset_mark_db.h"
|
||||
#include "Game/IW4/XAssets/rawfile/rawfile_mark_db.h"
|
||||
#include "Game/IW4/XAssets/snd_alias_list_t/snd_alias_list_t_mark_db.h"
|
||||
#include "Game/IW4/XAssets/sndcurve/sndcurve_mark_db.h"
|
||||
#include "Game/IW4/XAssets/stringtable/stringtable_mark_db.h"
|
||||
#include "Game/IW4/XAssets/structureddatadefset/structureddatadefset_mark_db.h"
|
||||
#include "Game/IW4/XAssets/tracerdef/tracerdef_mark_db.h"
|
||||
#include "Game/IW4/XAssets/vehicledef/vehicledef_mark_db.h"
|
||||
#include "Game/IW4/XAssets/weaponcompletedef/weaponcompletedef_mark_db.h"
|
||||
#include "Game/IW4/XAssets/xanimparts/xanimparts_mark_db.h"
|
||||
#include "Game/IW4/XAssets/xmodel/xmodel_mark_db.h"
|
||||
@@ -1,42 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Game/IW5/XAssets/addonmapents/addonmapents_mark_db.h"
|
||||
#include "Game/IW5/XAssets/clipmap_t/clipmap_t_mark_db.h"
|
||||
#include "Game/IW5/XAssets/comworld/comworld_mark_db.h"
|
||||
#include "Game/IW5/XAssets/font_s/font_s_mark_db.h"
|
||||
#include "Game/IW5/XAssets/fxeffectdef/fxeffectdef_mark_db.h"
|
||||
#include "Game/IW5/XAssets/fximpacttable/fximpacttable_mark_db.h"
|
||||
#include "Game/IW5/XAssets/fxworld/fxworld_mark_db.h"
|
||||
#include "Game/IW5/XAssets/gfximage/gfximage_mark_db.h"
|
||||
#include "Game/IW5/XAssets/gfxlightdef/gfxlightdef_mark_db.h"
|
||||
#include "Game/IW5/XAssets/gfxworld/gfxworld_mark_db.h"
|
||||
#include "Game/IW5/XAssets/glassworld/glassworld_mark_db.h"
|
||||
#include "Game/IW5/XAssets/leaderboarddef/leaderboarddef_mark_db.h"
|
||||
#include "Game/IW5/XAssets/loadedsound/loadedsound_mark_db.h"
|
||||
#include "Game/IW5/XAssets/localizeentry/localizeentry_mark_db.h"
|
||||
#include "Game/IW5/XAssets/mapents/mapents_mark_db.h"
|
||||
#include "Game/IW5/XAssets/material/material_mark_db.h"
|
||||
#include "Game/IW5/XAssets/materialpixelshader/materialpixelshader_mark_db.h"
|
||||
#include "Game/IW5/XAssets/materialtechniqueset/materialtechniqueset_mark_db.h"
|
||||
#include "Game/IW5/XAssets/materialvertexdeclaration/materialvertexdeclaration_mark_db.h"
|
||||
#include "Game/IW5/XAssets/materialvertexshader/materialvertexshader_mark_db.h"
|
||||
#include "Game/IW5/XAssets/menudef_t/menudef_t_mark_db.h"
|
||||
#include "Game/IW5/XAssets/menulist/menulist_mark_db.h"
|
||||
#include "Game/IW5/XAssets/pathdata/pathdata_mark_db.h"
|
||||
#include "Game/IW5/XAssets/physcollmap/physcollmap_mark_db.h"
|
||||
#include "Game/IW5/XAssets/physpreset/physpreset_mark_db.h"
|
||||
#include "Game/IW5/XAssets/rawfile/rawfile_mark_db.h"
|
||||
#include "Game/IW5/XAssets/scriptfile/scriptfile_mark_db.h"
|
||||
#include "Game/IW5/XAssets/snd_alias_list_t/snd_alias_list_t_mark_db.h"
|
||||
#include "Game/IW5/XAssets/sndcurve/sndcurve_mark_db.h"
|
||||
#include "Game/IW5/XAssets/stringtable/stringtable_mark_db.h"
|
||||
#include "Game/IW5/XAssets/structureddatadefset/structureddatadefset_mark_db.h"
|
||||
#include "Game/IW5/XAssets/surfacefxtable/surfacefxtable_mark_db.h"
|
||||
#include "Game/IW5/XAssets/tracerdef/tracerdef_mark_db.h"
|
||||
#include "Game/IW5/XAssets/vehicledef/vehicledef_mark_db.h"
|
||||
#include "Game/IW5/XAssets/vehicletrack/vehicletrack_mark_db.h"
|
||||
#include "Game/IW5/XAssets/weaponattachment/weaponattachment_mark_db.h"
|
||||
#include "Game/IW5/XAssets/weaponcompletedef/weaponcompletedef_mark_db.h"
|
||||
#include "Game/IW5/XAssets/xanimparts/xanimparts_mark_db.h"
|
||||
#include "Game/IW5/XAssets/xmodel/xmodel_mark_db.h"
|
||||
#include "Game/IW5/XAssets/xmodelsurfs/xmodelsurfs_mark_db.h"
|
||||
@@ -1,34 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Game/T5/XAssets/clipmap_t/clipmap_t_mark_db.h"
|
||||
#include "Game/T5/XAssets/comworld/comworld_mark_db.h"
|
||||
#include "Game/T5/XAssets/ddlroot_t/ddlroot_t_mark_db.h"
|
||||
#include "Game/T5/XAssets/destructibledef/destructibledef_mark_db.h"
|
||||
#include "Game/T5/XAssets/emblemset/emblemset_mark_db.h"
|
||||
#include "Game/T5/XAssets/font_s/font_s_mark_db.h"
|
||||
#include "Game/T5/XAssets/fxeffectdef/fxeffectdef_mark_db.h"
|
||||
#include "Game/T5/XAssets/fximpacttable/fximpacttable_mark_db.h"
|
||||
#include "Game/T5/XAssets/gameworldmp/gameworldmp_mark_db.h"
|
||||
#include "Game/T5/XAssets/gameworldsp/gameworldsp_mark_db.h"
|
||||
#include "Game/T5/XAssets/gfximage/gfximage_mark_db.h"
|
||||
#include "Game/T5/XAssets/gfxlightdef/gfxlightdef_mark_db.h"
|
||||
#include "Game/T5/XAssets/gfxworld/gfxworld_mark_db.h"
|
||||
#include "Game/T5/XAssets/glasses/glasses_mark_db.h"
|
||||
#include "Game/T5/XAssets/localizeentry/localizeentry_mark_db.h"
|
||||
#include "Game/T5/XAssets/mapents/mapents_mark_db.h"
|
||||
#include "Game/T5/XAssets/material/material_mark_db.h"
|
||||
#include "Game/T5/XAssets/materialtechniqueset/materialtechniqueset_mark_db.h"
|
||||
#include "Game/T5/XAssets/menudef_t/menudef_t_mark_db.h"
|
||||
#include "Game/T5/XAssets/menulist/menulist_mark_db.h"
|
||||
#include "Game/T5/XAssets/packindex/packindex_mark_db.h"
|
||||
#include "Game/T5/XAssets/physconstraints/physconstraints_mark_db.h"
|
||||
#include "Game/T5/XAssets/physpreset/physpreset_mark_db.h"
|
||||
#include "Game/T5/XAssets/rawfile/rawfile_mark_db.h"
|
||||
#include "Game/T5/XAssets/sndbank/sndbank_mark_db.h"
|
||||
#include "Game/T5/XAssets/snddriverglobals/snddriverglobals_mark_db.h"
|
||||
#include "Game/T5/XAssets/sndpatch/sndpatch_mark_db.h"
|
||||
#include "Game/T5/XAssets/stringtable/stringtable_mark_db.h"
|
||||
#include "Game/T5/XAssets/weaponvariantdef/weaponvariantdef_mark_db.h"
|
||||
#include "Game/T5/XAssets/xanimparts/xanimparts_mark_db.h"
|
||||
#include "Game/T5/XAssets/xglobals/xglobals_mark_db.h"
|
||||
#include "Game/T5/XAssets/xmodel/xmodel_mark_db.h"
|
||||
@@ -1,50 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Game/T6/XAssets/addonmapents/addonmapents_mark_db.h"
|
||||
#include "Game/T6/XAssets/clipmap_t/clipmap_t_mark_db.h"
|
||||
#include "Game/T6/XAssets/comworld/comworld_mark_db.h"
|
||||
#include "Game/T6/XAssets/ddlroot_t/ddlroot_t_mark_db.h"
|
||||
#include "Game/T6/XAssets/destructibledef/destructibledef_mark_db.h"
|
||||
#include "Game/T6/XAssets/emblemset/emblemset_mark_db.h"
|
||||
#include "Game/T6/XAssets/font_s/font_s_mark_db.h"
|
||||
#include "Game/T6/XAssets/fonticon/fonticon_mark_db.h"
|
||||
#include "Game/T6/XAssets/footstepfxtabledef/footstepfxtabledef_mark_db.h"
|
||||
#include "Game/T6/XAssets/footsteptabledef/footsteptabledef_mark_db.h"
|
||||
#include "Game/T6/XAssets/fxeffectdef/fxeffectdef_mark_db.h"
|
||||
#include "Game/T6/XAssets/fximpacttable/fximpacttable_mark_db.h"
|
||||
#include "Game/T6/XAssets/gameworldmp/gameworldmp_mark_db.h"
|
||||
#include "Game/T6/XAssets/gameworldsp/gameworldsp_mark_db.h"
|
||||
#include "Game/T6/XAssets/gfximage/gfximage_mark_db.h"
|
||||
#include "Game/T6/XAssets/gfxlightdef/gfxlightdef_mark_db.h"
|
||||
#include "Game/T6/XAssets/gfxworld/gfxworld_mark_db.h"
|
||||
#include "Game/T6/XAssets/glasses/glasses_mark_db.h"
|
||||
#include "Game/T6/XAssets/keyvaluepairs/keyvaluepairs_mark_db.h"
|
||||
#include "Game/T6/XAssets/leaderboarddef/leaderboarddef_mark_db.h"
|
||||
#include "Game/T6/XAssets/localizeentry/localizeentry_mark_db.h"
|
||||
#include "Game/T6/XAssets/mapents/mapents_mark_db.h"
|
||||
#include "Game/T6/XAssets/material/material_mark_db.h"
|
||||
#include "Game/T6/XAssets/materialtechniqueset/materialtechniqueset_mark_db.h"
|
||||
#include "Game/T6/XAssets/memoryblock/memoryblock_mark_db.h"
|
||||
#include "Game/T6/XAssets/menudef_t/menudef_t_mark_db.h"
|
||||
#include "Game/T6/XAssets/menulist/menulist_mark_db.h"
|
||||
#include "Game/T6/XAssets/physconstraints/physconstraints_mark_db.h"
|
||||
#include "Game/T6/XAssets/physpreset/physpreset_mark_db.h"
|
||||
#include "Game/T6/XAssets/qdb/qdb_mark_db.h"
|
||||
#include "Game/T6/XAssets/rawfile/rawfile_mark_db.h"
|
||||
#include "Game/T6/XAssets/scriptparsetree/scriptparsetree_mark_db.h"
|
||||
#include "Game/T6/XAssets/skinnedvertsdef/skinnedvertsdef_mark_db.h"
|
||||
#include "Game/T6/XAssets/slug/slug_mark_db.h"
|
||||
#include "Game/T6/XAssets/sndbank/sndbank_mark_db.h"
|
||||
#include "Game/T6/XAssets/snddriverglobals/snddriverglobals_mark_db.h"
|
||||
#include "Game/T6/XAssets/sndpatch/sndpatch_mark_db.h"
|
||||
#include "Game/T6/XAssets/stringtable/stringtable_mark_db.h"
|
||||
#include "Game/T6/XAssets/tracerdef/tracerdef_mark_db.h"
|
||||
#include "Game/T6/XAssets/vehicledef/vehicledef_mark_db.h"
|
||||
#include "Game/T6/XAssets/weaponattachment/weaponattachment_mark_db.h"
|
||||
#include "Game/T6/XAssets/weaponattachmentunique/weaponattachmentunique_mark_db.h"
|
||||
#include "Game/T6/XAssets/weaponcamo/weaponcamo_mark_db.h"
|
||||
#include "Game/T6/XAssets/weaponvariantdef/weaponvariantdef_mark_db.h"
|
||||
#include "Game/T6/XAssets/xanimparts/xanimparts_mark_db.h"
|
||||
#include "Game/T6/XAssets/xglobals/xglobals_mark_db.h"
|
||||
#include "Game/T6/XAssets/xmodel/xmodel_mark_db.h"
|
||||
#include "Game/T6/XAssets/zbarrierdef/zbarrierdef_mark_db.h"
|
||||
Reference in New Issue
Block a user