mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 07:21:14 +01:00
SOMEWHAT cleaned up the VideoConfigDiag code:
Also verify the validity of gfx configuration directly after loading rather than in the GUI code (which was kinda stupid anyway). git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7164 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
a8992b7960
commit
c30859dae0
@ -120,6 +120,8 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
||||
{
|
||||
vconfig.Load((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str());
|
||||
|
||||
Connect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(VideoConfigDiag::OnUpdateUI), NULL, this);
|
||||
|
||||
wxNotebook* const notebook = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
// -- GENERAL --
|
||||
@ -188,9 +190,9 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
||||
szr_enh->Add(new SettingChoice(page_general, vconfig.iMaxAnisotropy, wxGetTranslation(af_tooltip), 5, af_choices));
|
||||
|
||||
|
||||
wxStaticText* const text_aamode = new wxStaticText(page_general, -1, _("Anti-Aliasing:"));
|
||||
text_aamode = new wxStaticText(page_general, -1, _("Anti-Aliasing:"));
|
||||
szr_enh->Add(text_aamode, 1, wxALIGN_CENTER_VERTICAL, 0);
|
||||
SettingChoice* const choice_aamode = new SettingChoice(page_general, vconfig.iMultisampleMode, wxGetTranslation(aa_tooltip));
|
||||
choice_aamode = new SettingChoice(page_general, vconfig.iMultisampleMode, wxGetTranslation(aa_tooltip));
|
||||
|
||||
std::vector<std::string>::const_iterator
|
||||
it = vconfig.backend_info.AAModes.begin(),
|
||||
@ -198,11 +200,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
||||
for (; it != itend; ++it)
|
||||
choice_aamode->AppendString(wxGetTranslation(wxString::FromAscii(it->c_str())));
|
||||
|
||||
if (vconfig.backend_info.AAModes.size() <= 1)
|
||||
{
|
||||
choice_aamode->Disable();
|
||||
text_aamode->Disable();
|
||||
}
|
||||
|
||||
choice_aamode->Select(vconfig.iMultisampleMode);
|
||||
szr_enh->Add(choice_aamode);
|
||||
@ -210,14 +207,13 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
||||
|
||||
szr_enh->Add(new SettingCheckBox(page_general, _("Load Native Mipmaps"), wxGetTranslation(native_mips_tooltip), vconfig.bUseNativeMips));
|
||||
szr_enh->Add(new SettingCheckBox(page_general, _("EFB Scaled Copy"), wxGetTranslation(scaled_efb_copy_tooltip), vconfig.bCopyEFBScaled));
|
||||
szr_enh->Add(new SettingCheckBox(page_general, _("Pixel Lighting"), wxGetTranslation(pixel_lighting_tooltip), vconfig.bEnablePixelLigting));
|
||||
szr_enh->Add(pixel_lighting = new SettingCheckBox(page_general, _("Pixel Lighting"), wxGetTranslation(pixel_lighting_tooltip), vconfig.bEnablePixelLigting));
|
||||
szr_enh->Add(new SettingCheckBox(page_general, _("Pixel Depth"), wxGetTranslation(pixel_depth_tooltip), vconfig.bEnablePerPixelDepth));
|
||||
szr_enh->Add(new SettingCheckBox(page_general, _("Force Bi/Trilinear Filtering"), wxGetTranslation(force_filtering_tooltip), vconfig.bForceFiltering));
|
||||
|
||||
if (vconfig.backend_info.bSupports3DVision)
|
||||
{
|
||||
szr_enh->Add(new SettingCheckBox(page_general, _("3D Vision (Requires Fullscreen)"), wxGetTranslation(_3d_vision_tooltip), vconfig.b3DVision));
|
||||
}
|
||||
_3d_vision = new SettingCheckBox(page_general, _("3D Vision (Requires Fullscreen)"), wxGetTranslation(_3d_vision_tooltip), vconfig.b3DVision);
|
||||
_3d_vision->Show(vconfig.backend_info.bSupports3DVision);
|
||||
szr_enh->Add(_3d_vision);
|
||||
|
||||
// - EFB
|
||||
// EFB scale
|
||||
@ -233,21 +229,12 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
||||
//efb_scale_szr->AddStretchSpacer(1);
|
||||
efb_scale_szr->Add(choice_efbscale, 0, wxBOTTOM | wxLEFT, 5);
|
||||
|
||||
SettingCheckBox *emulate_efb_format_changes = new SettingCheckBox(page_general, _("Emulate format changes"), wxGetTranslation(efb_emulate_format_changes_tooltip), vconfig.bEFBEmulateFormatChanges);
|
||||
|
||||
if (!vconfig.backend_info.bSupportsFormatReinterpretation)
|
||||
{
|
||||
emulate_efb_format_changes->SetValue(false);
|
||||
emulate_efb_format_changes->Disable();
|
||||
}
|
||||
emulate_efb_format_changes = new SettingCheckBox(page_general, _("Emulate format changes"), wxGetTranslation(efb_emulate_format_changes_tooltip), vconfig.bEFBEmulateFormatChanges);
|
||||
|
||||
// EFB copy
|
||||
SettingCheckBox* efbcopy_enable = new SettingCheckBox(page_general, _("Enable"), wxGetTranslation(efb_copy_tooltip), vconfig.bEFBCopyEnable);
|
||||
_connect_macro_(efbcopy_enable, VideoConfigDiag::Event_EfbCopy, wxEVT_COMMAND_CHECKBOX_CLICKED, this);
|
||||
efbcopy_texture = new SettingRadioButton(page_general, _("Texture"), wxGetTranslation(efb_copy_texture_tooltip), vconfig.bCopyEFBToTexture, false, wxRB_GROUP);
|
||||
_connect_macro_(efbcopy_texture, VideoConfigDiag::Event_EfbCopyToTexture, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this);
|
||||
efbcopy_ram = new SettingRadioButton(page_general, _("RAM"), wxGetTranslation(efb_copy_ram_tooltip), vconfig.bCopyEFBToTexture, true);
|
||||
_connect_macro_(efbcopy_ram, VideoConfigDiag::Event_EfbCopyToRam, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this);
|
||||
cache_efb_copies = new SettingCheckBox(page_general, _("Enable cache"), wxGetTranslation(cache_efb_copies_tooltip), vconfig.bEFBCopyCacheEnable);
|
||||
wxStaticBoxSizer* const group_efbcopy = new wxStaticBoxSizer(wxHORIZONTAL, page_general, _("Copy"));
|
||||
group_efbcopy->Add(efbcopy_enable, 0, wxLEFT | wxRIGHT | wxBOTTOM, 5);
|
||||
@ -256,24 +243,9 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
||||
group_efbcopy->Add(efbcopy_ram, 0, wxRIGHT, 5);
|
||||
group_efbcopy->Add(cache_efb_copies, 0, wxRIGHT, 5);
|
||||
|
||||
if (!vconfig.backend_info.bSupportsEFBToRAM)
|
||||
{
|
||||
efbcopy_ram->Disable();
|
||||
vconfig.bCopyEFBToTexture = true;
|
||||
efbcopy_texture->SetValue(true);
|
||||
}
|
||||
if (!vconfig.bEFBCopyEnable)
|
||||
{
|
||||
efbcopy_ram->Disable();
|
||||
efbcopy_texture->Disable();
|
||||
cache_efb_copies->Disable();
|
||||
}
|
||||
else if (vconfig.bCopyEFBToTexture)
|
||||
cache_efb_copies->Disable();
|
||||
|
||||
// - safe texture cache
|
||||
SettingCheckBox* stc_enable = new SettingCheckBox(page_general, _("Enable"), wxGetTranslation(stc_tooltip), vconfig.bSafeTextureCache);
|
||||
_connect_macro_(stc_enable, VideoConfigDiag::Event_Stc, wxEVT_COMMAND_CHECKBOX_CLICKED, this);
|
||||
|
||||
stc_safe = new wxRadioButton(page_general, -1, _("Safe"),
|
||||
wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
|
||||
@ -297,12 +269,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
||||
if (128 == vconfig.iSafeTextureCache_ColorSamples)
|
||||
stc_fast->SetValue(true);
|
||||
|
||||
if (!vconfig.bSafeTextureCache)
|
||||
{
|
||||
stc_safe->Disable();
|
||||
stc_normal->Disable();
|
||||
stc_fast->Disable();
|
||||
}
|
||||
|
||||
wxStaticBoxSizer* const group_basic = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Basic"));
|
||||
szr_general->Add(group_basic, 0, wxEXPAND | wxALL, 5);
|
||||
@ -370,7 +336,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
||||
// - XFB
|
||||
{
|
||||
SettingCheckBox* enable_xfb = new SettingCheckBox(page_advanced, _("Enable"), wxGetTranslation(xfb_tooltip), vconfig.bUseXFB);
|
||||
_connect_macro_(enable_xfb, VideoConfigDiag::Event_Xfb, wxEVT_COMMAND_CHECKBOX_CLICKED, this);
|
||||
virtual_xfb = new SettingRadioButton(page_advanced, _("Virtual"), wxGetTranslation(xfb_tooltip), vconfig.bUseRealXFB, true, wxRB_GROUP);
|
||||
real_xfb = new SettingRadioButton(page_advanced, _("Real"), wxGetTranslation(xfb_tooltip), vconfig.bUseRealXFB);
|
||||
|
||||
@ -381,18 +346,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
||||
group_xfb->Add(virtual_xfb, 0, wxRIGHT, 5);
|
||||
group_xfb->Add(real_xfb, 0, wxRIGHT, 5);
|
||||
|
||||
if (!vconfig.backend_info.bSupportsRealXFB)
|
||||
{
|
||||
real_xfb->Disable();
|
||||
vconfig.bUseRealXFB = false;
|
||||
virtual_xfb->SetValue(true);
|
||||
}
|
||||
|
||||
if (!vconfig.bUseXFB)
|
||||
{
|
||||
real_xfb->Disable();
|
||||
virtual_xfb->Disable();
|
||||
}
|
||||
|
||||
} // xfb
|
||||
|
||||
@ -459,7 +412,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
||||
wxButton* const btn_close = new wxButton(this, -1, _("Close"), wxDefaultPosition);
|
||||
_connect_macro_(btn_close, VideoConfigDiag::Event_ClickClose, wxEVT_COMMAND_BUTTON_CLICKED, this);
|
||||
|
||||
Connect(-1, wxEVT_CLOSE_WINDOW, wxCloseEventHandler(VideoConfigDiag::Event_Close), (wxObject*)0, this);
|
||||
Connect(wxID_ANY, wxEVT_CLOSE_WINDOW, wxCloseEventHandler(VideoConfigDiag::Event_Close), (wxObject*)0, this);
|
||||
|
||||
wxBoxSizer* const szr_main = new wxBoxSizer(wxVERTICAL);
|
||||
szr_main->Add(notebook, 1, wxEXPAND | wxALL, 5);
|
||||
@ -467,4 +420,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
||||
|
||||
SetSizerAndFit(szr_main);
|
||||
Center();
|
||||
|
||||
UpdateWindowUI();
|
||||
}
|
||||
|
@ -71,55 +71,6 @@ protected:
|
||||
void Event_Backend(wxCommandEvent &ev) { ev.Skip(); } // TODO: Query list of supported AA modes
|
||||
void Event_Adapter(wxCommandEvent &ev) { ev.Skip(); } // TODO
|
||||
|
||||
void Event_EfbCopy(wxCommandEvent &ev)
|
||||
{
|
||||
if (ev.GetInt() == 0)
|
||||
{
|
||||
efbcopy_texture->Disable();
|
||||
efbcopy_ram->Disable();
|
||||
cache_efb_copies->Disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
efbcopy_texture->Enable();
|
||||
if (vconfig.backend_info.bSupportsEFBToRAM)
|
||||
{
|
||||
efbcopy_ram->Enable();
|
||||
if (!vconfig.bCopyEFBToTexture)
|
||||
cache_efb_copies->Enable();
|
||||
}
|
||||
}
|
||||
ev.Skip();
|
||||
}
|
||||
|
||||
void Event_EfbCopyToTexture(wxCommandEvent &ev)
|
||||
{
|
||||
cache_efb_copies->Disable();
|
||||
ev.Skip();
|
||||
}
|
||||
|
||||
void Event_EfbCopyToRam(wxCommandEvent &ev)
|
||||
{
|
||||
cache_efb_copies->Enable();
|
||||
ev.Skip();
|
||||
}
|
||||
|
||||
void Event_Stc(wxCommandEvent &ev)
|
||||
{
|
||||
if (ev.GetInt() == 0)
|
||||
{
|
||||
stc_safe->Disable();
|
||||
stc_normal->Disable();
|
||||
stc_fast->Disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
stc_safe->Enable();
|
||||
stc_normal->Enable();
|
||||
stc_fast->Enable();
|
||||
}
|
||||
ev.Skip();
|
||||
}
|
||||
void Event_StcSafe(wxCommandEvent &ev) { vconfig.iSafeTextureCache_ColorSamples = 0; ev.Skip(); }
|
||||
void Event_StcNormal(wxCommandEvent &ev) { vconfig.iSafeTextureCache_ColorSamples = 512; ev.Skip(); }
|
||||
void Event_StcFast(wxCommandEvent &ev) { vconfig.iSafeTextureCache_ColorSamples = 128; ev.Skip(); }
|
||||
@ -134,31 +85,57 @@ protected:
|
||||
ev.Skip();
|
||||
}
|
||||
|
||||
void Event_Xfb(wxCommandEvent &ev)
|
||||
{
|
||||
if (ev.GetInt() == 0)
|
||||
{
|
||||
virtual_xfb->Disable();
|
||||
real_xfb->Disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
virtual_xfb->Enable();
|
||||
if(vconfig.backend_info.bSupportsRealXFB) real_xfb->Enable();
|
||||
}
|
||||
ev.Skip();
|
||||
}
|
||||
|
||||
void Event_ClickClose(wxCommandEvent&);
|
||||
void Event_Close(wxCloseEvent&);
|
||||
|
||||
wxRadioButton* stc_safe;
|
||||
wxRadioButton* stc_normal;
|
||||
wxRadioButton* stc_fast;
|
||||
// Enables/disables UI elements depending on current config
|
||||
void OnUpdateUI(wxUpdateUIEvent& ev)
|
||||
{
|
||||
// Anti-aliasing
|
||||
choice_aamode->Enable(vconfig.backend_info.AAModes.size() > 1);
|
||||
text_aamode->Enable(vconfig.backend_info.AAModes.size() > 1);
|
||||
|
||||
// pixel lighting
|
||||
pixel_lighting->Enable(vconfig.backend_info.bSupportsPixelLighting);
|
||||
|
||||
// 3D vision
|
||||
_3d_vision->Show(vconfig.backend_info.bSupports3DVision);
|
||||
|
||||
// EFB copy
|
||||
efbcopy_texture->Enable(vconfig.bEFBCopyEnable);
|
||||
efbcopy_ram->Enable(vconfig.bEFBCopyEnable && vconfig.backend_info.bSupportsEFBToRAM);
|
||||
cache_efb_copies->Enable(vconfig.bEFBCopyEnable && vconfig.backend_info.bSupportsEFBToRAM && !vconfig.bCopyEFBToTexture);
|
||||
|
||||
// EFB format change emulation
|
||||
emulate_efb_format_changes->Enable(vconfig.backend_info.bSupportsFormatReinterpretation);
|
||||
|
||||
// ATC
|
||||
stc_safe->Enable(vconfig.bSafeTextureCache);
|
||||
stc_normal->Enable(vconfig.bSafeTextureCache);
|
||||
stc_fast->Enable(vconfig.bSafeTextureCache);
|
||||
|
||||
// XFB
|
||||
virtual_xfb->Enable(vconfig.bUseXFB);
|
||||
real_xfb->Enable(vconfig.bUseXFB && vconfig.backend_info.bSupportsRealXFB);
|
||||
|
||||
ev.Skip();
|
||||
}
|
||||
|
||||
wxStaticText* text_aamode;
|
||||
SettingChoice* choice_aamode;
|
||||
|
||||
SettingCheckBox* pixel_lighting;
|
||||
|
||||
SettingCheckBox* _3d_vision;
|
||||
|
||||
SettingRadioButton* efbcopy_texture;
|
||||
SettingRadioButton* efbcopy_ram;
|
||||
SettingCheckBox* cache_efb_copies;
|
||||
SettingCheckBox* emulate_efb_format_changes;
|
||||
|
||||
wxRadioButton* stc_safe;
|
||||
wxRadioButton* stc_normal;
|
||||
wxRadioButton* stc_fast;
|
||||
|
||||
SettingRadioButton* virtual_xfb;
|
||||
SettingRadioButton* real_xfb;
|
||||
|
@ -121,6 +121,9 @@ void VideoConfig::Load(const char *ini_file)
|
||||
bool bTmp;
|
||||
iniFile.Get("Interface", "UsePanicHandlers", &bTmp, true);
|
||||
SetEnableAlert(bTmp);
|
||||
|
||||
VerifyValidity();
|
||||
|
||||
}
|
||||
|
||||
void VideoConfig::GameIniLoad(const char *ini_file)
|
||||
@ -176,6 +179,19 @@ void VideoConfig::GameIniLoad(const char *ini_file)
|
||||
iniFile.Get("Video", "ZTPSpeedupHack", &bZTPSpeedHack);
|
||||
if (iniFile.Exists("Video", "DlistCachingEnable"))
|
||||
iniFile.Get("Video", "DlistCachingEnable", &bDlistCachingEnable);
|
||||
|
||||
VerifyValidity();
|
||||
}
|
||||
|
||||
void VideoConfig::VerifyValidity()
|
||||
{
|
||||
// TODO: Check iMaxAnisotropy value
|
||||
if (!backend_info.bSupportsEFBToRAM) bCopyEFBToTexture = true;
|
||||
if (iMultisampleMode >= (int)backend_info.AAModes.size()) iMultisampleMode = 0;
|
||||
if (!backend_info.bSupportsRealXFB) bUseRealXFB = false;
|
||||
if (!backend_info.bSupports3DVision) b3DVision = false;
|
||||
if (!backend_info.bSupportsFormatReinterpretation) bEFBEmulateFormatChanges = false;
|
||||
if (!backend_info.bSupportsPixelLighting) bEnablePixelLigting = false;
|
||||
}
|
||||
|
||||
void VideoConfig::Save(const char *ini_file)
|
||||
|
@ -64,6 +64,7 @@ struct VideoConfig
|
||||
VideoConfig();
|
||||
void Load(const char *ini_file);
|
||||
void GameIniLoad(const char *ini_file);
|
||||
void VerifyValidity();
|
||||
void Save(const char *ini_file);
|
||||
void UpdateProjectionHack();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user