diff options
| author | Travis Howell | 2011-06-30 11:17:58 +1000 | 
|---|---|---|
| committer | Travis Howell | 2011-06-30 11:17:58 +1000 | 
| commit | eae06884b6c6da23b7932ceba65e435d9be6ef82 (patch) | |
| tree | c7b3738340f144bf23ae0bac21bbdc5de743c762 /backends/platform/sdl | |
| parent | eec84253f0e5d24bd37f5a8fa88b29df6da45f83 (diff) | |
| download | scummvm-rg350-eae06884b6c6da23b7932ceba65e435d9be6ef82.tar.gz scummvm-rg350-eae06884b6c6da23b7932ceba65e435d9be6ef82.tar.bz2 scummvm-rg350-eae06884b6c6da23b7932ceba65e435d9be6ef82.zip  | |
WIN32: Add option to disable the console window, keeping the current default of enabling the console window.
Diffstat (limited to 'backends/platform/sdl')
| -rw-r--r-- | backends/platform/sdl/win32/win32.cpp | 60 | ||||
| -rw-r--r-- | backends/platform/sdl/win32/win32.h | 1 | 
2 files changed, 22 insertions, 39 deletions
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp index 420ed2465b..c1b6c853e4 100644 --- a/backends/platform/sdl/win32/win32.cpp +++ b/backends/platform/sdl/win32/win32.cpp @@ -24,6 +24,7 @@  #define FORBIDDEN_SYMBOL_ALLOW_ALL  #include "common/scummsys.h" +#include "common/config-manager.h"  #include "common/error.h"  #include "common/textconsole.h" @@ -44,46 +45,7 @@  #define DEFAULT_CONFIG_FILE "scummvm.ini" -//#define	HIDE_CONSOLE - -#ifdef HIDE_CONSOLE -struct SdlConsoleHidingWin32 { -	DWORD myPid; -	DWORD myTid; -	HWND consoleHandle; -}; - -// console hiding for win32 -static BOOL CALLBACK initBackendFindConsoleWin32Proc(HWND hWnd, LPARAM lParam) { -	DWORD pid, tid; -	SdlConsoleHidingWin32 *variables = (SdlConsoleHidingWin32 *)lParam; -	tid = GetWindowThreadProcessId(hWnd, &pid); -	if ((tid == variables->myTid) && (pid == variables->myPid)) { -		variables->consoleHandle = hWnd; -		return FALSE; -	} -	return TRUE; -} - -#endif -  void OSystem_Win32::init() { -#ifdef HIDE_CONSOLE -	// console hiding for win32 -	SdlConsoleHidingWin32 consoleHidingWin32; -	consoleHidingWin32.consoleHandle = 0; -	consoleHidingWin32.myPid = GetCurrentProcessId(); -	consoleHidingWin32.myTid = GetCurrentThreadId(); -	EnumWindows (initBackendFindConsoleWin32Proc, (LPARAM)&consoleHidingWin32); - -	if (!ConfMan.getBool("show_console")) { -		if (consoleHidingWin32.consoleHandle) { -			// We won't find a window with our TID/PID in case we were started from command-line -			ShowWindow(consoleHidingWin32.consoleHandle, SW_HIDE); -		} -	} -#endif -  	// Initialize File System Factory  	_fsFactory = new WindowsFilesystemFactory(); @@ -96,6 +58,26 @@ void OSystem_Win32::init() {  	OSystem_SDL::init();  } +void OSystem_Win32::initBackend() { +	// Console window is enabled by default on Windows +	ConfMan.registerDefault("console", true); + +	// Enable or disable the window console window +	if (ConfMan.getBool("console")) { +		if (AllocConsole()) { +			freopen("CONIN$","r",stdin); +			freopen("CONOUT$","w",stdout); +			freopen("CONOUT$","w",stderr); +		} +		SetConsoleTitle("ScummVM Status Window"); +	} else { +		FreeConsole(); +	} + +	// Invoke parent implementation of this method +	OSystem_SDL::initBackend(); +} +  bool OSystem_Win32::hasFeature(Feature f) {  	if (f == kFeatureDisplayLogFile) diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h index cc2fc51d36..b56997a63b 100644 --- a/backends/platform/sdl/win32/win32.h +++ b/backends/platform/sdl/win32/win32.h @@ -28,6 +28,7 @@  class OSystem_Win32 : public OSystem_SDL {  public:  	virtual void init(); +	virtual void initBackend();  	virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);  | 
