diff --git a/Source/Core/Core/ActionReplay.cpp b/Source/Core/Core/ActionReplay.cpp index e031d39174..b6bd722069 100644 --- a/Source/Core/Core/ActionReplay.cpp +++ b/Source/Core/Core/ActionReplay.cpp @@ -933,9 +933,4 @@ 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 1109eb0fa0..d2bf3621bf 100644 --- a/Source/Core/Core/ActionReplay.h +++ b/Source/Core/Core/ActionReplay.h @@ -40,5 +40,4 @@ void UpdateActiveList(); void EnableSelfLogging(bool enable); const std::vector &GetSelfLog(); bool IsSelfLogging(); -std::vector* GetARCodes(); } // namespace diff --git a/Source/Core/DolphinWX/Cheats/CheatSearchTab.cpp b/Source/Core/DolphinWX/Cheats/CheatSearchTab.cpp index 2b97142536..997b048a4d 100644 --- a/Source/Core/DolphinWX/Cheats/CheatSearchTab.cpp +++ b/Source/Core/DolphinWX/Cheats/CheatSearchTab.cpp @@ -169,7 +169,7 @@ void CheatSearchTab::OnCreateARCodeClicked(wxCommandEvent&) const u32 address = m_search_results[idx].address | ((m_search_type_size & ~1) << 24); - CreateCodeDialog arcode_dlg(this, address, ActionReplay::GetARCodes()); + CreateCodeDialog arcode_dlg(this, address); 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 60c600702b..364dfbad41 100644 --- a/Source/Core/DolphinWX/Cheats/CreateCodeDialog.cpp +++ b/Source/Core/DolphinWX/Cheats/CreateCodeDialog.cpp @@ -17,10 +17,9 @@ // Fired when an ActionReplay code is created. wxDEFINE_EVENT(UPDATE_CHEAT_LIST_EVENT, wxCommandEvent); -CreateCodeDialog::CreateCodeDialog(wxWindow* const parent, const u32 address, std::vector* _arCodes) +CreateCodeDialog::CreateCodeDialog(wxWindow* const parent, const u32 address) : 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)); @@ -89,7 +88,7 @@ void CreateCodeDialog::PressOK(wxCommandEvent& ev) { CISOProperties isoprops(GameListItem(SConfig::GetInstance().m_LastFilename, std::unordered_map()), this); // add the code to the isoproperties arcode list - arCodes->push_back(new_cheat); + isoprops.AddARCode(new_cheat); // save the gameini isoprops.SaveGameConfig(); isoprops.ActionReplayList_Load(); // loads the new arcodes diff --git a/Source/Core/DolphinWX/Cheats/CreateCodeDialog.h b/Source/Core/DolphinWX/Cheats/CreateCodeDialog.h index 421157e5ae..7c5b752320 100644 --- a/Source/Core/DolphinWX/Cheats/CreateCodeDialog.h +++ b/Source/Core/DolphinWX/Cheats/CreateCodeDialog.h @@ -17,11 +17,10 @@ wxDECLARE_EVENT(UPDATE_CHEAT_LIST_EVENT, wxCommandEvent); class CreateCodeDialog final : public wxDialog { public: - CreateCodeDialog(wxWindow* const parent, const u32 address, std::vector* _arCodes); + CreateCodeDialog(wxWindow* const parent, const u32 address); private: const u32 m_code_address; - std::vector* arCodes; wxTextCtrl* m_textctrl_name; wxTextCtrl* m_textctrl_code; diff --git a/Source/Core/DolphinWX/ISOProperties.cpp b/Source/Core/DolphinWX/ISOProperties.cpp index 0344e98130..d99dfb5a60 100644 --- a/Source/Core/DolphinWX/ISOProperties.cpp +++ b/Source/Core/DolphinWX/ISOProperties.cpp @@ -1486,6 +1486,11 @@ void CISOProperties::ActionReplayButtonClicked(wxCommandEvent& event) RemoveCheat->Disable(); } +void CISOProperties::AddARCode(const ActionReplay::ARCode& code) +{ + arCodes.emplace_back(code); +} + void CISOProperties::OnChangeBannerLang(wxCommandEvent& event) { ChangeBannerDetails(OpenGameListItem.GetLanguages()[event.GetSelection()]); diff --git a/Source/Core/DolphinWX/ISOProperties.h b/Source/Core/DolphinWX/ISOProperties.h index fd1735830a..2b37cb7657 100644 --- a/Source/Core/DolphinWX/ISOProperties.h +++ b/Source/Core/DolphinWX/ISOProperties.h @@ -70,9 +70,13 @@ public: bool bRefreshList; + // These are only public because of the ugly hack in CreateCodeDialog.cpp void ActionReplayList_Load(); bool SaveGameConfig(); + // This only exists because of the ugly hack in CreateCodeDialog.cpp + void AddARCode(const ActionReplay::ARCode& code); + private: DECLARE_EVENT_TABLE();