1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-30 08:24:05 +00:00

Separate "Dump" and "Reload" options.

This commit is contained in:
Sergey Lipskiy 2020-06-14 13:39:42 +07:00
parent 156171bebd
commit 7228d0d5db
7 changed files with 51 additions and 20 deletions

View File

@ -92,6 +92,7 @@ void Config::resetToDefaults()
textureFilter.txHiresFullAlphaChannel = 1;
textureFilter.txHresAltCRC = 0;
textureFilter.txDump = 0;
textureFilter.txReloadHiresTex = 0;
textureFilter.txForce16bpp = 0;
textureFilter.txCacheCompression = 1;

View File

@ -168,6 +168,7 @@ struct Config
u32 txHiresFullAlphaChannel; // Use alpha channel fully
u32 txHresAltCRC; // Use alternative method of paletted textures CRC calculation
u32 txDump; // Dump textures
u32 txReloadHiresTex; // Reload hires textures
u32 txForce16bpp; // Force use 16bit color textures
u32 txCacheCompression; // Zip textures cache

View File

@ -270,6 +270,8 @@ void ConfigDialog::_init(bool reInit, bool blockCustomSettings)
ui->alternativeCRCCheckBox->setChecked(config.textureFilter.txHresAltCRC != 0);
ui->textureDumpCheckBox->toggle();
ui->textureDumpCheckBox->setChecked(config.textureFilter.txDump != 0);
ui->textureReloadCheckBox->toggle();
ui->textureReloadCheckBox->setChecked(config.textureFilter.txReloadHiresTex != 0);
ui->force16bppCheckBox->setChecked(config.textureFilter.txForce16bpp != 0);
ui->compressCacheCheckBox->setChecked(config.textureFilter.txCacheCompression != 0);
ui->saveTextureCacheCheckBox->setChecked(config.textureFilter.txSaveCache != 0);
@ -547,6 +549,7 @@ void ConfigDialog::accept(bool justSave) {
config.textureFilter.txHiresFullAlphaChannel = ui->alphaChannelCheckBox->isChecked() ? 1 : 0;
config.textureFilter.txHresAltCRC = ui->alternativeCRCCheckBox->isChecked() ? 1 : 0;
config.textureFilter.txDump = ui->textureDumpCheckBox->isChecked() ? 1 : 0;
config.textureFilter.txReloadHiresTex = ui->textureReloadCheckBox->isChecked() ? 1 : 0;
config.textureFilter.txCacheCompression = ui->compressCacheCheckBox->isChecked() ? 1 : 0;
config.textureFilter.txForce16bpp = ui->force16bppCheckBox->isChecked() ? 1 : 0;

View File

@ -92,6 +92,7 @@ void _loadSettings(QSettings & settings)
config.textureFilter.txHiresFullAlphaChannel = settings.value("txHiresFullAlphaChannel", config.textureFilter.txHiresFullAlphaChannel).toInt();
config.textureFilter.txHresAltCRC = settings.value("txHresAltCRC", config.textureFilter.txHresAltCRC).toInt();
config.textureFilter.txDump = settings.value("txDump", config.textureFilter.txDump).toInt();
config.textureFilter.txReloadHiresTex = settings.value("txReloadHiresTex", config.textureFilter.txReloadHiresTex).toInt();
config.textureFilter.txForce16bpp = settings.value("txForce16bpp", config.textureFilter.txForce16bpp).toInt();
config.textureFilter.txCacheCompression = settings.value("txCacheCompression", config.textureFilter.txCacheCompression).toInt();
config.textureFilter.txSaveCache = settings.value("txSaveCache", config.textureFilter.txSaveCache).toInt();
@ -267,6 +268,7 @@ void writeSettings(const QString & _strIniFolder)
settings.setValue("txHiresFullAlphaChannel", config.textureFilter.txHiresFullAlphaChannel);
settings.setValue("txHresAltCRC", config.textureFilter.txHresAltCRC);
settings.setValue("txDump", config.textureFilter.txDump);
settings.setValue("txReloadHiresTex", config.textureFilter.txReloadHiresTex);
settings.setValue("txForce16bpp", config.textureFilter.txForce16bpp);
settings.setValue("txCacheCompression", config.textureFilter.txCacheCompression);
settings.setValue("txSaveCache", config.textureFilter.txSaveCache);
@ -461,6 +463,7 @@ void saveCustomRomSettings(const QString & _strIniFolder, const char * _strRomNa
WriteCustomSetting(textureFilter, txHiresFullAlphaChannel);
WriteCustomSetting(textureFilter, txHresAltCRC);
WriteCustomSetting(textureFilter, txDump);
WriteCustomSetting(textureFilter, txReloadHiresTex);
WriteCustomSetting(textureFilter, txForce16bpp);
WriteCustomSetting(textureFilter, txCacheCompression);
WriteCustomSetting(textureFilter, txSaveCache);

View File

@ -2679,6 +2679,9 @@
</item>
<item>
<widget class="QCheckBox" name="hiresTexFileStorageCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This option enables alternative storage for hi-res textures.&lt;/p&gt;&lt;p&gt;Normally memory cache is used. It keeps all hi-res textures in RAM and thus limited by available RAM size.&lt;/p&gt;&lt;p&gt;File storage keeps texture cache on HDD. It is slower than memory cache, but has virtually no limits on cache size.&lt;/p&gt;&lt;p&gt;Disable &amp;quot;Compress texture cache&amp;quot; option for better performance.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Use file storage instead of memory cache</string>
</property>
@ -2690,10 +2693,20 @@
<bool>true</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This option dumps textures on screen to a texture pack folder. You can also reload textures while the game is running to see how they look instantly—big time saver!&lt;/p&gt;&lt;p&gt;Hotkeys:&lt;br/&gt;Use &lt;span style=&quot; font-weight:600;&quot;&gt;R&lt;/span&gt; to reload textures from the texture pack&lt;br/&gt;Use &lt;span style=&quot; font-weight:600;&quot;&gt;D&lt;/span&gt; to toggle texture dumping on or off&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This option dumps textures on screen to a texture pack folder. &lt;/p&gt;&lt;p&gt;Hotkey:&lt;br/&gt;Use &lt;span style=&quot; font-weight:600;&quot;&gt;D&lt;/span&gt; to toggle texture dumping on or off&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Dump/edit textures</string>
<string>Press 'd' to dump N64 textures (for texture artists)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="textureReloadCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This option allows texture artists to reload hi-res textures while the game is running to instantly see how they look —big time saver!&lt;/p&gt;&lt;p&gt;Hotkey:&lt;br/&gt;Use &lt;span style=&quot; font-weight:600;&quot;&gt;R&lt;/span&gt; to reload textures from the texture pack&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Press 'r' to reload hi-res textures (for texture artists)</string>
</property>
</widget>
</item>

View File

@ -672,7 +672,7 @@ void _updateCachedTexture(const GHQTexInfo & _info, CachedTexture *_pTexture, u1
_pTexture->scaleS = 1.0f / (_pTexture->maskS ? f32(pow2(widthOrg)) : f32(widthOrg));
_pTexture->scaleT = 1.0f / (_pTexture->maskT ? f32(pow2(heightOrg)) : f32(heightOrg));
_pTexture->hdRatioS = f32(_info.width / _pTexture->width);
_pTexture->hdRatioT = f32(_info.height / _pTexture->height);
@ -1449,24 +1449,29 @@ void TextureCache::_clear()
void TextureCache::update(u32 _t)
{
if (config.textureFilter.txHiresEnable != 0 && config.textureFilter.txDump != 0) {
/* Force reload hi-res textures. Useful for texture artists */
if (isKeyPressed(G64_VK_R, 0x0001)) {
if (txfilter_reloadhirestex()) {
_clear();
if (config.textureFilter.txHiresEnable != 0) {
if (config.textureFilter.txReloadHiresTex != 0) {
/* Force reload hi-res textures. Useful for texture artists */
if (isKeyPressed(G64_VK_R, 0x0001)) {
if (txfilter_reloadhirestex()) {
_clear();
}
}
}
/* Turn on texture dump */
else if (isKeyPressed(G64_VK_D, 0x0001)) {
m_toggleDumpTex = !m_toggleDumpTex;
if (m_toggleDumpTex) {
displayLoadProgress(L"Texture dump - ON\n");
_clear();
std::this_thread::sleep_for(std::chrono::seconds(1));
}
else {
displayLoadProgress(L"Texture dump - OFF\n");
std::this_thread::sleep_for(std::chrono::seconds(1));
if (config.textureFilter.txDump != 0) {
/* Turn on texture dump */
if (isKeyPressed(G64_VK_D, 0x0001)) {
m_toggleDumpTex = !m_toggleDumpTex;
if (m_toggleDumpTex) {
displayLoadProgress(L"Texture dump - ON\n");
_clear();
std::this_thread::sleep_for(std::chrono::seconds(1));
}
else {
displayLoadProgress(L"Texture dump - OFF\n");
std::this_thread::sleep_for(std::chrono::seconds(1));
}
}
}
}

View File

@ -167,7 +167,9 @@ bool Config_SetDefault()
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "txHresAltCRC", config.textureFilter.txHresAltCRC, "Use alternative method of paletted textures CRC calculation.");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "txDump", config.textureFilter.txDump, "Enable dump of loaded N64 textures.");
res = ConfigSetDefaultBool(g_configVideoGliden64, "txDump", config.textureFilter.txDump, "Press 'd' to start dump of N64 textures.");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "txReloadHiresTex", config.textureFilter.txReloadHiresTex, "Press 'r' to reload HD textures.");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "txCacheCompression", config.textureFilter.txCacheCompression, "Zip textures cache.");
assert(res == M64ERR_SUCCESS);
@ -369,6 +371,8 @@ void Config_LoadCustomConfig()
if (result == M64ERR_SUCCESS) config.textureFilter.txHresAltCRC = atoi(value);
result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txDump", value, sizeof(value));
if (result == M64ERR_SUCCESS) config.textureFilter.txDump = atoi(value);
result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txReloadHiresTex", value, sizeof(value));
if (result == M64ERR_SUCCESS) config.textureFilter.txReloadHiresTex = atoi(value);
result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txForce16bpp", value, sizeof(value));
if (result == M64ERR_SUCCESS) config.textureFilter.txForce16bpp = atoi(value);
result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txCacheCompression", value, sizeof(value));
@ -461,6 +465,7 @@ void Config_LoadConfig()
config.textureFilter.txHiresFullAlphaChannel = ConfigGetParamBool(g_configVideoGliden64, "txHiresFullAlphaChannel");
config.textureFilter.txHresAltCRC = ConfigGetParamBool(g_configVideoGliden64, "txHresAltCRC");
config.textureFilter.txDump = ConfigGetParamBool(g_configVideoGliden64, "txDump");
config.textureFilter.txReloadHiresTex = ConfigGetParamBool(g_configVideoGliden64, "txReloadHiresTex");
config.textureFilter.txForce16bpp = ConfigGetParamBool(g_configVideoGliden64, "txForce16bpp");
config.textureFilter.txCacheCompression = ConfigGetParamBool(g_configVideoGliden64, "txCacheCompression");
config.textureFilter.txSaveCache = ConfigGetParamBool(g_configVideoGliden64, "txSaveCache");