Skip to content

Commit

Permalink
Change path to dump folder with strong CRC.
Browse files Browse the repository at this point in the history
  • Loading branch information
gonetz committed Mar 2, 2024
1 parent ad5d46c commit 568a31f
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 22 deletions.
5 changes: 3 additions & 2 deletions src/GLideNHQ/TxFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion src/GLideNHQ/TxFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand Down
11 changes: 10 additions & 1 deletion src/GLideNHQ/TxFilterExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
3 changes: 3 additions & 0 deletions src/GLideNHQ/TxFilterExport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 0 additions & 6 deletions src/TextureFilterHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 25 additions & 10 deletions src/Textures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/VI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down

0 comments on commit 568a31f

Please sign in to comment.