Allow compiling wiiuse with mingw

This commit is contained in:
Benau 2019-12-18 14:40:54 +08:00
parent 5f3b2ffc25
commit 16736c94bc
2 changed files with 6 additions and 5 deletions

View File

@ -33,7 +33,7 @@ CMAKE_DEPENDENT_OPTION(BUILD_RECORDER "Build opengl recorder" ON
CMAKE_DEPENDENT_OPTION(USE_SYSTEM_SQUISH "Use system Squish library instead of the built-in version, when available." ON CMAKE_DEPENDENT_OPTION(USE_SYSTEM_SQUISH "Use system Squish library instead of the built-in version, when available." ON
"NOT SERVER_ONLY" OFF) "NOT SERVER_ONLY" OFF)
CMAKE_DEPENDENT_OPTION(USE_WIIUSE "Support for wiimote input devices" ON CMAKE_DEPENDENT_OPTION(USE_WIIUSE "Support for wiimote input devices" ON
"NOT SERVER_ONLY;NOT MINGW;NOT CYGWIN" OFF) "NOT SERVER_ONLY;NOT CYGWIN" OFF)
if(APPLE AND NOT IOS) if(APPLE AND NOT IOS)
list(APPEND CMAKE_PREFIX_PATH /usr/local/opt) list(APPEND CMAKE_PREFIX_PATH /usr/local/opt)

View File

@ -43,7 +43,8 @@
#include <hidsdi.h> #include <hidsdi.h>
#include <setupapi.h> #include <setupapi.h>
#ifdef __MINGW32__ // 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 /* this prototype is missing from the mingw headers so we must add it
or suffer linker errors. */ or suffer linker errors. */
#ifdef __cplusplus #ifdef __cplusplus
@ -55,7 +56,7 @@ WINHIDSDI BOOL WINAPI HidD_SetOutputReport(HANDLE, PVOID, ULONG);
#endif #endif
#endif #endif
static int clock_gettime(int X, struct timeval *tv); static int clock_gettime_wiiuse(int X, struct timeval *tv);
int wiiuse_os_find(struct wiimote_t **wm, int max_wiimotes, int timeout) int wiiuse_os_find(struct wiimote_t **wm, int max_wiimotes, int timeout)
{ {
@ -368,7 +369,7 @@ unsigned long wiiuse_os_ticks()
unsigned long ms; unsigned long ms;
struct timeval tp; struct timeval tp;
clock_gettime(0, &tp); clock_gettime_wiiuse(0, &tp);
ms = (unsigned long)(1000 * tp.tv_sec + tp.tv_usec / 1e3); ms = (unsigned long)(1000 * tp.tv_sec + tp.tv_usec / 1e3);
return ms; return ms;
} }
@ -395,7 +396,7 @@ static LARGE_INTEGER getFILETIMEoffset()
return (t); return (t);
} }
static int clock_gettime(int X, struct timeval *tv) static int clock_gettime_wiiuse(int X, struct timeval *tv)
{ {
LARGE_INTEGER t; LARGE_INTEGER t;
FILETIME f; FILETIME f;