mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 13:55:38 +00:00
SDL: Add hotkeys (F1-F8) for loading/saving state
This commit is contained in:
parent
e11d98e5e0
commit
d47717fdd6
|
@ -92,7 +92,7 @@ bool SDLInterface::CreateGLContext()
|
|||
// glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
}
|
||||
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
SDL_GL_SetSwapInterval(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -277,6 +277,27 @@ bool SDLInterface::HandleSDLEvent(const SDL_Event* event)
|
|||
m_controller->SetButtonState(DigitalController::Button::Select, pressed);
|
||||
return true;
|
||||
|
||||
case SDL_SCANCODE_F1:
|
||||
case SDL_SCANCODE_F2:
|
||||
case SDL_SCANCODE_F3:
|
||||
case SDL_SCANCODE_F4:
|
||||
case SDL_SCANCODE_F5:
|
||||
case SDL_SCANCODE_F6:
|
||||
case SDL_SCANCODE_F7:
|
||||
case SDL_SCANCODE_F8:
|
||||
{
|
||||
if (!pressed)
|
||||
{
|
||||
auto filename = GetSaveStateFilename(event->key.keysym.scancode - SDL_SCANCODE_F1 + 1);
|
||||
if (event->key.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT))
|
||||
SaveState(filename);
|
||||
else
|
||||
LoadState(filename);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SDL_SCANCODE_TAB:
|
||||
SDL_GL_SetSwapInterval(pressed ? 0 : 1);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue