From 73f17694665298191d0f5cfc5b9cc876bdf4fd72 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 17:01:41 +1100 Subject: [PATCH] [Glide64] make ghq_hirs_cmpr privte --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 4 +++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 7f7f2db09..83d8d9a6c 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -642,7 +642,7 @@ public: m_cbxEnhTexCompression.Attach(GetDlgItem(IDC_CHK_TEX_COMPRESSION)); m_cbxEnhTexCompression.SetCheck(g_settings->ghq_enht_cmpr() > 0 ? BST_CHECKED : BST_UNCHECKED); m_cbxHrsTexCompression.Attach(GetDlgItem(IDC_CHK_HIRES_TEX_COMPRESSION)); - m_cbxHrsTexCompression.SetCheck(g_settings->ghq_hirs_cmpr > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxHrsTexCompression.SetCheck(g_settings->ghq_hirs_cmpr() ? BST_CHECKED : BST_UNCHECKED); TTSetTxt(IDC_CHK_COMPRESS_CACHE, "Compress texture cache:\n\nMemory will be compressed so that more textures can be held in the texture cache.\nThe compression ratio varies with each texture, but 1/5 of the original size would be a modest approximation.\nThey will be decompressed on-the-fly, before being downloaded to the gfx hardware.\nThis option will still help save memory space even when using texture compression.\n\n[Recommended: on]"); m_cbxEnhCompressCache.Attach(GetDlgItem(IDC_CHK_COMPRESS_CACHE)); @@ -699,7 +699,7 @@ public: g_settings->ghq_hirs_f16bpp = (int)m_cbxHrsForce16.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_dump = (int)m_cbxHrsTexEdit.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_altcrc = (int)m_cbxHrsAltCRC.GetCheck() == BST_CHECKED; - g_settings->ghq_hirs_cmpr = (int)m_cbxHrsTexCompression.GetCheck() == BST_CHECKED; + g_settings->SetGhqHirsCmpr(m_cbxHrsTexCompression.GetCheck() == BST_CHECKED); g_settings->ghq_hirs_gz = (int)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())); diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 12d76cce8..aaf73ed0f 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -665,7 +665,7 @@ int InitGfx() { options |= COMPRESS_TEX; } - if (g_settings->ghq_hirs_cmpr) + if (g_settings->ghq_hirs_cmpr()) { options |= COMPRESS_HIRESTEX; } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 8d21e3493..99fee71dd 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -44,7 +44,7 @@ CSettings::CSettings() : m_ghq_enht_f16bpp(false), m_ghq_enht_gz(false), m_ghq_enht_nobg(false), -ghq_hirs_cmpr(0), + m_ghq_hirs_cmpr(false), ghq_hirs_tile(0), ghq_hirs_f16bpp(0), ghq_hirs_gz(0), @@ -143,7 +143,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_enht_f16bpp, "ghq_enht_f16bpp", false); general_setting(Set_ghq_enht_gz, "ghq_enht_gz", true); general_setting(Set_ghq_enht_nobg, "ghq_enht_nobg", false); - general_setting(Set_ghq_hirs_cmpr, "ghq_hirs_cmpr", 0); + general_setting(Set_ghq_hirs_cmpr, "ghq_hirs_cmpr", false); general_setting(Set_ghq_hirs_tile, "ghq_hirs_tile", 0); general_setting(Set_ghq_hirs_f16bpp, "ghq_hirs_f16bpp", 0); general_setting(Set_ghq_hirs_gz, "ghq_hirs_gz", 1); @@ -388,6 +388,15 @@ void CSettings::SetGhqEnhtCmpr(bool value) } } +void CSettings::SetGhqHirsCmpr(bool value) +{ + if (value != m_ghq_hirs_cmpr) + { + m_ghq_hirs_cmpr = value; + m_dirty = true; + } +} + void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove) { uint32_t frame_buffer_original = m_frame_buffer; @@ -498,7 +507,7 @@ void CSettings::ReadSettings() m_ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp) !=0; m_ghq_enht_gz = GetSetting(Set_ghq_enht_gz) != 0; m_ghq_enht_nobg = GetSetting(Set_ghq_enht_nobg) != 0; - this->ghq_hirs_cmpr = GetSetting(Set_ghq_hirs_cmpr); + m_ghq_hirs_cmpr = GetSetting(Set_ghq_hirs_cmpr) != 0; this->ghq_hirs_tile = GetSetting(Set_ghq_hirs_tile); this->ghq_hirs_f16bpp = GetSetting(Set_ghq_hirs_f16bpp); this->ghq_hirs_gz = GetSetting(Set_ghq_hirs_gz); @@ -767,7 +776,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_enht_f16bpp, m_ghq_enht_f16bpp); SetSetting(Set_ghq_enht_gz, m_ghq_enht_gz); SetSetting(Set_ghq_enht_nobg, m_ghq_enht_nobg); - SetSetting(Set_ghq_hirs_cmpr, g_settings->ghq_hirs_cmpr); + SetSetting(Set_ghq_hirs_cmpr, m_ghq_hirs_cmpr); SetSetting(Set_ghq_hirs_tile, g_settings->ghq_hirs_tile); SetSetting(Set_ghq_hirs_f16bpp, g_settings->ghq_hirs_f16bpp); SetSetting(Set_ghq_hirs_gz, g_settings->ghq_hirs_gz); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 3cb8647aa..c9bfb45f1 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -211,7 +211,7 @@ public: inline bool ghq_enht_f16bpp(void) const { return m_ghq_enht_f16bpp; } inline bool ghq_enht_gz(void) const { return m_ghq_enht_gz; } inline bool ghq_enht_nobg(void) const { return m_ghq_enht_nobg; } - int ghq_hirs_cmpr; + inline bool ghq_hirs_cmpr(void) const { return m_ghq_hirs_cmpr; } int ghq_hirs_tile; int ghq_hirs_f16bpp; int ghq_hirs_gz; @@ -279,6 +279,7 @@ public: void SetGhqEnhtGz(bool value); void SetGhqEnhtNobg(bool value); void SetGhqEnhtCmpr(bool value); + void SetGhqHirsCmpr(bool value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); ucode_t DetectUCode(uint32_t uc_crc); void SetUcode(ucode_t value); @@ -327,6 +328,7 @@ private: bool m_ghq_enht_f16bpp; bool m_ghq_enht_gz; bool m_ghq_enht_nobg; + bool m_ghq_hirs_cmpr; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks;