diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 4ca039d51..ff6682f74 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -105,17 +105,6 @@ void ConfigCleanup(void) void CloseConfig(); -uint32_t texfltr[] = -{ - NO_FILTER, //"None" - SMOOTH_FILTER_1, //"Smooth filtering 1" - SMOOTH_FILTER_2, //"Smooth filtering 2" - SMOOTH_FILTER_3, //"Smooth filtering 3" - SMOOTH_FILTER_4, //"Smooth filtering 4" - SHARP_FILTER_1, //"Sharp filtering 1" - SHARP_FILTER_2, //"Sharp filtering 2" -}; - uint32_t texenht[] = { NO_ENHANCEMENT, //"None" @@ -644,14 +633,14 @@ public: TTSetTxt(IDC_TXT_ENH_FILTER, tooltip.c_str()); TTSetTxt(IDC_CMB_ENH_FILTER, tooltip.c_str()); m_cmbEnhFilter.Attach(GetDlgItem(IDC_CMB_ENH_FILTER)); - m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("None"), 0); - m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 1"), 1); - m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 2"), 2); - m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 3"), 3); - m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 4"), 4); - m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Sharp filtering 1"), 5); - m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Sharp filtering 2"), 6); - SetComboBoxIndex(m_cmbEnhFilter, g_settings->ghq_fltr); + m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("None"), CSettings::TextureFilter_None); + m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 1"), CSettings::TextureFilter_SmoothFiltering); + m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 2"), CSettings::TextureFilter_SmoothFiltering2); + m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 3"), CSettings::TextureFilter_SmoothFiltering3); + m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 4"), CSettings::TextureFilter_SmoothFiltering4); + m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Sharp filtering 1"), CSettings::TextureFilter_SharpFiltering1); + m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Sharp filtering 2"), CSettings::TextureFilter_SharpFiltering2); + SetComboBoxIndex(m_cmbEnhFilter, g_settings->ghq_fltr()); tooltip = "Texture enhancement:\n\n7 different filters are selectable here, each one with a distinctive look.\nBe aware of possible performance impacts.\n\nIMPORTANT: 'Store' mode - saves textures in cache 'as is'.\nIt can improve performance in games, which load many textures.\nDisable 'Ignore backgrounds' option for better result.\n\n[Recommended: your preference]"; TTSetTxt(IDC_TXT_ENHANCEMENT, tooltip.c_str()); @@ -747,7 +736,7 @@ public: m_textTexCache.GetWindowText(texcache, sizeof(texcache)); CSettings oldsettings = *g_settings; - g_settings->ghq_fltr = m_cmbEnhFilter.GetItemData(m_cmbEnhFilter.GetCurSel()); + g_settings->SetGhqFltr((CSettings::TextureFilter_t)m_cmbEnhFilter.GetItemData(m_cmbEnhFilter.GetCurSel())); g_settings->ghq_enht = m_cmbEnhEnhancement.GetItemData(m_cmbEnhEnhancement.GetCurSel()); g_settings->ghq_cache_size = atoi(texcache); g_settings->ghq_enht_nobg = (int)m_cbxEnhIgnoreBG.GetCheck() == BST_CHECKED; diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 9ec469b3c..6e4d6458c 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -807,11 +807,11 @@ int InitGfx() if (!g_settings->ghq_use) { - g_settings->ghq_use = g_settings->ghq_fltr || g_settings->ghq_enht /*|| g_settings->ghq_cmpr*/ || g_settings->ghq_hirs; + g_settings->ghq_use = g_settings->ghq_fltr() != CSettings::TextureFilter_None || g_settings->ghq_enht /*|| g_settings->ghq_cmpr*/ || g_settings->ghq_hirs; if (g_settings->ghq_use) { /* Plugin path */ - int options = texfltr[g_settings->ghq_fltr] | texenht[g_settings->ghq_enht] | texcmpr[g_settings->ghq_cmpr] | texhirs[g_settings->ghq_hirs]; + int options = g_settings->ghq_fltr() | texenht[g_settings->ghq_enht] | texcmpr[g_settings->ghq_cmpr] | texhirs[g_settings->ghq_hirs]; if (g_settings->ghq_enht_cmpr) options |= COMPRESS_TEX; if (g_settings->ghq_hirs_cmpr) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 60d9fa35d..42d5218ff 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -31,7 +31,7 @@ buff_clear(0), m_frame_buffer(0), //Texture filtering options texture_dir(""), -ghq_fltr(0), + m_ghq_fltr(TextureFilter_None), ghq_enht(0), ghq_cmpr(0), ghq_hirs(0), @@ -128,7 +128,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_wfmode, "wfmode", 1); general_setting(Set_unk_as_red, "unk_as_red", 0); general_setting(Set_unk_clear, "unk_clear", 0); - general_setting(Set_ghq_fltr, "ghq_fltr", 0); + general_setting(Set_ghq_fltr, "ghq_fltr", TextureFilter_None); general_setting(Set_ghq_cmpr, "ghq_cmpr", 0); general_setting(Set_ghq_enht, "ghq_enht", 0); general_setting(Set_ghq_hirs, "ghq_hirs", 0); @@ -242,6 +242,15 @@ void CSettings::SetSwapMode(SwapMode_t value) } } +void CSettings::SetGhqFltr(TextureFilter_t value) +{ + if (value != m_ghq_fltr) + { + m_ghq_fltr = value; + m_dirty = true; + } +} + void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove) { uint32_t frame_buffer_original = m_frame_buffer; @@ -325,7 +334,7 @@ void CSettings::ReadSettings() memset(texture_dir, 0, sizeof(texture_dir)); GetSystemSettingSz(Set_texture_dir, texture_dir, sizeof(texture_dir)); this->texture_dir = texture_dir; - this->ghq_fltr = (uint8_t)GetSetting(Set_ghq_fltr); + m_ghq_fltr = (TextureFilter_t)GetSetting(Set_ghq_fltr); this->ghq_cmpr = (uint8_t)GetSetting(Set_ghq_cmpr); this->ghq_enht = (uint8_t)GetSetting(Set_ghq_enht); this->ghq_hirs = (uint8_t)GetSetting(Set_ghq_hirs); @@ -597,7 +606,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_unk_clear, g_settings->unk_clear); #endif //_ENDUSER_RELEASE_ - SetSetting(Set_ghq_fltr, g_settings->ghq_fltr); + SetSetting(Set_ghq_fltr, m_ghq_fltr); SetSetting(Set_ghq_cmpr, g_settings->ghq_cmpr); SetSetting(Set_ghq_enht, g_settings->ghq_enht); SetSetting(Set_ghq_hirs, g_settings->ghq_hirs); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index a9975f575..cf53ad6b1 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -82,7 +82,18 @@ public: Filter_ForceBilinear = 1, Filter_ForcePointSampled = 2, }; - + + enum TextureFilter_t + { + TextureFilter_None = 0x00, + TextureFilter_SmoothFiltering = 0x01, + TextureFilter_SmoothFiltering2 = 0x02, + TextureFilter_SmoothFiltering3 = 0x03, + TextureFilter_SmoothFiltering4 = 0x04, + TextureFilter_SharpFiltering1 = 0x10, + TextureFilter_SharpFiltering2 = 0x20, + }; + enum SwapMode_t { SwapMode_Old = 0, @@ -155,7 +166,7 @@ public: //Texture filtering options std::string texture_dir; - int ghq_fltr; + inline TextureFilter_t ghq_fltr(void) const { return m_ghq_fltr; } int ghq_enht; int ghq_cmpr; int ghq_hirs; @@ -220,6 +231,7 @@ public: void SetLODmode(PixelLevelOfDetail_t value); void SetFiltering(Filtering_t value); void SetSwapMode(SwapMode_t value); + void SetGhqFltr(TextureFilter_t value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); void ReadGameSettings(const char * name); @@ -240,6 +252,7 @@ private: Filtering_t m_filtering; SwapMode_t m_swapmode; PixelLevelOfDetail_t m_lodmode; + TextureFilter_t m_ghq_fltr; StippleMode_t m_stipple_mode; hacks_t m_hacks; }; diff --git a/Source/Glide64/rdp.h b/Source/Glide64/rdp.h index e3e913a7d..c4203285d 100644 --- a/Source/Glide64/rdp.h +++ b/Source/Glide64/rdp.h @@ -163,8 +163,7 @@ typedef struct { uint32_t lr_x; uint32_t lr_y; } SCISSOR; - -extern uint32_t texfltr[]; + extern uint32_t texenht[]; extern uint32_t texcmpr[]; extern uint32_t texhirs[];