diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2016-06-05 09:29:51 +0200 |
|---|---|---|
| committer | Pierre Bourdon <delroth@gmail.com> | 2016-06-05 09:29:51 +0200 |
| commit | c514a48f4d279919e5bc2e34e205ef604f611af0 (patch) | |
| tree | e6b890f20a29562eeb43f256f50eb111bcacf06e /Source/Core/DolphinWX/Cheats/CreateCodeDialog.cpp | |
| parent | 96acd3e7ff21db52ffc6be6a0e8c9d99fe261c4d (diff) | |
| parent | 309d0e59f4697fdfc2763c7d3ee0075c514abe9b (diff) | |
Merge pull request #3776 from EmptyChaos/ar-isoprop-corrupt
ActionReplay: Fix ISOProperties corrupting active code set
Diffstat (limited to 'Source/Core/DolphinWX/Cheats/CreateCodeDialog.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/Cheats/CreateCodeDialog.cpp | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/Source/Core/DolphinWX/Cheats/CreateCodeDialog.cpp b/Source/Core/DolphinWX/Cheats/CreateCodeDialog.cpp index 364dfbad41..34b6baac82 100644 --- a/Source/Core/DolphinWX/Cheats/CreateCodeDialog.cpp +++ b/Source/Core/DolphinWX/Cheats/CreateCodeDialog.cpp @@ -12,11 +12,9 @@ #include "Core/ConfigManager.h" #include "DolphinWX/ISOProperties.h" #include "DolphinWX/WxUtils.h" +#include "DolphinWX/Cheats/CheatsWindow.h" #include "DolphinWX/Cheats/CreateCodeDialog.h" -// Fired when an ActionReplay code is created. -wxDEFINE_EVENT(UPDATE_CHEAT_LIST_EVENT, wxCommandEvent); - CreateCodeDialog::CreateCodeDialog(wxWindow* const parent, const u32 address) : wxDialog(parent, wxID_ANY, _("Create AR Code")) , m_code_address(address) @@ -73,30 +71,16 @@ void CreateCodeDialog::PressOK(wxCommandEvent& ev) return; } - //wxString full_code = textctrl_code->GetValue(); - //full_code += ' '; - //full_code += wxString::Format("0x%08x", code_value); - // create the new code ActionReplay::ARCode new_cheat; new_cheat.active = false; + new_cheat.user_defined = true; new_cheat.name = WxStrToStr(code_name); - const ActionReplay::AREntry new_entry(m_code_address, code_value); - new_cheat.ops.push_back(new_entry); - - // pretty hacky - add the code to the gameini - { - CISOProperties isoprops(GameListItem(SConfig::GetInstance().m_LastFilename, std::unordered_map<std::string, std::string>()), this); - // add the code to the isoproperties arcode list - isoprops.AddARCode(new_cheat); - // save the gameini - isoprops.SaveGameConfig(); - isoprops.ActionReplayList_Load(); // loads the new arcodes - //ActionReplay::UpdateActiveList(); - } + new_cheat.ops.emplace_back(ActionReplay::AREntry(m_code_address, code_value)); - // Propagate back to the parent frame to update the cheat list. - GetEventHandler()->AddPendingEvent(wxCommandEvent(UPDATE_CHEAT_LIST_EVENT)); + wxCommandEvent add_event(DOLPHIN_EVT_ADD_NEW_ACTION_REPLAY_CODE, GetId()); + add_event.SetClientData(&new_cheat); + GetParent()->GetEventHandler()->ProcessEvent(add_event); Close(); } |
