From 5f55d4e7f064c27be714c208fec1fbda419451dc Mon Sep 17 00:00:00 2001 From: death2droid Date: Mon, 11 May 2009 21:20:27 +0000 Subject: [PATCH] game.ini fix for projection hack's. This patch is by val532 git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3206 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/ISOProperties.cpp | 24 ++++- Source/Core/DolphinWX/Src/ISOProperties.h | 5 ++ Source/Plugins/Plugin_VideoOGL/Src/Config.cpp | 3 + Source/Plugins/Plugin_VideoOGL/Src/Config.h | 1 + .../Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp | 87 ++++++++++--------- .../Plugin_VideoOGL/Src/GUI/ConfigDlg.h | 3 +- Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 1 + 7 files changed, 82 insertions(+), 42 deletions(-) diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index fcdcd185ad..c93028e8d2 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -43,6 +43,7 @@ BEGIN_EVENT_TABLE(CISOProperties, wxDialog) EVT_CLOSE(CISOProperties::OnClose) EVT_BUTTON(ID_CLOSE, CISOProperties::OnCloseClick) EVT_BUTTON(ID_EDITCONFIG, CISOProperties::OnEditConfig) + EVT_CHOICE(ID_HACK, CISOProperties::SetRefresh) EVT_CHOICE(ID_EMUSTATE, CISOProperties::SetRefresh) EVT_CHOICE(ID_EMU_ISSUES, CISOProperties::SetRefresh) EVT_LISTBOX(ID_PATCHES_LIST, CISOProperties::ListSelectionChanged) @@ -285,6 +286,17 @@ void CISOProperties::CreateGUIControls() SafeTextureCache = new wxCheckBox(m_GameConfig, ID_SAFETEXTURECACHE, _("Safe Texture Cache"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); DstAlphaPass = new wxCheckBox(m_GameConfig, ID_DSTALPHAPASS, _("Distance Alpha Pass"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); UseXFB = new wxCheckBox(m_GameConfig, ID_USEXFB, _("Use XFB"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); + // Hack + Hacktext = new wxStaticText(m_GameConfig, ID_HACK_TEXT, _("Hack for: "), wxDefaultPosition, wxDefaultSize); + arrayStringFor_Hack.Add(_("None")); + arrayStringFor_Hack.Add(_("Zelda Twighlight Princess Bloom hack")); + arrayStringFor_Hack.Add(_("Super Mario Galaxy")); + arrayStringFor_Hack.Add(_("Mario Kart Wii")); + arrayStringFor_Hack.Add(_("Sonic and the Black Knight")); + arrayStringFor_Hack.Add(_("Bleach Versus Crusade")); + arrayStringFor_Hack.Add(_("Final Fantasy CC Echo of Time")); + Hack = new wxChoice(m_GameConfig, ID_HACK, wxDefaultPosition, wxDefaultSize, arrayStringFor_Hack, 0, wxDefaultValidator); + //HLE Audio sbHLEaudioOverrides = new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("HLE Audio")); UseRE0Fix = new wxCheckBox(m_GameConfig, ID_RE0FIX, _("Use RE0 Fix"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); @@ -319,6 +331,8 @@ void CISOProperties::CreateGUIControls() sbVideoOverrides->Add(SafeTextureCache, 0, wxEXPAND|wxLEFT, 5); sbVideoOverrides->Add(DstAlphaPass, 0, wxEXPAND|wxLEFT, 5); sbVideoOverrides->Add(UseXFB, 0, wxEXPAND|wxLEFT, 5); + sbVideoOverrides->Add(Hacktext, 0, wxEXPAND|wxLEFT, 5); + sbVideoOverrides->Add(Hack, 0, wxEXPAND|wxLEFT, 5); sbHLEaudioOverrides->Add(UseRE0Fix, 0, wxEXPAND|wxLEFT, 5); sbGameConfig->Add(sbCoreOverrides, 0, wxEXPAND); sbGameConfig->Add(sbWiiOverrides, 0, wxEXPAND); @@ -655,7 +669,14 @@ void CISOProperties::LoadGameConfig() UseRE0Fix->Set3StateValue((wxCheckBoxState)bTemp); else UseRE0Fix->Set3StateValue(wxCHK_UNDETERMINED); - + + GameIni.Get("Video", "Hack", &iTemp, -1); + if (iTemp == -1) + { + iTemp = 0; + bRefreshList = true; + } + Hack->SetSelection(iTemp); GameIni.Get("EmuState", "EmulationStateId", &iTemp, -1); if (iTemp == -1) @@ -760,6 +781,7 @@ bool CISOProperties::SaveGameConfig() else GameIni.Set("HLEaudio", "UseRE0Fix", UseRE0Fix->Get3StateValue()); + GameIni.Set("Video", "Hack", EmuState->GetSelection()); GameIni.Set("EmuState", "EmulationStateId", EmuState->GetSelection()); GameIni.Set("EmuState", "EmulationIssues", EmuIssues->GetValue()); diff --git a/Source/Core/DolphinWX/Src/ISOProperties.h b/Source/Core/DolphinWX/Src/ISOProperties.h index 70e19267a5..48cae0e39d 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.h +++ b/Source/Core/DolphinWX/Src/ISOProperties.h @@ -87,6 +87,9 @@ class CISOProperties : public wxDialog wxCheckBox *ProjHack1, *ForceFiltering, *EFBCopyDisable, *EFBCopyDisableHotKey, *EFBToTextureEnable, *SafeTextureCache, *DstAlphaPass, *UseXFB; + wxStaticText *Hacktext; + wxArrayString arrayStringFor_Hack; + wxChoice *Hack; // HLE Audio wxCheckBox *UseRE0Fix; @@ -163,6 +166,8 @@ class CISOProperties : public wxDialog ID_SAFETEXTURECACHE, ID_DSTALPHAPASS, ID_USEXFB, + ID_HACK_TEXT, + ID_HACK, ID_RE0FIX, ID_ENABLEPROGRESSIVESCAN, ID_ENABLEWIDESCREEN, diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp index 031713b0b3..d3e73cdb3f 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp @@ -123,6 +123,9 @@ void Config::GameIniLoad() { if (iniFile->Exists("Video", "UseXFB")) iniFile->Get("Video", "UseXFB", &bUseXFB, 0); + if (iniFile->Exists("Video", "Hack")) + iniFile->Get("Video", "Hack", &iPhackvalue, 0); + } void Config::Save() diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.h b/Source/Plugins/Plugin_VideoOGL/Src/Config.h index 39f968272b..7101c0bf43 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Config.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.h @@ -45,6 +45,7 @@ struct Config void Load(); void GameIniLoad(); void Save(); + void UpdateHack(); // General bool bFullscreen; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp index f3ab1e1f86..9437251d4f 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp @@ -76,6 +76,8 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl : wxDialog(parent, id, title, position, size, style) { g_Config.Load(); + g_Config.GameIniLoad(); + g_Config.UpdateHack(); } /////////////////////////////////////////////////////////////////////////////////////////////// @@ -522,48 +524,11 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) case ID_MSAAMODECB: g_Config.iMultisampleMode = m_MSAAModeCB->GetSelection(); break; - case ID_PHACKVALUE: + case ID_PHACKVALUE: g_Config.iPhackvalue = m_PhackvalueCB->GetSelection(); - if (g_Config.iPhackvalue >= 0) + if (g_Config.iPhackvalue >= 0) { - switch(g_Config.iPhackvalue) - { - case OGL_HACK_NONE: - g_Config.bPhackvalue1 = 0; - g_Config.bPhackvalue2 = 0; - break; - case OGL_HACK_ZELDA_TP_BLOOM_HACK: - g_Config.bPhackvalue1 = 1; - break; - case OGL_HACK_SUPER_MARIO_GALAXY: - g_Config.bPhackvalue1 = 1; - g_Config.fhackvalue1 = 0.00006f; - g_Config.bPhackvalue2 = 0; - break; - case OGL_HACK_MARIO_KART_WII: - g_Config.bPhackvalue1 = 1; - g_Config.fhackvalue1 = 0.00006f; - g_Config.bPhackvalue2 = 0; - break; - case OGL_HACK_SONIC_AND_THE_BLACK_KNIGHT: - g_Config.bPhackvalue1 = 1; - g_Config.fhackvalue1 = 0.00002f; - g_Config.bPhackvalue2 = 1; - g_Config.fhackvalue2 = 1.999980f; - break; - case OGL_HACK_BLEACH_VERSUS_CRUSADE: - g_Config.bPhackvalue2 = 1; - g_Config.fhackvalue2 = 0.5f; - g_Config.bPhackvalue1 = 0; - break; - case OGL_HACK_FINAL_FANTASY_CC_ECHO_OF_TIME: - g_Config.bPhackvalue1 = 1; - g_Config.fhackvalue1 = 0.8f; - g_Config.bPhackvalue2 = 1; - g_Config.fhackvalue2 = 1.2f; - break; - } - + g_Config.UpdateHack(); } break; } @@ -687,3 +652,45 @@ void ConfigDialog::UpdateGUI() m_FullscreenCB->Enable(!g_Config.renderToMainframe); m_WindowResolutionCB->Enable(!g_Config.renderToMainframe); } +void Config::UpdateHack() +{ + switch(g_Config.iPhackvalue) + { + case OGL_HACK_NONE: + g_Config.bPhackvalue1 = 0; + g_Config.bPhackvalue2 = 0; + break; + case OGL_HACK_ZELDA_TP_BLOOM_HACK: + g_Config.bPhackvalue1 = 1; + break; + case OGL_HACK_SUPER_MARIO_GALAXY: + g_Config.bPhackvalue1 = 1; + g_Config.fhackvalue1 = 0.00006f; + g_Config.bPhackvalue2 = 0; + break; + case OGL_HACK_MARIO_KART_WII: + g_Config.bPhackvalue1 = 1; + g_Config.fhackvalue1 = 0.00006f; + g_Config.bPhackvalue2 = 0; + break; + case OGL_HACK_SONIC_AND_THE_BLACK_KNIGHT: + g_Config.bPhackvalue1 = 1; + g_Config.fhackvalue1 = 0.00002f; + g_Config.bPhackvalue2 = 1; + g_Config.fhackvalue2 = 1.999980f; + break; + case OGL_HACK_BLEACH_VERSUS_CRUSADE: + g_Config.bPhackvalue2 = 1; + g_Config.fhackvalue2 = 0.5f; + g_Config.bPhackvalue1 = 0; + break; + case OGL_HACK_FINAL_FANTASY_CC_ECHO_OF_TIME: + g_Config.bPhackvalue1 = 1; + g_Config.fhackvalue1 = 0.8f; + g_Config.bPhackvalue2 = 1; + g_Config.fhackvalue2 = 1.2f; + break; + } +} + + diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h index 6000af0f92..233d6db871 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h @@ -57,7 +57,7 @@ class ConfigDialog : public wxDialog void AddFSReso(char *reso); void AddWindowReso(char *reso); void CreateGUIControls(); - + void GameIniLoad(); // Combo box lists, this one needs to be public wxArrayString arrayStringFor_FullscreenCB; @@ -196,6 +196,7 @@ class ConfigDialog : public wxDialog void OnClose(wxCloseEvent& event); void UpdateGUI(); + void UpdateHack(); void AboutClick(wxCommandEvent& event); void GeneralSettingsChanged(wxCommandEvent& event); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 1745eeb5b6..a852508f72 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -222,6 +222,7 @@ void Initialize(void *init) g_Config.Load(); g_Config.GameIniLoad(); + g_Config.UpdateHack(); if (!OpenGL_Create(g_VideoInitialize, 640, 480)) // 640x480 will be the default if all else fails {