2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-05-25 02:51:43 +00:00

Fix LMAP parsing and don't resolve till after ptr is ready.

This commit is contained in:
njohnson
2026-05-11 14:55:04 -04:00
committed by Jan Laupetin
parent 4208bab758
commit 336c9d8d86
10 changed files with 79 additions and 48 deletions
@@ -10,9 +10,15 @@ namespace light_def
{
const auto* lightDef = asset.Asset();
const auto assetFile = context.OpenAssetFile(GetFileNameForAsset(asset.m_name));
if (!assetFile || lightDef->attenuation.image == nullptr || lightDef->attenuation.image->name == nullptr)
if (!assetFile)
{
con::error("Could not open GfxLightDef file for dumping!");
return;
}
if (lightDef->attenuation.image == nullptr || lightDef->attenuation.image->name == nullptr)
{
con::error("GfxLightDef attenuation data was invalid!");
return;
}
@@ -22,6 +28,6 @@ namespace light_def
if (imageName[0] == ',')
imageName = &imageName[1];
stream << lightDef->attenuation.samplerState << imageName;
stream << lightDef->attenuation.samplerState << imageName << '\0';
}
} // namespace light_def
@@ -10,9 +10,17 @@ namespace light_def
{
const auto* lightDef = asset.Asset();
const auto assetFile = context.OpenAssetFile(GetFileNameForAsset(asset.m_name));
if (!assetFile || lightDef->attenuation.image == nullptr || lightDef->attenuation.image->name == nullptr)
if (!assetFile)
{
con::error("Could not open GfxLightDef file for dumping!");
return;
}
if (lightDef->attenuation.image == nullptr || lightDef->attenuation.image->name == nullptr)
{
con::error("GfxLightDef attenuation data was invalid!");
return;
}
auto& stream = *assetFile;
@@ -20,6 +28,6 @@ namespace light_def
if (imageName[0] == ',')
imageName = &imageName[1];
stream << lightDef->attenuation.samplerState << imageName << static_cast<char>(lightDef->lmapLookupStart);
stream << lightDef->attenuation.samplerState << imageName << '\0';
}
} // namespace light_def
@@ -13,20 +13,30 @@ namespace light_def
const auto* lightDef = asset.Asset();
const auto assetFile = context.OpenAssetFile(GetFileNameForAsset(asset.m_name));
auto& stream = *assetFile;
if (!assetFile)
{
con::error("Could not open GfxLightDef file for dumping!");
return;
}
if (lightDef->attenuation.image == nullptr || lightDef->attenuation.image->name == nullptr)
{
con::error("GfxLightDef attenuation data was invalid!");
return;
}
assert(lightDef->attenuation.image != nullptr);
const auto* attenuationImageName = lightDef->attenuation.image->name;
if (attenuationImageName && attenuationImageName[0] == ',')
attenuationImageName = &attenuationImageName[1];
const auto* cucolorisImageName = "";
if (lightDef->cucoloris.image)
if (lightDef->cucoloris.image && lightDef->cucoloris.image->name)
{
cucolorisImageName = lightDef->cucoloris.image->name;
if (cucolorisImageName && cucolorisImageName[0] == ',')
cucolorisImageName = &cucolorisImageName[1];
}
stream << lightDef->attenuation.samplerState << attenuationImageName << '\0' << lightDef->cucoloris.samplerState << cucolorisImageName;
stream << lightDef->attenuation.samplerState << attenuationImageName << '\0' << lightDef->cucoloris.samplerState << cucolorisImageName << '\0';
}
} // namespace light_def
@@ -10,9 +10,17 @@ namespace light_def
{
const auto* lightDef = asset.Asset();
const auto assetFile = context.OpenAssetFile(GetFileNameForAsset(asset.m_name));
if (!assetFile || lightDef->attenuation.image == nullptr || lightDef->attenuation.image->name == nullptr)
if (!assetFile)
{
con::error("Could not open GfxLightDef file for dumping!");
return;
}
if (lightDef->attenuation.image == nullptr || lightDef->attenuation.image->name == nullptr)
{
con::error("GfxLightDef attenuation data was invalid!");
return;
}
auto& stream = *assetFile;
@@ -20,6 +28,6 @@ namespace light_def
if (imageName[0] == ',')
imageName = &imageName[1];
stream << lightDef->attenuation.samplerState << imageName << static_cast<char>(lightDef->lmapLookupStart);
stream << lightDef->attenuation.samplerState << imageName << '\0';
}
} // namespace light_def
@@ -10,9 +10,17 @@ namespace light_def
{
const auto* lightDef = asset.Asset();
const auto assetFile = context.OpenAssetFile(GetFileNameForAsset(asset.m_name));
if (!assetFile || lightDef->attenuation.image == nullptr || lightDef->attenuation.image->name == nullptr)
if (!assetFile)
{
con::error("Could not open GfxLightDef file for dumping!");
return;
}
if (lightDef->attenuation.image == nullptr || lightDef->attenuation.image->name == nullptr)
{
con::error("GfxLightDef attenuation data was invalid!");
return;
}
auto& stream = *assetFile;
@@ -20,6 +28,6 @@ namespace light_def
if (imageName[0] == ',')
imageName = &imageName[1];
stream << lightDef->attenuation.samplerState << imageName << static_cast<char>(lightDef->lmapLookupStart);
stream << lightDef->attenuation.samplerState << imageName << '\0';
}
} // namespace light_def