Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compilability of WGI code against MinGW headers #5589

Closed
sezero opened this issue Apr 29, 2022 · 11 comments
Closed

compilability of WGI code against MinGW headers #5589

sezero opened this issue Apr 29, 2022 · 11 comments
Milestone

Comments

@sezero
Copy link
Contributor

sezero commented Apr 29, 2022

MinGW-w64 recently imported all missing headers in git so that our WGI
code can be compiled against it. However it was reported to me that the
following patch is needed for the time being - not sure why, yet. I am
putting this info here so that it may possibly be discussed and solved
by help from others.

Hint: @icculus, @slouken.
CC: @Biswa96

diff --git a/src/joystick/windows/SDL_windows_gaming_input.c b/src/joystick/windows/SDL_windows_gaming_input.c
index 8b552bb..c1608a7 100644
--- a/src/joystick/windows/SDL_windows_gaming_input.c
+++ b/src/joystick/windows/SDL_windows_gaming_input.c
@@ -34,6 +34,11 @@
 #include <cfgmgr32.h>
 #include <roapi.h>
 
+#ifdef __MINGW32__
+#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
 {
@slouken slouken added this to the 2.0.24 milestone Apr 29, 2022
@Biswa96
Copy link

Biswa96 commented Apr 29, 2022

I considered it as a workaround and not an issue of SDL code. The issue is a bit confusing (as always with any Microsoft stuff). According to the Windows.Devices.Power.idl file, the get_FullChargeCapacityInMilliwattHours function has the parameter of type Windows.Foundation.IReference<INT32> **. It was translated to __FIReference_1_INT32 ** type in Windows.Devices.Power.h in wine & mingw-w64. But the Microsoft Windows SDK translated it to __FIReference_1_int **.

@slouken
Copy link
Collaborator

slouken commented Apr 29, 2022

This seems like a reasonable patch, with appropriate documentation

@sezero
Copy link
Contributor Author

sezero commented Apr 29, 2022

If looking at windows sdk headers is not out of the question, here
is someone's github repo of them:
https://github.com/hughbe/windows-sdk-headers

@Biswa96
Copy link

Biswa96 commented Apr 29, 2022

There is also another confusion with Windows.Foundation.IReference<BYTE>** type. It is translated to __FIReference_1_byte** (see the different uppercase/lowercase).

By the way, I have not tested the SDL project with those new mingw-w64 headers due to absence of any gaming hardware. If anyone is willing to test the binaries compiled with mingw-w64 toolchain I can provide the necessary msys2/mingw headers & crt packages from CI.

@sezero
Copy link
Contributor Author

sezero commented May 1, 2022

Is it not more appropriate that the confusions are addressed in the idls
and headers themselves, e.g. by proper defines?

@Biswa96
Copy link

Biswa96 commented May 1, 2022

Is it not more appropriate that the confusions are addressed in the idls

Hence my first statement, "I considered it as a workaround and not an issue of SDL code". I have asked wine developers about this issue and they will be working on this but it may take time.

nyanmisaka added a commit to nyanmisaka/jellyfin-ffmpeg that referenced this issue May 1, 2022
1. We don't need SDL graphics output used by ffplay
2. SDL2 has an upstream issue here in: libsdl-org/SDL#5589
nyanmisaka added a commit to nyanmisaka/jellyfin-ffmpeg that referenced this issue May 1, 2022
1. We don't need SDL graphics output used by ffplay
2. SDL2 has an upstream issue here in: libsdl-org/SDL#5589
nyanmisaka added a commit to nyanmisaka/jellyfin-ffmpeg that referenced this issue May 1, 2022
1. We don't need SDL graphics output used by ffplay
2. SDL2 has an upstream issue here in: libsdl-org/SDL#5589
qwerty12 added a commit to qwerty12/mpv-winbuild-cmake that referenced this issue May 1, 2022
github-actions bot pushed a commit to qwerty12/mpv-winbuild-cmake that referenced this issue May 2, 2022
slouken added a commit that referenced this issue May 27, 2022
@slouken
Copy link
Collaborator

slouken commented May 27, 2022

Patch added, thanks!

@slouken slouken closed this as completed May 27, 2022
@sezero
Copy link
Contributor Author

sezero commented May 27, 2022

The patch isn't really a fix, and the new wgi headers are not in any mingw-w64 releases as far as I know: Remember to revert it when things get fixed in wine and mingw-w64

@slouken
Copy link
Collaborator

slouken commented May 27, 2022

Yep, will do.

@slouken
Copy link
Collaborator

slouken commented May 27, 2022

Actually, if the headers aren't in any release, I'll go ahead and revert this change and report it upstream.

@slouken slouken reopened this May 27, 2022
@slouken
Copy link
Collaborator

slouken commented May 27, 2022

Okay, I put in a better fix in d2c4d74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants