Incorporated slightly modified version of Rainer's WinCE patch
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40113
This commit is contained in:
parent
b444cb0240
commit
37aa008a3e
3 changed files with 28 additions and 3 deletions
|
@ -16,8 +16,10 @@
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
#include "SDL_main.h"
|
#include "SDL_main.h"
|
||||||
#ifdef main
|
#ifdef main
|
||||||
|
#ifndef _WIN32_WCE_EMULATION
|
||||||
#undef main
|
#undef main
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Do we really not want stdio redirection with Windows CE? */
|
/* Do we really not want stdio redirection with Windows CE? */
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
|
@ -28,7 +30,7 @@
|
||||||
#define STDOUT_FILE TEXT("stdout.txt")
|
#define STDOUT_FILE TEXT("stdout.txt")
|
||||||
#define STDERR_FILE TEXT("stderr.txt")
|
#define STDERR_FILE TEXT("stderr.txt")
|
||||||
|
|
||||||
#ifdef _WIN32_WCE
|
#if defined(_WIN32_WCE) && _WIN32_WCE < 300
|
||||||
/* seems to be undefined in Win CE although in online help */
|
/* seems to be undefined in Win CE although in online help */
|
||||||
#define isspace(a) (((CHAR)a == ' ') || ((CHAR)a == '\t'))
|
#define isspace(a) (((CHAR)a == ' ') || ((CHAR)a == '\t'))
|
||||||
|
|
||||||
|
@ -52,7 +54,7 @@ char *strrchr(char *str, int c)
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
#endif /* _WIN32_WCE */
|
#endif /* _WIN32_WCE < 300 */
|
||||||
|
|
||||||
/* Parse a command line buffer into arguments */
|
/* Parse a command line buffer into arguments */
|
||||||
static int ParseCommandLine(char *cmdline, char **argv)
|
static int ParseCommandLine(char *cmdline, char **argv)
|
||||||
|
@ -274,7 +276,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
|
||||||
nLen = wcslen(szCmdLine)+128+1;
|
nLen = wcslen(szCmdLine)+128+1;
|
||||||
bufp = (wchar_t *)alloca(nLen*2);
|
bufp = (wchar_t *)alloca(nLen*2);
|
||||||
GetModuleFileName(NULL, bufp, 128);
|
GetModuleFileName(NULL, bufp, 128);
|
||||||
wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen);
|
wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp));
|
||||||
nLen = wcslen(bufp)+1;
|
nLen = wcslen(bufp)+1;
|
||||||
cmdline = (char *)alloca(nLen);
|
cmdline = (char *)alloca(nLen);
|
||||||
if ( cmdline == NULL ) {
|
if ( cmdline == NULL ) {
|
||||||
|
|
|
@ -87,6 +87,26 @@ LONG
|
||||||
wParam = VK_LMENU;
|
wParam = VK_LMENU;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef NO_GETKEYBOARDSTATE
|
||||||
|
/* this is the workaround for the missing ToAscii() and ToUnicode() in CE (not necessary at KEYUP!) */
|
||||||
|
if ( SDL_TranslateUNICODE ) {
|
||||||
|
MSG msg;
|
||||||
|
|
||||||
|
msg.hwnd = hwnd;
|
||||||
|
msg.message = msg;
|
||||||
|
msg.wParam = wParam;
|
||||||
|
msg.lParam = lParam;
|
||||||
|
msg.time = 0;
|
||||||
|
if ( TranslateMessage(&m) && PeekMessage(&msg, hwnd, 0, WM_USER, PM_NOREMOVE) && (m.message == WM_CHAR) ) {
|
||||||
|
GetMessage(&m, hwnd, 0, WM_USER);
|
||||||
|
wParam = m.wParam;
|
||||||
|
} else {
|
||||||
|
wParam = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
wParam = 0;
|
||||||
|
}
|
||||||
|
#endif /* NO_GETKEYBOARDSTATE */
|
||||||
posted = SDL_PrivateKeyboard(SDL_PRESSED,
|
posted = SDL_PrivateKeyboard(SDL_PRESSED,
|
||||||
TranslateKey(wParam,HIWORD(lParam),&keysym,1));
|
TranslateKey(wParam,HIWORD(lParam),&keysym,1));
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,9 +375,12 @@ static int DIB_SussScreenDepth()
|
||||||
hdc = GetDC(SDL_Window);
|
hdc = GetDC(SDL_Window);
|
||||||
depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
|
depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
|
||||||
ReleaseDC(SDL_Window, hdc);
|
ReleaseDC(SDL_Window, hdc);
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
|
// AFAIK 16 bit CE devices have indeed RGB 565
|
||||||
if ( depth == 16 ) {
|
if ( depth == 16 ) {
|
||||||
depth = 15; /* GDI defined as RGB 555 */
|
depth = 15; /* GDI defined as RGB 555 */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return(depth);
|
return(depth);
|
||||||
#else
|
#else
|
||||||
int dib_size;
|
int dib_size;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue