summaryrefslogtreecommitdiff
path: root/source/vid_win.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2008-11-13 18:58:41 +0000
committerAndrey Nazarov <skuller@skuller.net>2008-11-13 18:58:41 +0000
commitbbefa87db18f5b76dc67efa00b7cc798361480f3 (patch)
treeefc130fe3b4fe22f111154a8720491b756daa7bd /source/vid_win.c
parentd65e02496cd9873f5bb0297661b19762b44ddfec (diff)
Hacked the source to get it compile on Windows Mobile using CeGCC toolchain.
Fixed nasty memory corruption bug in UI scripts loading code. Fixed software refresh compilation issues on Windows. Inactive MVD channels are now completely destroyed and recreated once they are active again, and they are no longer allowed to stay in waiting state forever. Fixed delay buffer overflow resulting in fatal connection error. Preserve MVD stream flags in demos recorded on GTV server, and handle `inuse' flag correctly on players when writing gamestate. Updated documentation and Debian package descriptions.
Diffstat (limited to 'source/vid_win.c')
-rw-r--r--source/vid_win.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/source/vid_win.c b/source/vid_win.c
index 4e0cd1a..d13492e 100644
--- a/source/vid_win.c
+++ b/source/vid_win.c
@@ -198,6 +198,7 @@ void Win_SetMode( void ) {
}
void VID_UpdateGamma( const byte *table ) {
+#ifndef __COREDLL__
WORD v;
int i;
@@ -211,6 +212,7 @@ void VID_UpdateGamma( const byte *table ) {
SetDeviceGammaRamp( win.dc, win.gamma_cust );
}
+#endif
}
/*
@@ -288,6 +290,7 @@ static void Win_Activate( WPARAM wParam ) {
}
}
+#ifndef __COREDLL__
if( win.flags & QVF_GAMMARAMP ) {
if( active == ACT_ACTIVATED ) {
SetDeviceGammaRamp( win.dc, win.gamma_cust );
@@ -295,6 +298,7 @@ static void Win_Activate( WPARAM wParam ) {
SetDeviceGammaRamp( win.dc, win.gamma_orig );
}
}
+#endif
if( win.flags & QVF_FULLSCREEN ) {
if( active == ACT_ACTIVATED ) {
@@ -738,13 +742,21 @@ void VID_PumpEvents( void ) {
}
}
+#ifdef __COREDLL__
+#define _WNDCLASSEX WNDCLASS
+#define _RegisterClassEx RegisterClass
+#else
+#define _WNDCLASSEX WNDCLASSEX
+#define _RegisterClassEx RegisterClassEx
+#endif
+
/*
============
Win_Init
============
*/
void Win_Init( void ) {
- WNDCLASSEX wc;
+ _WNDCLASSEX wc;
// register variables
vid_flip_on_switch = Cvar_Get( "vid_flip_on_switch", "0", 0 );
@@ -758,25 +770,29 @@ void Win_Init( void ) {
// register the frame class
memset( &wc, 0, sizeof( wc ) );
+#ifndef __COREDLL__
wc.cbSize = sizeof( wc );
+#endif
wc.lpfnWndProc = ( WNDPROC )Win_MainWndProc;
wc.hInstance = hGlobalInstance;
wc.hIcon = LoadImage( hGlobalInstance, MAKEINTRESOURCE( IDI_APP ),
IMAGE_ICON, 32, 32, LR_CREATEDIBSECTION );
+#ifndef __COREDLL__
wc.hIconSm = LoadImage( hGlobalInstance, MAKEINTRESOURCE( IDI_APP ),
IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION );
+#endif
wc.hCursor = LoadCursor ( NULL, IDC_ARROW );
wc.hbrBackground = GetStockObject( BLACK_BRUSH );
- wc.lpszClassName = WINDOW_CLASS_NAME;
+ wc.lpszClassName = _T( WINDOW_CLASS_NAME );
- if( !RegisterClassEx( &wc ) ) {
+ if( !_RegisterClassEx( &wc ) ) {
Com_Error( ERR_FATAL, "Couldn't register main window class" );
}
// create the window
win.wnd = CreateWindow(
- WINDOW_CLASS_NAME,
- APPLICATION,
+ _T( WINDOW_CLASS_NAME ),
+ _T( APPLICATION ),
0, //style
0, 0, 0, 0,
NULL,
@@ -793,6 +809,7 @@ void Win_Init( void ) {
Com_Error( ERR_FATAL, "Couldn't get DC of the main window" );
}
+#ifndef __COREDLL__
// init gamma ramp
if( vid_hwgamma->integer ) {
if( GetDeviceGammaRamp( win.dc, win.gamma_orig ) ) {
@@ -804,6 +821,7 @@ void Win_Init( void ) {
Cvar_Set( "vid_hwgamma", "0" );
}
}
+#endif
}
/*
@@ -812,15 +830,17 @@ Win_Shutdown
============
*/
void Win_Shutdown( void ) {
+#ifndef __COREDLL__
if( win.flags & QVF_GAMMARAMP ) {
SetDeviceGammaRamp( win.dc, win.gamma_orig );
}
+#endif
// prevents leaving empty slots in the taskbar
ShowWindow( win.wnd, SW_SHOWNORMAL );
ReleaseDC( win.wnd, win.dc );
DestroyWindow( win.wnd );
- UnregisterClass( WINDOW_CLASS_NAME, hGlobalInstance );
+ UnregisterClass( _T( WINDOW_CLASS_NAME ), hGlobalInstance );
if( win.kbdHook ) {
UnhookWindowsHookEx( win.kbdHook );
@@ -886,7 +906,9 @@ static void Win_AcquireMouse( void ) {
SetCapture( win.wnd );
ClipCursor( &rc );
+#ifndef __COREDLL__
SetWindowText( win.wnd, "[" APPLICATION "]" );
+#endif
}
@@ -904,7 +926,9 @@ static void Win_DeAcquireMouse( void ) {
ClipCursor( NULL );
ReleaseCapture();
+#ifndef __COREDLL__
SetWindowText( win.wnd, APPLICATION );
+#endif
}
static void win_xpfix_changed( cvar_t *self ) {