Skip to content

Commit

Permalink
Update GLFW and SDL2
Browse files Browse the repository at this point in the history
- Update GLFW to 3.4
- Update SDL2 to 2.30.0
- Add a patch to build SDL2 on MinGW
- Install two new developement packages to build GLFW on Linux with GitHub Actions
  • Loading branch information
encelo committed Feb 29, 2024
1 parent 7234a01 commit ef1744b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: 'Install Build Dependencies'
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libasound2-dev libpulse-dev
sudo apt-get install -y libwayland-dev libgl1-mesa-dev libxkbcommon-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libasound2-dev libpulse-dev
- name: 'CMake Configuration'
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
$env:CXX= "${{ matrix.CXX }}"
$env:MSYSTEM = "MINGW64"
C:\msys64\usr\bin\bash.exe -lc 'cmake -G \"MSYS Makefiles\" -B ../nCine-libraries-build -D CMAKE_BUILD_TYPE=${{ matrix.BuildType }}'
C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -B ../nCine-libraries-build -D CMAKE_BUILD_TYPE=${{ matrix.BuildType }}"
- name: 'Make'
env:
Expand Down
4 changes: 2 additions & 2 deletions cmake/glfw.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(TARGET_GLFW glfw)
set(URL_GLFW https://github.com/glfw/glfw/releases/download/3.3.9/glfw-3.3.9.zip)
set(URL_MD5_GLFW d265c845628f0a85eef4c1f96b25355f)
set(URL_GLFW https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.zip)
set(URL_MD5_GLFW 7d1e90c5c0011eb10eac280b6093d0d0)
set(LIBNAME_GLFW glfw3)
set(COMMON_CMAKE_ARGS_GLFW -DBUILD_SHARED_LIBS=ON -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF)

Expand Down
4 changes: 2 additions & 2 deletions cmake/sdl2.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(TARGET_SDL2 sdl2)
set(URL_SDL2 https://www.libsdl.org/release/SDL2-2.28.3.tar.gz)
set(URL_MD5_SDL2 a9cd672b63386d1f57074a4896045d54)
set(URL_SDL2 https://www.libsdl.org/release/SDL2-2.30.0.tar.gz)
set(URL_MD5_SDL2 3b0a35e1d794382dcd64d9da93870ea1)
set(LIBNAME_SDL2 SDL2)
set(LIBNAME_SDL2MAIN SDL2main)

Expand Down
52 changes: 35 additions & 17 deletions patches/sdl2_mingw.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
diff -urN SDL2-2.0.22.orig/src/joystick/windows/SDL_windows_gaming_input.c SDL2-2.0.22/src/joystick/windows/SDL_windows_gaming_input.c
--- SDL2-2.0.22.orig/src/joystick/windows/SDL_windows_gaming_input.c 2022-04-21 19:37:37.000000000 +0200
+++ SDL2-2.0.22/src/joystick/windows/SDL_windows_gaming_input.c 2022-06-29 01:55:50.226260405 +0200
@@ -34,6 +34,13 @@
#include <cfgmgr32.h>
#include <roapi.h>

+#ifdef ____FIReference_1_INT32_INTERFACE_DEFINED__
+/* MinGW-64 uses __FIReference_1_INT32 instead of Microsoft's __FIReference_1_int */
+#define __FIReference_1_int __FIReference_1_INT32
+#define __FIReference_1_int_get_Value __FIReference_1_INT32_get_Value
+#define __FIReference_1_int_Release __FIReference_1_INT32_Release
+#endif
+

struct joystick_hwdata
{
diff --git a/src/core/windows/SDL_xinput.h b/src/core/windows/SDL_xinput.h
index 85e97ff..c5b2b70 100644
--- a/src/core/windows/SDL_xinput.h
+++ b/src/core/windows/SDL_xinput.h
@@ -211,17 +211,6 @@ typedef struct

#endif /* HAVE_XINPUT_H */

-/* This struct is not defined in XInput headers. */
-typedef struct _XINPUT_CAPABILITIES_EX
-{
- XINPUT_CAPABILITIES Capabilities;
- WORD VendorId;
- WORD ProductId;
- WORD ProductVersion;
- WORD unk1;
- DWORD unk2;
-} XINPUT_CAPABILITIES_EX, *PXINPUT_CAPABILITIES_EX;
-
/* Forward decl's for XInput API's we load dynamically and use if available */
typedef DWORD(WINAPI *XInputGetState_t)(
DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */
diff --git a/src/joystick/windows/SDL_xinputjoystick.c b/src/joystick/windows/SDL_xinputjoystick.c
index 44d3457..d5bafd9 100644
--- a/src/joystick/windows/SDL_xinputjoystick.c
+++ b/src/joystick/windows/SDL_xinputjoystick.c
@@ -113,7 +113,7 @@ static SDL_bool GetXInputDeviceInfo(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Ui
*pPID = capabilities.ProductId;
}
if (pVersion) {
- *pVersion = capabilities.ProductVersion;
+ *pVersion = capabilities.VersionNumber;
}
return SDL_TRUE;
}

0 comments on commit ef1744b

Please sign in to comment.