[mupen64plus-input-sdl] 02/196: Imported Upstream version 1.99.2

Sven Eckelmann ecsv-guest at moszumanska.debian.org
Thu Nov 26 06:00:00 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 5fde3b7f1cdbbcfda411d2e2c92cc3f73adfa5b8
Author: Sven Eckelmann <sven.eckelmann at gmx.de>
Date:   Sat Feb 13 01:41:54 2010 +0100

    Imported Upstream version 1.99.2
---
 .hg_archival.txt                            |   2 +-
 .hgtags                                     |   1 +
 README                                      |  16 +-
 RELEASE                                     |  12 ++
 projects/msvc8/mupen64plus-input-sdl.vcproj | 232 ++++++++++++++++++++++++++++
 projects/unix/Makefile                      |  47 +++---
 src/autoconfig.c                            |  82 +++++++++-
 src/config.c                                |  25 ++-
 src/osal_dynamiclib_win32.c                 |  74 +++++++++
 src/{version.h => osal_preproc.h}           |  22 ++-
 src/plugin.c                                |  10 +-
 src/version.h                               |   2 +-
 12 files changed, 473 insertions(+), 52 deletions(-)

diff --git a/.hg_archival.txt b/.hg_archival.txt
index fe97867..d51023f 100644
--- a/.hg_archival.txt
+++ b/.hg_archival.txt
@@ -1,2 +1,2 @@
 repo: 298f44f57fdcae945f3fb894716debb7ed65ab2d
-node: fd71baaef000ef1a2a031cdf8e30bb4ad0ae5aa9
+node: 766be10f7bb8845c21cf7eb46548ff1cb64eb682
diff --git a/.hgtags b/.hgtags
new file mode 100644
index 0000000..8c22807
--- /dev/null
+++ b/.hgtags
@@ -0,0 +1 @@
+fd71baaef000ef1a2a031cdf8e30bb4ad0ae5aa9 1.99.1
diff --git a/README b/README
index b513593..80700a8 100644
--- a/README
+++ b/README
@@ -39,15 +39,25 @@ used for A and B and the second and third row was used for C-Buttons - except
 for the Button next to the A button which would be C-Down but got the Z 
 button.
 
-5. Default Keyboard interface:
+5. Playstation 3 Controller:
+Left analog stick - analog stick
+Right analog stick - C-pad
+D-Pad - D-Pad
+Cross - A
+Square - B
+L1 / R1 - L / R
+L2 - Z
+Start - Start
+
+6. Default Keyboard interface:
 Analog Pad is "Arrow Keys"
 C Up/Left/Down/Right are "I", "J", "K", "L"
 DPad Up/Left/Down/Right are "W", "A", "S", "D"
 Z trig is "z" key
 L and R trigs are "x" and "c"
 Start is "Enter" ("Return")
-A is "left meta"
-B is "left alt"
+A is "left shift"
+B is "left control"
 Select Mempack = ","
 Select Rumblepack = "."
 
diff --git a/RELEASE b/RELEASE
index dd57cc1..bbf3cee 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1,6 +1,18 @@
 SDL Input plugin for Mupen64Plus
 --------------------------------
 
+Mupen64Plus-input-sdl v1.99.2 - January 6, 2010
+-------------------------------------------------
+ - new feature: added MSVC8 project file, minor code refactoring for VC compatibility
+ - added auto-configuration for:
+   - Xbox 360 Wireless Receiver
+   - PS3 controller
+   - Jess Tech Dual Analog Pad
+ - Makefile improvements:
+   - throw error if OS/CPU not supported
+   - use DESTDIR in install/uninstall paths
+   - Allow user-specified CC/CXX/LD paths
+
 Mupen64Plus-input-sdl v1.99.1 - December 14, 2009
 -------------------------------------------------
  - New feature: Joystick/Keyboard auto-configuration
diff --git a/projects/msvc8/mupen64plus-input-sdl.vcproj b/projects/msvc8/mupen64plus-input-sdl.vcproj
new file mode 100644
index 0000000..122bcb1
--- /dev/null
+++ b/projects/msvc8/mupen64plus-input-sdl.vcproj
@@ -0,0 +1,232 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mupen64plus-input-sdl"
+	ProjectGUID="{7F3178D0-0E2E-471B-9160-69F0354F9DE9}"
+	RootNamespace="mupen64plusinputsdl"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDL.lib"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDL.lib"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\src\autoconfig.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\config.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\osal_dynamiclib_win32.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\plugin.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\src\autoconfig.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\config.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\osal_dynamiclib.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\osal_preproc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\plugin.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\version.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/projects/unix/Makefile b/projects/unix/Makefile
index f8fc0cb..6b9dfa1 100644
--- a/projects/unix/Makefile
+++ b/projects/unix/Makefile
@@ -20,8 +20,9 @@
 # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 # Makefile for SDL Input plugin in Mupen64plus
 
-# detect operation system
+# detect operating system
 UNAME = $(shell uname -s)
+OS := NONE
 ifeq ("$(UNAME)","Linux")
   OS = LINUX
   SO_EXTENSION = so
@@ -42,10 +43,14 @@ ifeq ("$(UNAME)","FreeBSD")
   SO_EXTENSION = so
   SHARED = -shared
 endif
+ifeq ("$(OS)","NONE")
+  $(error OS type "$(UNAME)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
+endif
 
 # detect system architecture
 HOST_CPU ?= $(shell uname -m)
 NO_ASM ?= 1
+CPU := NONE
 ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","")
   CPU := X86
   ifeq ("$(BITS)", "32")
@@ -58,13 +63,17 @@ ifneq ("$(filter pentium i%86,$(HOST_CPU))","")
   CPU := X86
   ARCH_DETECTED := 32BITS
 endif
-ifneq ("$(filter ppc powerpc,$(HOST_CPU))","")
-  CPU := PPC
-  ARCH_DETECTED := 32BITS
-endif
-ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
-  CPU := PPC
-  ARCH_DETECTED := 64BITS
+# PPC doesn't work yet
+#ifneq ("$(filter ppc powerpc,$(HOST_CPU))","")
+#  CPU := PPC
+#  ARCH_DETECTED := 32BITS
+#endif
+#ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
+#  CPU := PPC
+#  ARCH_DETECTED := 64BITS
+#endif
+ifeq ("$(CPU)","NONE")
+  $(error CPU type "$(HOST_CPU)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
 endif
 
 # base CFLAGS, LIBS, and LDFLAGS
@@ -156,15 +165,14 @@ else
 endif
 
 # set shell function names
-CC      = gcc
-CXX     = g++
-LD      = g++
-INSTALL = install
-ifeq ($(OS),LINUX)
-  STRIP	= strip -s
-endif
+CC      ?= gcc
+CXX     ?= g++
+LD      ?= g++
+INSTALL ?= install
 ifeq ($(OS),OSX)
-  STRIP	= strip -x 
+  STRIP	?= strip -x 
+else
+  STRIP	?= strip -s
 endif
 
 # set special flags for given Makefile parameters
@@ -216,6 +224,7 @@ targets:
 	@echo "  Install Options:"
 	@echo "    PREFIX=path   == install/uninstall prefix (default: /usr/local)"
 	@echo "    LIBDIR=path   == path to install plugin libraries (default: PREFIX/lib/mupen64plus)"
+	@echo "    DESTDIR=path  == path to prepend to all installation paths (only for packagers)"
 	@echo "  Debugging Options:"
 	@echo "    DEBUG=1       == add debugging symbols"
 	@echo "    PLUGINDBG=1   == print extra debugging information while running"
@@ -223,11 +232,11 @@ targets:
 all: $(TARGET)
 
 install: $(TARGET)
-	$(INSTALL) -d -v "$(LIBDIR)"
-	$(INSTALL) -m 0644 $(TARGET) "$(LIBDIR)"
+	$(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
+	$(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
 
 uninstall:
-	rm -f "$(LIBDIR)/$(TARGET)"
+	rm -f "$(DESTDIR)$(LIBDIR)/$(TARGET)"
 
 clean:
 	rm -rf ./_obj/* $(TARGET)
diff --git a/src/autoconfig.c b/src/autoconfig.c
index 28c76f4..0b47fbc 100644
--- a/src/autoconfig.c
+++ b/src/autoconfig.c
@@ -22,7 +22,7 @@
 #include <string.h>
 
 #include "m64p_types.h"
-
+#include "osal_preproc.h"
 #include "autoconfig.h"
 #include "plugin.h"
 
@@ -34,13 +34,16 @@ enum eJoyType
     JOY_DRAGON_RISE,
     JOY_GASIA_GAMEPAD,
     JOY_GREEN_ASIA_USB,
+    JOY_JESS_TECH_ANALOG_PAD,
     JOY_LOGITECH_CORDLESS_RUMBLEPAD_2,
     JOY_LOGITECH_DUAL_ACTION,
     JOY_MEGA_WORLD_USB,
     JOY_MICROSOFT_XBOX_360,
+    JOY_XBOX_360_WIRELESS_RECEIVER,
     JOY_N64_CONTROLLER,
     JOY_SAITEK_P880,
-    JOY_SAITEK_P990
+    JOY_SAITEK_P990,
+    JOY_PS3_CONTROLLER
 };
 
 typedef struct
@@ -54,13 +57,16 @@ static sJoyConfigMap l_JoyConfigMap[] = {
     { "DragonRise Inc. Generic USB Joystick", JOY_DRAGON_RISE},
     { "Gasia Co.,Ltd PS(R) Gamepad",          JOY_GASIA_GAMEPAD},
     { "GreenAsia Inc. USB Joystick",          JOY_GREEN_ASIA_USB},
+    { "Jess Tech Dual Analog Pad",            JOY_JESS_TECH_ANALOG_PAD},
     { "Logitech Cordless Rumblepad 2",        JOY_LOGITECH_CORDLESS_RUMBLEPAD_2},
     { "Logitech Dual Action",                 JOY_LOGITECH_DUAL_ACTION},
     { "Mega World USB Game Controllers",      JOY_MEGA_WORLD_USB},
     { "Microsoft X-Box 360 pad",              JOY_MICROSOFT_XBOX_360},
+    { "Xbox 360 Wireless Receiver",           JOY_XBOX_360_WIRELESS_RECEIVER},
     { "N64 controller",                       JOY_N64_CONTROLLER},
     { "SAITEK P880",                          JOY_SAITEK_P880},
     { "Saitek P990 Dual Analog Pad",          JOY_SAITEK_P990},
+    { "Sony PLAYSTATION(R)3 Controller",      JOY_PS3_CONTROLLER},
     { "Keyboard",                             KBD_DEFAULT}
 };
 
@@ -86,8 +92,8 @@ static void set_model_defaults(int iCtrlIdx, int iDeviceIdx, enum eJoyType type)
             pCtrl->button[U_DPAD].key = SDLK_w;
             pCtrl->button[START_BUTTON].key = SDLK_RETURN;
             pCtrl->button[Z_TRIG].key = SDLK_z;
-            pCtrl->button[B_BUTTON].key = SDLK_LALT;
-            pCtrl->button[A_BUTTON].key = SDLK_LMETA;
+            pCtrl->button[B_BUTTON].key = SDLK_LCTRL;
+            pCtrl->button[A_BUTTON].key = SDLK_LSHIFT;
             pCtrl->button[R_CBUTTON].key = SDLK_l;
             pCtrl->button[L_CBUTTON].key = SDLK_j;
             pCtrl->button[D_CBUTTON].key = SDLK_k;
@@ -205,6 +211,29 @@ static void set_model_defaults(int iCtrlIdx, int iDeviceIdx, enum eJoyType type)
             pCtrl->axis[0].axis_dir_a = pCtrl->axis[1].axis_dir_a = -1;
             pCtrl->axis[0].axis_dir_b = pCtrl->axis[1].axis_dir_b = 1;
             break;
+        case JOY_JESS_TECH_ANALOG_PAD:
+            pCtrl->button[R_DPAD].hat = pCtrl->button[L_DPAD].hat = 0;
+            pCtrl->button[D_DPAD].hat = pCtrl->button[U_DPAD].hat = 0;
+            pCtrl->button[R_DPAD].hat_pos = SDL_HAT_RIGHT;
+            pCtrl->button[L_DPAD].hat_pos = SDL_HAT_LEFT;
+            pCtrl->button[D_DPAD].hat_pos = SDL_HAT_DOWN;
+            pCtrl->button[U_DPAD].hat_pos = SDL_HAT_UP;
+            pCtrl->button[START_BUTTON].button = 9;
+            pCtrl->button[Z_TRIG].button = 7;
+            pCtrl->button[B_BUTTON].button = 0;
+            pCtrl->button[A_BUTTON].button = 2;
+            pCtrl->button[R_CBUTTON].axis = pCtrl->button[L_CBUTTON].axis = 3;
+            pCtrl->button[D_CBUTTON].axis = pCtrl->button[U_CBUTTON].axis = 2;
+            pCtrl->button[R_CBUTTON].axis_dir = pCtrl->button[D_CBUTTON].axis_dir = 1;
+            pCtrl->button[L_CBUTTON].axis_dir = pCtrl->button[U_CBUTTON].axis_dir = -1;
+            pCtrl->button[R_TRIG].button = 6;
+            pCtrl->button[L_TRIG].button = 4;
+            /* no MEMPAK or RUMBLEPAK defined */
+            pCtrl->axis[0].axis_a = pCtrl->axis[0].axis_b = 0;
+            pCtrl->axis[1].axis_a = pCtrl->axis[1].axis_b = 1;
+            pCtrl->axis[0].axis_dir_a = pCtrl->axis[1].axis_dir_a = -1;
+            pCtrl->axis[0].axis_dir_b = pCtrl->axis[1].axis_dir_b = 1;
+            break;
         case JOY_LOGITECH_CORDLESS_RUMBLEPAD_2:
         case JOY_LOGITECH_DUAL_ACTION:
             pCtrl->button[R_DPAD].axis = pCtrl->button[L_DPAD].axis = 4;
@@ -277,6 +306,30 @@ static void set_model_defaults(int iCtrlIdx, int iDeviceIdx, enum eJoyType type)
             pCtrl->axis[0].axis_dir_a = pCtrl->axis[1].axis_dir_a = -1;
             pCtrl->axis[0].axis_dir_b = pCtrl->axis[1].axis_dir_b = 1;
             break;
+        case JOY_XBOX_360_WIRELESS_RECEIVER:
+            pCtrl->button[R_DPAD].button = 13;
+            pCtrl->button[L_DPAD].button = 12;
+            pCtrl->button[D_DPAD].button = 11;
+            pCtrl->button[U_DPAD].button = 10;
+            pCtrl->button[START_BUTTON].button = 6;
+            pCtrl->button[Z_TRIG].button = 4;
+            pCtrl->button[B_BUTTON].button = 2;
+            pCtrl->button[A_BUTTON].button = 0;
+            pCtrl->button[R_CBUTTON].axis = pCtrl->button[L_CBUTTON].axis = 3;
+            pCtrl->button[D_CBUTTON].axis = pCtrl->button[U_CBUTTON].axis = 4;
+            pCtrl->button[R_CBUTTON].axis_dir = pCtrl->button[D_CBUTTON].axis_dir = 1;
+            pCtrl->button[L_CBUTTON].axis_dir = pCtrl->button[U_CBUTTON].axis_dir = -1;
+            pCtrl->button[L_CBUTTON].button = 3;
+            pCtrl->button[D_CBUTTON].button = 1;
+            pCtrl->button[R_TRIG].axis = 5;
+            pCtrl->button[L_TRIG].axis = 2;
+            pCtrl->button[R_TRIG].axis_dir = pCtrl->button[L_TRIG].axis_dir = -1;
+            /* no MEMPAK or RUMBLEPAK defined */
+            pCtrl->axis[0].axis_a = pCtrl->axis[0].axis_b = 0;
+            pCtrl->axis[1].axis_a = pCtrl->axis[1].axis_b = 1;
+            pCtrl->axis[0].axis_dir_a = pCtrl->axis[1].axis_dir_a = -1;
+            pCtrl->axis[0].axis_dir_b = pCtrl->axis[1].axis_dir_b = 1;
+            break;
         case JOY_N64_CONTROLLER:
             pCtrl->button[R_DPAD].hat = pCtrl->button[L_DPAD].hat = 0;
             pCtrl->button[D_DPAD].hat = pCtrl->button[U_DPAD].hat = 0;
@@ -301,6 +354,27 @@ static void set_model_defaults(int iCtrlIdx, int iDeviceIdx, enum eJoyType type)
             pCtrl->axis[0].axis_dir_a = pCtrl->axis[1].axis_dir_a = -1;
             pCtrl->axis[0].axis_dir_b = pCtrl->axis[1].axis_dir_b = 1;
             break;
+        case JOY_PS3_CONTROLLER:
+            pCtrl->button[R_DPAD].button = 5; // D-Pad Right
+            pCtrl->button[L_DPAD].button = 7; // D-Pad Left
+            pCtrl->button[D_DPAD].button = 6; // D-Pad Down
+            pCtrl->button[U_DPAD].button = 4; // D-Pad Up
+            pCtrl->button[START_BUTTON].button = 3; // Start button
+            pCtrl->button[Z_TRIG].button = 8; // L2
+            pCtrl->button[B_BUTTON].button = 15; // Square
+            pCtrl->button[A_BUTTON].button = 14; // X
+            pCtrl->button[R_CBUTTON].axis = pCtrl->button[L_CBUTTON].axis = 2; // Right analog stick
+            pCtrl->button[D_CBUTTON].axis = pCtrl->button[U_CBUTTON].axis = 3;
+            pCtrl->button[R_CBUTTON].axis_dir = pCtrl->button[D_CBUTTON].axis_dir = 1;
+            pCtrl->button[L_CBUTTON].axis_dir = pCtrl->button[U_CBUTTON].axis_dir = -1;
+            pCtrl->button[R_TRIG].button = 11; // R1
+            pCtrl->button[L_TRIG].button = 10; // R2
+            /* no MEMPAK or RUMBLEPAK defined */
+            pCtrl->axis[0].axis_a = pCtrl->axis[0].axis_b = 0; // Left analog stick
+            pCtrl->axis[1].axis_a = pCtrl->axis[1].axis_b = 1;
+            pCtrl->axis[0].axis_dir_a = pCtrl->axis[1].axis_dir_a = -1;
+            pCtrl->axis[0].axis_dir_b = pCtrl->axis[1].axis_dir_b = 1;
+            break;
         case JOY_SAITEK_P880:
             pCtrl->button[R_DPAD].hat = pCtrl->button[L_DPAD].hat = 0;
             pCtrl->button[D_DPAD].hat = pCtrl->button[U_DPAD].hat = 0;
diff --git a/src/config.c b/src/config.c
index 96b879d..c9fdd44 100644
--- a/src/config.c
+++ b/src/config.c
@@ -25,6 +25,8 @@
 #include "m64p_plugin.h"
 #include "m64p_config.h"
 
+#include "osal_preproc.h"
+#include "autoconfig.h"
 #include "plugin.h"
 
 #define HAT_POS_NAME( hat )         \
@@ -106,6 +108,7 @@ static void clear_controller(int iCtrlIdx)
 static const char * get_sdl_joystick_name(int iCtrlIdx)
 {
     static char JoyName[256];
+    const char *joySDLName;
     int joyWasInit = SDL_WasInit(SDL_INIT_JOYSTICK);
     
     /* initialize the joystick subsystem if necessary */
@@ -117,7 +120,7 @@ static const char * get_sdl_joystick_name(int iCtrlIdx)
         }
 
     /* get the name of the corresponding joystick */
-    const char *joySDLName = SDL_JoystickName(iCtrlIdx);
+    joySDLName = SDL_JoystickName(iCtrlIdx);
 
     /* copy the name to our local string */
     if (joySDLName != NULL)
@@ -170,6 +173,7 @@ void save_controller_config(int iCtrlIdx)
     for (j = 0; j < X_AXIS; j++ )
     {
         const char *Help;
+        int len = 0;
         ParamString[0] = 0;
         if (controller[iCtrlIdx].button[j].key > 0)
         {
@@ -201,7 +205,7 @@ void save_controller_config(int iCtrlIdx)
         else
             Help = NULL;
         /* if last character is a space, chop it off */
-        int len = strlen(ParamString);
+        len = strlen(ParamString);
         if (len > 0 && ParamString[len-1] == ' ')
             ParamString[len-1] = 0;
         ConfigSetDefaultString(pConfig, button_names[j], ParamString, Help);
@@ -211,6 +215,7 @@ void save_controller_config(int iCtrlIdx)
     for (j = 0; j < 2; j++ )
     {
         const char *Help;
+        int len = 0;
         ParamString[0] = 0;
         if (controller[iCtrlIdx].axis[j].key_a > 0 && controller[iCtrlIdx].axis[j].key_b > 0)
         {
@@ -240,7 +245,7 @@ void save_controller_config(int iCtrlIdx)
         else
             Help = NULL;
         /* if last character is a space, chop it off */
-        int len = strlen(ParamString);
+        len = strlen(ParamString);
         if (len > 0 && ParamString[len-1] == ' ')
             ParamString[len-1] = 0;
         ConfigSetDefaultString(pConfig, button_names[X_AXIS + j], ParamString, Help);
@@ -254,6 +259,9 @@ void load_configuration(void)
     char SectionName[32];
     char input_str[256], value1_str[16], value2_str[16];
     const char *config_ptr;
+    const char *JoyName;
+    int joy_found = 0, joy_plugged = 0;
+    int readOK;
     int i, j;
 
     /* loop through all 4 simulated N64 controllers */
@@ -269,7 +277,6 @@ void load_configuration(void)
             continue;
         }
         /* try to read all of the configuration values */
-        int readOK;
         for (readOK = 0; readOK == 0; readOK = 1)
         {
             if (ConfigGetParameter(pConfig, "plugged", M64TYPE_INT, &controller[i].control.Present, sizeof(int)) != M64ERR_SUCCESS)
@@ -308,11 +315,12 @@ void load_configuration(void)
                 }
                 if ((config_ptr = strstr(input_str, "hat")) != NULL)
                 {
+                    char *lastchar = NULL;
                     if (sscanf(config_ptr, "hat(%i %15s", &controller[i].button[j].hat, value1_str) != 2)
                         DebugMessage(M64MSG_WARNING, "parsing error in hat() parameter of button '%s' for controller %i", button_names[j], i + 1);
                     value1_str[15] = 0;
                     /* chop off the last character of value1_str if it is the closing parenthesis */
-                    char *lastchar = &value1_str[strlen(value1_str) - 1];
+                    lastchar = &value1_str[strlen(value1_str) - 1];
                     if (lastchar > value1_str && *lastchar == ')') *lastchar = 0;
                     controller[i].button[j].hat_pos = get_hat_pos_by_name(value1_str);
                 }
@@ -345,11 +353,12 @@ void load_configuration(void)
                 }
                 if ((config_ptr = strstr(input_str, "hat")) != NULL)
                 {
+                    char *lastchar = NULL;
                     if (sscanf(config_ptr, "hat(%i %15s %15s", &controller[i].axis[axis_idx].hat, value1_str, value2_str) != 3)
                         DebugMessage(M64MSG_WARNING, "parsing error in hat() parameter of axis '%s' for controller %i", button_names[j], i + 1);
                     value1_str[15] = value2_str[15] = 0;
                     /* chop off the last character of value2_str if it is the closing parenthesis */
-                    char *lastchar = &value2_str[strlen(value2_str) - 1];
+                    lastchar = &value2_str[strlen(value2_str) - 1];
                     if (lastchar > value2_str && *lastchar == ')') *lastchar = 0;
                     controller[i].axis[axis_idx].hat_pos_a = get_hat_pos_by_name(value1_str);
                     controller[i].axis[axis_idx].hat_pos_b = get_hat_pos_by_name(value2_str);
@@ -359,7 +368,7 @@ void load_configuration(void)
                 break;
         }
 
-        const char *JoyName = get_sdl_joystick_name(i);
+        JoyName = get_sdl_joystick_name(i);
         if (!readOK || controller[i].device == DEVICE_AUTO)
         {
             /* reset the controller configuration again and load the defaults */
@@ -386,7 +395,7 @@ void load_configuration(void)
     }
 
     /* see how many joysticks were found */
-    int joy_found = 0, joy_plugged = 0;
+    joy_found = 0, joy_plugged = 0;
     for (i = 0; i < 4; i++)
     {
         if (controller[i].device >= 0 || controller[i].device == DEVICE_NOT_JOYSTICK)
diff --git a/src/osal_dynamiclib_win32.c b/src/osal_dynamiclib_win32.c
new file mode 100644
index 0000000..4455cee
--- /dev/null
+++ b/src/osal_dynamiclib_win32.c
@@ -0,0 +1,74 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *   Mupen64plus-ui-console - osal_dynamiclib_win32.c                      *
+ *   Mupen64Plus homepage: http://code.google.com/p/mupen64plus/           *
+ *   Copyright (C) 2009 Richard Goedeken                                   *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <windows.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "m64p_types.h"
+#include "osal_dynamiclib.h"
+
+m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibraryPath)
+{
+    if (pLibHandle == NULL || pccLibraryPath == NULL)
+        return M64ERR_INPUT_ASSERT;
+
+    *pLibHandle = LoadLibrary(pccLibraryPath);
+
+    if (*pLibHandle == NULL)
+    {
+        char *pchErrMsg;
+        DWORD dwErr = GetLastError(); 
+        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr,
+                      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pchErrMsg, 0, NULL);
+        fprintf(stderr, "LoadLibrary('%s') error: %s\n", pccLibraryPath, pchErrMsg);
+        LocalFree(pchErrMsg);
+        return M64ERR_INPUT_NOT_FOUND;
+    }
+
+    return M64ERR_SUCCESS;
+}
+
+void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName)
+{
+    if (pccProcedureName == NULL)
+        return NULL;
+
+    return GetProcAddress(LibHandle, pccProcedureName);
+}
+
+m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle)
+{
+    int rval = FreeLibrary(LibHandle);
+
+    if (rval == 0)
+    {
+        char *pchErrMsg;
+        DWORD dwErr = GetLastError(); 
+        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr,
+                      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pchErrMsg, 0, NULL);
+        fprintf(stderr, "FreeLibrary() error: %s\n", pchErrMsg);
+        LocalFree(pchErrMsg);
+        return M64ERR_INTERNAL;
+    }
+
+    return M64ERR_SUCCESS;
+}
diff --git a/src/version.h b/src/osal_preproc.h
similarity index 79%
copy from src/version.h
copy to src/osal_preproc.h
index 51bdc51..79e96a0 100644
--- a/src/version.h
+++ b/src/osal_preproc.h
@@ -1,7 +1,8 @@
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *   Mupen64plus-input-sdl - version.h                                     *
+ *   Mupen64plus - osal_preproc.h                                          *
  *   Mupen64Plus homepage: http://code.google.com/p/mupen64plus/           *
  *   Copyright (C) 2009 Richard Goedeken                                   *
+ *   Copyright (C) 2002 Hacktarux                                          *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
@@ -19,17 +20,14 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-/* This header file is for versioning information
- *
- */
+/* this header file is for system-dependent #defines, #includes, and typedefs */
 
-#if !defined(VERSION_H)
-#define VERSION_H
+#if !defined(OSAL_PREPROC_H)
+#define OSAL_PREPROC_H
 
-#define PLUGIN_NAME    "Mupen64Plus SDL Input Plugin"
-#define PLUGIN_VERSION 0x016301
-
-#define VERSION_PRINTF_SPLIT(x) (((x) >> 16) & 0xffff), (((x) >> 8) & 0xff), ((x) & 0xff)
-
-#endif /* #define VERSION_H */
+#if defined(WIN32)
+  #define strcasestr strstr
+  #define strcasecmp _stricmp
+#endif // WIN32
 
+#endif // OSAL_PREPROC_H
\ No newline at end of file
diff --git a/src/plugin.c b/src/plugin.c
index 643115c..39a1a58 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -411,6 +411,7 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
 {
     int b, axis_val;
     SDL_Event event;
+    unsigned char mstate;
 
     // Handle keyboard input first
     doSdlKeys(SDL_GetKeyState(NULL));
@@ -500,7 +501,7 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
     }
 
     // process mouse events
-    unsigned char mstate = SDL_GetMouseState( NULL, NULL );
+    mstate = SDL_GetMouseState( NULL, NULL );
     for( b = 0; b < 16; b++ )
     {
         if( controller[Control].button[b].mouse < 1 )
@@ -536,7 +537,7 @@ EXPORT void CALL GetKeys( int Control, BUTTONS *Keys )
     }
 
 #ifdef _DEBUG
-    DebugMessage(M64MSG_INFO, "Controller #%d value: 0x%8.8X\n", Control, *(int *)&controller[Control].buttons );
+    DebugMessage(M64MSG_VERBOSE, "Controller #%d value: 0x%8.8X\n", Control, *(int *)&controller[Control].buttons );
 #endif
     *Keys = controller[Control].buttons;
 
@@ -725,8 +726,9 @@ EXPORT void CALL InitiateControllers(CONTROL_INFO ControlInfo)
 EXPORT void CALL ReadController(int Control, unsigned char *Command)
 {
 #ifdef _DEBUG
-    DebugMessage(M64MSG_INFO, "Raw Read (cont=%d):  %02X %02X %02X %02X %02X %02X", Control,
-                 Command[0], Command[1], Command[2], Command[3], Command[4], Command[5]);
+    if (Command != NULL)
+        DebugMessage(M64MSG_INFO, "Raw Read (cont=%d):  %02X %02X %02X %02X %02X %02X", Control,
+                     Command[0], Command[1], Command[2], Command[3], Command[4], Command[5]);
 #endif
 }
 
diff --git a/src/version.h b/src/version.h
index 51bdc51..5fe782d 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 0x016301
+#define PLUGIN_VERSION 0x016302
 
 #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