Organized savestate hotkeys: F1-F8: States, F9: Screenshot, F10: Pause, F11: Load last state, F12: Undo load state, Shift-F12: Undo save state
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3578 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
dfdfbd4a6a
commit
24a63ce368
|
@ -622,15 +622,34 @@ EState GetState()
|
|||
return CORE_UNINITIALIZED;
|
||||
}
|
||||
|
||||
// Save or recreate the emulation state
|
||||
void SaveState() {
|
||||
State_Save(0);
|
||||
static inline std::string GenerateScreenshotName()
|
||||
{
|
||||
int index = 1;
|
||||
std::string tempname, name;
|
||||
tempname = FULL_SCREENSHOTS_DIR + GetStartupParameter().GetUniqueID();
|
||||
|
||||
name = StringFromFormat("%s-%d.bmp", tempname.c_str(), index);
|
||||
|
||||
while(File::Exists(name.c_str()))
|
||||
name = StringFromFormat("%s-%d.bmp", tempname.c_str(), ++index);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
void LoadState() {
|
||||
State_Load(0);
|
||||
void ScreenShot(const std::string& name)
|
||||
{
|
||||
bool bPaused = (GetState() == CORE_PAUSE);
|
||||
|
||||
SetState(CORE_PAUSE);
|
||||
CPluginManager::GetInstance().GetVideo()->Video_Screenshot(name.c_str());
|
||||
if(!bPaused)
|
||||
SetState(CORE_RUN);
|
||||
}
|
||||
|
||||
void ScreenShot()
|
||||
{
|
||||
ScreenShot(GenerateScreenshotName());
|
||||
}
|
||||
|
||||
// --- Callbacks for plugins / engine ---
|
||||
|
||||
|
@ -849,28 +868,38 @@ const char *Callback_ISOName()
|
|||
return "";
|
||||
}
|
||||
|
||||
|
||||
// Called from ANY thread!
|
||||
// The hotkey function
|
||||
void Callback_KeyPress(int key, bool shift, bool control)
|
||||
{
|
||||
// 0x70 == VK_F1
|
||||
if (key >= 0x70 && key < 0x79) {
|
||||
// F1 - F8: Save states
|
||||
if (key >= 0x70 && key < 0x78) {
|
||||
// F-key
|
||||
int slot_number = key - 0x70 + 1;
|
||||
if (shift) {
|
||||
if (shift)
|
||||
State_Save(slot_number);
|
||||
} else {
|
||||
else
|
||||
State_Load(slot_number);
|
||||
}
|
||||
}
|
||||
|
||||
// 0x78 == VK_F9
|
||||
if (key == 0x78)
|
||||
ScreenShot();
|
||||
|
||||
// 0x7a == VK_F11
|
||||
if (key == 0x7a)
|
||||
State_LoadLastSaved();
|
||||
|
||||
// 0x7a == VK_F12
|
||||
if (key == 0x7b)
|
||||
State_LoadAs(FULL_STATESAVES_DIR "lastState.sav");
|
||||
{
|
||||
// TODO: Move to memory buffer, implement last state before loading
|
||||
if(shift)
|
||||
State_LoadAs(FULL_STATESAVES_DIR "lastState.sav");
|
||||
/*else
|
||||
State_LoadAs(FULL_STATESAVES_DIR "tempState.sav");
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
// Callback_WiimoteLog
|
||||
|
|
|
@ -49,9 +49,8 @@ namespace Core
|
|||
void SetState(EState _State);
|
||||
EState GetState();
|
||||
|
||||
// Save/Load state
|
||||
void SaveState();
|
||||
void LoadState();
|
||||
void ScreenShot(const std::string& name);
|
||||
void ScreenShot();
|
||||
|
||||
// Get core parameters kill use SConfig instead
|
||||
const SCoreStartupParameter& GetStartupParameter();
|
||||
|
|
|
@ -49,8 +49,8 @@ static unsigned char __LZO_MMODEL out [ OUT_LEN ];
|
|||
static HEAP_ALLOC(wrkmem,LZO1X_1_MEM_COMPRESS);
|
||||
|
||||
|
||||
static int ev_Save;
|
||||
static int ev_Load;
|
||||
static int ev_Save, ev_BufferSave;
|
||||
static int ev_Load, ev_BufferLoad;
|
||||
|
||||
static std::string cur_filename, lastFilename;
|
||||
|
||||
|
|
|
@ -290,8 +290,8 @@ EVT_MENU(IDM_UNDOSTATE, CFrame::OnUndoState)
|
|||
EVT_MENU(IDM_LOADSTATEFILE, CFrame::OnLoadStateFromFile)
|
||||
EVT_MENU(IDM_SAVESTATEFILE, CFrame::OnSaveStateToFile)
|
||||
|
||||
EVT_MENU_RANGE(IDM_LOADSLOT1, IDM_LOADSLOT10, CFrame::OnLoadState)
|
||||
EVT_MENU_RANGE(IDM_SAVESLOT1, IDM_SAVESLOT10, CFrame::OnSaveState)
|
||||
EVT_MENU_RANGE(IDM_LOADSLOT1, IDM_LOADSLOT8, CFrame::OnLoadState)
|
||||
EVT_MENU_RANGE(IDM_SAVESLOT1, IDM_SAVESLOT8, CFrame::OnSaveState)
|
||||
EVT_MENU_RANGE(IDM_DRIVE1, IDM_DRIVE24, CFrame::OnBootDrive)
|
||||
|
||||
EVT_SIZE(CFrame::OnResize)
|
||||
|
|
|
@ -144,7 +144,7 @@ void CFrame::CreateMenu()
|
|||
loadMenu->Append(IDM_UNDOSTATE, _T("Last Overwritten State\tF12"));
|
||||
loadMenu->AppendSeparator();
|
||||
|
||||
for (int i = 1; i < 10; i++) {
|
||||
for (int i = 1; i <= 8; 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));
|
||||
}
|
||||
|
@ -516,34 +516,12 @@ void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event))
|
|||
m_GameListCtrl->BrowseForDirectory();
|
||||
}
|
||||
|
||||
|
||||
// Create screenshot
|
||||
static inline void GenerateScreenshotName(std::string& name)
|
||||
{
|
||||
int index = 1;
|
||||
std::string tempname;
|
||||
tempname = FULL_SCREENSHOTS_DIR;
|
||||
tempname += Core::GetStartupParameter().GetUniqueID();
|
||||
|
||||
name = StringFromFormat("%s-%d.bmp", tempname.c_str(), index);
|
||||
|
||||
while(File::Exists(name.c_str()))
|
||||
name = StringFromFormat("%s-%d.bmp", tempname.c_str(), ++index);
|
||||
}
|
||||
|
||||
void CFrame::OnScreenshot(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
std::string name;
|
||||
GenerateScreenshotName(name);
|
||||
bool bPaused = (Core::GetState() == Core::CORE_PAUSE);
|
||||
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
CPluginManager::GetInstance().GetVideo()->Video_Screenshot(name.c_str());
|
||||
if(!bPaused)
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
Core::ScreenShot();
|
||||
}
|
||||
|
||||
|
||||
// Stop the emulation
|
||||
void CFrame::DoStop()
|
||||
{
|
||||
|
@ -583,7 +561,6 @@ void CFrame::OnStop(wxCommandEvent& WXUNUSED (event))
|
|||
DoStop();
|
||||
}
|
||||
|
||||
|
||||
void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
CConfigMain ConfigMain(this);
|
||||
|
|
|
@ -43,8 +43,6 @@ enum
|
|||
IDM_SAVESLOT6,
|
||||
IDM_SAVESLOT7,
|
||||
IDM_SAVESLOT8,
|
||||
IDM_SAVESLOT9,
|
||||
IDM_SAVESLOT10,
|
||||
IDM_LOADSLOT1,
|
||||
IDM_LOADSLOT2,
|
||||
IDM_LOADSLOT3,
|
||||
|
@ -53,8 +51,6 @@ enum
|
|||
IDM_LOADSLOT6,
|
||||
IDM_LOADSLOT7,
|
||||
IDM_LOADSLOT8,
|
||||
IDM_LOADSLOT9,
|
||||
IDM_LOADSLOT10,
|
||||
IDM_PLAY,
|
||||
IDM_STOP,
|
||||
IDM_SCREENSHOT,
|
||||
|
|
Loading…
Reference in New Issue