diff --git a/src/GLideNHQ/TxFilter.cpp b/src/GLideNHQ/TxFilter.cpp index 66421141f..fe5b774e6 100644 --- a/src/GLideNHQ/TxFilter.cpp +++ b/src/GLideNHQ/TxFilter.cpp @@ -590,7 +590,8 @@ TxFilter::checksum64strong(uint8 *src, int width, int height, int size, int rowS } boolean -TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, ColorFormat gfmt, N64FormatSize n64FmtSz, Checksum r_crc64) +TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, + ColorFormat gfmt, N64FormatSize n64FmtSz, Checksum r_crc64, boolean isStrongCrc) { assert(gfmt != graphics::colorFormat::RGBA); if (!_initialized) @@ -618,7 +619,7 @@ TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, ColorForm tmpbuf.assign(_dumpPath); tmpbuf.append(wst("/")); tmpbuf.append(_ident); - tmpbuf.append(wst("/GLideNHQ")); + isStrongCrc ? tmpbuf.append(wst("/GLideNHQ_strong_crc")) : tmpbuf.append(wst("/GLideNHQ")); if (!osal_path_existsW(tmpbuf.c_str()) && osal_mkdirp(tmpbuf.c_str()) != 0) return 0; diff --git a/src/GLideNHQ/TxFilter.h b/src/GLideNHQ/TxFilter.h index cb63a2ed8..75d0aa4b3 100644 --- a/src/GLideNHQ/TxFilter.h +++ b/src/GLideNHQ/TxFilter.h @@ -79,7 +79,8 @@ class TxFilter GHQTexInfo *info); uint64 checksum64(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette); uint64 checksum64strong(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette); - boolean dmptx(uint8 *src, int width, int height, int rowStridePixel, ColorFormat gfmt, N64FormatSize n64FmtSz, Checksum r_crc64); + boolean dmptx(uint8 *src, int width, int height, int rowStridePixel, + ColorFormat gfmt, N64FormatSize n64FmtSz, Checksum r_crc64, boolean isStrongCrc); boolean reloadhirestex(); void dumpcache(); }; diff --git a/src/GLideNHQ/TxFilterExport.cpp b/src/GLideNHQ/TxFilterExport.cpp index ffcb58362..dc892e858 100644 --- a/src/GLideNHQ/TxFilterExport.cpp +++ b/src/GLideNHQ/TxFilterExport.cpp @@ -97,11 +97,20 @@ TAPI boolean TAPIENTRY txfilter_dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gfmt, N64FormatSize n64FmtSz, Checksum r_crc64) { if (txFilter) - return txFilter->dmptx(src, width, height, rowStridePixel, ColorFormat(u32(gfmt)), n64FmtSz, r_crc64); + return txFilter->dmptx(src, width, height, rowStridePixel, ColorFormat(u32(gfmt)), n64FmtSz, r_crc64, FALSE); return 0; } +TAPI boolean TAPIENTRY +txfilter_dmptx_strong(uint8 *src, int width, int height, int rowStridePixel, uint16 gfmt, N64FormatSize n64FmtSz, Checksum r_crc64) +{ + if (txFilter) + return txFilter->dmptx(src, width, height, rowStridePixel, ColorFormat(u32(gfmt)), n64FmtSz, r_crc64, TRUE); + + return 0; +} + TAPI boolean TAPIENTRY txfilter_reloadhirestex() { diff --git a/src/GLideNHQ/TxFilterExport.h b/src/GLideNHQ/TxFilterExport.h index ba50decb7..9633d04ed 100644 --- a/src/GLideNHQ/TxFilterExport.h +++ b/src/GLideNHQ/TxFilterExport.h @@ -231,6 +231,9 @@ txfilter_checksum_strong(uint8 *src, int width, int height, int size, int rowStr TAPI boolean TAPIENTRY txfilter_dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gfmt, N64FormatSize n64FmtSz, Checksum r_crc64); +TAPI boolean TAPIENTRY +txfilter_dmptx_strong(uint8 *src, int width, int height, int rowStridePixel, uint16 gfmt, N64FormatSize n64FmtSz, Checksum r_crc64); + TAPI boolean TAPIENTRY txfilter_reloadhirestex(); diff --git a/src/TextureFilterHandler.cpp b/src/TextureFilterHandler.cpp index 44f1639c7..aa864df68 100644 --- a/src/TextureFilterHandler.cpp +++ b/src/TextureFilterHandler.cpp @@ -112,12 +112,6 @@ void TextureFilterHandler::init() pTexDumpPath = txDumpPath; } - if (config.textureFilter.txStrongCRC) { - ::wcscpy(txDumpPath, pTexDumpPath); - gln_wcscat(txDumpPath, wst("/strong_crc")); - pTexDumpPath = txDumpPath; - } - m_inited = txfilter_init(maxTextureSize, // max texture width supported by hardware maxTextureSize, // max texture height supported by hardware 32, // max texture bpp supported by hardware diff --git a/src/Textures.cpp b/src/Textures.cpp index 7c5aeae49..4d4c91a9b 100644 --- a/src/Textures.cpp +++ b/src/Textures.cpp @@ -1499,10 +1499,15 @@ void TextureCache::_loadFast(u32 _tile, CachedTexture *_pTexture) config.textureFilter.txHiresEnable != 0 && config.hotkeys.enabledKeys[Config::HotKey::hkTexDump] != 0) || config.textureFilter.txDump) { - txfilter_dmptx((u8*)m_tempTextureHolder.data(), tmptex.width, tmptex.height, - tmptex.width, (u16)u32(glInternalFormat), - N64FormatSize(_pTexture->format, _pTexture->size), - config.textureFilter.txStrongCRC ? strongcrc : ricecrc); + config.textureFilter.txStrongCRC ? + txfilter_dmptx_strong((u8*)m_tempTextureHolder.data(), tmptex.width, tmptex.height, + tmptex.width, (u16)u32(glInternalFormat), + N64FormatSize(_pTexture->format, _pTexture->size), + strongcrc) : + txfilter_dmptx((u8*)m_tempTextureHolder.data(), tmptex.width, tmptex.height, + tmptex.width, (u16)u32(glInternalFormat), + N64FormatSize(_pTexture->format, _pTexture->size), + ricecrc); } bool bLoaded = false; @@ -1676,10 +1681,15 @@ void TextureCache::_loadAccurate(u32 _tile, CachedTexture *_pTexture) config.textureFilter.txHiresEnable != 0 && config.hotkeys.enabledKeys[Config::HotKey::hkTexDump] != 0) || config.textureFilter.txDump) { - txfilter_dmptx((u8*)(m_tempTextureHolder.data() + texDataOffset), tmptex.width, tmptex.height, - tmptex.width, (u16)u32(glInternalFormat), - N64FormatSize(_pTexture->format, _pTexture->size), - config.textureFilter.txStrongCRC ? strongcrc : ricecrc); + config.textureFilter.txStrongCRC ? + txfilter_dmptx_strong((u8*)(m_tempTextureHolder.data() + texDataOffset), tmptex.width, tmptex.height, + tmptex.width, (u16)u32(glInternalFormat), + N64FormatSize(_pTexture->format, _pTexture->size), + strongcrc) : + txfilter_dmptx((u8*)(m_tempTextureHolder.data() + texDataOffset), tmptex.width, tmptex.height, + tmptex.width, (u16)u32(glInternalFormat), + N64FormatSize(_pTexture->format, _pTexture->size), + ricecrc); } texDataOffset += tmptex.width * tmptex.height; @@ -1735,10 +1745,15 @@ void TextureCache::_loadAccurate(u32 _tile, CachedTexture *_pTexture) config.textureFilter.txHiresEnable != 0 && config.hotkeys.enabledKeys[Config::HotKey::hkTexDump] != 0) || config.textureFilter.txDump) { - txfilter_dmptx((u8*)m_tempTextureHolder.data(), tmptex.width, tmptex.height, + config.textureFilter.txStrongCRC ? + txfilter_dmptx_strong((u8*)m_tempTextureHolder.data(), tmptex.width, tmptex.height, + tmptex.width, (u16)u32(glInternalFormat), + N64FormatSize(_pTexture->format, _pTexture->size), + strongcrc) : + txfilter_dmptx((u8*)m_tempTextureHolder.data(), tmptex.width, tmptex.height, tmptex.width, (u16)u32(glInternalFormat), N64FormatSize(_pTexture->format, _pTexture->size), - config.textureFilter.txStrongCRC ? strongcrc : ricecrc); + ricecrc); } bool bLoaded = false; diff --git a/src/VI.cpp b/src/VI.cpp index 6b6f958be..fafa695d7 100644 --- a/src/VI.cpp +++ b/src/VI.cpp @@ -139,8 +139,6 @@ static void checkHotkeys() else dwnd().getDrawer().showMessage("Disable strong CRC for textures dump\n", Milliseconds(750)); config.textureFilter.txStrongCRC = !config.textureFilter.txStrongCRC; - TFH.shutdown(); - TFH.init(); } }