From 1e3e06a036deede5b4dc50ab7b1e1f7c9ce90253 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Thu, 11 May 2017 14:38:34 +0700 Subject: [PATCH] Fix texture cache file name when rom name contains colon, #1477 --- src/GLideNHQ/TxHiResCache.cpp | 2 ++ src/GLideNHQ/TxTexCache.cpp | 2 ++ src/GLideNHQ/txWidestringWrapper.h | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/src/GLideNHQ/TxHiResCache.cpp b/src/GLideNHQ/TxHiResCache.cpp index 4e789185..6237fc0c 100644 --- a/src/GLideNHQ/TxHiResCache.cpp +++ b/src/GLideNHQ/TxHiResCache.cpp @@ -59,6 +59,7 @@ TxHiResCache::~TxHiResCache() if ((_options & DUMP_HIRESTEXCACHE) && !_haveCache && !_abortLoad) { /* dump cache to disk */ tx_wstring filename = _ident + wst("_HIRESTEXTURES.") + TEXCACHE_EXT; + removeColon(filename); tx_wstring cachepath(_path); cachepath += OSAL_DIR_SEPARATOR_STR; cachepath += wst("cache"); @@ -101,6 +102,7 @@ TxHiResCache::TxHiResCache(int maxwidth, int maxheight, int maxbpp, int options, if (_options & DUMP_HIRESTEXCACHE) { /* find it on disk */ tx_wstring filename = _ident + wst("_HIRESTEXTURES.") + TEXCACHE_EXT; + removeColon(filename); tx_wstring cachepath(_path); cachepath += OSAL_DIR_SEPARATOR_STR; cachepath += wst("cache"); diff --git a/src/GLideNHQ/TxTexCache.cpp b/src/GLideNHQ/TxTexCache.cpp index 763c7231..eb7c853c 100644 --- a/src/GLideNHQ/TxTexCache.cpp +++ b/src/GLideNHQ/TxTexCache.cpp @@ -39,6 +39,7 @@ TxTexCache::~TxTexCache() if (_options & DUMP_TEXCACHE) { /* dump cache to disk */ tx_wstring filename = _ident + wst("_MEMORYCACHE.") + TEXCACHE_EXT; + removeColon(filename); tx_wstring cachepath(_path); cachepath += OSAL_DIR_SEPARATOR_STR; cachepath += wst("cache"); @@ -61,6 +62,7 @@ TxTexCache::TxTexCache(int options, int cachesize, const wchar_t *path, const wc if (_options & DUMP_TEXCACHE) { /* find it on disk */ tx_wstring filename = _ident + wst("_MEMORYCACHE.") + TEXCACHE_EXT; + removeColon(filename); tx_wstring cachepath(_path); cachepath += OSAL_DIR_SEPARATOR_STR; cachepath += wst("cache"); diff --git a/src/GLideNHQ/txWidestringWrapper.h b/src/GLideNHQ/txWidestringWrapper.h index c4470171..a98f9f2e 100644 --- a/src/GLideNHQ/txWidestringWrapper.h +++ b/src/GLideNHQ/txWidestringWrapper.h @@ -2,6 +2,7 @@ #define ___TXWIDESCREENWRAPPER_H__ #include +#include #ifdef OS_ANDROID @@ -49,12 +50,18 @@ private: #define wst(A) dummyWString(A).c_str() +#define removeColon(A) #else #define tx_wstring std::wstring #define tx_swprintf swprintf #define wst(A) L##A #define wccmp(A, B) A[0] == B[0] +inline +void removeColon(tx_wstring& _s) +{ + std::replace(_s.begin(), _s.end(), L':', L'-'); +} #endif // OS_ANDROID