mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-10-23 20:18:10 +00:00
refactor: generate asset code once per asset/variant combination
This commit is contained in:
12 files changed
+380
-312
No files matched your search
+309
-261
@@ -1,275 +1,315 @@
|
||||
ZoneCode = {}
|
||||
|
||||
ZoneCode.Assets = {
|
||||
ZoneCode.Games = {
|
||||
IW3 = {
|
||||
"PhysPreset",
|
||||
"XAnimParts",
|
||||
"XModel",
|
||||
"Material",
|
||||
"MaterialTechniqueSet",
|
||||
"GfxImage",
|
||||
"snd_alias_list_t",
|
||||
"SndCurve",
|
||||
"LoadedSound",
|
||||
"clipMap_t",
|
||||
"ComWorld",
|
||||
"GameWorldSp",
|
||||
"GameWorldMp",
|
||||
"MapEnts",
|
||||
"GfxWorld",
|
||||
"GfxLightDef",
|
||||
"Font_s",
|
||||
"MenuList",
|
||||
"menuDef_t",
|
||||
"LocalizeEntry",
|
||||
"WeaponDef",
|
||||
"FxEffectDef",
|
||||
"FxImpactTable",
|
||||
"RawFile",
|
||||
"StringTable"
|
||||
Variants = {
|
||||
"pc"
|
||||
},
|
||||
Assets = {
|
||||
"PhysPreset",
|
||||
"XAnimParts",
|
||||
"XModel",
|
||||
"Material",
|
||||
"MaterialTechniqueSet",
|
||||
"GfxImage",
|
||||
"snd_alias_list_t",
|
||||
"SndCurve",
|
||||
"LoadedSound",
|
||||
"clipMap_t",
|
||||
"ComWorld",
|
||||
"GameWorldSp",
|
||||
"GameWorldMp",
|
||||
"MapEnts",
|
||||
"GfxWorld",
|
||||
"GfxLightDef",
|
||||
"Font_s",
|
||||
"MenuList",
|
||||
"menuDef_t",
|
||||
"LocalizeEntry",
|
||||
"WeaponDef",
|
||||
"FxEffectDef",
|
||||
"FxImpactTable",
|
||||
"RawFile",
|
||||
"StringTable"
|
||||
}
|
||||
},
|
||||
|
||||
IW4 = {
|
||||
"PhysPreset",
|
||||
"PhysCollmap",
|
||||
"XAnimParts",
|
||||
"XModel",
|
||||
"Material",
|
||||
"MaterialPixelShader",
|
||||
"MaterialVertexShader",
|
||||
"MaterialVertexDeclaration",
|
||||
"MaterialTechniqueSet",
|
||||
"GfxImage",
|
||||
"snd_alias_list_t",
|
||||
"SndCurve",
|
||||
"LoadedSound",
|
||||
"clipMap_t",
|
||||
"ComWorld",
|
||||
"GameWorldSp",
|
||||
"GameWorldMp",
|
||||
"MapEnts",
|
||||
"FxWorld",
|
||||
"GfxWorld",
|
||||
"GfxLightDef",
|
||||
"Font_s",
|
||||
"MenuList",
|
||||
"menuDef_t",
|
||||
"LocalizeEntry",
|
||||
"WeaponCompleteDef",
|
||||
"FxEffectDef",
|
||||
"FxImpactTable",
|
||||
"RawFile",
|
||||
"StringTable",
|
||||
"LeaderboardDef",
|
||||
"StructuredDataDefSet",
|
||||
"TracerDef",
|
||||
"VehicleDef",
|
||||
"AddonMapEnts"
|
||||
Variants = {
|
||||
"pc32",
|
||||
"pc64"
|
||||
},
|
||||
Assets = {
|
||||
"PhysPreset",
|
||||
"PhysCollmap",
|
||||
"XAnimParts",
|
||||
"XModel",
|
||||
"Material",
|
||||
"MaterialPixelShader",
|
||||
"MaterialVertexShader",
|
||||
"MaterialVertexDeclaration",
|
||||
"MaterialTechniqueSet",
|
||||
"GfxImage",
|
||||
"snd_alias_list_t",
|
||||
"SndCurve",
|
||||
"LoadedSound",
|
||||
"clipMap_t",
|
||||
"ComWorld",
|
||||
"GameWorldSp",
|
||||
"GameWorldMp",
|
||||
"MapEnts",
|
||||
"FxWorld",
|
||||
"GfxWorld",
|
||||
"GfxLightDef",
|
||||
"Font_s",
|
||||
"MenuList",
|
||||
"menuDef_t",
|
||||
"LocalizeEntry",
|
||||
"WeaponCompleteDef",
|
||||
"FxEffectDef",
|
||||
"FxImpactTable",
|
||||
"RawFile",
|
||||
"StringTable",
|
||||
"LeaderboardDef",
|
||||
"StructuredDataDefSet",
|
||||
"TracerDef",
|
||||
"VehicleDef",
|
||||
"AddonMapEnts"
|
||||
}
|
||||
},
|
||||
|
||||
IW5 = {
|
||||
"PhysPreset",
|
||||
"PhysCollmap",
|
||||
"XAnimParts",
|
||||
"XModelSurfs",
|
||||
"XModel",
|
||||
"Material",
|
||||
"MaterialPixelShader",
|
||||
"MaterialVertexShader",
|
||||
"MaterialVertexDeclaration",
|
||||
"MaterialTechniqueSet",
|
||||
"GfxImage",
|
||||
"snd_alias_list_t",
|
||||
"SndCurve",
|
||||
"LoadedSound",
|
||||
"clipMap_t",
|
||||
"ComWorld",
|
||||
"GlassWorld",
|
||||
"PathData",
|
||||
"VehicleTrack",
|
||||
"MapEnts",
|
||||
"FxWorld",
|
||||
"GfxWorld",
|
||||
"GfxLightDef",
|
||||
"Font_s",
|
||||
"MenuList",
|
||||
"menuDef_t",
|
||||
"LocalizeEntry",
|
||||
"WeaponAttachment",
|
||||
"WeaponCompleteDef",
|
||||
"FxEffectDef",
|
||||
"FxImpactTable",
|
||||
"SurfaceFxTable",
|
||||
"RawFile",
|
||||
"ScriptFile",
|
||||
"StringTable",
|
||||
"LeaderboardDef",
|
||||
"StructuredDataDefSet",
|
||||
"TracerDef",
|
||||
"VehicleDef",
|
||||
"AddonMapEnts",
|
||||
Variants = {
|
||||
"pc32",
|
||||
"pc64"
|
||||
},
|
||||
Assets = {
|
||||
"PhysPreset",
|
||||
"PhysCollmap",
|
||||
"XAnimParts",
|
||||
"XModelSurfs",
|
||||
"XModel",
|
||||
"Material",
|
||||
"MaterialPixelShader",
|
||||
"MaterialVertexShader",
|
||||
"MaterialVertexDeclaration",
|
||||
"MaterialTechniqueSet",
|
||||
"GfxImage",
|
||||
"snd_alias_list_t",
|
||||
"SndCurve",
|
||||
"LoadedSound",
|
||||
"clipMap_t",
|
||||
"ComWorld",
|
||||
"GlassWorld",
|
||||
"PathData",
|
||||
"VehicleTrack",
|
||||
"MapEnts",
|
||||
"FxWorld",
|
||||
"GfxWorld",
|
||||
"GfxLightDef",
|
||||
"Font_s",
|
||||
"MenuList",
|
||||
"menuDef_t",
|
||||
"LocalizeEntry",
|
||||
"WeaponAttachment",
|
||||
"WeaponCompleteDef",
|
||||
"FxEffectDef",
|
||||
"FxImpactTable",
|
||||
"SurfaceFxTable",
|
||||
"RawFile",
|
||||
"ScriptFile",
|
||||
"StringTable",
|
||||
"LeaderboardDef",
|
||||
"StructuredDataDefSet",
|
||||
"TracerDef",
|
||||
"VehicleDef",
|
||||
"AddonMapEnts",
|
||||
}
|
||||
},
|
||||
|
||||
QOS = {
|
||||
"PhysPreset",
|
||||
"PhysConstraints",
|
||||
"DestructibleDef",
|
||||
"XAnimParts",
|
||||
"XModel",
|
||||
"Material",
|
||||
"MaterialTechniqueSet",
|
||||
"GfxImage",
|
||||
"snd_alias_list_t",
|
||||
"SndCurve",
|
||||
"clipMap_t",
|
||||
"ComWorld",
|
||||
"GameWorldSp",
|
||||
"GameWorldMp",
|
||||
"MapEnts",
|
||||
"GfxWorld",
|
||||
"GfxLightDef",
|
||||
"Font_s",
|
||||
"MenuList",
|
||||
"menuDef_t",
|
||||
"LocalizeEntry",
|
||||
"WeaponDef",
|
||||
"FxEffectDef",
|
||||
"FxImpactTable",
|
||||
"RawFile",
|
||||
"StringTable",
|
||||
"XmlTree",
|
||||
"SceneAnimation",
|
||||
"Cutscene",
|
||||
"CustomCamera",
|
||||
Variants = {
|
||||
"pc"
|
||||
},
|
||||
Assets = {
|
||||
"PhysPreset",
|
||||
"PhysConstraints",
|
||||
"DestructibleDef",
|
||||
"XAnimParts",
|
||||
"XModel",
|
||||
"Material",
|
||||
"MaterialTechniqueSet",
|
||||
"GfxImage",
|
||||
"snd_alias_list_t",
|
||||
"SndCurve",
|
||||
"clipMap_t",
|
||||
"ComWorld",
|
||||
"GameWorldSp",
|
||||
"GameWorldMp",
|
||||
"MapEnts",
|
||||
"GfxWorld",
|
||||
"GfxLightDef",
|
||||
"Font_s",
|
||||
"MenuList",
|
||||
"menuDef_t",
|
||||
"LocalizeEntry",
|
||||
"WeaponDef",
|
||||
"FxEffectDef",
|
||||
"FxImpactTable",
|
||||
"RawFile",
|
||||
"StringTable",
|
||||
"XmlTree",
|
||||
"SceneAnimation",
|
||||
"Cutscene",
|
||||
"CustomCamera",
|
||||
}
|
||||
},
|
||||
|
||||
T4 = {
|
||||
"PhysPreset",
|
||||
"PhysConstraints",
|
||||
"DestructibleDef",
|
||||
"XAnimParts",
|
||||
"XModel",
|
||||
"Material",
|
||||
"MaterialTechniqueSet",
|
||||
"GfxImage",
|
||||
"snd_alias_list_t",
|
||||
"SndDriverGlobals",
|
||||
"LoadedSound",
|
||||
"clipMap_t",
|
||||
"ComWorld",
|
||||
"GameWorldSp",
|
||||
"GameWorldMp",
|
||||
"MapEnts",
|
||||
"GfxWorld",
|
||||
"GfxLightDef",
|
||||
"Font_s",
|
||||
"MenuList",
|
||||
"menuDef_t",
|
||||
"LocalizeEntry",
|
||||
"WeaponDef",
|
||||
"FxEffectDef",
|
||||
"FxImpactTable",
|
||||
"RawFile",
|
||||
"StringTable",
|
||||
"PackIndex",
|
||||
Variants = {
|
||||
"pc"
|
||||
},
|
||||
Assets = {
|
||||
"PhysPreset",
|
||||
"PhysConstraints",
|
||||
"DestructibleDef",
|
||||
"XAnimParts",
|
||||
"XModel",
|
||||
"Material",
|
||||
"MaterialTechniqueSet",
|
||||
"GfxImage",
|
||||
"snd_alias_list_t",
|
||||
"SndDriverGlobals",
|
||||
"LoadedSound",
|
||||
"clipMap_t",
|
||||
"ComWorld",
|
||||
"GameWorldSp",
|
||||
"GameWorldMp",
|
||||
"MapEnts",
|
||||
"GfxWorld",
|
||||
"GfxLightDef",
|
||||
"Font_s",
|
||||
"MenuList",
|
||||
"menuDef_t",
|
||||
"LocalizeEntry",
|
||||
"WeaponDef",
|
||||
"FxEffectDef",
|
||||
"FxImpactTable",
|
||||
"RawFile",
|
||||
"StringTable",
|
||||
"PackIndex",
|
||||
}
|
||||
},
|
||||
|
||||
T5 = {
|
||||
"PhysPreset",
|
||||
"PhysConstraints",
|
||||
"DestructibleDef",
|
||||
"XAnimParts",
|
||||
"XModel",
|
||||
"Material",
|
||||
"MaterialTechniqueSet",
|
||||
"GfxImage",
|
||||
"SndBank",
|
||||
"SndPatch",
|
||||
"clipMap_t",
|
||||
"ComWorld",
|
||||
"GameWorldSp",
|
||||
"GameWorldMp",
|
||||
"MapEnts",
|
||||
"GfxWorld",
|
||||
"GfxLightDef",
|
||||
"Font_s",
|
||||
"MenuList",
|
||||
"menuDef_t",
|
||||
"LocalizeEntry",
|
||||
"WeaponVariantDef",
|
||||
"SndDriverGlobals",
|
||||
"FxEffectDef",
|
||||
"FxImpactTable",
|
||||
"RawFile",
|
||||
"StringTable",
|
||||
"PackIndex",
|
||||
"XGlobals",
|
||||
"ddlRoot_t",
|
||||
"Glasses",
|
||||
"EmblemSet"
|
||||
Variants = {
|
||||
"pc"
|
||||
},
|
||||
Assets = {
|
||||
"PhysPreset",
|
||||
"PhysConstraints",
|
||||
"DestructibleDef",
|
||||
"XAnimParts",
|
||||
"XModel",
|
||||
"Material",
|
||||
"MaterialTechniqueSet",
|
||||
"GfxImage",
|
||||
"SndBank",
|
||||
"SndPatch",
|
||||
"clipMap_t",
|
||||
"ComWorld",
|
||||
"GameWorldSp",
|
||||
"GameWorldMp",
|
||||
"MapEnts",
|
||||
"GfxWorld",
|
||||
"GfxLightDef",
|
||||
"Font_s",
|
||||
"MenuList",
|
||||
"menuDef_t",
|
||||
"LocalizeEntry",
|
||||
"WeaponVariantDef",
|
||||
"SndDriverGlobals",
|
||||
"FxEffectDef",
|
||||
"FxImpactTable",
|
||||
"RawFile",
|
||||
"StringTable",
|
||||
"PackIndex",
|
||||
"XGlobals",
|
||||
"ddlRoot_t",
|
||||
"Glasses",
|
||||
"EmblemSet"
|
||||
}
|
||||
},
|
||||
|
||||
T6 = {
|
||||
"PhysPreset",
|
||||
"PhysConstraints",
|
||||
"DestructibleDef",
|
||||
"XAnimParts",
|
||||
"XModel",
|
||||
"Material",
|
||||
"MaterialTechniqueSet",
|
||||
"GfxImage",
|
||||
"SndBank",
|
||||
"SndPatch",
|
||||
"clipMap_t",
|
||||
"ComWorld",
|
||||
"GameWorldSp",
|
||||
"GameWorldMp",
|
||||
"MapEnts",
|
||||
"GfxWorld",
|
||||
"GfxLightDef",
|
||||
"Font_s",
|
||||
"FontIcon",
|
||||
"MenuList",
|
||||
"menuDef_t",
|
||||
"LocalizeEntry",
|
||||
"WeaponVariantDef",
|
||||
"WeaponAttachment",
|
||||
"WeaponAttachmentUnique",
|
||||
"WeaponCamo",
|
||||
"SndDriverGlobals",
|
||||
"FxEffectDef",
|
||||
"FxImpactTable",
|
||||
"RawFile",
|
||||
"StringTable",
|
||||
"LeaderboardDef",
|
||||
"XGlobals",
|
||||
"ddlRoot_t",
|
||||
"Glasses",
|
||||
"EmblemSet",
|
||||
"ScriptParseTree",
|
||||
"KeyValuePairs",
|
||||
"VehicleDef",
|
||||
"MemoryBlock",
|
||||
"AddonMapEnts",
|
||||
"TracerDef",
|
||||
"SkinnedVertsDef",
|
||||
"Qdb",
|
||||
"Slug",
|
||||
"FootstepTableDef",
|
||||
"FootstepFXTableDef",
|
||||
"ZBarrierDef"
|
||||
Variants = {
|
||||
"pc"
|
||||
},
|
||||
Assets = {
|
||||
"PhysPreset",
|
||||
"PhysConstraints",
|
||||
"DestructibleDef",
|
||||
"XAnimParts",
|
||||
"XModel",
|
||||
"Material",
|
||||
"MaterialTechniqueSet",
|
||||
"GfxImage",
|
||||
"SndBank",
|
||||
"SndPatch",
|
||||
"clipMap_t",
|
||||
"ComWorld",
|
||||
"GameWorldSp",
|
||||
"GameWorldMp",
|
||||
"MapEnts",
|
||||
"GfxWorld",
|
||||
"GfxLightDef",
|
||||
"Font_s",
|
||||
"FontIcon",
|
||||
"MenuList",
|
||||
"menuDef_t",
|
||||
"LocalizeEntry",
|
||||
"WeaponVariantDef",
|
||||
"WeaponAttachment",
|
||||
"WeaponAttachmentUnique",
|
||||
"WeaponCamo",
|
||||
"SndDriverGlobals",
|
||||
"FxEffectDef",
|
||||
"FxImpactTable",
|
||||
"RawFile",
|
||||
"StringTable",
|
||||
"LeaderboardDef",
|
||||
"XGlobals",
|
||||
"ddlRoot_t",
|
||||
"Glasses",
|
||||
"EmblemSet",
|
||||
"ScriptParseTree",
|
||||
"KeyValuePairs",
|
||||
"VehicleDef",
|
||||
"MemoryBlock",
|
||||
"AddonMapEnts",
|
||||
"TracerDef",
|
||||
"SkinnedVertsDef",
|
||||
"Qdb",
|
||||
"Slug",
|
||||
"FootstepTableDef",
|
||||
"FootstepFXTableDef",
|
||||
"ZBarrierDef"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ZoneCode:allTestFiles()
|
||||
result = {}
|
||||
|
||||
for game, assets in pairs(self.Assets) do
|
||||
for game, gameData in pairs(self.Games) do
|
||||
local gameLower = string.lower(game)
|
||||
|
||||
for i, assetName in ipairs(assets) do
|
||||
local assetNameLower = string.lower(assetName)
|
||||
table.insert(result, "%{wks.location}/src/ZoneCode/Game/" .. game .. "/XAssets/" .. assetNameLower .. "/" .. assetNameLower .. "_" .. gameLower .. "_struct_test.cpp")
|
||||
for i, variantName in ipairs(gameData.Variants) do
|
||||
local variantLower = string.lower(variantName)
|
||||
for j, assetName in ipairs(gameData.Assets) do
|
||||
local assetNameLower = string.lower(assetName)
|
||||
table.insert(result, "%{wks.location}/src/ZoneCode/Game/" .. game .. "/XAssets/" .. assetNameLower .. "/" .. assetNameLower .. "_" .. gameLower .. "_" .. variantName .. "_struct_test.cpp")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -279,14 +319,16 @@ end
|
||||
function ZoneCode:allMarkFiles()
|
||||
result = {}
|
||||
|
||||
for game, assets in pairs(self.Assets) do
|
||||
for game, gameData in pairs(self.Games) do
|
||||
local gameLower = string.lower(game)
|
||||
|
||||
-- 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 .. "_" .. gameLower .. "_mark_db.cpp")
|
||||
table.insert(result, "%{wks.location}/src/ZoneCode/Game/" .. game .. "/XAssets/" .. assetNameLower .. "/" .. assetNameLower .. "_" .. gameLower .. "_mark_db.h")
|
||||
for i, variantName in ipairs(gameData.Variants) do
|
||||
local variantLower = string.lower(variantName)
|
||||
for j, assetName in ipairs(gameData.Assets) do
|
||||
local assetNameLower = string.lower(assetName)
|
||||
table.insert(result, "%{wks.location}/src/ZoneCode/Game/" .. game .. "/XAssets/" .. assetNameLower .. "/" .. assetNameLower .. "_" .. gameLower .. "_" .. variantName .. "_mark_db.cpp")
|
||||
table.insert(result, "%{wks.location}/src/ZoneCode/Game/" .. game .. "/XAssets/" .. assetNameLower .. "/" .. assetNameLower .. "_" .. gameLower .. "_" .. variantName .. "_mark_db.h")
|
||||
end
|
||||
end
|
||||
|
||||
-- PerTemplate
|
||||
@@ -299,14 +341,17 @@ end
|
||||
function ZoneCode:allLoadFiles()
|
||||
result = {}
|
||||
|
||||
for game, assets in pairs(self.Assets) do
|
||||
for game, gameData in pairs(self.Games) do
|
||||
local gameLower = string.lower(game)
|
||||
|
||||
-- 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 .. "_" .. gameLower .. "_load_db.cpp")
|
||||
table.insert(result, "%{wks.location}/src/ZoneCode/Game/" .. game .. "/XAssets/" .. assetNameLower .. "/" .. assetNameLower .. "_" .. gameLower .. "_load_db.h")
|
||||
for i, variantName in ipairs(gameData.Variants) do
|
||||
local variantLower = string.lower(variantName)
|
||||
-- Per Asset/Variant
|
||||
for j, assetName in ipairs(gameData.Assets) do
|
||||
local assetNameLower = string.lower(assetName)
|
||||
table.insert(result, "%{wks.location}/src/ZoneCode/Game/" .. game .. "/XAssets/" .. assetNameLower .. "/" .. assetNameLower .. "_" .. gameLower .. "_" .. variantName .. "_load_db.cpp")
|
||||
table.insert(result, "%{wks.location}/src/ZoneCode/Game/" .. game .. "/XAssets/" .. assetNameLower .. "/" .. assetNameLower .. "_" .. gameLower .. "_" .. variantName .. "_load_db.h")
|
||||
end
|
||||
end
|
||||
|
||||
-- PerTemplate
|
||||
@@ -319,14 +364,17 @@ end
|
||||
function ZoneCode:allWriteFiles()
|
||||
result = {}
|
||||
|
||||
for game, assets in pairs(self.Assets) do
|
||||
for game, gameData in pairs(self.Games) do
|
||||
local gameLower = string.lower(game)
|
||||
|
||||
-- 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 .. "_" .. gameLower .. "_write_db.cpp")
|
||||
table.insert(result, "%{wks.location}/src/ZoneCode/Game/" .. game .. "/XAssets/" .. assetNameLower .. "/" .. assetNameLower .. "_" .. gameLower .. "_write_db.h")
|
||||
for i, variantName in ipairs(gameData.Variants) do
|
||||
local variantLower = string.lower(variantName)
|
||||
-- Per Asset/Variant
|
||||
for j, assetName in ipairs(gameData.Assets) do
|
||||
local assetNameLower = string.lower(assetName)
|
||||
table.insert(result, "%{wks.location}/src/ZoneCode/Game/" .. game .. "/XAssets/" .. assetNameLower .. "/" .. assetNameLower .. "_" .. gameLower .. "_" .. variantName .. "_write_db.cpp")
|
||||
table.insert(result, "%{wks.location}/src/ZoneCode/Game/" .. game .. "/XAssets/" .. assetNameLower .. "/" .. assetNameLower .. "_" .. gameLower .. "_" .. variantName .. "_write_db.h")
|
||||
end
|
||||
end
|
||||
|
||||
-- PerTemplate
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
#include "BaseRenderingContext.h"
|
||||
|
||||
BaseRenderingContext::BaseRenderingContext(std::string game,
|
||||
const WordSize gameWordSize,
|
||||
const std::endian endianness,
|
||||
std::vector<const FastFileBlock*> fastFileBlocks)
|
||||
BaseRenderingContext::BaseRenderingContext(std::string game, const GameVariant* variant, std::vector<const FastFileBlock*> fastFileBlocks)
|
||||
: m_game(std::move(game)),
|
||||
m_word_size_mismatch(gameWordSize != OWN_WORD_SIZE),
|
||||
m_word_size(gameWordSize),
|
||||
m_pointer_size(GetPointerSizeForWordSize(gameWordSize)),
|
||||
m_endianness_mismatch(std::endian::native != endianness),
|
||||
m_endianness(endianness),
|
||||
m_word_size_mismatch(variant->m_word_size != OWN_WORD_SIZE),
|
||||
m_word_size(variant->m_word_size),
|
||||
m_pointer_size(GetPointerSizeForWordSize(variant->m_word_size)),
|
||||
m_endianness_mismatch(std::endian::native != variant->m_endianness),
|
||||
m_endianness(variant->m_endianness),
|
||||
m_blocks(std::move(fastFileBlocks)),
|
||||
m_default_normal_block(nullptr),
|
||||
m_default_temp_block(nullptr)
|
||||
m_default_temp_block(nullptr),
|
||||
m_variant(variant)
|
||||
{
|
||||
for (const auto* block : m_blocks)
|
||||
{
|
||||
|
||||
@@ -19,6 +19,8 @@ public:
|
||||
const FastFileBlock* m_default_normal_block;
|
||||
const FastFileBlock* m_default_temp_block;
|
||||
|
||||
const GameVariant* m_variant;
|
||||
|
||||
protected:
|
||||
BaseRenderingContext(std::string game, WordSize gameWordSize, std::endian endianness, std::vector<const FastFileBlock*> fastFileBlocks);
|
||||
BaseRenderingContext(std::string game, const GameVariant* variant, std::vector<const FastFileBlock*> fastFileBlocks);
|
||||
};
|
||||
@@ -141,7 +141,7 @@ bool CodeGenerator::GenerateCode(const IDataRepository* repository)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto* variant : repository->GetGameVariants())
|
||||
for (const auto* variant : repository->GetGameVariants())
|
||||
{
|
||||
for (auto* asset : assets)
|
||||
{
|
||||
|
||||
@@ -18,11 +18,8 @@ RenderingUsedType::RenderingUsedType(const DataDefinition* type, StructureInform
|
||||
{
|
||||
}
|
||||
|
||||
OncePerAssetRenderingContext::OncePerAssetRenderingContext(std::string game,
|
||||
const WordSize gameWordSize,
|
||||
const std::endian endianness,
|
||||
std::vector<const FastFileBlock*> fastFileBlocks)
|
||||
: BaseRenderingContext(std::move(game), gameWordSize, endianness, std::move(fastFileBlocks)),
|
||||
OncePerAssetRenderingContext::OncePerAssetRenderingContext(std::string game, const GameVariant* variant, std::vector<const FastFileBlock*> fastFileBlocks)
|
||||
: BaseRenderingContext(std::move(game), variant, std::move(fastFileBlocks)),
|
||||
m_asset(nullptr),
|
||||
m_has_actions(false)
|
||||
{
|
||||
@@ -47,7 +44,8 @@ RenderingUsedType* OncePerAssetRenderingContext::AddUsedType(std::unique_ptr<Ren
|
||||
return result;
|
||||
}
|
||||
|
||||
RenderingUsedType* OncePerAssetRenderingContext::GetBaseType(const IDataRepository* repository, MemberComputations* computations, RenderingUsedType* usedType)
|
||||
RenderingUsedType*
|
||||
OncePerAssetRenderingContext::GetBaseType(const IDataRepository* repository, const MemberComputations* computations, RenderingUsedType* usedType)
|
||||
{
|
||||
if (usedType->m_type->GetType() == DataDefinitionType::TYPEDEF)
|
||||
{
|
||||
@@ -75,7 +73,7 @@ RenderingUsedType* OncePerAssetRenderingContext::GetBaseType(const IDataReposito
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void OncePerAssetRenderingContext::AddMembersToContext(const IDataRepository* repository, StructureInformation* info)
|
||||
void OncePerAssetRenderingContext::AddMembersToContext(const IDataRepository* repository, const StructureInformation* info)
|
||||
{
|
||||
for (const auto& member : info->m_ordered_members)
|
||||
{
|
||||
@@ -119,7 +117,7 @@ void OncePerAssetRenderingContext::AddMembersToContext(const IDataRepository* re
|
||||
}
|
||||
}
|
||||
|
||||
void OncePerAssetRenderingContext::ScanUsedTypeIfNeeded(const IDataRepository* repository, MemberComputations* computations, RenderingUsedType* usedType)
|
||||
void OncePerAssetRenderingContext::ScanUsedTypeIfNeeded(const IDataRepository* repository, const MemberComputations* computations, RenderingUsedType* usedType)
|
||||
{
|
||||
if (usedType->m_info != nullptr && !StructureComputations(usedType->m_info).IsAsset() && !computations->IsInRuntimeBlock() && !usedType->m_members_loaded)
|
||||
{
|
||||
@@ -163,7 +161,7 @@ void OncePerAssetRenderingContext::CreateUsedTypeCollections()
|
||||
}
|
||||
}
|
||||
|
||||
bool OncePerAssetRenderingContext::UsedTypeHasActions(const RenderingUsedType* usedType) const
|
||||
bool OncePerAssetRenderingContext::UsedTypeHasActions(const RenderingUsedType* usedType)
|
||||
{
|
||||
const StructureComputations computations(usedType->m_info);
|
||||
|
||||
@@ -191,8 +189,8 @@ bool OncePerAssetRenderingContext::UsedTypeHasActions(const RenderingUsedType* u
|
||||
std::unique_ptr<OncePerAssetRenderingContext>
|
||||
OncePerAssetRenderingContext::BuildContext(const IDataRepository* repository, StructureInformation* asset, const GameVariant* variant)
|
||||
{
|
||||
auto context = std::make_unique<OncePerAssetRenderingContext>(
|
||||
OncePerAssetRenderingContext(repository->GetGameName(), variant->m_word_size, variant->m_endianness, repository->GetAllFastFileBlocks()));
|
||||
auto context =
|
||||
std::make_unique<OncePerAssetRenderingContext>(OncePerAssetRenderingContext(repository->GetGameName(), variant, repository->GetAllFastFileBlocks()));
|
||||
|
||||
context->MakeAsset(repository, asset);
|
||||
context->CreateUsedTypeCollections();
|
||||
|
||||
@@ -39,15 +39,15 @@ public:
|
||||
bool m_has_actions;
|
||||
|
||||
private:
|
||||
OncePerAssetRenderingContext(std::string game, WordSize gameWordSize, std::endian endianness, std::vector<const FastFileBlock*> fastFileBlocks);
|
||||
OncePerAssetRenderingContext(std::string game, const GameVariant* variant, std::vector<const FastFileBlock*> fastFileBlocks);
|
||||
|
||||
RenderingUsedType* AddUsedType(std::unique_ptr<RenderingUsedType> usedType);
|
||||
RenderingUsedType* GetBaseType(const IDataRepository* repository, MemberComputations* computations, RenderingUsedType* usedType);
|
||||
void AddMembersToContext(const IDataRepository* repository, StructureInformation* info);
|
||||
void ScanUsedTypeIfNeeded(const IDataRepository* repository, MemberComputations* computations, RenderingUsedType* usedType);
|
||||
RenderingUsedType* GetBaseType(const IDataRepository* repository, const MemberComputations* computations, RenderingUsedType* usedType);
|
||||
void AddMembersToContext(const IDataRepository* repository, const StructureInformation* info);
|
||||
void ScanUsedTypeIfNeeded(const IDataRepository* repository, const MemberComputations* computations, RenderingUsedType* usedType);
|
||||
void MakeAsset(const IDataRepository* repository, StructureInformation* asset);
|
||||
void CreateUsedTypeCollections();
|
||||
bool UsedTypeHasActions(const RenderingUsedType* usedType) const;
|
||||
static bool UsedTypeHasActions(const RenderingUsedType* usedType);
|
||||
|
||||
std::unordered_map<const DataDefinition*, std::unique_ptr<RenderingUsedType>> m_used_types_lookup;
|
||||
};
|
||||
@@ -5,11 +5,10 @@
|
||||
#include <algorithm>
|
||||
|
||||
OncePerTemplateRenderingContext::OncePerTemplateRenderingContext(std::string game,
|
||||
const WordSize gameWordSize,
|
||||
const std::endian endianness,
|
||||
const GameVariant* variant,
|
||||
std::vector<const FastFileBlock*> fastFileBlocks,
|
||||
std::vector<StructureInformation*> assets)
|
||||
: BaseRenderingContext(std::move(game), gameWordSize, endianness, std::move(fastFileBlocks)),
|
||||
: BaseRenderingContext(std::move(game), variant, std::move(fastFileBlocks)),
|
||||
m_assets(std::move(assets))
|
||||
{
|
||||
for (const auto* block : m_blocks)
|
||||
@@ -35,6 +34,6 @@ std::unique_ptr<OncePerTemplateRenderingContext> OncePerTemplateRenderingContext
|
||||
assetInformation.emplace_back(info);
|
||||
}
|
||||
|
||||
return std::make_unique<OncePerTemplateRenderingContext>(OncePerTemplateRenderingContext(
|
||||
repository->GetGameName(), variant->m_word_size, variant->m_endianness, repository->GetAllFastFileBlocks(), assetInformation));
|
||||
return std::make_unique<OncePerTemplateRenderingContext>(
|
||||
OncePerTemplateRenderingContext(repository->GetGameName(), variant, repository->GetAllFastFileBlocks(), assetInformation));
|
||||
}
|
||||
@@ -15,8 +15,7 @@ public:
|
||||
|
||||
private:
|
||||
OncePerTemplateRenderingContext(std::string game,
|
||||
WordSize gameWordSize,
|
||||
std::endian endianness,
|
||||
const GameVariant* variant,
|
||||
std::vector<const FastFileBlock*> fastFileBlocks,
|
||||
std::vector<StructureInformation*> assets);
|
||||
};
|
||||
@@ -90,7 +90,10 @@ std::vector<CodeTemplateFile> AssetStructTestsTemplate::GetFilesToRenderOncePerA
|
||||
auto gameName = context.m_game;
|
||||
utils::MakeStringLowerCase(gameName);
|
||||
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_{1}_struct_test.cpp", assetName, gameName), TAG_SOURCE);
|
||||
auto variantName = context.m_variant->m_name;
|
||||
utils::MakeStringLowerCase(variantName);
|
||||
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_{1}_{2}_struct_test.cpp", assetName, gameName, variantName), TAG_SOURCE);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,11 @@ namespace
|
||||
|
||||
for (const auto* asset : m_env.m_assets)
|
||||
{
|
||||
LINEF("#include \"Game/{0}/XAssets/{1}/{1}_{2}_load_db.h\"", m_env.m_game, Lower(asset->m_definition->m_name), Lower(m_env.m_game))
|
||||
LINEF("#include \"Game/{0}/XAssets/{1}/{1}_{2}_{3}_load_db.h\"",
|
||||
m_env.m_game,
|
||||
Lower(asset->m_definition->m_name),
|
||||
Lower(m_env.m_game),
|
||||
Lower(m_env.m_variant->m_name))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +166,7 @@ namespace
|
||||
{
|
||||
AddGeneratedHint();
|
||||
|
||||
LINEF("#include \"{0}_{1}_load_db.h\"", Lower(m_env.m_asset->m_definition->m_name), Lower(m_env.m_game))
|
||||
LINEF("#include \"{0}_{1}_{2}_load_db.h\"", Lower(m_env.m_asset->m_definition->m_name), Lower(m_env.m_game), Lower(m_env.m_variant->m_name))
|
||||
LINE("")
|
||||
LINEF("#include \"Game/{0}/AssetMarker{0}.h\"", m_env.m_game)
|
||||
LINE("")
|
||||
@@ -174,7 +178,7 @@ namespace
|
||||
LINE("// Referenced Assets:")
|
||||
for (const auto* type : m_env.m_referenced_assets)
|
||||
{
|
||||
LINEF("#include \"../{0}/{0}_{1}_load_db.h\"", Lower(type->m_type->m_name), Lower(m_env.m_game))
|
||||
LINEF("#include \"../{0}/{0}_{1}_{2}_load_db.h\"", Lower(type->m_type->m_name), Lower(m_env.m_game), Lower(m_env.m_variant->m_name))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2185,8 +2189,11 @@ std::vector<CodeTemplateFile> ZoneLoadTemplate::GetFilesToRenderOncePerAsset(con
|
||||
auto gameName = context.m_game;
|
||||
utils::MakeStringLowerCase(gameName);
|
||||
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_{1}_load_db.h", assetName, gameName), TAG_HEADER);
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_{1}_load_db.cpp", assetName, gameName), TAG_SOURCE);
|
||||
auto variantName = context.m_variant->m_name;
|
||||
utils::MakeStringLowerCase(variantName);
|
||||
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_{1}_{2}_load_db.h", assetName, gameName, variantName), TAG_HEADER);
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_{1}_{2}_load_db.cpp", assetName, gameName, variantName), TAG_SOURCE);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,11 @@ namespace
|
||||
|
||||
for (const auto* asset : m_env.m_assets)
|
||||
{
|
||||
LINEF("#include \"Game/{0}/XAssets/{1}/{1}_{2}_mark_db.h\"", m_env.m_game, Lower(asset->m_definition->m_name), Lower(m_env.m_game))
|
||||
LINEF("#include \"Game/{0}/XAssets/{1}/{1}_{2}_{3}_mark_db.h\"",
|
||||
m_env.m_game,
|
||||
Lower(asset->m_definition->m_name),
|
||||
Lower(m_env.m_game),
|
||||
Lower(m_env.m_variant->m_name))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +143,7 @@ namespace
|
||||
{
|
||||
AddGeneratedHint();
|
||||
|
||||
LINEF("#include \"{0}_{1}_mark_db.h\"", Lower(m_env.m_asset->m_definition->m_name), Lower(m_env.m_game))
|
||||
LINEF("#include \"{0}_{1}_{2}_mark_db.h\"", Lower(m_env.m_asset->m_definition->m_name), Lower(m_env.m_game), Lower(m_env.m_variant->m_name))
|
||||
|
||||
if (!m_env.m_referenced_assets.empty())
|
||||
{
|
||||
@@ -147,7 +151,7 @@ namespace
|
||||
LINE("// Referenced Assets:")
|
||||
for (const auto* type : m_env.m_referenced_assets)
|
||||
{
|
||||
LINEF("#include \"../{0}/{0}_{1}_mark_db.h\"", Lower(type->m_type->m_name), Lower(m_env.m_game))
|
||||
LINEF("#include \"../{0}/{0}_{1}_{2}_mark_db.h\"", Lower(type->m_type->m_name), Lower(m_env.m_game), Lower(m_env.m_variant->m_name))
|
||||
}
|
||||
}
|
||||
LINE("")
|
||||
@@ -813,8 +817,11 @@ std::vector<CodeTemplateFile> ZoneMarkTemplate::GetFilesToRenderOncePerAsset(con
|
||||
auto gameName = context.m_game;
|
||||
utils::MakeStringLowerCase(gameName);
|
||||
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_{1}_mark_db.h", assetName, gameName), TAG_HEADER);
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_{1}_mark_db.cpp", assetName, gameName), TAG_SOURCE);
|
||||
auto variantName = context.m_variant->m_name;
|
||||
utils::MakeStringLowerCase(variantName);
|
||||
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_{1}_{2}_mark_db.h", assetName, gameName, variantName), TAG_HEADER);
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_{1}_{2}_mark_db.cpp", assetName, gameName, variantName), TAG_SOURCE);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,11 @@ namespace
|
||||
|
||||
for (const auto* asset : m_env.m_assets)
|
||||
{
|
||||
LINEF("#include \"Game/{0}/XAssets/{1}/{1}_{2}_write_db.h\"", m_env.m_game, Lower(asset->m_definition->m_name), Lower(m_env.m_game))
|
||||
LINEF("#include \"Game/{0}/XAssets/{1}/{1}_{2}_{3}_write_db.h\"",
|
||||
m_env.m_game,
|
||||
Lower(asset->m_definition->m_name),
|
||||
Lower(m_env.m_game),
|
||||
Lower(m_env.m_variant->m_name))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +161,7 @@ namespace
|
||||
{
|
||||
AddGeneratedHint();
|
||||
|
||||
LINEF("#include \"{0}_{1}_write_db.h\"", Lower(m_env.m_asset->m_definition->m_name), Lower(m_env.m_game))
|
||||
LINEF("#include \"{0}_{1}_{2}_write_db.h\"", Lower(m_env.m_asset->m_definition->m_name), Lower(m_env.m_game), Lower(m_env.m_variant->m_name))
|
||||
|
||||
if (!m_env.m_referenced_assets.empty())
|
||||
{
|
||||
@@ -165,7 +169,7 @@ namespace
|
||||
LINE("// Referenced Assets:")
|
||||
for (const auto* type : m_env.m_referenced_assets)
|
||||
{
|
||||
LINEF("#include \"../{0}/{0}_{1}_write_db.h\"", Lower(type->m_type->m_name), Lower(m_env.m_game))
|
||||
LINEF("#include \"../{0}/{0}_{1}_{2}_write_db.h\"", Lower(type->m_type->m_name), Lower(m_env.m_game), Lower(m_env.m_variant->m_name))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1666,8 +1670,11 @@ std::vector<CodeTemplateFile> ZoneWriteTemplate::GetFilesToRenderOncePerAsset(co
|
||||
auto gameName = context.m_game;
|
||||
utils::MakeStringLowerCase(gameName);
|
||||
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_{1}_write_db.h", assetName, gameName), TAG_HEADER);
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_{1}_write_db.cpp", assetName, gameName), TAG_SOURCE);
|
||||
auto variantName = context.m_variant->m_name;
|
||||
utils::MakeStringLowerCase(variantName);
|
||||
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_{1}_{2}_write_db.h", assetName, gameName, variantName), TAG_HEADER);
|
||||
files.emplace_back(std::format("XAssets/{0}/{0}_{1}_{2}_write_db.cpp", assetName, gameName, variantName), TAG_SOURCE);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user