Re-added WinRT support until we're sure that it's no longer being used

This commit is contained in:
Sam Lantinga 2022-11-23 10:41:43 -08:00
parent d5572559a5
commit a635a485bc
92 changed files with 8410 additions and 164 deletions

View file

@ -20,7 +20,7 @@
*/
#include "./SDL_internal.h"
#if defined(__WIN32__) || defined(__GDK__)
#if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)
#include "core/windows/SDL_windows.h"
#endif
@ -366,7 +366,7 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list
}
}
#if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__GDK__)
#if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__)
/* Flag tracking the attachment of the console: 0=unattached, 1=attached to a console, 2=attached to a file, -1=error */
static int consoleAttached = 0;
@ -378,7 +378,7 @@ static void SDLCALL
SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
const char *message)
{
#if defined(__WIN32__) || defined(__GDK__)
#if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)
/* Way too many allocations here, urgh */
/* Note: One can't call SDL_SetError here, since that function itself logs. */
{
@ -387,7 +387,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
LPTSTR tstr;
SDL_bool isstack;
#if !defined(HAVE_STDIO_H) && !defined(__GDK__)
#if !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__)
BOOL attachResult;
DWORD attachError;
DWORD charsWritten;
@ -426,7 +426,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
}
}
}
#endif /* !defined(HAVE_STDIO_H) && !defined(__GDK__) */
#endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__) */
length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1;
output = SDL_small_alloc(char, length, &isstack);
@ -436,7 +436,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
/* Output to debugger */
OutputDebugString(tstr);
#if !defined(HAVE_STDIO_H) && !defined(__GDK__)
#if !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__)
/* Screen output to stderr, if console was attached. */
if (consoleAttached == 1) {
if (!WriteConsole(stderrHandle, tstr, (DWORD) SDL_tcslen(tstr), &charsWritten, NULL)) {
@ -451,7 +451,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
OutputDebugString(TEXT("Error calling WriteFile\r\n"));
}
}
#endif /* !defined(HAVE_STDIO_H) && !defined(__GDK__) */
#endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__) */
SDL_free(tstr);
SDL_small_free(output, isstack);