[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer/src DirectX/DirectInput/DirectInput.c...
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer/src DirectX/DirectInput/DirectInput.c... |
Date: |
Wed, 03 Sep 2003 15:48:01 -0400 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/09/03 15:48:01
Modified files:
src/DirectX/DirectInput: DirectInput.cpp
src/NetPanzer/Core: netPanzerWinMain.cpp
src/NetPanzer/Interfaces: GameManager.cpp
Log message:
initialize DirectInput for dedicated server as well to avoid crashes
(the main loop was calling DirectInput when keys have been pressed)
Patches:
Index: netpanzer/src/DirectX/DirectInput/DirectInput.cpp
diff -u netpanzer/src/DirectX/DirectInput/DirectInput.cpp:1.2
netpanzer/src/DirectX/DirectInput/DirectInput.cpp:1.3
--- netpanzer/src/DirectX/DirectInput/DirectInput.cpp:1.2 Mon Sep 1
16:24:18 2003
+++ netpanzer/src/DirectX/DirectInput/DirectInput.cpp Wed Sep 3 15:48:01 2003
@@ -16,6 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <windows.h>
+#include <stdio.h>
#include "DirectInput.hpp"
#include "gapp.hpp"
@@ -45,12 +46,14 @@
if ( lpDIKeyDevice != 0 )
{
lpDIKeyDevice->Unacquire();
- lpDIKeyDevice->Release();
+ lpDIKeyDevice->Release();
+ lpDIKeyDevice = 0;
}
if ( lpDInput != 0 )
{
lpDInput->Release();
+ lpDInput = 0;
}
}
Index: netpanzer/src/NetPanzer/Core/netPanzerWinMain.cpp
diff -u netpanzer/src/NetPanzer/Core/netPanzerWinMain.cpp:1.3
netpanzer/src/NetPanzer/Core/netPanzerWinMain.cpp:1.4
--- netpanzer/src/NetPanzer/Core/netPanzerWinMain.cpp:1.3 Mon Sep 1
16:24:20 2003
+++ netpanzer/src/NetPanzer/Core/netPanzerWinMain.cpp Wed Sep 3 15:48:01 2003
@@ -109,12 +109,14 @@
if( !RegisterClass( &wc )) return false;
- client_win_rect.left = 0;
- client_win_rect.right = 640;
- client_win_rect.top = 0;
- client_win_rect.bottom = 480;
+ // XXX can we somehow avoid to disaply the windo already here? The
+ // dedicated server shouldn't open a window at all...
+ client_win_rect.left = 0;
+ client_win_rect.right = 640;
+ client_win_rect.top = 0;
+ client_win_rect.bottom = 480;
- AdjustWindowRect( &client_win_rect, WS_SYSMENU | WS_BORDER | WS_CAPTION |
WS_VISIBLE | WS_MINIMIZEBOX, false );
+ AdjustWindowRect( &client_win_rect, WS_SYSMENU | WS_BORDER | WS_CAPTION
| WS_VISIBLE | WS_MINIMIZEBOX, false );
gapp.hwndApp = CreateWindowEx(
WS_EX_APPWINDOW,
@@ -130,8 +132,9 @@
(HINSTANCE) hInstance,
0 );
- if( gapp.hwndApp == 0) return false;
- else
+ if( gapp.hwndApp == 0)
+ return false;
+ else
return true;
}
#endif
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.4
netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.5
--- netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.4 Wed Sep 3
15:22:12 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.cpp Wed Sep 3 15:48:01 2003
@@ -188,12 +188,12 @@
MessageBox(gapp.hwndApp, "DDraw.Initialize Failed", "Fatal Error",
MB_OK);
return ( false );
}
-
- LOG( ( "Initializing Direct Input\n" ) );
- if ( DirectInput::initialize() == false )
- return ( false );
}
- printf ("DXInit\n");
+
+ LOG( ( "Initializing Direct Input\n" ) );
+ if ( DirectInput::initialize() == false )
+ return ( false );
+ printf ("DXInit\n");
return( true );
}
@@ -500,10 +500,13 @@
{
LOG( ("Initializing Direct Keyboard Input") );
- if( execution_mode == _execution_mode_loop_back_server)
+ // XXX commented out, since the main window isn't hidden as intended... I
+ // dunno why. If a key is pressed in the main window, then we need a defined
+ // DirectInput Handler.
+ //if( execution_mode == _execution_mode_loop_back_server)
{
- if ( DirectInput::initializeDirectKeyboard() == false )
- return ( false );
+ if (!DirectInput::initializeDirectKeyboard())
+ return false;
}
//JoystickInterface::init();
@@ -1101,6 +1104,8 @@
if ( success == false )
{
+ printf("Initialisation failed at stage %d.\n", i);
+ fflush(stdout);
shutdown( i );
return ( false );
}
@@ -1157,6 +1162,8 @@
if ( success == false )
{
+ printf("Server Initialization failed at stage %d.\n", i);
+ fflush(stdout);
dedicatedShutdown( i );
return ( false );
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer/src DirectX/DirectInput/DirectInput.c...,
Matthias Braun <=