Update to 0.15.4, with fix for Windows compilation

This commit is contained in:
QwertyChouskie 2018-11-28 11:18:32 -08:00
parent 0c5d728c48
commit 2253dc9db9
12 changed files with 234 additions and 102 deletions

94
lib/wiiuse/.clang-format Normal file
View File

@ -0,0 +1,94 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: true
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 110
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '$'
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: false
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...

2
lib/wiiuse/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
build
.cquery_cached_index

15
lib/wiiuse/.travis.yml Normal file
View File

@ -0,0 +1,15 @@
os:
- linux
- osx
language: c
compiler:
- clang
- gcc
sudo: required
dist: trusty
install: . scripts/ci/$TRAVIS_OS_NAME/install.sh
script: . scripts/ci/common/script.sh

View File

@ -1,13 +1,35 @@
WiiUse Changelog WiiUse Changelog
================ ================
Fork, located at <http://github.com/wiiuse/wiiuse> De-facto official fork, located at <http://github.com/wiiuse/wiiuse>
Original project: Original project (0.12 and earlier):
- <http://wiiuse.net/>
- <http://wiiuse.sourceforge.net/>
- <http://sourceforge.net/projects/wiiuse/> - <http://sourceforge.net/projects/wiiuse/>
- Now-defunct web sites:
- wiiuse.net:
most recent archive from 2011
<https://web.archive.org/web/20110107085956/http://wiiuse.net/>
- wiiuse.sourceforge.net:
most recent archive from 2010 (looks identical on homepage to 2011 snapshot above)
<https://web.archive.org/web/20100216015311/http://wiiuse.sourceforge.net/>
v0.15.4 -- 28-Nov-2018
--------------------
Fixed:
- Windows build - verified to work on VS Community 2017 from fresh install.
Changed:
- Removed `WCONST` macro of questionable value -
it made some struct members "const" for consuming software,
but non-const within the library.
Made it too complex to maintain.
Shouldn't really affect usage (doesn't change layout, etc.),
but noted separately because it is technically a (very minor) API change.
- Removed broken links to old project web sites.
v0.15.3 -- 25-Nov-2018 v0.15.3 -- 25-Nov-2018
-------------------- --------------------
@ -17,7 +39,6 @@ Fixed:
- Fixed forgotten version number - Fixed forgotten version number
- Fixed library installation prefix on 64bit systems - Fixed library installation prefix on 64bit systems
v0.15.2 -- 25-Nov-2018 v0.15.2 -- 25-Nov-2018
-------------------- --------------------

View File

@ -50,7 +50,7 @@ Original Author: Michael Laforest < para > < thepara (--AT--) g m a i l [--DOT--
Additional Contributors: Additional Contributors:
- Jan Ciger - Reviatech SAS <https://github.com/janoc> <jan.ciger@reviatech.com> - Jan Ciger - Reviatech SAS <https://github.com/janoc> <jan.ciger@reviatech.com> (effective co-maintainer)
- dhewg - dhewg
- Christopher Sawczuk @ TU-Delft (initial Balance Board support) - Christopher Sawczuk @ TU-Delft (initial Balance Board support)
- Paul Burton <https://github.com/paulburton/wiiuse> - Paul Burton <https://github.com/paulburton/wiiuse>
@ -120,16 +120,14 @@ Wiiuse currently operates on Linux, Windows and Mac. You will need:
### For Linux ### For Linux
- The kernel must support bluetooth - The kernel must support Bluetooth
- The BlueZ bluetooth drivers must be installed - The BlueZ Bluetooth drivers must be installed
- If compiling, you'll need the BlueZ dev files (Debian/Ubuntu package - If compiling, you'll need the BlueZ dev files (Debian/Ubuntu package
`libbluetooth-dev`) `libbluetooth-dev`)
### For Windows ### For Windows
- Bluetooth driver (tested with Microsoft's stack with Windows XP SP2) - Bluetooth driver (tested with Microsoft's stack with Windows XP SP2 thru Windows 10)
- If compiling, Microsoft Windows Driver Development Kit (DDK)
### For Mac ### For Mac
@ -179,6 +177,10 @@ You may need to install the Windows SDK (in recent versions) or
DDK (driver development kit - for old Windows SDK only) to compile DDK (driver development kit - for old Windows SDK only) to compile
wiiuse. wiiuse.
With Visual Studio Community 2017, this is very easy to build now:
if you have chosen to install the "desktop C++" tools,
you'll automatically have what you need.
## Using the Library ## Using the Library
To use the library in your own program you must first compile wiiuse as To use the library in your own program you must first compile wiiuse as
@ -227,7 +229,7 @@ Nintendo
BlueZ BlueZ
> Easy and intuitive bluetooth stack for Linux. > Easy and intuitive Bluetooth stack for Linux.
Thanks to Brent for letting me borrow his Guitar Hero 3 controller. Thanks to Brent for letting me borrow his Guitar Hero 3 controller.
@ -260,30 +262,26 @@ greatly appreciated.
- Created an 0.13 version with some very preliminary MotionPlus support. - Created an 0.13 version with some very preliminary MotionPlus support.
- Integrated into branch `fwiine-motionplus`, not yet merged pending - Integrated into branch `fwiine-motionplus`, not yet merged pending
alternate MotionPlus merge from WiiC by Jan Ciger. alternate MotionPlus merge from WiiC by Jan Ciger.
- [DolphinEmu](http://code.google.com/p/dolphin-emu/source/checkout) - [DolphinEmu](https://github.com/dolphin-emu/dolphin)
- Embedded, converted to C++, drastically changed over time and - used to have a WiiUse fork labeled version 0.13.0 (no relation to 0.13 in this current project)
mostly unrecognizable now. - Embedded, converted to C++, drastically changed over time,
mostly unrecognizable, and then removed before 3.0.
- Added Mac support.
- Added code to handle finding and pairing wiimotes on windows.
- A mostly intact version is here: - A mostly intact version is here:
<http://code.google.com/p/dolphin-emu/source/browse/?name=2.0#git%2FExternals%2FWiiUseSrc%2FSrc> <https://github.com/dolphin-emu/dolphin/tree/2.0/Externals/WiiUseSrc>
- Added Mac support - Last code state before removal is here:
- Added code to handle finding and pairing wiimotes on windows, see: <https://github.com/dolphin-emu/dolphin/tree/b038df64bfad478c4e2605985809f58f351ec11c/Source/Core/wiiuse>
<http://code.google.com/p/dolphin-emu/source/browse/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp> - Their new replacement is <https://github.com/dolphin-emu/dolphin/tree/master/Source/Core/Core/HW/WiimoteReal>
- Fully modified version of the IO code is here:
<http://code.google.com/p/dolphin-emu/source/browse/#git%2FSource%2FCore%2FCore%2FSrc%2FHW%2FWiimoteReal>
- [paulburton on github](https://github.com/paulburton/wiiuse) - [paulburton on github](https://github.com/paulburton/wiiuse)
- Added balance board support - skipped in favor of the TU Delft version. - Added balance board support - skipped in favor of the TU Delft version.
- Added static library support - not yet added to the mainline. - Added static library support - not yet added to the mainline.
- [KzMz on github)](https://github.com/KzMz/wiiuse_fork) - [KzMz on github)](https://github.com/KzMz/wiiuse_fork)
- Started work on speaker support. - Started work on speaker support.
- [WiiC](http://wiic.sourceforge.net/) - [WiiC](https://github.com/grandelli/WiiC)
- Dramatically changed, C++ API added. - Dramatically changed, C++ API added.
- MotionPlus support added. - MotionPlus support added.
- Added Mac support. - Added Mac support.
- DolphinEmu PPA: used to have a WiiUse 0.13
- Added Mac support.
- Unknown other changes - not yet investigated.
- Source package zipped up and available here:
<https://github.com/wiiuse/wiiuse/downloads>
## Other Links ## Other Links
@ -291,9 +289,13 @@ greatly appreciated.
- Possible alternative using the Linux kernel support for the Wiimote - Possible alternative using the Linux kernel support for the Wiimote
and the standard Linux input system: <https://github.com/dvdhrm/xwiimote> and the standard Linux input system: <https://github.com/dvdhrm/xwiimote>
Original project: Original project (0.12 and earlier):
- SourceForge page: <http://sourceforge.net/projects/wiiuse/> - <http://sourceforge.net/projects/wiiuse/>
- Archived pages of the original project: - Now-defunct web sites:
- <http://web.archive.org/web/*/http://wiiuse.net/> - wiiuse.net:
- <http://web.archive.org/web/*/http://wiiuse.sourceforge.net/> most recent archive from 2011
<https://web.archive.org/web/20110107085956/http://wiiuse.net/>
- wiiuse.sourceforge.net:
most recent archive from 2010 (looks identical on homepage to 2011 snapshot above)
<https://web.archive.org/web/20100216015311/http://wiiuse.sourceforge.net/>

8
lib/wiiuse/RELEASE.md Normal file
View File

@ -0,0 +1,8 @@
# Release Checklist
This project unfortunately has a several-step release process,
and it's easy to miss one of the steps.
- Update `CHANGELOG.mkd`
- Ensure contributor list in `README.mkd` is accurate/up to date.
- Bump version in wiiuse.h

View File

@ -73,7 +73,8 @@ macro(_winsdk_announce)
endmacro() endmacro()
set(_winsdk_win10vers set(_winsdk_win10vers
10.0.17133.0 # Redstone 4 aka Win10 1803 "April 1018 Update" 10.0.17763.0 # Redstone 5 aka Win10 1810 "October 2018 Update"
10.0.17133.0 # Redstone 4 aka Win10 1803 "April 2018 Update"
10.0.16299.0 # Redstone 3 aka Win10 1709 "Fall Creators Update" 10.0.16299.0 # Redstone 3 aka Win10 1709 "Fall Creators Update"
10.0.15063.0 # Redstone 2 aka Win10 1703 "Creators Update" 10.0.15063.0 # Redstone 2 aka Win10 1703 "Creators Update"
10.0.14393.0 # Redstone aka Win10 1607 "Anniversary Update" 10.0.14393.0 # Redstone aka Win10 1607 "Anniversary Update"

View File

@ -108,8 +108,6 @@ extern FILE *logtarget[];
#define absf(x) ((x >= 0) ? (x) : (x * -1.0f)) #define absf(x) ((x >= 0) ? (x) : (x * -1.0f))
#define diff_f(x, y) ((x >= y) ? (absf(x - y)) : (absf(y - x))) #define diff_f(x, y) ((x >= y) ? (absf(x - y)) : (absf(y - x)))
#define WCONST
/** @} */ /** @} */
#endif /* DEFINITIONS_H_INCLUDED */ #endif /* DEFINITIONS_H_INCLUDED */

View File

@ -37,15 +37,7 @@
#ifndef EVENTS_H_INCLUDED #ifndef EVENTS_H_INCLUDED
#define EVENTS_H_INCLUDED #define EVENTS_H_INCLUDED
#if defined(_MSC_VER) #include "wiiuse.h"
/* MS compilers of pre-VC2010 versions don't have stdint.h
* and I can't get VC2010's stdint.h to compile nicely in
* WiiUse
*/
#include "wiiuse_msvcstdint.h"
#else
#include <stdint.h>
#endif
/** @defgroup internal_events Internal: Event Utilities */ /** @defgroup internal_events Internal: Event Utilities */
/** @{ */ /** @{ */

View File

@ -117,12 +117,15 @@ struct wiimote_t **wiiuse_init(int wiimotes)
* *
* This banner is only displayed once so that if you need * This banner is only displayed once so that if you need
* to call this function again it won't be intrusive. * to call this function again it won't be intrusive.
*
* 2018: Replaced wiiuse.net with sourceforge project, since
* wiiuse.net is now abandoned and "parked".
*/ */
if (!g_banner) if (!g_banner)
{ {
printf("wiiuse v" WIIUSE_VERSION " loaded.\n" printf("wiiuse v" WIIUSE_VERSION " loaded.\n"
" Fork at http://github.com/rpavlik/wiiuse\n" " De-facto official fork at http://github.com/wiiuse/wiiuse\n"
" Original By: Michael Laforest <thepara[at]gmail{dot}com> http://wiiuse.net\n"); " Original By: Michael Laforest <thepara[at]gmail{dot}com> <https://sourceforge.net/projects/wiiuse/>\n");
g_banner = 1; g_banner = 1;
} }

View File

@ -58,7 +58,7 @@
* intended to be the new "upstream" of the project. The new homepage is * intended to be the new "upstream" of the project. The new homepage is
* on GitHub, where the source is maintained: * on GitHub, where the source is maintained:
* *
* - http://github.com/rpavlik/wiiuse * - http://github.com/wiiuse/wiiuse
* *
* Contributions (under the GPL 3+) are welcome and encouraged! * Contributions (under the GPL 3+) are welcome and encouraged!
* *
@ -73,7 +73,7 @@
#define WIIUSE_MAJOR 0 #define WIIUSE_MAJOR 0
#define WIIUSE_MINOR 15 #define WIIUSE_MINOR 15
#define WIIUSE_MICRO 3 #define WIIUSE_MICRO 4
#define WIIUSE_VERSION_TRANSFORM(MAJ, MIN, MICRO) (MAJ * 1000000 + MIN * 1000 + MICRO) #define WIIUSE_VERSION_TRANSFORM(MAJ, MIN, MICRO) (MAJ * 1000000 + MIN * 1000 + MICRO)
#define WIIUSE_HAS_VERSION(MAJ, MIN, MICRO) \ #define WIIUSE_HAS_VERSION(MAJ, MIN, MICRO) \
@ -107,11 +107,7 @@
#include <bluetooth/bluetooth.h> #include <bluetooth/bluetooth.h>
#endif #endif
#ifndef WCONST #if defined(_MSC_VER) && _MSC_VER < 1700
#define WCONST const
#endif
#if defined(_MSC_VER)
/* MS compilers of pre-VC2010 versions don't have stdint.h /* MS compilers of pre-VC2010 versions don't have stdint.h
* and I can't get VC2010's stdint.h to compile nicely in * and I can't get VC2010's stdint.h to compile nicely in
* WiiUse * WiiUse
@ -733,89 +729,89 @@ typedef enum WIIUSE_WIIMOTE_TYPE {
*/ */
typedef struct wiimote_t typedef struct wiimote_t
{ {
WCONST int unid; /**< user specified id */ int unid; /**< user specified id */
#ifdef WIIUSE_BLUEZ #ifdef WIIUSE_BLUEZ
/** @name Linux-specific (BlueZ) members */ /** @name Linux-specific (BlueZ) members */
/** @{ */ /** @{ */
WCONST char bdaddr_str[18]; /**< readable bt address */ char bdaddr_str[18]; /**< readable bt address */
WCONST bdaddr_t bdaddr; /**< bt address */ bdaddr_t bdaddr; /**< bt address */
WCONST int out_sock; /**< output socket */ int out_sock; /**< output socket */
WCONST int in_sock; /**< input socket */ int in_sock; /**< input socket */
/** @} */ /** @} */
#endif #endif
#ifdef WIIUSE_WIN32 #ifdef WIIUSE_WIN32
/** @name Windows-specific members */ /** @name Windows-specific members */
/** @{ */ /** @{ */
WCONST HANDLE dev_handle; /**< HID handle */ HANDLE dev_handle; /**< HID handle */
WCONST OVERLAPPED hid_overlap; /**< overlap handle */ OVERLAPPED hid_overlap; /**< overlap handle */
WCONST enum win_bt_stack_t stack; /**< type of bluetooth stack to use */ enum win_bt_stack_t stack; /**< type of bluetooth stack to use */
WCONST int timeout; /**< read timeout */ int timeout; /**< read timeout */
WCONST byte normal_timeout; /**< normal timeout */ byte normal_timeout; /**< normal timeout */
WCONST byte exp_timeout; /**< timeout for expansion handshake */ byte exp_timeout; /**< timeout for expansion handshake */
/** @} */ /** @} */
#endif #endif
#ifdef WIIUSE_MAC #ifdef WIIUSE_MAC
/** @name Mac OS X-specific members */ /** @name Mac OS X-specific members */
/** @{ */ /** @{ */
WCONST void *objc_wm; /** WiiuseWiimote* as opaque pointer */ void *objc_wm; /** WiiuseWiimote* as opaque pointer */
/** @} */ /** @} */
#endif #endif
WCONST int state; /**< various state flags */ int state; /**< various state flags */
WCONST byte leds; /**< currently lit leds */ byte leds; /**< currently lit leds */
WCONST float battery_level; /**< battery level */ float battery_level; /**< battery level */
WCONST int flags; /**< options flag */ int flags; /**< options flag */
#ifndef WIIUSE_SYNC_HANDSHAKE #ifndef WIIUSE_SYNC_HANDSHAKE
WCONST byte handshake_state; /**< the state of the connection handshake */ byte handshake_state; /**< the state of the connection handshake */
#endif #endif
WCONST byte expansion_state; /**< the state of the expansion handshake */ byte expansion_state; /**< the state of the expansion handshake */
WCONST struct data_req_t *data_req; /**< list of data read requests */ struct data_req_t *data_req; /**< list of data read requests */
WCONST struct read_req_t *read_req; /**< list of data read requests */ struct read_req_t *read_req; /**< list of data read requests */
WCONST struct accel_t accel_calib; /**< wiimote accelerometer calibration */ struct accel_t accel_calib; /**< wiimote accelerometer calibration */
WCONST struct expansion_t exp; /**< wiimote expansion device */ struct expansion_t exp; /**< wiimote expansion device */
WCONST struct vec3b_t accel; /**< current raw acceleration data */ struct vec3b_t accel; /**< current raw acceleration data */
WCONST struct orient_t orient; /**< current orientation on each axis */ struct orient_t orient; /**< current orientation on each axis */
WCONST struct gforce_t gforce; /**< current gravity forces on each axis */ struct gforce_t gforce; /**< current gravity forces on each axis */
WCONST struct ir_t ir; /**< IR data */ struct ir_t ir; /**< IR data */
WCONST uint16_t btns; /**< what buttons have just been pressed */ uint16_t btns; /**< what buttons have just been pressed */
WCONST uint16_t btns_held; /**< what buttons are being held down */ uint16_t btns_held; /**< what buttons are being held down */
WCONST uint16_t btns_released; /**< what buttons were just released this */ uint16_t btns_released; /**< what buttons were just released this */
WCONST float orient_threshold; /**< threshold for orient to generate an event */ float orient_threshold; /**< threshold for orient to generate an event */
WCONST int32_t accel_threshold; /**< threshold for accel to generate an event */ int32_t accel_threshold; /**< threshold for accel to generate an event */
WCONST struct wiimote_state_t lstate; /**< last saved state */ struct wiimote_state_t lstate; /**< last saved state */
WCONST WIIUSE_EVENT_TYPE event; /**< type of event that occurred */ WIIUSE_EVENT_TYPE event; /**< type of event that occurred */
WCONST byte motion_plus_id[6]; byte motion_plus_id[6];
WCONST WIIUSE_WIIMOTE_TYPE type; WIIUSE_WIIMOTE_TYPE type;
} wiimote; } wiimote;
/** @brief Data passed to a callback during wiiuse_update() */ /** @brief Data passed to a callback during wiiuse_update() */
typedef struct wiimote_callback_data_t typedef struct wiimote_callback_data_t
{ {
WCONST int uid; int uid;
WCONST byte leds; byte leds;
WCONST float battery_level; float battery_level;
WCONST struct vec3b_t accel; struct vec3b_t accel;
WCONST struct orient_t orient; struct orient_t orient;
WCONST struct gforce_t gforce; struct gforce_t gforce;
WCONST struct ir_t ir; struct ir_t ir;
WCONST uint16_t buttons; uint16_t buttons;
WCONST uint16_t buttons_held; uint16_t buttons_held;
WCONST uint16_t buttons_released; uint16_t buttons_released;
WCONST WIIUSE_EVENT_TYPE event; WIIUSE_EVENT_TYPE event;
WCONST int state; int state;
WCONST struct expansion_t expansion; struct expansion_t expansion;
} wiimote_callback_data_t; } wiimote_callback_data_t;
/** @brief Callback type */ /** @brief Callback type */

View File

@ -80,7 +80,7 @@
#include "definitions.h" #include "definitions.h"
#if defined(_MSC_VER) #if defined(_MSC_VER) && _MSC_VER < 1700
/* MS compilers of pre-VC2010 versions don't have stdint.h /* MS compilers of pre-VC2010 versions don't have stdint.h
* and I can't get VC2010's stdint.h to compile nicely in * and I can't get VC2010's stdint.h to compile nicely in
* WiiUse * WiiUse