DolphinWX: Remove the Projection Hack UI

This commit is contained in:
Lioncash 2014-07-30 19:31:29 -04:00
parent 5516b0382c
commit cd37af8590
7 changed files with 5 additions and 254 deletions

View File

@ -86,7 +86,6 @@ if(wxWidgets_FOUND)
MemcardManager.cpp
MemoryCards/WiiSaveCrypted.cpp
NetWindow.cpp
PHackSettings.cpp
PatchAddEdit.cpp
TASInputDlg.cpp
VideoConfigDiag.cpp

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
@ -90,7 +90,6 @@
<ClCompile Include="MemoryCards\WiiSaveCrypted.cpp" />
<ClCompile Include="NetWindow.cpp" />
<ClCompile Include="PatchAddEdit.cpp" />
<ClCompile Include="PHackSettings.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
@ -140,7 +139,6 @@
<ClInclude Include="MemoryCards\WiiSaveCrypted.h" />
<ClInclude Include="NetWindow.h" />
<ClInclude Include="PatchAddEdit.h" />
<ClInclude Include="PHackSettings.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="TASInputDlg.h" />
<ClInclude Include="VideoConfigDiag.h" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="GUI">
@ -146,9 +146,6 @@
<ClCompile Include="PatchAddEdit.cpp">
<Filter>GUI</Filter>
</ClCompile>
<ClCompile Include="PHackSettings.cpp">
<Filter>GUI</Filter>
</ClCompile>
<ClCompile Include="TASInputDlg.cpp">
<Filter>GUI</Filter>
</ClCompile>
@ -271,9 +268,6 @@
<ClInclude Include="PatchAddEdit.h">
<Filter>GUI</Filter>
</ClInclude>
<ClInclude Include="PHackSettings.h">
<Filter>GUI</Filter>
</ClInclude>
<ClInclude Include="TASInputDlg.h">
<Filter>GUI</Filter>
</ClInclude>

View File

@ -73,7 +73,6 @@
#include "DolphinWX/ISOFile.h"
#include "DolphinWX/ISOProperties.h"
#include "DolphinWX/PatchAddEdit.h"
#include "DolphinWX/PHackSettings.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/resources/isoprop_disc.xpm"
#include "DolphinWX/resources/isoprop_file.xpm"
@ -105,7 +104,6 @@ BEGIN_EVENT_TABLE(CISOProperties, wxDialog)
EVT_BUTTON(ID_SHOWDEFAULTCONFIG, CISOProperties::OnShowDefaultConfig)
EVT_CHOICE(ID_EMUSTATE, CISOProperties::SetRefresh)
EVT_CHOICE(ID_EMU_ISSUES, CISOProperties::SetRefresh)
EVT_BUTTON(ID_PHSETTINGS, CISOProperties::PHackButtonClicked)
EVT_LISTBOX(ID_PATCHES_LIST, CISOProperties::ListSelectionChanged)
EVT_BUTTON(ID_EDITPATCH, CISOProperties::PatchButtonClicked)
EVT_BUTTON(ID_ADDPATCH, CISOProperties::PatchButtonClicked)
@ -413,13 +411,6 @@ void CISOProperties::CreateGUIControls(bool IsWad)
UseBBox = new wxCheckBox(m_GameConfig, ID_USE_BBOX, _("Enable Bounding Box Calculation"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Video", "UseBBox"));
UseBBox->SetToolTip(_("If checked, the bounding box registers will be updated. Used by the Paper Mario games."));
// Hack
wxFlexGridSizer* const szrPHackSettings = new wxFlexGridSizer(0);
PHackEnable = new wxCheckBox(m_GameConfig, ID_PHACKENABLE, _("Custom Projection Hack"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
PHackEnable->SetToolTip(_("Enables Custom Projection Hack"));
PHSettings = new wxButton(m_GameConfig, ID_PHSETTINGS, _("Settings..."));
PHSettings->SetToolTip(_("Customize some Orthographic Projection parameters."));
wxBoxSizer* const sEmuState = new wxBoxSizer(wxHORIZONTAL);
wxStaticText* const EmuStateText = new wxStaticText(m_GameConfig, wxID_ANY, _("Emulation State: "));
arrayStringFor_EmuState.Add(_("Not Set"));
@ -455,10 +446,7 @@ void CISOProperties::CreateGUIControls(bool IsWad)
wxStaticBoxSizer * const sbVideoOverrides = new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Video"));
sbVideoOverrides->Add(UseBBox, 0, wxLEFT, 5);
szrPHackSettings->Add(PHackEnable, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5);
szrPHackSettings->Add(PHSettings, 0, wxLEFT, 5);
sbVideoOverrides->Add(szrPHackSettings, 0, wxEXPAND);
wxStaticBoxSizer * const sbGameConfig = new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Game-Specific Settings"));
sbGameConfig->Add(OverrideText, 0, wxEXPAND|wxALL, 5);
sbGameConfig->Add(sbCoreOverrides, 0, wxEXPAND);
@ -1043,10 +1031,6 @@ void CISOProperties::LoadGameConfig()
// First set values from default gameini, then apply values from local gameini
int iTemp;
default_video->Get("ProjectionHack", &iTemp);
PHackEnable->SetValue(!!iTemp);
if (local_video->Get("ProjectionHack", &iTemp))
PHackEnable->SetValue(!!iTemp);
default_video->Get("PH_SZNear", &PHack_Data.PHackSZNear);
if (GameIniLocal.GetIfExists("Video", "PH_SZNear", &iTemp))
PHack_Data.PHackSZNear = !!iTemp;
@ -1133,7 +1117,6 @@ bool CISOProperties::SaveGameConfig()
GameIniLocal.DeleteKey((section), (key)); \
} while (0)
SAVE_IF_NOT_DEFAULT("Video", "ProjectionHack", (int)PHackEnable->GetValue(), 0);
SAVE_IF_NOT_DEFAULT("Video", "PH_SZNear", (PHack_Data.PHackSZNear ? 1 : 0), 0);
SAVE_IF_NOT_DEFAULT("Video", "PH_SZFar", (PHack_Data.PHackSZFar ? 1 : 0), 0);
SAVE_IF_NOT_DEFAULT("Video", "PH_ZNear", PHack_Data.PHZNear, "");
@ -1329,17 +1312,6 @@ void CISOProperties::PatchList_Save()
GameIniLocal.SetLines("OnFrame", lines);
}
void CISOProperties::PHackButtonClicked(wxCommandEvent& event)
{
if (event.GetId() == ID_PHSETTINGS)
{
::PHack_Data = PHack_Data;
CPHackSettings dlg(this, 1);
if (dlg.ShowModal() == wxID_OK)
PHack_Data = ::PHack_Data;
}
}
void CISOProperties::PatchButtonClicked(wxCommandEvent& event)
{
int selection = Patches->GetSelection();

View File

@ -72,8 +72,7 @@ private:
// Wii
wxCheckBox *EnableWideScreen;
// Video
wxCheckBox *PHackEnable, *UseBBox;
wxButton *PHSettings;
wxCheckBox *UseBBox;
wxArrayString arrayStringFor_EmuState;
wxChoice *EmuState;
@ -136,8 +135,6 @@ private:
ID_MERGEBLOCKS,
ID_AUDIO_DSP_HLE,
ID_USE_BBOX,
ID_PHACKENABLE,
ID_PHSETTINGS,
ID_ENABLEPROGRESSIVESCAN,
ID_ENABLEWIDESCREEN,
ID_EDITCONFIG,
@ -198,7 +195,6 @@ private:
void CheckPartitionIntegrity(wxCommandEvent& event);
void SetRefresh(wxCommandEvent& event);
void OnChangeBannerLang(wxCommandEvent& event);
void PHackButtonClicked(wxCommandEvent& event);
GameListItem *OpenGameListItem;

View File

@ -1,152 +0,0 @@
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <cstdio>
#include <string>
#include <wx/checkbox.h>
#include <wx/choice.h>
#include <wx/defs.h>
#include <wx/dialog.h>
#include <wx/event.h>
#include <wx/gdicmn.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/string.h>
#include <wx/textctrl.h>
#include <wx/translation.h>
#include <wx/windowid.h>
#include "Common/CommonPaths.h"
#include "Common/FileUtil.h"
#include "Common/IniFile.h"
#include "DolphinWX/ISOProperties.h"
#include "DolphinWX/PHackSettings.h"
#include "DolphinWX/WxUtils.h"
class wxWindow;
BEGIN_EVENT_TABLE(CPHackSettings, wxDialog)
EVT_CHOICE(ID_PHACK_CHOICE, CPHackSettings::SetRefresh)
EVT_BUTTON(wxID_OK, CPHackSettings::SavePHackData)
END_EVENT_TABLE()
CPHackSettings::CPHackSettings(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
{
CreateGUIControls();
std::string _iniFilename = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP "PH_PRESETS.ini";
PHPresetsIni.Load(_iniFilename);
PHPresetsIni.SortSections();
LoadPHackData();
}
CPHackSettings::~CPHackSettings()
{
}
void CPHackSettings::CreateGUIControls()
{
wxStaticText *PHackChoiceText = new wxStaticText(this, wxID_ANY, _("Presets: "));
PHackChoice = new wxChoice(this, ID_PHACK_CHOICE);
PHackChoice->SetToolTip(_("Load preset values from hack patterns available."));
wxStaticText *PHackZNearText = new wxStaticText(this, wxID_ANY, _("zNear Correction: "));
PHackZNear = new wxTextCtrl(this, ID_PHACK_ZNEAR);
PHackZNear->SetToolTip(_("Adds the specified value to zNear Parameter.\nTwo ways to express the floating point values.\nExample: entering '\'200'\' or '\'0.0002'\' directly, it produces equal effects, the acquired value will be '\'0.0002'\'.\nValues: (0->+/-Integer) or (0->+/-FP[6 digits of precision])\n\nNOTE: Check LogWindow/Console for the acquired values."));
PHackSZNear = new wxCheckBox(this, ID_PHACK_SZNEAR, _("(-)+zNear"));
PHackSZNear->SetToolTip(_("Changes sign to zNear Parameter (after correction)"));
wxStaticText *PHackZFarText = new wxStaticText(this, wxID_ANY, _("zFar Correction: "));
PHackZFar = new wxTextCtrl(this, ID_PHACK_ZFAR);
PHackZFar->SetToolTip(_("Adds the specified value to zFar Parameter.\nTwo ways to express the floating point values.\nExample: entering '\'200'\' or '\'0.0002'\' directly, it produces equal effects, the acquired value will be '\'0.0002'\'.\nValues: (0->+/-Integer) or (0->+/-FP[6 digits of precision])\n\nNOTE: Check LogWindow/Console for the acquired values."));
PHackSZFar = new wxCheckBox(this, ID_PHACK_SZFAR, _("(-)+zFar"));
PHackSZFar->SetToolTip(_("Changes sign to zFar Parameter (after correction)"));
wxStaticBoxSizer *sbPHackSettings = new wxStaticBoxSizer(wxVERTICAL, this, _("Parameters"));
wxFlexGridSizer *szrPHackSettings = new wxFlexGridSizer(3, 5, 5);
sbPHackSettings->Add(szrPHackSettings, 0, wxEXPAND|wxLEFT|wxTOP, 5);
szrPHackSettings->Add(PHackZNearText, 0, wxALIGN_CENTER_VERTICAL);
szrPHackSettings->Add(PHackZNear, 1, wxEXPAND);
szrPHackSettings->Add(PHackSZNear, 0, wxEXPAND|wxLEFT, 5);
szrPHackSettings->Add(PHackZFarText, 0, wxALIGN_CENTER_VERTICAL);
szrPHackSettings->Add(PHackZFar, 1, wxEXPAND);
szrPHackSettings->Add(PHackSZFar, 0, wxEXPAND|wxLEFT, 5);
wxBoxSizer* sPHack = new wxBoxSizer(wxVERTICAL);
sPHack->Add(PHackChoiceText, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5);
sPHack->Add(PHackChoice, 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5);
sPHack->Add(sbPHackSettings, 0, wxEXPAND|wxALL, 5);
sPHack->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5);
SetSizerAndFit(sPHack);
SetFocus();
}
void CPHackSettings::LoadPHackData()
{
std::string sTemp;
std::string sIndex;
PHackChoice->Clear();
PHackChoice->Append(_("[Custom]"));
for (int i = 0; ; i++)
{
sIndex = std::to_string(i);
if (!PHPresetsIni.Exists(sIndex, "Title"))
break;
PHPresetsIni.GetOrCreateSection(sIndex)->Get("Title", &sTemp);
if (sTemp.empty())
sTemp = WxStrToStr(_("(UNKNOWN)"));
if (i == 0)
PHackChoice->Append(StrToWxStr("-------------"));
PHackChoice->Append(StrToWxStr(sTemp));
}
PHackChoice->Select(0);
PHackSZNear->Set3StateValue((wxCheckBoxState)PHack_Data.PHackSZNear);
PHackSZFar->Set3StateValue((wxCheckBoxState)PHack_Data.PHackSZFar);
PHackZNear->SetValue(StrToWxStr(PHack_Data.PHZNear));
PHackZFar->SetValue(StrToWxStr(PHack_Data.PHZFar));
}
void CPHackSettings::SetRefresh(wxCommandEvent& event)
{
bool bTemp;
std::string sTemp;
std::string sIndex;
int index = event.GetSelection();
if (index > 1)
{
index -= 2;
sIndex = std::to_string(index);
IniFile::Section* proj_hack = PHPresetsIni.GetOrCreateSection(sIndex);
proj_hack->Get("PH_SZNear", &bTemp);
PHackSZNear->Set3StateValue((wxCheckBoxState)bTemp);
proj_hack->Get("PH_SZFar", &bTemp);
PHackSZFar->Set3StateValue((wxCheckBoxState)bTemp);
proj_hack->Get("PH_ZNear", &sTemp);
PHackZNear->SetValue(StrToWxStr(sTemp));
proj_hack->Get("PH_ZFar", &sTemp);
PHackZFar->SetValue(StrToWxStr(sTemp));
}
}
void CPHackSettings::SavePHackData(wxCommandEvent& event)
{
PHack_Data.PHackSZNear = PHackSZNear->GetValue();
PHack_Data.PHackSZFar = PHackSZFar->GetValue();
PHack_Data.PHZNear = PHackZNear->GetValue().char_str();
PHack_Data.PHZFar = PHackZFar->GetValue().char_str();
AcceptAndClose();
event.Skip();
}

View File

@ -1,56 +0,0 @@
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#include <wx/dialog.h>
#include <wx/event.h>
#include <wx/gdicmn.h>
#include <wx/string.h>
#include <wx/translation.h>
#include <wx/windowid.h>
#include "Common/IniFile.h"
class wxCheckBox;
class wxChoice;
class wxTextCtrl;
class wxWindow;
class CPHackSettings : public wxDialog
{
public:
CPHackSettings(wxWindow* parent,
wxWindowID id = 1,
const wxString& title = _("Custom Projection Hack Settings"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
virtual ~CPHackSettings();
private:
DECLARE_EVENT_TABLE();
wxChoice *PHackChoice;
wxCheckBox *PHackSZNear;
wxCheckBox *PHackSZFar;
wxTextCtrl *PHackZNear;
wxTextCtrl *PHackZFar;
enum {
ID_PHACK_CHOICE = 1000,
ID_PHACK_SZNEAR,
ID_PHACK_SZFAR,
ID_PHACK_ZNEAR,
ID_PHACK_ZFAR,
};
IniFile PHPresetsIni;
void SetRefresh(wxCommandEvent& event);
void CreateGUIControls();
void SavePHackData(wxCommandEvent& event);
void LoadPHackData();
};