aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README2
-rw-r--r--backends/platform/sdl/win32/win32.cpp60
-rw-r--r--backends/platform/sdl/win32/win32.h1
-rw-r--r--base/commandLine.cpp19
-rw-r--r--dists/win32/ScummVM.iss1
5 files changed, 31 insertions, 52 deletions
diff --git a/README b/README
index 25cf9294e0..48929816fd 100644
--- a/README
+++ b/README
@@ -943,6 +943,7 @@ arguments -- see the next section.
-z, --list-games Display list of supported games and exit
-t, --list-targets Display list of configured targets and exit
--list-saves=TARGET Display a list of savegames for the game (TARGET) specified
+ --console Enable the console window (default: enabled) (Windows only)
-c, --config=CONFIG Use alternate configuration file
-p, --path=PATH Path to where the game is installed
@@ -1975,6 +1976,7 @@ The following keywords are recognized:
confirm_exit bool Ask for confirmation by the user before quitting
(SDL backend only).
+ console bool Enable the console window (default: enabled) (Windows only).
cdrom number Number of CD-ROM unit to use for audio. If
negative, don't even try to access the CD-ROM.
joystick_num number Number of joystick device to use for input
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);
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 1cd3643f5a..a4fefc413a 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -65,6 +65,9 @@ static const char HELP_STRING[] =
" -z, --list-games Display list of supported games and exit\n"
" -t, --list-targets Display list of configured targets and exit\n"
" --list-saves=TARGET Display a list of savegames for the game (TARGET) specified\n"
+#if defined (WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
+ " --console Enable the console window (default:enabled)\n"
+#endif
"\n"
" -c, --config=CONFIG Use alternate configuration file\n"
" -p, --path=PATH Path to where the game is installed\n"
@@ -231,13 +234,6 @@ void registerDefaults() {
ConfMan.registerDefault("record_temp_file_name", "record.tmp");
ConfMan.registerDefault("record_time_file_name", "record.time");
-#if 0
- // NEW CODE TO HIDE CONSOLE FOR WIN32
-#ifdef WIN32
- // console hiding for win32
- ConfMan.registerDefault("show_console", false);
-#endif
-#endif
}
//
@@ -554,14 +550,11 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
END_OPTION
#endif
-#if 0
- // NEW CODE TO HIDE CONSOLE FOR WIN32
-#ifdef WIN32
- // console hiding for win32
- DO_LONG_OPTION_BOOL("show-console")
+#if defined (WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
+ // Optional console window on Windows (default: enabled)
+ DO_LONG_OPTION_BOOL("console")
END_OPTION
#endif
-#endif
unknownOption:
// If we get till here, the option is unhandled and hence unknown.
diff --git a/dists/win32/ScummVM.iss b/dists/win32/ScummVM.iss
index 00f4868e60..68a20d0b14 100644
--- a/dists/win32/ScummVM.iss
+++ b/dists/win32/ScummVM.iss
@@ -44,6 +44,7 @@ Name: es; MessagesFile: compiler:Languages\Spanish.isl
[Icons]
Name: {group}\{cm:UninstallProgram, ScummVM}; Filename: {uninstallexe}
Name: {group}\ScummVM; Filename: {app}\scummvm.exe; WorkingDir: {app}; Comment: scummvm; Flags: createonlyiffileexists; IconIndex: 0
+Name: {group}\ScummVM (noconsole); Filename: {app}\scummvm.exe; Parameters: "--no-console"; WorkingDir: {app}; Comment: scummvm; Flags: createonlyiffileexists; IconIndex: 0
Name: {group}\Authors; Filename: {app}\AUTHORS.txt; WorkingDir: {app}; Comment: AUTHORS; Flags: createonlyiffileexists
Name: {group}\Copying; Filename: {app}\COPYING.txt; WorkingDir: {app}; Comment: COPYING; Flags: createonlyiffileexists
Name: {group}\Copying.LGPL; Filename: {app}\COPYING.LGPL.txt; WorkingDir: {app}; Comment: COPYING.LGPL; Flags: createonlyiffileexists