summaryrefslogtreecommitdiffhomepage
path: root/patches/sdl2
diff options
context:
space:
mode:
authorØrjan Malde <red@foxi.me>2020-10-05 14:05:24 +0200
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-10-05 16:10:02 +0100
commit213fe0adcfea44a11be64f8138712b877cbef31e (patch)
treea6de731b40472e61eb4000dbb91c033b08b9e6ed /patches/sdl2
parenta35f6d2a19ab9c5b0b8f6bb84197e02e7416ba3f (diff)
downloadmidipix_build-213fe0adcfea44a11be64f8138712b877cbef31e.tar.bz2
midipix_build-213fe0adcfea44a11be64f8138712b877cbef31e.tar.xz
groups/251.native_packages_lib.group: sdl2 switch to win32
Signed-off-by: Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
Diffstat (limited to 'patches/sdl2')
-rw-r--r--patches/sdl2/iconv.patch12
-rw-r--r--patches/sdl2/u16.patch123
-rw-r--r--patches/sdl2/wchar.patch102
-rw-r--r--patches/sdl2/win32.patch203
4 files changed, 440 insertions, 0 deletions
diff --git a/patches/sdl2/iconv.patch b/patches/sdl2/iconv.patch
new file mode 100644
index 00000000..64008c8a
--- /dev/null
+++ b/patches/sdl2/iconv.patch
@@ -0,0 +1,12 @@
+diff -ru SDL2-2.0.8.orig/src/stdlib/SDL_iconv.c SDL2-2.0.8/src/stdlib/SDL_iconv.c
+--- SDL2-2.0.8.orig/src/stdlib/SDL_iconv.c 2018-03-01 17:34:42.000000000 +0100
++++ SDL2-2.0.8/src/stdlib/SDL_iconv.c 2020-10-05 12:56:24.565427760 +0200
+@@ -37,7 +37,7 @@
+ iconv() may or may not use const char ** for the inbuf param.
+ If we get this wrong, it's just a warning, so no big deal.
+ */
+-#if defined(_XGP6) || defined(__APPLE__) || \
++#if defined(_XGP6) || defined(__APPLE__) || defined(__midipix__) || \
+ defined(__EMSCRIPTEN__) || \
+ (defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) || \
+ (defined(_NEWLIB_VERSION)))
diff --git a/patches/sdl2/u16.patch b/patches/sdl2/u16.patch
new file mode 100644
index 00000000..d282e5e7
--- /dev/null
+++ b/patches/sdl2/u16.patch
@@ -0,0 +1,123 @@
+diff -ru SDL2-2.0.8.orig/include/SDL_stdinc.h SDL2-2.0.8/include/SDL_stdinc.h
+--- SDL2-2.0.8.orig/include/SDL_stdinc.h 2018-03-01 17:34:41.000000000 +0100
++++ SDL2-2.0.8/include/SDL_stdinc.h 2020-10-05 12:29:51.927442178 +0200
+@@ -451,10 +451,17 @@
+ extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
+ extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
+
++#ifdef __midipix__
++extern DECLSPEC size_t SDLCALL SDL_wcslen(const uint16_t *wstr);
++extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) uint16_t *dst, const uint16_t *src, size_t maxlen);
++extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) uint16_t *dst, const uint16_t *src, size_t maxlen);
++extern DECLSPEC int SDLCALL SDL_wcscmp(const uint16_t *str, const uint16_t *str2);
++#else
+ extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
+ extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
+ extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
+ extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
++#endif /* !__midipix__ */
+
+ extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
+ extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
+diff -ru SDL2-2.0.8.orig/src/dynapi/SDL_dynapi_procs.h SDL2-2.0.8/src/dynapi/SDL_dynapi_procs.h
+--- SDL2-2.0.8.orig/src/dynapi/SDL_dynapi_procs.h 2018-03-01 17:34:42.000000000 +0100
++++ SDL2-2.0.8/src/dynapi/SDL_dynapi_procs.h 2020-10-05 12:41:07.154180772 +0200
+@@ -418,9 +418,15 @@
+ SDL_DYNAPI_PROC(void*,SDL_memcpy,(SDL_OUT_BYTECAP(c) void *a, SDL_IN_BYTECAP(c) const void *b, size_t c),(a,b,c),return)
+ SDL_DYNAPI_PROC(void*,SDL_memmove,(SDL_OUT_BYTECAP(c) void *a, SDL_IN_BYTECAP(c) const void *b, size_t c),(a,b,c),return)
+ SDL_DYNAPI_PROC(int,SDL_memcmp,(const void *a, const void *b, size_t c),(a,b,c),return)
++#ifdef __midipix__
++SDL_DYNAPI_PROC(size_t,SDL_wcslen,(const uint16_t *a),(a),return)
++SDL_DYNAPI_PROC(size_t,SDL_wcslcpy,(SDL_OUT_Z_CAP(c) uint16_t *a, const uint16_t *b, size_t c),(a,b,c),return)
++SDL_DYNAPI_PROC(size_t,SDL_wcslcat,(SDL_INOUT_Z_CAP(c) uint16_t *a, const uint16_t *b, size_t c),(a,b,c),return)
++#else
+ SDL_DYNAPI_PROC(size_t,SDL_wcslen,(const wchar_t *a),(a),return)
+ SDL_DYNAPI_PROC(size_t,SDL_wcslcpy,(SDL_OUT_Z_CAP(c) wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return)
+ SDL_DYNAPI_PROC(size_t,SDL_wcslcat,(SDL_INOUT_Z_CAP(c) wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return)
++#endif
+ SDL_DYNAPI_PROC(size_t,SDL_strlen,(const char *a),(a),return)
+ SDL_DYNAPI_PROC(size_t,SDL_strlcpy,(SDL_OUT_Z_CAP(c) char *a, const char *b, size_t c),(a,b,c),return)
+ SDL_DYNAPI_PROC(size_t,SDL_utf8strlcpy,(SDL_OUT_Z_CAP(c) char *a, const char *b, size_t c),(a,b,c),return)
+@@ -660,7 +666,11 @@
+ SDL_DYNAPI_PROC(SDL_JoystickID,SDL_JoystickGetDeviceInstanceID,(int a),(a),return)
+ SDL_DYNAPI_PROC(size_t,SDL_utf8strlen,(const char *a),(a),return)
+ SDL_DYNAPI_PROC(void*,SDL_LoadFile_RW,(SDL_RWops *a, size_t *b, int c),(a,b,c),return)
++#ifdef __midipix__
++SDL_DYNAPI_PROC(int,SDL_wcscmp,(const uint16_t *a, const uint16_t *b),(a,b),return)
++#else
+ SDL_DYNAPI_PROC(int,SDL_wcscmp,(const wchar_t *a, const wchar_t *b),(a,b),return)
++#endif
+ SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return)
+ SDL_DYNAPI_PROC(SDL_Surface*,SDL_DuplicateSurface,(SDL_Surface *a),(a),return)
+ SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return)
+diff -ru SDL2-2.0.8.orig/src/stdlib/SDL_string.c SDL2-2.0.8/src/stdlib/SDL_string.c
+--- SDL2-2.0.8.orig/src/stdlib/SDL_string.c 2018-03-01 17:34:42.000000000 +0100
++++ SDL2-2.0.8/src/stdlib/SDL_string.c 2020-10-05 12:29:39.691442561 +0200
+@@ -416,6 +416,44 @@
+ #endif /* HAVE_STRLEN */
+ }
+
++#ifdef __midipix__
++#include <u16ports/u16ports.h>
++
++size_t
++SDL_wcslen(const uint16_t * string)
++{
++ return u16_wcslen(string);
++}
++
++size_t
++SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) uint16_t *dst, const uint16_t *src, size_t maxlen)
++{
++ size_t srclen = u16_wcslen(src);
++ if(maxlen > 0) {
++ size_t len = SDL_min(srclen, maxlen - 1);
++ SDL_memcpy(dst, src, len * sizeof(uint16_t));
++ dst[len] = '\0';
++ }
++ return srclen;
++}
++
++size_t
++SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) uint16_t *dst, const uint16_t *src, size_t maxlen)
++{
++ size_t dstlen = u16_wcslen(dst);
++ size_t srclen = u16_wcslen(src);
++ if (dstlen < maxlen) {
++ SDL_wcslcpy(dst + dstlen, src, maxlen - dstlen);
++ }
++ return dstlen + srclen;
++}
++
++int
++SDL_wcscmp(const uint16_t *str1, const uint16_t *str2)
++{
++ return u16_wcscmp(str1, str2);
++}
++#else
+ size_t
+ SDL_wcslen(const wchar_t * string)
+ {
+@@ -476,6 +514,7 @@
+ return (int)(*str1 - *str2);
+ #endif /* HAVE_WCSCMP */
+ }
++#endif /* !__midipix__ */
+
+ size_t
+ SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
+diff -ru SDL2-2.0.8.orig/src/video/windows/SDL_windowsmessagebox.c SDL2-2.0.8/src/video/windows/SDL_windowsmessagebox.c
+--- SDL2-2.0.8.orig/src/video/windows/SDL_windowsmessagebox.c 2018-03-01 17:34:42.000000000 +0100
++++ SDL2-2.0.8/src/video/windows/SDL_windowsmessagebox.c 2020-10-05 12:51:31.389436939 +0200
+@@ -350,7 +350,11 @@
+ HFONT DialogFont;
+ SIZE Size;
+ RECT TextSize;
++#ifdef __midipix__
++ uint16_t *wmessage;
++#else
+ wchar_t* wmessage;
++#endif
+ TEXTMETRIC TM;
+
+ HWND ParentWindow = NULL;
diff --git a/patches/sdl2/wchar.patch b/patches/sdl2/wchar.patch
new file mode 100644
index 00000000..ea5a7dfb
--- /dev/null
+++ b/patches/sdl2/wchar.patch
@@ -0,0 +1,102 @@
+diff -ru SDL2-2.0.8.orig/src/video/windows/SDL_windowsevents.c SDL2-2.0.8/src/video/windows/SDL_windowsevents.c
+--- SDL2-2.0.8.orig/src/video/windows/SDL_windowsevents.c 2018-03-01 17:34:42.000000000 +0100
++++ SDL2-2.0.8/src/video/windows/SDL_windowsevents.c 2020-10-05 13:11:43.595494306 +0200
+@@ -47,6 +47,10 @@
+ #include "wmmsg.h"
+ #endif
+
++#ifdef __midipix__
++#define sdl_window_data (uint16_t[]){'S','D','L','_','W','i','n','d','o','w','D','a','t','a',0}
++#endif
++
+ /* For processing mouse WM_*BUTTON* and WM_MOUSEMOVE message-data from GetMessageExtraInfo() */
+ #define MOUSEEVENTF_FROMTOUCH 0xFF515700
+
+@@ -384,7 +388,11 @@
+ }
+
+ /* Get the window data for the window */
++#ifdef __midipix__
++ data = (SDL_WindowData *) GetProp(hwnd, sdl_window_data);
++#else
+ data = (SDL_WindowData *) GetProp(hwnd, TEXT("SDL_WindowData"));
++#endif
+ if (!data) {
+ return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
+ }
+diff -ru SDL2-2.0.8.orig/src/video/windows/SDL_windowswindow.c SDL2-2.0.8/src/video/windows/SDL_windowswindow.c
+--- SDL2-2.0.8.orig/src/video/windows/SDL_windowswindow.c 2018-03-01 17:34:42.000000000 +0100
++++ SDL2-2.0.8/src/video/windows/SDL_windowswindow.c 2020-10-05 13:23:58.342720394 +0200
+@@ -45,10 +45,22 @@
+ #define SWP_NOCOPYBITS 0
+ #endif
+
++#ifdef __midipix__
++#define sdl_helper_window_input_catcher (uint16_t[]){'S','D','L','H','e','l','p','e','r','W','i','n','d','o','w','I','n','p','u','t','C','a','t','c','h','e','r',0}
++#define sdl_helper_window_name (uint16_t[]){'S','D','L','H','e','l','p','e','r','W','i','n','d','o','w','I','n','p','u','t','M','s','g','W','i','n','d','o','w',0}
++#define sdl_window (uint16_t[]){'S','D','L','_','W','i','n','d','o','w','D','a','t','a',0}
++#define sdl_empty (uint16_t[]){0}
++#endif
++
+ /* Fake window to help with DirectInput events. */
+ HWND SDL_HelperWindow = NULL;
++#ifdef __midipix__
++static WCHAR *SDL_HelperWindowClassName = sdl_helper_window_input_catcher;
++static WCHAR *SDL_HelperWindowName = sdl_helper_window_name;
++#else
+ static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher");
+ static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow");
++#endif
+ static ATOM SDL_HelperWindowClass = 0;
+
+ /* For borderless Windows, still want the following flags:
+@@ -183,7 +195,11 @@
+ window->driverdata = data;
+
+ /* Associate the data with the window */
++#ifdef __midipix__
++ if (!SetProp(hwnd, sdl_window, data)) {
++#else
+ if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
++#endif
+ ReleaseDC(hwnd, data->hdc);
+ SDL_free(data);
+ return WIN_SetError("SetProp() failed");
+@@ -307,7 +323,11 @@
+ int w, h;
+
+ if (window->flags & SDL_WINDOW_SKIP_TASKBAR) {
++#ifdef __midipix__
++ parent = CreateWindow(SDL_Appname, sdl_empty, STYLE_BASIC, 0, 0, 32, 32, NULL, NULL, SDL_Instance, NULL);
++#else
+ parent = CreateWindow(SDL_Appname, TEXT(""), STYLE_BASIC, 0, 0, 32, 32, NULL, NULL, SDL_Instance, NULL);
++#endif
+ }
+
+ style |= GetWindowStyle(window);
+@@ -315,9 +335,13 @@
+ /* Figure out what the window area will be */
+ WIN_AdjustWindowRectWithStyle(window, style, FALSE, &x, &y, &w, &h, SDL_FALSE);
+
++#ifdef __midipix__
++ hwnd = CreateWindow(SDL_Appname, sdl_empty, style, x, y, w, h, parent, NULL, SDL_Instance, NULL);
++#else
+ hwnd =
+ CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, parent, NULL,
+ SDL_Instance, NULL);
++#endif
+ if (!hwnd) {
+ return WIN_SetError("Couldn't create window");
+ }
+@@ -741,7 +765,11 @@
+
+ if (data) {
+ ReleaseDC(data->hwnd, data->hdc);
++#ifdef __midipix__
++ RemoveProp(data->hwnd, sdl_window);
++#else
+ RemoveProp(data->hwnd, TEXT("SDL_WindowData"));
++#endif
+ if (data->created) {
+ DestroyWindow(data->hwnd);
+ if (data->parent) {
diff --git a/patches/sdl2/win32.patch b/patches/sdl2/win32.patch
new file mode 100644
index 00000000..0cc8167a
--- /dev/null
+++ b/patches/sdl2/win32.patch
@@ -0,0 +1,203 @@
+--- SDL2-2.0.8.orig/src/video/windows/SDL_windowsvideo.c 2018-03-01 17:34:42.000000000 +0100
++++ SDL2-2.0.8/src/video/windows/SDL_windowsvideo.c 2020-10-05 01:07:51.101894646 +0200
+@@ -240,13 +240,17 @@
+ WIN_QuitMouse(_this);
+ }
+
+-
++#ifdef SDL_VIDEO_RENDER_D3D
+ #define D3D_DEBUG_INFO
+ #include <d3d9.h>
++#endif
+
+ SDL_bool
+ D3D_LoadDLL(void **pD3DDLL, IDirect3D9 **pDirect3D9Interface)
+ {
++#ifndef SDL_VIDEO_RENDER_D3D
++ return SDL_FALSE;
++#else
+ *pD3DDLL = SDL_LoadObject("D3D9.DLL");
+ if (*pD3DDLL) {
+ typedef IDirect3D9 *(WINAPI *Direct3DCreate9_t) (UINT SDKVersion);
+@@ -284,12 +288,16 @@
+ }
+ *pDirect3D9Interface = NULL;
+ return SDL_FALSE;
++#endif
+ }
+
+
+ int
+ SDL_Direct3D9GetAdapterIndex(int displayIndex)
+ {
++#ifndef SDL_VIDEO_RENDER_D3D
++ return 0;
++#else
+ void *pD3DDLL;
+ IDirect3D9 *pD3D;
+ if (!D3D_LoadDLL(&pD3DDLL, &pD3D)) {
+@@ -324,6 +332,7 @@
+
+ return adapterIndex;
+ }
++#endif
+ }
+
+ #if HAVE_DXGI_H
+--- SDL2-2.0.8.orig/src/video/windows/SDL_windowsevents.c 2018-03-01 17:34:42.000000000 +0100
++++ SDL2-2.0.8/src/video/windows/SDL_windowsevents.c 2020-10-05 01:59:14.387146659 +0200
+@@ -1162,7 +1166,7 @@
+ }
+ } else {
+ /* Use the first icon as a default icon, like in the Explorer */
+- GetModuleFileName(SDL_Instance, path, MAX_PATH);
++ GetModuleFileNameA(SDL_Instance, path, MAX_PATH);
+ ExtractIconEx(path, 0, &wcex.hIcon, &wcex.hIconSm, 1);
+ }
+
+--- SDL2-2.0.8.orig/include/SDL_system.h 2018-03-01 17:34:41.000000000 +0100
++++ SDL2-2.0.8/include/SDL_system.h 2020-10-05 00:17:56.683991095 +0200
+@@ -41,7 +41,7 @@
+
+
+ /* Platform specific functions for Windows */
+-#ifdef __WIN32__
++#if defined(__WIN32__) || defined(__midipix__)
+
+ /**
+ \brief Set a function that is called for every windows message, before TranslateMessage()
+--- SDL2-2.0.8.orig/src/core/unix/SDL_windows.c 1970-01-01 01:00:00.000000000 +0100
++++ SDL2-2.0.8/src/core/unix/SDL_windows.c 2020-10-05 01:45:58.660207506 +0200
+@@ -0,0 +1,54 @@
++/*
++ Simple DirectMedia Layer
++ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
++
++ This software is provided 'as-is', without any express or implied
++ warranty. In no event will the authors be held liable for any damages
++ arising from the use of this software.
++
++ Permission is granted to anyone to use this software for any purpose,
++ including commercial applications, and to alter it and redistribute it
++ freely, subject to the following restrictions:
++
++ 1. The origin of this software must not be misrepresented; you must not
++ claim that you wrote the original software. If you use this software
++ in a product, an acknowledgment in the product documentation would be
++ appreciated but is not required.
++ 2. Altered source versions must be plainly marked as such, and must not be
++ misrepresented as being the original software.
++ 3. This notice may not be removed or altered from any source distribution.
++*/
++#include "../../SDL_internal.h"
++
++#if defined(__WIN32__) || defined(__WINRT__) || defined(__midipix__)
++
++#include "SDL_windows.h"
++#include "SDL_error.h"
++#include "SDL_assert.h"
++
++#ifndef _WIN32_WINNT_VISTA
++#define _WIN32_WINNT_VISTA 0x0600
++#endif
++
++
++/* Sets an error message based on an HRESULT */
++int
++WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr)
++{
++ TCHAR buffer[1024];
++ char *message;
++ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hr, 0,
++ buffer, SDL_arraysize(buffer), NULL);
++ message = WIN_StringToUTF8(buffer);
++ SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message);
++ SDL_free(message);
++ return -1;
++}
++
++/* Sets an error message based on GetLastError() */
++int
++WIN_SetError(const char *prefix)
++{
++ return WIN_SetErrorFromHRESULT(prefix, GetLastError());
++}
++#endif
+--- SDL2-2.0.8.orig/src/core/unix/SDL_windows.h 1970-01-01 01:00:00.000000000 +0100
++++ SDL2-2.0.8/src/core/unix/SDL_windows.h 2020-10-05 01:36:40.827047116 +0200
+@@ -0,0 +1,75 @@
++/*
++ Simple DirectMedia Layer
++ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
++
++ This software is provided 'as-is', without any express or implied
++ warranty. In no event will the authors be held liable for any damages
++ arising from the use of this software.
++
++ Permission is granted to anyone to use this software for any purpose,
++ including commercial applications, and to alter it and redistribute it
++ freely, subject to the following restrictions:
++
++ 1. The origin of this software must not be misrepresented; you must not
++ claim that you wrote the original software. If you use this software
++ in a product, an acknowledgment in the product documentation would be
++ appreciated but is not required.
++ 2. Altered source versions must be plainly marked as such, and must not be
++ misrepresented as being the original software.
++ 3. This notice may not be removed or altered from any source distribution.
++*/
++
++/* This is an include file for windows.h with the SDL build settings */
++
++#ifndef _INCLUDED_WINDOWS_H
++#define _INCLUDED_WINDOWS_H
++
++#if defined(__WIN32__)
++#define WIN32_LEAN_AND_MEAN
++#define STRICT
++#ifndef UNICODE
++#define UNICODE 1
++#endif
++#undef _WIN32_WINNT
++#define _WIN32_WINNT 0x501 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices(), 0x501 for raw input */
++#endif
++
++#include <windows.h>
++#include <basetyps.h> /* for REFIID with broken mingw.org headers */
++
++/* Routines to convert from UTF8 to native Windows text */
++#if UNICODE
++#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(S), (SDL_wcslen(S)+1)*sizeof(WCHAR))
++#define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UTF-16LE", "UTF-8", (char *)(S), SDL_strlen(S)+1)
++#else
++/* !!! FIXME: UTF8ToString() can just be a SDL_strdup() here. */
++#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)(S), (SDL_strlen(S)+1))
++#define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)(S), SDL_strlen(S)+1)
++#endif
++
++/* Sets an error message based on a given HRESULT */
++extern int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr);
++
++/* Sets an error message based on GetLastError(). Always return -1. */
++extern int WIN_SetError(const char *prefix);
++
++/* Wrap up the oddities of CoInitialize() into a common function. */
++extern HRESULT WIN_CoInitialize(void);
++extern void WIN_CoUninitialize(void);
++
++/* Returns SDL_TRUE if we're running on Windows Vista and newer */
++extern BOOL WIN_IsWindowsVistaOrGreater(void);
++
++/* Returns SDL_TRUE if we're running on Windows 7 and newer */
++extern BOOL WIN_IsWindows7OrGreater(void);
++
++/* You need to SDL_free() the result of this call. */
++extern char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid);
++
++/* Checks to see if two GUID are the same. */
++extern BOOL WIN_IsEqualGUID(const GUID * a, const GUID * b);
++extern BOOL WIN_IsEqualIID(REFIID a, REFIID b);
++
++#endif /* _INCLUDED_WINDOWS_H */
++
++/* vi: set ts=4 sw=4 expandtab: */