diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index dddfb627c..4558e14ca 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -106,14 +106,6 @@ void ConfigCleanup(void) void CloseConfig(); -uint32_t texhirs[] = -{ - NO_HIRESTEXTURES, //"Do not use" - RICE_HIRESTEXTURES, //"Rice format" - // GHQ_HIRESTEXTURES, //"GlideHQ format" - // JABO_HIRESTEXTURES, //"Jabo format" -}; - #ifdef _WIN32 template < class T, class TT = CToolTipCtrl > @@ -620,9 +612,9 @@ public: TTSetTxt(IDC_TXT_FORMAT_CHOICES, tooltip.c_str()); TTSetTxt(IDC_CMB_FORMAT_CHOICES, tooltip.c_str()); m_cmbHrsFormat.Attach(GetDlgItem(IDC_CMB_FORMAT_CHOICES)); - m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("None"), 0); - m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("Rice format"), 1); - SetComboBoxIndex(m_cmbHrsFormat, g_settings->ghq_hirs); + m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("None"), CSettings::HiResPackFormat_None); + m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("Rice format"), CSettings::HiResPackFormat_Riceformat); + SetComboBoxIndex(m_cmbHrsFormat, g_settings->ghq_hirs()); m_cmbTextureCompression.Attach(GetDlgItem(IDC_CMB_TEX_COMPRESS_MEHTOD)); m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("S3TC"), 0); @@ -701,7 +693,7 @@ public: g_settings->ghq_enht_nobg = (int)m_cbxEnhIgnoreBG.GetCheck() == BST_CHECKED; g_settings->ghq_enht_cmpr = (int)m_cbxEnhTexCompression.GetCheck() == BST_CHECKED; g_settings->ghq_enht_gz = (int)m_cbxEnhCompressCache.GetCheck() == BST_CHECKED; - g_settings->ghq_hirs = m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel()); + g_settings->SetGhqHirs((CSettings::HiResPackFormat_t)m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel())); g_settings->ghq_hirs_tile = (int)m_cbxHrsTile.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_f16bpp = (int)m_cbxHrsForce16.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_dump = (int)m_cbxHrsTexEdit.GetCheck() == BST_CHECKED; diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 8336687ca..6bac928f1 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -655,11 +655,11 @@ int InitGfx() if (!g_settings->ghq_use) { - g_settings->ghq_use = g_settings->ghq_fltr() != CSettings::TextureFilter_None || g_settings->ghq_enht() != CSettings::TextureEnht_None || g_settings->ghq_hirs; + g_settings->ghq_use = g_settings->ghq_fltr() != CSettings::TextureFilter_None || g_settings->ghq_enht() != CSettings::TextureEnht_None || g_settings->ghq_hirs() != CSettings::HiResPackFormat_None; if (g_settings->ghq_use) { /* Plugin path */ - int options = g_settings->ghq_fltr() | g_settings->ghq_enht() | g_settings->ghq_cmpr() | texhirs[g_settings->ghq_hirs]; + int options = g_settings->ghq_fltr() | g_settings->ghq_enht() | g_settings->ghq_cmpr() | g_settings->ghq_hirs(); if (g_settings->ghq_enht_cmpr) { options |= COMPRESS_TEX; diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 05cc32844..a19d05a9a 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -39,7 +39,7 @@ CSettings::CSettings() : m_ghq_fltr(TextureFilter_None), m_ghq_enht(TextureEnht_None), m_ghq_cmpr(TextureCompression_S3TC), -ghq_hirs(0), + m_ghq_hirs(HiResPackFormat_None), ghq_use(0), ghq_enht_cmpr(0), ghq_enht_f16bpp(0), @@ -139,7 +139,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_fltr, "ghq_fltr", TextureFilter_None); general_setting(Set_ghq_cmpr, "ghq_cmpr", TextureCompression_S3TC); general_setting(Set_ghq_enht, "ghq_enht", TextureEnht_None); - general_setting(Set_ghq_hirs, "ghq_hirs", 0); + general_setting(Set_ghq_hirs, "ghq_hirs", HiResPackFormat_None); general_setting(Set_ghq_enht_cmpr, "ghq_enht_cmpr", 0); general_setting(Set_ghq_enht_f16bpp, "ghq_enht_f16bpp", 0); general_setting(Set_ghq_enht_gz, "ghq_enht_gz", 1); @@ -353,6 +353,15 @@ void CSettings::SetGhqCmpr(TextureCompression_t value) } } +void CSettings::SetGhqHirs(HiResPackFormat_t value) +{ + if (value != m_ghq_hirs) + { + m_ghq_hirs = value; + m_dirty = true; + } +} + void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove) { uint32_t frame_buffer_original = m_frame_buffer; @@ -458,7 +467,7 @@ void CSettings::ReadSettings() m_ghq_fltr = (TextureFilter_t)GetSetting(Set_ghq_fltr); m_ghq_cmpr = (TextureCompression_t)GetSetting(Set_ghq_cmpr); m_ghq_enht = (TextureEnhancement_t)GetSetting(Set_ghq_enht); - this->ghq_hirs = (uint8_t)GetSetting(Set_ghq_hirs); + m_ghq_hirs = (HiResPackFormat_t)GetSetting(Set_ghq_hirs); this->ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr); this->ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp); this->ghq_enht_gz = GetSetting(Set_ghq_enht_gz); @@ -727,7 +736,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_fltr, m_ghq_fltr); SetSetting(Set_ghq_cmpr, m_ghq_cmpr); SetSetting(Set_ghq_enht, m_ghq_enht); - SetSetting(Set_ghq_hirs, g_settings->ghq_hirs); + SetSetting(Set_ghq_hirs, m_ghq_hirs); SetSetting(Set_ghq_enht_cmpr, g_settings->ghq_enht_cmpr); SetSetting(Set_ghq_enht_f16bpp, g_settings->ghq_enht_f16bpp); SetSetting(Set_ghq_enht_gz, g_settings->ghq_enht_gz); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 27ace39dc..956cc0ae1 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -113,6 +113,12 @@ public: TextureCompression_FXT1 = 0x1000, }; + enum HiResPackFormat_t + { + HiResPackFormat_None = 0, + HiResPackFormat_Riceformat = 0x00020000, + }; + enum SwapMode_t { SwapMode_Old = 0, @@ -200,7 +206,7 @@ public: inline TextureFilter_t ghq_fltr(void) const { return m_ghq_fltr; } inline TextureEnhancement_t ghq_enht(void) const { return m_ghq_enht; } inline TextureCompression_t ghq_cmpr(void) const { return m_ghq_cmpr; } - int ghq_hirs; + inline HiResPackFormat_t ghq_hirs(void) const { return m_ghq_hirs; } int ghq_use; int ghq_enht_cmpr; int ghq_enht_f16bpp; @@ -270,6 +276,7 @@ public: void SetGhqFltr(TextureFilter_t value); void SetGhqEnht(TextureEnhancement_t value); void SetGhqCmpr(TextureCompression_t value); + void SetGhqHirs(HiResPackFormat_t value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); ucode_t DetectUCode(uint32_t uc_crc); void SetUcode(ucode_t value); @@ -313,6 +320,7 @@ private: TextureFilter_t m_ghq_fltr; TextureEnhancement_t m_ghq_enht; TextureCompression_t m_ghq_cmpr; + HiResPackFormat_t m_ghq_hirs; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index 91206b854..bd88a19d0 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -1569,7 +1569,7 @@ void load_palette(uint32_t addr, uint16_t start, uint16_t count) WriteTrace(TraceTLUT, TraceDebug, "%d: %08lx", i, *(uint16_t *)(gfx.RDRAM + (addr ^ 2))); } - if (g_settings->ghq_hirs) + if (g_settings->ghq_hirs() != CSettings::HiResPackFormat_None) { memcpy((uint8_t*)(rdp.pal_8_rice + start), spal, count << 1); } diff --git a/Source/Glide64/rdp.h b/Source/Glide64/rdp.h index 0d42917d0..f7ee84a3b 100644 --- a/Source/Glide64/rdp.h +++ b/Source/Glide64/rdp.h @@ -164,7 +164,6 @@ typedef struct { uint32_t lr_y; } SCISSOR; -extern uint32_t texhirs[]; typedef struct { uint16_t tile_ul_s;