Skip to content

Commit

Permalink
Fix struct redefinition error on newer mingw-w64
Browse files Browse the repository at this point in the history
  • Loading branch information
SiegeLordEx authored and SiegeLord committed May 17, 2024
1 parent 614d4db commit bbb8dc0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,15 @@ if(WIN32)

# Xinput support for xbox compatible controllers.
if(XINPUT_FOUND)
run_c_compile_test("
#include <xinput.h>
XINPUT_CAPABILITIES_EX x;
int main(void) { return 0; }"
HAVE_XINPUT_CAPABILITIES_EX
)
if(HAVE_XINPUT_CAPABILITIES_EX)
set(ALLEGRO_CFG_HAVE_XINPUT_CAPABILITIES_EX 1)
endif()
set(SUPPORT_XINPUT 1)
set(ALLEGRO_CFG_XINPUT 1)
endif(XINPUT_FOUND)
Expand Down
2 changes: 2 additions & 0 deletions include/allegro5/platform/alplatf.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#cmakedefine ALLEGRO_CFG_ANDROID_LEGACY

#cmakedefine ALLEGRO_CFG_HAVE_XINPUT_CAPABILITIES_EX

/*---------------------------------------------------------------------------*/

/* Define to 1 if you have the corresponding header file. */
Expand Down
2 changes: 2 additions & 0 deletions src/win/wjoyxi.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ ALLEGRO_JOYSTICK_DRIVER _al_joydrv_xinput =
#define XINPUT_MIN_VERSION 3
#define XINPUT_MAX_VERSION 4

#ifndef ALLEGRO_CFG_HAVE_XINPUT_CAPABILITIES_EX
typedef struct _XINPUT_CAPABILITIES_EX
{
XINPUT_CAPABILITIES Capabilities;
Expand All @@ -118,6 +119,7 @@ typedef struct _XINPUT_CAPABILITIES_EX
WORD unk1;
DWORD unk2;
} XINPUT_CAPABILITIES_EX, * PXINPUT_CAPABILITIES_EX;
#endif

typedef void (WINAPI *XInputEnablePROC)(BOOL);
typedef DWORD (WINAPI *XInputSetStatePROC)(DWORD, XINPUT_VIBRATION*);
Expand Down

0 comments on commit bbb8dc0

Please sign in to comment.