diff --git a/Source/Core/Core/ActionReplay.cpp b/Source/Core/Core/ActionReplay.cpp index e77af7f5c4..769a89269f 100644 --- a/Source/Core/Core/ActionReplay.cpp +++ b/Source/Core/Core/ActionReplay.cpp @@ -934,4 +934,9 @@ bool RunCode(const ARCode &arcode) return true; } +std::vector GetARCodes() +{ + return arCodes; +} + } // namespace ActionReplay diff --git a/Source/Core/Core/ActionReplay.h b/Source/Core/Core/ActionReplay.h index 8479785749..1ab4f8cb2c 100644 --- a/Source/Core/Core/ActionReplay.h +++ b/Source/Core/Core/ActionReplay.h @@ -36,4 +36,5 @@ void UpdateActiveList(); void EnableSelfLogging(bool enable); const std::vector &GetSelfLog(); bool IsSelfLogging(); +std::vector GetARCodes(); } // namespace diff --git a/Source/Core/Core/PatchEngine.h b/Source/Core/Core/PatchEngine.h index 73039eb8b1..c67d23c725 100644 --- a/Source/Core/Core/PatchEngine.h +++ b/Source/Core/Core/PatchEngine.h @@ -8,6 +8,7 @@ #include #include "Common/CommonTypes.h" +#include "Core/PatchEngine.h" class IniFile; diff --git a/Source/Core/DolphinWX/ARCodeAddEdit.cpp b/Source/Core/DolphinWX/ARCodeAddEdit.cpp index 95866a32e4..07240e63f7 100644 --- a/Source/Core/DolphinWX/ARCodeAddEdit.cpp +++ b/Source/Core/DolphinWX/ARCodeAddEdit.cpp @@ -26,12 +26,12 @@ #include "Core/ActionReplay.h" #include "Core/ARDecrypt.h" #include "DolphinWX/ARCodeAddEdit.h" -#include "DolphinWX/ISOProperties.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& _arCodes, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) : wxDialog(parent, id, title, position, size, style) , selection(_selection) + , arCodes(_arCodes) { Bind(wxEVT_BUTTON, &CARCodeAddEdit::SaveCheatData, this, wxID_OK); diff --git a/Source/Core/DolphinWX/ARCodeAddEdit.h b/Source/Core/DolphinWX/ARCodeAddEdit.h index c54afad50a..cbf99a28fa 100644 --- a/Source/Core/DolphinWX/ARCodeAddEdit.h +++ b/Source/Core/DolphinWX/ARCodeAddEdit.h @@ -21,7 +21,8 @@ namespace ActionReplay { struct ARCode; } class CARCodeAddEdit : public wxDialog { public: - CARCodeAddEdit(int _selection, wxWindow* parent, + CARCodeAddEdit(int _selection, const std::vector& _arCodes, + wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Edit ActionReplay Code"), const wxPoint& pos = wxDefaultPosition, @@ -33,6 +34,8 @@ private: wxSpinButton* EntrySelection; wxTextCtrl* EditCheatCode; + std::vector arCodes; + void SaveCheatData(wxCommandEvent& event); void ChangeEntry(wxSpinEvent& event); void UpdateTextCtrl(ActionReplay::ARCode arCode); diff --git a/Source/Core/DolphinWX/Cheats/CheatSearchTab.cpp b/Source/Core/DolphinWX/Cheats/CheatSearchTab.cpp index 27a17d13a5..7ad145b958 100644 --- a/Source/Core/DolphinWX/Cheats/CheatSearchTab.cpp +++ b/Source/Core/DolphinWX/Cheats/CheatSearchTab.cpp @@ -19,6 +19,7 @@ #include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/StringUtil.h" +#include "Core/ActionReplay.h" #include "Core/HW/Memmap.h" #include "DolphinWX/WxUtils.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); - CreateCodeDialog arcode_dlg(this, address); + CreateCodeDialog arcode_dlg(this, address, ActionReplay::GetARCodes()); arcode_dlg.SetExtraStyle(arcode_dlg.GetExtraStyle() & ~wxWS_EX_BLOCK_EVENTS); arcode_dlg.ShowModal(); } diff --git a/Source/Core/DolphinWX/Cheats/CreateCodeDialog.cpp b/Source/Core/DolphinWX/Cheats/CreateCodeDialog.cpp index d5188e34f6..c9766cd2ce 100644 --- a/Source/Core/DolphinWX/Cheats/CreateCodeDialog.cpp +++ b/Source/Core/DolphinWX/Cheats/CreateCodeDialog.cpp @@ -20,9 +20,10 @@ // Fired when an ActionReplay code is created. 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& _arCodes) : wxDialog(parent, wxID_ANY, _("Create AR Code")) , m_code_address(address) + , arCodes(_arCodes) { wxStaticText* const label_name = new wxStaticText(this, wxID_ANY, _("Name: ")); m_textctrl_name = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(256, -1)); diff --git a/Source/Core/DolphinWX/Cheats/CreateCodeDialog.h b/Source/Core/DolphinWX/Cheats/CreateCodeDialog.h index 97aed1728d..d1860ffed6 100644 --- a/Source/Core/DolphinWX/Cheats/CreateCodeDialog.h +++ b/Source/Core/DolphinWX/Cheats/CreateCodeDialog.h @@ -8,6 +8,7 @@ #include #include "Common/CommonTypes.h" +#include "Core/ActionReplay.h" class wxCheckBox; class wxTextCtrl; @@ -18,10 +19,11 @@ wxDECLARE_EVENT(UPDATE_CHEAT_LIST_EVENT, wxCommandEvent); class CreateCodeDialog final : public wxDialog { public: - CreateCodeDialog(wxWindow* const parent, const u32 address); + CreateCodeDialog(wxWindow* const parent, const u32 address, const std::vector& _arCodes); private: const u32 m_code_address; + std::vector arCodes; wxTextCtrl* m_textctrl_name; wxTextCtrl* m_textctrl_code; diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index 36c7ff6cfc..b7185f014e 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -1099,9 +1099,8 @@ void CGameListCtrl::OnProperties(wxCommandEvent& WXUNUSED (event)) if (!iso) return; - CISOProperties ISOProperties(iso->GetFileName(), this); - if (ISOProperties.ShowModal() == wxID_OK) - Update(); + CISOProperties* ISOProperties = new CISOProperties(iso->GetFileName(), this); + ISOProperties->Show(); } void CGameListCtrl::OnWiki(wxCommandEvent& WXUNUSED (event)) diff --git a/Source/Core/DolphinWX/ISOProperties.cpp b/Source/Core/DolphinWX/ISOProperties.cpp index 819300c29c..c580606c42 100644 --- a/Source/Core/DolphinWX/ISOProperties.cpp +++ b/Source/Core/DolphinWX/ISOProperties.cpp @@ -71,6 +71,8 @@ #include "DiscIO/Volume.h" #include "DiscIO/VolumeCreator.h" #include "DolphinWX/ARCodeAddEdit.h" +#include "DolphinWX/GameListCtrl.h" +//#include "DolphinWX/Frame.h" #include "DolphinWX/ISOFile.h" #include "DolphinWX/ISOProperties.h" #include "DolphinWX/PatchAddEdit.h" @@ -80,22 +82,6 @@ #include "DolphinWX/resources/isoprop_file.xpm" #include "DolphinWX/resources/isoprop_folder.xpm" -struct WiiPartition -{ - DiscIO::IVolume *Partition; - DiscIO::IFileSystem *FileSystem; - std::vector Files; -}; -static std::vector WiiDisc; - -static DiscIO::IVolume *OpenISO = nullptr; -static DiscIO::IFileSystem *pFileSystem = nullptr; - -std::vector onFrame; -std::vector arCodes; -PHackData PHack_Data; - - BEGIN_EVENT_TABLE(CISOProperties, wxDialog) EVT_CLOSE(CISOProperties::OnClose) EVT_BUTTON(wxID_OK, CISOProperties::OnCloseClick) @@ -675,8 +661,9 @@ void CISOProperties::OnClose(wxCloseEvent& WXUNUSED (event)) { if (!SaveGameConfig()) WxUtils::ShowErrorDialog(wxString::Format(_("Could not save %s."), GameIniFileLocal.c_str())); - - EndModal(bRefreshList ? wxID_OK : wxID_CANCEL); + if (bRefreshList) + ((CGameListCtrl*)GetParent())->Update(); + Destroy(); } void CISOProperties::OnCloseClick(wxCommandEvent& WXUNUSED (event)) @@ -1059,20 +1046,20 @@ void CISOProperties::LoadGameConfig() int 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)) - PHack_Data.PHackSZNear = !!iTemp; - default_video->Get("PH_SZFar", &PHack_Data.PHackSZFar); + m_PHack_Data.PHackSZNear = !!iTemp; + default_video->Get("PH_SZFar", &m_PHack_Data.PHackSZFar); if (GameIniLocal.GetIfExists("Video", "PH_SZFar", &iTemp)) - PHack_Data.PHackSZFar = !!iTemp; + m_PHack_Data.PHackSZFar = !!iTemp; 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)) - PHack_Data.PHZNear = sTemp; - default_video->Get("PH_ZFar", &PHack_Data.PHZFar); + m_PHack_Data.PHZNear = sTemp; + default_video->Get("PH_ZFar", &m_PHack_Data.PHZFar); if (GameIniLocal.GetIfExists("Video", "PH_ZFar", &sTemp)) - PHack_Data.PHZFar = sTemp; + m_PHack_Data.PHZFar = sTemp; IniFile::Section* default_emustate = GameIniDefault.GetOrCreateSection("EmuState"); default_emustate->Get("EmulationStateId", &iTemp, 0/*Not Set*/); @@ -1163,10 +1150,10 @@ bool CISOProperties::SaveGameConfig() GameIniLocal.DeleteKey((section), (key)); \ } while (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, ""); - SAVE_IF_NOT_DEFAULT("Video", "PH_ZFar", PHack_Data.PHZFar, ""); + SAVE_IF_NOT_DEFAULT("Video", "PH_SZNear", (m_PHack_Data.PHackSZNear ? 1 : 0), 0); + SAVE_IF_NOT_DEFAULT("Video", "PH_SZFar", (m_PHack_Data.PHackSZFar ? 1 : 0), 0); + SAVE_IF_NOT_DEFAULT("Video", "PH_ZNear", m_PHack_Data.PHZNear, ""); + SAVE_IF_NOT_DEFAULT("Video", "PH_ZFar", m_PHack_Data.PHZFar, ""); SAVE_IF_NOT_DEFAULT("EmuState", "EmulationStateId", EmuState->GetSelection(), 0); std::string emu_issues = EmuIssues->GetValue().ToStdString(); @@ -1386,13 +1373,13 @@ void CISOProperties::PatchButtonClicked(wxCommandEvent& event) { case ID_EDITPATCH: { - CPatchAddEdit dlg(selection, this); + CPatchAddEdit dlg(selection, onFrame, this); dlg.ShowModal(); } break; case ID_ADDPATCH: { - CPatchAddEdit dlg(-1, this, 1, _("Add Patch")); + CPatchAddEdit dlg(-1, onFrame, this, 1, _("Add Patch")); if (dlg.ShowModal() == wxID_OK) { Patches->Append(StrToWxStr(onFrame.back().name)); @@ -1466,13 +1453,13 @@ void CISOProperties::ActionReplayButtonClicked(wxCommandEvent& event) { case ID_EDITCHEAT: { - CARCodeAddEdit dlg(selection, this); + CARCodeAddEdit dlg(selection, arCodes, this); dlg.ShowModal(); } break; 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) { Cheats->Append(StrToWxStr(arCodes.back().name)); diff --git a/Source/Core/DolphinWX/ISOProperties.h b/Source/Core/DolphinWX/ISOProperties.h index 9cb40bb128..8b396d5b2c 100644 --- a/Source/Core/DolphinWX/ISOProperties.h +++ b/Source/Core/DolphinWX/ISOProperties.h @@ -20,6 +20,11 @@ #include "Common/IniFile.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 wxButton; @@ -37,6 +42,13 @@ namespace Gecko { class CodeConfigPanel; } extern std::vector arCodes; +struct WiiPartition +{ + DiscIO::IVolume *Partition; + DiscIO::IFileSystem *FileSystem; + std::vector Files; +}; + struct PHackData { bool PHackSZNear; @@ -68,6 +80,15 @@ public: private: DECLARE_EVENT_TABLE(); + std::vector WiiDisc; + + DiscIO::IVolume *OpenISO; + DiscIO::IFileSystem *pFileSystem; + + std::vector onFrame; + std::vector arCodes; + PHackData m_PHack_Data; + // Core wxCheckBox *CPUThread, *SkipIdle, *MMU, *DCBZOFF, *FPRF; wxCheckBox *SyncGPU, *FastDiscSpeed, *DSPHLE; diff --git a/Source/Core/DolphinWX/PatchAddEdit.cpp b/Source/Core/DolphinWX/PatchAddEdit.cpp index 9b4b201a47..5d388977bb 100644 --- a/Source/Core/DolphinWX/PatchAddEdit.cpp +++ b/Source/Core/DolphinWX/PatchAddEdit.cpp @@ -28,11 +28,12 @@ #include "DolphinWX/PatchAddEdit.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& _onFrame, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) : wxDialog(parent, id, title, position, size, style) { selection = _selection; CreateGUIControls(selection); + onFrame = _onFrame; Bind(wxEVT_BUTTON, &CPatchAddEdit::SavePatchData, this, wxID_OK); } diff --git a/Source/Core/DolphinWX/PatchAddEdit.h b/Source/Core/DolphinWX/PatchAddEdit.h index c7e16f9b76..1fbd3e77b1 100644 --- a/Source/Core/DolphinWX/PatchAddEdit.h +++ b/Source/Core/DolphinWX/PatchAddEdit.h @@ -25,7 +25,8 @@ class wxWindow; class CPatchAddEdit : public wxDialog { public: - CPatchAddEdit(int _selection, wxWindow* parent, + CPatchAddEdit(int _selection, const std::vector& _onFrame, + wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Edit Patch"), const wxPoint& pos = wxDefaultPosition, @@ -42,6 +43,7 @@ private: wxButton* EntryAdd; wxButton* EntryRemove; wxStaticBoxSizer* sbEntry; + std::vector onFrame; void CreateGUIControls(int selection); void ChangeEntry(wxSpinEvent& event);