Integrated David Ludwig's support for Windows RT

This commit is contained in:
Sam Lantinga 2014-03-09 11:36:47 -07:00
commit a7d2ebb8d6
79 changed files with 9656 additions and 33 deletions

View file

@ -20,7 +20,7 @@
*/
#include "./SDL_internal.h"
#if defined(__WIN32__)
#if defined(__WIN32__) || defined(__WINRT__)
#include "core/windows/SDL_windows.h"
#endif
@ -318,13 +318,15 @@ static void
SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
const char *message)
{
#if defined(__WIN32__)
#if defined(__WIN32__) || defined(__WINRT__)
/* Way too many allocations here, urgh */
/* Note: One can't call SDL_SetError here, since that function itself logs. */
{
char *output;
size_t length;
LPTSTR tstr;
#ifndef __WINRT__
BOOL attachResult;
DWORD attachError;
unsigned long charsWritten;
@ -356,6 +358,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
stderrHandle = GetStdHandle(STD_ERROR_HANDLE);
}
}
#endif /* ifndef __WINRT__ */
length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1;
output = SDL_stack_alloc(char, length);
@ -365,6 +368,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
/* Output to debugger */
OutputDebugString(tstr);
#ifndef __WINRT__
/* Screen output to stderr, if console was attached. */
if (consoleAttached == 1) {
if (!WriteConsole(stderrHandle, tstr, lstrlen(tstr), &charsWritten, NULL)) {
@ -374,6 +378,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
OutputDebugString(TEXT("Insufficient heap memory to write message\r\n"));
}
}
#endif /* ifndef __WINRT__ */
SDL_free(tstr);
SDL_stack_free(output);