From c4f4550cc97c93fd975b40f04450e2d54b682cc0 Mon Sep 17 00:00:00 2001 From: Alexey Pavlov Date: Wed, 1 Feb 2017 21:03:35 +0300 Subject: [PATCH] ois-git: Build from official repository. --- ...s-to-newer-version.-Allow-build-IOS-.patch | 172 ++++++++++++++++++ mingw-w64-ois-git/0002-Fix-macros-name.patch | 25 +++ ...ger-Cannot-have-pure-virtual-methods.patch | 25 +++ ...r-OIS-libraries-in-config-files.-Fix.patch | 130 +++++++++++++ mingw-w64-ois-git/0005-Fix-typo.patch | 28 +++ ...0006-Add-mingw-definitions-to-CFLAGS.patch | 27 +++ .../0007-Fix-source-file-name.patch | 28 +++ ...08-Add-macros-directory-to-configure.patch | 25 +++ ...use-to-use-GetDeviceState-instead-of.patch | 141 ++++++++++++++ mingw-w64-ois-git/0010-Unicode-fix.patch | 34 ++++ mingw-w64-ois-git/PKGBUILD | 38 +++- 11 files changed, 669 insertions(+), 4 deletions(-) create mode 100644 mingw-w64-ois-git/0001-Upgrade-autotools-to-newer-version.-Allow-build-IOS-.patch create mode 100644 mingw-w64-ois-git/0002-Fix-macros-name.patch create mode 100644 mingw-w64-ois-git/0003-InputManager-Cannot-have-pure-virtual-methods.patch create mode 100644 mingw-w64-ois-git/0004-Substitute-proper-OIS-libraries-in-config-files.-Fix.patch create mode 100644 mingw-w64-ois-git/0005-Fix-typo.patch create mode 100644 mingw-w64-ois-git/0006-Add-mingw-definitions-to-CFLAGS.patch create mode 100644 mingw-w64-ois-git/0007-Fix-source-file-name.patch create mode 100644 mingw-w64-ois-git/0008-Add-macros-directory-to-configure.patch create mode 100644 mingw-w64-ois-git/0009-Switched-Win32Mouse-to-use-GetDeviceState-instead-of.patch create mode 100644 mingw-w64-ois-git/0010-Unicode-fix.patch diff --git a/mingw-w64-ois-git/0001-Upgrade-autotools-to-newer-version.-Allow-build-IOS-.patch b/mingw-w64-ois-git/0001-Upgrade-autotools-to-newer-version.-Allow-build-IOS-.patch new file mode 100644 index 0000000000..40b897b1af --- /dev/null +++ b/mingw-w64-ois-git/0001-Upgrade-autotools-to-newer-version.-Allow-build-IOS-.patch @@ -0,0 +1,172 @@ +From 869430a4c3fa1a10eed97b076fad636ae2644304 Mon Sep 17 00:00:00 2001 +From: Alexpux +Date: Mon, 17 Nov 2014 07:39:06 +0300 +Subject: [PATCH 01/10] Upgrade autotools to newer version. Allow build IOS + with autotools for mingw target. + +--- + Makefile.am | 2 ++ + configure.ac | 46 +++++++++++++++++++++++++++++++++++++++++----- + demos/Makefile.am | 24 ++++++++++++++++++++---- + src/Makefile.am | 31 ++++++++++++++++++++++++++++++- + 4 files changed, 93 insertions(+), 10 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index e53bfb6..d281118 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -1,3 +1,5 @@ ++ACLOCAL_AMFLAGS = -I m4 ++ + SUBDIRS = src includes + + pkgconfigdir = $(libdir)/pkgconfig +diff --git a/configure.ac b/configure.ac +index 37386ba..36ad204 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1,11 +1,20 @@ + # -*- Autoconf -*- + # Process this file with autoconf to produce a configure script. +-AC_PREREQ(2.50) ++AC_PREREQ(2.69) + AC_INIT( [OIS], 1.4.0 ) + + AC_CANONICAL_TARGET +-AM_INIT_AUTOMAKE( [OIS], 1.4.0 ) +-AM_CONFIG_HEADER([includes/config.h]) ++AM_INIT_AUTOMAKE ++AM_CONFIG_HEADERS([includes/config.h]) ++AC_CONFIG_MACRO_DIR([m4]) ++ ++case "$host" in ++ *-*-mingw*|*-*-cygwin*) ++ lt_cv_deplibs_check_method='pass_all' ++ ;; ++esac ++ ++LT_INIT + + dnl Check for programs + AC_PROG_CC +@@ -21,8 +30,35 @@ CFLAGS="$CFLAGS" + CXXFLAGS="$CXXFLAGS" + LIBS="$LIBS" + +-dnl Detect X11 +-AC_CHECK_HEADERS([X11/Xlib.h],, [AC_MSG_ERROR("Xlib.h not found - libx11-dev")]) ++case "$host" in ++ *-*-mingw*|*-*-cygwin*) ++ AC_DEFINE(PLATFORM_WIN32, 1, [Platform is Win32]) ++ AM_CONDITIONAL([PLATFORM_WIN32], [test xtest = xtest]) ++ AM_CONDITIONAL([PLATFORM_LINUX], [test xno = xtest]) ++ AM_CONDITIONAL([PLATFORM_APPLE], [test xno = xtest]) ++ PLATFORM_STRING="Win32" ++ ;; ++ *-*-linux*) ++ AC_DEFINE(PLATFORM_LINUX, 1, [Platform is Linux]) ++ PLATFORM_STRING="Linux" ++ AM_CONDITIONAL([PLATFORM_WIN32], [test xno = xtest]) ++ AM_CONDITIONAL([PLATFORM_LINUX], [test xtest = xtest]) ++ AM_CONDITIONAL([PLATFORM_APPLE], [test xno = xtest]) ++ dnl Detect X11 ++ AC_CHECK_HEADERS([X11/Xaw/Command.h],, [AC_MSG_ERROR("libxaw headers not found")]) ++ ;; ++ *-*-darwin*) ++ AC_MSG_WARN([Hello]) ++ AC_DEFINE(PLATFORM_APPLE, 1, [Platform is Apple]) ++ PLATFORM_STRING="Apple" ++ AM_CONDITIONAL([PLATFORM_WIN32], [test xno = xtest]) ++ AM_CONDITIONAL([PLATFORM_LINUX], [test xno = xtest]) ++ AM_CONDITIONAL([PLATFORM_APPLE], [test xtest = xtest]) ++ ;; ++ *) ++ AC_MSG_WARN([*** Please add $host to configure.ac checks!]) ++ ;; ++esac + + dnl Added for BSD's + AC_PROG_LIBTOOL +diff --git a/demos/Makefile.am b/demos/Makefile.am +index 690e81e..9efca66 100644 +--- a/demos/Makefile.am ++++ b/demos/Makefile.am +@@ -1,11 +1,27 @@ +-INCLUDES = $(STLPORT_CFLAGS) -I$(top_srcdir)/includes $(CFLAGS) -I/usr/X11R6/include ++if PLATFORM_LINUX ++AM_CPPFLAGS = $(STLPORT_CFLAGS) -I$(top_srcdir)/includes $(CFLAGS) -I/usr/X11R6/include ++endif ++ ++if PLATFORM_WIN32 ++AM_CPPFLAGS = $(STLPORT_CFLAGS) -I$(top_srcdir)/includes -I$(top_srcdir)/Win32/CommandLine $(CFLAGS) ++endif + + noinst_PROGRAMS = ConsoleApp FFConsoleTest + +-ConsoleApp_SOURCES = OISConsole.cpp +-ConsoleApp_LDFLAGS = -L$(top_builddir)/src ++if PLATFORM_WIN32 ++ConsoleApp_SOURCES = OISConsole.cppZZ $(top_srcdir)/Win32/CommandLine/CommandLine.rc ++ConsoleApp_LDADD = -lOIS -ldinput8 -ldxguid -lole32 -loleaut32 -luser32 ++else ++ConsoleApp_SOURCES = OISConsole.cppZZ + ConsoleApp_LDADD = -lOIS ++endif ++ConsoleApp_LDFLAGS = -L$(top_builddir)/src + ++if PLATFORM_WIN32 ++FFConsoleTest_SOURCES = FFConsoleDemo.cpp $(top_srcdir)/Win32/DemoFFTest/FF.rc ++FFConsoleTest_LDADD = -lOIS -ldinput8 -ldxguid -lole32 -loleaut32 -luser32 ++else + FFConsoleTest_SOURCES = FFConsoleDemo.cpp +-FFConsoleTest_LDFLAGS = -L$(top_builddir)/src + FFConsoleTest_LDADD = -lOIS ++endif ++FFConsoleTest_LDFLAGS = -L$(top_builddir)/src +diff --git a/src/Makefile.am b/src/Makefile.am +index 83892d2..f24f100 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -1,4 +1,6 @@ +-INCLUDES = $(STLPORT_CFLAGS) -I$(top_srcdir)/includes $(CFLAGS) -I/usr/X11R6/include ++if PLATFORM_LINUX ++ ++AM_CPPFLAGS = $(STLPORT_CFLAGS) -I$(top_srcdir)/includes $(CFLAGS) -I/usr/X11R6/include + + + +@@ -22,4 +24,31 @@ libOIS_la_LDFLAGS = -release @PACKAGE_VERSION@ + + libOIS_la_LIBADD = $(STLPORT_LIBS) -L/usr/X11R6/lib -lX11 + ++endif ++ ++if PLATFORM_WIN32 ++ ++AM_CPPFLAGS = $(STLPORT_CFLAGS) -I$(top_srcdir)/includes $(CFLAGS) -DWIN32 -DOIS_DYNAMIC_LIB -DOIS_NONCLIENT_BUILD ++ ++lib_LTLIBRARIES=libOIS.la ++libOIS_la_SOURCES = OISInputManager.cpp \ ++ OISObject.cpp \ ++ OISEffect.cpp \ ++ OISJoyStick.cpp \ ++ OISKeyboard.cpp \ ++ OISForceFeedback.cpp \ ++ OISException.cpp \ ++ ./win32/Win32InputManager.cpp \ ++ ./win32/Win32JoyStick.cpp \ ++ ./win32/Win32ForceFeedback.cpp \ ++ ./win32/Win32KeyBoard.cpp \ ++ ./win32/Win32Mouse.cpp ++ ++libOIS_la_LDFLAGS = -Wl,--enable-auto-image-base -Wl,--add-stdcall-alias -Wl,--out-implib,libOIS.dll.a -no-undefined -release @PACKAGE_VERSION@ ++#libOIS_la_LDFLAGS = -version-info $(shell echo "@PACKAGE_VERSION@" | tr '.' ':') ++ ++libOIS_la_LIBADD = $(STLPORT_LIBS) -ldinput8 -ldxguid -lole32 -loleaut32 -luser32 ++ ++endif ++ + #eof "$Id: Makefile.am,v 1.15.2.1 2008/02/14 03:33:36 pjcast Exp $" +-- +2.9.0 + diff --git a/mingw-w64-ois-git/0002-Fix-macros-name.patch b/mingw-w64-ois-git/0002-Fix-macros-name.patch new file mode 100644 index 0000000000..8bfb05c3a1 --- /dev/null +++ b/mingw-w64-ois-git/0002-Fix-macros-name.patch @@ -0,0 +1,25 @@ +From ad8df954ac5396b6d14e10c1f630a3bf5d61a16e Mon Sep 17 00:00:00 2001 +From: Alexpux +Date: Mon, 17 Nov 2014 07:50:04 +0300 +Subject: [PATCH 02/10] Fix macros name + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 36ad204..b1a338d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -5,7 +5,7 @@ AC_INIT( [OIS], 1.4.0 ) + + AC_CANONICAL_TARGET + AM_INIT_AUTOMAKE +-AM_CONFIG_HEADERS([includes/config.h]) ++AC_CONFIG_HEADERS([includes/config.h]) + AC_CONFIG_MACRO_DIR([m4]) + + case "$host" in +-- +2.9.0 + diff --git a/mingw-w64-ois-git/0003-InputManager-Cannot-have-pure-virtual-methods.patch b/mingw-w64-ois-git/0003-InputManager-Cannot-have-pure-virtual-methods.patch new file mode 100644 index 0000000000..787ac363f7 --- /dev/null +++ b/mingw-w64-ois-git/0003-InputManager-Cannot-have-pure-virtual-methods.patch @@ -0,0 +1,25 @@ +From 4d621d46f8c0c7f3ea7381a85f6d1f7aff8f5900 Mon Sep 17 00:00:00 2001 +From: Alexpux +Date: Mon, 17 Nov 2014 08:42:32 +0300 +Subject: [PATCH 03/10] InputManager: Cannot have pure virtual methods. + +--- + includes/OISInputManager.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/includes/OISInputManager.h b/includes/OISInputManager.h +index 6794510..a17f244 100644 +--- a/includes/OISInputManager.h ++++ b/includes/OISInputManager.h +@@ -171,7 +171,7 @@ namespace OIS + @remarks + Called from createInputSystem, gives derived input class a chance to setup after it is created + */ +- virtual void _initialize(ParamList ¶mList) = 0; ++ virtual void _initialize(ParamList ¶mList) {}; + + /** + @remarks +-- +2.9.0 + diff --git a/mingw-w64-ois-git/0004-Substitute-proper-OIS-libraries-in-config-files.-Fix.patch b/mingw-w64-ois-git/0004-Substitute-proper-OIS-libraries-in-config-files.-Fix.patch new file mode 100644 index 0000000000..fdc25dcdc6 --- /dev/null +++ b/mingw-w64-ois-git/0004-Substitute-proper-OIS-libraries-in-config-files.-Fix.patch @@ -0,0 +1,130 @@ +From 153a2dfa41b950aa1b17d4487df3e5b895bc4c37 Mon Sep 17 00:00:00 2001 +From: Alexpux +Date: Mon, 17 Nov 2014 10:46:12 +0300 +Subject: [PATCH 04/10] Substitute proper OIS libraries in config files. Fix + defines for mingw. + +--- + OIS.pc.in | 2 +- + configure.ac | 12 +++++++++++- + demos/Makefile.am | 6 ++---- + src/Makefile.am | 8 ++++---- + 4 files changed, 18 insertions(+), 10 deletions(-) + +diff --git a/OIS.pc.in b/OIS.pc.in +index aab0b7a..d68284c 100644 +--- a/OIS.pc.in ++++ b/OIS.pc.in +@@ -6,6 +6,6 @@ includedir=@includedir@ + Name: OIS + Description: Cross platform C++ Input Framework + Version: @VERSION@ +-Libs: -L${libdir} -lOIS ++Libs: -L${libdir} @OIS_LIBS@ + Cflags: -I${includedir}/@PACKAGE@ -I${includedir} + +diff --git a/configure.ac b/configure.ac +index b1a338d..24374fc 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -29,6 +29,8 @@ OIS_USE_STLPORT + CFLAGS="$CFLAGS" + CXXFLAGS="$CXXFLAGS" + LIBS="$LIBS" ++OIS_LIBS="-lOIS" ++DX_LIBS="$DX_LIBS" + + case "$host" in + *-*-mingw*|*-*-cygwin*) +@@ -37,6 +39,12 @@ case "$host" in + AM_CONDITIONAL([PLATFORM_LINUX], [test xno = xtest]) + AM_CONDITIONAL([PLATFORM_APPLE], [test xno = xtest]) + PLATFORM_STRING="Win32" ++ DX_LIBS="-ldinput8 -ldxguid -lole32 -loleaut32 -luser32" ++ OIS_LIBS="$OIS_LIBS $DX_LIBS" ++ if test "${enable_shared}" = yes; then ++ AC_DEFINE([OIS_DYNAMIC_LIB], [], [Import settings for Win32]);; ++ fi ++ AC_DEFINE([OIS_NONCLIENT_BUILD], [], [Export settings for Win32]);; + ;; + *-*-linux*) + AC_DEFINE(PLATFORM_LINUX, 1, [Platform is Linux]) +@@ -45,7 +53,7 @@ case "$host" in + AM_CONDITIONAL([PLATFORM_LINUX], [test xtest = xtest]) + AM_CONDITIONAL([PLATFORM_APPLE], [test xno = xtest]) + dnl Detect X11 +- AC_CHECK_HEADERS([X11/Xaw/Command.h],, [AC_MSG_ERROR("libxaw headers not found")]) ++ AC_CHECK_HEADERS([X11/Xlib.h],, [AC_MSG_ERROR("Xlib.h not found - libx11-dev")]) + ;; + *-*-darwin*) + AC_MSG_WARN([Hello]) +@@ -59,6 +67,8 @@ case "$host" in + AC_MSG_WARN([*** Please add $host to configure.ac checks!]) + ;; + esac ++AC_SUBST(OIS_LIBS) ++AC_SUBST(DX_LIBS) + + dnl Added for BSD's + AC_PROG_LIBTOOL +diff --git a/demos/Makefile.am b/demos/Makefile.am +index 9efca66..f62b5a4 100644 +--- a/demos/Makefile.am ++++ b/demos/Makefile.am +@@ -10,18 +10,16 @@ noinst_PROGRAMS = ConsoleApp FFConsoleTest + + if PLATFORM_WIN32 + ConsoleApp_SOURCES = OISConsole.cppZZ $(top_srcdir)/Win32/CommandLine/CommandLine.rc +-ConsoleApp_LDADD = -lOIS -ldinput8 -ldxguid -lole32 -loleaut32 -luser32 + else + ConsoleApp_SOURCES = OISConsole.cppZZ +-ConsoleApp_LDADD = -lOIS + endif + ConsoleApp_LDFLAGS = -L$(top_builddir)/src ++ConsoleApp_LDADD = @OIS_LIBS@ + + if PLATFORM_WIN32 + FFConsoleTest_SOURCES = FFConsoleDemo.cpp $(top_srcdir)/Win32/DemoFFTest/FF.rc +-FFConsoleTest_LDADD = -lOIS -ldinput8 -ldxguid -lole32 -loleaut32 -luser32 + else + FFConsoleTest_SOURCES = FFConsoleDemo.cpp +-FFConsoleTest_LDADD = -lOIS + endif + FFConsoleTest_LDFLAGS = -L$(top_builddir)/src ++FFConsoleTest_LDADD = @OIS_LIBS@ +diff --git a/src/Makefile.am b/src/Makefile.am +index f24f100..6ad108e 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -14,8 +14,8 @@ libOIS_la_SOURCES = OISInputManager.cpp \ + OISException.cpp \ + ./linux/EventHelpers.cpp \ + ./linux/LinuxInputManager.cpp \ +- ./linux/LinuxJoyStickEvents.cpp \ +- ./linux/LinuxForceFeedback.cpp \ ++ ./linux/LinuxJoyStickEvents.cpp \ ++ ./linux/LinuxForceFeedback.cpp \ + ./linux/LinuxKeyboard.cpp \ + ./linux/LinuxMouse.cpp + +@@ -28,7 +28,7 @@ endif + + if PLATFORM_WIN32 + +-AM_CPPFLAGS = $(STLPORT_CFLAGS) -I$(top_srcdir)/includes $(CFLAGS) -DWIN32 -DOIS_DYNAMIC_LIB -DOIS_NONCLIENT_BUILD ++AM_CPPFLAGS = $(STLPORT_CFLAGS) -I$(top_srcdir)/includes $(CFLAGS) + + lib_LTLIBRARIES=libOIS.la + libOIS_la_SOURCES = OISInputManager.cpp \ +@@ -47,7 +47,7 @@ libOIS_la_SOURCES = OISInputManager.cpp \ + libOIS_la_LDFLAGS = -Wl,--enable-auto-image-base -Wl,--add-stdcall-alias -Wl,--out-implib,libOIS.dll.a -no-undefined -release @PACKAGE_VERSION@ + #libOIS_la_LDFLAGS = -version-info $(shell echo "@PACKAGE_VERSION@" | tr '.' ':') + +-libOIS_la_LIBADD = $(STLPORT_LIBS) -ldinput8 -ldxguid -lole32 -loleaut32 -luser32 ++libOIS_la_LIBADD = $(STLPORT_LIBS) @DX_LIBS@ + + endif + +-- +2.9.0 + diff --git a/mingw-w64-ois-git/0005-Fix-typo.patch b/mingw-w64-ois-git/0005-Fix-typo.patch new file mode 100644 index 0000000000..3a47b754c1 --- /dev/null +++ b/mingw-w64-ois-git/0005-Fix-typo.patch @@ -0,0 +1,28 @@ +From 6472f08a3284d80562d0355e24537b773af5e1e4 Mon Sep 17 00:00:00 2001 +From: Alexpux +Date: Mon, 17 Nov 2014 10:54:57 +0300 +Subject: [PATCH 05/10] Fix typo. + +--- + configure.ac | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 24374fc..c9dfccd 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -42,9 +42,9 @@ case "$host" in + DX_LIBS="-ldinput8 -ldxguid -lole32 -loleaut32 -luser32" + OIS_LIBS="$OIS_LIBS $DX_LIBS" + if test "${enable_shared}" = yes; then +- AC_DEFINE([OIS_DYNAMIC_LIB], [], [Import settings for Win32]);; ++ AC_DEFINE([OIS_DYNAMIC_LIB], [], [Import settings for Win32]) + fi +- AC_DEFINE([OIS_NONCLIENT_BUILD], [], [Export settings for Win32]);; ++ AC_DEFINE([OIS_NONCLIENT_BUILD], [], [Export settings for Win32]) + ;; + *-*-linux*) + AC_DEFINE(PLATFORM_LINUX, 1, [Platform is Linux]) +-- +2.9.0 + diff --git a/mingw-w64-ois-git/0006-Add-mingw-definitions-to-CFLAGS.patch b/mingw-w64-ois-git/0006-Add-mingw-definitions-to-CFLAGS.patch new file mode 100644 index 0000000000..9afb88c8ed --- /dev/null +++ b/mingw-w64-ois-git/0006-Add-mingw-definitions-to-CFLAGS.patch @@ -0,0 +1,27 @@ +From c6bdc14163d3a48cffed0ad652405ab9781a9939 Mon Sep 17 00:00:00 2001 +From: Alexpux +Date: Mon, 17 Nov 2014 11:06:04 +0300 +Subject: [PATCH 06/10] Add mingw definitions to CFLAGS. + +--- + configure.ac | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/configure.ac b/configure.ac +index c9dfccd..91ead1c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -43,8 +43,10 @@ case "$host" in + OIS_LIBS="$OIS_LIBS $DX_LIBS" + if test "${enable_shared}" = yes; then + AC_DEFINE([OIS_DYNAMIC_LIB], [], [Import settings for Win32]) ++ CFLAGS="$CFLAGS -DOIS_DYNAMIC_LIB" + fi + AC_DEFINE([OIS_NONCLIENT_BUILD], [], [Export settings for Win32]) ++ CFLAGS="$CFLAGS -DOIS_NONCLIENT_BUILD" + ;; + *-*-linux*) + AC_DEFINE(PLATFORM_LINUX, 1, [Platform is Linux]) +-- +2.9.0 + diff --git a/mingw-w64-ois-git/0007-Fix-source-file-name.patch b/mingw-w64-ois-git/0007-Fix-source-file-name.patch new file mode 100644 index 0000000000..44f5874ac6 --- /dev/null +++ b/mingw-w64-ois-git/0007-Fix-source-file-name.patch @@ -0,0 +1,28 @@ +From 83749dc311254ccc47d333c700d9f99de83464a5 Mon Sep 17 00:00:00 2001 +From: Alexpux +Date: Mon, 17 Nov 2014 11:23:46 +0300 +Subject: [PATCH 07/10] Fix source file name. + +--- + demos/Makefile.am | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/demos/Makefile.am b/demos/Makefile.am +index f62b5a4..9a73a3c 100644 +--- a/demos/Makefile.am ++++ b/demos/Makefile.am +@@ -9,9 +9,9 @@ endif + noinst_PROGRAMS = ConsoleApp FFConsoleTest + + if PLATFORM_WIN32 +-ConsoleApp_SOURCES = OISConsole.cppZZ $(top_srcdir)/Win32/CommandLine/CommandLine.rc ++ConsoleApp_SOURCES = OISConsole.cpp $(top_srcdir)/Win32/CommandLine/CommandLine.rc + else +-ConsoleApp_SOURCES = OISConsole.cppZZ ++ConsoleApp_SOURCES = OISConsole.cpp + endif + ConsoleApp_LDFLAGS = -L$(top_builddir)/src + ConsoleApp_LDADD = @OIS_LIBS@ +-- +2.9.0 + diff --git a/mingw-w64-ois-git/0008-Add-macros-directory-to-configure.patch b/mingw-w64-ois-git/0008-Add-macros-directory-to-configure.patch new file mode 100644 index 0000000000..1a305d3b01 --- /dev/null +++ b/mingw-w64-ois-git/0008-Add-macros-directory-to-configure.patch @@ -0,0 +1,25 @@ +From 90ea5b77d56c4a9b833dc37c9dcb8d0db2193262 Mon Sep 17 00:00:00 2001 +From: Alexpux +Date: Tue, 18 Nov 2014 00:04:14 +0300 +Subject: [PATCH 08/10] Add macros directory to configure. + +--- + configure.ac | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 91ead1c..16888ed 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3,6 +3,8 @@ + AC_PREREQ(2.69) + AC_INIT( [OIS], 1.4.0 ) + ++AC_CONFIG_MACRO_DIR([m4]) ++ + AC_CANONICAL_TARGET + AM_INIT_AUTOMAKE + AC_CONFIG_HEADERS([includes/config.h]) +-- +2.9.0 + diff --git a/mingw-w64-ois-git/0009-Switched-Win32Mouse-to-use-GetDeviceState-instead-of.patch b/mingw-w64-ois-git/0009-Switched-Win32Mouse-to-use-GetDeviceState-instead-of.patch new file mode 100644 index 0000000000..90d9b52423 --- /dev/null +++ b/mingw-w64-ois-git/0009-Switched-Win32Mouse-to-use-GetDeviceState-instead-of.patch @@ -0,0 +1,141 @@ +From 45ce839be2ee10757270ab68b757e28e83b8a3c0 Mon Sep 17 00:00:00 2001 +From: Alexpux +Date: Tue, 18 Nov 2014 00:05:31 +0300 +Subject: [PATCH 09/10] Switched Win32Mouse to use GetDeviceState instead of + GetDeviceData. Fixes unreliable click state when changing focus with + FOREGROUND and NON_EXCLUSIVE states. + +--- + includes/win32/Win32Mouse.h | 2 +- + src/win32/Win32Mouse.cpp | 67 ++++++++++----------------------------------- + 2 files changed, 16 insertions(+), 53 deletions(-) + +diff --git a/includes/win32/Win32Mouse.h b/includes/win32/Win32Mouse.h +index 972267f..e24f76c 100644 +--- a/includes/win32/Win32Mouse.h ++++ b/includes/win32/Win32Mouse.h +@@ -47,7 +47,7 @@ namespace OIS + virtual void _initialize(); + + protected: +- bool _doMouseClick( int mouseButton, DIDEVICEOBJECTDATA& di ); ++ bool _doMouseClick( int mouseButton, unsigned char di ); + + IDirectInput8* mDirectInput; + IDirectInputDevice8* mMouse; +diff --git a/src/win32/Win32Mouse.cpp b/src/win32/Win32Mouse.cpp +index 10f2c2d..2e59cc9 100644 +--- a/src/win32/Win32Mouse.cpp ++++ b/src/win32/Win32Mouse.cpp +@@ -70,6 +70,8 @@ void Win32Mouse::_initialize() + HRESULT hr = mMouse->Acquire(); + if (FAILED(hr) && hr != DIERR_OTHERAPPHASPRIO) + OIS_EXCEPT( E_General, "Win32Mouse::Win32Mouse >> Failed to aquire mouse!" ); ++ ++ mMouse->SetDataFormat(&c_dfDIMouse2); + } + + //--------------------------------------------------------------------------------------------------// +@@ -91,17 +93,17 @@ void Win32Mouse::capture() + //Clear old relative values + mState.X.rel = mState.Y.rel = mState.Z.rel = 0; + +- DIDEVICEOBJECTDATA diBuff[MOUSE_DX_BUFFERSIZE]; ++ DIMOUSESTATE2 mouseState; + DWORD entries = MOUSE_DX_BUFFERSIZE; + +- HRESULT hr = mMouse->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), diBuff, &entries, 0 ); ++ HRESULT hr = mMouse->GetDeviceState( sizeof(DIMOUSESTATE2), &mouseState); + if( hr != DI_OK ) + { + hr = mMouse->Acquire(); + while( hr == DIERR_INPUTLOST ) + hr = mMouse->Acquire(); + +- hr = mMouse->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), diBuff, &entries, 0 ); ++ hr = mMouse->GetDeviceState( sizeof(DIMOUSESTATE2), &mouseState); + + //Perhaps the user just tabbed away, and coop settings + //are nonexclusive..so just ignore +@@ -109,52 +111,13 @@ void Win32Mouse::capture() + return; + } + +- bool axesMoved = false; +- //Accumulate all axis movements for one axesMove message.. +- //Buttons are fired off as they are found +- for(unsigned int i = 0; i < entries; ++i ) +- { +- switch( diBuff[i].dwOfs ) +- { +- case DIMOFS_BUTTON0: +- if(!_doMouseClick(0, diBuff[i])) return; +- break; +- case DIMOFS_BUTTON1: +- if(!_doMouseClick(1, diBuff[i])) return; +- break; +- case DIMOFS_BUTTON2: +- if(!_doMouseClick(2, diBuff[i])) return; +- break; +- case DIMOFS_BUTTON3: +- if(!_doMouseClick(3, diBuff[i])) return; +- break; +- case DIMOFS_BUTTON4: +- if(!_doMouseClick(4, diBuff[i])) return; +- break; +- case DIMOFS_BUTTON5: +- if(!_doMouseClick(5, diBuff[i])) return; +- break; +- case DIMOFS_BUTTON6: +- if(!_doMouseClick(6, diBuff[i])) return; +- break; +- case DIMOFS_BUTTON7: +- if(!_doMouseClick(7, diBuff[i])) return; +- break; +- case DIMOFS_X: +- mState.X.rel += diBuff[i].dwData; +- axesMoved = true; +- break; +- case DIMOFS_Y: +- mState.Y.rel += diBuff[i].dwData; +- axesMoved = true; +- break; +- case DIMOFS_Z: +- mState.Z.rel += diBuff[i].dwData; +- axesMoved = true; +- break; +- default: break; +- } //end switch +- }//end for ++ mState.X.rel = mouseState.lX; ++ mState.Y.rel = mouseState.lY; ++ mState.Z.rel = mouseState.lZ; ++ for (unsigned int i=0;i<8;i++) ++ if(!_doMouseClick(i, mouseState.rgbButtons[i])) return; ++ ++ bool axesMoved = mouseState.lX != 0 || mouseState.lY != 0 || mouseState.lZ != 0; + + if( axesMoved ) + { +@@ -191,15 +154,15 @@ void Win32Mouse::capture() + } + + //--------------------------------------------------------------------------------------------------// +-bool Win32Mouse::_doMouseClick( int mouseButton, DIDEVICEOBJECTDATA& di ) ++bool Win32Mouse::_doMouseClick( int mouseButton, unsigned char di ) + { +- if( di.dwData & 0x80 ) ++ if( di & 0x80 && !mState.buttonDown((MouseButtonID)mouseButton) ) + { + mState.buttons |= 1 << mouseButton; //turn the bit flag on + if( mListener && mBuffered ) + return mListener->mousePressed( MouseEvent( this, mState ), (MouseButtonID)mouseButton ); + } +- else ++ else if (!(di & 0x80) && mState.buttonDown((MouseButtonID)mouseButton)) + { + mState.buttons &= ~(1 << mouseButton); //turn the bit flag off + if( mListener && mBuffered ) +-- +2.9.0 + diff --git a/mingw-w64-ois-git/0010-Unicode-fix.patch b/mingw-w64-ois-git/0010-Unicode-fix.patch new file mode 100644 index 0000000000..fc7f78f6d8 --- /dev/null +++ b/mingw-w64-ois-git/0010-Unicode-fix.patch @@ -0,0 +1,34 @@ +From 3aab5a996a39da6a4b591fec2c22699cb057b5cd Mon Sep 17 00:00:00 2001 +From: Alexpux +Date: Tue, 18 Nov 2014 00:05:50 +0300 +Subject: [PATCH 10/10] Unicode fix. + +--- + src/win32/Win32InputManager.cpp | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/src/win32/Win32InputManager.cpp b/src/win32/Win32InputManager.cpp +index fedc5ee..17df9b0 100644 +--- a/src/win32/Win32InputManager.cpp ++++ b/src/win32/Win32InputManager.cpp +@@ -152,7 +152,17 @@ BOOL CALLBACK Win32InputManager::_DIEnumDevCallback(LPCDIDEVICEINSTANCE lpddi, L + jsInfo.isXInput = false; + jsInfo.productGuid = lpddi->guidProduct; + jsInfo.deviceID = lpddi->guidInstance; ++#if UNICODE ++ //convert from wide char to narrow char array ++ char ch[260]; ++ char pDefaultChar = ' '; ++ WideCharToMultiByte(CP_ACP,0,lpddi->tszInstanceName,-1, ch,260,&pDefaultChar, NULL); ++ ++ //A std:string using the char* constructor. ++ std::string ss(ch); ++#else + jsInfo.vendor = lpddi->tszInstanceName; ++#endif + jsInfo.devId = _this_->joySticks; + + _this_->joySticks++; +-- +2.9.0 + diff --git a/mingw-w64-ois-git/PKGBUILD b/mingw-w64-ois-git/PKGBUILD index d64ef5c26c..b46a7f8f2e 100644 --- a/mingw-w64-ois-git/PKGBUILD +++ b/mingw-w64-ois-git/PKGBUILD @@ -4,11 +4,11 @@ _realname=ois pkgbase=mingw-w64-${_realname}-git pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-git" _base_ver=1.4.0 -pkgver=1.4.0.68.af406d9 +pkgver=1.4.0.50.6129c0a pkgrel=1 provides=("${MINGW_PACKAGE_PREFIX}-${_realname}") conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}") -replaces="${MINGW_PACKAGE_PREFIX}-${_realname}" +replaces=("${MINGW_PACKAGE_PREFIX}-${_realname}") pkgdesc="Object Oriented Input System (mingw-w64)" arch=('any') url="https://sourceforge.net/projects/wgois" @@ -16,8 +16,28 @@ license=('custom:zlib/libpng') depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs") options=('strip' '!libtool' 'staticlibs') makedepends=('autoconf' 'automake' 'libtool' "${MINGW_PACKAGE_PREFIX}-gcc" "git") -source=("${_realname}"::"git+https://github.com/Alexpux/Object-oriented-Input-System--OIS-.git#branch=devel") -sha256sums=('SKIP') +source=("${_realname}"::"git+https://github.com/wgois/OIS.git" + 0001-Upgrade-autotools-to-newer-version.-Allow-build-IOS-.patch + 0002-Fix-macros-name.patch + 0003-InputManager-Cannot-have-pure-virtual-methods.patch + 0004-Substitute-proper-OIS-libraries-in-config-files.-Fix.patch + 0005-Fix-typo.patch + 0006-Add-mingw-definitions-to-CFLAGS.patch + 0007-Fix-source-file-name.patch + 0008-Add-macros-directory-to-configure.patch + 0009-Switched-Win32Mouse-to-use-GetDeviceState-instead-of.patch + 0010-Unicode-fix.patch) +sha256sums=('SKIP' + '9ac438aff02fd130ee1970dfd395dc008739c8dfd111c1a51f37412f07e71fe7' + '2916602bee6851c4e44627cdde5ab48db58b6fbfc03971df440446d6c75c94c7' + '3bd9cdb208c6ecd72060887dd4ff00f60c43067a02c0e3facecc890439a2ec73' + '4f191559b8fe1d54d87864c86a5b3c8973abfd5e199b6728a2d821dea9bfd5df' + '0146bf520e5b9cdd31bd6e327d20ea9d27d2782e3635fe8995b5ad41716b2eb0' + '9ac1d5decbdf760464fbf8fb3a50570ebcc51cdfa54cf76fdb6d664b23adb352' + '9a728cbd4dd8932d24cab17097cde6c6d8d6f9c3a79090dab697d14aacf53b74' + '7980039e5e9151bc125f8e20a6ace6b0a849d2f4e6db88b642c6cca8ce524e9b' + '5be6edebd934abd5a44d3111ac517806227a07591114a58ff4b64e4fefe6eb12' + 'b509b936232de332cf69f2c6204dc1d4a1bb7112872cc0dea9d69eda1ae449d7') pkgver() { cd "${srcdir}/${_realname}" @@ -26,6 +46,16 @@ pkgver() { prepare() { cd ${srcdir}/${_realname} + git am --committer-date-is-author-date "${srcdir}"/0001-Upgrade-autotools-to-newer-version.-Allow-build-IOS-.patch + git am --committer-date-is-author-date "${srcdir}"/0002-Fix-macros-name.patch + git am --committer-date-is-author-date "${srcdir}"/0003-InputManager-Cannot-have-pure-virtual-methods.patch + git am --committer-date-is-author-date "${srcdir}"/0004-Substitute-proper-OIS-libraries-in-config-files.-Fix.patch + git am --committer-date-is-author-date "${srcdir}"/0005-Fix-typo.patch + git am --committer-date-is-author-date "${srcdir}"/0006-Add-mingw-definitions-to-CFLAGS.patch + git am --committer-date-is-author-date "${srcdir}"/0007-Fix-source-file-name.patch + git am --committer-date-is-author-date "${srcdir}"/0008-Add-macros-directory-to-configure.patch + git am --committer-date-is-author-date "${srcdir}"/0009-Switched-Win32Mouse-to-use-GetDeviceState-instead-of.patch + git am --committer-date-is-author-date "${srcdir}"/0010-Unicode-fix.patch libtoolize --copy --force aclocal ${ACLOCAL_FLAGS}