[mupen64plus-core] 241/310: Fix saveslot selection for SDL2

Sven Eckelmann ecsv-guest at moszumanska.debian.org
Thu Nov 26 05:58:08 UTC 2015


This is an automated email from the git hooks/post-receive script.

ecsv-guest pushed a commit to branch armhf_test
in repository mupen64plus-core.

commit cd288223332f76b08b8c4783203177f564ad90c8
Author: Sven Eckelmann <sven at narfation.org>
Date:   Thu Jul 25 13:25:25 2013 +0200

    Fix saveslot selection for SDL2
    
    The IDs for SDL scancodes don't start from SDL_SCANCODE_0 and end at
    SDL_SCANCODE_9. Therefore, SDL_SCANCODE_9 is bigger than SDL_SCANCODE_0 (which
    violates a precondition of the key check) and this makes it impossible to
    select a saveslot using the numbers on the keyboard.
---
 debian/changelog                            |  4 +-
 debian/patches/n64_cic_nus_6105_reset.patch |  4 +-
 debian/patches/sdl2_select_saveslot.patch   | 78 +++++++++++++++++++++++++++++
 debian/patches/series                       |  1 +
 4 files changed, 84 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 527fe89..7079d54 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,10 @@
 mupen64plus-core (2.0-2) UNRELEASED; urgency=low
 
   * debian/patches:
-    - n64_cic_nus_6105_reset.patch, Reset PIF_RAMb 46,47 after the
+    - Add n64_cic_nus_6105_reset.patch, Reset PIF_RAMb 46,47 after the
       n64_cic_nus_6105 challenge
+    - Add sdl2_select_saveslot.patch, Fix saveslot selection for SDL2
+      (Closes: #717801)
 
  -- Sven Eckelmann <sven at narfation.org>  Thu, 25 Jul 2013 13:10:48 +0200
 
diff --git a/debian/patches/n64_cic_nus_6105_reset.patch b/debian/patches/n64_cic_nus_6105_reset.patch
index 52384d1..71b0934 100644
--- a/debian/patches/n64_cic_nus_6105_reset.patch
+++ b/debian/patches/n64_cic_nus_6105_reset.patch
@@ -5,10 +5,10 @@ Author: Sven Eckelmann <sven at narfation.org>
 
 ---
 diff --git a/src/memory/pif.c b/src/memory/pif.c
-index 529ce95c3f8c88552f92009b1b916859b16d1a2c..e5266ad023bd262e4786f2ee2c03dc3a9ff012ed 100644
+index b20c4e7e87abef19bba6c5a398c0207c5adf15a1..9bec74f5022e8c3bce3b2cb68af405716ff75af5 100644
 --- a/src/memory/pif.c
 +++ b/src/memory/pif.c
-@@ -513,6 +513,8 @@ void update_pif_write(void)
+@@ -492,6 +492,8 @@ void update_pif_write(void)
              }
              // calculate the proper response for the given challenge (X-Scale's algorithm)
              n64_cic_nus_6105(challenge, response, CHL_LEN - 2);
diff --git a/debian/patches/sdl2_select_saveslot.patch b/debian/patches/sdl2_select_saveslot.patch
new file mode 100644
index 0000000..b4e635e
--- /dev/null
+++ b/debian/patches/sdl2_select_saveslot.patch
@@ -0,0 +1,78 @@
+Description: Fix saveslot selection for SDL2
+ The IDs for SDL scancodes don't start from SDL_SCANCODE_0 and end at
+ SDL_SCANCODE_9. Therefore, SDL_SCANCODE_9 is bigger than SDL_SCANCODE_0 (which
+ violates a precondition of the key check) and this makes it impossible to
+ select a saveslot using the numbers on the keyboard.
+Bug-Debian: http://bugs.debian.org/717801
+Author: Sven Eckelmann <sven at narfation.org>
+
+---
+diff --git a/src/main/eventloop.c b/src/main/eventloop.c
+index a79d64b54c066835a6e24e7aa37c6bf1fb9d0896..e69af01f6ca244c07ae110ac341f1ca77895dd1e 100644
+--- a/src/main/eventloop.c
++++ b/src/main/eventloop.c
+@@ -41,6 +41,14 @@
+ #define SDL_SCANCODE_G SDLK_g
+ #define SDL_SCANCODE_RETURN SDLK_RETURN
+ #define SDL_SCANCODE_0 SDLK_0
++#define SDL_SCANCODE_1 SDLK_1
++#define SDL_SCANCODE_2 SDLK_2
++#define SDL_SCANCODE_3 SDLK_3
++#define SDL_SCANCODE_4 SDLK_4
++#define SDL_SCANCODE_5 SDLK_5
++#define SDL_SCANCODE_6 SDLK_6
++#define SDL_SCANCODE_7 SDLK_7
++#define SDL_SCANCODE_8 SDLK_8
+ #define SDL_SCANCODE_9 SDLK_9
+ #define SDL_SCANCODE_UNKNOWN SDLK_UNKNOWN
+ 
+@@ -445,17 +453,47 @@ int event_set_core_defaults(void)
+     return 1;
+ }
+ 
++static int get_saveslot_from_keysym(int keysym)
++{
++    switch (keysym) {
++    case SDL_SCANCODE_0:
++        return 0;
++    case SDL_SCANCODE_1:
++        return 1;
++    case SDL_SCANCODE_2:
++        return 2;
++    case SDL_SCANCODE_3:
++        return 3;
++    case SDL_SCANCODE_4:
++        return 4;
++    case SDL_SCANCODE_5:
++        return 5;
++    case SDL_SCANCODE_6:
++        return 6;
++    case SDL_SCANCODE_7:
++        return 7;
++    case SDL_SCANCODE_8:
++        return 8;
++    case SDL_SCANCODE_9:
++        return 9;
++    default:
++        return -1;
++    }
++}
++
+ /*********************************************************************************************************
+ * sdl keyup/keydown handlers
+ */
+ 
+ void event_sdl_keydown(int keysym, int keymod)
+ {
++    int slot;
++
+     /* check for the only 2 hard-coded key commands: Alt-enter for fullscreen and 0-9 for save state slot */
+     if (keysym == SDL_SCANCODE_RETURN && keymod & (KMOD_LALT | KMOD_RALT))
+         gfx.changeWindow();
+-    else if (keysym >= SDL_SCANCODE_0 && keysym <= SDL_SCANCODE_9)
+-        main_state_set_slot(keysym - SDL_SCANCODE_0);
++    else if ((slot = get_saveslot_from_keysym(keysym)) >= 0)
++        main_state_set_slot(slot);
+     /* check all of the configurable commands */
+     else if (keysym == sdl_keysym2native(ConfigGetParamInt(l_CoreEventsConfig, kbdStop)))
+         main_stop();
diff --git a/debian/patches/series b/debian/patches/series
index 701fae1..474f9c0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@ disable_recompiler_disassembler.patch
 sdl2_keysym.patch
 multiple_main.patch
 n64_cic_nus_6105_reset.patch
+sdl2_select_saveslot.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus-core.git



More information about the Pkg-games-commits mailing list