From 1d518f5d6fb6d3145f23b0b5a344db89adcd4139 Mon Sep 17 00:00:00 2001 From: wraitii Date: Mon, 7 Jun 2021 19:27:54 +0000 Subject: [PATCH] Fix MouseEventMask for bundles. The .png get converted to .dds and they failed to load. Use a custom CacheLoader since that's lightweight enough and avoids having to hack into the texture manager. Thanks Stan for testing Differential Revision: https://code.wildfiregames.com/D4119 This was SVN commit r25738. --- source/gui/SettingTypes/MouseEventMask.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/gui/SettingTypes/MouseEventMask.cpp b/source/gui/SettingTypes/MouseEventMask.cpp index 88967db792..a95343fcb7 100644 --- a/source/gui/SettingTypes/MouseEventMask.cpp +++ b/source/gui/SettingTypes/MouseEventMask.cpp @@ -24,6 +24,7 @@ #include "maths/Rect.h" #include "maths/Vector2D.h" #include "ps/Filesystem.h" +#include "ps/CacheLoader.h" #include "ps/CLogger.h" #include "ps/CStr.h" #include "scriptinterface/ScriptConversions.h" @@ -85,8 +86,16 @@ public: static std::unique_ptr Create(const std::string& spec) { std::shared_ptr shapeFile; + CCacheLoader loader(g_VFS, L".dds"); + VfsPath sourcePath = VfsPath("art") / L"textures" / L"ui" / spec.substr(specOffset); + VfsPath archivePath = loader.ArchiveCachePath(sourcePath); + Status status; size_t size; - if (g_VFS->LoadFile(VfsPath("art") / L"textures" / L"ui" / spec.substr(specOffset), shapeFile, size) != INFO::OK) + if (loader.CanUseArchiveCache(sourcePath, archivePath)) + status = g_VFS->LoadFile(archivePath, shapeFile, size); + else + status = g_VFS->LoadFile(sourcePath, shapeFile, size); + if (status != INFO::OK) { LOGWARNING("Mouse event mask texture not found ('%s')", spec); return nullptr;