ActionReplay: UI Consistency and Cleanup

Cleanup code style.

Move ActionReplay code->INI saving into ActionReplay namespace.

Threadsafety Cleanup: ActionReplay is accessed from the Host, Emu
and CPU Threads so the internal storage needs to be protected by a
lock to prevent vectors/strings being deleted/moved while in use by
the CPU Thread.

UI Consistency: Make ARCodes behave like Gecko Codes - only apply
changes when Apply is pressed. Save changes to INI from CheatsWindow.

ISOProperties/CheatsWindow now synchronize with each other.
This commit is contained in:
EmptyChaos
2016-04-22 10:42:16 +00:00
parent 25b072ff2b
commit 6ab1b27477
11 changed files with 328 additions and 374 deletions

View File

@ -29,6 +29,8 @@ namespace Gecko
class CodeConfigPanel;
}
wxDECLARE_EVENT(DOLPHIN_EVT_ADD_NEW_ACTION_REPLAY_CODE, wxCommandEvent);
class wxCheatsWindow final : public wxDialog
{
public:
@ -37,11 +39,7 @@ public:
void UpdateGUI();
private:
struct ARCodeIndex
{
u32 uiIndex;
size_t index;
};
struct CodeData;
// --- GUI Controls ---
wxButton* m_button_apply;
@ -63,18 +61,14 @@ private:
wxStaticBox* m_groupbox_info;
wxArrayString m_cheat_string_list;
std::vector<ARCodeIndex> m_index_list;
Gecko::CodeConfigPanel* m_geckocode_panel;
IniFile m_gameini_default;
IniFile m_gameini_local;
std::string m_gameini_local_path;
std::string m_game_id;
u32 m_game_revision;
// ActionReplay::UnregisterCodeChangeCallback handle
void* m_ar_callback_token = nullptr;
bool m_ar_ignore_callback = false;
bool m_ignore_ini_callback = false;
void Init_ChildControls();
@ -82,6 +76,8 @@ private:
void Load_GeckoCodes();
// --- Wx Events Handlers ---
// Cheat Search
void OnNewARCodeCreated(wxCommandEvent& ev);
// Close Button
void OnEvent_ButtonClose_Press(wxCommandEvent& event);
@ -89,15 +85,14 @@ private:
// Cheats List
void OnEvent_CheatsList_ItemSelected(wxCommandEvent& event);
void OnEvent_CheatsList_ItemToggled(wxCommandEvent& event);
void OnEvent_CheatsList_Update(wxThreadEvent& event);
void OnActionReplayModified();
void OnEvent_CheatsList_Update(wxCommandEvent& event);
// Apply Changes Button
void OnEvent_ApplyChanges_Press(wxCommandEvent& event);
// Update Log Button
void OnEvent_ButtonUpdateLog_Press(wxCommandEvent& event);
void OnClearActionReplayLog(wxCommandEvent& event);
// Enable Logging Checkbox
void OnEvent_CheckBoxEnableLogging_StateChange(wxCommandEvent& event);