[Glide64] Get ghq_enht to use an enum

This commit is contained in:
zilmar 2017-01-30 18:01:22 +11:00
parent d2918162e7
commit f15a154cd4
5 changed files with 40 additions and 32 deletions

View File

@ -105,19 +105,6 @@ void ConfigCleanup(void)
void CloseConfig();
uint32_t texenht[] =
{
NO_ENHANCEMENT, //"None"
NO_ENHANCEMENT, //"Store"
X2_ENHANCEMENT, //"X2"
X2SAI_ENHANCEMENT, //"X2SAI"
HQ2X_ENHANCEMENT, //"HQ2X"
HQ2XS_ENHANCEMENT, //"HQ2XS"
LQ2X_ENHANCEMENT, //"LQ2X"
LQ2XS_ENHANCEMENT, //"LQ2XS"
HQ4X_ENHANCEMENT, //"HQ4X"
};
uint32_t texcmpr[] =
{
//NO_COMPRESSION, //"None"
@ -646,16 +633,15 @@ public:
TTSetTxt(IDC_TXT_ENHANCEMENT, tooltip.c_str());
TTSetTxt(IDC_CMB_ENHANCEMENT, tooltip.c_str());
m_cmbEnhEnhancement.Attach(GetDlgItem(IDC_CMB_ENHANCEMENT));
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("None"), 0);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("Store"), 1);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("X2"), 2);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("X2SAI"), 3);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ2X"), 4);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ2XS"), 5);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("LQ2X"), 6);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("LQ2XS"), 7);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ4X"), 8);
SetComboBoxIndex(m_cmbEnhEnhancement, g_settings->ghq_enht);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("None"), CSettings::TextureEnht_None);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("X2"), CSettings::TextureEnht_X2);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("X2SAI"), CSettings::TextureEnht_X2SAI);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ2X"), CSettings::TextureEnht_HQ2X);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ2XS"), CSettings::TextureEnht_HQ2XS);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("LQ2X"), CSettings::TextureEnht_LQ2X);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("LQ2XS"), CSettings::TextureEnht_LQ2XS);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ4X"), CSettings::TextureEnht_HQ4X);
SetComboBoxIndex(m_cmbEnhEnhancement, g_settings->ghq_enht());
tooltip = "Hi-res pack format:\n\nChoose which method is to be used for loading Hi-res texture packs.\nOnly Rice's format is available currently.\nLeave on \"None\" if you will not be needing to load hi-res packs.\n\n[Recommended: Rice's format. Default: \"None\"]";
TTSetTxt(IDC_TXT_FORMAT_CHOICES, tooltip.c_str());
@ -737,7 +723,7 @@ public:
CSettings oldsettings = *g_settings;
g_settings->SetGhqFltr((CSettings::TextureFilter_t)m_cmbEnhFilter.GetItemData(m_cmbEnhFilter.GetCurSel()));
g_settings->ghq_enht = m_cmbEnhEnhancement.GetItemData(m_cmbEnhEnhancement.GetCurSel());
g_settings->SetGhqEnht((CSettings::TextureEnhancement_t)m_cmbEnhEnhancement.GetItemData(m_cmbEnhEnhancement.GetCurSel()));
g_settings->ghq_cache_size = atoi(texcache);
g_settings->ghq_enht_nobg = (int)m_cbxEnhIgnoreBG.GetCheck() == BST_CHECKED;
g_settings->ghq_enht_cmpr = (int)m_cbxEnhTexCompression.GetCheck() == BST_CHECKED;

View File

@ -807,11 +807,11 @@ int InitGfx()
if (!g_settings->ghq_use)
{
g_settings->ghq_use = g_settings->ghq_fltr() != CSettings::TextureFilter_None || 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() != CSettings::TextureEnht_None || g_settings->ghq_hirs;
if (g_settings->ghq_use)
{
/* Plugin path */
int options = 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() | 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)

View File

@ -32,7 +32,7 @@ buff_clear(0),
//Texture filtering options
texture_dir(""),
m_ghq_fltr(TextureFilter_None),
ghq_enht(0),
m_ghq_enht(TextureEnht_None),
ghq_cmpr(0),
ghq_hirs(0),
ghq_use(0),
@ -130,7 +130,7 @@ void CSettings::RegisterSettings(void)
general_setting(Set_unk_clear, "unk_clear", 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_enht, "ghq_enht", TextureEnht_None);
general_setting(Set_ghq_hirs, "ghq_hirs", 0);
general_setting(Set_ghq_enht_cmpr, "ghq_enht_cmpr", 0);
general_setting(Set_ghq_enht_tile, "ghq_enht_tile", 0);
@ -251,6 +251,15 @@ void CSettings::SetGhqFltr(TextureFilter_t value)
}
}
void CSettings::SetGhqEnht(TextureEnhancement_t value)
{
if (value != m_ghq_enht)
{
m_ghq_enht = value;
m_dirty = true;
}
}
void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove)
{
uint32_t frame_buffer_original = m_frame_buffer;
@ -336,7 +345,7 @@ void CSettings::ReadSettings()
this->texture_dir = texture_dir;
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);
m_ghq_enht = (TextureEnhancement_t)GetSetting(Set_ghq_enht);
this->ghq_hirs = (uint8_t)GetSetting(Set_ghq_hirs);
this->ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr);
this->ghq_enht_tile = GetSetting(Set_ghq_enht_tile);
@ -608,7 +617,7 @@ void CSettings::WriteSettings(void)
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_enht, m_ghq_enht);
SetSetting(Set_ghq_hirs, g_settings->ghq_hirs);
SetSetting(Set_ghq_enht_cmpr, g_settings->ghq_enht_cmpr);
SetSetting(Set_ghq_enht_tile, g_settings->ghq_enht_tile);

View File

@ -94,6 +94,18 @@ public:
TextureFilter_SharpFiltering2 = 0x20,
};
enum TextureEnhancement_t
{
TextureEnht_None = 0x00,
TextureEnht_X2 = 0x100,
TextureEnht_X2SAI = 0x200,
TextureEnht_HQ2X = 0x300,
TextureEnht_HQ2XS = 0x600,
TextureEnht_LQ2X = 0x400,
TextureEnht_LQ2XS = 0x700,
TextureEnht_HQ4X = 0x500,
};
enum SwapMode_t
{
SwapMode_Old = 0,
@ -167,7 +179,7 @@ public:
//Texture filtering options
std::string texture_dir;
inline TextureFilter_t ghq_fltr(void) const { return m_ghq_fltr; }
int ghq_enht;
inline TextureEnhancement_t ghq_enht(void) const { return m_ghq_enht; }
int ghq_cmpr;
int ghq_hirs;
int ghq_use;
@ -232,6 +244,7 @@ public:
void SetFiltering(Filtering_t value);
void SetSwapMode(SwapMode_t value);
void SetGhqFltr(TextureFilter_t value);
void SetGhqEnht(TextureEnhancement_t value);
void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove);
void ReadGameSettings(const char * name);
@ -253,6 +266,7 @@ private:
SwapMode_t m_swapmode;
PixelLevelOfDetail_t m_lodmode;
TextureFilter_t m_ghq_fltr;
TextureEnhancement_t m_ghq_enht;
StippleMode_t m_stipple_mode;
hacks_t m_hacks;
};

View File

@ -164,7 +164,6 @@ typedef struct {
uint32_t lr_y;
} SCISSOR;
extern uint32_t texenht[];
extern uint32_t texcmpr[];
extern uint32_t texhirs[];