2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-01-10 02:31:49 +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

@@ -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