Make iso properties non modal.

This commit is contained in:
Rachel Bryk 2015-02-24 18:32:17 -05:00
parent 5fc62ac563
commit 2df8190e1a
13 changed files with 69 additions and 45 deletions

View file

@ -934,4 +934,9 @@ bool RunCode(const ARCode &arcode)
return true; return true;
} }
std::vector<ARCode> GetARCodes()
{
return arCodes;
}
} // namespace ActionReplay } // namespace ActionReplay

View file

@ -36,4 +36,5 @@ void UpdateActiveList();
void EnableSelfLogging(bool enable); void EnableSelfLogging(bool enable);
const std::vector<std::string> &GetSelfLog(); const std::vector<std::string> &GetSelfLog();
bool IsSelfLogging(); bool IsSelfLogging();
std::vector<ARCode> GetARCodes();
} // namespace } // namespace

View file

@ -8,6 +8,7 @@
#include <vector> #include <vector>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Core/PatchEngine.h"
class IniFile; class IniFile;

View file

@ -26,12 +26,12 @@
#include "Core/ActionReplay.h" #include "Core/ActionReplay.h"
#include "Core/ARDecrypt.h" #include "Core/ARDecrypt.h"
#include "DolphinWX/ARCodeAddEdit.h" #include "DolphinWX/ARCodeAddEdit.h"
#include "DolphinWX/ISOProperties.h"
#include "DolphinWX/WxUtils.h" #include "DolphinWX/WxUtils.h"
CARCodeAddEdit::CARCodeAddEdit(int _selection, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) CARCodeAddEdit::CARCodeAddEdit(int _selection, const std::vector<ActionReplay::ARCode>& _arCodes, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style) : wxDialog(parent, id, title, position, size, style)
, selection(_selection) , selection(_selection)
, arCodes(_arCodes)
{ {
Bind(wxEVT_BUTTON, &CARCodeAddEdit::SaveCheatData, this, wxID_OK); Bind(wxEVT_BUTTON, &CARCodeAddEdit::SaveCheatData, this, wxID_OK);

View file

@ -21,7 +21,8 @@ namespace ActionReplay { struct ARCode; }
class CARCodeAddEdit : public wxDialog class CARCodeAddEdit : public wxDialog
{ {
public: public:
CARCodeAddEdit(int _selection, wxWindow* parent, CARCodeAddEdit(int _selection, const std::vector<ActionReplay::ARCode>& _arCodes,
wxWindow* parent,
wxWindowID id = wxID_ANY, wxWindowID id = wxID_ANY,
const wxString& title = _("Edit ActionReplay Code"), const wxString& title = _("Edit ActionReplay Code"),
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
@ -33,6 +34,8 @@ private:
wxSpinButton* EntrySelection; wxSpinButton* EntrySelection;
wxTextCtrl* EditCheatCode; wxTextCtrl* EditCheatCode;
std::vector<ActionReplay::ARCode> arCodes;
void SaveCheatData(wxCommandEvent& event); void SaveCheatData(wxCommandEvent& event);
void ChangeEntry(wxSpinEvent& event); void ChangeEntry(wxSpinEvent& event);
void UpdateTextCtrl(ActionReplay::ARCode arCode); void UpdateTextCtrl(ActionReplay::ARCode arCode);

View file

@ -19,6 +19,7 @@
#include "Common/CommonFuncs.h" #include "Common/CommonFuncs.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ActionReplay.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "DolphinWX/WxUtils.h" #include "DolphinWX/WxUtils.h"
#include "DolphinWX/Cheats/CheatSearchTab.h" #include "DolphinWX/Cheats/CheatSearchTab.h"
@ -308,7 +309,7 @@ void CheatSearchTab::CreateARCode(wxCommandEvent&)
{ {
const u32 address = m_search_results[sel].address | ((m_search_type_size & ~1) << 24); const u32 address = m_search_results[sel].address | ((m_search_type_size & ~1) << 24);
CreateCodeDialog arcode_dlg(this, address); CreateCodeDialog arcode_dlg(this, address, ActionReplay::GetARCodes());
arcode_dlg.SetExtraStyle(arcode_dlg.GetExtraStyle() & ~wxWS_EX_BLOCK_EVENTS); arcode_dlg.SetExtraStyle(arcode_dlg.GetExtraStyle() & ~wxWS_EX_BLOCK_EVENTS);
arcode_dlg.ShowModal(); arcode_dlg.ShowModal();
} }

View file

@ -20,9 +20,10 @@
// Fired when an ActionReplay code is created. // Fired when an ActionReplay code is created.
wxDEFINE_EVENT(UPDATE_CHEAT_LIST_EVENT, wxCommandEvent); wxDEFINE_EVENT(UPDATE_CHEAT_LIST_EVENT, wxCommandEvent);
CreateCodeDialog::CreateCodeDialog(wxWindow* const parent, const u32 address) CreateCodeDialog::CreateCodeDialog(wxWindow* const parent, const u32 address, const std::vector<ActionReplay::ARCode>& _arCodes)
: wxDialog(parent, wxID_ANY, _("Create AR Code")) : wxDialog(parent, wxID_ANY, _("Create AR Code"))
, m_code_address(address) , m_code_address(address)
, arCodes(_arCodes)
{ {
wxStaticText* const label_name = new wxStaticText(this, wxID_ANY, _("Name: ")); wxStaticText* const label_name = new wxStaticText(this, wxID_ANY, _("Name: "));
m_textctrl_name = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(256, -1)); m_textctrl_name = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(256, -1));

View file

@ -8,6 +8,7 @@
#include <wx/event.h> #include <wx/event.h>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Core/ActionReplay.h"
class wxCheckBox; class wxCheckBox;
class wxTextCtrl; class wxTextCtrl;
@ -18,10 +19,11 @@ wxDECLARE_EVENT(UPDATE_CHEAT_LIST_EVENT, wxCommandEvent);
class CreateCodeDialog final : public wxDialog class CreateCodeDialog final : public wxDialog
{ {
public: public:
CreateCodeDialog(wxWindow* const parent, const u32 address); CreateCodeDialog(wxWindow* const parent, const u32 address, const std::vector<ActionReplay::ARCode>& _arCodes);
private: private:
const u32 m_code_address; const u32 m_code_address;
std::vector<ActionReplay::ARCode> arCodes;
wxTextCtrl* m_textctrl_name; wxTextCtrl* m_textctrl_name;
wxTextCtrl* m_textctrl_code; wxTextCtrl* m_textctrl_code;

View file

@ -1099,9 +1099,8 @@ void CGameListCtrl::OnProperties(wxCommandEvent& WXUNUSED (event))
if (!iso) if (!iso)
return; return;
CISOProperties ISOProperties(iso->GetFileName(), this); CISOProperties* ISOProperties = new CISOProperties(iso->GetFileName(), this);
if (ISOProperties.ShowModal() == wxID_OK) ISOProperties->Show();
Update();
} }
void CGameListCtrl::OnWiki(wxCommandEvent& WXUNUSED (event)) void CGameListCtrl::OnWiki(wxCommandEvent& WXUNUSED (event))

View file

@ -71,6 +71,8 @@
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
#include "DolphinWX/ARCodeAddEdit.h" #include "DolphinWX/ARCodeAddEdit.h"
#include "DolphinWX/GameListCtrl.h"
//#include "DolphinWX/Frame.h"
#include "DolphinWX/ISOFile.h" #include "DolphinWX/ISOFile.h"
#include "DolphinWX/ISOProperties.h" #include "DolphinWX/ISOProperties.h"
#include "DolphinWX/PatchAddEdit.h" #include "DolphinWX/PatchAddEdit.h"
@ -80,22 +82,6 @@
#include "DolphinWX/resources/isoprop_file.xpm" #include "DolphinWX/resources/isoprop_file.xpm"
#include "DolphinWX/resources/isoprop_folder.xpm" #include "DolphinWX/resources/isoprop_folder.xpm"
struct WiiPartition
{
DiscIO::IVolume *Partition;
DiscIO::IFileSystem *FileSystem;
std::vector<const DiscIO::SFileInfo *> Files;
};
static std::vector<WiiPartition> WiiDisc;
static DiscIO::IVolume *OpenISO = nullptr;
static DiscIO::IFileSystem *pFileSystem = nullptr;
std::vector<PatchEngine::Patch> onFrame;
std::vector<ActionReplay::ARCode> arCodes;
PHackData PHack_Data;
BEGIN_EVENT_TABLE(CISOProperties, wxDialog) BEGIN_EVENT_TABLE(CISOProperties, wxDialog)
EVT_CLOSE(CISOProperties::OnClose) EVT_CLOSE(CISOProperties::OnClose)
EVT_BUTTON(wxID_OK, CISOProperties::OnCloseClick) EVT_BUTTON(wxID_OK, CISOProperties::OnCloseClick)
@ -675,8 +661,9 @@ void CISOProperties::OnClose(wxCloseEvent& WXUNUSED (event))
{ {
if (!SaveGameConfig()) if (!SaveGameConfig())
WxUtils::ShowErrorDialog(wxString::Format(_("Could not save %s."), GameIniFileLocal.c_str())); WxUtils::ShowErrorDialog(wxString::Format(_("Could not save %s."), GameIniFileLocal.c_str()));
if (bRefreshList)
EndModal(bRefreshList ? wxID_OK : wxID_CANCEL); ((CGameListCtrl*)GetParent())->Update();
Destroy();
} }
void CISOProperties::OnCloseClick(wxCommandEvent& WXUNUSED (event)) void CISOProperties::OnCloseClick(wxCommandEvent& WXUNUSED (event))
@ -1059,20 +1046,20 @@ void CISOProperties::LoadGameConfig()
int iTemp; int iTemp;
default_video->Get("ProjectionHack", &iTemp); default_video->Get("ProjectionHack", &iTemp);
default_video->Get("PH_SZNear", &PHack_Data.PHackSZNear); default_video->Get("PH_SZNear", &m_PHack_Data.PHackSZNear);
if (GameIniLocal.GetIfExists("Video", "PH_SZNear", &iTemp)) if (GameIniLocal.GetIfExists("Video", "PH_SZNear", &iTemp))
PHack_Data.PHackSZNear = !!iTemp; m_PHack_Data.PHackSZNear = !!iTemp;
default_video->Get("PH_SZFar", &PHack_Data.PHackSZFar); default_video->Get("PH_SZFar", &m_PHack_Data.PHackSZFar);
if (GameIniLocal.GetIfExists("Video", "PH_SZFar", &iTemp)) if (GameIniLocal.GetIfExists("Video", "PH_SZFar", &iTemp))
PHack_Data.PHackSZFar = !!iTemp; m_PHack_Data.PHackSZFar = !!iTemp;
std::string sTemp; std::string sTemp;
default_video->Get("PH_ZNear", &PHack_Data.PHZNear); default_video->Get("PH_ZNear", &m_PHack_Data.PHZNear);
if (GameIniLocal.GetIfExists("Video", "PH_ZNear", &sTemp)) if (GameIniLocal.GetIfExists("Video", "PH_ZNear", &sTemp))
PHack_Data.PHZNear = sTemp; m_PHack_Data.PHZNear = sTemp;
default_video->Get("PH_ZFar", &PHack_Data.PHZFar); default_video->Get("PH_ZFar", &m_PHack_Data.PHZFar);
if (GameIniLocal.GetIfExists("Video", "PH_ZFar", &sTemp)) if (GameIniLocal.GetIfExists("Video", "PH_ZFar", &sTemp))
PHack_Data.PHZFar = sTemp; m_PHack_Data.PHZFar = sTemp;
IniFile::Section* default_emustate = GameIniDefault.GetOrCreateSection("EmuState"); IniFile::Section* default_emustate = GameIniDefault.GetOrCreateSection("EmuState");
default_emustate->Get("EmulationStateId", &iTemp, 0/*Not Set*/); default_emustate->Get("EmulationStateId", &iTemp, 0/*Not Set*/);
@ -1163,10 +1150,10 @@ bool CISOProperties::SaveGameConfig()
GameIniLocal.DeleteKey((section), (key)); \ GameIniLocal.DeleteKey((section), (key)); \
} while (0) } while (0)
SAVE_IF_NOT_DEFAULT("Video", "PH_SZNear", (PHack_Data.PHackSZNear ? 1 : 0), 0); SAVE_IF_NOT_DEFAULT("Video", "PH_SZNear", (m_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_SZFar", (m_PHack_Data.PHackSZFar ? 1 : 0), 0);
SAVE_IF_NOT_DEFAULT("Video", "PH_ZNear", PHack_Data.PHZNear, ""); SAVE_IF_NOT_DEFAULT("Video", "PH_ZNear", m_PHack_Data.PHZNear, "");
SAVE_IF_NOT_DEFAULT("Video", "PH_ZFar", PHack_Data.PHZFar, ""); SAVE_IF_NOT_DEFAULT("Video", "PH_ZFar", m_PHack_Data.PHZFar, "");
SAVE_IF_NOT_DEFAULT("EmuState", "EmulationStateId", EmuState->GetSelection(), 0); SAVE_IF_NOT_DEFAULT("EmuState", "EmulationStateId", EmuState->GetSelection(), 0);
std::string emu_issues = EmuIssues->GetValue().ToStdString(); std::string emu_issues = EmuIssues->GetValue().ToStdString();
@ -1386,13 +1373,13 @@ void CISOProperties::PatchButtonClicked(wxCommandEvent& event)
{ {
case ID_EDITPATCH: case ID_EDITPATCH:
{ {
CPatchAddEdit dlg(selection, this); CPatchAddEdit dlg(selection, onFrame, this);
dlg.ShowModal(); dlg.ShowModal();
} }
break; break;
case ID_ADDPATCH: case ID_ADDPATCH:
{ {
CPatchAddEdit dlg(-1, this, 1, _("Add Patch")); CPatchAddEdit dlg(-1, onFrame, this, 1, _("Add Patch"));
if (dlg.ShowModal() == wxID_OK) if (dlg.ShowModal() == wxID_OK)
{ {
Patches->Append(StrToWxStr(onFrame.back().name)); Patches->Append(StrToWxStr(onFrame.back().name));
@ -1466,13 +1453,13 @@ void CISOProperties::ActionReplayButtonClicked(wxCommandEvent& event)
{ {
case ID_EDITCHEAT: case ID_EDITCHEAT:
{ {
CARCodeAddEdit dlg(selection, this); CARCodeAddEdit dlg(selection, arCodes, this);
dlg.ShowModal(); dlg.ShowModal();
} }
break; break;
case ID_ADDCHEAT: case ID_ADDCHEAT:
{ {
CARCodeAddEdit dlg(-1, this, 1, _("Add ActionReplay Code")); CARCodeAddEdit dlg(-1, arCodes, this, 1, _("Add ActionReplay Code"));
if (dlg.ShowModal() == wxID_OK) if (dlg.ShowModal() == wxID_OK)
{ {
Cheats->Append(StrToWxStr(arCodes.back().name)); Cheats->Append(StrToWxStr(arCodes.back().name));

View file

@ -20,6 +20,11 @@
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Core/ActionReplay.h" #include "Core/ActionReplay.h"
#include "DiscIO/Filesystem.h"
#include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h"
#include "DolphinWX/ARCodeAddEdit.h"
#include "DolphinWX/PatchAddEdit.h"
class GameListItem; class GameListItem;
class wxButton; class wxButton;
@ -37,6 +42,13 @@ namespace Gecko { class CodeConfigPanel; }
extern std::vector<ActionReplay::ARCode> arCodes; extern std::vector<ActionReplay::ARCode> arCodes;
struct WiiPartition
{
DiscIO::IVolume *Partition;
DiscIO::IFileSystem *FileSystem;
std::vector<const DiscIO::SFileInfo *> Files;
};
struct PHackData struct PHackData
{ {
bool PHackSZNear; bool PHackSZNear;
@ -68,6 +80,15 @@ public:
private: private:
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
std::vector<WiiPartition> WiiDisc;
DiscIO::IVolume *OpenISO;
DiscIO::IFileSystem *pFileSystem;
std::vector<PatchEngine::Patch> onFrame;
std::vector<ActionReplay::ARCode> arCodes;
PHackData m_PHack_Data;
// Core // Core
wxCheckBox *CPUThread, *SkipIdle, *MMU, *DCBZOFF, *FPRF; wxCheckBox *CPUThread, *SkipIdle, *MMU, *DCBZOFF, *FPRF;
wxCheckBox *SyncGPU, *FastDiscSpeed, *DSPHLE; wxCheckBox *SyncGPU, *FastDiscSpeed, *DSPHLE;

View file

@ -28,11 +28,12 @@
#include "DolphinWX/PatchAddEdit.h" #include "DolphinWX/PatchAddEdit.h"
#include "DolphinWX/WxUtils.h" #include "DolphinWX/WxUtils.h"
CPatchAddEdit::CPatchAddEdit(int _selection, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) CPatchAddEdit::CPatchAddEdit(int _selection, const std::vector<PatchEngine::Patch>& _onFrame, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style) : wxDialog(parent, id, title, position, size, style)
{ {
selection = _selection; selection = _selection;
CreateGUIControls(selection); CreateGUIControls(selection);
onFrame = _onFrame;
Bind(wxEVT_BUTTON, &CPatchAddEdit::SavePatchData, this, wxID_OK); Bind(wxEVT_BUTTON, &CPatchAddEdit::SavePatchData, this, wxID_OK);
} }

View file

@ -25,7 +25,8 @@ class wxWindow;
class CPatchAddEdit : public wxDialog class CPatchAddEdit : public wxDialog
{ {
public: public:
CPatchAddEdit(int _selection, wxWindow* parent, CPatchAddEdit(int _selection, const std::vector<PatchEngine::Patch>& _onFrame,
wxWindow* parent,
wxWindowID id = wxID_ANY, wxWindowID id = wxID_ANY,
const wxString& title = _("Edit Patch"), const wxString& title = _("Edit Patch"),
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
@ -42,6 +43,7 @@ private:
wxButton* EntryAdd; wxButton* EntryAdd;
wxButton* EntryRemove; wxButton* EntryRemove;
wxStaticBoxSizer* sbEntry; wxStaticBoxSizer* sbEntry;
std::vector<PatchEngine::Patch> onFrame;
void CreateGUIControls(int selection); void CreateGUIControls(int selection);
void ChangeEntry(wxSpinEvent& event); void ChangeEntry(wxSpinEvent& event);