[mupen64plus-input-sdl] 32/196: Imported Upstream version 1.99.4

Sven Eckelmann ecsv-guest at moszumanska.debian.org
Thu Nov 26 06:00:11 UTC 2015


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

ecsv-guest pushed a commit to branch master
in repository mupen64plus-input-sdl.

commit 7f66fe1df07da10f679635a8abead58bb9074988
Author: Sven Eckelmann <sven.eckelmann at gmx.de>
Date:   Wed Nov 24 20:28:57 2010 +0100

    Imported Upstream version 1.99.4
---
 README                 |  2 +-
 RELEASE                |  8 ++++++++
 data/InputAutoCfg.ini  | 26 ++++++++++++++++++++++++++
 projects/unix/Makefile | 18 ++++++++++--------
 src/config.c           | 46 ++++++++++++++++++++++++++++++----------------
 src/config.h           |  2 +-
 src/plugin.c           | 25 +++++++++++++++++++++----
 src/version.h          |  2 +-
 8 files changed, 98 insertions(+), 31 deletions(-)

diff --git a/README b/README
index d263270..5b0128e 100644
--- a/README
+++ b/README
@@ -4,7 +4,7 @@
    may press the Left Control and Alt keys together to toggle the mouse cursor on and off.
  - If X/Y analog axes are mapped to keys, a plain keypress will simulate the joystick
    being pressed all the way to the edge.  To decrease the amount of simulated joystick
-   deflection, the user may press the Left Control, Left Alt, or LeftCtrl+LeftAlt modifiers.
+   deflection, the user may press Right Control, Right Shift, or Right Ctrl+Right Shift.
 
 ********Notes for supported joysticks for auto-configuration:
 
diff --git a/RELEASE b/RELEASE
index f9ebba0..0d80d13 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1,6 +1,14 @@
 SDL Input plugin for Mupen64Plus
 --------------------------------
 
+Mupen64Plus-input-sdl v1.99.4 - November 22, 2010
+-------------------------------------------------
+ - Bugfix: Do configuration during PluginStart(), so GUI will see defaults (auto-configured) the first time it is run
+ - Move axis value reducers to right shift and right ctrl, to avoid conflict with A/B buttons
+ - New feature: extra deadzone parameter in axis() config parameter clause when mapping an analog joystick axis to an N64 button
+ - many new joystick auto-configurations
+ - makefile fixes and improvements
+
 Mupen64Plus-input-sdl v1.99.3 - February 13, 2010
 -------------------------------------------------
  - New feature: auto-configuration uses an .ini file instead of hard-coding the controllers in the source code
diff --git a/data/InputAutoCfg.ini b/data/InputAutoCfg.ini
index b6cad48..f41d14b 100644
--- a/data/InputAutoCfg.ini
+++ b/data/InputAutoCfg.ini
@@ -74,6 +74,32 @@ Rumblepak switch =
 X Axis = axis(0-,2-)
 Y Axis = axis(1-,1+)
 
+; FuSa is a homebrew program which allows a PSP to be used as a gamepad
+[FuSa FuSa GamePad]
+plugged = True
+plugin = 2
+mouse = False
+AnalogDeadzone = 4096,4096
+AnalogPeak = 32768,32768
+DPad R =
+DPad L =
+DPad D =
+DPad U =
+Start = button(7)
+Z Trig = button(4)
+B Button = button(2)
+A Button = button(0)
+C Button R = hat(0 Right)
+C Button L = hat(0 Left)
+C Button D = hat(0 Down)
+C Button U = hat(0 Up)
+R Trig = button(5)
+L Trig = button(3)
+Mempak switch =
+Rumblepak switch =
+X Axis = axis(0-,0+)
+Y Axis = axis(1-,1+)
+
 [Gasia Co.,Ltd PS(R) Gamepad]
 plugged = True
 plugin = 2
diff --git a/projects/unix/Makefile b/projects/unix/Makefile
index d269d60..0a0d7ab 100644
--- a/projects/unix/Makefile
+++ b/projects/unix/Makefile
@@ -33,6 +33,11 @@ ifeq ("$(UNAME)","linux")
   SO_EXTENSION = so
   SHARED = -shared
 endif
+ifneq ("$(filter GNU hurd,$(UNAME))","")
+  OS = LINUX
+  SO_EXTENSION = so
+  SHARED = -shared
+endif
 ifeq ("$(UNAME)","Darwin")
   OS = OSX
   SO_EXTENSION = dylib
@@ -83,7 +88,6 @@ endif
 
 # base CFLAGS, LIBS, and LDFLAGS
 CFLAGS += -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -fvisibility=hidden -I../../src
-LDFLAGS += -ldl
 ifneq ($(OS), FREEBSD)
   CFLAGS += -pipe -O3
 endif
@@ -109,8 +113,10 @@ ifeq ($(OS), LINUX)
   ifeq ($(CPU), X86)
     ifeq ($(ARCH_DETECTED), 64BITS)
       CFLAGS += -march=athlon64
+      LDFLAGS += -ldl
     else
       CFLAGS += -mmmx -msse -march=i686 -mtune=pentium-m -fomit-frame-pointer
+      LDFLAGS += -ldl
     endif
   endif
 endif
@@ -118,9 +124,10 @@ ifeq ($(OS), OSX)
   ifeq ($(CPU), X86)
     ifeq ($(ARCH_DETECTED), 64BITS)
       CFLAGS += -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
+      LDFLAGS += -ldl
     else
       CFLAGS += -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
-      LDFLAGS += -arch i686
+      LDFLAGS += -arch i686 -ldl
     endif
   endif
 endif
@@ -132,17 +139,12 @@ endif
 ifeq ($(shell which sdl-config 2>/dev/null),)
   $(error No SDL development libraries found!)
 endif
-ifeq ($(OS),FREEBSD)
-    CFLAGS  += `${SDL_CONFIG} --cflags`
-    LDFLAGS += `${SDL_CONFIG} --libs`
-endif
 ifeq ("$(UNAME)","Darwin")
     CFLAGS  += $(shell sdl-config --cflags)
     # sdl-config on mac screws up when we're trying to build a library and not an executable
     # SDL 1.3 is supposed to fix that, if it's ever released
     LDFLAGS += -L/usr/local/lib -lSDL -Wl,-framework,Cocoa
-endif
-ifeq ($(OS),LINUX)
+else
     CFLAGS  += $(shell sdl-config --cflags)
     LDFLAGS += $(shell sdl-config --libs)
 endif
diff --git a/src/config.c b/src/config.c
index f6845b0..583124c 100644
--- a/src/config.c
+++ b/src/config.c
@@ -160,14 +160,14 @@ static int load_controller_config(const char *SectionName, int i)
     for (readOK = 0; readOK == 0; readOK = 1)
     {
         /* check for the required parameters */
-        if (ConfigGetParameter(pConfig, "plugged", M64TYPE_INT, &controller[i].control->Present, sizeof(int)) != M64ERR_SUCCESS)
+        if (ConfigGetParameter(pConfig, "plugged", M64TYPE_BOOL, &controller[i].control->Present, sizeof(int)) != M64ERR_SUCCESS)
             break;
         if (ConfigGetParameter(pConfig, "plugin", M64TYPE_INT, &controller[i].control->Plugin, sizeof(int)) != M64ERR_SUCCESS)
             break;
         if (ConfigGetParameter(pConfig, "device", M64TYPE_INT, &controller[i].device, sizeof(int)) != M64ERR_SUCCESS)
             break;
         /* then do the optional parameters */
-        ConfigGetParameter(pConfig, "mouse", M64TYPE_INT, &controller[i].mouse, sizeof(int));
+        ConfigGetParameter(pConfig, "mouse", M64TYPE_BOOL, &controller[i].mouse, sizeof(int));
         if (ConfigGetParameter(pConfig, "AnalogDeadzone", M64TYPE_STRING, input_str, 256) == M64ERR_SUCCESS)
         {
             if (sscanf(input_str, "%i,%i", &controller[i].axis_deadzone[0], &controller[i].axis_deadzone[1]) != 2)
@@ -382,7 +382,7 @@ void save_controller_config(int iCtrlIdx)
  *    - the keyboard config parameters will never be written to the config file, even if the Input-SDL-Control1 section was previously empty
  */
   
-void load_configuration(void)
+void load_configuration(int bPrintSummary)
 {
     char SectionName[32];
     const char *JoyName;
@@ -441,11 +441,11 @@ void load_configuration(void)
                 DebugMessage(M64MSG_INFO, "N64 Controller #%i: Disabled, SDL joystick is not available", i+1);
             }
             else
-                DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using stored configuration with joystick '%s'", i+1, JoyName);
+                DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using SDL joystick %i ('%s')", i+1, controller[i].device, JoyName);
         }
         else /* controller is configured for keyboard/mouse */
         {
-            DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using stored configuration for keyboard/mouse", i+1);
+            DebugMessage(M64MSG_INFO, "N64 Controller #%i: Using keyboard/mouse", i+1);
         }
     }
 
@@ -460,25 +460,39 @@ void load_configuration(void)
                 joy_plugged++;
         }
     }
-    if (joy_found > 0 && joy_plugged > 0)
-    {
-        DebugMessage(M64MSG_INFO, "%i controller(s) found, %i plugged in and usable in the emulator", joy_found, joy_plugged);
-    }
-    else
+
+    /* fallback to keyboard if no joysticks are available and 'plugged in' */
+    if (joy_found == 0 || joy_plugged == 0)
     {
-        if (joy_found == 0)
-            DebugMessage(M64MSG_WARNING, "No joysticks/controllers found");
-        else if (joy_plugged == 0)
-            DebugMessage(M64MSG_WARNING, "%i controllers found, but none are 'plugged in'", joy_found);
-        DebugMessage(M64MSG_INFO, "Forcing keyboard input for N64 controller #1");
+        DebugMessage(M64MSG_INFO, "N64 Controller #1: Forcing default keyboard configuration");
         auto_set_defaults(DEVICE_NOT_JOYSTICK, "Keyboard");
-        if (!load_controller_config("AutoConfig0", 0))
+        if (load_controller_config("AutoConfig0", 0))
+        {
+            /* use ConfigSetDefault*() to save this auto-config if config section was empty */
+            save_controller_config(0);
+        }
+        else
         {
             DebugMessage(M64MSG_ERROR, "Autoconfig keyboard setup invalid");
         }
         ConfigDeleteSection("AutoConfig0");
     }
 
+    if (bPrintSummary)
+    {
+        if (joy_found > 0 && joy_plugged > 0)
+        {
+            DebugMessage(M64MSG_INFO, "%i controller(s) found, %i plugged in and usable in the emulator", joy_found, joy_plugged);
+        }
+        else
+        {
+            if (joy_found == 0)
+                DebugMessage(M64MSG_WARNING, "No joysticks/controllers found");
+            else if (joy_plugged == 0)
+                DebugMessage(M64MSG_WARNING, "%i controllers found, but none were 'plugged in'", joy_found);
+        }
+    }
+
 }
 
 
diff --git a/src/config.h b/src/config.h
index 4379ac2..9ab22b7 100644
--- a/src/config.h
+++ b/src/config.h
@@ -22,7 +22,7 @@
 #ifndef __CONFIG_H__
 #define __CONFIG_H__
 
-extern void load_configuration(void);
+extern void load_configuration(int bPrintSummary);
 extern void save_controller_config(int iCtrlIdx);
 
 #endif /* __CONFIG_H__ */
diff --git a/src/plugin.c b/src/plugin.c
index 1f33173..0bdfcc9 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -129,11 +129,14 @@ void DebugMessage(int level, const char *message, ...)
   va_end(args);
 }
 
+static CONTROL temp_core_controlinfo[4];
 
 /* Mupen64Plus plugin functions */
 EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Context,
                                    void (*DebugCallback)(void *, int, const char *))
 {
+    int i;
+
     if (l_PluginInit)
         return M64ERR_ALREADY_INIT;
 
@@ -169,6 +172,21 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con
         return M64ERR_INCOMPATIBLE;
     }
 
+    /* reset controllers */
+    memset(controller, 0, sizeof(SController) * 4);
+    for (i = 0; i < SDLK_LAST; i++)
+    {
+        myKeyState[i] = 0;
+    }
+    /* set CONTROL struct pointers to the temporary static array */
+    /* this small struct is used to tell the core whether each controller is plugged in, and what type of pak is connected */
+    /* we only need it so that we can call load_configuration below, to auto-config for a GUI front-end */
+    for (i = 0; i < 4; i++)
+        controller[i].control = temp_core_controlinfo + i;
+
+    /* read plugin config from core config database, auto-config if necessary and update core database */
+    load_configuration(0);
+
     l_PluginInit = 1;
     return M64ERR_SUCCESS;
 }
@@ -217,9 +235,9 @@ doSdlKeys(unsigned char* keystate)
     static int grabmouse = 1, grabtoggled = 0;
 
     axis_max_val = 80;
-    if (keystate[SDLK_LCTRL])
+    if (keystate[SDLK_RCTRL])
         axis_max_val -= 40;
-    if (keystate[SDLK_LSHIFT])
+    if (keystate[SDLK_RSHIFT])
         axis_max_val -= 20;
 
     for( c = 0; c < 4; c++ )
@@ -702,14 +720,13 @@ EXPORT void CALL InitiateControllers(CONTROL_INFO ControlInfo)
         controller[i].control = ControlInfo.Controls + i;
 
     // read configuration
-    load_configuration();
+    load_configuration(1);
 
     for( i = 0; i < 4; i++ )
     {
         // test for rumble support for this joystick
         InitiateRumble(i);
         // if rumble not supported, switch to mempack
-        // Comment out if statement to test rumble on systems without necessary hardware.
         if (controller[i].control->Plugin == PLUGIN_RAW && controller[i].event_joystick == 0)
             controller[i].control->Plugin = PLUGIN_MEMPAK;
     }
diff --git a/src/version.h b/src/version.h
index dbf46b0..c26deec 100644
--- a/src/version.h
+++ b/src/version.h
@@ -27,7 +27,7 @@
 #define VERSION_H
 
 #define PLUGIN_NAME    "Mupen64Plus SDL Input Plugin"
-#define PLUGIN_VERSION 0x016303
+#define PLUGIN_VERSION 0x016304
 
 #define VERSION_PRINTF_SPLIT(x) (((x) >> 16) & 0xffff), (((x) >> 8) & 0xff), ((x) & 0xff)
 

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



More information about the Pkg-games-commits mailing list