Fixed building with mingw32
parent
3e1679c885
commit
5cb1ca551f
|
@ -33,6 +33,41 @@
|
||||||
#include "../SDL_audio_c.h"
|
#include "../SDL_audio_c.h"
|
||||||
#include "SDL_winmm.h"
|
#include "SDL_winmm.h"
|
||||||
|
|
||||||
|
/*====== WORKAROUND for MinGW's WinAPI header where those structures are being missed ======*/
|
||||||
|
#if defined(__MINGW32__) && !defined(__MINGW64__)
|
||||||
|
|
||||||
|
typedef struct tagWAVEINCAPS2W
|
||||||
|
{
|
||||||
|
WORD wMid;
|
||||||
|
WORD wPid;
|
||||||
|
MMVERSION vDriverVersion;
|
||||||
|
WCHAR szPname[MAXPNAMELEN];
|
||||||
|
DWORD dwFormats;
|
||||||
|
WORD wChannels;
|
||||||
|
WORD wReserved1;
|
||||||
|
GUID ManufacturerGuid;
|
||||||
|
GUID ProductGuid;
|
||||||
|
GUID NameGuid;
|
||||||
|
} WAVEINCAPS2W,*PWAVEINCAPS2W,*NPWAVEINCAPS2W,*LPWAVEINCAPS2W;
|
||||||
|
|
||||||
|
typedef struct tagWAVEOUTCAPS2W
|
||||||
|
{
|
||||||
|
WORD wMid;
|
||||||
|
WORD wPid;
|
||||||
|
MMVERSION vDriverVersion;
|
||||||
|
WCHAR szPname[MAXPNAMELEN];
|
||||||
|
DWORD dwFormats;
|
||||||
|
WORD wChannels;
|
||||||
|
WORD wReserved1;
|
||||||
|
DWORD dwSupport;
|
||||||
|
GUID ManufacturerGuid;
|
||||||
|
GUID ProductGuid;
|
||||||
|
GUID NameGuid;
|
||||||
|
} WAVEOUTCAPS2W,*PWAVEOUTCAPS2W,*NPWAVEOUTCAPS2W,*LPWAVEOUTCAPS2W;
|
||||||
|
|
||||||
|
#endif /* defined(__MINGW32__) && !defined(__MINGW64__) */
|
||||||
|
/*==========================================================================================*/
|
||||||
|
|
||||||
#ifndef WAVE_FORMAT_IEEE_FLOAT
|
#ifndef WAVE_FORMAT_IEEE_FLOAT
|
||||||
#define WAVE_FORMAT_IEEE_FLOAT 0x0003
|
#define WAVE_FORMAT_IEEE_FLOAT 0x0003
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -85,7 +85,12 @@ GetJoystickName(int index, const char *szRegKey)
|
||||||
char regvalue[256];
|
char regvalue[256];
|
||||||
char regname[256];
|
char regname[256];
|
||||||
|
|
||||||
SDL_snprintf(regkey, SDL_arraysize(regkey), "%s\\%s\\%s",
|
SDL_snprintf(regkey, SDL_arraysize(regkey),
|
||||||
|
#ifdef UNICODE
|
||||||
|
"%S\\%s\\%S",
|
||||||
|
#else
|
||||||
|
"%s\\%s\\%s",
|
||||||
|
#endif
|
||||||
REGSTR_PATH_JOYCONFIG, szRegKey, REGSTR_KEY_JOYCURR);
|
REGSTR_PATH_JOYCONFIG, szRegKey, REGSTR_KEY_JOYCURR);
|
||||||
hTopKey = HKEY_LOCAL_MACHINE;
|
hTopKey = HKEY_LOCAL_MACHINE;
|
||||||
regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
|
regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
|
||||||
|
@ -110,8 +115,13 @@ GetJoystickName(int index, const char *szRegKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open that registry key */
|
/* open that registry key */
|
||||||
SDL_snprintf(regkey, SDL_arraysize(regkey), "%s\\%s", REGSTR_PATH_JOYOEM,
|
SDL_snprintf(regkey, SDL_arraysize(regkey),
|
||||||
regname);
|
#ifdef UNICODE
|
||||||
|
"%S\\%s",
|
||||||
|
#else
|
||||||
|
"%s\\%s",
|
||||||
|
#endif
|
||||||
|
REGSTR_PATH_JOYOEM, regname);
|
||||||
regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
|
regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
|
||||||
if (regresult != ERROR_SUCCESS) {
|
if (regresult != ERROR_SUCCESS) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -313,7 +323,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
|
||||||
};
|
};
|
||||||
DWORD pos[MAX_AXES];
|
DWORD pos[MAX_AXES];
|
||||||
struct _transaxis *transaxis;
|
struct _transaxis *transaxis;
|
||||||
int value, change;
|
int value;
|
||||||
JOYINFOEX joyinfo;
|
JOYINFOEX joyinfo;
|
||||||
|
|
||||||
joyinfo.dwSize = sizeof(joyinfo);
|
joyinfo.dwSize = sizeof(joyinfo);
|
||||||
|
|
|
@ -1628,6 +1628,16 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt,
|
||||||
len = SDL_PrintFloat(text, left, &info, va_arg(ap, double));
|
len = SDL_PrintFloat(text, left, &info, va_arg(ap, double));
|
||||||
done = SDL_TRUE;
|
done = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
|
case 'S':
|
||||||
|
{
|
||||||
|
/* In practice this is used on Windows for WCHAR strings */
|
||||||
|
wchar_t *wide_arg = va_arg(ap, wchar_t *);
|
||||||
|
char *arg = SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(wide_arg), (SDL_wcslen(wide_arg)+1)*sizeof(*wide_arg));
|
||||||
|
len = SDL_PrintString(text, left, &info, arg);
|
||||||
|
SDL_free(arg);
|
||||||
|
done = SDL_TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
len = SDL_PrintString(text, left, &info, va_arg(ap, char *));
|
len = SDL_PrintString(text, left, &info, va_arg(ap, char *));
|
||||||
done = SDL_TRUE;
|
done = SDL_TRUE;
|
||||||
|
|
Loading…
Reference in New Issue