mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-27 06:32:27 +00:00
Fix freezing of dedicated server window on Windows
The code was donated by motorsep, thanks!
This commit is contained in:
parent
105fdb0624
commit
5936422d9d
2 changed files with 23 additions and 0 deletions
|
@ -636,6 +636,10 @@ WinMain
|
|||
int main(int argc, char *argv[]) {
|
||||
const HCURSOR hcurSave = ::SetCursor( LoadCursor( 0, IDC_WAIT ) );
|
||||
|
||||
#ifdef ID_DEDICATED
|
||||
MSG msg;
|
||||
#endif
|
||||
|
||||
Sys_SetPhysicalWorkMemory( 192 << 20, 1024 << 20 );
|
||||
|
||||
win32.hInstance = GetModuleHandle(NULL);
|
||||
|
@ -681,6 +685,17 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
// main game loop
|
||||
while( 1 ) {
|
||||
#if ID_DEDICATED
|
||||
// Since this is a Dedicated Server, process all Windowing Messages
|
||||
// Now.
|
||||
while(PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)){
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
// Give the OS a little time to recuperate.
|
||||
Sleep(10);
|
||||
#endif
|
||||
|
||||
Win_Frame();
|
||||
|
||||
|
|
|
@ -108,7 +108,11 @@ static LRESULT CALLBACK ConWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
|
|||
}
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
#ifdef ID_DEDICATED
|
||||
if ( cvarSystem->IsInitialized() ) {
|
||||
#else
|
||||
if ( cvarSystem->IsInitialized() && com_skipRenderer.GetBool() ) {
|
||||
#endif
|
||||
cmdSystem->BufferCommandText(CMD_EXEC_APPEND, "quit\n");
|
||||
} else if ( s_wcd.quitOnClose ) {
|
||||
PostQuitMessage( 0 );
|
||||
|
@ -143,11 +147,15 @@ static LRESULT CALLBACK ConWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
|
|||
SendMessage( s_wcd.hwndBuffer, EM_SETSEL, 0, -1 );
|
||||
SendMessage( s_wcd.hwndBuffer, WM_COPY, 0, 0 );
|
||||
} else if ( wParam == QUIT_ID ) {
|
||||
#ifdef ID_DEDICATED
|
||||
cmdSystem->BufferCommandText(CMD_EXEC_APPEND, "quit\n");
|
||||
#else
|
||||
if ( s_wcd.quitOnClose ) {
|
||||
PostQuitMessage( 0 );
|
||||
} else {
|
||||
cmdSystem->BufferCommandText(CMD_EXEC_APPEND, "quit\n");
|
||||
}
|
||||
#endif
|
||||
} else if ( wParam == CLEAR_ID ) {
|
||||
SendMessage( s_wcd.hwndBuffer, EM_SETSEL, 0, -1 );
|
||||
SendMessage( s_wcd.hwndBuffer, EM_REPLACESEL, FALSE, ( LPARAM ) "" );
|
||||
|
|
Loading…
Reference in a new issue