[mednaffe] 57/99: Fix ID for duplicate controllers

Stephen Kitt skitt at moszumanska.debian.org
Tue Aug 2 21:00:06 UTC 2016


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

skitt pushed a commit to branch master
in repository mednaffe.

commit 4c055014a34be1a28b1a223a9ad7ac4df14ccb03
Author: AmatCoder <amatcoder at gmail.com>
Date:   Sat May 2 03:52:49 2015 +0200

    Fix ID for duplicate controllers
---
 src/input.c          | 6 ++++--
 src/joystick_linux.c | 6 ++++--
 src/joystick_win.c   | 6 ++++--
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/input.c b/src/input.c
index 071160f..a42cd0b 100644
--- a/src/input.c
+++ b/src/input.c
@@ -603,13 +603,15 @@ void on_input_clicked (GtkButton *button, guidata *gui)
      else GetJoy(i, gui);
      
      CheckDuplicates(i, gui);
+    }
+  }
+    for(i=0;i<9;i++)
+  {
      printf("Index: %i - Instance: %i - Name: %s - ID: %016I64x\n", i, 
               SDL_JoystickInstanceID(gui->joy[i].sdljoy), 
               SDL_JoystickName(gui->joy[i].sdljoy), 
               gui->joy[i].id);
-    }
   }
-
    /* gchar *string;
       
       gchar *dir = g_win32_get_package_installation_directory_of_module(NULL);
diff --git a/src/joystick_linux.c b/src/joystick_linux.c
index e7c62ed..a734726 100644
--- a/src/joystick_linux.c
+++ b/src/joystick_linux.c
@@ -84,8 +84,10 @@ void CheckDuplicates(guint js, guidata *gui)
   for (a=0;a<9;a++)
   {
     if (a==js) break;
-    if (gui->joy[js].id == gui->joy[a].id)
-      gui->joy[js].id++;  
+    if (gui->joy[js].id == gui->joy[a].id){
+      gui->joy[js].id++;
+      CheckDuplicates(js, gui);
+    }  
   } 
 }
 
diff --git a/src/joystick_win.c b/src/joystick_win.c
index 19b395c..35503ba 100644
--- a/src/joystick_win.c
+++ b/src/joystick_win.c
@@ -56,8 +56,10 @@ void CheckDuplicates(guint js, guidata *gui)
   for (a=0;a<9;a++)
   {
     if (a==js) break;
-    if (gui->joy[js].id == gui->joy[a].id)
-      gui->joy[a].id++;  
+    if (gui->joy[js].id == gui->joy[a].id) {
+      gui->joy[a].id++;
+      CheckDuplicates(a, gui);
+    }
   } 
 }
 

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



More information about the Pkg-games-commits mailing list