[Glide64] Use enum for Filtering

This commit is contained in:
zilmar 2017-01-29 20:10:32 +11:00
parent e572f531d5
commit fbdc95c30a
4 changed files with 31 additions and 12 deletions

View File

@ -482,10 +482,10 @@ public:
TTSetTxt(IDC_CMB_FILTERING_MODE, tooltip.c_str());
m_cmbFiltering.Attach(GetDlgItem(IDC_CMB_FILTERING_MODE));
m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Automatic"), 0);
m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Force Bilinear"), 1);
m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Force Point-sampled"), 2);
SetComboBoxIndex(m_cmbFiltering, g_settings->filtering);
m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Automatic"), CSettings::Filter_Automatic);
m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Force Bilinear"), CSettings::Filter_ForceBilinear);
m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Force Point-sampled"), CSettings::Filter_ForcePointSampled);
SetComboBoxIndex(m_cmbFiltering, (uint32_t)g_settings->filtering());
tooltip = "Buffer swapping method:\n\nThere are 3 buffer swapping methods:\n\n* old - swap buffers when vertical interrupt has occurred.\n* new - swap buffers when set of conditions is satisfied. Prevents flicker on some games.\n* hybrid - mix of first two methods. Can prevent even more flickering then previous method, but also can cause artefacts.\nIf you have flickering problems in a game (or graphics that don't show), try to change swapping method.\n\n[Recommended: new (hybrid for Paper Mario)]";
TTSetTxt(IDC_TXT_BUFFER_SWAPPING, tooltip.c_str());
@ -560,7 +560,7 @@ public:
{
CSettings oldsettings = *g_settings;
g_settings->filtering = m_cmbFiltering.GetItemData(m_cmbFiltering.GetCurSel());
g_settings->SetFiltering((CSettings::Filtering_t)m_cmbFiltering.GetItemData(m_cmbFiltering.GetCurSel()));
g_settings->SetAspectmode((CSettings::AspectMode_t)m_cmbAspect.GetItemData(m_cmbAspect.GetCurSel()));
g_settings->swapmode = m_cmbBufferSwap.GetItemData(m_cmbBufferSwap.GetCurSel());
g_settings->fog = m_cbxFog.GetCheck() == BST_CHECKED;

View File

@ -21,8 +21,8 @@ advanced_options(0),
texenh_options(0),
vsync(0),
m_rotate(Rotate_None),
m_filtering(Filter_Automatic),
filtering(0),
fog(0),
buff_clear(0),
swapmode(0),
@ -148,7 +148,7 @@ void CSettings::RegisterSettings(void)
general_setting(Set_ghq_hirs_dump, "ghq_hirs_dump", 0);
general_setting(Set_optimize_texrect_default, "optimize_texrect", true);
general_setting(Set_filtering_default, "filtering", 0);
general_setting(Set_filtering_default, "filtering", CSettings::Filter_Automatic);
general_setting(Set_lodmode_default, "lodmode", 0);
general_setting(Set_fog_default, "fog", 1);
general_setting(Set_buff_clear_default, "buff_clear", 1);
@ -215,6 +215,15 @@ void CSettings::SetAspectmode(AspectMode_t value)
}
}
void CSettings::SetFiltering(Filtering_t value)
{
if (value != m_filtering)
{
m_filtering = value;
m_dirty = true;
}
}
void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove)
{
uint32_t frame_buffer_original = m_frame_buffer;
@ -483,7 +492,6 @@ void CSettings::ReadGameSettings(const char * name)
if (fb_crc_mode >= 0) g_settings->fb_crc_mode = (CSettings::FBCRCMODE)fb_crc_mode;
g_settings->filtering = GetSetting(g_romopen ? Set_filtering : Set_filtering_default);
g_settings->fog = GetSetting(g_romopen ? Set_fog : Set_fog_default);
g_settings->buff_clear = GetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default);
g_settings->swapmode = GetSetting(g_romopen ? Set_swapmode : Set_swapmode_default);
@ -544,6 +552,8 @@ void CSettings::ReadGameSettings(const char * name)
else if (read_back_to_screen == 0) { fb_remove_bits |= fb_read_back_to_screen | fb_read_back_to_screen2; }
g_settings->UpdateFrameBufferBits(fb_add_bits, fb_remove_bits);
SetFiltering((Filtering_t)GetSetting(g_romopen ? Set_filtering : Set_filtering_default));
SetAspectmode((AspectMode_t)GetSetting(g_romopen ? Set_aspect : Set_aspect_default));
g_settings->flame_corona = g_settings->hacks(hack_Zelda) && !fb_depth_render_enabled();
}
@ -590,7 +600,7 @@ void CSettings::WriteSettings(void)
SetSetting(Set_ghq_hirs_let_texartists_fly, g_settings->ghq_hirs_let_texartists_fly);
SetSetting(Set_ghq_hirs_dump, g_settings->ghq_hirs_dump);
SetSetting(g_romopen ? Set_filtering : Set_filtering_default, g_settings->filtering);
SetSetting(g_romopen ? Set_filtering : Set_filtering_default, filtering());
SetSetting(g_romopen ? Set_fog : Set_fog_default, g_settings->fog);
SetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default, g_settings->buff_clear);
SetSetting(g_romopen ? Set_swapmode : Set_swapmode_default, g_settings->swapmode);

View File

@ -76,6 +76,13 @@ public:
Rotate_270 = 3,
};
enum Filtering_t
{
Filter_Automatic = 0,
Filter_ForceBilinear = 1,
Filter_ForcePointSampled = 2,
};
uint32_t res_x, scr_res_x;
uint32_t res_y, scr_res_y;
#ifndef ANDROID
@ -87,7 +94,6 @@ public:
int vsync;
int filtering;
int fog;
int buff_clear;
int swapmode;
@ -120,6 +126,7 @@ public:
inline const char * log_dir(void) const { return m_log_dir; }
inline bool FlushLogs(void) const { return m_FlushLogs; }
inline ScreenRotate_t rotate(void) const { return m_rotate; }
inline Filtering_t filtering(void) const { return m_filtering; }
inline AspectMode_t aspectmode(void) const { return m_aspectmode; }
//Texture filtering options
@ -186,6 +193,7 @@ public:
int wrpFBO;
int wrpAnisotropic;
void SetAspectmode(AspectMode_t value);
void SetFiltering(Filtering_t value);
void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove);
void ReadGameSettings(const char * name);
@ -202,6 +210,7 @@ private:
AspectMode_t m_aspectmode;
uint32_t m_frame_buffer;
ScreenRotate_t m_rotate;
Filtering_t m_filtering;
hacks_t m_hacks;
};

View File

@ -867,14 +867,14 @@ void TexCache()
int tile = rdp.cur_tile + i;
if (g_settings->filtering == 0)
if (g_settings->filtering() == CSettings::Filter_Automatic)
{
int filter = (rdp.filter_mode != 2) ? GR_TEXTUREFILTER_POINT_SAMPLED : GR_TEXTUREFILTER_BILINEAR;
grTexFilterMode(tmu, filter, filter);
}
else
{
int filter = (g_settings->filtering == 1) ? GR_TEXTUREFILTER_BILINEAR : GR_TEXTUREFILTER_POINT_SAMPLED;
int filter = (g_settings->filtering() == CSettings::Filter_ForceBilinear) ? GR_TEXTUREFILTER_BILINEAR : GR_TEXTUREFILTER_POINT_SAMPLED;
grTexFilterMode(tmu, filter, filter);
}