Fix savestates in SDL2 port
Because SDL_SCANCODE_0 comes *after* SDL_SCANCODE_9 in the SDL keycode table, we have to check if the keycode is between >=1 and <=0. We also have to substract SDL_SCANCODE_1 in order to set command_parameter properly. Errata: Currently, the savestate created with CTRL+0 is created, but refuses to load on Windows (working fine on Linux).
This commit is contained in:
parent
be9df4d658
commit
7fe86cec59
@ -205,9 +205,9 @@ static void handle_events(GB_gameboy_t *gb)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
/* Save states */
|
/* Save states */
|
||||||
if (event.key.keysym.scancode >= SDL_SCANCODE_0 && event.key.keysym.scancode <= SDL_SCANCODE_9) {
|
if (event.key.keysym.scancode >= SDL_SCANCODE_1 && event.key.keysym.scancode <= SDL_SCANCODE_0) {
|
||||||
if (event.key.keysym.mod & MODIFIER) {
|
if (event.key.keysym.mod & MODIFIER) {
|
||||||
command_parameter = event.key.keysym.scancode - SDL_SCANCODE_0;
|
command_parameter = event.key.keysym.scancode - SDL_SCANCODE_1;
|
||||||
|
|
||||||
if (event.key.keysym.mod & KMOD_SHIFT) {
|
if (event.key.keysym.mod & KMOD_SHIFT) {
|
||||||
pending_command = GB_SDL_LOAD_STATE_COMMAND;
|
pending_command = GB_SDL_LOAD_STATE_COMMAND;
|
||||||
|
Loading…
Reference in New Issue
Block a user