diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 5bfddc7e5..b5be2ef8e 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -678,7 +678,7 @@ public: m_cbxSaveTexCache.Attach(GetDlgItem(IDC_CHK_TEX_CACHE_HD)); TTSetTxt(IDC_CHK_TEX_CACHE_HD, "Save texture cache to HD:\n\nFor enhanced textures cache:\nThis will save all previously loaded and enhanced textures to HD.\nSo upon next game launch, all the textures will be instantly loaded, resulting in smoother performance.\n\nFor high-resolution textures cache:\nAfter creation, loading hi-res texture will take only a few seconds upon game launch, as opposed to the 5 to 60 seconds a pack can take to load without this cache file.\nThe only downside here is upon any changes to the pack, the cache file will need to be manually deleted.\n\nSaved cache files go into a folder called \"Cache\" within the Textures folder.\n\n[Highly Recommended: on]"); - m_cbxSaveTexCache.SetCheck(g_settings->ghq_cache_save > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxSaveTexCache.SetCheck(g_settings->ghq_cache_save() > 0 ? BST_CHECKED : BST_UNCHECKED); return TRUE; } @@ -703,7 +703,7 @@ public: g_settings->SetGhqHirsGz(m_cbxHrsCompressCache.GetCheck() == BST_CHECKED); g_settings->ghq_hirs_let_texartists_fly = (int)m_cbxHrsLetFly.GetCheck() == BST_CHECKED; g_settings->SetGhqCmpr((CSettings::TextureCompression_t)m_cmbTextureCompression.GetItemData(m_cmbTextureCompression.GetCurSel())); - g_settings->ghq_cache_save = (int)m_cbxSaveTexCache.GetCheck() == BST_CHECKED; + g_settings->SetGhqCacheSave(m_cbxSaveTexCache.GetCheck() == BST_CHECKED); if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed { g_settings->WriteSettings(); diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 382e9e2e1..2b3fb3a65 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -689,7 +689,7 @@ int InitGfx() { options |= GZ_HIRESTEXCACHE; } - if (g_settings->ghq_cache_save) + if (g_settings->ghq_cache_save()) { options |= (DUMP_TEXCACHE | DUMP_HIRESTEXCACHE); } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 067e408e1..f2019d8ba 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -49,7 +49,7 @@ CSettings::CSettings() : m_ghq_hirs_f16bpp(false), m_ghq_hirs_gz(false), m_ghq_hirs_altcrc(false), -ghq_cache_save(0), + m_ghq_cache_save(false), ghq_cache_size(0), ghq_hirs_let_texartists_fly(0), ghq_hirs_dump(0), @@ -148,7 +148,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_hirs_f16bpp, "ghq_hirs_f16bpp", false); general_setting(Set_ghq_hirs_gz, "ghq_hirs_gz", true); general_setting(Set_ghq_hirs_altcrc, "ghq_hirs_altcrc", true); - general_setting(Set_ghq_cache_save, "ghq_cache_save", 1); + general_setting(Set_ghq_cache_save, "ghq_cache_save", true); general_setting(Set_ghq_cache_size, "ghq_cache_size", 0); general_setting(Set_ghq_hirs_let_texartists_fly, "ghq_hirs_let_texartists_fly", 0); general_setting(Set_ghq_hirs_dump, "ghq_hirs_dump", 0); @@ -433,6 +433,15 @@ void CSettings::SetGhqHirsGz(bool value) } } +void CSettings::SetGhqCacheSave(bool value) +{ + if (value != m_ghq_cache_save) + { + m_ghq_cache_save = value; + m_dirty = true; + } +} + void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove) { uint32_t frame_buffer_original = m_frame_buffer; @@ -548,7 +557,7 @@ void CSettings::ReadSettings() m_ghq_hirs_f16bpp = GetSetting(Set_ghq_hirs_f16bpp) != 0; m_ghq_hirs_gz = GetSetting(Set_ghq_hirs_gz) != 0; m_ghq_hirs_altcrc = GetSetting(Set_ghq_hirs_altcrc) != 0; - this->ghq_cache_save = GetSetting(Set_ghq_cache_save); + m_ghq_cache_save = GetSetting(Set_ghq_cache_save) != 0; this->ghq_cache_size = GetSetting(Set_ghq_cache_size); this->ghq_hirs_let_texartists_fly = GetSetting(Set_ghq_hirs_let_texartists_fly); this->ghq_hirs_dump = GetSetting(Set_ghq_hirs_dump); @@ -817,7 +826,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_hirs_f16bpp, m_ghq_hirs_f16bpp); SetSetting(Set_ghq_hirs_gz, m_ghq_hirs_gz); SetSetting(Set_ghq_hirs_altcrc, m_ghq_hirs_altcrc); - SetSetting(Set_ghq_cache_save, g_settings->ghq_cache_save); + SetSetting(Set_ghq_cache_save, m_ghq_cache_save); SetSetting(Set_ghq_cache_size, g_settings->ghq_cache_size); SetSetting(Set_ghq_hirs_let_texartists_fly, g_settings->ghq_hirs_let_texartists_fly); SetSetting(Set_ghq_hirs_dump, g_settings->ghq_hirs_dump); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 1ea62ef9d..8dac0aadb 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -216,7 +216,7 @@ public: inline bool ghq_hirs_f16bpp(void) const { return m_ghq_hirs_f16bpp; } inline bool ghq_hirs_gz(void) const { return m_ghq_hirs_gz; } inline bool ghq_hirs_altcrc(void) const { return m_ghq_hirs_altcrc; } - int ghq_cache_save; + inline bool ghq_cache_save(void) const { return m_ghq_cache_save; } int ghq_cache_size; int ghq_hirs_let_texartists_fly; int ghq_hirs_dump; @@ -284,6 +284,7 @@ public: void SetGhqHirsAltcrc(bool value); void SetGhqHirsCmpr(bool value); void SetGhqHirsGz(bool value); + void SetGhqCacheSave(bool value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); ucode_t DetectUCode(uint32_t uc_crc); void SetUcode(ucode_t value); @@ -337,6 +338,7 @@ private: bool m_ghq_hirs_f16bpp; bool m_ghq_hirs_gz; bool m_ghq_hirs_altcrc; + bool m_ghq_cache_save; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks;