mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-05 02:32:45 +00:00
Save States:
1. Added a header, including the Game ID (old states are obsolete unless the gameid is appended to the beginning) so states from different games can't be cross-loaded 2. Added loading/saving from/to file 3. Added loading of last saved state (F11) 4. Added "Undo State": Load the backed up last overwritten state (if you press save instead of load) (F12) 5. State code cleanup git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3560 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
2ea850f5a0
commit
7ea2bc5da9
7 changed files with 169 additions and 30 deletions
|
@ -139,11 +139,20 @@ void CFrame::CreateMenu()
|
|||
emulationMenu->AppendSeparator();
|
||||
wxMenu *saveMenu = new wxMenu;
|
||||
wxMenu *loadMenu = new wxMenu;
|
||||
m_pSubMenuLoad = emulationMenu->AppendSubMenu(saveMenu, _T("&Load State"));
|
||||
m_pSubMenuSave = emulationMenu->AppendSubMenu(loadMenu, _T("Sa&ve State"));
|
||||
m_pSubMenuLoad = emulationMenu->AppendSubMenu(loadMenu, _T("&Load State"));
|
||||
m_pSubMenuSave = emulationMenu->AppendSubMenu(saveMenu, _T("Sa&ve State"));
|
||||
|
||||
saveMenu->Append(IDM_SAVESTATEFILE, _T("Save State..."));
|
||||
saveMenu->AppendSeparator();
|
||||
|
||||
loadMenu->Append(IDM_LOADSTATEFILE, _T("Load State..."));
|
||||
loadMenu->Append(IDM_LOADLASTSTATE, _T("Last Saved State\tF11"));
|
||||
loadMenu->Append(IDM_UNDOSTATE, _T("Last Overwritten State\tF12"));
|
||||
loadMenu->AppendSeparator();
|
||||
|
||||
for (int i = 1; i < 10; i++) {
|
||||
saveMenu->Append(IDM_LOADSLOT1 + i - 1, wxString::Format(_T("Slot %i\tF%i"), i, i));
|
||||
loadMenu->Append(IDM_SAVESLOT1 + i - 1, wxString::Format(_T("Slot %i\tShift+F%i"), i, i));
|
||||
loadMenu->Append(IDM_LOADSLOT1 + i - 1, wxString::Format(_T("Slot %i\tF%i"), i, i));
|
||||
saveMenu->Append(IDM_SAVESLOT1 + i - 1, wxString::Format(_T("Slot %i\tShift+F%i"), i, i));
|
||||
}
|
||||
menuBar->Append(emulationMenu, _T("&Emulation"));
|
||||
|
||||
|
@ -717,6 +726,52 @@ void CFrame::OnToggleSkipIdle(wxCommandEvent& WXUNUSED (event))
|
|||
SConfig::GetInstance().SaveSettings();
|
||||
}
|
||||
|
||||
void CFrame::OnLoadStateFromFile(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
wxString path = wxFileSelector(
|
||||
_T("Select the state to load"),
|
||||
wxEmptyString, wxEmptyString, wxEmptyString,
|
||||
wxString::Format
|
||||
(
|
||||
_T("All Save States (sav, s##)|*.sav;*.s??|All files (%s)|%s"),
|
||||
wxFileSelectorDefaultWildcardStr,
|
||||
wxFileSelectorDefaultWildcardStr
|
||||
),
|
||||
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST,
|
||||
this);
|
||||
|
||||
if(path)
|
||||
State_LoadAs(path.ToAscii());
|
||||
}
|
||||
|
||||
void CFrame::OnSaveStateToFile(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
wxString path = wxFileSelector(
|
||||
_T("Select the state to save"),
|
||||
wxEmptyString, wxEmptyString, wxEmptyString,
|
||||
wxString::Format
|
||||
(
|
||||
_T("All Save States (sav, s##)|*.sav;*.s??|All files (%s)|%s"),
|
||||
wxFileSelectorDefaultWildcardStr,
|
||||
wxFileSelectorDefaultWildcardStr
|
||||
),
|
||||
wxFD_SAVE,
|
||||
this);
|
||||
|
||||
if(path)
|
||||
State_SaveAs(path.ToAscii());
|
||||
}
|
||||
|
||||
void CFrame::OnLoadLastState(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
State_LoadLastSaved();
|
||||
}
|
||||
|
||||
void CFrame::OnUndoState(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
State_LoadAs(FULL_STATESAVES_DIR "lastState.sav");
|
||||
}
|
||||
|
||||
void CFrame::OnLoadState(wxCommandEvent& event)
|
||||
{
|
||||
int id = event.GetId();
|
||||
|
@ -724,13 +779,6 @@ void CFrame::OnLoadState(wxCommandEvent& event)
|
|||
State_Load(slot);
|
||||
}
|
||||
|
||||
void CFrame::OnResize(wxSizeEvent& event)
|
||||
{
|
||||
FitInside();
|
||||
DoMoveIcons(); // In FrameWiimote.cpp
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void CFrame::OnSaveState(wxCommandEvent& event)
|
||||
{
|
||||
int id = event.GetId();
|
||||
|
@ -738,6 +786,12 @@ void CFrame::OnSaveState(wxCommandEvent& event)
|
|||
State_Save(slot);
|
||||
}
|
||||
|
||||
void CFrame::OnResize(wxSizeEvent& event)
|
||||
{
|
||||
FitInside();
|
||||
DoMoveIcons(); // In FrameWiimote.cpp
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
// Enable and disable the toolbar
|
||||
void CFrame::OnToggleToolbar(wxCommandEvent& event)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue