Add per-game "configuration profiles" for video backend configuration:

This allows ALL settings in the gfx configuration dialog to be adjusted _per game_ in a more user-friendly way than before.
Obsoletes the gfx related options in the ISO properties, but I kept those since the configuration profiles use different ini file keys (i.e. convert the game inis to the new naming, please!).


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7167 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX 2011-02-13 22:36:12 +00:00
parent 7a7a71d3fa
commit b776ac3d6f
8 changed files with 510 additions and 131 deletions

View File

@ -120,6 +120,13 @@ public:
bool Get(const char* sectionName, const char* key, bool* value, bool defaultValue = false);
bool Get(const char* sectionName, const char* key, std::vector<std::string>& values);
template<typename T> bool GetIfExists(const char* sectionName, const char* key, T value)
{
if (Exists(sectionName, key))
return Get(sectionName, key, value);
return false;
}
bool GetKeys(const char* sectionName, std::vector<std::string>& keys) const;
void SetLines(const char* sectionName, const std::vector<std::string> &lines);

View File

@ -941,3 +941,8 @@ void CFrame::DoFullscreen(bool bF)
else
m_RenderFrame->Raise();
}
const GameListItem *CFrame::GetGameListItem(int index) const
{
return m_GameListCtrl->GetISO(index);
}

View File

@ -45,6 +45,7 @@ static inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int len
// Class declarations
class CGameListCtrl;
class GameListItem;
class CLogWindow;
// The CPanel class to receive MSWWindowProc messages from the video backend.
@ -133,6 +134,8 @@ class CFrame : public CRenderFrame
void ToggleDisplayMode (bool bFullscreen);
static void ConnectWiimote(int wm_idx, bool connect);
const GameListItem *GetGameListItem(int index) const;
#ifdef __WXGTK__
Common::Event panic_event;
bool bPanicResult;

View File

@ -695,6 +695,7 @@ void CGameListCtrl::OnColBeginDrag(wxListEvent& event)
const GameListItem *CGameListCtrl::GetISO(int index) const
{
if (index >= (int)m_ISOFiles.size()) return NULL;
return &m_ISOFiles[index];
}

View File

@ -5,6 +5,15 @@
#include <wx/intl.h>
#include "Frame.h"
#include "ISOFile.h"
#include "ConfigManager.h"
#include "Core.h"
#include "Host.h"
extern CFrame* main_frame;
#define _connect_macro_(b, f, c, s) (b)->Connect(wxID_ANY, (c), wxCommandEventHandler( f ), (wxObject*)0, (wxEvtHandler*)s)
// template instantiation
@ -55,7 +64,16 @@ void VideoConfigDiag::Event_ClickClose(wxCommandEvent&)
void VideoConfigDiag::Event_Close(wxCloseEvent& ev)
{
g_Config.Save((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str());
if (cur_profile == 0)
{
vconfig.Save((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str());
}
else
{
const GameListItem* item = main_frame->GetGameListItem(cur_profile-1);
vconfig.GameIniSave((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str(),
(std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + item->GetUniqueID() + ".ini").c_str());
}
EndModal(wxID_OK);
@ -64,6 +82,7 @@ void VideoConfigDiag::Event_Close(wxCloseEvent& ev)
// TODO: implement some hack to increase the tooltip display duration, because some of these are way too long for anyone to read in 5 seconds.
wxString profile_tooltip = wxTRANSLATE("Selects which game should be affect by the configuration changes done in this dialog.\nThe (Default) profile affects the standard settings used for every game.");
wxString adapter_tooltip = wxTRANSLATE("Select a hardware adapter to use.\nWhen in doubt, use the first one");
wxString ar_tooltip = wxTRANSLATE("Select what aspect ratio to use when rendering:\nAuto: Use the native aspect ratio (4:3)\nForce 16:9: Stretch the picture to an aspect ratio of 16:9.\nForce 4:3: Stretch the picture to an aspect ratio of 4:3.\nStretch to window: Stretch the picture to the window size.");
wxString ws_hack_tooltip = wxTRANSLATE("Force the game to output graphics for widescreen resolutions.\nNote that this might cause graphical glitches");
@ -115,12 +134,38 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
wxString::Format(_("Dolphin %s Graphics Configuration"),
wxGetTranslation(wxString::From8BitData(title.c_str()))),
wxDefaultPosition, wxDefaultSize)
, vconfig(g_Config)
, ininame(_ininame)
, choice_adapter(NULL)
, choice_ppshader(NULL)
{
vconfig.Load((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str());
// TODO: Make this less hacky
vconfig = g_Config; // take over backend_info
// If a game from the game list is running, show the game specific config; show the default config otherwise
cur_profile = 0;
if (Core::isRunning())
{
// Search which ISO has been started
for (int index = 0; ; ++index)
{
const GameListItem* item = main_frame->GetGameListItem(index);
if (item == NULL) break;
if (item->GetUniqueID() == SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID)
{
cur_profile = index+1;
break;
}
}
}
// Load settings
vconfig.Load((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str());
if (cur_profile != 0)
{
const GameListItem* item = main_frame->GetGameListItem(cur_profile-1);
vconfig.GameIniLoad((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + item->GetUniqueID() + ".ini").c_str());
}
Connect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(VideoConfigDiag::OnUpdateUI), NULL, this);
wxNotebook* const notebook = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize);
@ -134,6 +179,22 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
{
wxFlexGridSizer* const szr_basic = new wxFlexGridSizer(2, 5, 5);
// game specific config
szr_basic->Add(new wxStaticText(page_general, -1, _("Configuration profile:")), 1, wxALIGN_CENTER_VERTICAL, 5);
profile_cb = new SettingChoice(page_general, cur_profile, wxGetTranslation(profile_tooltip));
szr_basic->Add(profile_cb, 1, 0, 0);
profile_cb->AppendString(_("(Default)"));
for (int index = 0; ; ++index)
{
// TODO: Sort these alphabetically
const GameListItem* item = main_frame->GetGameListItem(index);
if (item == NULL) break;
profile_cb->AppendString(wxString(item->GetName(0).c_str(), wxConvUTF8));
}
profile_cb->Select(cur_profile);
_connect_macro_(profile_cb, VideoConfigDiag::Event_OnProfileChange, wxEVT_COMMAND_CHOICE_SELECTED, this);
// graphics api
//{
//const wxString gfxapi_choices[] = { _("Software [not present]"),
@ -150,7 +211,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
if (vconfig.backend_info.Adapters.size())
{
szr_basic->Add(new wxStaticText(page_general, -1, _("Adapter:")), 1, wxALIGN_CENTER_VERTICAL, 5);
wxChoice* const choice_adapter = new SettingChoice(page_general, vconfig.iAdapter, wxGetTranslation(adapter_tooltip));
choice_adapter = new SettingChoice(page_general, vconfig.iAdapter, wxGetTranslation(adapter_tooltip));
std::vector<std::string>::const_iterator
it = vconfig.backend_info.Adapters.begin(),
@ -162,14 +223,14 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
szr_basic->Add(choice_adapter, 1, 0, 0);
}
// aspect-ratio
{
const wxString ar_choices[] = { _("Auto [recommended]"),
_("Force 16:9"), _("Force 4:3"), _("Stretch to Window") };
szr_basic->Add(new wxStaticText(page_general, -1, _("Aspect Ratio:")), 1, wxALIGN_CENTER_VERTICAL, 0);
wxChoice* const choice_aspect = new SettingChoice(page_general,
choice_aspect = new SettingChoice(page_general,
vconfig.iAspectRatio, wxGetTranslation(ar_tooltip), sizeof(ar_choices)/sizeof(*ar_choices), ar_choices);
szr_basic->Add(choice_aspect, 1, 0, 0);
}
@ -177,9 +238,9 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
// widescreen hack
{
szr_basic->AddStretchSpacer(1);
szr_basic->Add(new SettingCheckBox(page_general, _("Widescreen Hack"), wxGetTranslation(ws_hack_tooltip), vconfig.bWidescreenHack), 1, 0, 0);
szr_basic->Add(widescreen_hack = new SettingCheckBox(page_general, _("Widescreen Hack"), wxGetTranslation(ws_hack_tooltip), vconfig.bWidescreenHack), 1, 0, 0);
szr_basic->AddStretchSpacer(1);
szr_basic->Add(new SettingCheckBox(page_general, _("V-Sync"), wxGetTranslation(vsync_tooltip), vconfig.bVSync), 1, 0, 0);
szr_basic->Add(vsync = new SettingCheckBox(page_general, _("V-Sync"), wxGetTranslation(vsync_tooltip), vconfig.bVSync), 1, 0, 0);
}
// enhancements
@ -187,7 +248,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
szr_enh->Add(new wxStaticText(page_general, -1, _("Anisotropic Filtering:")), 1, wxALIGN_CENTER_VERTICAL, 0);
const wxString af_choices[] = {wxT("1x"), wxT("2x"), wxT("4x"), wxT("8x"), wxT("16x")};
szr_enh->Add(new SettingChoice(page_general, vconfig.iMaxAnisotropy, wxGetTranslation(af_tooltip), 5, af_choices));
szr_enh->Add(anisotropic_filtering = new SettingChoice(page_general, vconfig.iMaxAnisotropy, wxGetTranslation(af_tooltip), 5, af_choices));
text_aamode = new wxStaticText(page_general, -1, _("Anti-Aliasing:"));
@ -205,11 +266,11 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
szr_enh->Add(choice_aamode);
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(native_mips = new SettingCheckBox(page_general, _("Load Native Mipmaps"), wxGetTranslation(native_mips_tooltip), vconfig.bUseNativeMips));
szr_enh->Add(efb_scaled_copy = new SettingCheckBox(page_general, _("EFB Scaled Copy"), wxGetTranslation(scaled_efb_copy_tooltip), vconfig.bCopyEFBScaled));
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));
szr_enh->Add(pixel_depth = new SettingCheckBox(page_general, _("Pixel Depth"), wxGetTranslation(pixel_depth_tooltip), vconfig.bEnablePerPixelDepth));
szr_enh->Add(force_filtering = new SettingCheckBox(page_general, _("Force Bi/Trilinear Filtering"), wxGetTranslation(force_filtering_tooltip), vconfig.bForceFiltering));
_3d_vision = new SettingCheckBox(page_general, _("3D Vision (Requires Fullscreen)"), wxGetTranslation(_3d_vision_tooltip), vconfig.b3DVision);
_3d_vision->Show(vconfig.backend_info.bSupports3DVision);
@ -222,8 +283,8 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
const wxString efbscale_choices[] = { _("Fractional"), _("Integral [recommended]"),
wxT("1x"), wxT("2x"), wxT("3x"), wxT("0.75x"), wxT("0.5x"), wxT("0.375x") };
wxChoice *const choice_efbscale = new SettingChoice(page_general,
vconfig.iEFBScale, wxGetTranslation(internal_res_tooltip), sizeof(efbscale_choices)/sizeof(*efbscale_choices), efbscale_choices);
choice_efbscale = new SettingChoice(page_general,
vconfig.iEFBScale, wxGetTranslation(internal_res_tooltip), sizeof(efbscale_choices)/sizeof(*efbscale_choices), efbscale_choices);
efb_scale_szr->Add(new wxStaticText(page_general, -1, _("Scale:")), 0, wxALIGN_CENTER_VERTICAL, 5);
//efb_scale_szr->AddStretchSpacer(1);
@ -232,7 +293,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
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);
efbcopy_enable = new SettingCheckBox(page_general, _("Enable"), wxGetTranslation(efb_copy_tooltip), vconfig.bEFBCopyEnable);
efbcopy_texture = new SettingRadioButton(page_general, _("Texture"), wxGetTranslation(efb_copy_texture_tooltip), vconfig.bCopyEFBToTexture, false, wxRB_GROUP);
efbcopy_ram = new SettingRadioButton(page_general, _("RAM"), wxGetTranslation(efb_copy_ram_tooltip), vconfig.bCopyEFBToTexture, true);
cache_efb_copies = new SettingCheckBox(page_general, _("Enable cache"), wxGetTranslation(cache_efb_copies_tooltip), vconfig.bEFBCopyCacheEnable);
@ -245,7 +306,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
// - safe texture cache
SettingCheckBox* stc_enable = new SettingCheckBox(page_general, _("Enable"), wxGetTranslation(stc_tooltip), vconfig.bSafeTextureCache);
stc_enable = new SettingCheckBox(page_general, _("Enable"), wxGetTranslation(stc_tooltip), vconfig.bSafeTextureCache);
stc_safe = new wxRadioButton(page_general, -1, _("Safe"),
wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
@ -260,15 +321,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
stc_fast->SetToolTip(wxGetTranslation(stc_speed_tooltip));
_connect_macro_(stc_fast, VideoConfigDiag::Event_StcFast, wxEVT_COMMAND_RADIOBUTTON_SELECTED, this);
if (0 == vconfig.iSafeTextureCache_ColorSamples)
stc_safe->SetValue(true);
if (512 == vconfig.iSafeTextureCache_ColorSamples)
stc_normal->SetValue(true);
if (128 == vconfig.iSafeTextureCache_ColorSamples)
stc_fast->SetValue(true);
wxStaticBoxSizer* const group_basic = new wxStaticBoxSizer(wxVERTICAL, page_general, _("Basic"));
szr_general->Add(group_basic, 0, wxEXPAND | wxALL, 5);
@ -280,7 +332,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
wxStaticBoxSizer* const group_efb = new wxStaticBoxSizer(wxVERTICAL, page_general, _("EFB"));
szr_general->Add(group_efb, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
group_efb->Add(efb_scale_szr, 0, wxBOTTOM | wxLEFT, 5);
group_efb->Add(new SettingCheckBox(page_general, _("Enable CPU Access"), wxGetTranslation(efb_access_tooltip), vconfig.bEFBAccessEnable), 0, wxBOTTOM | wxLEFT, 5);
group_efb->Add(efbaccess_enable = new SettingCheckBox(page_general, _("Enable CPU Access"), wxGetTranslation(efb_access_tooltip), vconfig.bEFBAccessEnable), 0, wxBOTTOM | wxLEFT, 5);
group_efb->Add(emulate_efb_format_changes, 0, wxBOTTOM | wxLEFT, 5);
group_efb->Add(group_efbcopy, 0, wxEXPAND | wxBOTTOM, 5);
@ -302,15 +354,23 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
notebook->AddPage(page_advanced, _("Advanced"));
wxBoxSizer* const szr_advanced = new wxBoxSizer(wxVERTICAL);
// configuration profiles
{
wxStaticBoxSizer* const group_profile = new wxStaticBoxSizer(wxHORIZONTAL, page_advanced, _("Configuration profile"));
profile_text = new wxStaticText(page_advanced, -1, profile_cb->GetLabelText());
szr_advanced->Add(group_profile, 0, wxEXPAND | wxALL, 5);
group_profile->Add(profile_text, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
}
// - rendering
{
wxGridSizer* const szr_rendering = new wxGridSizer(2, 5, 5);
szr_rendering->Add(new SettingCheckBox(page_advanced, _("Enable Wireframe"), wxGetTranslation(wireframe_tooltip), vconfig.bWireFrame));
szr_rendering->Add(new SettingCheckBox(page_advanced, _("Disable Lighting"), wxGetTranslation(disable_lighting_tooltip), vconfig.bDisableLighting));
szr_rendering->Add(new SettingCheckBox(page_advanced, _("Disable Textures"), wxGetTranslation(disable_textures_tooltip), vconfig.bDisableTexturing));
szr_rendering->Add(new SettingCheckBox(page_advanced, _("Disable Fog"), wxGetTranslation(disable_fog_tooltip), vconfig.bDisableFog));
szr_rendering->Add(new SettingCheckBox(page_advanced, _("Disable Dest. Alpha Pass"), wxGetTranslation(disable_alphapass_tooltip), vconfig.bDstAlphaPass));
szr_rendering->Add(wireframe = new SettingCheckBox(page_advanced, _("Enable Wireframe"), wxGetTranslation(wireframe_tooltip), vconfig.bWireFrame));
szr_rendering->Add(disable_lighting = new SettingCheckBox(page_advanced, _("Disable Lighting"), wxGetTranslation(disable_lighting_tooltip), vconfig.bDisableLighting));
szr_rendering->Add(disable_textures = new SettingCheckBox(page_advanced, _("Disable Textures"), wxGetTranslation(disable_textures_tooltip), vconfig.bDisableTexturing));
szr_rendering->Add(disable_fog = new SettingCheckBox(page_advanced, _("Disable Fog"), wxGetTranslation(disable_fog_tooltip), vconfig.bDisableFog));
szr_rendering->Add(disable_dst_alpha = new SettingCheckBox(page_advanced, _("Disable Dest. Alpha Pass"), wxGetTranslation(disable_alphapass_tooltip), vconfig.bDstAlphaPass));
wxStaticBoxSizer* const group_rendering = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Rendering"));
szr_advanced->Add(group_rendering, 0, wxEXPAND | wxALL, 5);
@ -321,12 +381,12 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
{
wxGridSizer* const szr_info = new wxGridSizer(2, 5, 5);
szr_info->Add(new SettingCheckBox(page_advanced, _("Show FPS"), wxGetTranslation(show_fps_tooltip), vconfig.bShowFPS));
szr_info->Add(new SettingCheckBox(page_advanced, _("Various Statistics"), wxGetTranslation(show_stats_tooltip), vconfig.bOverlayStats));
szr_info->Add(new SettingCheckBox(page_advanced, _("Projection Stats"), wxGetTranslation(proj_stats_tooltip), vconfig.bOverlayProjStats));
szr_info->Add(new SettingCheckBox(page_advanced, _("Texture Format"), wxGetTranslation(texfmt_tooltip), vconfig.bTexFmtOverlayEnable));
szr_info->Add(new SettingCheckBox(page_advanced, _("EFB Copy Regions"), wxGetTranslation(efb_copy_regions_tooltip), vconfig.bShowEFBCopyRegions));
szr_info->Add(new SettingCheckBox(page_advanced, _("Show Shader Errors"), wxT(""), vconfig.bShowShaderErrors));
szr_info->Add(show_fps = new SettingCheckBox(page_advanced, _("Show FPS"), wxGetTranslation(show_fps_tooltip), vconfig.bShowFPS));
szr_info->Add(overlay_stats = new SettingCheckBox(page_advanced, _("Various Statistics"), wxGetTranslation(show_stats_tooltip), vconfig.bOverlayStats));
szr_info->Add(overlay_proj_stats = new SettingCheckBox(page_advanced, _("Projection Stats"), wxGetTranslation(proj_stats_tooltip), vconfig.bOverlayProjStats));
szr_info->Add(texfmt_overlay = new SettingCheckBox(page_advanced, _("Texture Format"), wxGetTranslation(texfmt_tooltip), vconfig.bTexFmtOverlayEnable));
szr_info->Add(efb_copy_regions = new SettingCheckBox(page_advanced, _("EFB Copy Regions"), wxGetTranslation(efb_copy_regions_tooltip), vconfig.bShowEFBCopyRegions));
szr_info->Add(show_shader_errors = new SettingCheckBox(page_advanced, _("Show Shader Errors"), wxT(""), vconfig.bShowShaderErrors));
wxStaticBoxSizer* const group_info = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Information"));
szr_advanced->Add(group_info, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
@ -335,7 +395,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
// - XFB
{
SettingCheckBox* enable_xfb = new SettingCheckBox(page_advanced, _("Enable"), wxGetTranslation(xfb_tooltip), vconfig.bUseXFB);
enable_xfb = new SettingCheckBox(page_advanced, _("Enable"), wxGetTranslation(xfb_tooltip), vconfig.bUseXFB);
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);
@ -353,13 +413,13 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
{
wxGridSizer* const szr_utility = new wxGridSizer(2, 5, 5);
szr_utility->Add(new SettingCheckBox(page_advanced, _("Dump Textures"), wxGetTranslation(dump_textures_tooltip), vconfig.bDumpTextures));
szr_utility->Add(new SettingCheckBox(page_advanced, _("Load Hi-Res Textures"), wxGetTranslation(load_hires_textures_tooltip), vconfig.bHiresTextures));
szr_utility->Add(new SettingCheckBox(page_advanced, _("Dump EFB Target"), dump_efb_tooltip, vconfig.bDumpEFBTarget));
szr_utility->Add(new SettingCheckBox(page_advanced, _("Dump Frames"), dump_frames_tooltip, vconfig.bDumpFrames));
szr_utility->Add(new SettingCheckBox(page_advanced, _("Free Look"), free_look_tooltip, vconfig.bFreeLook));
szr_utility->Add(dump_textures = new SettingCheckBox(page_advanced, _("Dump Textures"), wxGetTranslation(dump_textures_tooltip), vconfig.bDumpTextures));
szr_utility->Add(hires_textures = new SettingCheckBox(page_advanced, _("Load Hi-Res Textures"), wxGetTranslation(load_hires_textures_tooltip), vconfig.bHiresTextures));
szr_utility->Add(dump_efb = new SettingCheckBox(page_advanced, _("Dump EFB Target"), dump_efb_tooltip, vconfig.bDumpEFBTarget));
szr_utility->Add(dump_frames = new SettingCheckBox(page_advanced, _("Dump Frames"), dump_frames_tooltip, vconfig.bDumpFrames));
szr_utility->Add(free_look = new SettingCheckBox(page_advanced, _("Free Look"), free_look_tooltip, vconfig.bFreeLook));
#if !defined WIN32 && defined HAVE_LIBAV
szr_utility->Add(new SettingCheckBox(page_advanced, _("Frame dumps use FFV1"), use_ffv1_tooltip, vconfig.bUseFFV1));
szr_utility->Add(frame_dumps_via_ffv1 = new SettingCheckBox(page_advanced, _("Frame dumps use FFV1"), use_ffv1_tooltip, vconfig.bUseFFV1));
#endif
wxStaticBoxSizer* const group_utility = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Utility"));
@ -371,17 +431,17 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
{
wxGridSizer* const szr_misc = new wxGridSizer(2);
szr_misc->Add(new SettingCheckBox(page_advanced, _("Crop"), crop_tooltip, vconfig.bCrop), 0, wxBOTTOM, 5);
szr_misc->Add(new SettingCheckBox(page_advanced, _("Enable OpenCL"), opencl_tooltip, vconfig.bEnableOpenCL), 0, wxLEFT|wxBOTTOM, 5);
szr_misc->Add(new SettingCheckBox(page_advanced, _("Enable Display List Caching"), dlc_tooltip, vconfig.bDlistCachingEnable), 0, wxBOTTOM, 5);
szr_misc->Add(new SettingCheckBox(page_advanced, _("Enable Hotkeys"), hotkeys_tooltip, vconfig.bOSDHotKey), 0, wxLEFT|wxBOTTOM, 5);
szr_misc->Add(crop = new SettingCheckBox(page_advanced, _("Crop"), crop_tooltip, vconfig.bCrop), 0, wxBOTTOM, 5);
szr_misc->Add(opencl = new SettingCheckBox(page_advanced, _("Enable OpenCL"), opencl_tooltip, vconfig.bEnableOpenCL), 0, wxLEFT|wxBOTTOM, 5);
szr_misc->Add(dlcache = new SettingCheckBox(page_advanced, _("Enable Display List Caching"), dlc_tooltip, vconfig.bDlistCachingEnable), 0, wxBOTTOM, 5);
szr_misc->Add(hotkeys = new SettingCheckBox(page_advanced, _("Enable Hotkeys"), hotkeys_tooltip, vconfig.bOSDHotKey), 0, wxLEFT|wxBOTTOM, 5);
// postproc shader
if (vconfig.backend_info.PPShaders.size())
{
szr_misc->Add(new wxStaticText(page_advanced, -1, _("Post-Processing Shader:")), 1, wxALIGN_CENTER_VERTICAL, 0);
wxChoice *const choice_ppshader = new wxChoice(page_advanced, -1, wxDefaultPosition);
choice_ppshader = new wxChoice(page_advanced, -1, wxDefaultPosition);
choice_ppshader->SetToolTip(wxGetTranslation(ppshader_tooltip));
choice_ppshader->AppendString(_("(off)"));
@ -421,5 +481,161 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
SetSizerAndFit(szr_main);
Center();
SetUIValuesFromConfig();
Connect(wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(VideoConfigDiag::OnUpdateUI), NULL, this);
UpdateWindowUI();
}
void VideoConfigDiag::Event_OnProfileChange(wxCommandEvent& ev)
{
// Save settings of current profile
if (cur_profile == 0)
{
vconfig.Save((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str());
}
else
{
const GameListItem* item = main_frame->GetGameListItem(cur_profile-1);
vconfig.GameIniSave((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str(),
(std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + item->GetUniqueID() + ".ini").c_str());
}
// Enable new profile
cur_profile = ev.GetInt();
// Reset settings
vconfig.Load((File::GetUserPath(D_CONFIG_IDX) + ininame + ".ini").c_str());
// Load game-specific settings
if (cur_profile != 0)
{
const GameListItem* item = main_frame->GetGameListItem(cur_profile-1);
vconfig.GameIniLoad((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + item->GetUniqueID() + ".ini").c_str());
}
// Update our UI elements with the new config
SetUIValuesFromConfig();
UpdateWindowUI();
profile_text->SetLabel(profile_cb->GetLabelText());
ev.Skip();
}
void VideoConfigDiag::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);
// If emulation hasn't started, yet, always update g_Config.
// Otherwise only update it if we're editing the currently running game's profile
if (!Core::isRunning())
{
g_Config = vconfig;
}
else if (cur_profile != 0)
{
// TODO: Modifying the default profile should update g_Config as well
if (main_frame->GetGameListItem(cur_profile-1)->GetUniqueID() == SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID)
g_Config = vconfig;
}
ev.Skip();
}
void VideoConfigDiag::SetUIValuesFromConfig()
{
if (choice_adapter) choice_adapter->SetSelection(vconfig.iAdapter);
choice_aspect->SetSelection(vconfig.iAspectRatio);
widescreen_hack->SetValue(vconfig.bWidescreenHack);
vsync->SetValue(vconfig.bVSync);
anisotropic_filtering->SetSelection(vconfig.iMaxAnisotropy);
choice_aamode->SetSelection(vconfig.iMultisampleMode);
native_mips->SetValue(vconfig.bUseNativeMips);
efb_scaled_copy->SetValue(vconfig.bCopyEFBScaled);
pixel_lighting->SetValue(vconfig.bEnablePixelLigting);
pixel_depth->SetValue(vconfig.bEnablePerPixelDepth);
force_filtering->SetValue(vconfig.bForceFiltering);
_3d_vision->SetValue(vconfig.b3DVision);
choice_efbscale->SetSelection(vconfig.iEFBScale);
efbaccess_enable->SetValue(vconfig.bEFBAccessEnable);
emulate_efb_format_changes->SetValue(vconfig.bEFBEmulateFormatChanges);
efbcopy_enable->SetValue(vconfig.bEFBCopyEnable);
efbcopy_texture->SetValue(vconfig.bCopyEFBToTexture);
efbcopy_ram->SetValue(!vconfig.bCopyEFBToTexture);
cache_efb_copies->SetValue(vconfig.bEFBCopyCacheEnable);
stc_enable->SetValue(vconfig.bSafeTextureCache);
if (0 == vconfig.iSafeTextureCache_ColorSamples)
stc_safe->SetValue(true);
if (512 == vconfig.iSafeTextureCache_ColorSamples)
stc_normal->SetValue(true);
if (128 == vconfig.iSafeTextureCache_ColorSamples)
stc_fast->SetValue(true);
wireframe->SetValue(vconfig.bWireFrame);
disable_lighting->SetValue(vconfig.bDisableLighting);
disable_textures->SetValue(vconfig.bDisableTexturing);
disable_fog->SetValue(vconfig.bDisableFog);
disable_dst_alpha->SetValue(vconfig.bDstAlphaPass);
show_fps->SetValue(vconfig.bShowFPS);
overlay_stats->SetValue(vconfig.bOverlayStats);
overlay_proj_stats->SetValue(vconfig.bOverlayProjStats);
texfmt_overlay->SetValue(vconfig.bTexFmtOverlayEnable);
efb_copy_regions->SetValue(vconfig.bShowEFBCopyRegions);
show_shader_errors->SetValue(vconfig.bShowShaderErrors);
enable_xfb->SetValue(vconfig.bUseXFB);
virtual_xfb->SetValue(!vconfig.bUseRealXFB);
real_xfb->SetValue(vconfig.bUseRealXFB);
dump_textures->SetValue(vconfig.bDumpTextures);
hires_textures->SetValue(vconfig.bHiresTextures);
dump_efb->SetValue(vconfig.bDumpEFBTarget);
dump_frames->SetValue(vconfig.bDumpFrames);
free_look->SetValue(vconfig.bFreeLook);
#if !defined WIN32 && defined HAVE_LIBAV
frame_dumps_via_ffv1->SetValue(vconfig.bUseFFV1);
#endif
crop->SetValue(vconfig.bCrop);
opencl->SetValue(vconfig.bEnableOpenCL);
dlcache->SetValue(vconfig.bDlistCachingEnable);
hotkeys->SetValue(vconfig.bOSDHotKey);
if (choice_ppshader)
{
if (vconfig.sPostProcessingShader.empty()) choice_ppshader->Select(0);
else choice_ppshader->SetStringSelection(wxString::FromAscii(vconfig.sPostProcessingShader.c_str()));
}
}

View File

@ -88,60 +88,90 @@ protected:
void Event_ClickClose(wxCommandEvent&);
void Event_Close(wxCloseEvent&);
// 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);
void Event_OnProfileChange(wxCommandEvent& ev);
// pixel lighting
pixel_lighting->Enable(vconfig.backend_info.bSupportsPixelLighting);
// Enables/disables UI elements depending on current config - if appropriate also updates g_Config
void OnUpdateUI(wxUpdateUIEvent& ev);
// 3D vision
_3d_vision->Show(vconfig.backend_info.bSupports3DVision);
// Refresh UI values from current config (used when reloading config)
void SetUIValuesFromConfig();
// 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);
// Don't mess with keeping two comboboxes in sync, use only one CB instead..
SettingChoice* profile_cb; // "General" tab
wxStaticText* profile_text; // "Advanced" tab
// 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();
}
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* emulate_efb_format_changes;
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* enable_xfb;
SettingRadioButton* virtual_xfb;
SettingRadioButton* real_xfb;
VideoConfig &vconfig;
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;
wxChoice* choice_ppshader;
// TODO: Add options for
//vconfig.bTexFmtOverlayCenter
//vconfig.bAnaglyphStereo
//vconfig.iAnaglyphStereoSeparation
//vconfig.iAnaglyphFocalAngle
//vconfig.bShowEFBCopyRegions
//vconfig.iCompileDLsLevel
VideoConfig vconfig;
std::string ininame;
int cur_profile;
};
#endif

View File

@ -130,55 +130,91 @@ void VideoConfig::GameIniLoad(const char *ini_file)
{
IniFile iniFile;
iniFile.Load(ini_file);
if (iniFile.Exists("Video", "ForceFiltering"))
iniFile.Get("Video", "ForceFiltering", &bForceFiltering);
if (iniFile.Exists("Video", "MaxAnisotropy"))
iniFile.Get("Video", "MaxAnisotropy", &iMaxAnisotropy); // NOTE - this is x in (1 << x)
if (iniFile.Exists("Video", "EFBCopyEnable"))
iniFile.Get("Video", "EFBCopyEnable", &bEFBCopyEnable);
if (iniFile.Exists("Video", "EFBCopyDisableHotKey"))
iniFile.Get("Video", "EFBCopyDisableHotKey", &bOSDHotKey);
if (iniFile.Exists("Video", "EFBAccessEnable"))
iniFile.Get("Video", "EFBAccessEnable", &bEFBAccessEnable);
if (iniFile.Exists("Video", "EFBToTextureEnable"))
iniFile.Get("Video", "EFBToTextureEnable", &bCopyEFBToTexture);
if (iniFile.Exists("Video", "EFBScaledCopy"))
iniFile.Get("Video", "EFBScaledCopy", &bCopyEFBScaled);
if (iniFile.Exists("Video", "SafeTextureCache"))
iniFile.Get("Video", "SafeTextureCache", &bSafeTextureCache);
//Safe texture cache params
if (iniFile.Exists("Video", "SafeTextureCacheColorSamples"))
iniFile.Get("Video", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples);
if (iniFile.Exists("Video", "MSAA"))
iniFile.Get("Video", "MSAA", &iMultisampleMode);
if (iniFile.Exists("Video", "EFBScale"))
iniFile.Get("Video", "EFBScale", &iEFBScale, 0);
if (iniFile.Exists("Video", "DstAlphaPass"))
iniFile.Get("Video", "DstAlphaPass", &bDstAlphaPass);
if (iniFile.Exists("Video", "UseXFB"))
iniFile.Get("Video", "UseXFB", &bUseXFB);
if (iniFile.Exists("Video", "UseRealXFB"))
iniFile.Get("Video", "UseRealXFB", &bUseRealXFB);
if (iniFile.Exists("Video", "ProjectionHack"))
iniFile.Get("Video", "ProjectionHack", &iPhackvalue[0], 0);
if (iniFile.Exists("Video", "PH_SZNear"))
iniFile.Get("Video", "PH_SZNear", &iPhackvalue[1], 0);
if (iniFile.Exists("Video", "PH_SZFar"))
iniFile.Get("Video", "PH_SZFar", &iPhackvalue[2], 0);
if (iniFile.Exists("Video", "PH_ExtraParam"))
iniFile.Get("Video", "PH_ExtraParam", &iPhackvalue[3], 0);
if (iniFile.Exists("Video", "PH_ZNear"))
iniFile.Get("Video", "PH_ZNear", &sPhackvalue[0], "");
if (iniFile.Exists("Video", "PH_ZFar"))
iniFile.Get("Video", "PH_ZFar", &sPhackvalue[1], "");
if (iniFile.Exists("Video", "UseNativeMips"))
iniFile.Get("Video", "UseNativeMips", &bUseNativeMips);
if (iniFile.Exists("Video", "ZTPSpeedupHack"))
iniFile.Get("Video", "ZTPSpeedupHack", &bZTPSpeedHack);
if (iniFile.Exists("Video", "DlistCachingEnable"))
iniFile.Get("Video", "DlistCachingEnable", &bDlistCachingEnable);
iniFile.GetIfExists("Video_Hardware", "VSync", &bVSync);
iniFile.GetIfExists("Video_Settings", "wideScreenHack", &bWidescreenHack);
iniFile.GetIfExists("Video_Settings", "AspectRatio", &iAspectRatio);
iniFile.GetIfExists("Video_Settings", "Crop", &bCrop);
iniFile.GetIfExists("Video_Settings", "UseXFB", &bUseXFB);
iniFile.GetIfExists("Video_Settings", "UseRealXFB", &bUseRealXFB);
iniFile.GetIfExists("Video_Settings", "UseNativeMips", &bUseNativeMips);
iniFile.GetIfExists("Video_Settings", "SafeTextureCache", &bSafeTextureCache);
iniFile.GetIfExists("Video_Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples);
iniFile.GetIfExists("Video_Settings", "ShowFPS", &bShowFPS);
iniFile.GetIfExists("Video_Settings", "OverlayStats", &bOverlayStats);
iniFile.GetIfExists("Video_Settings", "OverlayProjStats", &bOverlayProjStats);
iniFile.GetIfExists("Video_Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions);
iniFile.GetIfExists("Video_Settings", "DLOptimize", &iCompileDLsLevel);
iniFile.GetIfExists("Video_Settings", "DumpTextures", &bDumpTextures);
iniFile.GetIfExists("Video_Settings", "HiresTextures", &bHiresTextures);
iniFile.GetIfExists("Video_Settings", "DumpEFBTarget", &bDumpEFBTarget);
iniFile.GetIfExists("Video_Settings", "DumpFrames", &bDumpFrames);
iniFile.GetIfExists("Video_Settings", "FreeLook", &bFreeLook);
iniFile.GetIfExists("Video_Settings", "UseFFV1", &bUseFFV1);
iniFile.GetIfExists("Video_Settings", "AnaglyphStereo", &bAnaglyphStereo);
iniFile.GetIfExists("Video_Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation);
iniFile.GetIfExists("Video_Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle);
iniFile.GetIfExists("Video_Settings", "EnablePixelLigting", &bEnablePixelLigting);
iniFile.GetIfExists("Video_Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth);
iniFile.GetIfExists("Video_Settings", "ShowShaderErrors", &bShowShaderErrors);
iniFile.GetIfExists("Video_Settings", "MSAA", &iMultisampleMode);
iniFile.GetIfExists("Video_Settings", "EFBScale", &iEFBScale); // integral
iniFile.GetIfExists("Video_Settings", "DstAlphaPass", &bDstAlphaPass);
iniFile.GetIfExists("Video_Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable);
iniFile.GetIfExists("Video_Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter);
iniFile.GetIfExists("Video_Settings", "WireFrame", &bWireFrame);
iniFile.GetIfExists("Video_Settings", "DisableLighting", &bDisableLighting);
iniFile.GetIfExists("Video_Settings", "DisableTexturing", &bDisableTexturing);
iniFile.GetIfExists("Video_Settings", "DisableFog", &bDisableFog);
iniFile.GetIfExists("Video_Settings", "EnableOpenCL", &bEnableOpenCL);
iniFile.GetIfExists("Video_Enhancements", "ForceFiltering", &bForceFiltering);
iniFile.GetIfExists("Video_Enhancements", "MaxAnisotropy", &iMaxAnisotropy); // NOTE - this is x in (1 << x)
iniFile.GetIfExists("Video_Enhancements", "PostProcessingShader", &sPostProcessingShader);
iniFile.GetIfExists("Video_Enhancements", "Enable3dVision", &b3DVision);
iniFile.GetIfExists("Video_Hacks", "EFBAccessEnable", &bEFBAccessEnable);
iniFile.GetIfExists("Video_Hacks", "DlistCachingEnable", &bDlistCachingEnable);
iniFile.GetIfExists("Video_Hacks", "EFBCopyEnable", &bEFBCopyEnable);
iniFile.GetIfExists("Video_Hacks", "EFBCopyDisableHotKey", &bOSDHotKey);
iniFile.GetIfExists("Video_Hacks", "EFBToTextureEnable", &bCopyEFBToTexture);
iniFile.GetIfExists("Video_Hacks", "EFBScaledCopy", &bCopyEFBScaled);
iniFile.GetIfExists("Video_Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable);
iniFile.GetIfExists("Video_Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges);
iniFile.GetIfExists("Video_Hardware", "Adapter", &iAdapter);
iniFile.GetIfExists("Video", "ForceFiltering", &bForceFiltering);
iniFile.GetIfExists("Video", "MaxAnisotropy", &iMaxAnisotropy); // NOTE - this is x in (1 << x)
iniFile.GetIfExists("Video", "EFBCopyEnable", &bEFBCopyEnable);
iniFile.GetIfExists("Video", "EFBCopyDisableHotKey", &bOSDHotKey);
iniFile.GetIfExists("Video", "EFBAccessEnable", &bEFBAccessEnable);
iniFile.GetIfExists("Video", "EFBToTextureEnable", &bCopyEFBToTexture);
iniFile.GetIfExists("Video", "EFBScaledCopy", &bCopyEFBScaled);
iniFile.GetIfExists("Video", "SafeTextureCache", &bSafeTextureCache);
iniFile.GetIfExists("Video", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples);
iniFile.GetIfExists("Video", "MSAA", &iMultisampleMode);
iniFile.GetIfExists("Video", "EFBScale", &iEFBScale);
iniFile.GetIfExists("Video", "DstAlphaPass", &bDstAlphaPass);
iniFile.GetIfExists("Video", "UseXFB", &bUseXFB);
iniFile.GetIfExists("Video", "UseRealXFB", &bUseRealXFB);
iniFile.GetIfExists("Video", "ProjectionHack", &iPhackvalue[0]);
iniFile.GetIfExists("Video", "PH_SZNear", &iPhackvalue[1]);
iniFile.GetIfExists("Video", "PH_SZFar", &iPhackvalue[2]);
iniFile.GetIfExists("Video", "PH_ExtraParam", &iPhackvalue[3]);
iniFile.GetIfExists("Video", "PH_ZNear", &sPhackvalue[0]);
iniFile.GetIfExists("Video", "PH_ZFar", &sPhackvalue[1]);
iniFile.GetIfExists("Video", "UseNativeMips", &bUseNativeMips);
iniFile.GetIfExists("Video", "ZTPSpeedupHack", &bZTPSpeedHack);
iniFile.GetIfExists("Video", "DlistCachingEnable", &bDlistCachingEnable);
VerifyValidity();
}
@ -186,8 +222,9 @@ void VideoConfig::GameIniLoad(const char *ini_file)
void VideoConfig::VerifyValidity()
{
// TODO: Check iMaxAnisotropy value
if (iAdapter >= backend_info.Adapters.size()) iAdapter = 0;
if (!backend_info.bSupportsEFBToRAM) bCopyEFBToTexture = true;
if (iMultisampleMode >= (int)backend_info.AAModes.size()) iMultisampleMode = 0;
if (iMultisampleMode < 0 || 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;
@ -261,6 +298,85 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Save(ini_file);
}
void VideoConfig::GameIniSave(const char* default_ini, const char* game_ini)
{
// wxWidgets doesn't provide us with a nice way to change 3-state checkboxes into 2-state ones
// This would allow us to make the "default config" dialog layout to be 2-state based, but the
// "game config" layout to be 3-state based (with the 3rd state being "use default")
// Since we can't do that, we instead just save anything which differs from the default config
// TODO: Make this less ugly
VideoConfig defCfg;
defCfg.Load(default_ini);
IniFile iniFile;
iniFile.Load(game_ini);
#define SET_IF_DIFFERS(section, key, member) { if ((member) != (defCfg.member)) iniFile.Set((section), (key), (member)); else iniFile.DeleteKey((section), (key)); }
SET_IF_DIFFERS("Video_Hardware", "VSync", bVSync);
SET_IF_DIFFERS("Video_Settings", "wideScreenHack", bWidescreenHack);
SET_IF_DIFFERS("Video_Settings", "AspectRatio", iAspectRatio);
SET_IF_DIFFERS("Video_Settings", "Crop", bCrop);
SET_IF_DIFFERS("Video_Settings", "UseXFB", bUseXFB);
SET_IF_DIFFERS("Video_Settings", "UseRealXFB", bUseRealXFB);
SET_IF_DIFFERS("Video_Settings", "UseNativeMips", bUseNativeMips);
SET_IF_DIFFERS("Video_Settings", "SafeTextureCache", bSafeTextureCache);
SET_IF_DIFFERS("Video_Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
SET_IF_DIFFERS("Video_Settings", "ShowFPS", bShowFPS);
SET_IF_DIFFERS("Video_Settings", "OverlayStats", bOverlayStats);
SET_IF_DIFFERS("Video_Settings", "OverlayProjStats", bOverlayProjStats);
SET_IF_DIFFERS("Video_Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions);
SET_IF_DIFFERS("Video_Settings", "DLOptimize", iCompileDLsLevel);
SET_IF_DIFFERS("Video_Settings", "DumpTextures", bDumpTextures);
SET_IF_DIFFERS("Video_Settings", "HiresTextures", bHiresTextures);
SET_IF_DIFFERS("Video_Settings", "DumpEFBTarget", bDumpEFBTarget);
SET_IF_DIFFERS("Video_Settings", "DumpFrames", bDumpFrames);
SET_IF_DIFFERS("Video_Settings", "FreeLook", bFreeLook);
SET_IF_DIFFERS("Video_Settings", "UseFFV1", bUseFFV1);
SET_IF_DIFFERS("Video_Settings", "AnaglyphStereo", bAnaglyphStereo);
SET_IF_DIFFERS("Video_Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation);
SET_IF_DIFFERS("Video_Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle);
SET_IF_DIFFERS("Video_Settings", "EnablePixelLigting", bEnablePixelLigting);
SET_IF_DIFFERS("Video_Settings", "EnablePerPixelDepth", bEnablePerPixelDepth);
SET_IF_DIFFERS("Video_Settings", "ShowShaderErrors", bShowShaderErrors);
SET_IF_DIFFERS("Video_Settings", "MSAA", iMultisampleMode);
SET_IF_DIFFERS("Video_Settings", "EFBScale", iEFBScale); // integral
SET_IF_DIFFERS("Video_Settings", "DstAlphaPass", bDstAlphaPass);
SET_IF_DIFFERS("Video_Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable);
SET_IF_DIFFERS("Video_Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter);
SET_IF_DIFFERS("Video_Settings", "WireFrame", bWireFrame);
SET_IF_DIFFERS("Video_Settings", "DisableLighting", bDisableLighting);
SET_IF_DIFFERS("Video_Settings", "DisableTexturing", bDisableTexturing);
SET_IF_DIFFERS("Video_Settings", "DisableFog", bDisableFog);
SET_IF_DIFFERS("Video_Settings", "EnableOpenCL", bEnableOpenCL);
SET_IF_DIFFERS("Video_Enhancements", "ForceFiltering", bForceFiltering);
SET_IF_DIFFERS("Video_Enhancements", "MaxAnisotropy", iMaxAnisotropy); // NOTE - this is x in (1 << x)
SET_IF_DIFFERS("Video_Enhancements", "PostProcessingShader", sPostProcessingShader);
SET_IF_DIFFERS("Video_Enhancements", "Enable3dVision", b3DVision);
SET_IF_DIFFERS("Video_Hacks", "EFBAccessEnable", bEFBAccessEnable);
SET_IF_DIFFERS("Video_Hacks", "DlistCachingEnable", bDlistCachingEnable);
SET_IF_DIFFERS("Video_Hacks", "EFBCopyEnable", bEFBCopyEnable);
SET_IF_DIFFERS("Video_Hacks", "EFBCopyDisableHotKey", bOSDHotKey);
SET_IF_DIFFERS("Video_Hacks", "EFBToTextureEnable", bCopyEFBToTexture);
SET_IF_DIFFERS("Video_Hacks", "EFBScaledCopy", bCopyEFBScaled);
SET_IF_DIFFERS("Video_Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable);
SET_IF_DIFFERS("Video_Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
SET_IF_DIFFERS("Video_Hardware", "Adapter", iAdapter);
iniFile.Save(game_ini);
}
// TODO: remove
extern bool g_aspect_wide;

View File

@ -66,6 +66,7 @@ struct VideoConfig
void GameIniLoad(const char *ini_file);
void VerifyValidity();
void Save(const char *ini_file);
void GameIniSave(const char* default_ini, const char* game_ini);
void UpdateProjectionHack();
// General