Fixed more Win64 portability issues
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401476
This commit is contained in:
parent
8039553413
commit
302e86a4dc
12 changed files with 28 additions and 25 deletions
BIN
VisualCE.zip
BIN
VisualCE.zip
Binary file not shown.
|
@ -166,7 +166,7 @@ static void __cdecl cleanup_output(void)
|
||||||
/* This is where execution begins [console apps] */
|
/* This is where execution begins [console apps] */
|
||||||
int console_main(int argc, char *argv[])
|
int console_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int n;
|
size_t n;
|
||||||
char *bufp, *appname;
|
char *bufp, *appname;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ char *SDL_getenv(const char *name)
|
||||||
{
|
{
|
||||||
size_t bufferlen;
|
size_t bufferlen;
|
||||||
|
|
||||||
bufferlen = GetEnvironmentVariable(name, SDL_envmem, SDL_envmemlen);
|
bufferlen = GetEnvironmentVariable(name, SDL_envmem, (DWORD)SDL_envmemlen);
|
||||||
if ( bufferlen == 0 ) {
|
if ( bufferlen == 0 ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ char *SDL_getenv(const char *name)
|
||||||
}
|
}
|
||||||
SDL_envmem = newmem;
|
SDL_envmem = newmem;
|
||||||
SDL_envmemlen = bufferlen;
|
SDL_envmemlen = bufferlen;
|
||||||
GetEnvironmentVariable(name, SDL_envmem, SDL_envmemlen);
|
GetEnvironmentVariable(name, SDL_envmem, (DWORD)SDL_envmemlen);
|
||||||
}
|
}
|
||||||
return SDL_envmem;
|
return SDL_envmem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -710,7 +710,7 @@ SDL_Surface *GAPI_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
style = 0;
|
style = 0;
|
||||||
|
|
||||||
if (!SDL_windowid)
|
if (!SDL_windowid)
|
||||||
SetWindowLong(SDL_Window, GWL_STYLE, style);
|
SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
|
||||||
|
|
||||||
/* Allocate bitmap */
|
/* Allocate bitmap */
|
||||||
if(gapiBuffer)
|
if(gapiBuffer)
|
||||||
|
|
|
@ -36,6 +36,9 @@
|
||||||
#ifndef SetWindowLongPtr
|
#ifndef SetWindowLongPtr
|
||||||
#define SetWindowLongPtr SetWindowLong
|
#define SetWindowLongPtr SetWindowLong
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef GWLP_WNDPROC
|
||||||
|
#define GWLP_WNDPROC GWL_WNDPROC
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../SDL_sysvideo.h"
|
#include "../SDL_sysvideo.h"
|
||||||
|
|
||||||
|
|
|
@ -562,7 +562,7 @@ LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
Aparently it's too difficult for MS to check
|
Aparently it's too difficult for MS to check
|
||||||
inside their function, so I have to do it here.
|
inside their function, so I have to do it here.
|
||||||
*/
|
*/
|
||||||
style = GetWindowLong(hwnd, GWL_STYLE);
|
style = GetWindowLongPtr(hwnd, GWL_STYLE);
|
||||||
AdjustWindowRect(
|
AdjustWindowRect(
|
||||||
&size,
|
&size,
|
||||||
style,
|
style,
|
||||||
|
|
|
@ -172,7 +172,7 @@ WMcursor *WIN_CreateWMCursor(_THIS,
|
||||||
|
|
||||||
/* Create the cursor */
|
/* Create the cursor */
|
||||||
cursor->curs = CreateCursor(
|
cursor->curs = CreateCursor(
|
||||||
(HINSTANCE)GetWindowLongPtr(SDL_Window, GWL_HINSTANCE),
|
(HINSTANCE)GetWindowLongPtr(SDL_Window, GWLP_HINSTANCE),
|
||||||
hot_x, hot_y, allowed_x, allowed_y,
|
hot_x, hot_y, allowed_x, allowed_y,
|
||||||
cursor->ands, cursor->xors);
|
cursor->ands, cursor->xors);
|
||||||
if ( cursor->curs == NULL ) {
|
if ( cursor->curs == NULL ) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ static int WIN_GL_ResetWindow(_THIS)
|
||||||
/* Save the existing window attributes */
|
/* Save the existing window attributes */
|
||||||
LONG style;
|
LONG style;
|
||||||
RECT rect = { 0, 0, 0, 0 };
|
RECT rect = { 0, 0, 0, 0 };
|
||||||
style = GetWindowLong(SDL_Window, GWL_STYLE);
|
style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
|
||||||
GetWindowRect(SDL_Window, &rect);
|
GetWindowRect(SDL_Window, &rect);
|
||||||
DestroyWindow(SDL_Window);
|
DestroyWindow(SDL_Window);
|
||||||
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
|
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
/* The translation table from a Microsoft VK keysym to a SDL keysym */
|
/* The translation table from a Microsoft VK keysym to a SDL keysym */
|
||||||
static SDLKey VK_keymap[SDLK_LAST];
|
static SDLKey VK_keymap[SDLK_LAST];
|
||||||
static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed);
|
static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, int pressed);
|
||||||
|
|
||||||
/* Masks for processing the windows KEYDOWN and KEYUP messages */
|
/* Masks for processing the windows KEYDOWN and KEYUP messages */
|
||||||
#define REPEATED_KEYMASK (1<<30)
|
#define REPEATED_KEYMASK (1<<30)
|
||||||
|
@ -376,7 +376,7 @@ void DIB_InitOSKeymap(_THIS)
|
||||||
VK_keymap[VK_APPS] = SDLK_MENU;
|
VK_keymap[VK_APPS] = SDLK_MENU;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed)
|
static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, int pressed)
|
||||||
{
|
{
|
||||||
/* Set the keysym information */
|
/* Set the keysym information */
|
||||||
keysym->scancode = (unsigned char) scancode;
|
keysym->scancode = (unsigned char) scancode;
|
||||||
|
@ -426,8 +426,8 @@ int DIB_CreateWindow(_THIS)
|
||||||
/* DJM: we want all event's for the user specified
|
/* DJM: we want all event's for the user specified
|
||||||
window to be handled by SDL.
|
window to be handled by SDL.
|
||||||
*/
|
*/
|
||||||
userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC);
|
userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWLP_WNDPROC);
|
||||||
SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage);
|
SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)WinMessage);
|
||||||
} else {
|
} else {
|
||||||
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
|
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
|
||||||
(WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
|
(WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
|
||||||
|
@ -444,7 +444,7 @@ int DIB_CreateWindow(_THIS)
|
||||||
void DIB_DestroyWindow(_THIS)
|
void DIB_DestroyWindow(_THIS)
|
||||||
{
|
{
|
||||||
if ( SDL_windowid ) {
|
if ( SDL_windowid ) {
|
||||||
SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc);
|
SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)userWindowProc);
|
||||||
} else {
|
} else {
|
||||||
DestroyWindow(SDL_Window);
|
DestroyWindow(SDL_Window);
|
||||||
}
|
}
|
||||||
|
|
|
@ -647,7 +647,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
screen_pal = DIB_CreatePalette(bpp);
|
screen_pal = DIB_CreatePalette(bpp);
|
||||||
}
|
}
|
||||||
|
|
||||||
style = GetWindowLong(SDL_Window, GWL_STYLE);
|
style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
|
||||||
style &= ~(resizestyle|WS_MAXIMIZE);
|
style &= ~(resizestyle|WS_MAXIMIZE);
|
||||||
if ( (video->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
|
if ( (video->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
|
||||||
style &= ~windowstyle;
|
style &= ~windowstyle;
|
||||||
|
@ -677,7 +677,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
|
|
||||||
/* DJM: Don't piss of anyone who has setup his own window */
|
/* DJM: Don't piss of anyone who has setup his own window */
|
||||||
if ( !SDL_windowid )
|
if ( !SDL_windowid )
|
||||||
SetWindowLong(SDL_Window, GWL_STYLE, style);
|
SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
|
||||||
|
|
||||||
/* Delete the old bitmap if necessary */
|
/* Delete the old bitmap if necessary */
|
||||||
if ( screen_bmp != NULL ) {
|
if ( screen_bmp != NULL ) {
|
||||||
|
@ -780,7 +780,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
bounds.top = SDL_windowY;
|
bounds.top = SDL_windowY;
|
||||||
bounds.right = SDL_windowX+video->w;
|
bounds.right = SDL_windowX+video->w;
|
||||||
bounds.bottom = SDL_windowY+video->h;
|
bounds.bottom = SDL_windowY+video->h;
|
||||||
AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
|
AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
|
||||||
width = bounds.right-bounds.left;
|
width = bounds.right-bounds.left;
|
||||||
height = bounds.bottom-bounds.top;
|
height = bounds.bottom-bounds.top;
|
||||||
if ( (flags & SDL_FULLSCREEN) ) {
|
if ( (flags & SDL_FULLSCREEN) ) {
|
||||||
|
|
|
@ -874,8 +874,8 @@ int DX5_CreateWindow(_THIS)
|
||||||
/* DJM: we want all event's for the user specified
|
/* DJM: we want all event's for the user specified
|
||||||
window to be handled by SDL.
|
window to be handled by SDL.
|
||||||
*/
|
*/
|
||||||
userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC);
|
userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWLP_WNDPROC);
|
||||||
SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage);
|
SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)WinMessage);
|
||||||
} else {
|
} else {
|
||||||
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
|
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
|
||||||
(WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
|
(WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
|
||||||
|
@ -903,7 +903,7 @@ void DX5_DestroyWindow(_THIS)
|
||||||
|
|
||||||
/* Destroy our window */
|
/* Destroy our window */
|
||||||
if ( SDL_windowid ) {
|
if ( SDL_windowid ) {
|
||||||
SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc);
|
SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)userWindowProc);
|
||||||
} else {
|
} else {
|
||||||
DestroyWindow(SDL_Window);
|
DestroyWindow(SDL_Window);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1123,7 +1123,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
}
|
}
|
||||||
#endif /* !NO_CHANGEDISPLAYSETTINGS */
|
#endif /* !NO_CHANGEDISPLAYSETTINGS */
|
||||||
|
|
||||||
style = GetWindowLong(SDL_Window, GWL_STYLE);
|
style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
|
||||||
style &= ~(resizestyle|WS_MAXIMIZE);
|
style &= ~(resizestyle|WS_MAXIMIZE);
|
||||||
if ( video->flags & SDL_FULLSCREEN ) {
|
if ( video->flags & SDL_FULLSCREEN ) {
|
||||||
style &= ~windowstyle;
|
style &= ~windowstyle;
|
||||||
|
@ -1148,7 +1148,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
|
|
||||||
/* DJM: Don't piss of anyone who has setup his own window */
|
/* DJM: Don't piss of anyone who has setup his own window */
|
||||||
if ( !SDL_windowid )
|
if ( !SDL_windowid )
|
||||||
SetWindowLong(SDL_Window, GWL_STYLE, style);
|
SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
|
||||||
|
|
||||||
/* Resize the window (copied from SDL WinDIB driver) */
|
/* Resize the window (copied from SDL WinDIB driver) */
|
||||||
if ( !SDL_windowid && !IsZoomed(SDL_Window) ) {
|
if ( !SDL_windowid && !IsZoomed(SDL_Window) ) {
|
||||||
|
@ -1178,7 +1178,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
bounds.top = SDL_windowY;
|
bounds.top = SDL_windowY;
|
||||||
bounds.right = SDL_windowX+video->w;
|
bounds.right = SDL_windowX+video->w;
|
||||||
bounds.bottom = SDL_windowY+video->h;
|
bounds.bottom = SDL_windowY+video->h;
|
||||||
AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
|
AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
|
||||||
width = bounds.right-bounds.left;
|
width = bounds.right-bounds.left;
|
||||||
height = bounds.bottom-bounds.top;
|
height = bounds.bottom-bounds.top;
|
||||||
if ( (flags & SDL_FULLSCREEN) ) {
|
if ( (flags & SDL_FULLSCREEN) ) {
|
||||||
|
@ -1217,7 +1217,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the appropriate window style */
|
/* Set the appropriate window style */
|
||||||
style = GetWindowLong(SDL_Window, GWL_STYLE);
|
style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
|
||||||
style &= ~(resizestyle|WS_MAXIMIZE);
|
style &= ~(resizestyle|WS_MAXIMIZE);
|
||||||
if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
|
if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
|
||||||
style &= ~windowstyle;
|
style &= ~windowstyle;
|
||||||
|
@ -1239,7 +1239,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
}
|
}
|
||||||
/* DJM: Don't piss of anyone who has setup his own window */
|
/* DJM: Don't piss of anyone who has setup his own window */
|
||||||
if ( !SDL_windowid )
|
if ( !SDL_windowid )
|
||||||
SetWindowLong(SDL_Window, GWL_STYLE, style);
|
SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
|
||||||
|
|
||||||
/* Set DirectDraw sharing mode.. exclusive when fullscreen */
|
/* Set DirectDraw sharing mode.. exclusive when fullscreen */
|
||||||
if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
|
if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
|
||||||
|
@ -1264,7 +1264,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
bounds.top = 0;
|
bounds.top = 0;
|
||||||
bounds.right = GetSystemMetrics(SM_CXSCREEN);
|
bounds.right = GetSystemMetrics(SM_CXSCREEN);
|
||||||
bounds.bottom = GetSystemMetrics(SM_CYSCREEN);
|
bounds.bottom = GetSystemMetrics(SM_CYSCREEN);
|
||||||
AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
|
AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
|
||||||
SetWindowPos(SDL_Window, HWND_TOPMOST,
|
SetWindowPos(SDL_Window, HWND_TOPMOST,
|
||||||
bounds.left, bounds.top,
|
bounds.left, bounds.top,
|
||||||
bounds.right - bounds.left,
|
bounds.right - bounds.left,
|
||||||
|
@ -1581,7 +1581,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
bounds.top = SDL_windowY;
|
bounds.top = SDL_windowY;
|
||||||
bounds.right = SDL_windowX+video->w;
|
bounds.right = SDL_windowX+video->w;
|
||||||
bounds.bottom = SDL_windowY+video->h;
|
bounds.bottom = SDL_windowY+video->h;
|
||||||
AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
|
AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
|
||||||
width = bounds.right-bounds.left;
|
width = bounds.right-bounds.left;
|
||||||
height = bounds.bottom-bounds.top;
|
height = bounds.bottom-bounds.top;
|
||||||
if ( center ) {
|
if ( center ) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue