Update Wiiuse to 0.15.5

Updates Wiiuse, while keeping (and labeling) STK-specific patches.
This commit is contained in:
QwertyChouskie 2019-12-27 18:13:32 -08:00
parent 8df28b07b1
commit 27fce1d1a4
8 changed files with 36 additions and 8 deletions

View File

@ -14,6 +14,17 @@ Original project (0.12 and earlier):
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.5 -- 24-Nov-2019
--------------------
Fixed:
- Windows build - Fixed support for the -TR Wiimote (big thanks to
Philipp Hartl!)
- Windows build - Fixed name clash in the WIIUSE_DEBUG macro
- Windows build - Fixed build of the SDL example
v0.15.4 -- 28-Nov-2018
--------------------

View File

@ -4,6 +4,8 @@
cmake_minimum_required(VERSION 2.8.0)
# Added for STK, silences CMake warning
# See https://github.com/supertuxkart/stk-code/commit/b0ff15873ee7fa8901672672b47def9039a5534b#diff-a3e272598233e89e4b577a434cc2a89d
if(NOT (CMAKE_MAJOR_VERSION VERSION_LESS 3))
cmake_policy(SET CMP0048 OLD)
endif()
@ -24,6 +26,7 @@ message(STATUS "Configuring WiiUse version ${CPACK_PACKAGE_VERSION}")
option(BUILD_EXAMPLE "Should we build the example app?" YES)
option(BUILD_EXAMPLE_SDL "Should we build the SDL-based example app?" YES)
# Modified for STK, see https://github.com/supertuxkart/stk-code/commit/aea2739e9de42f566ceb6ba0c6396a9f97fe90d4#diff-a3e272598233e89e4b577a434cc2a89d
option(BUILD_WIIUSE_SHARED_LIB "Should we build as a shared library (dll/so)?" NO)
option(INSTALL_EXAMPLES "Should we install the example apps?" YES)

View File

@ -67,6 +67,7 @@ Additional Contributors:
- Mattes D <https://github.com/madmaxoft>
- Chadwick Boulay <https://github.com/cboulay>
- Florian Baumgartl <https://github.com/Baumgartl>
- Philipp Hartl <https://github.com/phHartl>
## License

View File

@ -4,7 +4,13 @@ find_package(GLUT)
if(SDL_FOUND AND OPENGL_FOUND AND GLUT_FOUND)
include_directories(../src ${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIRS})
add_executable(wiiuseexample-sdl sdl.c)
if(WIN32)
add_executable(wiiuseexample-sdl WIN32 sdl.c)
else()
add_executable(wiiuseexample-sdl sdl.c)
endif()
target_link_libraries(wiiuseexample-sdl wiiuse ${SDL_LIBRARY} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES})
if(INSTALL_EXAMPLES)

View File

@ -1,5 +1,5 @@
if(NOT MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
endif()
set(SOURCES
@ -85,6 +85,7 @@ set_property(TARGET
PUBLIC_HEADER
${API})
# Modified for STK, see https://github.com/supertuxkart/stk-code/commit/15e741fa0490f55718bd7f009ef83f0540b9d0a1#diff-a3e272598233e89e4b577a434cc2a89d
if(MSVC)
set_property(TARGET wiiuse APPEND PROPERTY
COMPILE_DEFINITIONS $<$<CONFIG:Debug>:WITH_WIIUSE_DEBUG>

View File

@ -82,11 +82,11 @@ extern FILE *logtarget[];
{ \
if (OUTF_DEBUG) \
{ \
char *file = __FILE__; \
int i = strlen(file) - 1; \
for (; i && (file[i] != '\\'); --i) \
char *___filename = __FILE__; \
int ___i = strlen(___filename) - 1; \
for (; ___i && (___filename[___i] != '\\'); --___i) \
; \
fprintf(OUTF_DEBUG, "[DEBUG] %s:%i: " fmt "\n", file + i + 1, __LINE__, ##__VA_ARGS__); \
fprintf(OUTF_DEBUG, "[DEBUG] %s:%i: " fmt "\n", ___filename + ___i + 1, __LINE__, ##__VA_ARGS__); \
} \
} while (0)
#else

View File

@ -43,6 +43,7 @@
#include <hidsdi.h>
#include <setupapi.h>
// Modified for STK, see https://github.com/supertuxkart/stk-code/commit/16736c94bc7bb0853a4f2a3ca4a7a61d64f6297b#diff-888f3f4cc3f5fe319c3eb3a61958de77
// Not needed in mxe gcc 5.5 nor clang 9
#if 0//def __MINGW32__
/* this prototype is missing from the mingw headers so we must add it
@ -56,6 +57,7 @@ WINHIDSDI BOOL WINAPI HidD_SetOutputReport(HANDLE, PVOID, ULONG);
#endif
#endif
// Modified for STK, see https://github.com/supertuxkart/stk-code/commit/16736c94bc7bb0853a4f2a3ca4a7a61d64f6297b#diff-888f3f4cc3f5fe319c3eb3a61958de77
static int clock_gettime_wiiuse(int X, struct timeval *tv);
int wiiuse_os_find(struct wiimote_t **wm, int max_wiimotes, int timeout)
@ -129,6 +131,7 @@ int wiiuse_os_find(struct wiimote_t **wm, int max_wiimotes, int timeout)
if (attr.ProductID == WM_PRODUCT_ID_TR)
wm[found]->type = WIIUSE_WIIMOTE_MOTION_PLUS_INSIDE;
// Modified for STK, see https://github.com/supertuxkart/stk-code/commit/c3379764136da2bfa7890b6a49189e734c45422e#diff-888f3f4cc3f5fe319c3eb3a61958de77
wm[found]->hid_overlap.hEvent = CreateEvent(NULL, 1, 1, L"");
wm[found]->hid_overlap.Offset = 0;
wm[found]->hid_overlap.OffsetHigh = 0;
@ -343,8 +346,9 @@ int wiiuse_os_write(struct wiimote_t *wm, byte report_type, byte *buf, int len)
return 0;
}
/* Windows should always use WriteFile instead of HidD_SetOutputReport to communicate -> data pipe instead of control pipe*/
case WIIUSE_STACK_MS:
return HidD_SetOutputReport(wm->dev_handle, write_buffer, len + 1);
return WriteFile(wm->dev_handle, write_buffer, 22, &bytes, &wm->hid_overlap);
case WIIUSE_STACK_BLUESOLEIL:
return WriteFile(wm->dev_handle, write_buffer, 22, &bytes, &wm->hid_overlap);
@ -369,6 +373,7 @@ unsigned long wiiuse_os_ticks()
unsigned long ms;
struct timeval tp;
// Modified for STK, see https://github.com/supertuxkart/stk-code/commit/16736c94bc7bb0853a4f2a3ca4a7a61d64f6297b#diff-888f3f4cc3f5fe319c3eb3a61958de77
clock_gettime_wiiuse(0, &tp);
ms = (unsigned long)(1000 * tp.tv_sec + tp.tv_usec / 1e3);
return ms;
@ -396,6 +401,7 @@ static LARGE_INTEGER getFILETIMEoffset()
return (t);
}
// Modified for STK, see https://github.com/supertuxkart/stk-code/commit/16736c94bc7bb0853a4f2a3ca4a7a61d64f6297b#diff-888f3f4cc3f5fe319c3eb3a61958de77
static int clock_gettime_wiiuse(int X, struct timeval *tv)
{
LARGE_INTEGER t;

View File

@ -73,7 +73,7 @@
#define WIIUSE_MAJOR 0
#define WIIUSE_MINOR 15
#define WIIUSE_MICRO 4
#define WIIUSE_MICRO 5
#define WIIUSE_VERSION_TRANSFORM(MAJ, MIN, MICRO) (MAJ * 1000000 + MIN * 1000 + MICRO)
#define WIIUSE_HAS_VERSION(MAJ, MIN, MICRO) \