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.
This commit is contained in:
wraitii 2021-06-07 19:27:54 +00:00
parent 65ae6543c3
commit 1d518f5d6f

View File

@ -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<CGUIMouseEventMaskTexture> Create(const std::string& spec)
{
std::shared_ptr<u8> 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;