Merge pull request #18638 from hrydgard/more-tex-replacement-details

Fix two minor tex replacement issues
This commit is contained in:
Unknown W. Brackets authored and GitHub committed 2023-12-29 10:21:43 -08:00
commit 80bd328a9d
2 files changed
+13 -2

No files matched your search

+1 -1
View File
@@ -223,7 +223,7 @@ void ReplacedTexture::Prepare(VFSBackend *vfs) {
VFSFileReference *fileRef = vfs_->GetFile(desc_.filenames[i].c_str());
if (!fileRef) {
if (i == 0) {
WARN_LOG(G3D, "Texture replacement file '%s' not found", desc_.filenames[i].c_str());
INFO_LOG(G3D, "Texture replacement file '%s' not found", desc_.filenames[i].c_str());
// No file at all. Mark as NOT_FOUND.
SetState(ReplacementState::NOT_FOUND);
return;
+12 -1
View File
@@ -180,6 +180,12 @@ bool TextureReplacer::LoadIni() {
// 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(G3D, "No replacement textures found.");
return false;
}
ComputeAliasMap(filenameMap);
}
}
@@ -593,7 +599,12 @@ ReplacedTexture *TextureReplacer::FindReplacement(u64 cachekey, u32 hash, int w,
}
desc.logId = desc.filenames[0];
desc.hashfiles = desc.filenames[0]; // The generated filename of the top level is used as the key in the data cache.
hashfiles = desc.filenames[0];
hashfiles.clear();
hashfiles.reserve(desc.filenames[0].size() * (desc.filenames.size() + 1));
for (int level = 0; level < desc.filenames.size(); level++) {
hashfiles += desc.filenames[level];
hashfiles.push_back('|');
}
} else {
desc.logId = hashfiles;
SplitString(hashfiles, '|', desc.filenames);