mirror of
https://github.com/joel16/SDL2.git
synced 2025-02-21 04:01:16 +00:00
Updated for embedded Visual C++ 4.0
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40454
This commit is contained in:
parent
a12335985b
commit
a3897183c7
@ -39,6 +39,7 @@ EXTRA_DIST = \
|
||||
Borland.zip \
|
||||
VisualC.html \
|
||||
VisualC.zip \
|
||||
VisualCE.zip \
|
||||
MPWmake.sea.bin \
|
||||
CWprojects.sea.bin \
|
||||
PBProjects.tar.gz \
|
||||
|
@ -1,8 +1,7 @@
|
||||
|
||||
Project files for embedded Visual C++ 4.0 can be found in VisualCE.zip
|
||||
|
||||
NOTE:
|
||||
SDL is NOT SUPPORTED on the WinCE platform! This is for experimental
|
||||
purposes only.
|
||||
|
||||
There are several SDL features not available in the WinCE port of SDL.
|
||||
|
||||
- DirectX is not yet available
|
||||
|
BIN
VisualCE.zip
Normal file
BIN
VisualCE.zip
Normal file
Binary file not shown.
@ -30,9 +30,10 @@ static char rcsid =
|
||||
|
||||
/* Redefine main() on Win32 and MacOS so that it is called by winmain.c */
|
||||
|
||||
#if defined(WIN32) || (defined(__MWERKS__) && !defined(__BEOS__)) || \
|
||||
defined(macintosh) || defined(__APPLE__) || defined(__SYMBIAN32__) || \
|
||||
defined(QWS)
|
||||
#if defined(WIN32) || defined(_WIN32) || \
|
||||
(defined(__MWERKS__) && !defined(__BEOS__)) || \
|
||||
defined(macintosh) || defined(__APPLE__) || \
|
||||
defined(__SYMBIAN32__) || defined(QWS)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define C_LINKAGE "C"
|
||||
|
@ -63,7 +63,7 @@ static int Audio_Available(void)
|
||||
|
||||
/* Version check DSOUND.DLL (Is DirectX okay?) */
|
||||
dsound_ok = 0;
|
||||
DSoundDLL = LoadLibrary("DSOUND.DLL");
|
||||
DSoundDLL = LoadLibrary(TEXT("DSOUND.DLL"));
|
||||
if ( DSoundDLL != NULL ) {
|
||||
/* We just use basic DirectSound, we're okay */
|
||||
/* Yay! */
|
||||
@ -95,7 +95,7 @@ static int Audio_Available(void)
|
||||
* to fall back to the DIB driver. */
|
||||
if (dsound_ok) {
|
||||
/* DirectSoundCaptureCreate was added in DX5 */
|
||||
if (!GetProcAddress(DSoundDLL, "DirectSoundCaptureCreate"))
|
||||
if (!GetProcAddress(DSoundDLL, TEXT("DirectSoundCaptureCreate")))
|
||||
dsound_ok = 0;
|
||||
|
||||
}
|
||||
@ -121,10 +121,10 @@ static int DX5_Load(void)
|
||||
int status;
|
||||
|
||||
DX5_Unload();
|
||||
DSoundDLL = LoadLibrary("DSOUND.DLL");
|
||||
DSoundDLL = LoadLibrary(TEXT("DSOUND.DLL"));
|
||||
if ( DSoundDLL != NULL ) {
|
||||
DSoundCreate = (void *)GetProcAddress(DSoundDLL,
|
||||
"DirectSoundCreate");
|
||||
TEXT("DirectSoundCreate"));
|
||||
}
|
||||
if ( DSoundDLL && DSoundCreate ) {
|
||||
status = 0;
|
||||
@ -189,7 +189,7 @@ AudioBootStrap DSOUND_bootstrap = {
|
||||
static void SetDSerror(const char *function, int code)
|
||||
{
|
||||
static const char *error;
|
||||
static char errbuf[BUFSIZ];
|
||||
static char errbuf[1024];
|
||||
|
||||
errbuf[0] = 0;
|
||||
switch (code) {
|
||||
|
@ -225,6 +225,9 @@ int console_main(int argc, char *argv[])
|
||||
|
||||
/* Exit cleanly, calling atexit() functions */
|
||||
exit(0);
|
||||
|
||||
/* Hush little compiler, don't you cry... */
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* This is where execution begins [windowed apps] */
|
||||
|
@ -33,8 +33,8 @@ static char rcsid =
|
||||
#include "SDL_error.h"
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#define USE_GETTICKCOUNT
|
||||
#define USE_SETTIMER
|
||||
//#define USE_GETTICKCOUNT
|
||||
//#define USE_SETTIMER
|
||||
#endif
|
||||
|
||||
#define TIME_WRAP_VALUE (~(DWORD)0)
|
||||
|
@ -42,6 +42,7 @@ static char rcsid =
|
||||
#ifndef _WIN32_WCE
|
||||
#define HAVE_OPENGL
|
||||
#endif
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
@ -53,7 +53,11 @@ static char rcsid =
|
||||
#define DINPUT_FULLSCREEN() DDRAW_FULLSCREEN()
|
||||
|
||||
/* The main window -- and a function to set it for the audio */
|
||||
extern const char *SDL_Appname;
|
||||
#ifdef _WIN32_WCE
|
||||
extern LPWSTR SDL_Appname;
|
||||
#else
|
||||
extern LPSTR SDL_Appname;
|
||||
#endif
|
||||
extern HINSTANCE SDL_Instance;
|
||||
extern HWND SDL_Window;
|
||||
extern const char *SDL_windowid;
|
||||
|
@ -47,10 +47,15 @@ static char rcsid =
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#define NO_GETKEYBOARDSTATE
|
||||
#define NO_CHANGEDISPLAYSETTINGS
|
||||
#endif
|
||||
|
||||
/* The window we use for everything... */
|
||||
const char *SDL_Appname = NULL;
|
||||
#ifdef _WIN32_WCE
|
||||
LPWSTR SDL_Appname = NULL;
|
||||
#else
|
||||
LPSTR SDL_Appname = NULL;
|
||||
#endif
|
||||
HINSTANCE SDL_Instance = NULL;
|
||||
HWND SDL_Window = NULL;
|
||||
RECT SDL_bounds = {0, 0, 0, 0};
|
||||
@ -578,21 +583,22 @@ int SDL_RegisterApp(char *name, Uint32 style, void *hInst)
|
||||
class.hCursor = NULL;
|
||||
#ifdef _WIN32_WCE
|
||||
{
|
||||
/* WinCE uses the UNICODE version */
|
||||
int nLen = strlen(name)+1;
|
||||
LPWSTR lpszW = alloca(nLen*2);
|
||||
MultiByteToWideChar(CP_ACP, 0, name, -1, lpszW, nLen);
|
||||
class.hIcon = LoadImage(hInst, lpszW, IMAGE_ICON,
|
||||
0, 0, LR_DEFAULTCOLOR);
|
||||
class.lpszMenuName = NULL;
|
||||
class.lpszClassName = lpszW;
|
||||
/* WinCE uses the UNICODE version */
|
||||
int nLen = strlen(name)+1;
|
||||
SDL_Appname = malloc(nLen*2);
|
||||
MultiByteToWideChar(CP_ACP, 0, name, -1, SDL_Appname, nLen);
|
||||
}
|
||||
#else
|
||||
class.hIcon = LoadImage(hInst, name, IMAGE_ICON,
|
||||
0, 0, LR_DEFAULTCOLOR);
|
||||
class.lpszMenuName = "(none)";
|
||||
class.lpszClassName = name;
|
||||
{
|
||||
int nLen = strlen(name)+1;
|
||||
SDL_Appname = malloc(nLen);
|
||||
strcpy(SDL_Appname, name);
|
||||
}
|
||||
#endif /* _WIN32_WCE */
|
||||
class.hIcon = LoadImage(hInst, SDL_Appname, IMAGE_ICON,
|
||||
0, 0, LR_DEFAULTCOLOR);
|
||||
class.lpszMenuName = NULL;
|
||||
class.lpszClassName = SDL_Appname;
|
||||
class.hbrBackground = NULL;
|
||||
class.hInstance = hInst;
|
||||
class.style = style;
|
||||
@ -606,7 +612,6 @@ int SDL_RegisterApp(char *name, Uint32 style, void *hInst)
|
||||
SDL_SetError("Couldn't register application class");
|
||||
return(-1);
|
||||
}
|
||||
SDL_Appname = name;
|
||||
SDL_Instance = hInst;
|
||||
|
||||
#ifdef WM_MOUSELEAVE
|
||||
|
@ -27,7 +27,9 @@ static char rcsid =
|
||||
|
||||
/* WGL implementation of SDL OpenGL support */
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
#include "SDL_opengl.h"
|
||||
#endif
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_lowvideo.h"
|
||||
#include "SDL_wingl_c.h"
|
||||
@ -264,10 +266,6 @@ void WIN_GL_SwapBuffers(_THIS)
|
||||
SwapBuffers(GL_hdc);
|
||||
}
|
||||
|
||||
#endif /* HAVE_OPENGL */
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
|
||||
void WIN_GL_UnloadLibrary(_THIS)
|
||||
{
|
||||
if ( this->gl_config.driver_loaded ) {
|
||||
|
@ -333,28 +333,9 @@ static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, in
|
||||
|
||||
int DIB_CreateWindow(_THIS)
|
||||
{
|
||||
#ifdef _WIN32_WCE
|
||||
/* WinCE uses the UNICODE version */
|
||||
int nLen;
|
||||
LPWSTR lpszW;
|
||||
|
||||
if ( SDL_RegisterApp("SDL_app", 0, 0) != 0 ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
nLen = strlen(SDL_Appname) + 1;
|
||||
lpszW = alloca(nLen * 2);
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, "SDL_App", -1, lpszW, nLen);
|
||||
|
||||
SDL_Window = CreateWindow(lpszW, lpszW, WS_VISIBLE,
|
||||
0, 0, 0, 0, NULL, NULL, SDL_Instance, NULL);
|
||||
if ( SDL_Window == NULL ) {
|
||||
SDL_SetError("Couldn't create window");
|
||||
return(-1);
|
||||
}
|
||||
ShowWindow(SDL_Window, SW_HIDE);
|
||||
#else
|
||||
#ifndef CS_BYTEALIGNCLIENT
|
||||
#define CS_BYTEALIGNCLIENT 0
|
||||
#endif
|
||||
SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0);
|
||||
if ( SDL_windowid ) {
|
||||
SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0);
|
||||
@ -376,8 +357,6 @@ int DIB_CreateWindow(_THIS)
|
||||
}
|
||||
ShowWindow(SDL_Window, SW_HIDE);
|
||||
}
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,15 @@ static char rcsid =
|
||||
#define NO_CHANGEDISPLAYSETTINGS
|
||||
#define NO_GAMMA_SUPPORT
|
||||
#endif
|
||||
#ifndef WS_MAXIMIZE
|
||||
#define WS_MAXIMIZE 0
|
||||
#endif
|
||||
#ifndef SWP_NOCOPYBITS
|
||||
#define SWP_NOCOPYBITS 0
|
||||
#endif
|
||||
#ifndef PC_NOCOLLAPSE
|
||||
#define PC_NOCOLLAPSE 0
|
||||
#endif
|
||||
|
||||
/* Initialization/Query functions */
|
||||
static int DIB_VideoInit(_THIS, SDL_PixelFormat *vformat);
|
||||
@ -143,11 +152,11 @@ static SDL_VideoDevice *DIB_CreateDevice(int devindex)
|
||||
device->SetGammaRamp = DIB_SetGammaRamp;
|
||||
device->GetGammaRamp = DIB_GetGammaRamp;
|
||||
#ifdef HAVE_OPENGL
|
||||
device->GL_LoadLibrary = WIN_GL_LoadLibrary;
|
||||
device->GL_GetProcAddress = WIN_GL_GetProcAddress;
|
||||
device->GL_GetAttribute = WIN_GL_GetAttribute;
|
||||
device->GL_MakeCurrent = WIN_GL_MakeCurrent;
|
||||
device->GL_SwapBuffers = WIN_GL_SwapBuffers;
|
||||
device->GL_LoadLibrary = WIN_GL_LoadLibrary;
|
||||
device->GL_GetProcAddress = WIN_GL_GetProcAddress;
|
||||
device->GL_GetAttribute = WIN_GL_GetAttribute;
|
||||
device->GL_MakeCurrent = WIN_GL_MakeCurrent;
|
||||
device->GL_SwapBuffers = WIN_GL_SwapBuffers;
|
||||
#endif
|
||||
device->SetCaption = WIN_SetWMCaption;
|
||||
device->SetIcon = WIN_SetWMIcon;
|
||||
@ -440,10 +449,8 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
(WS_POPUP);
|
||||
const DWORD windowstyle =
|
||||
(WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX);
|
||||
#ifndef _WIN32_WCE
|
||||
const DWORD resizestyle =
|
||||
(WS_THICKFRAME|WS_MAXIMIZEBOX);
|
||||
#endif
|
||||
int binfo_size;
|
||||
BITMAPINFO *binfo;
|
||||
HDC hdc;
|
||||
@ -455,12 +462,10 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
/* See whether or not we should center the window */
|
||||
was_visible = IsWindowVisible(SDL_Window);
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
/* Clean up any GL context that may be hanging around */
|
||||
if ( current->flags & SDL_OPENGL ) {
|
||||
WIN_GL_ShutDown(this);
|
||||
}
|
||||
#endif /* HAVE_OPENGL */
|
||||
|
||||
/* Recalculate the bitmasks if necessary */
|
||||
if ( bpp == current->format->BitsPerPixel ) {
|
||||
@ -542,9 +547,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
}
|
||||
|
||||
style = GetWindowLong(SDL_Window, GWL_STYLE);
|
||||
#ifndef _WIN32_WCE
|
||||
style &= ~(resizestyle|WS_MAXIMIZE);
|
||||
#endif
|
||||
if ( (video->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
|
||||
style &= ~windowstyle;
|
||||
style |= directstyle;
|
||||
@ -562,13 +565,11 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
style &= ~directstyle;
|
||||
style |= windowstyle;
|
||||
if ( flags & SDL_RESIZABLE ) {
|
||||
#ifndef _WIN32_WCE
|
||||
style |= resizestyle;
|
||||
#endif
|
||||
video->flags |= SDL_RESIZABLE;
|
||||
}
|
||||
}
|
||||
#ifndef _WIN32_WCE
|
||||
#if WS_MAXIMIZE
|
||||
if (IsZoomed(SDL_Window)) style |= WS_MAXIMIZE;
|
||||
#endif
|
||||
}
|
||||
@ -659,11 +660,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
bounds.top = 0;
|
||||
bounds.right = video->w;
|
||||
bounds.bottom = video->h;
|
||||
#ifndef _WIN32_WCE
|
||||
AdjustWindowRect(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE);
|
||||
#else
|
||||
AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE,0);
|
||||
#endif
|
||||
AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
|
||||
width = bounds.right-bounds.left;
|
||||
height = bounds.bottom-bounds.top;
|
||||
x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
|
||||
@ -671,11 +668,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
if ( y < 0 ) { /* Cover up title bar for more client area */
|
||||
y -= GetSystemMetrics(SM_CYCAPTION)/2;
|
||||
}
|
||||
#ifndef _WIN32_WCE
|
||||
swp_flags = (SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_SHOWWINDOW);
|
||||
#else
|
||||
swp_flags = (SWP_FRAMECHANGED | SWP_SHOWWINDOW);
|
||||
#endif
|
||||
if ( was_visible && !(flags & SDL_FULLSCREEN) ) {
|
||||
swp_flags |= SWP_NOMOVE;
|
||||
}
|
||||
@ -689,7 +682,6 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
SetForegroundWindow(SDL_Window);
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
/* Set up for OpenGL */
|
||||
if ( flags & SDL_OPENGL ) {
|
||||
if ( WIN_GL_SetupWindow(this) < 0 ) {
|
||||
@ -697,7 +689,6 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
}
|
||||
video->flags |= SDL_OPENGL;
|
||||
}
|
||||
#endif /* HAVE_OPENGL */
|
||||
|
||||
/* We're live! */
|
||||
return(video);
|
||||
@ -760,11 +751,7 @@ int DIB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
|
||||
entries[i].peRed = colors[i].r;
|
||||
entries[i].peGreen = colors[i].g;
|
||||
entries[i].peBlue = colors[i].b;
|
||||
#ifndef _WIN32_WCE
|
||||
entries[i].peFlags = PC_NOCOLLAPSE;
|
||||
#else
|
||||
entries[i].peFlags = 0;
|
||||
#endif
|
||||
}
|
||||
SetPaletteEntries(screen_pal, firstcolor, ncolors, entries);
|
||||
SelectPalette(hdc, screen_pal, FALSE);
|
||||
@ -917,11 +904,9 @@ void DIB_VideoQuit(_THIS)
|
||||
ShowWindow(SDL_Window, SW_HIDE);
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_OPENGL
|
||||
if ( this->screen->flags & SDL_OPENGL ) {
|
||||
WIN_GL_ShutDown(this);
|
||||
}
|
||||
#endif /* HAVE_OPENGL */
|
||||
this->screen->pixels = NULL;
|
||||
}
|
||||
if ( screen_bmp ) {
|
||||
|
@ -43,6 +43,10 @@ static char rcsid =
|
||||
#define WM_APP 0x8000
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#define NO_GETKEYBOARDSTATE
|
||||
#endif
|
||||
|
||||
/* The keyboard and mouse device input */
|
||||
#define MAX_INPUTS 16 /* Maximum of 16-1 input devices */
|
||||
#define INPUT_QSIZE 32 /* Buffer up to 32 input messages */
|
||||
@ -67,7 +71,7 @@ static WNDPROC userWindowProc = NULL;
|
||||
static void SetDIerror(char *function, int code)
|
||||
{
|
||||
static char *error;
|
||||
static char errbuf[BUFSIZ];
|
||||
static char errbuf[1024];
|
||||
|
||||
errbuf[0] = 0;
|
||||
switch (code) {
|
||||
@ -449,6 +453,7 @@ LONG
|
||||
DX5_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg) {
|
||||
#ifdef WM_ACTIVATEAPP
|
||||
case WM_ACTIVATEAPP: {
|
||||
int i, active;
|
||||
|
||||
@ -467,7 +472,9 @@ LONG
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif /* WM_ACTIVATEAPP */
|
||||
|
||||
#ifdef WM_DISPLAYCHANGE
|
||||
case WM_DISPLAYCHANGE: {
|
||||
WORD BitsPerPixel;
|
||||
WORD SizeX, SizeY;
|
||||
@ -479,6 +486,7 @@ LONG
|
||||
/* We cause this message when we go fullscreen */
|
||||
}
|
||||
break;
|
||||
#endif /* WM_DISPLAYCHANGE */
|
||||
|
||||
/* The keyboard is handled via DirectInput */
|
||||
case WM_SYSKEYUP:
|
||||
@ -489,6 +497,7 @@ LONG
|
||||
}
|
||||
return(0);
|
||||
|
||||
#if defined(SC_SCREENSAVE) || defined(SC_MONITORPOWER)
|
||||
/* Don't allow screen savers or monitor power downs.
|
||||
This is because they quietly clear DirectX surfaces.
|
||||
It would be better to allow the application to
|
||||
@ -501,11 +510,11 @@ LONG
|
||||
(wParam&0xFFF0)==SC_MONITORPOWER)
|
||||
return(0);
|
||||
}
|
||||
goto custom_processing;
|
||||
break;
|
||||
/* Fall through to default processing */
|
||||
|
||||
#endif /* SC_SCREENSAVE || SC_MONITORPOWER */
|
||||
|
||||
default: {
|
||||
custom_processing:
|
||||
/* Only post the event if we're watching for it */
|
||||
if ( SDL_ProcessEvents[SDL_SYSWMEVENT] == SDL_ENABLE ) {
|
||||
SDL_SysWMmsg wmmsg;
|
||||
@ -759,14 +768,21 @@ static SDL_keysym *TranslateKey(UINT scancode, SDL_keysym *keysym, int pressed)
|
||||
keysym->unicode = 0;
|
||||
if ( pressed && SDL_TranslateUNICODE ) { /* Someday use ToUnicode() */
|
||||
UINT vkey;
|
||||
#ifndef NO_GETKEYBOARDSTATE
|
||||
BYTE keystate[256];
|
||||
BYTE chars[2];
|
||||
#endif
|
||||
|
||||
vkey = MapVirtualKey(scancode, 1);
|
||||
#ifdef NO_GETKEYBOARDSTATE
|
||||
/* Uh oh, better hope the vkey is close enough.. */
|
||||
keysym->unicode = vkey;
|
||||
#else
|
||||
GetKeyboardState(keystate);
|
||||
if ( ToAscii(vkey,scancode,keystate,(WORD *)chars,0) == 1 ) {
|
||||
keysym->unicode = chars[0];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return(keysym);
|
||||
}
|
||||
@ -782,7 +798,9 @@ int DX5_CreateWindow(_THIS)
|
||||
SDL_DIfun[i] = NULL;
|
||||
}
|
||||
|
||||
/* Create the SDL window */
|
||||
#ifndef CS_BYTEALIGNCLIENT
|
||||
#define CS_BYTEALIGNCLIENT 0
|
||||
#endif
|
||||
SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0);
|
||||
if ( SDL_windowid ) {
|
||||
SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0);
|
||||
|
@ -51,10 +51,23 @@ static char rcsid =
|
||||
#include "SDL_dx5yuv_c.h"
|
||||
#include "SDL_wingl_c.h"
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#define NO_CHANGEDISPLAYSETTINGS
|
||||
#endif
|
||||
#ifndef WS_MAXIMIZE
|
||||
#define WS_MAXIMIZE 0
|
||||
#endif
|
||||
#ifndef SWP_NOCOPYBITS
|
||||
#define SWP_NOCOPYBITS 0
|
||||
#endif
|
||||
#ifndef PC_NOCOLLAPSE
|
||||
#define PC_NOCOLLAPSE 0
|
||||
#endif
|
||||
|
||||
|
||||
/* DirectX function pointers for video and events */
|
||||
HRESULT (WINAPI *DDrawCreate)( GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter );
|
||||
HRESULT (WINAPI *DInputCreate)(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter);
|
||||
HRESULT (WINAPI *DInputCreate)(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUT *ppDI, LPUNKNOWN punkOuter);
|
||||
|
||||
/* This is the rect EnumModes2 uses */
|
||||
struct DX5EnumRect {
|
||||
@ -443,19 +456,19 @@ static int DX5_Available(void)
|
||||
|
||||
/* Version check DINPUT.DLL and DDRAW.DLL (Is DirectX okay?) */
|
||||
dinput_ok = 0;
|
||||
DInputDLL = LoadLibrary("DINPUT.DLL");
|
||||
DInputDLL = LoadLibrary(TEXT("DINPUT.DLL"));
|
||||
if ( DInputDLL != NULL ) {
|
||||
dinput_ok = 1;
|
||||
FreeLibrary(DInputDLL);
|
||||
}
|
||||
ddraw_ok = 0;
|
||||
DDrawDLL = LoadLibrary("DDRAW.DLL");
|
||||
DDrawDLL = LoadLibrary(TEXT("DDRAW.DLL"));
|
||||
if ( DDrawDLL != NULL ) {
|
||||
HRESULT (WINAPI *DDrawCreate)(GUID *,LPDIRECTDRAW *,IUnknown *);
|
||||
LPDIRECTDRAW DDraw;
|
||||
|
||||
/* Try to create a valid DirectDraw object */
|
||||
DDrawCreate = (void *)GetProcAddress(DDrawDLL, "DirectDrawCreate");
|
||||
DDrawCreate = (void *)GetProcAddress(DDrawDLL, TEXT("DirectDrawCreate"));
|
||||
if ( (DDrawCreate != NULL)
|
||||
&& !FAILED(DDrawCreate(NULL, &DDraw, NULL)) ) {
|
||||
if ( !FAILED(IDirectDraw_SetCooperativeLevel(DDraw,
|
||||
@ -511,15 +524,15 @@ static int DX5_Load(void)
|
||||
int status;
|
||||
|
||||
DX5_Unload();
|
||||
DDrawDLL = LoadLibrary("DDRAW.DLL");
|
||||
DDrawDLL = LoadLibrary(TEXT("DDRAW.DLL"));
|
||||
if ( DDrawDLL != NULL ) {
|
||||
DDrawCreate = (void *)GetProcAddress(DDrawDLL,
|
||||
"DirectDrawCreate");
|
||||
TEXT("DirectDrawCreate"));
|
||||
}
|
||||
DInputDLL = LoadLibrary("DINPUT.DLL");
|
||||
DInputDLL = LoadLibrary(TEXT("DINPUT.DLL"));
|
||||
if ( DInputDLL != NULL ) {
|
||||
DInputCreate = (void *)GetProcAddress(DInputDLL,
|
||||
"DirectInputCreateA");
|
||||
TEXT("DirectInputCreateA"));
|
||||
}
|
||||
if ( DDrawDLL && DDrawCreate && DInputDLL && DInputCreate ) {
|
||||
status = 0;
|
||||
@ -596,11 +609,11 @@ static SDL_VideoDevice *DX5_CreateDevice(int devindex)
|
||||
device->SetGammaRamp = DX5_SetGammaRamp;
|
||||
device->GetGammaRamp = DX5_GetGammaRamp;
|
||||
#ifdef HAVE_OPENGL
|
||||
device->GL_LoadLibrary = WIN_GL_LoadLibrary;
|
||||
device->GL_GetProcAddress = WIN_GL_GetProcAddress;
|
||||
device->GL_GetAttribute = WIN_GL_GetAttribute;
|
||||
device->GL_MakeCurrent = WIN_GL_MakeCurrent;
|
||||
device->GL_SwapBuffers = WIN_GL_SwapBuffers;
|
||||
device->GL_LoadLibrary = WIN_GL_LoadLibrary;
|
||||
device->GL_GetProcAddress = WIN_GL_GetProcAddress;
|
||||
device->GL_GetAttribute = WIN_GL_GetAttribute;
|
||||
device->GL_MakeCurrent = WIN_GL_MakeCurrent;
|
||||
device->GL_SwapBuffers = WIN_GL_SwapBuffers;
|
||||
#endif
|
||||
device->SetCaption = WIN_SetWMCaption;
|
||||
device->SetIcon = WIN_SetWMIcon;
|
||||
@ -670,7 +683,7 @@ static HRESULT WINAPI EnumModes2(DDSURFACEDESC *desc, VOID *udata)
|
||||
void SetDDerror(const char *function, int code)
|
||||
{
|
||||
static char *error;
|
||||
static char errbuf[BUFSIZ];
|
||||
static char errbuf[1024];
|
||||
|
||||
errbuf[0] = 0;
|
||||
switch (code) {
|
||||
@ -994,11 +1007,13 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
SDL_primary = NULL;
|
||||
}
|
||||
|
||||
#ifndef NO_CHANGEDISPLAYSETTINGS
|
||||
/* Unset any previous OpenGL fullscreen mode */
|
||||
if ( (current->flags & (SDL_OPENGL|SDL_FULLSCREEN)) ==
|
||||
(SDL_OPENGL|SDL_FULLSCREEN) ) {
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Clean up any GL context that may be hanging around */
|
||||
if ( current->flags & SDL_OPENGL ) {
|
||||
@ -1057,6 +1072,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
video->h = height;
|
||||
video->pitch = SDL_CalculatePitch(video);
|
||||
|
||||
#ifndef NO_CHANGEDISPLAYSETTINGS
|
||||
/* Set fullscreen mode if appropriate.
|
||||
Ugh, since our list of valid video modes comes from
|
||||
the DirectX driver, we may not actually be able to
|
||||
@ -1077,6 +1093,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
SDL_fullscreen_mode = settings;
|
||||
}
|
||||
}
|
||||
#endif /* !NO_CHANGEDISPLAYSETTINGS */
|
||||
|
||||
style = GetWindowLong(SDL_Window, GWL_STYLE);
|
||||
style &= ~(resizestyle|WS_MAXIMIZE);
|
||||
@ -1096,7 +1113,9 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
video->flags |= SDL_RESIZABLE;
|
||||
}
|
||||
}
|
||||
#if WS_MAXIMIZE
|
||||
if (IsZoomed(SDL_Window)) style |= WS_MAXIMIZE;
|
||||
#endif
|
||||
}
|
||||
SetWindowLong(SDL_Window, GWL_STYLE, style);
|
||||
|
||||
@ -1110,7 +1129,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
bounds.top = 0;
|
||||
bounds.right = video->w;
|
||||
bounds.bottom = video->h;
|
||||
AdjustWindowRect(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE);
|
||||
AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
|
||||
width = bounds.right-bounds.left;
|
||||
height = bounds.bottom-bounds.top;
|
||||
x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
|
||||
@ -1157,7 +1176,9 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
style |= resizestyle;
|
||||
}
|
||||
}
|
||||
#if WS_MAXIMIZE
|
||||
if (IsZoomed(SDL_Window)) style |= WS_MAXIMIZE;
|
||||
#endif
|
||||
}
|
||||
SetWindowLong(SDL_Window, GWL_STYLE, style);
|
||||
|
||||
@ -1466,8 +1487,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
bounds.top = 0;
|
||||
bounds.right = video->w;
|
||||
bounds.bottom = video->h;
|
||||
AdjustWindowRect(&bounds, GetWindowLong(SDL_Window, GWL_STYLE),
|
||||
FALSE);
|
||||
AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
|
||||
width = bounds.right-bounds.left;
|
||||
height = bounds.bottom-bounds.top;
|
||||
x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
|
||||
@ -2235,11 +2255,13 @@ void DX5_VideoQuit(_THIS)
|
||||
|
||||
/* If we're fullscreen GL, we need to reset the display */
|
||||
if ( this->screen != NULL ) {
|
||||
#ifndef NO_CHANGEDISPLAYSETTINGS
|
||||
if ( (this->screen->flags & (SDL_OPENGL|SDL_FULLSCREEN)) ==
|
||||
(SDL_OPENGL|SDL_FULLSCREEN) ) {
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
ShowWindow(SDL_Window, SW_HIDE);
|
||||
}
|
||||
#endif
|
||||
if ( this->screen->flags & SDL_OPENGL ) {
|
||||
WIN_GL_ShutDown(this);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ struct SDL_PrivateVideoData {
|
||||
|
||||
/* DirectX function pointers for video and events */
|
||||
extern HRESULT (WINAPI *DDrawCreate)( GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter );
|
||||
extern HRESULT (WINAPI *DInputCreate)(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter);
|
||||
extern HRESULT (WINAPI *DInputCreate)(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUT *ppDI, LPUNKNOWN punkOuter);
|
||||
|
||||
/* DirectDraw error reporting function */
|
||||
extern void SetDDerror(const char *function, int code);
|
||||
|
Loading…
x
Reference in New Issue
Block a user