2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-11-26 22:42:06 +00:00

chore: update all logging to use centralized logging component

This commit is contained in:
Jan Laupetin
2025-09-10 19:52:42 +02:00
parent 1bf4033f41
commit 02f20f09b6
161 changed files with 824 additions and 664 deletions

View File

@@ -4,6 +4,7 @@
#include "Image/DdsLoader.h"
#include "Image/IwiTypes.h"
#include "Pool/GlobalAssetPool.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <cstring>
@@ -40,7 +41,7 @@ namespace
const auto texture = dds::LoadDds(*file.m_stream);
if (!texture)
{
std::cerr << std::format("Failed to load dds file for image asset \"{}\"\n", assetName);
con::error("Failed to load dds file for image asset \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Game/IW3/IW3.h"
#include "Game/IW3/Material/JsonMaterialLoaderIW3.h"
#include "Material/MaterialCommon.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <iostream>
@@ -32,7 +33,7 @@ namespace
AssetRegistration<AssetMaterial> registration(assetName, material);
if (!LoadMaterialAsJson(*file.m_stream, *material, m_memory, context, registration))
{
std::cerr << std::format("Failed to load material \"{}\"\n", assetName);
con::error("Failed to load material \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -1,5 +1,7 @@
#include "InfoStringToStructConverter.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <format>
#include <iostream>
@@ -63,7 +65,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (fx == nullptr)
{
std::cerr << std::format("Failed to load fx asset \"{}\"\n", value);
con::error("Failed to load fx asset \"{}\"", value);
return false;
}
@@ -85,7 +87,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (xmodel == nullptr)
{
std::cerr << std::format("Failed to load xmodel asset \"{}\"\n", value);
con::error("Failed to load xmodel asset \"{}\"", value);
return false;
}
@@ -107,7 +109,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (material == nullptr)
{
std::cerr << std::format("Failed to load material asset \"{}\"\n", value);
con::error("Failed to load material asset \"{}\"", value);
return false;
}
@@ -129,7 +131,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (tracer == nullptr)
{
std::cerr << std::format("Failed to load tracer asset \"{}\"\n", value);
con::error("Failed to load tracer asset \"{}\"", value);
return false;
}
@@ -146,7 +148,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (endPtr != &value[value.size()])
{
std::cerr << std::format("Failed to parse value \"{}\" as mph\n", value);
con::error("Failed to parse value \"{}\" as mph", value);
return false;
}
@@ -165,7 +167,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (collmap == nullptr)
{
std::cerr << std::format("Failed to load collmap asset \"{}\"\n", value);
con::error("Failed to load collmap asset \"{}\"", value);
return false;
}

View File

@@ -3,6 +3,7 @@
#include "Game/IW4/IW4.h"
#include "Game/IW4/Leaderboard/JsonLeaderboardDef.h"
#include "Leaderboard/LeaderboardCommon.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -36,7 +37,7 @@ namespace
if (type != "leaderboard" || version != 1u)
{
std::cerr << std::format("Tried to load leaderboard \"{}\" but did not find expected type leaderboard of version 1\n", leaderboardDef.name);
con::error("Tried to load leaderboard \"{}\" but did not find expected type leaderboard of version 1", leaderboardDef.name);
return false;
}
@@ -45,7 +46,7 @@ namespace
}
catch (const json::exception& e)
{
std::cerr << std::format("Failed to parse json of leaderboard: {}\n", e.what());
con::error("Failed to parse json of leaderboard: {}", e.what());
}
return false;
@@ -125,7 +126,7 @@ namespace
const JsonLoader loader(*file.m_stream, m_memory);
if (!loader.Load(*leaderboardDef))
{
std::cerr << std::format("Failed to load leaderboard \"{}\"\n", assetName);
con::error("Failed to load leaderboard \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -2,6 +2,7 @@
#include "Game/IW4/IW4.h"
#include "LightDef/LightDefCommon.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -49,7 +50,7 @@ namespace
auto* imageDependency = context.LoadDependency<AssetImage>(imageName);
if (!imageDependency)
{
std::cerr << std::format("Could not load GfxLightDef \"{}\" due to missing image \"{}\"\n", assetName, imageName);
con::error("Could not load GfxLightDef \"{}\" due to missing image \"{}\"", assetName, imageName);
return AssetCreationResult::Failure();
}
registration.AddDependency(imageDependency);

View File

@@ -3,6 +3,7 @@
#include "Game/IW4/IW4.h"
#include "Game/IW4/Material/JsonMaterialLoaderIW4.h"
#include "Material/MaterialCommon.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <iostream>
@@ -32,7 +33,7 @@ namespace
AssetRegistration<AssetMaterial> registration(assetName, material);
if (!LoadMaterialAsJson(*file.m_stream, *material, m_memory, context, registration))
{
std::cerr << std::format("Failed to load material \"{}\"\n", assetName);
con::error("Failed to load material \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -5,6 +5,7 @@
#include "Game/IW4/Menu/MenuConverterIW4.h"
#include "ObjLoading.h"
#include "Parsing/Menu/MenuFileReader.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -88,7 +89,7 @@ namespace
const auto alreadyLoadedMenuFile = conversionState.m_menus_by_filename.find(menuFilePath);
if (alreadyLoadedMenuFile != conversionState.m_menus_by_filename.end())
{
std::cout << std::format("Already loaded \"{}\", skipping\n", menuFilePath);
con::debug("Already loaded \"{}\", skipping", menuFilePath);
for (auto* menu : alreadyLoadedMenuFile->second)
{
menus.emplace_back(menu->Asset());
@@ -100,7 +101,7 @@ namespace
const auto file = m_search_path.Open(menuFilePath);
if (!file.IsOpen())
{
std::cerr << std::format("Could not open menu file \"{}\"\n", menuFilePath);
con::error("Could not open menu file \"{}\"", menuFilePath);
return false;
}
@@ -109,12 +110,12 @@ namespace
{
ProcessParsedResults(menuFilePath, context, *menuFileResult, zoneState, conversionState, menus, registration);
if (!menuFileResult->m_menus_to_load.empty())
std::cout << std::format("WARNING: Menu file has menus to load even though it is not a menu list, ignoring: \"{}\"\n", menuFilePath);
con::warn("Menu file has menus to load even though it is not a menu list, ignoring: \"{}\"", menuFilePath);
return true;
}
else
std::cerr << std::format("Could not read menu file \"{}\"\n", menuFilePath);
con::error("Could not read menu file \"{}\"", menuFilePath);
return false;
}
@@ -134,12 +135,12 @@ namespace
for (const auto& menu : parsingResult.m_menus)
totalItemCount += menu->m_items.size();
std::cout << std::format("Successfully read menu file \"{}\" ({} loads, {} menus, {} functions, {} items)\n",
fileName,
menuLoadCount,
menuCount,
functionCount,
totalItemCount);
con::info("Successfully read menu file \"{}\" ({} loads, {} menus, {} functions, {} items)",
fileName,
menuLoadCount,
menuCount,
functionCount,
totalItemCount);
// Add all functions to the zone state to make them available for all menus to be converted
for (auto& function : parsingResult.m_functions)
@@ -160,7 +161,7 @@ namespace
converter->ConvertMenu(*commonMenu, *menuAsset, menuRegistration);
if (menuAsset == nullptr)
{
std::cerr << std::format("Failed to convert menu file \"{}\"\n", commonMenu->m_name);
con::error("Failed to convert menu file \"{}\"", commonMenu->m_name);
return false;
}

View File

@@ -4,6 +4,7 @@
#include "Game/IW4/ObjConstantsIW4.h"
#include "InfoString/InfoString.h"
#include "InfoStringLoaderPhysPresetIW4.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <iostream>
@@ -30,7 +31,7 @@ namespace
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cerr << std::format("Failed to read phys preset gdt entry: \"{}\"\n", assetName);
con::error("Failed to read phys preset gdt entry: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Game/IW4/IW4.h"
#include "Game/IW4/InfoString/InfoStringToStructConverter.h"
#include "Game/IW4/PhysPreset/PhysPresetFields.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <cassert>
@@ -78,7 +79,7 @@ namespace phys_preset
infoString, &presetInfo, m_zone.m_script_strings, m_memory, context, registration, phys_preset_fields, std::extent_v<decltype(phys_preset_fields)>);
if (!converter.Convert())
{
std::cerr << std::format("Failed to parse phys preset: \"{}\"\n", assetName);
con::error("Failed to parse phys preset: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -5,6 +5,7 @@
#include "InfoString/InfoString.h"
#include "InfoStringLoaderPhysPresetIW4.h"
#include "PhysPreset/PhysPresetCommon.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <iostream>
@@ -32,7 +33,7 @@ namespace
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET, *file.m_stream))
{
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure();
}

View File

@@ -1,6 +1,7 @@
#include "LoaderRawFileIW4.h"
#include "Game/IW4/IW4.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <filesystem>
@@ -58,7 +59,7 @@ namespace
if (ret != Z_STREAM_END)
{
std::cerr << std::format("Deflate failed for loading rawfile \"{}\"\n", assetName);
con::error("Deflate failed for loading rawfile \"{}\"", assetName);
deflateEnd(&zs);
return AssetCreationResult::Failure();
}

View File

@@ -2,6 +2,7 @@
#include "Game/IW4/IW4.h"
#include "Shader/ShaderCommon.h"
#include "Utils/Logging/Log.h"
#include <cstdint>
#include <format>
@@ -29,7 +30,7 @@ namespace
if (file.m_length % sizeof(uint32_t) != 0)
{
std::cerr << std::format("Invalid pixel shader \"{}\": Size must be dividable by {}\n", assetName, sizeof(uint32_t));
con::error("Invalid pixel shader \"{}\": Size must be dividable by {}", assetName, sizeof(uint32_t));
return AssetCreationResult::Failure();
}

View File

@@ -2,6 +2,7 @@
#include "Game/IW4/IW4.h"
#include "Shader/ShaderCommon.h"
#include "Utils/Logging/Log.h"
#include <cstdint>
#include <format>
@@ -29,7 +30,7 @@ namespace
if (file.m_length % sizeof(uint32_t) != 0)
{
std::cerr << std::format("Invalid vertex shader \"{}\": Size must be dividable by {}\n", assetName, sizeof(uint32_t));
con::error("Invalid vertex shader \"{}\": Size must be dividable by {}", assetName, sizeof(uint32_t));
return AssetCreationResult::Failure();
}

View File

@@ -5,6 +5,7 @@
#include "Parsing/Graph2D/Graph2DReader.h"
#include "Pool/GlobalAssetPool.h"
#include "Sound/SoundCurveCommon.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -38,7 +39,7 @@ namespace
if (sndCurveData->knots.size() > std::extent_v<decltype(SndCurve::knots)>)
{
std::cerr << std::format("Failed to load SndCurve \"{}\": Too many knots ({})\n", assetName, sndCurveData->knots.size());
con::error("Failed to load SndCurve \"{}\": Too many knots ({})", assetName, sndCurveData->knots.size());
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/IW4/ObjConstantsIW4.h"
#include "InfoString/InfoString.h"
#include "InfoStringLoaderWeaponIW4.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -31,7 +32,7 @@ namespace
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cerr << std::format("Failed to read weapon gdt entry: \"{}\"\n", assetName);
con::error("Failed to read weapon gdt entry: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/IW4/InfoString/EnumStrings.h"
#include "Game/IW4/InfoString/InfoStringToStructConverter.h"
#include "Game/IW4/Weapon/WeaponFields.h"
#include "Utils/Logging/Log.h"
#include "Weapon/AccuracyGraphLoader.h"
#include <cassert>
@@ -23,13 +24,13 @@ namespace
std::vector<std::string> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse hide tags as array\n";
con::error("Failed to parse hide tags as array");
return false;
}
if (valueArray.size() > std::extent_v<decltype(WeaponFullDef::hideTags)>)
{
std::cerr << std::format("Cannot have more than {} hide tags!\n", std::extent_v<decltype(WeaponFullDef::hideTags)>);
con::error("Cannot have more than {} hide tags!", std::extent_v<decltype(WeaponFullDef::hideTags)>);
return false;
}
@@ -85,14 +86,13 @@ namespace
std::vector<std::array<std::string, 2>> pairs;
if (!ParseAsArray(value, pairs))
{
std::cerr << std::format("Failed to parse notetrack{}map as pairs\n", mapName);
con::error("Failed to parse notetrack{}map as pairs", mapName);
return false;
}
if (pairs.size() > std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>)
{
std::cerr << std::format(
"Cannot have more than {} notetrack{}map entries!\n", std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>, mapName);
con::error("Cannot have more than {} notetrack{}map entries!", std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>, mapName);
return false;
}
@@ -267,28 +267,27 @@ namespace
void CheckProjectileValues(const WeaponCompleteDef& weaponCompleteDef, const WeaponDef& weaponDef)
{
if (weaponDef.iProjectileSpeed <= 0)
std::cerr << std::format("Projectile speed for WeapType {} must be greater than 0.0", weaponCompleteDef.szDisplayName);
con::error("Projectile speed for WeapType {} must be greater than 0.0", weaponCompleteDef.szDisplayName);
if (weaponDef.destabilizationCurvatureMax >= 1000000000.0f || weaponDef.destabilizationCurvatureMax < 0.0f)
std::cerr << std::format("Destabilization angle for for WeapType {} must be between 0 and 45 degrees", weaponCompleteDef.szDisplayName);
con::error("Destabilization angle for for WeapType {} must be between 0 and 45 degrees", weaponCompleteDef.szDisplayName);
if (weaponDef.destabilizationRateTime < 0.0f)
std::cerr << std::format("Destabilization rate time for for WeapType {} must be non-negative", weaponCompleteDef.szDisplayName);
con::error("Destabilization rate time for for WeapType {} must be non-negative", weaponCompleteDef.szDisplayName);
}
void CheckTurretBarrelSpin(const WeaponCompleteDef& weaponCompleteDef, const WeaponDef& weaponDef)
{
if (weaponDef.weapClass != WEAPCLASS_TURRET)
std::cerr << std::format("Rotating barrel set for non-turret weapon {}.", weaponCompleteDef.szInternalName);
con::error("Rotating barrel set for non-turret weapon {}.", weaponCompleteDef.szInternalName);
if (0.0f == weaponDef.turretBarrelSpinSpeed)
{
std::cerr << std::format(
"Rotating barrel spin speed '{}' is invalid for weapon {}.", weaponDef.turretBarrelSpinSpeed, weaponCompleteDef.szInternalName);
con::error("Rotating barrel spin speed '{}' is invalid for weapon {}.", weaponDef.turretBarrelSpinSpeed, weaponCompleteDef.szInternalName);
}
if (0.0f < weaponDef.turretOverheatUpRate && 0.0f >= weaponDef.turretOverheatDownRate)
{
std::cerr << std::format("Turret overheat Up rate is set, but the down rate '{}' is invalid for weapon {}.",
weaponDef.turretOverheatDownRate,
weaponCompleteDef.szInternalName);
con::error("Turret overheat Up rate is set, but the down rate '{}' is invalid for weapon {}.",
weaponDef.turretOverheatDownRate,
weaponCompleteDef.szInternalName);
}
}
@@ -296,18 +295,18 @@ namespace
{
if (0.0f != weaponDef.fAdsZoomInFrac)
{
std::cerr << std::format("Weapon {} ({}) has thermal scope set. ADS Zoom In frac should be 0 to prevent zoom-in blur ({}).\n",
weaponCompleteDef.szInternalName,
weaponCompleteDef.szDisplayName,
weaponDef.fAdsZoomInFrac);
con::error("Weapon {} ({}) has thermal scope set. ADS Zoom In frac should be 0 to prevent zoom-in blur ({}).",
weaponCompleteDef.szInternalName,
weaponCompleteDef.szDisplayName,
weaponDef.fAdsZoomInFrac);
}
if (0.0f != weaponDef.fAdsZoomOutFrac)
{
std::cerr << std::format("Weapon {} ({}) has thermal scope set. ADS Zoom Out frac should be 0 to prevent zoom-out blur ({}).\n",
weaponCompleteDef.szInternalName,
weaponCompleteDef.szDisplayName,
weaponDef.fAdsZoomOutFrac);
con::error("Weapon {} ({}) has thermal scope set. ADS Zoom Out frac should be 0 to prevent zoom-out blur ({}).",
weaponCompleteDef.szInternalName,
weaponCompleteDef.szDisplayName,
weaponDef.fAdsZoomOutFrac);
}
}
@@ -337,7 +336,7 @@ namespace
weaponDef.fMinDamageRange = 999999.12f;
if (weaponDef.enemyCrosshairRange > 15000.0f)
std::cerr << std::format("Enemy crosshair ranges should be less than {}\n", 15000.0f);
con::error("Enemy crosshair ranges should be less than {}", 15000.0f);
if (weaponDef.weapType == WEAPTYPE_PROJECTILE)
CheckProjectileValues(weaponCompleteDef, weaponDef);
@@ -350,22 +349,21 @@ namespace
if (weaponDef.offhandClass && !weaponDef.bClipOnly)
{
std::cerr << std::format(
"Weapon {} ({}) is an offhand weapon but is not set to clip only, which is not supported since we can't reload the offhand slot.\n",
weaponCompleteDef.szInternalName,
weaponCompleteDef.szDisplayName);
con::error("Weapon {} ({}) is an offhand weapon but is not set to clip only, which is not supported since we can't reload the offhand slot.",
weaponCompleteDef.szInternalName,
weaponCompleteDef.szDisplayName);
}
if (weaponDef.weapType == WEAPTYPE_BULLET)
{
if (weaponDef.bulletExplDmgMult <= 0.0f)
std::cerr << std::format("Detected invalid bulletExplDmgMult of '{}' for weapon '{}'; please update weapon settings.\n",
weaponDef.bulletExplDmgMult,
weaponCompleteDef.szInternalName);
con::error("Detected invalid bulletExplDmgMult of '{}' for weapon '{}'; please update weapon settings.",
weaponDef.bulletExplDmgMult,
weaponCompleteDef.szInternalName);
if (weaponDef.bulletExplRadiusMult <= 0.0f)
std::cerr << std::format("Detected invalid bulletExplRadiusMult of '{}' for weapon '{}'; please update weapon settings.\n",
weaponDef.bulletExplRadiusMult,
weaponCompleteDef.szInternalName);
con::error("Detected invalid bulletExplRadiusMult of '{}' for weapon '{}'; please update weapon settings.",
weaponDef.bulletExplRadiusMult,
weaponCompleteDef.szInternalName);
}
}
@@ -448,7 +446,7 @@ namespace weapon
infoString, *weaponFullDef, m_zone.m_script_strings, m_memory, context, registration, weapon_fields, std::extent_v<decltype(weapon_fields)>);
if (!converter.Convert())
{
std::cerr << std::format("Failed to parse weapon: \"{}\"\n", assetName);
con::error("Failed to parse weapon: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/IW4/ObjConstantsIW4.h"
#include "InfoString/InfoString.h"
#include "InfoStringLoaderWeaponIW4.h"
#include "Utils/Logging/Log.h"
#include "Weapon/WeaponCommon.h"
#include <cstring>
@@ -33,7 +34,7 @@ namespace
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON, *file.m_stream))
{
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Game/IW5/IW5.h"
#include "Image/ImageCommon.h"
#include "Image/IwiLoader.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -39,7 +40,7 @@ namespace
const auto texture = iwi::LoadIwi(ss);
if (!texture)
{
std::cerr << std::format("Failed to load texture from: {}\n", fileName);
con::error("Failed to load texture from: {}", fileName);
return AssetCreationResult::Failure();
}

View File

@@ -1,5 +1,7 @@
#include "InfoStringToStructConverter.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <format>
#include <iostream>
@@ -63,7 +65,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (fx == nullptr)
{
std::cerr << std::format("Failed to load fx asset \"{}\"\n", value);
con::error("Failed to load fx asset \"{}\"", value);
return false;
}
@@ -85,7 +87,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (xmodel == nullptr)
{
std::cerr << std::format("Failed to load xmodel asset \"{}\"\n", value);
con::error("Failed to load xmodel asset \"{}\"", value);
return false;
}
@@ -107,7 +109,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (material == nullptr)
{
std::cerr << std::format("Failed to load material asset \"{}\"\n", value);
con::error("Failed to load material asset \"{}\"", value);
return false;
}
@@ -129,7 +131,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (tracer == nullptr)
{
std::cerr << std::format("Failed to load tracer asset \"{}\"\n", value);
con::error("Failed to load tracer asset \"{}\"", value);
return false;
}
@@ -146,7 +148,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (endPtr != &value[value.size()])
{
std::cout << "Failed to parse value \"" << value << "\" as mph\n";
con::error("Failed to parse value \"{}\" as mph", value);
return false;
}
@@ -165,7 +167,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (collmap == nullptr)
{
std::cerr << std::format("Failed to load collmap asset \"{}\"\n", value);
con::error("Failed to load collmap asset \"{}\"", value);
return false;
}

View File

@@ -3,6 +3,7 @@
#include "Game/IW5/IW5.h"
#include "Game/IW5/Leaderboard/JsonLeaderboardDef.h"
#include "Leaderboard/LeaderboardCommon.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -36,7 +37,7 @@ namespace
if (type != "leaderboard" || version != 1u)
{
std::cerr << std::format("Tried to load leaderboard \"{}\" but did not find expected type leaderboard of version 1\n", leaderboardDef.name);
con::error("Tried to load leaderboard \"{}\" but did not find expected type leaderboard of version 1", leaderboardDef.name);
return false;
}
@@ -45,7 +46,7 @@ namespace
}
catch (const json::exception& e)
{
std::cerr << std::format("Failed to parse json of leaderboard: {}\n", e.what());
con::error("Failed to parse json of leaderboard: {}", e.what());
}
return false;
@@ -142,7 +143,7 @@ namespace
const JsonLoader loader(*file.m_stream, m_memory);
if (!loader.Load(*leaderboardDef))
{
std::cerr << std::format("Failed to load leaderboard \"{}\"\n", assetName);
con::error("Failed to load leaderboard \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Game/IW5/IW5.h"
#include "Game/IW5/Material/JsonMaterialLoaderIW5.h"
#include "Material/MaterialCommon.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <iostream>
@@ -32,7 +33,7 @@ namespace
AssetRegistration<AssetMaterial> registration(assetName, material);
if (!LoadMaterialAsJson(*file.m_stream, *material, m_memory, context, registration))
{
std::cerr << std::format("Failed to load material \"{}\"\n", assetName);
con::error("Failed to load material \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -5,6 +5,7 @@
#include "Game/IW5/Menu/MenuConverterIW5.h"
#include "ObjLoading.h"
#include "Parsing/Menu/MenuFileReader.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -88,7 +89,7 @@ namespace
const auto alreadyLoadedMenuFile = conversionState.m_menus_by_filename.find(menuFilePath);
if (alreadyLoadedMenuFile != conversionState.m_menus_by_filename.end())
{
std::cout << std::format("Already loaded \"{}\", skipping\n", menuFilePath);
con::debug("Already loaded \"{}\", skipping", menuFilePath);
for (auto* menu : alreadyLoadedMenuFile->second)
{
menus.emplace_back(menu->Asset());
@@ -100,7 +101,7 @@ namespace
const auto file = m_search_path.Open(menuFilePath);
if (!file.IsOpen())
{
std::cerr << std::format("Could not open menu file \"{}\"\n", menuFilePath);
con::error("Could not open menu file \"{}\"", menuFilePath);
return false;
}
@@ -109,12 +110,12 @@ namespace
{
ProcessParsedResults(menuFilePath, context, *menuFileResult, zoneState, conversionState, menus, registration);
if (!menuFileResult->m_menus_to_load.empty())
std::cout << std::format("WARNING: Menu file has menus to load even though it is not a menu list, ignoring: \"{}\"\n", menuFilePath);
con::warn("Menu file has menus to load even though it is not a menu list, ignoring: \"{}\"", menuFilePath);
return true;
}
else
std::cerr << std::format("Could not read menu file \"{}\"\n", menuFilePath);
con::error("Could not read menu file \"{}\"", menuFilePath);
return false;
}
@@ -134,12 +135,12 @@ namespace
for (const auto& menu : parsingResult.m_menus)
totalItemCount += static_cast<unsigned>(menu->m_items.size());
std::cout << std::format("Successfully read menu file \"{}\" ({} loads, {} menus, {} functions, {} items)\n",
fileName,
menuLoadCount,
menuCount,
functionCount,
totalItemCount);
con::info("Successfully read menu file \"{}\" ({} loads, {} menus, {} functions, {} items)",
fileName,
menuLoadCount,
menuCount,
functionCount,
totalItemCount);
// Add all functions to the zone state to make them available for all menus to be converted
for (auto& function : parsingResult.m_functions)
@@ -160,7 +161,7 @@ namespace
converter->ConvertMenu(*commonMenu, *menuAsset, menuRegistration);
if (menuAsset == nullptr)
{
std::cerr << std::format("Failed to convert menu file \"{}\"\n", commonMenu->m_name);
con::error("Failed to convert menu file \"{}\"", commonMenu->m_name);
return false;
}

View File

@@ -2,6 +2,7 @@
#include "Game/IW5/IW5.h"
#include "Pool/GlobalAssetPool.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <filesystem>
@@ -57,7 +58,7 @@ namespace
if (ret != Z_STREAM_END)
{
std::cerr << std::format("Deflate failed for loading rawfile \"{}\"\n", assetName);
con::error("Deflate failed for loading rawfile \"{}\"", assetName);
deflateEnd(&zs);
return AssetCreationResult::Failure();
}

View File

@@ -2,6 +2,7 @@
#include "Game/IW5/IW5.h"
#include "Pool/GlobalAssetPool.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <filesystem>
@@ -53,13 +54,13 @@ namespace
if (scriptFile->compressedLen <= 0 || scriptFile->bytecodeLen <= 0)
{
std::cerr << std::format("Error: Invalid length of the buffers in {} specified\n", assetName);
con::error("Invalid length of the buffers in {} specified", assetName);
return AssetCreationResult::Failure();
}
if (offset + static_cast<size_t>(scriptFile->compressedLen + scriptFile->bytecodeLen) > static_cast<size_t>(file.m_length))
{
std::cerr << std::format("Error: Specified length in {} GSC BIN structure exceeds the actual file size\n", assetName);
con::error("Specified length in {} GSC BIN structure exceeds the actual file size", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/IW5/ObjConstantsIW5.h"
#include "InfoString/InfoString.h"
#include "InfoStringLoaderWeaponIW5.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -31,7 +32,7 @@ namespace
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cerr << std::format("Failed to read weapon gdt entry: \"{}\"\n", assetName);
con::error("Failed to read weapon gdt entry: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Game/IW5/IW5.h"
#include "Game/IW5/InfoString/InfoStringToStructConverter.h"
#include "Game/IW5/Weapon/WeaponFields.h"
#include "Utils/Logging/Log.h"
#include "Weapon/AccuracyGraphLoader.h"
#include <cassert>
@@ -22,13 +23,13 @@ namespace
std::vector<std::string> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse hide tags as array\n";
con::error("Failed to parse hide tags as array");
return false;
}
if (valueArray.size() > std::extent_v<decltype(WeaponFullDef::hideTags)>)
{
std::cerr << std::format("Cannot have more than {} hide tags!\n", std::extent_v<decltype(WeaponFullDef::hideTags)>);
con::error("Cannot have more than {} hide tags!", std::extent_v<decltype(WeaponFullDef::hideTags)>);
return false;
}
@@ -83,14 +84,13 @@ namespace
std::vector<std::array<std::string, 2>> pairs;
if (!ParseAsArray(value, pairs))
{
std::cerr << std::format("Failed to parse notetrack{}map as pairs\n", mapName);
con::error("Failed to parse notetrack{}map as pairs", mapName);
return false;
}
if (pairs.size() > std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>)
{
std::cerr << std::format(
"Cannot have more than {} notetrack{}map entries!\n", std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>, mapName);
con::error("Cannot have more than {} notetrack{}map entries!", std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>, mapName);
return false;
}
@@ -146,7 +146,7 @@ namespace
std::vector<std::string> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse attachments as array\n";
con::error("Failed to parse attachments as array");
return false;
}
@@ -165,7 +165,7 @@ namespace
{
if (currentScope >= std::extent_v<decltype(WeaponFullDef::scopes)>)
{
std::cerr << std::format("Cannot have more than {} scopes\n", std::extent_v<decltype(WeaponFullDef::scopes)>);
con::error("Cannot have more than {} scopes", std::extent_v<decltype(WeaponFullDef::scopes)>);
return false;
}
@@ -175,7 +175,7 @@ namespace
{
if (currentUnderBarrel >= std::extent_v<decltype(WeaponFullDef::underBarrels)>)
{
std::cerr << std::format("Cannot have more than {} under barrels\n", std::extent_v<decltype(WeaponFullDef::underBarrels)>);
con::error("Cannot have more than {} under barrels", std::extent_v<decltype(WeaponFullDef::underBarrels)>);
return false;
}
@@ -185,7 +185,7 @@ namespace
{
if (currentOther >= std::extent_v<decltype(WeaponFullDef::others)>)
{
std::cerr << std::format("Cannot have more than {} other attachments\n", std::extent_v<decltype(WeaponFullDef::others)>);
con::error("Cannot have more than {} other attachments", std::extent_v<decltype(WeaponFullDef::others)>);
return false;
}
@@ -201,7 +201,7 @@ namespace
std::vector<std::array<std::string, 7>> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse anim overrides as array\n";
con::error("Failed to parse anim overrides as array");
return false;
}
@@ -242,7 +242,7 @@ namespace
std::vector<std::array<std::string, 5>> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse sound overrides as array\n";
con::error("Failed to parse sound overrides as array");
return false;
}
@@ -277,7 +277,7 @@ namespace
std::vector<std::array<std::string, 5>> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse attachments as array\n";
con::error("Failed to parse attachments as array");
return false;
}
@@ -315,7 +315,7 @@ namespace
std::vector<std::array<std::string, 3>> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse reload overrides as array\n";
con::error("Failed to parse reload overrides as array");
return false;
}
@@ -349,7 +349,7 @@ namespace
std::vector<std::array<std::string, 3>> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse note track overrides as array\n";
con::error("Failed to parse note track overrides as array");
return false;
}
@@ -378,7 +378,7 @@ namespace
if (currentOverrideKeyOffset >= 24u)
{
std::cerr << std::format("Cannot have more than {} note track overrides per attachment\n", 24u);
con::error("Cannot have more than {} note track overrides per attachment", 24u);
return false;
}
@@ -433,7 +433,7 @@ namespace
}
}
std::cerr << std::format("Weapon does not have attachment \"{}\"\n", value);
con::error("Weapon does not have attachment \"{}\"", value);
return false;
}
@@ -473,7 +473,7 @@ namespace
auto* fxInfo = m_context.LoadDependency<AssetFx>(value);
if (!fxInfo)
{
std::cerr << std::format("Failed to load fx for override \"{}\"\n", value);
con::error("Failed to load fx for override \"{}\"", value);
return false;
}
@@ -494,7 +494,7 @@ namespace
}
}
std::cerr << std::format("Unknown anim file \"{}\"\n", value);
con::error("Unknown anim file \"{}\"", value);
return false;
}
@@ -509,7 +509,7 @@ namespace
}
}
std::cerr << std::format("Unknown sound type \"{}\"\n", value);
con::error("Unknown sound type \"{}\"", value);
return false;
}
@@ -524,7 +524,7 @@ namespace
}
}
std::cerr << std::format("Unknown fx type \"{}\"\n", value);
con::error("Unknown fx type \"{}\"", value);
return false;
}
@@ -535,7 +535,7 @@ namespace
if (size != value.size())
{
std::cerr << std::format("Invalid int value: \"{}\"\n", value);
con::error("Invalid int value: \"{}\"", value);
return false;
}
@@ -697,28 +697,27 @@ namespace
void CheckProjectileValues(const WeaponCompleteDef& weaponCompleteDef, const WeaponDef& weaponDef)
{
if (weaponDef.iProjectileSpeed <= 0)
std::cerr << std::format("Projectile speed for WeapType {} must be greater than 0.0", weaponCompleteDef.szDisplayName);
con::error("Projectile speed for WeapType {} must be greater than 0.0", weaponCompleteDef.szDisplayName);
if (weaponDef.destabilizationCurvatureMax >= 1000000000.0f || weaponDef.destabilizationCurvatureMax < 0.0f)
std::cerr << std::format("Destabilization angle for for WeapType {} must be between 0 and 45 degrees", weaponCompleteDef.szDisplayName);
con::error("Destabilization angle for for WeapType {} must be between 0 and 45 degrees", weaponCompleteDef.szDisplayName);
if (weaponDef.destabilizationRateTime < 0.0f)
std::cerr << std::format("Destabilization rate time for for WeapType {} must be non-negative", weaponCompleteDef.szDisplayName);
con::error("Destabilization rate time for for WeapType {} must be non-negative", weaponCompleteDef.szDisplayName);
}
void CheckTurretBarrelSpin(const WeaponCompleteDef& weaponCompleteDef, const WeaponDef& weaponDef)
{
if (weaponDef.weapClass != WEAPCLASS_TURRET)
std::cerr << std::format("Rotating barrel set for non-turret weapon {}.", weaponCompleteDef.szInternalName);
con::error("Rotating barrel set for non-turret weapon {}.", weaponCompleteDef.szInternalName);
if (0.0f == weaponDef.turretBarrelSpinSpeed)
{
std::cerr << std::format(
"Rotating barrel spin speed '{}' is invalid for weapon {}.", weaponDef.turretBarrelSpinSpeed, weaponCompleteDef.szInternalName);
con::error("Rotating barrel spin speed '{}' is invalid for weapon {}.", weaponDef.turretBarrelSpinSpeed, weaponCompleteDef.szInternalName);
}
if (0.0f < weaponDef.turretOverheatUpRate && 0.0f >= weaponDef.turretOverheatDownRate)
{
std::cerr << std::format("Turret overheat Up rate is set, but the down rate '{}' is invalid for weapon {}.",
weaponDef.turretOverheatDownRate,
weaponCompleteDef.szInternalName);
con::error("Turret overheat Up rate is set, but the down rate '{}' is invalid for weapon {}.",
weaponDef.turretOverheatDownRate,
weaponCompleteDef.szInternalName);
}
}
@@ -726,18 +725,18 @@ namespace
{
if (0.0f != weaponDef.fAdsZoomInFrac)
{
std::cerr << std::format("Weapon {} ({}) has thermal scope set. ADS Zoom In frac should be 0 to prevent zoom-in blur ({}).\n",
weaponCompleteDef.szInternalName,
weaponCompleteDef.szDisplayName,
weaponDef.fAdsZoomInFrac);
con::error("Weapon {} ({}) has thermal scope set. ADS Zoom In frac should be 0 to prevent zoom-in blur ({}).",
weaponCompleteDef.szInternalName,
weaponCompleteDef.szDisplayName,
weaponDef.fAdsZoomInFrac);
}
if (0.0f != weaponDef.fAdsZoomOutFrac)
{
std::cerr << std::format("Weapon {} ({}) has thermal scope set. ADS Zoom Out frac should be 0 to prevent zoom-out blur ({}).\n",
weaponCompleteDef.szInternalName,
weaponCompleteDef.szDisplayName,
weaponDef.fAdsZoomOutFrac);
con::error("Weapon {} ({}) has thermal scope set. ADS Zoom Out frac should be 0 to prevent zoom-out blur ({}).",
weaponCompleteDef.szInternalName,
weaponCompleteDef.szDisplayName,
weaponDef.fAdsZoomOutFrac);
}
}
@@ -767,7 +766,7 @@ namespace
weaponDef.fMinDamageRange = 999999.12f;
if (weaponDef.enemyCrosshairRange > 15000.0f)
std::cerr << std::format("Enemy crosshair ranges should be less than {}\n", 15000.0f);
con::error("Enemy crosshair ranges should be less than {}", 15000.0f);
if (weaponDef.weapType == WEAPTYPE_PROJECTILE)
CheckProjectileValues(weaponCompleteDef, weaponDef);
@@ -780,22 +779,21 @@ namespace
if (weaponDef.offhandClass && !weaponDef.bClipOnly)
{
std::cerr << std::format(
"Weapon {} ({}) is an offhand weapon but is not set to clip only, which is not supported since we can't reload the offhand slot.\n",
weaponCompleteDef.szInternalName,
weaponCompleteDef.szDisplayName);
con::error("Weapon {} ({}) is an offhand weapon but is not set to clip only, which is not supported since we can't reload the offhand slot.",
weaponCompleteDef.szInternalName,
weaponCompleteDef.szDisplayName);
}
if (weaponDef.weapType == WEAPTYPE_BULLET)
{
if (weaponDef.bulletExplDmgMult <= 0.0f)
std::cerr << std::format("Detected invalid bulletExplDmgMult of '{}' for weapon '{}'; please update weapon settings.\n",
weaponDef.bulletExplDmgMult,
weaponCompleteDef.szInternalName);
con::error("Detected invalid bulletExplDmgMult of '{}' for weapon '{}'; please update weapon settings.",
weaponDef.bulletExplDmgMult,
weaponCompleteDef.szInternalName);
if (weaponDef.bulletExplRadiusMult <= 0.0f)
std::cerr << std::format("Detected invalid bulletExplRadiusMult of '{}' for weapon '{}'; please update weapon settings.\n",
weaponDef.bulletExplRadiusMult,
weaponCompleteDef.szInternalName);
con::error("Detected invalid bulletExplRadiusMult of '{}' for weapon '{}'; please update weapon settings.",
weaponDef.bulletExplRadiusMult,
weaponCompleteDef.szInternalName);
}
}
@@ -878,7 +876,7 @@ namespace weapon
infoString, *weaponFullDef, m_zone.m_script_strings, m_memory, context, registration, weapon_fields, std::extent_v<decltype(weapon_fields)>);
if (!converter.Convert())
{
std::cerr << std::format("Failed to parse weapon: \"{}\"\n", assetName);
con::error("Failed to parse weapon: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -2,6 +2,7 @@
#include "Game/IW5/IW5.h"
#include "Game/IW5/Weapon/JsonWeaponAttachment.h"
#include "Utils/Logging/Log.h"
#include "Weapon/AttachmentCommon.h"
#include <cstring>
@@ -39,7 +40,7 @@ namespace
if (type != "attachment" || version != 1u)
{
std::cerr << "Tried to load attachment \"" << attachment.szInternalName << "\" but did not find expected type attachment of version 1\n";
con::error("Tried to load attachment \"{}\" but did not find expected type attachment of version 1", attachment.szInternalName);
return false;
}
@@ -48,7 +49,7 @@ namespace
}
catch (const json::exception& e)
{
std::cerr << std::format("Failed to parse json of attachment: {}\n", e.what());
con::error("Failed to parse json of attachment: {}", e.what());
}
return false;
@@ -57,7 +58,7 @@ namespace
private:
static void PrintError(const WeaponAttachment& attachment, const std::string& message)
{
std::cerr << "Cannot load attachment \"" << attachment.szInternalName << "\": " << message << "\n";
con::error("Cannot load attachment \"{}\": {}", attachment.szInternalName, message);
}
bool CreateWeaponAttachmentFromJson(const JsonWeaponAttachment& jAttachment, WeaponAttachment& attachment) const
@@ -653,7 +654,7 @@ namespace
const JsonLoader loader(*file.m_stream, m_memory, context, registration);
if (!loader.Load(*attachment))
{
std::cerr << std::format("Failed to load attachment \"{}\"\n", assetName);
con::error("Failed to load attachment \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/IW5/ObjConstantsIW5.h"
#include "InfoString/InfoString.h"
#include "InfoStringLoaderWeaponIW5.h"
#include "Utils/Logging/Log.h"
#include "Weapon/WeaponCommon.h"
#include <cstring>
@@ -34,7 +35,7 @@ namespace
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON, *file.m_stream))
{
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Game/T5/Material/JsonMaterialLoaderT5.h"
#include "Game/T5/T5.h"
#include "Material/MaterialCommon.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <iostream>
@@ -32,7 +33,7 @@ namespace
AssetRegistration<AssetMaterial> registration(assetName, material);
if (!LoadMaterialAsJson(*file.m_stream, *material, m_memory, context, registration))
{
std::cerr << std::format("Failed to load material \"{}\"\n", assetName);
con::error("Failed to load material \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -1,6 +1,7 @@
#include "LoaderRawFileT5.h"
#include "Game/T5/T5.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <filesystem>
@@ -71,7 +72,7 @@ namespace
if (ret != Z_STREAM_END)
{
std::cerr << std::format("Deflate failed for loading gsc file \"{}\"\n", assetName);
con::error("Deflate failed for loading gsc file \"{}\"", assetName);
deflateEnd(&zs);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Csv/CsvStream.h"
#include "Game/T6/CommonT6.h"
#include "Game/T6/T6.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <format>
@@ -65,14 +66,14 @@ namespace
if (currentRow.size() < COL_COUNT_MIN)
{
std::cerr << std::format("{} Column count lower than min column count ({})\n", ErrorPrefix(assetName, currentRowIndex), COL_COUNT_MIN);
con::error("{} Column count lower than min column count ({})", ErrorPrefix(assetName, currentRowIndex), COL_COUNT_MIN);
return AssetCreationResult::Failure();
}
int index;
if (!ParseInt(index, currentRow[ROW_INDEX]) || index < 0)
{
std::cerr << std::format("{} Failed to parse index\n", ErrorPrefix(assetName, currentRowIndex));
con::error("{} Failed to parse index", ErrorPrefix(assetName, currentRowIndex));
return AssetCreationResult::Failure();
}
@@ -118,7 +119,7 @@ namespace
}
else
{
std::cerr << std::format("{} Unknown row type \"{}\"\n", ErrorPrefix(assetName, currentRowIndex), currentRow[ROW_TYPE]);
con::error("{} Unknown row type \"{}\"", ErrorPrefix(assetName, currentRowIndex), currentRow[ROW_TYPE]);
return AssetCreationResult::Failure();
}
}
@@ -222,26 +223,26 @@ namespace
{
if (row.size() < COL_COUNT_ICON)
{
std::cerr << std::format("{} Column count lower than min column count for entries ({})\n", ErrorPrefix(assetName, rowIndex), COL_COUNT_ICON);
con::error("{} Column count lower than min column count for entries ({})", ErrorPrefix(assetName, rowIndex), COL_COUNT_ICON);
return false;
}
if (!ParseInt(icon.fontIconSize, row[ROW_ICON_SIZE]))
{
std::cerr << std::format("{} Failed to parse size\n", ErrorPrefix(assetName, rowIndex));
con::error("{} Failed to parse size", ErrorPrefix(assetName, rowIndex));
return false;
}
if (!ParseFloat(icon.xScale, row[ROW_ICON_XSCALE]) || !ParseFloat(icon.yScale, row[ROW_ICON_YSCALE]))
{
std::cerr << std::format("{} Failed to parse scale\n", ErrorPrefix(assetName, rowIndex));
con::error("{} Failed to parse scale", ErrorPrefix(assetName, rowIndex));
return false;
}
auto* materialDependency = context.LoadDependency<AssetMaterial>(row[ROW_ICON_MATERIAL]);
if (materialDependency == nullptr)
{
std::cerr << std::format("{} Failed to load material \"{}\"\n", ErrorPrefix(assetName, rowIndex), row[ROW_ICON_MATERIAL]);
con::error("{} Failed to load material \"{}\"", ErrorPrefix(assetName, rowIndex), row[ROW_ICON_MATERIAL]);
return false;
}
registration.AddDependency(materialDependency);
@@ -258,19 +259,19 @@ namespace
{
if (row.size() < COL_COUNT_ALIAS)
{
std::cerr << std::format("{} Column count lower than min column count for aliases ({})\n", ErrorPrefix(assetName, rowIndex), COL_COUNT_ALIAS);
con::error("{} Column count lower than min column count for aliases ({})", ErrorPrefix(assetName, rowIndex), COL_COUNT_ALIAS);
return false;
}
if (!ParseHashStr(alias.aliasHash, row[ROW_ALIAS_NAME]))
{
std::cerr << std::format("{} Failed to parse alias \"{}\"\n", ErrorPrefix(assetName, rowIndex), row[ROW_ALIAS_NAME]);
con::error("{} Failed to parse alias \"{}\"", ErrorPrefix(assetName, rowIndex), row[ROW_ALIAS_NAME]);
return false;
}
if (!ParseHashStr(alias.buttonHash, row[ROW_ALIAS_BUTTON]))
{
std::cerr << std::format("{} Failed to parse button \"{}\"\n", ErrorPrefix(assetName, rowIndex), row[ROW_ALIAS_BUTTON]);
con::error("{} Failed to parse button \"{}\"", ErrorPrefix(assetName, rowIndex), row[ROW_ALIAS_BUTTON]);
return false;
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/CommonT6.h"
#include "Game/T6/FontIcon/JsonFontIconT6.h"
#include "Game/T6/T6.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <format>
@@ -45,7 +46,7 @@ namespace
if (type != "font-icon" || version != 1u)
{
std::cerr << std::format("Tried to load font icon \"{}\" but did not find expected type font-icon of version 1\n", assetName);
con::error("Tried to load font icon \"{}\" but did not find expected type font-icon of version 1", assetName);
return AssetCreationResult::Failure();
}
@@ -55,7 +56,7 @@ namespace
}
catch (const json::exception& e)
{
std::cerr << std::format("Failed to parse json of font icon: {}\n", e.what());
con::error("Failed to parse json of font icon: {}", e.what());
}
return AssetCreationResult::Failure();
@@ -114,7 +115,7 @@ namespace
auto* materialDependency = context.LoadDependency<AssetMaterial>(jFontIconEntry.material);
if (materialDependency == nullptr)
{
std::cerr << std::format("Failed to load material \"{}\" for font icon entry \"{}\"\n", jFontIconEntry.material, jFontIconEntry.name);
con::error("Failed to load material \"{}\" for font icon entry \"{}\"", jFontIconEntry.material, jFontIconEntry.name);
return false;
}
registration.AddDependency(materialDependency);

View File

@@ -4,6 +4,7 @@
#include "Game/T6/T6.h"
#include "Image/ImageCommon.h"
#include "Image/IwiLoader.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -40,7 +41,7 @@ namespace
const auto texture = iwi::LoadIwi(ss);
if (!texture)
{
std::cerr << std::format("Failed to load texture from: {}\n", fileName);
con::error("Failed to load texture from: {}", fileName);
return AssetCreationResult::Failure();
}

View File

@@ -1,6 +1,7 @@
#include "InfoStringToStructConverter.h"
#include "Game/T6/CommonT6.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <iostream>
@@ -83,7 +84,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (fx == nullptr)
{
std::cerr << std::format("Failed to load fx asset \"{}\"\n", value);
con::error("Failed to load fx asset \"{}\"", value);
return false;
}
@@ -105,7 +106,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (xmodel == nullptr)
{
std::cerr << std::format("Failed to load xmodel asset \"{}\"\n", value);
con::error("Failed to load xmodel asset \"{}\"", value);
return false;
}
@@ -128,7 +129,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (material == nullptr)
{
std::cerr << std::format("Failed to load material asset \"{}\"\n", value);
con::error("Failed to load material asset \"{}\"", value);
return false;
}
@@ -150,7 +151,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (physPreset == nullptr)
{
std::cerr << std::format("Failed to load physpreset asset \"{}\"\n", value);
con::error("Failed to load physpreset asset \"{}\"", value);
return false;
}
@@ -175,7 +176,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
if (tracer == nullptr)
{
std::cerr << std::format("Failed to load tracer asset \"{}\"\n", value);
con::error("Failed to load tracer asset \"{}\"", value);
return false;
}
@@ -190,7 +191,7 @@ bool InfoStringToStructConverter::ConvertBaseField(const cspField_t& field, cons
unsigned int soundAliasHash;
if (!GetHashValue(value, soundAliasHash))
{
std::cerr << std::format("Failed to parse value \"{}\" as hash\n", value);
con::error("Failed to parse value \"{}\" as hash", value);
return false;
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/Leaderboard/JsonLeaderboardDef.h"
#include "Game/T6/T6.h"
#include "Leaderboard/LeaderboardCommon.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -37,7 +38,7 @@ namespace
if (type != "leaderboard" || version != 1u)
{
std::cerr << std::format("Tried to load leaderboard \"{}\" but did not find expected type leaderboard of version 1\n", leaderboardDef.name);
con::error("Tried to load leaderboard \"{}\" but did not find expected type leaderboard of version 1", leaderboardDef.name);
return false;
}
@@ -46,7 +47,7 @@ namespace
}
catch (const json::exception& e)
{
std::cerr << std::format("Failed to parse json of leaderboard: {}\n", e.what());
con::error("Failed to parse json of leaderboard: {}", e.what());
}
return false;
@@ -149,7 +150,7 @@ namespace
const JsonLoader loader(*file.m_stream, m_memory);
if (!loader.Load(*leaderboardDef))
{
std::cerr << std::format("Failed to load leaderboard \"{}\"\n", assetName);
con::error("Failed to load leaderboard \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Game/T6/Material/JsonMaterialLoaderT6.h"
#include "Game/T6/T6.h"
#include "Material/MaterialCommon.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <iostream>
@@ -32,7 +33,7 @@ namespace
AssetRegistration<AssetMaterial> registration(assetName, material);
if (!LoadMaterialAsJson(*file.m_stream, *material, m_memory, context, registration))
{
std::cerr << std::format("Failed to load material \"{}\"\n", assetName);
con::error("Failed to load material \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -30,6 +30,7 @@
#include "StringTable/LoaderStringTableT6.h"
#include "Tracer/GdtLoaderTracerT6.h"
#include "Tracer/RawLoaderTracerT6.h"
#include "Utils/Logging/Log.h"
#include "Vehicle/GdtLoaderVehicleT6.h"
#include "Vehicle/RawLoaderVehicleT6.h"
#include "Weapon/AttachmentGdtLoaderT6.h"
@@ -62,14 +63,12 @@ namespace T6
SoundBank* ObjLoader::LoadSoundBankForZone(ISearchPath& searchPath, const std::string& soundBankFileName, Zone& zone)
{
if (ObjLoading::Configuration.Verbose)
std::cout << std::format("Trying to load sound bank '{}' for zone '{}'\n", soundBankFileName, zone.m_name);
con::debug("Trying to load sound bank '{}' for zone '{}'", soundBankFileName, zone.m_name);
auto* existingSoundBank = SoundBank::Repository.GetContainerByName(soundBankFileName);
if (existingSoundBank != nullptr)
{
if (ObjLoading::Configuration.Verbose)
std::cout << std::format("Referencing loaded sound bank '{}'.\n", soundBankFileName);
con::debug("Referencing loaded sound bank '{}'.", soundBankFileName);
SoundBank::Repository.AddContainerReference(existingSoundBank, &zone);
return existingSoundBank;
@@ -83,19 +82,18 @@ namespace T6
if (!sndBank->Initialize())
{
std::cerr << std::format("Failed to load sound bank '{}'\n", soundBankFileName);
con::error("Failed to load sound bank '{}'", soundBankFileName);
return nullptr;
}
SoundBank::Repository.AddContainer(std::move(sndBank), &zone);
if (ObjLoading::Configuration.Verbose)
std::cout << std::format("Found and loaded sound bank '{}'\n", soundBankFileName);
con::debug("Found and loaded sound bank '{}'", soundBankFileName);
return sndBankPtr;
}
std::cerr << std::format("Failed to load sound bank '{}'\n", soundBankFileName);
con::error("Failed to load sound bank '{}'", soundBankFileName);
return nullptr;
}
@@ -113,7 +111,7 @@ namespace T6
if (soundBank)
{
if (!VerifySoundBankChecksum(*soundBank, sndBankLinkedInfo))
std::cout << std::format("Checksum of sound bank does not match link time checksum for '{}'\n", soundBankFileName);
con::warn("Checksum of sound bank does not match link time checksum for '{}'", soundBankFileName);
loadedBanksForZone.emplace(soundBankFileName);
@@ -163,14 +161,12 @@ namespace T6
void ObjLoader::LoadIPakForZone(ISearchPath& searchPath, const std::string& ipakName, Zone& zone)
{
if (ObjLoading::Configuration.Verbose)
std::cout << std::format("Trying to load ipak '{}' for zone '{}'\n", ipakName, zone.m_name);
con::debug("Trying to load ipak '{}' for zone '{}'", ipakName, zone.m_name);
auto* existingIPak = IIPak::Repository.GetContainerByName(ipakName);
if (existingIPak != nullptr)
{
if (ObjLoading::Configuration.Verbose)
std::cout << std::format("Referencing loaded ipak '{}'.\n", ipakName);
con::debug("Referencing loaded ipak '{}'.", ipakName);
IIPak::Repository.AddContainerReference(existingIPak, &zone);
return;
@@ -187,12 +183,11 @@ namespace T6
{
IIPak::Repository.AddContainer(std::move(ipak), &zone);
if (ObjLoading::Configuration.Verbose)
std::cout << std::format("Found and loaded ipak '{}'.\n", ipakFilename);
con::debug("Found and loaded ipak '{}'.", ipakFilename);
}
else
{
std::cerr << std::format("Failed to load ipak '{}'!\n", ipakFilename);
con::error("Failed to load ipak '{}'!", ipakFilename);
}
}
}
@@ -209,8 +204,7 @@ namespace T6
void ObjLoader::LoadCommonIPaks(ISearchPath& searchPath, Zone& zone)
{
if (ObjLoading::Configuration.Verbose)
std::cout << std::format("Loading common ipaks for zone \"{}\"\n", zone.m_name);
con::debug("Loading common ipaks for zone \"{}\"", zone.m_name);
LoadIPakForZone(searchPath, "base", zone);
const auto& languagePrefixes = IGame::GetGameById(GameId::T6)->GetLanguagePrefixes();
@@ -219,23 +213,20 @@ namespace T6
if (IsMpZone(zone))
{
if (ObjLoading::Configuration.Verbose)
std::cout << std::format("Loading multiplayer ipaks for zone \"{}\"\n", zone.m_name);
con::debug("Loading multiplayer ipaks for zone \"{}\"", zone.m_name);
LoadIPakForZone(searchPath, "mp", zone);
LoadIPakForZone(searchPath, "so", zone);
}
else if (IsZmZone(zone))
{
if (ObjLoading::Configuration.Verbose)
std::cout << std::format("Loading zombie ipak for zone \"{}\"\n", zone.m_name);
con::debug("Loading zombie ipak for zone \"{}\"", zone.m_name);
LoadIPakForZone(searchPath, "zm", zone);
}
else
{
if (ObjLoading::Configuration.Verbose)
std::cout << std::format("Loading singleplayer ipak for zone \"{}\"\n", zone.m_name);
con::debug("Loading singleplayer ipak for zone \"{}\"", zone.m_name);
LoadIPakForZone(searchPath, "sp", zone);
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "InfoStringLoaderPhysConstraintsT6.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -31,7 +32,7 @@ namespace
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cerr << std::format("Failed to read phys constraints gdt entry: \"{}\"\n", assetName);
con::error("Failed to read phys constraints gdt entry: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Game/T6/InfoString/InfoStringToStructConverter.h"
#include "Game/T6/PhysConstraints/PhysConstraintsFields.h"
#include "Game/T6/T6.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <cstring>
@@ -101,7 +102,7 @@ namespace phys_constraints
std::extent_v<decltype(phys_constraints_fields)>);
if (!converter.Convert())
{
std::cerr << std::format("Failed to parse phys constraints: \"{}\"\n", assetName);
con::error("Failed to parse phys constraints: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -5,6 +5,7 @@
#include "InfoString/InfoString.h"
#include "InfoStringLoaderPhysConstraintsT6.h"
#include "PhysConstraints/PhysConstraintsCommon.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -33,7 +34,7 @@ namespace
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_CONSTRAINTS, *file.m_stream))
{
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "InfoStringLoaderPhysPresetT6.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -31,7 +32,7 @@ namespace
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cerr << std::format("Failed to read phys preset gdt entry: \"{}\"\n", assetName);
con::error("Failed to read phys preset gdt entry: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Game/T6/InfoString/InfoStringToStructConverter.h"
#include "Game/T6/PhysPreset/PhysPresetFields.h"
#include "Game/T6/T6.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <cassert>
@@ -87,7 +88,7 @@ namespace phys_preset
std::extent_v<decltype(phys_preset_fields)>);
if (!converter.Convert())
{
std::cerr << std::format("Failed to parse phys preset: \"{}\"\n", assetName);
con::error("Failed to parse phys preset: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -5,6 +5,7 @@
#include "InfoString/InfoString.h"
#include "InfoStringLoaderPhysPresetT6.h"
#include "PhysPreset/PhysPresetCommon.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -33,7 +34,7 @@ namespace
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET, *file.m_stream))
{
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure();
}

View File

@@ -2,6 +2,7 @@
#include "Game/T6/T6.h"
#include "Pool/GlobalAssetPool.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <filesystem>
@@ -73,7 +74,7 @@ namespace
if (ret != Z_STREAM_END)
{
std::cerr << std::format("Deflate failed for loading animtree file \"{}\"\n", assetName);
con::error("Deflate failed for loading animtree file \"{}\"", assetName);
deflateEnd(&zs);
return AssetCreationResult::Failure();
}

View File

@@ -7,6 +7,7 @@
#include "Game/T6/T6.h"
#include "ObjContainer/SoundBank/SoundBankWriter.h"
#include "Pool/GlobalAssetPool.h"
#include "Utils/Logging/Log.h"
#include "Utils/StringUtils.h"
#include <cmath>
@@ -96,14 +97,14 @@ namespace
if (!cell.AsFloat(dbsplValue))
{
const auto& colName = headerRow.HeaderNameForColumn(columnIndex);
std::cerr << std::format("Invalid value for row {} col '{}' - Must be a float\n", rowIndex + 1, colName);
con::error("Invalid value for row {} col '{}' - Must be a float", rowIndex + 1, colName);
return false;
}
if (dbsplValue < 0.0f || dbsplValue > 100.0f)
{
const auto& colName = headerRow.HeaderNameForColumn(columnIndex);
std::cerr << std::format("Invalid value for row {} col '{}' - {} [0.0, 100.0]\n", rowIndex + 1, colName, dbsplValue);
con::error("Invalid value for row {} col '{}' - {} [0.0, 100.0]", rowIndex + 1, colName, dbsplValue);
return false;
}
@@ -121,14 +122,14 @@ namespace
if (!cell.AsFloat(centsValue))
{
const auto& colName = headerRow.HeaderNameForColumn(columnIndex);
std::cerr << std::format("Invalid value for row {} col '{}' - Must be a float\n", rowIndex + 1, colName);
con::error("Invalid value for row {} col '{}' - Must be a float", rowIndex + 1, colName);
return false;
}
if (centsValue < -2400.0f || centsValue > 1200.0f)
{
const auto& colName = headerRow.HeaderNameForColumn(columnIndex);
std::cerr << std::format("Invalid value for row {} col '{}' - {} [-2400.0, 1200.0]\n", rowIndex + 1, colName, centsValue);
con::error("Invalid value for row {} col '{}' - {} [-2400.0, 1200.0]", rowIndex + 1, colName, centsValue);
return false;
}
@@ -151,14 +152,14 @@ namespace
if (!cell.AsUInt32(value32))
{
const auto& colName = headerRow.HeaderNameForColumn(columnIndex);
std::cerr << std::format("Invalid value for row {} col '{}' - Must be a uint\n", rowIndex + 1, colName);
con::error("Invalid value for row {} col '{}' - Must be a uint", rowIndex + 1, colName);
return false;
}
if (value32 < min || value32 > max)
{
const auto& colName = headerRow.HeaderNameForColumn(columnIndex);
std::cerr << std::format("Invalid value for row {} col '{}' - {} [{}, {}]\n", rowIndex + 1, colName, value32, min, max);
con::error("Invalid value for row {} col '{}' - {} [{}, {}]", rowIndex + 1, colName, value32, min, max);
return false;
}
@@ -181,14 +182,14 @@ namespace
if (!cell.AsInt32(value32))
{
const auto& colName = headerRow.HeaderNameForColumn(columnIndex);
std::cerr << std::format("Invalid value for row {} col '{}' - Must be a int\n", rowIndex + 1, colName);
con::error("Invalid value for row {} col '{}' - Must be a int", rowIndex + 1, colName);
return false;
}
if (value32 < min || value32 > max)
{
const auto& colName = headerRow.HeaderNameForColumn(columnIndex);
std::cerr << std::format("Invalid value for row {} col '{}' - {} [{}, {}]\n", rowIndex + 1, colName, value32, min, max);
con::error("Invalid value for row {} col '{}' - {} [{}, {}]", rowIndex + 1, colName, value32, min, max);
return false;
}
@@ -211,14 +212,14 @@ namespace
if (!cell.AsUInt32(value32))
{
const auto& colName = headerRow.HeaderNameForColumn(columnIndex);
std::cerr << std::format("Invalid value for row {} col '{}' - Must be a uint\n", rowIndex + 1, colName);
con::error("Invalid value for row {} col '{}' - Must be a uint", rowIndex + 1, colName);
return false;
}
if (value32 < min || value32 > max)
{
const auto& colName = headerRow.HeaderNameForColumn(columnIndex);
std::cerr << std::format("Invalid value for row {} col '{}' - {} [{}, {}]\n", rowIndex + 1, colName, value32, min, max);
con::error("Invalid value for row {} col '{}' - {} [{}, {}]", rowIndex + 1, colName, value32, min, max);
return false;
}
@@ -235,14 +236,14 @@ namespace
if (!cell.AsFloat(valueFloat))
{
const auto& colName = headerRow.HeaderNameForColumn(columnIndex);
std::cerr << std::format("Invalid value for row {} col '{}' - Must be a float\n", rowIndex + 1, colName);
con::error("Invalid value for row {} col '{}' - Must be a float", rowIndex + 1, colName);
return false;
}
if (valueFloat < 0.0f || valueFloat > 1.0f)
{
const auto& colName = headerRow.HeaderNameForColumn(columnIndex);
std::cerr << std::format("Invalid value for row {} col '{}' - {} [0.0, 1.0]\n", rowIndex + 1, colName, valueFloat);
con::error("Invalid value for row {} col '{}' - {} [0.0, 1.0]", rowIndex + 1, colName, valueFloat);
return false;
}
@@ -290,9 +291,9 @@ namespace
}
const auto& colName = headerRow.HeaderNameForColumn(columnIndex);
std::cerr << std::format("Invalid value for row {} col '{}' - {}. Must be one of:\n", rowIndex + 1, colName, cell.m_value);
con::error("Invalid value for row {} col '{}' - {}. Must be one of:", rowIndex + 1, colName, cell.m_value);
for (auto i = 0u; i < enumValueCount; i++)
std::cerr << std::format(" {}\n", enumValues[i]);
con::error(" {}", enumValues[i]);
return false;
}
@@ -341,9 +342,9 @@ namespace
if (!foundValue)
{
const auto& colName = headerRow.HeaderNameForColumn(columnIndex);
std::cerr << std::format("Invalid value for row {} col '{}' - {}. Must be one of:\n", rowIndex + 1, colName, entry);
con::error("Invalid value for row {} col '{}' - {}. Must be one of:", rowIndex + 1, colName, entry);
for (auto i = 0u; i < enumValueCount; i++)
std::cerr << std::format(" {}\n", enumValues[i]);
con::error(" {}", enumValues[i]);
return false;
}
}
@@ -648,7 +649,7 @@ namespace
SoundAliasHeaders headers;
if (!headerRow.Read(csv) || !headers.From(headerRow))
{
std::cerr << std::format("Invalid headers for aliases of sound bank {}\n", sndBank->name);
con::error("Invalid headers for aliases of sound bank {}", sndBank->name);
return false;
}
@@ -740,7 +741,7 @@ namespace
if (freeIdx == std::numeric_limits<unsigned short>::max())
{
std::cerr << "Unable to allocate sound bank alias index list\n";
con::error("Unable to allocate sound bank alias index list");
return false;
}
@@ -807,7 +808,7 @@ namespace
RadverbHeaders headers;
if (!csvHeaders.Read(csv) || !headers.From(csvHeaders))
{
std::cerr << std::format("Invalid headers for radverbs of sound bank {}\n", sndBank->name);
con::error("Invalid headers for radverbs of sound bank {}", sndBank->name);
return false;
}
@@ -867,7 +868,7 @@ namespace
const auto nameRow = headerRow.GetIndexForHeader("name");
if (!nameRow)
{
std::cerr << std::format("Missing name header for ducks of sound bank {}\n", sndBank->name);
con::error("Missing name header for ducks of sound bank {}", sndBank->name);
return false;
}
@@ -882,7 +883,7 @@ namespace
const auto duckFile = searchPath.Open(std::format("soundbank/ducks/{}.duk", name));
if (!duckFile.IsOpen())
{
std::cerr << std::format("Unable to find .duk file for {} in ducklist for sound bank {}\n", name, sndBank->name);
con::error("Unable to find .duk file for {} in ducklist for sound bank {}", name, sndBank->name);
return false;
}
@@ -944,7 +945,7 @@ namespace
{
if (assetName.find('.') == std::string::npos)
{
std::cerr << "A language must be specific in the sound bank asset name! (Ex: mpl_common.all)\n";
con::error("A language must be specific in the sound bank asset name! (Ex: mpl_common.all)");
return AssetCreationResult::Failure();
}
@@ -969,7 +970,7 @@ namespace
{
if (!LoadSoundRadverbs(m_memory, sndBank, radverbFile))
{
std::cerr << std::format("Sound bank reverbs file for {} is invalid\n", assetName);
con::error("Sound bank reverbs file for {} is invalid", assetName);
return AssetCreationResult::Failure();
}
}
@@ -979,7 +980,7 @@ namespace
{
if (!LoadSoundDuckList(m_search_path, m_memory, sndBank, duckListFile))
{
std::cerr << std::format("Sound bank ducklist file for {} is invalid\n", assetName);
con::error("Sound bank ducklist file for {} is invalid", assetName);
return AssetCreationResult::Failure();
}
}
@@ -1051,7 +1052,7 @@ namespace
}
else
{
std::cerr << std::format("Loaded sound bank for {} failed to generate. Please check your build files.\n", assetName);
con::error("Loaded sound bank for {} failed to generate. Please check your build files.", assetName);
return AssetCreationResult::Failure();
}
}
@@ -1065,7 +1066,7 @@ namespace
if (!result)
{
std::cerr << std::format("Streamed sound bank for {} failed to generate. Please check your build files.\n", assetName);
con::error("Streamed sound bank for {} failed to generate. Please check your build files.", assetName);
return AssetCreationResult::Failure();
}
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "InfoStringLoaderTracerT6.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -31,7 +32,7 @@ namespace
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cerr << std::format("Failed to read tracer gdt entry: \"{}\"\n", assetName);
con::error("Failed to read tracer gdt entry: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/T6.h"
#include "Game/T6/Tracer/TracerFields.h"
#include "Tracer/TracerCommon.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <cstring>
@@ -67,7 +68,7 @@ namespace tracer
infoString, *tracer, m_zone.m_script_strings, m_memory, context, registration, tracer_fields, std::extent_v<decltype(tracer_fields)>);
if (!converter.Convert())
{
std::cerr << std::format("Failed to parse tracer: \"{}\"\n", assetName);
con::error("Failed to parse tracer: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -5,6 +5,7 @@
#include "InfoString/InfoString.h"
#include "InfoStringLoaderTracerT6.h"
#include "Tracer/TracerCommon.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -33,7 +34,7 @@ namespace
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_TRACER, *file.m_stream))
{
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "InfoStringLoaderVehicleT6.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -31,7 +32,7 @@ namespace
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cerr << std::format("Failed to read vehicle gdt entry: \"{}\"\n", assetName);
con::error("Failed to read vehicle gdt entry: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Game/T6/InfoString/InfoStringToStructConverter.h"
#include "Game/T6/T6.h"
#include "Game/T6/Vehicle/VehicleFields.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <cstring>
@@ -37,7 +38,7 @@ namespace
if (endPtr != &value[value.size()])
{
std::cerr << std::format("Failed to parse value \"{}\" as mph\n", value);
con::error("Failed to parse value \"{}\" as mph", value);
return false;
}
@@ -51,7 +52,7 @@ namespace
if (endPtr != &value[value.size()])
{
std::cerr << std::format("Failed to parse value \"{}\" as pounds\n", value);
con::error("Failed to parse value \"{}\" as pounds", value);
return false;
}
@@ -79,7 +80,7 @@ namespace
}
*reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset) = TEAM_BAD;
std::cerr << std::format("Failed to parse value \"{}\" as team\n", value);
con::error("Failed to parse value \"{}\" as team", value);
return false;
}
@@ -127,7 +128,7 @@ namespace vehicle
infoString, *vehicleDef, m_zone.m_script_strings, m_memory, context, registration, vehicle_fields, std::extent_v<decltype(vehicle_fields)>);
if (!converter.Convert())
{
std::cerr << std::format("Failed to parse vehicle: \"{}\"\n", assetName);
con::error("Failed to parse vehicle: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "InfoStringLoaderVehicleT6.h"
#include "Utils/Logging/Log.h"
#include "Vehicle/VehicleCommon.h"
#include <cstring>
@@ -33,7 +34,7 @@ namespace
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_VEHICLE, *file.m_stream))
{
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/ObjConstantsT6.h"
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -31,7 +32,7 @@ namespace
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cerr << std::format("Failed to read attachment gdt entry: \"{}\"\n", assetName);
con::error("Failed to read attachment gdt entry: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/T6.h"
#include "Game/T6/Weapon/AttachmentFields.h"
#include "Game/T6/Weapon/WeaponStrings.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <cstring>
@@ -113,7 +114,7 @@ namespace attachment
infoString, *attachment, m_zone.m_script_strings, m_memory, context, registration, attachment_fields, std::extent_v<decltype(attachment_fields)>);
if (!converter.Convert())
{
std::cerr << std::format("Failed to parse attachment: \"{}\"\n", assetName);
con::error("Failed to parse attachment: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/ObjConstantsT6.h"
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "Utils/Logging/Log.h"
#include "Weapon/AttachmentCommon.h"
#include <cstring>
@@ -34,7 +35,7 @@ namespace
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON_ATTACHMENT, *file.m_stream))
{
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/ObjConstantsT6.h"
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -31,7 +32,7 @@ namespace
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cerr << std::format("Failed to read attachment unique gdt entry: \"{}\"\n", assetName);
con::error("Failed to read attachment unique gdt entry: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/T6.h"
#include "Game/T6/Weapon/AttachmentUniqueFields.h"
#include "Game/T6/Weapon/WeaponStrings.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <cstring>
@@ -48,13 +49,13 @@ namespace
std::vector<std::string> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse hide tags as array\n";
con::error("Failed to parse hide tags as array");
return false;
}
if (valueArray.size() > std::extent_v<decltype(WeaponFullDef::hideTags)>)
{
std::cerr << std::format("Cannot have more than {} hide tags!\n", std::extent_v<decltype(WeaponFullDef::hideTags)>);
con::error("Cannot have more than {} hide tags!", std::extent_v<decltype(WeaponFullDef::hideTags)>);
return false;
}
@@ -93,7 +94,7 @@ namespace
if (camo == nullptr)
{
std::cerr << std::format("Failed to load camo asset \"{}\"\n", value);
con::error("Failed to load camo asset \"{}\"", value);
return false;
}
@@ -143,7 +144,7 @@ namespace
std::vector<eAttachment> attachmentsFromName;
if (!attachment_unique::ExtractAttachmentsFromAssetNameT6(assetName, attachmentsFromName))
{
std::cerr << std::format("Failed to determine attachments from attachment unique name \"{}\"\n", assetName);
con::error("Failed to determine attachments from attachment unique name \"{}\"", assetName);
return false;
}
@@ -236,7 +237,7 @@ namespace attachment_unique
std::extent_v<decltype(attachment_unique_fields)>);
if (!converter.Convert())
{
std::cerr << std::format("Failed to parse attachment unique: \"{}\"\n", assetName);
con::error("Failed to parse attachment unique: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/ObjConstantsT6.h"
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "Utils/Logging/Log.h"
#include "Weapon/AttachmentUniqueCommon.h"
#include <cstring>
@@ -33,7 +34,7 @@ namespace
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON_ATTACHMENT_UNIQUE, *file.m_stream))
{
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Game/T6/Json/JsonWeaponCamo.h"
#include "Game/T6/T6.h"
#include "Pool/GlobalAssetPool.h"
#include "Utils/Logging/Log.h"
#include "Weapon/CamoCommon.h"
#include <cstring>
@@ -40,7 +41,7 @@ namespace
if (type != "weaponCamo" || version != 1u)
{
std::cerr << std::format("Tried to load weapon camo \"{}\" but did not find expected type weaponCamo of version {}\n", weaponCamo.name, 1u);
con::error("Tried to load weapon camo \"{}\" but did not find expected type weaponCamo of version {}", weaponCamo.name, 1u);
return false;
}
@@ -49,7 +50,7 @@ namespace
}
catch (const json::exception& e)
{
std::cerr << std::format("Failed to parse json of weapon camo: {}\n", e.what());
con::error("Failed to parse json of weapon camo: {}", e.what());
}
return false;
@@ -58,7 +59,7 @@ namespace
private:
static void PrintError(const WeaponCamo& weaponCamo, const std::string& message)
{
std::cerr << std::format("Cannot load weapon camo \"{}\": {}\n", weaponCamo.name, message);
con::error("Cannot load weapon camo \"{}\": {}", weaponCamo.name, message);
}
bool CreateWeaponCamoSetFromJson(const JsonWeaponCamoSet& jWeaponCamoSet, WeaponCamoSet& weaponCamoSet, const WeaponCamo& weaponCamo) const
@@ -263,7 +264,7 @@ namespace
const JsonLoader loader(*file.m_stream, m_memory, context, registration);
if (!loader.Load(*weaponCamo))
{
std::cerr << std::format("Failed to load weapon camo \"{}\"\n", assetName);
con::error("Failed to load weapon camo \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Game/T6/ObjConstantsT6.h"
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "Utils/Logging/Log.h"
#include "WeaponInfoStringLoaderT6.h"
#include <cstring>
@@ -31,7 +32,7 @@ namespace
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cerr << std::format("Failed to read weapon gdt entry: \"{}\"\n", assetName);
con::error("Failed to read weapon gdt entry: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -5,6 +5,7 @@
#include "Game/T6/T6.h"
#include "Game/T6/Weapon/WeaponFields.h"
#include "Game/T6/Weapon/WeaponStrings.h"
#include "Utils/Logging/Log.h"
#include "Weapon/AccuracyGraphLoader.h"
#include <cassert>
@@ -126,13 +127,13 @@ namespace
std::vector<std::string> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse hide tags as array\n";
con::error("Failed to parse hide tags as array");
return false;
}
if (valueArray.size() > std::extent_v<decltype(WeaponFullDef::hideTags)>)
{
std::cerr << std::format("Cannot have more than {} hide tags!\n", std::extent_v<decltype(WeaponFullDef::hideTags)>);
con::error("Cannot have more than {} hide tags!", std::extent_v<decltype(WeaponFullDef::hideTags)>);
return false;
}
@@ -183,13 +184,13 @@ namespace
std::vector<std::array<std::string, 2>> pairs;
if (!ParseAsArray(value, pairs))
{
std::cerr << "Failed to parse notetracksoundmap as pairs\n";
con::error("Failed to parse notetracksoundmap as pairs");
return false;
}
if (pairs.size() > std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>)
{
std::cerr << "Cannot have more than " << std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)> << " notetracksoundmap entries!\n";
con::error("Cannot have more than {} notetracksoundmap entries!", std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>);
return false;
}
@@ -239,7 +240,7 @@ namespace
if (camo == nullptr)
{
std::cerr << std::format("Failed to load camo asset \"{}\"\n", value);
con::error("Failed to load camo asset \"{}\"", value);
return false;
}
@@ -254,7 +255,7 @@ namespace
std::vector<std::string> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse attachments as array\n";
con::error("Failed to parse attachments as array");
return false;
}
@@ -265,7 +266,7 @@ namespace
auto* attachmentAssetInfo = m_context.ForceLoadDependency<AssetAttachment>(attachmentName);
if (attachmentAssetInfo == nullptr)
{
std::cerr << std::format("Failed to load attachment asset \"{}\"\n", attachmentName);
con::error("Failed to load attachment asset \"{}\"", attachmentName);
return false;
}
@@ -273,17 +274,17 @@ namespace
if (static_cast<unsigned>(attachmentAsset->attachmentType) >= ATTACHMENT_TYPE_COUNT)
{
std::cerr << std::format(
"Invalid attachment type {} for attachment asset \"{}\"\n", static_cast<unsigned>(attachmentAsset->attachmentType), attachmentName);
con::error(
"Invalid attachment type {} for attachment asset \"{}\"", static_cast<unsigned>(attachmentAsset->attachmentType), attachmentName);
return false;
}
if (attachments[attachmentAsset->attachmentType] != nullptr)
{
std::cerr << std::format("Already loaded attachment with same type {}: \"{}\", \"{}\"\n",
static_cast<unsigned>(attachmentAsset->attachmentType),
attachments[attachmentAsset->attachmentType]->szInternalName,
attachmentName);
con::error("Already loaded attachment with same type {}: \"{}\", \"{}\"",
static_cast<unsigned>(attachmentAsset->attachmentType),
attachments[attachmentAsset->attachmentType]->szInternalName,
attachmentName);
return false;
}
@@ -305,7 +306,7 @@ namespace
std::vector<std::string> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse attachment uniques as array\n";
con::error("Failed to parse attachment uniques as array");
return false;
}
@@ -317,7 +318,7 @@ namespace
auto* attachmentUniqueAssetInfo = m_context.ForceLoadDependency<AssetAttachmentUnique>(attachmentUniqueName);
if (attachmentUniqueAssetInfo == nullptr)
{
std::cerr << std::format("Failed to load attachment unique asset \"{}\"\n", attachmentUniqueName);
con::error("Failed to load attachment unique asset \"{}\"", attachmentUniqueName);
return false;
}
@@ -327,9 +328,8 @@ namespace
{
if (attachmentCombinationIndex >= std::extent_v<decltype(WeaponFullDef::attachmentUniques)>)
{
std::cerr << std::format(
"Cannot have more than {} combined attachment attachment unique entries!\n",
(std::extent_v<decltype(WeaponFullDef::attachmentUniques)> - std::extent_v<decltype(WeaponFullDef::attachments)>));
con::error("Cannot have more than {} combined attachment attachment unique entries!",
(std::extent_v<decltype(WeaponFullDef::attachmentUniques)> - std::extent_v<decltype(WeaponFullDef::attachments)>));
return false;
}
@@ -340,18 +340,18 @@ namespace
{
if (static_cast<unsigned>(attachmentUniqueAsset->attachmentType) >= ATTACHMENT_TYPE_COUNT)
{
std::cerr << std::format("Invalid attachment type {} for attachment unique asset \"{}\"\n",
static_cast<unsigned>(attachmentUniqueAsset->attachmentType),
attachmentUniqueName);
con::error("Invalid attachment type {} for attachment unique asset \"{}\"",
static_cast<unsigned>(attachmentUniqueAsset->attachmentType),
attachmentUniqueName);
return false;
}
if (attachmentUniques[attachmentUniqueAsset->attachmentType] != nullptr)
{
std::cerr << std::format("Already loaded attachment unique with same type {}: \"{}\", \"{}\"\n",
static_cast<unsigned>(attachmentUniqueAsset->attachmentType),
attachmentUniques[attachmentUniqueAsset->attachmentType]->szInternalName,
attachmentUniqueName);
con::error("Already loaded attachment unique with same type {}: \"{}\", \"{}\"",
static_cast<unsigned>(attachmentUniqueAsset->attachmentType),
attachmentUniques[attachmentUniqueAsset->attachmentType]->szInternalName,
attachmentUniqueName);
return false;
}
@@ -621,7 +621,7 @@ namespace weapon
infoString, *weaponFullDef, m_zone.m_script_strings, m_memory, context, registration, weapon_fields, std::extent_v<decltype(weapon_fields)>);
if (!converter.Convert())
{
std::cerr << std::format("Failed to parse weapon: \"{}\"\n", assetName);
con::error("Failed to parse weapon: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Game/T6/ObjConstantsT6.h"
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "Utils/Logging/Log.h"
#include "Weapon/WeaponCommon.h"
#include "WeaponInfoStringLoaderT6.h"
@@ -33,7 +34,7 @@ namespace
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON, *file.m_stream))
{
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "InfoStringLoaderZBarrierT6.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -31,7 +32,7 @@ namespace
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cerr << std::format("Failed to read zbarrier gdt entry: \"{}\"\n", assetName);
con::error("Failed to read zbarrier gdt entry: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -3,6 +3,7 @@
#include "Game/T6/InfoString/InfoStringToStructConverter.h"
#include "Game/T6/T6.h"
#include "Game/T6/ZBarrier/ZBarrierFields.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <cstring>
@@ -75,7 +76,7 @@ namespace z_barrier
infoString, *zbarrier, m_zone.m_script_strings, m_memory, context, registration, zbarrier_fields, std::extent_v<decltype(zbarrier_fields)>);
if (!converter.Convert())
{
std::cerr << std::format("Failed to parse zbarrier: \"{}\"\n", assetName);
con::error("Failed to parse zbarrier: \"{}\"", assetName);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "InfoStringLoaderZBarrierT6.h"
#include "Utils/Logging/Log.h"
#include "ZBarrier/ZBarrierCommon.h"
#include <cstring>
@@ -33,7 +34,7 @@ namespace
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_ZBARRIER, *file.m_stream))
{
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure();
}