2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-09-12 11:37:27 +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

@@ -9,6 +9,7 @@
#include "Image/IwiWriter8.h"
#include "Image/Texture.h"
#include "ImageConverterArgs.h"
#include "Utils/Logging/Log.h"
#include "Utils/StringUtils.h"
#include <assert.h>
@@ -61,7 +62,7 @@ namespace image_converter
else if (extension == EXTENSION_DDS)
ConvertDds(filePath);
else
std::cerr << std::format("Unsupported extension {}\n", extension);
con::error("Unsupported extension {}", extension);
}
bool ConvertIwi(const fs::path& iwiPath)
@@ -69,7 +70,7 @@ namespace image_converter
std::ifstream file(iwiPath, std::ios::in | std::ios::binary);
if (!file.is_open())
{
std::cerr << std::format("Failed to open input file {}\n", iwiPath.string());
con::error("Failed to open input file {}", iwiPath.string());
return false;
}
@@ -83,7 +84,7 @@ namespace image_converter
std::ofstream outFile(outPath, std::ios::out | std::ios::binary);
if (!outFile.is_open())
{
std::cerr << std::format("Failed to open output file {}\n", outPath.string());
con::error("Failed to open output file {}", outPath.string());
return false;
}
@@ -96,7 +97,7 @@ namespace image_converter
std::ifstream file(ddsPath, std::ios::in | std::ios::binary);
if (!file.is_open())
{
std::cerr << std::format("Failed to open input file {}\n", ddsPath.string());
con::error("Failed to open input file {}", ddsPath.string());
return false;
}
@@ -113,7 +114,7 @@ namespace image_converter
std::ofstream outFile(outPath, std::ios::out | std::ios::binary);
if (!outFile.is_open())
{
std::cerr << std::format("Failed to open output file {}\n", outPath.string());
con::error("Failed to open output file {}", outPath.string());
return false;
}
@@ -154,12 +155,12 @@ namespace image_converter
bool ShowGameTui()
{
std::cout << "Select the game to convert to:\n";
std::cout << " 1 - Call Of Duty 4: Modern Warfare (IW3)\n";
std::cout << " 2 - Call Of Duty: Modern Warfare 2 (IW4)\n";
std::cout << " 3 - Call Of Duty: Modern Warfare 3 (IW5)\n";
std::cout << " 4 - Call Of Duty: Black Ops (T5)\n";
std::cout << " 5 - Call Of Duty: Black Ops 2 (T6)\n";
con::info("Select the game to convert to:");
con::info(" 1 - Call Of Duty 4: Modern Warfare (IW3)");
con::info(" 2 - Call Of Duty: Modern Warfare 2 (IW4)");
con::info(" 3 - Call Of Duty: Modern Warfare 3 (IW5)");
con::info(" 4 - Call Of Duty: Black Ops (T5)");
con::info(" 5 - Call Of Duty: Black Ops 2 (T6)");
unsigned num;
std::cin >> num;
@@ -182,7 +183,7 @@ namespace image_converter
m_game_to_convert_to = Game::T6;
break;
default:
std::cerr << "Invalid input\n";
con::error("Invalid input");
return false;
}

View File

@@ -2,6 +2,7 @@
#include "GitVersion.h"
#include "Utils/Arguments/UsageInformation.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <iostream>
@@ -101,7 +102,7 @@ void ImageConverterArgs::PrintUsage()
void ImageConverterArgs::PrintVersion()
{
std::cout << std::format("OpenAssetTools ImageConverter {}\n", GIT_VERSION);
con::info("OpenAssetTools ImageConverter {}", GIT_VERSION);
}
void ImageConverterArgs::SetVerbose(const bool isVerbose)

View File

@@ -6,6 +6,7 @@
#include "ObjWriting.h"
#include "SearchPath/OutputPathFilesystem.h"
#include "SearchPath/SearchPaths.h"
#include "Utils/Logging/Log.h"
#include "Utils/ObjFileStream.h"
#include "Zone/AssetList/AssetList.h"
#include "Zone/AssetList/AssetListReader.h"
@@ -165,7 +166,7 @@ class LinkerImpl final : public Linker
if (!definitionStream.IsOpen())
{
if (logMissing)
std::cerr << std::format("Could not find zone definition file for target \"{}\".\n", targetName);
con::error("Could not find zone definition file for target \"{}\".", targetName);
return nullptr;
}
@@ -175,7 +176,7 @@ class LinkerImpl final : public Linker
if (!zoneDefinition)
{
std::cerr << std::format("Failed to read zone definition file for target \"{}\".\n", targetName);
con::error("Failed to read zone definition file for target \"{}\".", targetName);
return nullptr;
}
@@ -225,7 +226,7 @@ class LinkerImpl final : public Linker
if (!ReadIgnoreEntries(paths, ignore, context.m_definition->m_game, context.m_ignored_assets))
{
std::cerr << std::format("Failed to read asset listing for ignoring assets of project \"{}\".\n", ignore);
con::error("Failed to read asset listing for ignoring assets of project \"{}\".", ignore);
return false;
}
}
@@ -239,7 +240,7 @@ class LinkerImpl final : public Linker
const auto gdtFile = gdtSearchPath->Open(std::format("{}.gdt", gdtName));
if (!gdtFile.IsOpen())
{
std::cerr << std::format("Failed to open file for gdt \"{}\"\n", gdtName);
con::error("Failed to open file for gdt \"{}\"", gdtName);
return false;
}
@@ -247,7 +248,7 @@ class LinkerImpl final : public Linker
auto gdt = std::make_unique<Gdt>();
if (!gdtReader.Read(*gdt))
{
std::cerr << std::format("Failed to read gdt file \"{}\"\n", gdtName);
con::error("Failed to read gdt file \"{}\"", gdtName);
return false;
}
@@ -274,19 +275,19 @@ class LinkerImpl final : public Linker
const auto stream = outPath.Open(std::format("{}.ff", zone.m_name));
if (!stream)
{
std::cerr << std::format("Failed to open file for zone: {}\n", zone.m_name);
con::error("Failed to open file for zone: {}", zone.m_name);
return false;
}
std::cout << std::format("Building zone \"{}\"\n", zone.m_name);
con::info("Building zone \"{}\"", zone.m_name);
if (!ZoneWriting::WriteZone(*stream, zone))
{
std::cerr << "Writing zone failed.\n";
con::error("Writing zone failed.");
return false;
}
std::cout << std::format("Created zone \"{}\"\n", zone.m_name);
con::info("Created zone \"{}\"", zone.m_name);
return true;
}
@@ -339,7 +340,7 @@ class LinkerImpl final : public Linker
if (alreadyBuiltTargets.find(referencedTarget) == alreadyBuiltTargets.end())
{
targetsToBuild.emplace_back(referencedTarget);
std::cout << std::format("Building referenced target \"{}\"\n", referencedTarget);
con::info("Building referenced target \"{}\"", referencedTarget);
}
}
}
@@ -354,7 +355,7 @@ class LinkerImpl final : public Linker
{
if (!fs::is_regular_file(zonePath))
{
std::cerr << std::format("Could not find zone file to load \"{}\".\n", zonePath);
con::error("Could not find zone file to load \"{}\".", zonePath);
return false;
}
@@ -366,14 +367,11 @@ class LinkerImpl final : public Linker
auto zone = ZoneLoading::LoadZone(zonePath);
if (!zone)
{
std::cerr << std::format("Failed to load zone \"{}\".\n", zonePath);
con::error("Failed to load zone \"{}\".", zonePath);
return false;
}
if (m_args.m_verbose)
{
std::cout << std::format("Load zone \"{}\"\n", zone->m_name);
}
con::debug("Load zone \"{}\"", zone->m_name);
m_loaded_zones.emplace_back(std::move(zone));
}
@@ -390,8 +388,7 @@ class LinkerImpl final : public Linker
loadedZone.reset();
if (m_args.m_verbose)
std::cout << std::format("Unloaded zone \"{}\"\n", zoneName);
con::debug("Unloaded zone \"{}\"", zoneName);
}
m_loaded_zones.clear();
}
@@ -406,7 +403,7 @@ class LinkerImpl final : public Linker
}
else if (projectSpecifier.find_first_of('/', targetNameSeparatorIndex + 1) != std::string::npos)
{
std::cerr << std::format("Project specifier cannot have more than one target name: \"{}\"\n", projectSpecifier);
con::error("Project specifier cannot have more than one target name: \"{}\"", projectSpecifier);
return false;
}
else
@@ -417,13 +414,13 @@ class LinkerImpl final : public Linker
if (projectName.empty())
{
std::cerr << std::format("Project name cannot be empty: \"{}\"\n", projectSpecifier);
con::error("Project name cannot be empty: \"{}\"", projectSpecifier);
return false;
}
if (targetName.empty())
{
std::cerr << std::format("Target name cannot be empty: \"{}\"\n", projectSpecifier);
con::error("Target name cannot be empty: \"{}\"", projectSpecifier);
return false;
}

View File

@@ -5,6 +5,7 @@
#include "ObjWriting.h"
#include "Utils/Arguments/UsageInformation.h"
#include "Utils/FileUtils.h"
#include "Utils/Logging/Log.h"
#include "Utils/PathUtils.h"
#include <filesystem>
@@ -150,7 +151,7 @@ void LinkerArgs::PrintUsage() const
void LinkerArgs::PrintVersion()
{
std::cout << std::format("OpenAssetTools Linker {}\n", GIT_VERSION);
con::info("OpenAssetTools Linker {}", GIT_VERSION);
}
void LinkerArgs::SetBinFolder()

View File

@@ -3,6 +3,7 @@
#include "SearchPath/IWD.h"
#include "SearchPath/SearchPathFilesystem.h"
#include "SearchPath/SearchPaths.h"
#include "Utils/Logging/Log.h"
#include "Utils/StringUtils.h"
#include <cassert>
@@ -241,11 +242,11 @@ namespace
if (!fs::is_directory(path))
{
std::cout << std::format("Adding {} search path (Not found): {}\n", m_type_name, path);
con::debug("Adding {} search path (Not found): {}", m_type_name, path);
return false;
}
std::cout << std::format("Adding {} search path: {}\n", m_type_name, path);
con::debug("Adding {} search path: {}", m_type_name, path);
searchPaths.CommitSearchPath(std::make_unique<SearchPathFilesystem>(path));
return true;
}

View File

@@ -1,5 +1,7 @@
#include "InfoString.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <iostream>
#include <sstream>
@@ -172,13 +174,13 @@ bool InfoString::FromStream(const std::string& prefix, std::istream& stream)
std::string readPrefix;
if (!infoStream.NextField(readPrefix))
{
std::cerr << "Invalid info string: Empty\n";
con::error("Invalid info string: Empty");
return false;
}
if (prefix != readPrefix)
{
std::cerr << "Invalid info string: Prefix \"" << readPrefix << "\" did not match expected prefix \"" << prefix << "\"\n";
con::error("Invalid info string: Prefix \"{}\" did not match expected prefix \"{}\"", readPrefix, prefix);
return false;
}
@@ -188,9 +190,9 @@ bool InfoString::FromStream(const std::string& prefix, std::istream& stream)
if (key.empty())
{
if (m_keys_by_insertion.empty())
std::cerr << "Invalid info string: Got empty key at the start of the info string\n";
con::error("Invalid info string: Got empty key at the start of the info string");
else
std::cerr << "Invalid info string: Got empty key after key \"" << m_keys_by_insertion[m_keys_by_insertion.size() - 1] << "\"\n";
con::error("Invalid info string: Got empty key after key \"{}\"", m_keys_by_insertion[m_keys_by_insertion.size() - 1]);
return false;
}
@@ -198,7 +200,7 @@ bool InfoString::FromStream(const std::string& prefix, std::istream& stream)
std::string value;
if (!infoStream.NextField(value))
{
std::cerr << "Invalid info string: Unexpected eof, no value for key \"" << key << "\"\n";
con::error("Invalid info string: Unexpected eof, no value for key \"{}\"", key);
return false;
}

View File

@@ -1,5 +1,7 @@
#include "GdtStream.h"
#include "Utils/Logging/Log.h"
#include <iostream>
#include <sstream>
@@ -14,7 +16,7 @@ public:
void GdtReader::PrintError(const std::string& message) const
{
std::cout << "GDT Error at line " << m_line << ": " << message << "\n";
con::error("GDT Error at line {}: {}", m_line, message);
}
int GdtReader::PeekChar()

View File

@@ -1,5 +1,7 @@
#include "OutputPathFilesystem.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <fstream>
#include <iostream>
@@ -24,14 +26,14 @@ std::unique_ptr<std::ostream> OutputPathFilesystem::Open(const std::string& file
fs::create_directories(containingDirectory, ec);
if (ec)
{
std::cerr << std::format("Failed to create folder '{}' when try to open file '{}'\n", containingDirectory.string(), fileName);
con::error("Failed to create folder '{}' when try to open file '{}'", containingDirectory.string(), fileName);
return nullptr;
}
std::ofstream stream(fullNewPath, std::ios::binary | std::ios::out);
if (!stream.is_open())
{
std::cerr << std::format("Failed to open file '{}'\n", fileName);
con::error("Failed to open file '{}'", fileName);
return nullptr;
}

View File

@@ -1,5 +1,6 @@
#include "SearchPathFilesystem.h"
#include "Utils/Logging/Log.h"
#include "Utils/ObjFileStream.h"
#include <filesystem>
@@ -59,6 +60,6 @@ void SearchPathFilesystem::Find(const SearchPathSearchOptions& options, const st
}
catch (std::filesystem::filesystem_error& e)
{
std::cerr << std::format("Directory Iterator threw error when trying to find files: \"{}\"\n", e.what());
con::error("Directory Iterator threw error when trying to find files: \"{}\"", e.what());
}
}

View File

@@ -4,6 +4,7 @@
#include "Utils/ClassUtils.h"
#include "Utils/Endianness.h"
#include "Utils/FileUtils.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <iostream>
@@ -232,7 +233,7 @@ namespace flac
}
catch (const FlacReadingException& e)
{
std::cerr << e.what() << "\n";
con::error(e.what());
}
return false;

View File

@@ -16,6 +16,7 @@
#include "Techset/TechniqueStateMapCache.h"
#include "Techset/TechsetCommon.h"
#include "Techset/TechsetDefinitionCache.h"
#include "Utils/Logging/Log.h"
#include <cmath>
#include <cstring>
@@ -248,7 +249,7 @@ namespace
else
throw GdtReadingException("ColorMap may not be blank in particle cloud materials");
std::cout << std::format("Using particlecloud for \"{}\"\n", m_material.info.name);
con::info("Using particlecloud for \"{}\"", m_material.info.name);
}
void mtl_tools_template()
@@ -1362,7 +1363,7 @@ namespace
}
catch (const GdtReadingException& e)
{
std::cerr << std::format("Error while trying to load material from gdt: {} @ GdtEntry \"{}\"\n", e.what(), entry->m_name);
con::error("Error while trying to load material from gdt: {} @ GdtEntry \"{}\"", e.what(), entry->m_name);
}
return AssetCreationResult::Failure();

View File

@@ -13,6 +13,7 @@
#include "Techset/TechsetDefinitionCache.h"
#include "Techset/TechsetFileReader.h"
#include "Utils/Alignment.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <cassert>
@@ -103,7 +104,7 @@ namespace
if (shaderSize % sizeof(uint32_t) != 0)
{
std::cerr << std::format("Invalid shader \"{}\": Size must be dividable by {}\n", fileName, sizeof(uint32_t));
con::error("Invalid shader \"{}\": Size must be dividable by {}", fileName, sizeof(uint32_t));
return nullptr;
}

View File

@@ -2,6 +2,7 @@
#include "Game/IW4/IW4.h"
#include "Game/IW4/TechsetConstantsIW4.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -31,28 +32,28 @@ namespace
{
if (decl->streamCount >= std::extent_v<decltype(MaterialVertexStreamRouting::data)>)
{
std::cerr << std::format("Failed to add vertex decl stream. Too many abbreviations: {}\n", assetName);
con::error("Failed to add vertex decl stream. Too many abbreviations: {}", assetName);
return AssetCreationResult::Failure();
}
std::string destinationAbbreviation;
if (!NextAbbreviation(assetName, destinationAbbreviation, currentOffset))
{
std::cerr << std::format("Failed to detect vertex decl destination abbreviation: {}\n", assetName);
con::error("Failed to detect vertex decl destination abbreviation: {}", assetName);
return AssetCreationResult::Failure();
}
const auto foundSourceAbbreviation = std::ranges::find(materialStreamSourceAbbreviation, sourceAbbreviation);
if (foundSourceAbbreviation == std::end(materialStreamSourceAbbreviation))
{
std::cerr << std::format("Unknown vertex decl source abbreviation: {}\n", sourceAbbreviation);
con::error("Unknown vertex decl source abbreviation: {}", sourceAbbreviation);
return AssetCreationResult::Failure();
}
const auto foundDestinationAbbreviation = std::ranges::find(materialStreamDestinationAbbreviation, destinationAbbreviation);
if (foundDestinationAbbreviation == std::end(materialStreamDestinationAbbreviation))
{
std::cerr << std::format("Unknown vertex decl destination abbreviation: {}\n", destinationAbbreviation);
con::error("Unknown vertex decl destination abbreviation: {}", destinationAbbreviation);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "GitVersion.h"
#include "ObjContainer/IPak/IPakTypes.h"
#include "Utils/Alignment.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <cassert>
@@ -143,7 +144,7 @@ namespace
const auto openFile = m_search_path.Open(fileName);
if (!openFile.IsOpen())
{
std::cerr << std::format("Failed to open file for ipak: {}\n", fileName);
con::error("Failed to open file for ipak: {}", fileName);
return nullptr;
}
@@ -388,14 +389,14 @@ namespace image
const auto file = outPath.Open(std::format("{}.ipak", m_name));
if (!file)
{
std::cerr << std::format("Failed to open file for ipak {}\n", m_name);
con::error("Failed to open file for ipak {}", m_name);
return;
}
IPakWriter writer(*file, searchPath, m_image_names);
writer.Write();
std::cout << std::format("Created ipak {} with {} entries\n", m_name, m_image_names.size());
con::info("Created ipak {} with {} entries", m_name, m_image_names.size());
}
const std::vector<std::string>& IPakToCreate::GetImageNames() const

View File

@@ -1,6 +1,7 @@
#include "IwdCreator.h"
#include "Utils/FileToZlibWrapper.h"
#include "Utils/Logging/Log.h"
#include <chrono>
#include <format>
@@ -24,7 +25,7 @@ void IwdToCreate::Build(ISearchPath& searchPath, IOutputPath& outPath)
const auto file = outPath.Open(fileName);
if (!file)
{
std::cerr << std::format("Failed to open file for iwd {}\n", m_name);
con::error("Failed to open file for iwd {}", m_name);
return;
}
@@ -33,7 +34,7 @@ void IwdToCreate::Build(ISearchPath& searchPath, IOutputPath& outPath)
const auto zipFile = zipOpen2(fileName.c_str(), APPEND_STATUS_CREATE, nullptr, &functions);
if (!zipFile)
{
std::cerr << std::format("Failed to open file as zip for iwd {}\n", m_name);
con::error("Failed to open file as zip for iwd {}", m_name);
return;
}
@@ -42,7 +43,7 @@ void IwdToCreate::Build(ISearchPath& searchPath, IOutputPath& outPath)
auto readFile = searchPath.Open(filePath);
if (!readFile.IsOpen())
{
std::cerr << std::format("Failed to open file for iwd: {}\n", filePath);
con::error("Failed to open file for iwd: {}", filePath);
continue;
}
@@ -76,7 +77,7 @@ void IwdToCreate::Build(ISearchPath& searchPath, IOutputPath& outPath)
zipClose(zipFile, nullptr);
std::cout << std::format("Created iwd {} with {} entries\n", m_name, m_file_paths.size());
con::info("Created iwd {} with {} entries", m_name, m_file_paths.size());
}
const std::vector<std::string>& IwdToCreate::GetFilePaths() const
@@ -100,7 +101,7 @@ IwdToCreate* IwdCreator::GetOrAddIwd(const std::string& iwdName)
void IwdCreator::Finalize(ISearchPath& searchPath, IOutputPath& outPath)
{
std::cout << std::format("Writing {} iwd files to disk\n", m_iwds.size());
con::info("Writing {} iwd files to disk", m_iwds.size());
for (const auto& iwdToCreate : m_iwds)
iwdToCreate->Build(searchPath, outPath);

View File

@@ -1,5 +1,7 @@
#include "KeyValuePairsCreator.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <format>
#include <iostream>
@@ -41,7 +43,7 @@ namespace key_value_pairs
if (endPtr != &strValue[strValue.size()])
{
std::cerr << std::format("Could not parse metadata key \"{}\" as hash\n", metaData.first);
con::error("Could not parse metadata key \"{}\" as hash", metaData.first);
continue;
}

View File

@@ -3,6 +3,7 @@
#include "Image/DdsTypes.h"
#include "Utils/ClassUtils.h"
#include "Utils/FileUtils.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <iostream>
@@ -41,13 +42,13 @@ namespace dds
m_stream.read(reinterpret_cast<char*>(&magic), sizeof(magic));
if (m_stream.gcount() != sizeof(magic))
{
std::cerr << "Failed to read dds data\n";
con::error("Failed to read dds data");
return false;
}
if (magic != DDS_MAGIC)
{
std::cerr << "Invalid magic for dds\n";
con::error("Invalid magic for dds");
return false;
}
@@ -60,7 +61,7 @@ namespace dds
m_stream.read(reinterpret_cast<char*>(&headerDx10), sizeof(headerDx10));
if (m_stream.gcount() != sizeof(headerDx10))
{
std::cerr << "Failed to read dds data\n";
con::error("Failed to read dds data");
return false;
}
@@ -81,7 +82,7 @@ namespace dds
}
else
{
std::cerr << std::format("Unsupported dds resourceDimension {}\n", static_cast<unsigned>(headerDx10.resourceDimension));
con::error("Unsupported dds resourceDimension {}", static_cast<unsigned>(headerDx10.resourceDimension));
return false;
}
@@ -94,7 +95,7 @@ namespace dds
}
}
std::cerr << std::format("Unsupported dds dxgi format {}\n", static_cast<unsigned>(headerDx10.dxgiFormat));
con::error("Unsupported dds dxgi format {}", static_cast<unsigned>(headerDx10.dxgiFormat));
return false;
}
@@ -118,7 +119,7 @@ namespace dds
return ReadDxt10Header();
default:
std::cerr << std::format("Unknown dds FourCC {}\n", pf.dwFourCC);
con::error("Unknown dds FourCC {}", pf.dwFourCC);
return false;
}
}
@@ -169,8 +170,7 @@ namespace dds
}
}
std::cerr << std::format(
"Failed to find dds pixel format: R={:#x} G={:#x} B={:#x} A={:#x}\n", pf.dwRBitMask, pf.dwGBitMask, pf.dwBBitMask, pf.dwABitMask);
con::error("Failed to find dds pixel format: R={:#x} G={:#x} B={:#x} A={:#x}", pf.dwRBitMask, pf.dwGBitMask, pf.dwBBitMask, pf.dwABitMask);
return false;
}
@@ -189,7 +189,7 @@ namespace dds
m_stream.read(reinterpret_cast<char*>(&header), sizeof(header));
if (m_stream.gcount() != sizeof(header))
{
std::cerr << "Failed to read dds data\n";
con::error("Failed to read dds data");
return false;
}
@@ -249,7 +249,7 @@ namespace dds
if (m_stream.gcount() != mipSize)
{
std::cerr << "Failed to read texture data from dds\n";
con::error("Failed to read texture data from dds");
return nullptr;
}
}

View File

@@ -1,6 +1,7 @@
#include "IwiLoader.h"
#include "Image/IwiTypes.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <format>
@@ -36,10 +37,10 @@ namespace iwi
case iwi6::IwiFormat::IMG_FORMAT_WAVELET_LUMINANCE_ALPHA:
case iwi6::IwiFormat::IMG_FORMAT_WAVELET_LUMINANCE:
case iwi6::IwiFormat::IMG_FORMAT_WAVELET_ALPHA:
std::cerr << std::format("Unsupported IWI format: {}\n", format);
con::error("Unsupported IWI format: {}", format);
break;
default:
std::cerr << std::format("Unknown IWI format: {}\n", format);
con::error("Unknown IWI format: {}", format);
break;
}
@@ -84,14 +85,14 @@ namespace iwi
if (currentMipLevel < static_cast<int>(std::extent_v<decltype(iwi6::IwiHeader::fileSizeForPicmip)>)
&& currentFileSize != header.fileSizeForPicmip[currentMipLevel])
{
std::cerr << std::format("Iwi has invalid file size for picmip {}\n", currentMipLevel);
con::error("Iwi has invalid file size for picmip {}", currentMipLevel);
return nullptr;
}
stream.read(reinterpret_cast<char*>(texture->GetBufferForMipLevel(currentMipLevel)), sizeOfMipLevel);
if (stream.gcount() != sizeOfMipLevel)
{
std::cerr << std::format("Unexpected eof of iwi in mip level {}\n", currentMipLevel);
con::error("Unexpected eof of iwi in mip level {}", currentMipLevel);
return nullptr;
}
}
@@ -134,10 +135,10 @@ namespace iwi
case iwi8::IwiFormat::IMG_FORMAT_DXN_AS_LUMINANCE_ALPHA:
case iwi8::IwiFormat::IMG_FORMAT_DXT1_AS_LUMINANCE:
case iwi8::IwiFormat::IMG_FORMAT_DXT1_AS_ALPHA:
std::cerr << std::format("Unsupported IWI format: {}\n", format);
con::error("Unsupported IWI format: {}", format);
break;
default:
std::cerr << std::format("Unknown IWI format: {}\n", format);
con::error("Unknown IWI format: {}", format);
break;
}
@@ -176,12 +177,12 @@ namespace iwi
}
else if ((header.flags & iwi8::IwiFlags::IMG_FLAG_MAPTYPE_MASK) == iwi8::IwiFlags::IMG_FLAG_MAPTYPE_1D)
{
std::cerr << "Iwi has unsupported map type 1D\n";
con::error("Iwi has unsupported map type 1D");
return nullptr;
}
else
{
std::cerr << "Iwi has unsupported map type\n";
con::error("Iwi has unsupported map type");
return nullptr;
}
@@ -198,14 +199,14 @@ namespace iwi
if (currentMipLevel < static_cast<int>(std::extent_v<decltype(iwi8::IwiHeader::fileSizeForPicmip)>)
&& currentFileSize != header.fileSizeForPicmip[currentMipLevel])
{
std::cerr << std::format("Iwi has invalid file size for picmip {}\n", currentMipLevel);
con::error("Iwi has invalid file size for picmip {}", currentMipLevel);
return nullptr;
}
stream.read(reinterpret_cast<char*>(texture->GetBufferForMipLevel(currentMipLevel)), sizeOfMipLevel);
if (stream.gcount() != sizeOfMipLevel)
{
std::cerr << std::format("Unexpected eof of iwi in mip level {}\n", currentMipLevel);
con::error("Unexpected eof of iwi in mip level {}", currentMipLevel);
return nullptr;
}
}
@@ -245,10 +246,10 @@ namespace iwi
case iwi13::IwiFormat::IMG_FORMAT_BITMAP_C8:
case iwi13::IwiFormat::IMG_FORMAT_BITMAP_RGBA8:
case iwi13::IwiFormat::IMG_FORMAT_A16B16G16R16F:
std::cerr << std::format("Unsupported IWI format: {}\n", format);
con::error("Unsupported IWI format: {}", format);
break;
default:
std::cerr << std::format("Unknown IWI format: {}\n", format);
con::error("Unknown IWI format: {}", format);
break;
}
@@ -293,14 +294,14 @@ namespace iwi
if (currentMipLevel < static_cast<int>(std::extent_v<decltype(iwi13::IwiHeader::fileSizeForPicmip)>)
&& currentFileSize != header.fileSizeForPicmip[currentMipLevel])
{
std::cerr << std::format("Iwi has invalid file size for picmip {}\n", currentMipLevel);
con::error("Iwi has invalid file size for picmip {}", currentMipLevel);
return nullptr;
}
stream.read(reinterpret_cast<char*>(texture->GetBufferForMipLevel(currentMipLevel)), sizeOfMipLevel);
if (stream.gcount() != sizeOfMipLevel)
{
std::cerr << std::format("Unexpected eof of iwi in mip level {}\n", currentMipLevel);
con::error("Unexpected eof of iwi in mip level {}", currentMipLevel);
return nullptr;
}
}
@@ -342,10 +343,10 @@ namespace iwi
case iwi27::IwiFormat::IMG_FORMAT_BITMAP_RGB5A3:
case iwi27::IwiFormat::IMG_FORMAT_BITMAP_C8:
case iwi27::IwiFormat::IMG_FORMAT_BITMAP_RGBA8:
std::cerr << std::format("Unsupported IWI format: {}\n", format);
con::error("Unsupported IWI format: {}", format);
break;
default:
std::cerr << std::format("Unknown IWI format: {}\n", format);
con::error("Unknown IWI format: {}", format);
break;
}
@@ -390,14 +391,14 @@ namespace iwi
if (currentMipLevel < static_cast<int>(std::extent_v<decltype(iwi27::IwiHeader::fileSizeForPicmip)>)
&& currentFileSize != header.fileSizeForPicmip[currentMipLevel])
{
std::cerr << std::format("Iwi has invalid file size for picmip {}\n", currentMipLevel);
con::error("Iwi has invalid file size for picmip {}", currentMipLevel);
return nullptr;
}
stream.read(reinterpret_cast<char*>(texture->GetBufferForMipLevel(currentMipLevel)), sizeOfMipLevel);
if (stream.gcount() != sizeOfMipLevel)
{
std::cerr << std::format("Unexpected eof of iwi in mip level {}\n", currentMipLevel);
con::error("Unexpected eof of iwi in mip level {}", currentMipLevel);
return nullptr;
}
}
@@ -415,7 +416,7 @@ namespace iwi
if (iwiVersion.tag[0] != 'I' || iwiVersion.tag[1] != 'W' || iwiVersion.tag[2] != 'i')
{
std::cerr << "Invalid IWI magic\n";
con::error("Invalid IWI magic");
return nullptr;
}
@@ -437,7 +438,7 @@ namespace iwi
break;
}
std::cerr << std::format("Unknown IWI version {}\n", iwiVersion.version);
con::error("Unknown IWI version {}", iwiVersion.version);
return nullptr;
}
} // namespace iwi

View File

@@ -1,5 +1,7 @@
#include "AssetCreationContext.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <format>
#include <iostream>
@@ -87,7 +89,7 @@ XAssetInfoGeneric* AssetCreationContext::AddAssetGeneric(GenericAssetRegistratio
addedAsset = m_zone.m_pools->AddAsset(std::move(xAssetInfo));
if (addedAsset == nullptr)
std::cerr << std::format("Failed to add asset of type \"{}\" to pool: \"{}\"\n", *m_zone.m_pools->GetAssetTypeName(assetType), pAssetName);
con::error("Failed to add asset of type \"{}\" to pool: \"{}\"", *m_zone.m_pools->GetAssetTypeName(assetType), pAssetName);
return addedAsset;
}
@@ -97,7 +99,7 @@ XAssetInfoGeneric* AssetCreationContext::LoadDefaultAssetDependency(const asset_
if (result.HasTakenAction() && !result.HasFailed())
return result.GetAssetInfo();
std::cerr << std::format("Failed to create default asset of type {}\n", *m_zone.m_pools->GetAssetTypeName(assetType));
con::error("Failed to create default asset of type {}", *m_zone.m_pools->GetAssetTypeName(assetType));
return nullptr;
}
@@ -127,11 +129,11 @@ XAssetInfoGeneric* AssetCreationContext::LoadDependencyGeneric(const asset_type_
if (!result.HasFailed())
return result.GetAssetInfo();
std::cerr << std::format("Could not load asset \"{}\" of type \"{}\"\n", assetName, *m_zone.m_pools->GetAssetTypeName(assetType));
con::error("Could not load asset \"{}\" of type \"{}\"", assetName, *m_zone.m_pools->GetAssetTypeName(assetType));
}
else
{
std::cerr << std::format("Missing asset \"{}\" of type \"{}\"\n", assetName, *m_zone.m_pools->GetAssetTypeName(assetType));
con::error("Missing asset \"{}\" of type \"{}\"", assetName, *m_zone.m_pools->GetAssetTypeName(assetType));
}
return nullptr;
@@ -149,7 +151,7 @@ IndirectAssetReference AssetCreationContext::LoadIndirectAssetReferenceGeneric(c
const auto result = m_creators->CreateAsset(assetType, assetName, *this);
if (!result.HasTakenAction() && !result.HasFailed())
{
std::cerr << std::format("Could not load indirectly referenced asset \"{}\" of type \"{}\"\n", assetName, *m_zone.m_pools->GetAssetTypeName(assetType));
con::warn("Could not load indirectly referenced asset \"{}\" of type \"{}\"", assetName, *m_zone.m_pools->GetAssetTypeName(assetType));
}
return IndirectAssetReference(assetType, assetName);
}
@@ -185,11 +187,11 @@ XAssetInfoGeneric* AssetCreationContext::ForceLoadDependencyGeneric(const asset_
if (!result.HasFailed())
return result.GetAssetInfo();
std::cerr << std::format("Could not load asset \"{}\" of type \"{}\"\n", assetName, *m_zone.m_pools->GetAssetTypeName(assetType));
con::error("Could not load asset \"{}\" of type \"{}\"", assetName, *m_zone.m_pools->GetAssetTypeName(assetType));
}
else
{
std::cerr << std::format("Missing asset \"{}\" of type \"{}\"\n", assetName, *m_zone.m_pools->GetAssetTypeName(assetType));
con::error("Missing asset \"{}\" of type \"{}\"", assetName, *m_zone.m_pools->GetAssetTypeName(assetType));
}
return nullptr;

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();
}

View File

@@ -1,5 +1,7 @@
#include "InfoStringToStructConverterBase.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
#include <iostream>
@@ -66,7 +68,7 @@ bool InfoStringToStructConverterBase::ConvertInt(const std::string& value, const
if (endPtr != &value[value.size()])
{
std::cerr << std::format("Failed to parse value \"{}\" as int\n", value);
con::error("Failed to parse value \"{}\" as int", value);
return false;
}
@@ -80,7 +82,7 @@ bool InfoStringToStructConverterBase::ConvertUint(const std::string& value, cons
if (endPtr != &value[value.size()])
{
std::cerr << std::format("Failed to parse value \"{}\" as uint\n", value);
con::error("Failed to parse value \"{}\" as uint", value);
return false;
}
@@ -95,7 +97,7 @@ bool InfoStringToStructConverterBase::ConvertBool(const std::string& value, cons
*reinterpret_cast<bool*>(reinterpret_cast<uintptr_t>(m_structure) + offset) = intValue != 0;
if (endPtr != &value[value.size()])
{
std::cerr << std::format("Failed to parse value \"{}\" as bool\n", value);
con::error("Failed to parse value \"{}\" as bool", value);
return false;
}
@@ -110,7 +112,7 @@ bool InfoStringToStructConverterBase::ConvertQBoolean(const std::string& value,
*reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(m_structure) + offset) = intValue != 0 ? 1 : 0;
if (endPtr != &value[value.size()])
{
std::cerr << std::format("Failed to parse value \"{}\" as qboolean\n", value);
con::error("Failed to parse value \"{}\" as qboolean", value);
return false;
}
@@ -124,7 +126,7 @@ bool InfoStringToStructConverterBase::ConvertFloat(const std::string& value, con
if (endPtr != &value[value.size()])
{
std::cerr << std::format("Failed to parse value \"{}\" as float\n", value);
con::error("Failed to parse value \"{}\" as float", value);
return false;
}
@@ -138,7 +140,7 @@ bool InfoStringToStructConverterBase::ConvertMilliseconds(const std::string& val
if (endPtr != &value[value.size()])
{
std::cerr << std::format("Failed to parse value \"{}\" as milliseconds\n", value);
con::error("Failed to parse value \"{}\" as milliseconds", value);
return false;
}
@@ -176,8 +178,7 @@ bool InfoStringToStructConverterBase::ConvertEnumInt(
ss << '"' << enumValues[i] << '"';
}
ss << '\n';
std::cerr << ss.str();
con::error(ss.str());
return false;
}

View File

@@ -5,6 +5,7 @@
#include "InfoString/InfoString.h"
#include "Pool/XAssetInfo.h"
#include "Utils/ClassUtils.h"
#include "Utils/Logging/Log.h"
#include "Utils/MemoryManager.h"
#include "Zone/ZoneScriptStrings.h"
@@ -51,7 +52,7 @@ protected:
if (c == '\n' && currentEntryOffset != ARRAY_SIZE)
{
std::cerr << "Expected value but got new line\n";
con::error("Expected value but got new line");
return false;
}
@@ -89,7 +90,7 @@ protected:
const auto isLastEntry = currentEntryOffset >= (ARRAY_SIZE - 1);
if (isNextEntrySeparator != isLastEntry)
{
std::cerr << std::format("Expected {} values but got new line\n", ARRAY_SIZE);
con::error("Expected {} values but got new line", ARRAY_SIZE);
return false;
}
@@ -104,7 +105,7 @@ protected:
if (currentEntryOffset > 0)
{
std::cerr << std::format("Expected {} values but got new line\n", ARRAY_SIZE);
con::error("Expected {} values but got new line", ARRAY_SIZE);
return false;
}

View File

@@ -3,6 +3,7 @@
#include "LocalizeFileParser.h"
#include "Parsing/Impl/CommentRemovingStreamProxy.h"
#include "Parsing/Impl/ParserSingleInputStream.h"
#include "Utils/Logging/Log.h"
LocalizeFileReader::LocalizeFileReader(std::istream& stream, std::string fileName, GameLanguage language, ILocalizeFileDuplicationChecker& duplicationChecker)
: m_file_name(std::move(fileName)),
@@ -46,6 +47,6 @@ bool LocalizeFileReader::ReadLocalizeFile(std::vector<CommonLocalizeEntry>& entr
return true;
}
std::cerr << "Parsing localization file failed!\n";
con::error("Parsing localization file failed!");
return false;
}

View File

@@ -1,6 +1,7 @@
#include "SequenceLocalizeFileLanguageValue.h"
#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h"
#include "Utils/Logging/Log.h"
#include <sstream>
@@ -24,9 +25,9 @@ void SequenceLocalizeFileLanguageValue::ProcessMatch(LocalizeFileParserState* st
const auto alreadyDefinedLanguage = state->m_current_reference_languages.find(langName);
if (alreadyDefinedLanguage != state->m_current_reference_languages.end())
{
std::ostringstream str;
str << "Value for reference \"" << state->m_current_reference << "\" already defined for language \"" << langToken.IdentifierValue() << "\"";
throw ParsingException(langToken.GetPos(), str.str());
throw ParsingException(
langToken.GetPos(),
std::format("Value for reference \"{}\" already defined for language \"{}\"", state->m_current_reference, langToken.IdentifierValue()));
}
state->m_current_reference_languages.emplace(langName);
@@ -35,7 +36,7 @@ void SequenceLocalizeFileLanguageValue::ProcessMatch(LocalizeFileParserState* st
const auto& currentReference = state->m_current_reference;
if (!state->m_duplication_checker.CheckLocalizeEntryForDuplicates(currentReference))
{
std::cout << "Localize: a value for reference \"" << currentReference << "\" was already defined\n";
con::warn("Localize: a value for reference \"{}\" was already defined", currentReference);
}
state->m_entries.emplace_back(currentReference, valueToken.StringValue());

View File

@@ -38,6 +38,7 @@
#include COMMON_HEADER
#set JSON_HEADER "\"Game/" + GAME + "/Material/JsonMaterial" + GAME + ".h\""
#include JSON_HEADER
#include "Utils/Logging/Log.h"
#include <format>
#include <iostream>
@@ -72,7 +73,7 @@ namespace
if (type != "material" || version != 1u)
{
std::cerr << std::format("Tried to load material \"{}\" but did not find expected type material of version 1\n", material.info.name);
con::error("Tried to load material \"{}\" but did not find expected type material of version 1", material.info.name);
return false;
}
@@ -81,7 +82,7 @@ namespace
jRoot.at("_game").get_to(game);
if (game != GAME_LOWER)
{
std::cerr << std::format("Tried to load material \"{}\" but \"_game\" did not find expected type value {}\n", material.info.name, GAME_LOWER);
con::error("Tried to load material \"{}\" but \"_game\" did not find expected type value {}", material.info.name, GAME_LOWER);
return false;
}
#endif
@@ -91,7 +92,7 @@ namespace
}
catch (const json::exception& e)
{
std::cerr << std::format("Failed to parse json of material: {}\n", e.what());
con::error("Failed to parse json of material: {}", e.what());
}
return false;
@@ -100,7 +101,7 @@ namespace
private:
static void PrintError(const Material& material, const std::string& message)
{
std::cerr << std::format("Cannot load material \"{}\": {}\n", material.info.name, message);
con::error("Cannot load material \"{}\": {}", material.info.name, message);
}
#if defined(FEATURE_IW3) || defined(FEATURE_IW4) || defined(FEATURE_IW5)

View File

@@ -1,5 +1,7 @@
#include "AbstractMenuConverter.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <iostream>
@@ -15,15 +17,15 @@ AbstractMenuConverter::AbstractMenuConverter(const bool disableOptimizations, IS
void AbstractMenuConverter::PrintConversionExceptionDetails(const MenuConversionException& e)
{
std::cerr << "ERROR while converting menu:\n";
std::cerr << std::format(" Menu: {}\n", e.m_menu->m_name);
con::error("ERROR while converting menu:");
con::error(" Menu: {}", e.m_menu->m_name);
if (e.m_item)
{
std::cerr << std::format("Item: {}\n", e.m_item->m_name);
con::error("Item: {}", e.m_item->m_name);
}
std::cerr << std::format(" Message: {}\n", e.m_message);
con::error(" Message: {}", e.m_message);
}
const char* AbstractMenuConverter::ConvertString(const std::string& str) const

View File

@@ -2,13 +2,14 @@
#include "IPakStreamManager.h"
#include "ObjContainer/IPak/IPakTypes.h"
#include "zlib.h"
#include "Utils/Logging/Log.h"
#include <filesystem>
#include <format>
#include <iostream>
#include <memory>
#include <vector>
#include <zlib.h>
namespace fs = std::filesystem;
@@ -92,7 +93,7 @@ namespace
m_stream->read(reinterpret_cast<char*>(&indexEntry), sizeof(indexEntry));
if (m_stream->gcount() != sizeof(indexEntry))
{
std::cerr << std::format("Unexpected eof when trying to load index entry {}.\n", itemIndex);
con::error("Unexpected eof when trying to load index entry {}.", itemIndex);
return false;
}
@@ -115,7 +116,7 @@ namespace
m_stream->read(reinterpret_cast<char*>(&section), sizeof(section));
if (m_stream->gcount() != sizeof(section))
{
std::cerr << "Unexpected eof when trying to load section.\n";
con::error("Unexpected eof when trying to load section.");
return false;
}
@@ -143,19 +144,19 @@ namespace
m_stream->read(reinterpret_cast<char*>(&header), sizeof(header));
if (m_stream->gcount() != sizeof(header))
{
std::cerr << "Unexpected eof when trying to load header.\n";
con::error("Unexpected eof when trying to load header.");
return false;
}
if (header.magic != ipak_consts::IPAK_MAGIC)
{
std::cerr << std::format("Invalid ipak magic '{:#x}'.\n", header.magic);
con::error("Invalid ipak magic '{:#x}'.", header.magic);
return false;
}
if (header.version != ipak_consts::IPAK_VERSION)
{
std::cerr << std::format("Unsupported ipak version '{}'.\n", header.version);
con::error("Unsupported ipak version '{}'.", header.version);
return false;
}
@@ -167,13 +168,13 @@ namespace
if (m_index_section == nullptr)
{
std::cerr << "IPak does not contain an index section.\n";
con::error("IPak does not contain an index section.");
return false;
}
if (m_data_section == nullptr)
{
std::cerr << "IPak does not contain a data section.\n";
con::error("IPak does not contain a data section.");
return false;
}

View File

@@ -1,6 +1,7 @@
#include "IPakEntryReadStream.h"
#include "ObjContainer/IPak/IPakTypes.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <cassert>
@@ -128,7 +129,7 @@ bool IPakEntryReadStream::ValidateBlockHeader(const IPakDataBlockHeader* blockHe
{
if (blockHeader->countAndOffset.count > 31)
{
std::cerr << "IPak block has more than 31 commands: " << blockHeader->countAndOffset.count << " -> Invalid\n";
con::error("IPak block has more than 31 commands: {} -> Invalid", blockHeader->countAndOffset.count);
return false;
}
@@ -142,7 +143,7 @@ bool IPakEntryReadStream::ValidateBlockHeader(const IPakDataBlockHeader* blockHe
// The game uses IPAK_COMMAND_SKIP as value for compressed when it intends to skip the specified amount of data
if (blockHeader->commands[currentCommand].compressed == 0 || blockHeader->commands[currentCommand].compressed == 1)
{
std::cerr << "IPak block offset (" << blockHeader->countAndOffset.offset << ") is not the file head (" << m_file_head << ") -> Invalid\n";
con::error("IPak block offset ({}) is not the file head ({}) -> Invalid", blockHeader->countAndOffset.offset, m_file_head);
return false;
}
}
@@ -167,7 +168,7 @@ bool IPakEntryReadStream::AdjustChunkBufferWindowForBlockHeader(const IPakDataBl
{
if (requiredChunkCount > IPAK_CHUNK_COUNT_PER_READ)
{
std::cerr << "IPak block spans over more than " << IPAK_CHUNK_COUNT_PER_READ << " chunks (" << requiredChunkCount << "), which is not supported.\n";
con::error("IPak block spans over more than {} chunks ({}), which is not supported.", IPAK_CHUNK_COUNT_PER_READ, requiredChunkCount);
return false;
}
@@ -221,7 +222,7 @@ bool IPakEntryReadStream::ProcessCommand(const size_t commandSize, const int com
if (result != LZO_E_OK)
{
std::cerr << "Decompressing block with lzo failed: " << result << "!\n";
con::error("Decompressing block with lzo failed: {}!", result);
return false;
}

View File

@@ -1,12 +1,13 @@
#include "SoundBank.h"
#include "zlib.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
#include <memory>
#include <sstream>
#include <vector>
#include <zlib.h>
ObjContainerRepository<SoundBank, Zone> SoundBank::Repository;
@@ -130,50 +131,50 @@ bool SoundBank::ReadHeader()
m_stream->read(reinterpret_cast<char*>(&m_header), sizeof(m_header));
if (m_stream->gcount() != sizeof(m_header))
{
std::cerr << "Unexpected eof when trying to load sndbank header.\n";
con::error("Unexpected eof when trying to load sndbank header.");
return false;
}
if (m_header.magic != MAGIC)
{
std::cerr << std::format("Invalid sndbank magic 0x{:x}\n", m_header.magic);
con::error("Invalid sndbank magic 0x{:x}", m_header.magic);
return false;
}
if (m_header.version != VERSION)
{
std::cerr << std::format("Unsupported sndbank version {} (should be {})\n", m_header.version, VERSION);
con::error("Unsupported sndbank version {} (should be {})", m_header.version, VERSION);
return false;
}
if (m_header.entrySize != sizeof(SoundAssetBankEntry))
{
std::cerr << std::format("Invalid sndbank entry size 0x{:x} (should be 0x{:x})\n", m_header.entrySize, sizeof(SoundAssetBankEntry));
con::error("Invalid sndbank entry size 0x{:x} (should be 0x{:x})", m_header.entrySize, sizeof(SoundAssetBankEntry));
return false;
}
if (m_header.fileSize != m_file_size)
{
std::cerr << std::format("Invalid sndbank {} (header expects {})\n", m_file_size, m_header.fileSize);
con::error("Invalid sndbank {} (header expects {})", m_file_size, m_header.fileSize);
return false;
}
if (m_header.entryCount
&& (m_header.entryOffset <= 0 || m_header.entryOffset + sizeof(SoundAssetBankEntry) * m_header.entryCount > static_cast<size_t>(m_file_size)))
{
std::cerr << std::format("Invalid sndbank entry offset {} (filesize is {})\n", m_header.entryOffset, m_file_size);
con::error("Invalid sndbank entry offset {} (filesize is {})", m_header.entryOffset, m_file_size);
return false;
}
if (m_header.checksumOffset <= 0 || m_header.checksumOffset + sizeof(SoundAssetBankChecksum) * m_header.entryCount > static_cast<size_t>(m_file_size))
{
std::cerr << std::format("Invalid sndbank checksum offset {} (filesize is {})\n", m_header.checksumOffset, m_file_size);
con::error("Invalid sndbank checksum offset {} (filesize is {})", m_header.checksumOffset, m_file_size);
return false;
}
if (m_header.dependencyCount * m_header.dependencySize > sizeof(SoundAssetBankHeader::dependencies))
{
std::cerr << std::format("Invalid sndbank dependency sizes (count is {}; size is {})\n", m_header.dependencyCount, m_header.dependencySize);
con::error("Invalid sndbank dependency sizes (count is {}; size is {})", m_header.dependencyCount, m_header.dependencySize);
return false;
}
@@ -202,13 +203,13 @@ bool SoundBank::ReadEntries()
if (m_stream->gcount() != sizeof(entry))
{
std::cerr << std::format("Failed to read sound bank entry at index {}\n", i);
con::error("Failed to read sound bank entry at index {}", i);
return false;
}
if (entry.offset == 0 || entry.offset + entry.size >= m_file_size)
{
std::cerr << std::format("Invalid sound bank entry data offset {} (filesize is {})\n", entry.offset, m_header.fileSize);
con::error("Invalid sound bank entry data offset {} (filesize is {})", entry.offset, m_header.fileSize);
return false;
}
@@ -230,7 +231,7 @@ bool SoundBank::ReadChecksums()
if (m_stream->gcount() != sizeof(checksum))
{
std::cerr << std::format("Failed to read sound bank checksum at index {}\n", i);
con::error("Failed to read sound bank checksum at index {}", i);
return false;
}

View File

@@ -5,6 +5,7 @@
#include "Sound/FlacDecoder.h"
#include "Sound/WavTypes.h"
#include "Utils/FileUtils.h"
#include "Utils/Logging/Log.h"
#include "Utils/StringUtils.h"
#include <cstring>
@@ -201,7 +202,7 @@ public:
return true;
}
std::cerr << std::format("Unable to decode .flac file for sound {}\n", filePath);
con::error("Unable to decode .flac file for sound {}", filePath);
return false;
}
@@ -238,15 +239,14 @@ public:
if (!LoadFileByExtension(soundFilePath, sound, soundData, soundSize))
{
std::cerr << std::format("Unable to find a compatible file for sound {}\n", soundFilePath);
con::error("Unable to find a compatible file for sound {}", soundFilePath);
return false;
}
const auto lastEntry = m_entries.rbegin();
if (!sound.m_streamed && lastEntry->frameRateIndex != 6)
{
std::cout << std::format("WARNING: Loaded sound \"{}\" should have a framerate of 48000 but doesn't. This sound may not work on all games!\n",
soundFilePath);
con::warn("Loaded sound \"{}\" should have a framerate of 48000 but doesn't. This sound may not work on all games!", soundFilePath);
}
SoundAssetBankChecksum checksum{};
@@ -297,7 +297,7 @@ public:
{
if (!WriteEntries())
{
std::cerr << "An error occurred writing the sound bank entries. Please check output.\n";
con::error("An error occurred writing the sound bank entries. Please check output.");
return false;
}
@@ -311,7 +311,7 @@ public:
if (m_current_offset > UINT32_MAX)
{
std::cerr << "Sound bank files must be under 4GB. Please reduce the number of sounds being written!\n";
con::error("Sound bank files must be under 4GB. Please reduce the number of sounds being written!");
return false;
}

View File

@@ -5,6 +5,7 @@
#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h"
#include "Parsing/Simple/SimpleLexer.h"
#include "Parsing/Simple/SimpleParserValue.h"
#include "Utils/Logging/Log.h"
#include <format>
@@ -210,17 +211,17 @@ namespace graph2d
if (!parser.Parse())
{
std::cerr << std::format("Failed to parse {} \"{}\"\n", graphTypeName, graphName);
con::error("Failed to parse {} \"{}\"", graphTypeName, graphName);
return nullptr;
}
if (!parser.HasExpectedKnotCount())
{
std::cerr << std::format("Failed to load {} \"{}\": Actual knot count ({}) differs from expected ({})\n",
graphTypeName,
graphName,
parser.GetActualKnotCount(),
parser.GetExpectedKnotCount());
con::error("Failed to load {} \"{}\": Actual knot count ({}) differs from expected ({})",
graphTypeName,
graphName,
parser.GetActualKnotCount(),
parser.GetExpectedKnotCount());
return nullptr;
}

View File

@@ -8,6 +8,7 @@
#include "Parsing/Impl/ParserMultiInputStream.h"
#include "Parsing/Impl/ParserSingleInputStream.h"
#include "Parsing/Simple/SimpleLexer.h"
#include "Utils/Logging/Log.h"
using namespace menu;
@@ -65,25 +66,25 @@ bool MenuFileReader::IsValidEndState(const MenuFileParserState* state) const
{
if (state->m_current_item)
{
std::cerr << "In \"" << m_file_name << "\": Unclosed item at end of file!\n";
con::error("In \"{}\": Unclosed item at end of file!", m_file_name);
return false;
}
if (state->m_current_menu)
{
std::cerr << "In \"" << m_file_name << "\": Unclosed menu at end of file!\n";
con::error("In \"{}\": Unclosed menu at end of file!", m_file_name);
return false;
}
if (state->m_current_function)
{
std::cerr << "In \"" << m_file_name << "\": Unclosed function at end of file!\n";
con::error("In \"{}\": Unclosed function at end of file!", m_file_name);
return false;
}
if (state->m_in_global_scope)
{
std::cerr << "In \"" << m_file_name << "\": Did not close global scope!\n";
con::error("In \"{}\": Did not close global scope!", m_file_name);
return false;
}
@@ -125,11 +126,11 @@ std::unique_ptr<ParsingResult> MenuFileReader::ReadMenuFile()
if (!parser->Parse())
{
std::cerr << "Parsing menu file failed!\n";
con::error("Parsing menu file failed!");
const auto* parserEndState = parser->GetState();
if (parserEndState->m_current_event_handler_set && !parserEndState->m_permissive_mode)
std::cerr << "You can use the --menu-permissive option to try to compile the event handler script anyway.\n";
con::error("You can use the --menu-permissive option to try to compile the event handler script anyway.");
return nullptr;
}

View File

@@ -2,6 +2,7 @@
#include "ObjLoading.h"
#include "Utils/FileToZlibWrapper.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <cassert>
@@ -215,7 +216,7 @@ namespace
if (m_unz_file == nullptr)
{
std::cerr << std::format("Could not open IWD \"{}\"\n", m_path);
con::error("Could not open IWD \"{}\"", m_path);
return false;
}
@@ -239,7 +240,7 @@ namespace
ret = unzGoToNextFile(m_unz_file);
}
std::cout << std::format("Loaded IWD \"{}\" with {} entries\n", m_path, m_entry_map.size());
con::info("Loaded IWD \"{}\" with {} entries", m_path, m_entry_map.size());
return true;
}
@@ -261,7 +262,7 @@ namespace
assert(!m_has_open_file);
if (m_has_open_file)
{
std::cerr << "Trying to open new IWD file while last one was not yet closed.\n";
con::error("Trying to open new IWD file while last one was not yet closed.");
return SearchPathOpenFile();
}

View File

@@ -1,5 +1,7 @@
#include "StateMapHandler.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <cassert>
#include <iostream>
@@ -76,7 +78,7 @@ StateMapVars StateMapHandler::BuildVars(const uint32_t* baseStateBits) const
if (matchingValue != var.m_values.end())
result.AddValue(var.m_name, matchingValue->m_name);
else
std::cerr << "Could not find base value for state map var \"" << var.m_name << "\"\n";
con::error("Could not find base value for state map var \"{}\"", var.m_name);
}
return result;

View File

@@ -4,6 +4,7 @@
#include "Parsing/Impl/ParserSingleInputStream.h"
#include "Parsing/Matcher/StateMapExpressionMatchers.h"
#include "Parsing/StateMapParser.h"
#include "Utils/Logging/Log.h"
#include <iostream>
@@ -22,13 +23,13 @@ bool StateMapReader::IsValidEndState(const StateMapParserState* state) const
{
if (state->m_current_rule)
{
std::cerr << "In \"" << m_file_name << "\": Unclosed rule at end of file!\n";
con::error("In \"{}\": Unclosed rule at end of file!", m_file_name);
return false;
}
if (state->m_in_entry)
{
std::cerr << "In \"" << m_file_name << "\": Unclosed entry at end of file!\n";
con::error("In \"{}\": Unclosed entry at end of file!", m_file_name);
return false;
}
@@ -36,7 +37,7 @@ bool StateMapReader::IsValidEndState(const StateMapParserState* state) const
{
if (state->m_definition->m_state_map_entries[i].m_rules.empty())
{
std::cerr << "In \"" << m_file_name << "\": State map must define a rule for \"" << state->m_layout.m_entry_layout.m_entries[i].m_name << "\"!\n";
con::error("In \"{}\": State map must define a rule for \"{}\"!", m_file_name, state->m_layout.m_entry_layout.m_entries[i].m_name);
return false;
}
}
@@ -59,7 +60,7 @@ std::unique_ptr<StateMapDefinition> StateMapReader::ReadStateMapDefinition() con
const auto success = parser->Parse();
if (!success)
{
std::cout << "Parsing state map file \"" << m_file_name << "\" failed!\n";
con::error("Parsing state map file \"{}\" failed!", m_file_name);
return {};
}

View File

@@ -6,6 +6,7 @@
#include "Parsing/Impl/ParserMultiInputStream.h"
#include "Parsing/Impl/ParserSingleInputStream.h"
#include "StructuredDataDef/Parsing/StructuredDataDefParser.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <iostream>
@@ -54,7 +55,7 @@ std::vector<std::unique_ptr<CommonStructuredDataDef>> StructuredDataDefReader::R
if (success)
return parser->GetDefs();
std::cerr << std::format("Parsing structured data def file \"{}\" failed!\n", m_file_name);
con::error("Parsing structured data def file \"{}\" failed!", m_file_name);
return {};
}

View File

@@ -4,6 +4,7 @@
#include "Parsing/Impl/ParserSingleInputStream.h"
#include "Parsing/Simple/SimpleLexer.h"
#include "Parsing/TechniqueFileParser.h"
#include "Utils/Logging/Log.h"
#include <iostream>
@@ -33,6 +34,6 @@ bool TechniqueFileReader::ReadTechniqueDefinition() const
if (success)
return true;
std::cout << "Parsing technique file \"" << m_file_name << "\" failed!\n";
con::error("Parsing technique file \"{}\" failed!", m_file_name);
return false;
}

Some files were not shown because too many files have changed in this diff Show More