diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 1f3ea14ae4..5b672305ed 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -91,6 +91,19 @@ static const struct { "SaveStateSlot9", 0, 0 /* wxMOD_NONE */ }, { "SaveStateSlot10", 0, 0 /* wxMOD_NONE */ }, + { "SelectStateSlot1", 0 , 0 }, + { "SelectStateSlot2", 0 , 0 }, + { "SelectStateSlot3", 0, 0 }, + { "SelectStateSlot4", 0 , 0 }, + { "SelectStateSlot5", 0 , 0 }, + { "SelectStateSlot6", 0 , 0 }, + { "SelectStateSlot7", 0 , 0 }, + { "SelectStateSlot8", 0 , 0 }, + { "SelectStateSlot9", 0 , 0 }, + { "SelectStateSlot10", 0 , 0 }, + { "SaveSelectedSlot", 0 , 0 }, + { "LoadSelectedSlot", 0 , 0 }, + { "LoadLastState1", 0, 0 /* wxMOD_NONE */ }, { "LoadLastState2", 0, 0 /* wxMOD_NONE */ }, { "LoadLastState3", 0, 0 /* wxMOD_NONE */ }, diff --git a/Source/Core/Core/CoreParameter.h b/Source/Core/Core/CoreParameter.h index 29a08e7b5a..b6008b3145 100644 --- a/Source/Core/Core/CoreParameter.h +++ b/Source/Core/Core/CoreParameter.h @@ -65,6 +65,20 @@ enum Hotkey HK_SAVE_STATE_SLOT_9, HK_SAVE_STATE_SLOT_10, + HK_SELECT_STATE_SLOT_1, + HK_SELECT_STATE_SLOT_2, + HK_SELECT_STATE_SLOT_3, + HK_SELECT_STATE_SLOT_4, + HK_SELECT_STATE_SLOT_5, + HK_SELECT_STATE_SLOT_6, + HK_SELECT_STATE_SLOT_7, + HK_SELECT_STATE_SLOT_8, + HK_SELECT_STATE_SLOT_9, + HK_SELECT_STATE_SLOT_10, + + HK_SAVE_STATE_SLOT_SELECTED, + HK_LOAD_STATE_SLOT_SELECTED, + HK_LOAD_LAST_STATE_1, HK_LOAD_LAST_STATE_2, HK_LOAD_LAST_STATE_3, diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 97711b9664..8b806ab34a 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -70,6 +70,7 @@ extern "C" { #include "DolphinWX/resources/Dolphin.c" // NOLINT: Dolphin icon }; +int g_saveSlot = 1; CRenderFrame::CRenderFrame(wxFrame* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) @@ -276,10 +277,13 @@ EVT_MENU(IDM_UNDOLOADSTATE, CFrame::OnUndoLoadState) EVT_MENU(IDM_UNDOSAVESTATE, CFrame::OnUndoSaveState) EVT_MENU(IDM_LOADSTATEFILE, CFrame::OnLoadStateFromFile) EVT_MENU(IDM_SAVESTATEFILE, CFrame::OnSaveStateToFile) +EVT_MENU(IDM_SAVESELECTEDSLOT, CFrame::OnSaveCurrentSlot) +EVT_MENU(IDM_LOADSELECTEDSLOT, CFrame::OnLoadCurrentSlot) EVT_MENU_RANGE(IDM_LOADSLOT1, IDM_LOADSLOT10, CFrame::OnLoadState) EVT_MENU_RANGE(IDM_LOADLAST1, IDM_LOADLAST8, CFrame::OnLoadLastState) EVT_MENU_RANGE(IDM_SAVESLOT1, IDM_SAVESLOT10, CFrame::OnSaveState) +EVT_MENU_RANGE(IDM_SELECTSLOT1, IDM_SELECTSLOT10, CFrame::OnSelectSlot) EVT_MENU_RANGE(IDM_FRAMESKIP0, IDM_FRAMESKIP9, CFrame::OnFrameSkip) EVT_MENU_RANGE(IDM_DRIVE1, IDM_DRIVE24, CFrame::OnBootDrive) EVT_MENU_RANGE(IDM_CONNECT_WIIMOTE1, IDM_CONNECT_BALANCEBOARD, CFrame::OnConnectWiimote) @@ -931,6 +935,19 @@ int GetCmdForHotkey(unsigned int key) case HK_UNDO_SAVE_STATE: return IDM_UNDOSAVESTATE; case HK_LOAD_STATE_FILE: return IDM_LOADSTATEFILE; case HK_SAVE_STATE_FILE: return IDM_SAVESTATEFILE; + + case HK_SELECT_STATE_SLOT_1: return IDM_SELECTSLOT1; + case HK_SELECT_STATE_SLOT_2: return IDM_SELECTSLOT2; + case HK_SELECT_STATE_SLOT_3: return IDM_SELECTSLOT3; + case HK_SELECT_STATE_SLOT_4: return IDM_SELECTSLOT4; + case HK_SELECT_STATE_SLOT_5: return IDM_SELECTSLOT5; + case HK_SELECT_STATE_SLOT_6: return IDM_SELECTSLOT6; + case HK_SELECT_STATE_SLOT_7: return IDM_SELECTSLOT7; + case HK_SELECT_STATE_SLOT_8: return IDM_SELECTSLOT8; + case HK_SELECT_STATE_SLOT_9: return IDM_SELECTSLOT9; + case HK_SELECT_STATE_SLOT_10: return IDM_SELECTSLOT10; + case HK_SAVE_STATE_SLOT_SELECTED: return IDM_SAVESELECTEDSLOT; + case HK_LOAD_STATE_SLOT_SELECTED: return IDM_LOADSELECTEDSLOT; } return -1; @@ -1052,8 +1069,27 @@ void CFrame::OnKeyDown(wxKeyEvent& event) if (--SConfig::GetInstance().m_Framelimit > 0x19) SConfig::GetInstance().m_Framelimit = 0x19; } + else if (IsHotkey(event, HK_SAVE_STATE_SLOT_SELECTED)) + { + State::Save(g_saveSlot); + } + else if (IsHotkey(event, HK_LOAD_STATE_SLOT_SELECTED)) + { + State::Load(g_saveSlot); + } + else { + for (int i = HK_SELECT_STATE_SLOT_1; i < HK_SELECT_STATE_SLOT_10; ++i) + { + if (IsHotkey (event, i)) + { + wxCommandEvent slot_event; + slot_event.SetId(i + IDM_SELECTSLOT1 - HK_SELECT_STATE_SLOT_1); + CFrame::OnSelectSlot(slot_event); + } + } + unsigned int i = NUM_HOTKEYS; if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain || TASInputHasFocus()) { diff --git a/Source/Core/DolphinWX/Frame.h b/Source/Core/DolphinWX/Frame.h index 3ddcaa510b..7e8988a1f4 100644 --- a/Source/Core/DolphinWX/Frame.h +++ b/Source/Core/DolphinWX/Frame.h @@ -331,6 +331,10 @@ private: void StartGame(const std::string& filename); void OnChangeColumnsVisible(wxCommandEvent& event); + void OnSelectSlot(wxCommandEvent& event); + void OnSaveCurrentSlot(wxCommandEvent& event); + void OnLoadCurrentSlot(wxCommandEvent& event); + // Event table DECLARE_EVENT_TABLE(); }; @@ -343,3 +347,4 @@ void OnStoppedCallback(); // For TASInputDlg void TASManipFunction(GCPadStatus* PadStatus, int controllerID); bool TASInputHasFocus(); +extern int g_saveSlot; diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 4045879e31..6b0fc4d92e 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -185,16 +185,19 @@ wxMenuBar* CFrame::CreateMenu() emulationMenu->AppendSeparator(); wxMenu *saveMenu = new wxMenu; wxMenu *loadMenu = new wxMenu; + wxMenu *slotSelectMenu = new wxMenu; emulationMenu->Append(IDM_LOADSTATE, _("&Load State"), loadMenu); emulationMenu->Append(IDM_SAVESTATE, _("Sa&ve State"), saveMenu); + emulationMenu->Append(IDM_SELECTSLOT, _("Select State slot"), slotSelectMenu); saveMenu->Append(IDM_SAVESTATEFILE, GetMenuLabel(HK_SAVE_STATE_FILE)); + saveMenu->Append(IDM_SAVESELECTEDSLOT, GetMenuLabel(HK_SAVE_STATE_SLOT_SELECTED)); saveMenu->Append(IDM_SAVEFIRSTSTATE, GetMenuLabel(HK_SAVE_FIRST_STATE)); loadMenu->Append(IDM_UNDOSAVESTATE, GetMenuLabel(HK_UNDO_SAVE_STATE)); saveMenu->AppendSeparator(); loadMenu->Append(IDM_LOADSTATEFILE, GetMenuLabel(HK_LOAD_STATE_FILE)); - + loadMenu->Append(IDM_LOADSELECTEDSLOT, GetMenuLabel(HK_LOAD_STATE_SLOT_SELECTED)); loadMenu->Append(IDM_UNDOLOADSTATE, GetMenuLabel(HK_UNDO_LOAD_STATE)); loadMenu->AppendSeparator(); @@ -202,6 +205,7 @@ wxMenuBar* CFrame::CreateMenu() { loadMenu->Append(IDM_LOADSLOT1 + i - 1, GetMenuLabel(HK_LOAD_STATE_SLOT_1 + i - 1)); saveMenu->Append(IDM_SAVESLOT1 + i - 1, GetMenuLabel(HK_SAVE_STATE_SLOT_1 + i - 1)); + slotSelectMenu->Append(IDM_SELECTSLOT1 + i - 1, GetMenuLabel(HK_SELECT_STATE_SLOT_1 + i -1)); } loadMenu->AppendSeparator(); @@ -477,6 +481,28 @@ wxString CFrame::GetMenuLabel(int Id) case HK_UNDO_LOAD_STATE: Label = _("Undo Load State"); break; case HK_UNDO_SAVE_STATE: Label = _("Undo Save State"); break; + case HK_SAVE_STATE_SLOT_SELECTED: + Label = _("Save state to selected slot"); + break; + + case HK_LOAD_STATE_SLOT_SELECTED: + Label = _("load state from selected slot"); + break; + + case HK_SELECT_STATE_SLOT_1: + case HK_SELECT_STATE_SLOT_2: + case HK_SELECT_STATE_SLOT_3: + case HK_SELECT_STATE_SLOT_4: + case HK_SELECT_STATE_SLOT_5: + case HK_SELECT_STATE_SLOT_6: + case HK_SELECT_STATE_SLOT_7: + case HK_SELECT_STATE_SLOT_8: + case HK_SELECT_STATE_SLOT_9: + case HK_SELECT_STATE_SLOT_10: + Label = wxString::Format(_("Select Slot %i"), Id - HK_SELECT_STATE_SLOT_1 + 1); + break; + + default: Label = wxString::Format(_("Undefined %i"), Id); } @@ -1602,6 +1628,27 @@ void CFrame::OnFrameSkip(wxCommandEvent& event) SConfig::GetInstance().m_FrameSkip = amount; } +void CFrame::OnSelectSlot(wxCommandEvent& event) +{ + g_saveSlot = event.GetId() - IDM_SELECTSLOT1 + 1; + Core::DisplayMessage(StringFromFormat("Selected slot %d", g_saveSlot), 1000); +} + +void CFrame::OnLoadCurrentSlot(wxCommandEvent& event) +{ + if (Core::IsRunningAndStarted()) + { + State::Load(g_saveSlot); + } +} + +void CFrame::OnSaveCurrentSlot(wxCommandEvent& event) +{ + if (Core::IsRunningAndStarted()) + { + State::Save(g_saveSlot); + } +} diff --git a/Source/Core/DolphinWX/Globals.h b/Source/Core/DolphinWX/Globals.h index 7966b95c15..408e3eba7f 100644 --- a/Source/Core/DolphinWX/Globals.h +++ b/Source/Core/DolphinWX/Globals.h @@ -24,6 +24,7 @@ enum { IDM_LOADSTATE = 200, // File menu IDM_SAVESTATE, + IDM_SELECTSLOT, IDM_SAVEFIRSTSTATE, IDM_UNDOLOADSTATE, IDM_UNDOSAVESTATE, @@ -57,6 +58,18 @@ enum IDM_LOADLAST6, IDM_LOADLAST7, IDM_LOADLAST8, + IDM_SELECTSLOT1, + IDM_SELECTSLOT2, + IDM_SELECTSLOT3, + IDM_SELECTSLOT4, + IDM_SELECTSLOT5, + IDM_SELECTSLOT6, + IDM_SELECTSLOT7, + IDM_SELECTSLOT8, + IDM_SELECTSLOT9, + IDM_SELECTSLOT10, + IDM_SAVESELECTEDSLOT, + IDM_LOADSELECTEDSLOT, IDM_FRAMESKIP0, IDM_FRAMESKIP1, IDM_FRAMESKIP2, diff --git a/Source/Core/DolphinWX/HotkeyDlg.cpp b/Source/Core/DolphinWX/HotkeyDlg.cpp index f9f403f0e4..359f44e6a2 100644 --- a/Source/Core/DolphinWX/HotkeyDlg.cpp +++ b/Source/Core/DolphinWX/HotkeyDlg.cpp @@ -253,6 +253,20 @@ void HotkeyConfigDialog::CreateHotkeyGUIControls() _("Save State Slot 9"), _("Save State Slot 10"), + _("Select State Slot 1"), + _("Select State Slot 2"), + _("Select State Slot 3"), + _("Select State Slot 4"), + _("Select State Slot 5"), + _("Select State Slot 6"), + _("Select State Slot 7"), + _("Select State Slot 8"), + _("Select State Slot 9"), + _("Select State Slot 10"), + + _("Save to selected slot"), + _("Load from selected slot"), + _("Load State Last 1"), _("Load State Last 2"), _("Load State Last 3"),