Merge pull request #19684 from hrydgard/new-log-categories

Add new log category for texture replacements
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2024-12-01 14:55:10 +01:00
commit ba01673b4f
7 files changed
+84 -84

No files matched your search

+2 -1
View File
@@ -34,7 +34,7 @@ enum class Log {
CPU,
FileSystem,
G3D,
HLE, // dumping ground that we should get rid of
HLE,
JIT,
Loader,
ME,
@@ -47,6 +47,7 @@ enum class Log {
Achievements,
HTTP,
Printf,
TexReplacement,
sceAudio,
sceCtrl,
+1
View File
@@ -104,6 +104,7 @@ static const char * const g_logTypeNames[] = {
"ACHIEVEMENTS",
"HTTP",
"PRINTF",
"TEXREPLACE",
"SCEAUDIO",
"SCECTRL",
+39 -38
View File
@@ -224,7 +224,7 @@ void ReplacedTexture::Prepare(VFSBackend *vfs) {
VFSFileReference *fileRef = vfs_->GetFile(desc_.filenames[i].c_str());
if (!fileRef) {
if (i == 0) {
INFO_LOG(Log::G3D, "Texture replacement file '%s' not found in %s", desc_.filenames[i].c_str(), vfs_->toString().c_str());
INFO_LOG(Log::TexReplacement, "Texture replacement file '%s' not found in %s", desc_.filenames[i].c_str(), vfs_->toString().c_str());
// No file at all. Mark as NOT_FOUND.
SetState(ReplacementState::NOT_FOUND);
return;
@@ -249,7 +249,7 @@ void ReplacedTexture::Prepare(VFSBackend *vfs) {
fmt = pixelFormat;
} else {
if (fmt != pixelFormat) {
ERROR_LOG(Log::G3D, "Replacement mipmap %d doesn't have the same pixel format as mipmap 0. Stopping.", i);
ERROR_LOG(Log::TexReplacement, "Replacement mipmap %d doesn't have the same pixel format as mipmap 0. Stopping.", i);
break;
}
}
@@ -263,7 +263,7 @@ void ReplacedTexture::Prepare(VFSBackend *vfs) {
// No replacement found.
std::string name = TextureReplacer::HashName(desc_.cachekey, desc_.hash, 0);
if (result == LoadLevelResult::LOAD_ERROR) {
WARN_LOG(Log::G3D, "Failed to load replacement texture '%s'", name.c_str());
WARN_LOG(Log::TexReplacement, "Failed to load replacement texture '%s'", name.c_str());
}
SetState(ReplacementState::NOT_FOUND);
return;
@@ -297,7 +297,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
}
if (!vfs_) {
ERROR_LOG(Log::G3D, "Unexpected null vfs_ pointer in LoadLevelData");
ERROR_LOG(Log::TexReplacement, "Unexpected null vfs_ pointer in LoadLevelData");
return LoadLevelResult::LOAD_ERROR;
}
@@ -326,7 +326,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
// Additional quick checks
good = good && header.layerCount <= 1;
} else if (imageType == ReplacedImageType::BASIS) {
WARN_LOG(Log::G3D, "The basis texture format is not supported. Use KTX2 (basisu texture.png -uastc -ktx2 -mipmap)");
WARN_LOG(Log::TexReplacement, "The basis texture format is not supported. Use KTX2 (basisu texture.png -uastc -ktx2 -mipmap)");
// We simply don't support basis files currently.
good = false;
@@ -339,7 +339,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
u32 format;
if (good && (header.ddspf.dwFlags & DDPF_FOURCC)) {
char *fcc = (char *)&header.ddspf.dwFourCC;
// INFO_LOG(Log::G3D, "DDS fourcc: %c%c%c%c", fcc[0], fcc[1], fcc[2], fcc[3]);
// INFO_LOG(Log::TexReplacement, "DDS fourcc: %c%c%c%c", fcc[0], fcc[1], fcc[2], fcc[3]);
if (header.ddspf.dwFourCC == MK_FOURCC("DX10")) {
ddsDX10 = true;
good = good && vfs_->Read(openFile, &header10, sizeof(header10)) == sizeof(header10);
@@ -348,7 +348,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
case 71: // DXGI_FORMAT_BC1_UNORM
case 72: // DXGI_FORMAT_BC1_UNORM_SRGB
if (!desc_.formatSupport.bc123) {
WARN_LOG(Log::G3D, "BC1 format not supported, skipping texture");
WARN_LOG(Log::TexReplacement, "BC1 format not supported, skipping texture");
good = false;
}
*pixelFormat = Draw::DataFormat::BC1_RGBA_UNORM_BLOCK;
@@ -356,7 +356,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
case 74: // DXGI_FORMAT_BC2_UNORM
case 75: // DXGI_FORMAT_BC2_UNORM_SRGB
if (!desc_.formatSupport.bc123) {
WARN_LOG(Log::G3D, "BC2 format not supported, skipping texture");
WARN_LOG(Log::TexReplacement, "BC2 format not supported, skipping texture");
good = false;
}
*pixelFormat = Draw::DataFormat::BC2_UNORM_BLOCK;
@@ -364,7 +364,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
case 77: // DXGI_FORMAT_BC3_UNORM
case 78: // DXGI_FORMAT_BC3_UNORM_SRGB
if (!desc_.formatSupport.bc123) {
WARN_LOG(Log::G3D, "BC3 format not supported, skipping texture");
WARN_LOG(Log::TexReplacement, "BC3 format not supported, skipping texture");
good = false;
}
*pixelFormat = Draw::DataFormat::BC3_UNORM_BLOCK;
@@ -372,18 +372,18 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
case 98: // DXGI_FORMAT_BC7_UNORM:
case 99: // DXGI_FORMAT_BC7_UNORM_SRGB:
if (!desc_.formatSupport.bc7) {
WARN_LOG(Log::G3D, "BC7 format not supported, skipping texture");
WARN_LOG(Log::TexReplacement, "BC7 format not supported, skipping texture");
good = false;
}
*pixelFormat = Draw::DataFormat::BC7_UNORM_BLOCK;
break;
default:
WARN_LOG(Log::G3D, "DXGI pixel format %d not supported.", header10.dxgiFormat);
WARN_LOG(Log::TexReplacement, "DXGI pixel format %d not supported.", header10.dxgiFormat);
good = false;
}
} else {
if (!desc_.formatSupport.bc123) {
WARN_LOG(Log::G3D, "BC1-3 formats not supported");
WARN_LOG(Log::TexReplacement, "BC1-3 formats not supported");
good = false;
}
format = header.ddspf.dwFourCC;
@@ -400,12 +400,12 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
*pixelFormat = Draw::DataFormat::BC3_UNORM_BLOCK;
break;
default:
ERROR_LOG(Log::G3D, "DDS pixel format not supported.");
ERROR_LOG(Log::TexReplacement, "DDS pixel format not supported.");
good = false;
}
}
} else if (good) {
ERROR_LOG(Log::G3D, "DDS non-fourCC format not supported.");
ERROR_LOG(Log::TexReplacement, "DDS non-fourCC format not supported.");
good = false;
}
@@ -433,12 +433,12 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
level.h = headerPeek.Height();
good = true;
} else {
ERROR_LOG(Log::G3D, "Could not get PNG dimensions: %s (zip)", filename.c_str());
ERROR_LOG(Log::TexReplacement, "Could not get PNG dimensions: %s (zip)", filename.c_str());
good = false;
}
*pixelFormat = Draw::DataFormat::R8G8B8A8_UNORM;
} else {
ERROR_LOG(Log::G3D, "Could not load texture replacement info: %s - unsupported format %s", filename.c_str(), magic.c_str());
ERROR_LOG(Log::TexReplacement, "Could not load texture replacement info: %s - unsupported format %s", filename.c_str(), magic.c_str());
}
// TODO: We no longer really need to have a split in this function, the upper and lower parts can be merged now.
@@ -447,7 +447,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
// If loading a low mip directly (through png most likely), check that the mipmap size is correct.
// Can't load mips of the wrong size.
if (level.w != std::max(1, (levels_[0].w >> mipLevel)) || level.h != std::max(1, (levels_[0].h >> mipLevel))) {
WARN_LOG(Log::G3D, "Replacement mipmap invalid: size=%dx%d, expected=%dx%d (level %d)",
WARN_LOG(Log::TexReplacement, "Replacement mipmap invalid: size=%dx%d, expected=%dx%d (level %d)",
level.w, level.h, levels_[0].w >> mipLevel, levels_[0].h >> mipLevel, mipLevel);
good = false;
}
@@ -471,7 +471,8 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
basist::ktx2_transcoder transcoder;
if (!transcoder.init(buffer.data(), (int)buffer.size())) {
WARN_LOG(Log::G3D, "Error reading KTX file");
WARN_LOG(Log::TexReplacement, "Error reading KTX file");
vfs_->CloseFile(openFile);
return LoadLevelResult::LOAD_ERROR;
}
@@ -489,7 +490,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
*pixelFormat = Draw::DataFormat::ETC2_R8G8B8_UNORM_BLOCK;
} else {
// Transcode to RGBA8 instead as a fallback. A bit slow and takes a lot of memory, but better than nothing.
WARN_LOG(Log::G3D, "Replacement texture format not supported - transcoding to RGBA8888");
WARN_LOG(Log::TexReplacement, "Replacement texture format not supported - transcoding to RGBA8888");
transcoderFormat = basist::transcoder_texture_format::cTFRGBA32;
*pixelFormat = Draw::DataFormat::R8G8B8A8_UNORM;
}
@@ -505,12 +506,13 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
*pixelFormat = Draw::DataFormat::ASTC_4x4_UNORM_BLOCK;
} else {
// Transcode to RGBA8 instead as a fallback. A bit slow and takes a lot of memory, but better than nothing.
WARN_LOG(Log::G3D, "Replacement texture format not supported - transcoding to RGBA8888");
WARN_LOG(Log::TexReplacement, "Replacement texture format not supported - transcoding to RGBA8888");
transcoderFormat = basist::transcoder_texture_format::cTFRGBA32;
*pixelFormat = Draw::DataFormat::R8G8B8A8_UNORM;
}
} else {
WARN_LOG(Log::G3D, "PPSSPP currently only supports KTX for basis/UASTC textures. This may change in the future.");
WARN_LOG(Log::TexReplacement, "PPSSPP currently only supports KTX for basis/UASTC textures. This may change in the future.");
vfs_->CloseFile(openFile);
return LoadLevelResult::LOAD_ERROR;
}
@@ -519,7 +521,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
_dbg_assert_(bc || *pixelFormat == Draw::DataFormat::R8G8B8A8_UNORM);
if (bc && ((level.w & 3) != 0 || (level.h & 3) != 0)) {
WARN_LOG(Log::G3D, "Block compressed replacement texture '%s' not divisible by 4x4 (%dx%d). In D3D11 (only!) we will have to expand (potentially causing glitches).", filename.c_str(), level.w, level.h);
WARN_LOG(Log::TexReplacement, "Block compressed replacement texture '%s' not divisible by 4x4 (%dx%d). In D3D11 (only!) we will have to expand (potentially causing glitches).", filename.c_str(), level.w, level.h);
}
data_.resize(numMips);
@@ -573,7 +575,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
_dbg_assert_(bc);
if (bc && ((level.w & 3) != 0 || (level.h & 3) != 0)) {
WARN_LOG(Log::G3D, "Block compressed replacement texture '%s' not divisible by 4x4 (%dx%d). In D3D11 (only!) we will have to expand (potentially causing glitches).", filename.c_str(), level.w, level.h);
WARN_LOG(Log::TexReplacement, "Block compressed replacement texture '%s' not divisible by 4x4 (%dx%d). In D3D11 (only!) we will have to expand (potentially causing glitches).", filename.c_str(), level.w, level.h);
}
data_.resize(numMips);
@@ -588,7 +590,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
size_t read_bytes = vfs_->Read(openFile, &out[0], bytesToRead);
if (read_bytes != bytesToRead) {
WARN_LOG(Log::G3D, "DDS: Expected %d bytes, got %d", bytesToRead, (int)read_bytes);
WARN_LOG(Log::TexReplacement, "DDS: Expected %d bytes, got %d", bytesToRead, (int)read_bytes);
}
levels_.push_back(level);
@@ -605,13 +607,13 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
auto zim = std::make_unique<uint8_t[]>(fileSize);
if (!zim) {
ERROR_LOG(Log::G3D, "Failed to allocate memory for texture replacement");
ERROR_LOG(Log::TexReplacement, "Failed to allocate memory for texture replacement");
vfs_->CloseFile(openFile);
return LoadLevelResult::LOAD_ERROR;
}
if (vfs_->Read(openFile, &zim[0], fileSize) != fileSize) {
ERROR_LOG(Log::G3D, "Could not load texture replacement: %s - failed to read ZIM", filename.c_str());
ERROR_LOG(Log::TexReplacement, "Could not load texture replacement: %s - failed to read ZIM", filename.c_str());
vfs_->CloseFile(openFile);
return LoadLevelResult::LOAD_ERROR;
}
@@ -623,7 +625,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
// TODO: Zim files can actually hold mipmaps (although no tool has ever been made to create them :P)
if (LoadZIMPtr(&zim[0], fileSize, &w, &h, &f, &image)) {
if (w > level.w || h > level.h) {
ERROR_LOG(Log::G3D, "Texture replacement changed since header read: %s", filename.c_str());
ERROR_LOG(Log::TexReplacement, "Texture replacement changed since header read: %s", filename.c_str());
return LoadLevelResult::LOAD_ERROR;
}
@@ -655,17 +657,15 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
std::string pngdata;
pngdata.resize(fileSize);
pngdata.resize(vfs_->Read(openFile, &pngdata[0], fileSize));
vfs_->CloseFile(openFile);
if (!png_image_begin_read_from_memory(&png, &pngdata[0], pngdata.size())) {
ERROR_LOG(Log::G3D, "Could not load texture replacement info: %s - %s (zip)", filename.c_str(), png.message);
vfs_->CloseFile(openFile);
ERROR_LOG(Log::TexReplacement, "Could not load texture replacement info: %s - %s (zip)", filename.c_str(), png.message);
return LoadLevelResult::LOAD_ERROR;
}
if (png.width > (uint32_t)level.w || png.height > (uint32_t)level.h) {
ERROR_LOG(Log::G3D, "Texture replacement changed since header read: %s", filename.c_str());
vfs_->CloseFile(openFile);
ERROR_LOG(Log::TexReplacement, "Texture replacement changed since header read: %s", filename.c_str());
return LoadLevelResult::LOAD_ERROR;
}
vfs_->CloseFile(openFile);
bool checkedAlpha = false;
if ((png.format & PNG_FORMAT_FLAG_ALPHA) == 0) {
@@ -681,7 +681,8 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
// TODO: Should probably try to handle out-of-memory gracefully here.
out.resize(level.w * level.h * 4);
if (!png_image_finish_read(&png, nullptr, &out[0], level.w * 4, nullptr)) {
ERROR_LOG(Log::G3D, "Could not load texture replacement: %s - %s", filename.c_str(), png.message);
ERROR_LOG(Log::TexReplacement, "Could not load texture replacement: %s - %s", filename.c_str(), png.message);
vfs_->CloseFile(openFile);
out.resize(0);
return LoadLevelResult::LOAD_ERROR;
}
@@ -698,7 +699,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference
levels_.push_back(level);
return LoadLevelResult::CONTINUE;
} else {
WARN_LOG(Log::G3D, "Don't know how to load this image type! %d", (int)imageType);
WARN_LOG(Log::TexReplacement, "Don't know how to load this image type! %d", (int)imageType);
vfs_->CloseFile(openFile);
}
return LoadLevelResult::LOAD_ERROR;
@@ -709,7 +710,7 @@ bool ReplacedTexture::CopyLevelTo(int level, uint8_t *out, size_t outDataSize, i
_assert_msg_(out != nullptr && rowPitch > 0, "Invalid out/pitch");
if (State() != ReplacementState::ACTIVE) {
WARN_LOG(Log::G3D, "Init not done yet");
WARN_LOG(Log::TexReplacement, "Init not done yet");
return false;
}
@@ -727,7 +728,7 @@ bool ReplacedTexture::CopyLevelTo(int level, uint8_t *out, size_t outDataSize, i
const std::vector<uint8_t> &data = data_[level];
if (data.empty()) {
WARN_LOG(Log::G3D, "Level %d is empty", level);
WARN_LOG(Log::TexReplacement, "Level %d is empty", level);
return false;
}
@@ -736,12 +737,12 @@ bool ReplacedTexture::CopyLevelTo(int level, uint8_t *out, size_t outDataSize, i
int blockSize;
if (!Draw::DataFormatIsBlockCompressed(fmt, &blockSize)) {
if (fmt != Draw::DataFormat::R8G8B8A8_UNORM) {
ERROR_LOG(Log::G3D, "Unexpected linear data format");
ERROR_LOG(Log::TexReplacement, "Unexpected linear data format");
return false;
}
if (rowPitch < info.w * 4) {
ERROR_LOG(Log::G3D, "Replacement rowPitch=%d, but w=%d (level=%d) (too small)", rowPitch, info.w * 4, level);
ERROR_LOG(Log::TexReplacement, "Replacement rowPitch=%d, but w=%d (level=%d) (too small)", rowPitch, info.w * 4, level);
return false;
}
-4
View File
@@ -22,7 +22,6 @@
#include "Common/File/VFS/VFS.h"
#include "Common/GPU/thin3d.h"
#include "Common/Log.h"
#include "Core/ConfigValues.h"
class TextureReplacer;
@@ -121,9 +120,6 @@ public:
void SetState(ReplacementState state) {
_dbg_assert_(state != state_);
#ifdef _DEBUG
// WARN_LOG(Log::G3D, "Texture %s changed state from %s to %s", logId_.c_str(), StateString(state_), StateString(state));
#endif
state_ = state;
}
+36 -35
View File
@@ -88,7 +88,7 @@ void TextureReplacer::NotifyConfigChanged() {
// If we're saving, auto-create the directory.
if (saveEnabled_ && !File::Exists(newTextureDir_)) {
INFO_LOG(Log::G3D, "Creating new texture directory: '%s'", newTextureDir_.ToVisualString().c_str());
INFO_LOG(Log::TexReplacement, "Creating new texture directory: '%s'", newTextureDir_.ToVisualString().c_str());
File::CreateFullPath(newTextureDir_);
// We no longer create a nomedia file here, since we put one
// in the TEXTURES root.
@@ -140,7 +140,7 @@ bool TextureReplacer::LoadIni(std::string *error) {
// First, check for textures.zip, which is used to reduce IO.
VFSBackend *dir = ZipFileReader::Create(zipPath, "", false);
if (!dir) {
INFO_LOG(Log::G3D, "%s wasn't a zip file - opening the directory %s instead.", zipPath.c_str(), basePath_.c_str());
INFO_LOG(Log::TexReplacement, "%s wasn't a zip file - opening the directory %s instead.", zipPath.c_str(), basePath_.c_str());
vfsIsZip_ = false;
dir = new DirectoryReader(basePath_);
} else {
@@ -164,14 +164,14 @@ bool TextureReplacer::LoadIni(std::string *error) {
iniLoaded = overrideIni.LoadFromVFS(*dir, overrideFilename);
if (!iniLoaded) {
*error = "Loading override ini failed: " + overrideFilename;
ERROR_LOG(Log::G3D, "Failed to load extra texture ini: %s", overrideFilename.c_str());
ERROR_LOG(Log::TexReplacement, "Failed to load extra texture ini: %s", overrideFilename.c_str());
// Since this error is most likely to occure for texture pack creators, let's just bail here
// so that the creator is more likely to look in the logs for what happened.
delete dir;
return false;
}
INFO_LOG(Log::G3D, "Loading extra texture ini: %s", overrideFilename.c_str());
INFO_LOG(Log::TexReplacement, "Loading extra texture ini: %s", overrideFilename.c_str());
if (!LoadIniValues(overrideIni, nullptr, true, error)) {
*error = "Override: " + *error;
delete dir;
@@ -182,18 +182,18 @@ bool TextureReplacer::LoadIni(std::string *error) {
} else {
if (vfsIsZip_) {
// We don't accept zip files without inis.
ERROR_LOG(Log::G3D, "Texture pack lacking ini file: %s", basePath_.c_str());
ERROR_LOG(Log::TexReplacement, "Texture pack lacking ini file: %s", basePath_.c_str());
*error = "Zip files without ini files will not load";
delete dir;
return false;
} else {
WARN_LOG(Log::G3D, "Texture pack lacking ini file: %s Proceeding with only hash-named textures in the root.", basePath_.c_str());
WARN_LOG(Log::TexReplacement, "Texture pack lacking ini file: %s Proceeding with only hash-named textures in the root.", basePath_.c_str());
// Do what we can do anyway: Scan for textures and build the map.
std::map<ReplacementCacheKey, std::map<int, std::string>> filenameMap;
ScanForHashNamedFiles(dir, filenameMap);
if (filenameMap.empty()) {
WARN_LOG(Log::G3D, "No replacement textures found.");
WARN_LOG(Log::TexReplacement, "No replacement textures found.");
return false;
}
@@ -213,9 +213,9 @@ bool TextureReplacer::LoadIni(std::string *error) {
}
if (vfsIsZip_) {
INFO_LOG(Log::G3D, "Texture pack activated from '%s'", (basePath_ / ZIP_FILENAME).c_str());
INFO_LOG(Log::TexReplacement, "Texture pack activated from '%s'", (basePath_ / ZIP_FILENAME).c_str());
} else {
INFO_LOG(Log::G3D, "Texture pack activated from '%s'", basePath_.c_str());
INFO_LOG(Log::TexReplacement, "Texture pack activated from '%s'", basePath_.c_str());
}
// The ini doesn't have to exist for the texture directory or zip to be valid.
@@ -243,7 +243,7 @@ void TextureReplacer::ScanForHashNamedFiles(VFSBackend *dir, std::map<Replacemen
ReplacementCacheKey key(0, 0);
int level = 0; // sscanf might fail to pluck the level, but that's ok, we default to 0. sscanf doesn't write to non-matched outputs.
if (sscanf(hash.c_str(), "%16llx%8x_%d", &key.cachekey, &key.hash, &level) >= 1) {
// INFO_LOG(Log::G3D, "hash-like file in root, adding: %s", file.name.c_str());
// INFO_LOG(Log::TexReplacement, "hash-like file in root, adding: %s", file.name.c_str());
filenameMap[key][level] = file.name;
}
}
@@ -259,7 +259,7 @@ void TextureReplacer::ComputeAliasMap(const std::map<ReplacementCacheKey, std::m
alias += level.second + "|";
mipIndex++;
} else {
WARN_LOG(Log::G3D, "Non-sequential mip index %d, breaking. filenames=%s", level.first, level.second.c_str());
WARN_LOG(Log::TexReplacement, "Non-sequential mip index %d, breaking. filenames=%s", level.first, level.second.c_str());
break;
}
}
@@ -303,17 +303,17 @@ bool TextureReplacer::LoadIniValues(IniFile &ini, VFSBackend *dir, bool isOverri
options->Get("ignoreMipmap", &ignoreMipmap_, ignoreMipmap_);
if (reduceHash_ && hash_ == ReplacedTextureHash::QUICK) {
reduceHash_ = false;
ERROR_LOG(Log::G3D, "Texture Replacement: reduceHash option requires safer hash, use xxh32 or xxh64 instead.");
ERROR_LOG(Log::TexReplacement, "Texture Replacement: reduceHash option requires safer hash, use xxh32 or xxh64 instead.");
}
if (ignoreAddress_ && hash_ == ReplacedTextureHash::QUICK) {
ignoreAddress_ = false;
ERROR_LOG(Log::G3D, "Texture Replacement: ignoreAddress option requires safer hash, use xxh32 or xxh64 instead.");
ERROR_LOG(Log::TexReplacement, "Texture Replacement: ignoreAddress option requires safer hash, use xxh32 or xxh64 instead.");
}
int version = 0;
if (options->Get("version", &version, 0) && version > VERSION) {
ERROR_LOG(Log::G3D, "Unsupported texture replacement version %d, trying anyway", version);
ERROR_LOG(Log::TexReplacement, "Unsupported texture replacement version %d, trying anyway", version);
}
int badFileNameCount = 0;
@@ -359,9 +359,9 @@ bool TextureReplacer::LoadIniValues(IniFile &ini, VFSBackend *dir, bool isOverri
}
}
} else if (k.empty()) {
INFO_LOG(Log::G3D, "Ignoring [hashes] line with empty key: '= %s'", v.c_str());
INFO_LOG(Log::TexReplacement, "Ignoring [hashes] line with empty key: '= %s'", v.c_str());
} else {
ERROR_LOG(Log::G3D, "Unsupported syntax under [hashes], ignoring: %s = ", k.c_str());
ERROR_LOG(Log::TexReplacement, "Unsupported syntax under [hashes], ignoring: %s = ", k.c_str());
}
}
}
@@ -372,7 +372,7 @@ bool TextureReplacer::LoadIniValues(IniFile &ini, VFSBackend *dir, bool isOverri
if (badFileNameCount > 0) {
auto err = GetI18NCategory(I18NCat::ERRORS);
g_OSD.Show(OSDType::MESSAGE_WARNING, err->T("textures.ini filenames may not be cross - platform(banned characters)"), badFilenames, 6.0f);
WARN_LOG(Log::G3D, "Potentially bad filenames: %s", badFilenames.c_str());
WARN_LOG(Log::TexReplacement, "Potentially bad filenames: %s", badFilenames.c_str());
}
if (ini.HasSection("hashranges")) {
@@ -409,7 +409,7 @@ void TextureReplacer::ParseHashRange(const std::string &key, const std::string &
SplitString(value, ',', valueParts);
if (keyParts.size() != 3 || valueParts.size() != 2) {
ERROR_LOG(Log::G3D, "Ignoring invalid hashrange %s = %s, expecting addr,w,h = w,h", key.c_str(), value.c_str());
ERROR_LOG(Log::TexReplacement, "Ignoring invalid hashrange %s = %s, expecting addr,w,h = w,h", key.c_str(), value.c_str());
return;
}
@@ -422,19 +422,19 @@ void TextureReplacer::ParseHashRange(const std::string &key, const std::string &
u32 fromW;
u32 fromH;
if (!TryParse(keyParts[0], &addr) || !TryParse(keyParts[1], &fromW) || !TryParse(keyParts[2], &fromH)) {
ERROR_LOG(Log::G3D, "Ignoring invalid hashrange %s = %s, key format is 0x12345678,512,512", key.c_str(), value.c_str());
ERROR_LOG(Log::TexReplacement, "Ignoring invalid hashrange %s = %s, key format is 0x12345678,512,512", key.c_str(), value.c_str());
return;
}
u32 toW;
u32 toH;
if (!TryParse(valueParts[0], &toW) || !TryParse(valueParts[1], &toH)) {
ERROR_LOG(Log::G3D, "Ignoring invalid hashrange %s = %s, value format is 512,512", key.c_str(), value.c_str());
ERROR_LOG(Log::TexReplacement, "Ignoring invalid hashrange %s = %s, value format is 512,512", key.c_str(), value.c_str());
return;
}
if (toW > fromW || toH > fromH) {
ERROR_LOG(Log::G3D, "Ignoring invalid hashrange %s = %s, range bigger than source", key.c_str(), value.c_str());
ERROR_LOG(Log::TexReplacement, "Ignoring invalid hashrange %s = %s, range bigger than source", key.c_str(), value.c_str());
return;
}
@@ -452,10 +452,10 @@ void TextureReplacer::ParseFiltering(const std::string &key, const std::string &
} else if (!strcasecmp(value.c_str(), "auto")) {
filtering_[itemKey] = TEX_FILTER_AUTO;
} else {
ERROR_LOG(Log::G3D, "Unsupported syntax under [filtering]: %s", value.c_str());
ERROR_LOG(Log::TexReplacement, "Unsupported syntax under [filtering]: %s", value.c_str());
}
} else {
ERROR_LOG(Log::G3D, "Unsupported syntax under [filtering]: %s", key.c_str());
ERROR_LOG(Log::TexReplacement, "Unsupported syntax under [filtering]: %s", key.c_str());
}
}
@@ -466,25 +466,25 @@ void TextureReplacer::ParseReduceHashRange(const std::string& key, const std::st
SplitString(value, ',', valueParts);
if (keyParts.size() != 2 || valueParts.size() != 1) {
ERROR_LOG(Log::G3D, "Ignoring invalid reducehashrange %s = %s, expecting w,h = reducehashvalue", key.c_str(), value.c_str());
ERROR_LOG(Log::TexReplacement, "Ignoring invalid reducehashrange %s = %s, expecting w,h = reducehashvalue", key.c_str(), value.c_str());
return;
}
u32 forW;
u32 forH;
if (!TryParse(keyParts[0], &forW) || !TryParse(keyParts[1], &forH)) {
ERROR_LOG(Log::G3D, "Ignoring invalid reducehashrange %s = %s, key format is 512,512", key.c_str(), value.c_str());
ERROR_LOG(Log::TexReplacement, "Ignoring invalid reducehashrange %s = %s, key format is 512,512", key.c_str(), value.c_str());
return;
}
float rhashvalue;
if (!TryParse(valueParts[0], &rhashvalue)) {
ERROR_LOG(Log::G3D, "Ignoring invalid reducehashrange %s = %s, value format is 0.5", key.c_str(), value.c_str());
ERROR_LOG(Log::TexReplacement, "Ignoring invalid reducehashrange %s = %s, value format is 0.5", key.c_str(), value.c_str());
return;
}
if (rhashvalue == 0) {
ERROR_LOG(Log::G3D, "Ignoring invalid hashrange %s = %s, reducehashvalue can't be 0", key.c_str(), value.c_str());
ERROR_LOG(Log::TexReplacement, "Ignoring invalid hashrange %s = %s, reducehashvalue can't be 0", key.c_str(), value.c_str());
return;
}
@@ -601,7 +601,7 @@ ReplacedTexture *TextureReplacer::FindReplacement(u64 cachekey, u32 hash, int w,
// Early-out for ignored textures, let's not bother even starting a thread task.
if (ignored) {
// WARN_LOG(Log::G3D, "Not found/ignored: %s (%d, %d)", hashfiles.c_str(), (int)foundReplacement, (int)ignored);
// WARN_LOG(Log::TexReplacement, "Not found/ignored: %s (%d, %d)", hashfiles.c_str(), (int)foundReplacement, (int)ignored);
// Insert an entry into the cache for faster lookup next time.
ReplacedTextureRef ref{};
cache_.emplace(std::make_pair(replacementKey, ref));
@@ -664,7 +664,7 @@ ReplacedTexture *TextureReplacer::FindReplacement(u64 cachekey, u32 hash, int w,
static bool WriteTextureToPNG(png_imagep image, const Path &filename, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap) {
FILE *fp = File::OpenCFile(filename, "wb");
if (!fp) {
ERROR_LOG(Log::IO, "Unable to open texture file '%s' for writing.", filename.c_str());
ERROR_LOG(Log::TexReplacement, "Save texture: Unable to open texture file '%s' for writing.", filename.c_str());
return false;
}
@@ -672,7 +672,8 @@ static bool WriteTextureToPNG(png_imagep image, const Path &filename, int conver
fclose(fp);
return true;
} else {
ERROR_LOG(Log::System, "Texture PNG encode failed.");
// This shouldn't really happen.
ERROR_LOG(Log::TexReplacement, "Texture PNG encode failed.");
fclose(fp);
remove(filename.c_str());
return false;
@@ -736,11 +737,11 @@ public:
bool success = WriteTextureToPNG(&png, saveFilename, 0, rgbaData, w * 4, nullptr);
png_image_free(&png);
if (png.warning_or_error >= 2) {
ERROR_LOG(Log::G3D, "Saving texture to PNG produced errors.");
ERROR_LOG(Log::TexReplacement, "Saving texture to PNG produced errors.");
} else if (success) {
NOTICE_LOG(Log::G3D, "Saving texture for replacement: %08x / %dx%d in '%s'", replacedInfoHash, w, h, saveFilename.ToVisualString().c_str());
NOTICE_LOG(Log::TexReplacement, "Saving texture for replacement: %08x / %dx%d in '%s'", replacedInfoHash, w, h, saveFilename.ToVisualString().c_str());
} else {
ERROR_LOG(Log::G3D, "Failed to write '%s'", saveFilename.c_str());
ERROR_LOG(Log::TexReplacement, "Failed to write '%s'", saveFilename.c_str());
}
}
};
@@ -826,7 +827,7 @@ void TextureReplacer::NotifyTextureDecoded(ReplacedTexture *texture, const Repla
size_t saveBufSize = w * h * 4;
u8 *saveBuf = (u8 *)malloc(saveBufSize);
if (!saveBuf) {
ERROR_LOG(Log::G3D, "Failed to allocated %d bytes of memory for saving a texture", (int)saveBufSize);
ERROR_LOG(Log::TexReplacement, "Failed to allocated %d bytes of memory for saving a texture", (int)saveBufSize);
return;
}
@@ -883,7 +884,7 @@ void TextureReplacer::Decimate(ReplacerDecimateMode mode) {
double totalSizeGB = totalSize / (1024.0 * 1024.0 * 1024.0);
if (totalSizeGB >= 1.0) {
WARN_LOG(Log::G3D, "Decimated replacements older than %fs, currently using %f GB of RAM", age, totalSizeGB);
WARN_LOG(Log::TexReplacement, "Decimated replacements older than %fs, currently using %f GB of RAM", age, totalSizeGB);
}
lastTextureCacheSizeGB_ = totalSizeGB;
}
+1 -1
View File
@@ -558,7 +558,7 @@ void SoundEffectMixer::LoadDefaultSample(UI::UISound sound) {
}
Sample *sample = Sample::Load(filename);
if (!sample) {
ERROR_LOG(Log::System, "Failed to load the default sample for UI sound %d", (int)sound);
ERROR_LOG(Log::Audio, "Failed to load the default sample for UI sound %d", (int)sound);
}
std::lock_guard<std::mutex> guard(mutex_);
samples_[(size_t)sound] = std::unique_ptr<Sample>(sample);
+5 -5
View File
@@ -338,7 +338,7 @@ void ImDisasmView::Draw(ImDrawList *drawList) {
const bool is_active = ImGui::IsItemActive(); // Held
if (pressed) {
INFO_LOG(Log::System, "Pressed");
// INFO_LOG(Log::System, "Pressed");
}
ImGui::SetItemKeyOwner(ImGuiKey_MouseWheelY);
@@ -437,7 +437,7 @@ void ImDisasmView::Draw(ImDrawList *drawList) {
ImGuiIO& io = ImGui::GetIO();
ImVec2 mousePos = ImVec2(io.MousePos.x - canvas_p0.x, io.MousePos.y - canvas_p0.y);
if (is_hovered && ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
// INFO_LOG(Log::CPU, "Mousedown %f,%f active:%d hover:%d", mousePos.x, mousePos.y, is_active, is_hovered);
// INFO_LOG(Log::System, "Mousedown %f,%f active:%d hover:%d", mousePos.x, mousePos.y, is_active, is_hovered);
onMouseDown(mousePos.x, mousePos.y, 1);
}
if (is_hovered && ImGui::IsMouseClicked(ImGuiMouseButton_Right)) {
@@ -445,13 +445,13 @@ void ImDisasmView::Draw(ImDrawList *drawList) {
onMouseDown(mousePos.x, mousePos.y, 2);
}
if (ImGui::IsMouseReleased(ImGuiMouseButton_Left)) {
// INFO_LOG(Log::CPU, "Mouseup %f,%f active:%d hover:%d", mousePos.x, mousePos.y, is_active, is_hovered);
// INFO_LOG(Log::System, "Mouseup %f,%f active:%d hover:%d", mousePos.x, mousePos.y, is_active, is_hovered);
if (is_hovered) {
onMouseUp(mousePos.x, mousePos.y, 1);
}
}
if (ImGui::IsMouseDragging(ImGuiMouseButton_Left)) {
// INFO_LOG(Log::CPU, "Mousedrag %f,%f active:%d hover:%d", mousePos.x, mousePos.y, is_active, is_hovered);
// INFO_LOG(Log::System, "Mousedrag %f,%f active:%d hover:%d", mousePos.x, mousePos.y, is_active, is_hovered);
if (is_hovered) {
onMouseMove(mousePos.x, mousePos.y, 1);
}
@@ -477,7 +477,7 @@ void ImDisasmView::Draw(ImDrawList *drawList) {
}
if (pressed) {
// INFO_LOG(Log::CPU, "Clicked %f,%f", mousePos.x, mousePos.y);
// INFO_LOG(Log::System, "Clicked %f,%f", mousePos.x, mousePos.y);
if (mousePos.x < rowHeight_) { // Left column
// Toggle breakpoint at dragAddr_.
debugger->toggleBreakpoint(curAddress_);