* GUI Video-Settings changes:

- Removed recent ghanges about separate per-game Video Settings
  - Added "One Window 3-State Support" (very close to full implementation)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7391 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
gnick79
2011-03-21 19:57:31 +00:00
parent d332cc342d
commit 017735b9ff
19 changed files with 930 additions and 563 deletions
@@ -16,7 +16,6 @@
// http://code.google.com/p/dolphin-emu/
#include "VideoBackendBase.h"
#include "../../VideoCommon/Src/VideoConfig.h"
// TODO: ugly
#ifdef _WIN32
@@ -74,13 +73,3 @@ void VideoBackend::ActivateBackend(const std::string& name)
if (name == (*it)->GetName())
g_video_backend = *it;
}
void VideoBackend::LoadConfig()
{
g_Config.Load(((File::GetUserPath(D_CONFIG_IDX) + ini_name) + ".ini").c_str());
}
void VideoBackend::SaveConfig()
{
g_Config.Save(((File::GetUserPath(D_CONFIG_IDX) + ini_name) + ".ini").c_str());
}
-10
View File
@@ -83,10 +83,6 @@ struct SCPFifoStruct
class VideoBackend
{
public:
const char* const ini_name;
VideoBackend(const char* _ini_name) : ini_name(_ini_name) {}
virtual ~VideoBackend() {}
virtual void EmuStateChange(EMUSTATE_CHANGE) = 0;
@@ -131,9 +127,6 @@ public:
virtual writeFn16 Video_PEWrite16() = 0;
virtual writeFn32 Video_PEWrite32() = 0;
void LoadConfig();
void SaveConfig();
static void PopulateList();
static void ClearList();
static void ActivateBackend(const std::string& name);
@@ -145,9 +138,6 @@ extern VideoBackend* g_video_backend;
// inherited by dx9/dx11/ogl backends
class VideoBackendHardware : public VideoBackend
{
protected:
VideoBackendHardware(const char* _ini_name) : VideoBackend(_ini_name) {}
void DoState(PointerWrap &p);
void RunLoop(bool enable);
-4
View File
@@ -1377,11 +1377,7 @@ void CConfigMain::OnSelectionChanged(wxCommandEvent& ev)
void CConfigMain::OnConfig(wxCommandEvent&)
{
if (g_video_backend)
{
g_video_backend->LoadConfig();
g_video_backend->ShowConfig(this);
g_video_backend->SaveConfig();
}
}
// Search for avaliable resolutions
-4
View File
@@ -1161,11 +1161,7 @@ void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED (event))
void CFrame::OnConfigGFX(wxCommandEvent& WXUNUSED (event))
{
if (g_video_backend)
{
g_video_backend->LoadConfig();
g_video_backend->ShowConfig(this);
g_video_backend->SaveConfig();
}
}
void CFrame::OnConfigDSP(wxCommandEvent& WXUNUSED (event))
@@ -29,7 +29,6 @@
#include "Blob.h"
#include "Core.h"
#include "ISOProperties.h"
#include "VideoConfigDiag.h"
#include "IniFile.h"
#include "FileUtil.h"
#include "CDUtils.h"
@@ -125,7 +124,6 @@ BEGIN_EVENT_TABLE(CGameListCtrl, wxListCtrl)
EVT_LIST_COL_BEGIN_DRAG(LIST_CTRL, CGameListCtrl::OnColBeginDrag)
EVT_LIST_COL_CLICK(LIST_CTRL, CGameListCtrl::OnColumnClick)
EVT_MENU(IDM_PROPERTIES, CGameListCtrl::OnProperties)
EVT_MENU(IDM_GAMEVIDEOCONFIG, CGameListCtrl::OnGameVideoConfig)
EVT_MENU(IDM_GAMEWIKI, CGameListCtrl::OnWiki)
EVT_MENU(IDM_OPENCONTAININGFOLDER, CGameListCtrl::OnOpenContainingFolder)
EVT_MENU(IDM_OPENSAVEFOLDER, CGameListCtrl::OnOpenSaveFolder)
@@ -1001,7 +999,6 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
{
wxMenu* popupMenu = new wxMenu;
popupMenu->Append(IDM_PROPERTIES, _("&Properties"));
popupMenu->Append(IDM_GAMEVIDEOCONFIG, _("&Graphics Configuration"));
popupMenu->Append(IDM_GAMEWIKI, _("&Wiki"));
popupMenu->AppendSeparator();
@@ -1170,31 +1167,6 @@ void CGameListCtrl::OnProperties(wxCommandEvent& WXUNUSED (event))
Update();
}
void CGameListCtrl::OnGameVideoConfig(wxCommandEvent&)
{
const GameListItem* const iso = GetSelectedISO();
if (!iso)
return;
VideoConfig const vc = g_Config;
g_Config.SetAllUndetermined();
// ugly
DiscIO::IVolume* const open_iso = DiscIO::CreateVolumeFromFilename(iso->GetFileName());
std::string const unique_id = open_iso->GetUniqueID();
std::string const ini_path = File::GetUserPath(D_GAMECONFIG_IDX) + unique_id + ".ini";
g_Config.GameIniLoad(ini_path.c_str());
delete open_iso;
VideoConfigDiag vcd(this, unique_id, true);
vcd.ShowModal();
g_Config.GameIniSave(ini_path.c_str());
g_Config = vc;
}
void CGameListCtrl::OnWiki(wxCommandEvent& WXUNUSED (event))
{
const GameListItem *iso = GetSelectedISO();
-1
View File
@@ -98,7 +98,6 @@ private:
void OnKeyPress(wxListEvent& event);
void OnSize(wxSizeEvent& event);
void OnProperties(wxCommandEvent& event);
void OnGameVideoConfig(wxCommandEvent&);
void OnWiki(wxCommandEvent& event);
void OnOpenContainingFolder(wxCommandEvent& event);
void OnOpenSaveFolder(wxCommandEvent& event);
-1
View File
@@ -92,7 +92,6 @@ enum
IDM_RESTART,
IDM_CHANGEDISC,
IDM_PROPERTIES,
IDM_GAMEVIDEOCONFIG,
IDM_GAMEWIKI,
IDM_LOAD_WII_MENU,
IDM_CONNECT_WIIMOTE1,
File diff suppressed because it is too large Load Diff
+122 -19
View File
@@ -17,29 +17,36 @@
#include <wx/panel.h>
#include <wx/spinctrl.h>
class SettingCheckBox : public wxCheckBox
template <typename U>
class BoolSettingCB : public wxCheckBox
{
public:
SettingCheckBox(wxWindow* parent, const wxString& label, const wxString& tooltip,
bool &setting, long style = 0);
BoolSettingCB(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool reverse = false, long style = 0);
// overload constructor
BoolSettingCB(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool &def_setting, bool &state, bool reverse = false, long style = 0);
void UpdateValue(wxCommandEvent& ev)
{
int const val = Get3StateValue();
*reinterpret_cast<u8*>(&m_setting) = (u8)val;
if (m_state) *m_state = (ev.GetInt() != wxCHK_UNDETERMINED);
m_setting = (ev.GetInt() == wxCHK_UNDETERMINED) ? d_setting : ((ev.GetInt() != 0) & true); // discriminate CheckBox 3State
m_setting = m_setting ^ m_reverse;
ev.Skip();
}
private:
bool &m_setting;
bool &d_setting;
bool *m_state;
const bool m_reverse;
};
class SettingRadioButton : public wxRadioButton
template <typename W>
class BoolSettingRB : public wxRadioButton
{
public:
SettingRadioButton(wxWindow* parent, const wxString& label, const wxString& tooltip,
bool &setting, bool reverse = false, long style = 0);
BoolSettingRB(wxWindow* parent, const wxString& label, const wxString& tooltip, bool &setting, bool reverse = false, long style = 0);
void UpdateValue(wxCommandEvent& ev)
{
m_setting = (ev.GetInt() != 0) ^ m_reverse;
@@ -51,6 +58,9 @@ private:
const bool m_reverse;
};
typedef BoolSettingCB<wxCheckBox> SettingCheckBox;
typedef BoolSettingRB<wxRadioButton> SettingRadioButton;
template <typename T>
class IntegerSetting : public wxSpinCtrl
{
@@ -62,7 +72,6 @@ public:
m_setting = ev.GetInt();
ev.Skip();
}
private:
T& m_setting;
};
@@ -74,10 +83,17 @@ class SettingChoice : public wxChoice
public:
SettingChoice(wxWindow* parent, int &setting, const wxString& tooltip, int num = 0, const wxString choices[] = NULL, long style = 0);
void UpdateValue(wxCommandEvent& ev);
// overload constructor
SettingChoice(wxWindow* parent, int &setting, int &def_setting, bool &state, int &cur_index, const wxString& tooltip, int num = 0, const wxString choices[] = NULL, long style = 0);
void UpdateValue(wxCommandEvent& ev);
void UpdateValue_variant(wxCommandEvent& ev);
private:
int &m_setting;
int &d_setting;
int &m_index;
bool *m_state;
};
class CGameListCtrl;
@@ -85,33 +101,120 @@ class CGameListCtrl;
class VideoConfigDiag : public wxDialog
{
public:
VideoConfigDiag(wxWindow* parent, const std::string &title, bool is_game_config = false);
VideoConfigDiag(wxWindow* parent, const std::string &title, const std::string& ininame);
private:
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_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(); }
void Event_StcSafe(wxCommandEvent &ev) { cur_vconfig.iSafeTextureCache_ColorSamples = 0; ev.Skip(); }
void Event_StcNormal(wxCommandEvent &ev) { cur_vconfig.iSafeTextureCache_ColorSamples = 512; ev.Skip(); }
void Event_StcFast(wxCommandEvent &ev) { cur_vconfig.iSafeTextureCache_ColorSamples = 128; ev.Skip(); }
void Event_PPShader(wxCommandEvent &ev)
{
const int sel = ev.GetInt();
if (sel)
vconfig.sPostProcessingShader = ev.GetString().mb_str();
cur_vconfig.sPostProcessingShader = ev.GetString().mb_str();
else
vconfig.sPostProcessingShader.clear();
cur_vconfig.sPostProcessingShader.clear();
ev.Skip();
}
void Event_ClickClose(wxCommandEvent&);
void Event_Close(wxCloseEvent&);
void Event_OnProfileChange(wxCommandEvent& ev);
// Enables/disables UI elements depending on current config - if appropriate also updates g_Config
void OnUpdateUI(wxUpdateUIEvent& ev);
// Refresh UI values from current config (used when reloading config)
void SetUIValuesFromConfig();
VideoConfig& vconfig;
// Redraw the aspect about some UI controls when a profile is selected
void ChangeStyle();
// Don't mess with keeping two comboboxes in sync, use only one CB instead..
SettingChoice* profile_cb; // "General" tab
wxStaticText* profile_text; // "Advanced" tab
wxChoice* choice_adapter;
wxChoice* choice_aspect;
SettingCheckBox* widescreen_hack;
SettingCheckBox* vsync;
SettingChoice* anisotropic_filtering;
wxStaticText* text_aamode;
SettingChoice* choice_aamode;
SettingCheckBox* native_mips;
SettingCheckBox* efb_scaled_copy;
SettingCheckBox* pixel_lighting;
SettingCheckBox* pixel_depth;
SettingCheckBox* force_filtering;
SettingCheckBox* _3d_vision;
wxChoice* choice_efbscale;
SettingCheckBox* efbaccess_enable;
SettingCheckBox* emulate_efb_format_changes;
SettingCheckBox* efbcopy_enable;
SettingRadioButton* efbcopy_texture;
SettingRadioButton* efbcopy_ram;
SettingCheckBox* cache_efb_copies;
SettingCheckBox* stc_enable;
wxRadioButton* stc_safe;
wxRadioButton* stc_normal;
wxRadioButton* stc_fast;
SettingCheckBox* wireframe;
SettingCheckBox* disable_lighting;
SettingCheckBox* disable_textures;
SettingCheckBox* disable_fog;
SettingCheckBox* disable_dst_alpha;
SettingCheckBox* show_fps;
SettingCheckBox* overlay_stats;
SettingCheckBox* overlay_proj_stats;
SettingCheckBox* texfmt_overlay;
SettingCheckBox* efb_copy_regions;
SettingCheckBox* show_shader_errors;
SettingCheckBox* show_input_display;
SettingCheckBox* enable_xfb;
SettingRadioButton* virtual_xfb;
SettingRadioButton* real_xfb;
SettingCheckBox* dump_textures;
SettingCheckBox* hires_textures;
SettingCheckBox* dump_efb;
SettingCheckBox* dump_frames;
SettingCheckBox* free_look;
SettingCheckBox* frame_dumps_via_ffv1;
SettingCheckBox* crop;
SettingCheckBox* opencl;
SettingCheckBox* dlcache;
SettingCheckBox* hotkeys;
SettingCheckBox* ompdecoder;
wxChoice* choice_ppshader;
// TODO: Add options for
//cur_vconfig.bTexFmtOverlayCenter
//cur_vconfig.bAnaglyphStereo
//cur_vconfig.iAnaglyphStereoSeparation
//cur_vconfig.iAnaglyphFocalAngle
//cur_vconfig.bShowEFBCopyRegions
//cur_vconfig.iCompileDLsLevel
VideoConfig cur_vconfig;
VideoConfig def_vconfig;
std::string ininame;
int cur_profile;
int prev_profile;
const CGameListCtrl *GameListCtrl;
};
#endif
File diff suppressed because it is too large Load Diff
+73 -35
View File
@@ -27,7 +27,6 @@
#include "Common.h"
#include "VideoCommon.h"
#include "IniFile.h"
#include <vector>
#include <string>
@@ -62,17 +61,22 @@ class IniFile;
// NEVER inherit from this class.
struct VideoConfig
{
VideoConfig();
void Load(const char *ini_file);
private:
// According to new structure-design this member MUST BE private
void GameIniLoad(const char *ini_file);
public:
VideoConfig();
// You can choose what "INI snapshot" you wish to load...
// GameIni is loaded over MainIni file only if 'fileCheck' argument is passed with success
void Load(const char *main_ini_file, bool fileCheck = false, const char *game_ini_file = "");
void VerifyValidity();
void Save(const char *ini_file);
void GameIniSave(const char* game_ini);
void GameIniSave(const char* default_ini, const char* game_ini);
void UpdateProjectionHack();
// some hacks used for per-game config
void SetAllUndetermined();
// General
bool bVSync;
@@ -81,7 +85,7 @@ struct VideoConfig
int iAspectRatio;
bool bCrop; // Aspect ratio controls.
bool bUseXFB;
bool bUseRealXFB;
bool bUseRealXFB; // joined to radio button
bool bUseNativeMips;
// OpenCL/OpenMP
@@ -113,7 +117,7 @@ struct VideoConfig
// Utility
bool bDumpTextures;
bool bHiresTextures;
bool bHiresTextures;
bool bDumpEFBTarget;
bool bDumpFrames;
bool bUseFFV1;
@@ -123,15 +127,16 @@ struct VideoConfig
int iAnaglyphFocalAngle;
bool b3DVision;
// Hacks
bool bEFBAccessEnable;
bool bDlistCachingEnable;
bool bDlistCachingEnable;
bool bEFBCopyEnable;
bool bEFBCopyCacheEnable;
bool bEFBEmulateFormatChanges;
bool bOSDHotKey;
bool bCopyEFBToTexture;
bool bCopyEFBToTexture; // joined to radio button
bool bCopyEFBScaled;
bool bSafeTextureCache;
int iSafeTextureCache_ColorSamples;
@@ -152,8 +157,64 @@ struct VideoConfig
// D3D only config, mostly to be merged into the above
int iAdapter;
// UI Controls state
struct
{
// IMPORTANT: each member inside this struct MUST HAVE same name corresponding to data member
bool bVSync;
bool bWidescreenHack;
bool iAspectRatio;
bool bCrop;
bool bUseXFB;
bool bUseNativeMips;
bool bEnableOpenCL;
bool iMultisampleMode;
bool iEFBScale;
bool bForceFiltering;
bool iMaxAnisotropy;
bool bShowFPS;
bool bShowInputDisplay;
bool bOverlayStats;
bool bOverlayProjStats;
bool bTexFmtOverlayEnable;
bool bTexFmtOverlayCenter;
bool bShowEFBCopyRegions;
bool bWireFrame;
bool bDisableLighting;
bool bDisableTexturing;
bool bDstAlphaPass;
bool bDisableFog;
bool bDumpTextures;
bool bHiresTextures;
bool bDumpEFBTarget;
bool bDumpFrames;
bool bUseFFV1;
bool bFreeLook;
bool bAnaglyphStereo;
bool b3DVision;
bool iAnaglyphStereoSeparation;
bool iAnaglyphFocalAngle;
bool bEFBAccessEnable;
bool bOMPDecoder;
bool bDlistCachingEnable;
bool bEFBCopyEnable;
bool bEFBCopyCacheEnable;
bool bEFBEmulateFormatChanges;
bool bOSDHotKey;
bool bCopyEFBScaled;
bool bSafeTextureCache;
bool bZTPSpeedHack;
bool bEnablePixelLighting;
bool bEnablePerPixelDepth;
bool iLog;
bool iSaveTargetId;
bool iCompileDLsLevel;
bool bShowShaderErrors;
bool iAdapter;
} UI_State;
// Static config per API
struct BackendInfo
struct
{
API_TYPE APIType;
@@ -167,29 +228,6 @@ struct VideoConfig
bool bSupportsFormatReinterpretation;
bool bSupportsPixelLighting;
} backend_info;
// haxhaxhax
static bool IsUndetermined(const bool& val)
{
// lul, storing a u8 inside a bool
return (*reinterpret_cast<const u8*>(&val) > 1);
}
static bool IsUndetermined(int val)
{
return (val < 0);
}
private:
template <typename T>
void SetIfDetermined(IniFile::Section& sect, const char* key, const T& value)
{
if (IsUndetermined(value))
sect.Delete(key);
else
sect.Set(key, value);
}
};
extern VideoConfig g_Config;
@@ -9,9 +9,6 @@ namespace DX11
class VideoBackend : public VideoBackendHardware
{
public:
VideoBackend() : VideoBackendHardware("gfx_dx11") {}
bool Initialize(void *&);
void Shutdown();
+4 -3
View File
@@ -141,7 +141,7 @@ void VideoBackend::ShowConfig(void *_hParent)
// Clear ppshaders string vector
g_Config.backend_info.PPShaders.clear();
VideoConfigDiag diag((wxWindow*)_hParent, _trans("Direct3D11"));
VideoConfigDiag diag((wxWindow*)_hParent, _trans("Direct3D11"), "gfx_dx11");
diag.ShowModal();
g_Config.backend_info.Adapters.clear();
@@ -156,8 +156,9 @@ bool VideoBackend::Initialize(void *&window_handle)
frameCount = 0;
LoadConfig();
g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());
g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_dx11.ini").c_str(), true,
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());
UpdateProjectionHack(g_Config.iPhackvalue, g_Config.sPhackvalue);
UpdateActiveConfig();
@@ -9,9 +9,6 @@ namespace DX9
class VideoBackend : public VideoBackendHardware
{
public:
VideoBackend() : VideoBackendHardware("gfx_dx9") {}
bool Initialize(void *&);
void Shutdown();
+5 -4
View File
@@ -123,7 +123,7 @@ void VideoBackend::ShowConfig(void* parent)
// Clear ppshaders string vector
g_Config.backend_info.PPShaders.clear();
VideoConfigDiag diag((wxWindow*)parent, _trans("Direct3D9"));
VideoConfigDiag diag((wxWindow*)parent, _trans("Direct3D9"), "gfx_dx9");
diag.ShowModal();
g_Config.backend_info.Adapters.clear();
@@ -137,9 +137,10 @@ bool VideoBackend::Initialize(void *&window_handle)
frameCount = 0;
LoadConfig();
g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());
UpdateProjectionHack(g_Config.iPhackvalue, g_Config.sPhackvalue); // DX9 projection hack could be disabled by commenting out this line
g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_dx9.ini").c_str(), true,
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());
UpdateProjectionHack(g_Config.iPhackvalue, g_Config.sPhackvalue);
UpdateActiveConfig();
window_handle = (void*)EmuWindow::Create((HWND)window_handle, GetModuleHandle(0), _T("Loading - Please wait."));
@@ -9,9 +9,6 @@ namespace OGL
class VideoBackend : public VideoBackendHardware
{
public:
VideoBackend() : VideoBackendHardware("gfx_opengl") {}
bool Initialize(void *&);
void Shutdown();
+3 -3
View File
@@ -149,7 +149,7 @@ void VideoBackend::ShowConfig(void *_hParent)
// pp shaders
GetShaders(g_Config.backend_info.PPShaders);
VideoConfigDiag diag((wxWindow*)_hParent, "OpenGL");
VideoConfigDiag diag((wxWindow*)_hParent, "OpenGL", "gfx_opengl");
diag.ShowModal();
#endif
}
@@ -160,8 +160,8 @@ bool VideoBackend::Initialize(void *&window_handle)
frameCount = 0;
LoadConfig();
g_Config.GameIniLoad(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());
g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_opengl.ini").c_str(), true,
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());
g_Config.UpdateProjectionHack();
@@ -67,7 +67,7 @@ void VideoSoftware::ShowConfig(void *_hParent)
bool VideoSoftware::Initialize(void *&window_handle)
{
LoadConfig();
g_SWVideoConfig.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_software.ini").c_str());
if (!OpenGL_Create(window_handle))
{
@@ -9,9 +9,6 @@ namespace SW
class VideoSoftware : public VideoBackend
{
public:
VideoSoftware() : VideoBackend("gfx_software") {}
bool Initialize(void *&);
void Shutdown();