aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2005-04-23 13:52:27 +0000
committerMax Horn2005-04-23 13:52:27 +0000
commit8fddaada1dd6dad2302eb153892257d2020883fc (patch)
tree48f22984e2df39ad352d3306a591bff053e4df3e
parente70c98fa22c193dd5077a21729771aa440edd106 (diff)
downloadscummvm-rg350-8fddaada1dd6dad2302eb153892257d2020883fc.tar.gz
scummvm-rg350-8fddaada1dd6dad2302eb153892257d2020883fc.tar.bz2
scummvm-rg350-8fddaada1dd6dad2302eb153892257d2020883fc.zip
Simplified debuglevel handling:
- it's only honored in the global level of the config file - all checks for it go through gDebugLevel now, which is made global - the '-d' switch is handled in a slightly saner and consistent way - removed 'debuglevel' from the config format documentation; we do not want to encourage the avarage user to use it svn-id: r17769
-rw-r--r--README2
-rw-r--r--backends/wince/wince-sdl.cpp2
-rw-r--r--base/gameDetector.cpp11
-rw-r--r--base/main.cpp3
-rw-r--r--common/util.h2
-rw-r--r--doc/08.tex2
-rw-r--r--scumm/debugger.cpp4
-rw-r--r--scumm/scumm.cpp2
-rw-r--r--simon/debugger.cpp4
-rw-r--r--simon/simon.cpp10
10 files changed, 15 insertions, 27 deletions
diff --git a/README b/README
index 48dcb80bcb..d13ba99db6 100644
--- a/README
+++ b/README
@@ -1157,8 +1157,6 @@ The following keywords are recognized:
Queen
boot_param number Pass this number to the boot script
- debuglevel number Enable debug output. The higher number, the
- more verbose output.
Broken Sword II adds the following non-standard keywords:
diff --git a/backends/wince/wince-sdl.cpp b/backends/wince/wince-sdl.cpp
index 5ed7362206..1562832847 100644
--- a/backends/wince/wince-sdl.cpp
+++ b/backends/wince/wince-sdl.cpp
@@ -1660,7 +1660,7 @@ bool OSystem_WINCE3::pollEvent(Event &event) {
void OSystem_WINCE3::quit() {
fclose(stdout_file);
fclose(stderr_file);
- if (!ConfMan.hasKey("debuglevel")) {
+ if (gDebugLevel <= 0) {
DeleteFile(TEXT("\\scummvm_stdout.txt"));
DeleteFile(TEXT("\\scummvm_stderr.txt"));
}
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp
index 3d292ff46d..c430f4a4ac 100644
--- a/base/gameDetector.cpp
+++ b/base/gameDetector.cpp
@@ -170,7 +170,6 @@ GameDetector::GameDetector() {
#endif
// Miscellaneous
- ConfMan.registerDefault("debuglevel", 0);
ConfMan.registerDefault("joystick_num", -1);
ConfMan.registerDefault("confirm_exit", false);
#ifdef USE_ALSA
@@ -369,13 +368,8 @@ void GameDetector::parseCommandLine(int argc, char **argv) {
END_OPTION
DO_OPTION_OPT('d', "debuglevel")
- if (option != NULL)
- ConfMan.set("debuglevel", (int)strtol(option, 0, 10), kTransientDomain);
- gDebugLevel = ConfMan.getInt("debuglevel");
- if (gDebugLevel)
- printf("Debuglevel (from command line): %d\n", gDebugLevel);
- else
- printf("Debuglevel (from command line): 0 - Game only\n");
+ gDebugLevel = option ? (int)strtol(option, 0, 10) : 1;
+ printf("Debuglevel (from command line): %d\n", gDebugLevel);
END_OPTION
DO_OPTION('e', "music-driver")
@@ -568,7 +562,6 @@ ShowHelpAndExit:
void GameDetector::setTarget(const String &name) {
_targetName = name;
ConfMan.setActiveDomain(name);
- gDebugLevel = ConfMan.getInt("debuglevel");
}
bool GameDetector::detectGame() {
diff --git a/base/main.cpp b/base/main.cpp
index 1b9e9495ee..d8afe0ddf7 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -360,7 +360,8 @@ extern "C" int main(int argc, char *argv[]) {
else
ConfMan.loadDefaultConfigFile();
- gDebugLevel = ConfMan.getInt("debuglevel");
+ if (ConfMan.hasKey("debuglevel"))
+ gDebugLevel = ConfMan.getInt("debuglevel");
// Update the config file
ConfMan.set("versioninfo", gScummVMVersion, Common::ConfigManager::kApplicationDomain);
diff --git a/common/util.h b/common/util.h
index 5800023dfb..3f10d5434c 100644
--- a/common/util.h
+++ b/common/util.h
@@ -201,5 +201,7 @@ void CDECL debug(int level, const char *s, ...);
void CDECL debug(const char *s, ...);
void checkHeap();
+extern int gDebugLevel;
+
#endif
diff --git a/doc/08.tex b/doc/08.tex
index 84cdf3285f..09f2d27889 100644
--- a/doc/08.tex
+++ b/doc/08.tex
@@ -118,8 +118,6 @@ The following keywords are recognized:
& Queen
\\
boot\_param &number Pass this number to the boot script\\
- debuglevel &number Enable debug output. The higher number, the\\
- & more verbose output.\\
\end{tabular}
Broken Sword II adds the following non-standard keywords:\\
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp
index a26d78e7da..11d85d5e3f 100644
--- a/scumm/debugger.cpp
+++ b/scumm/debugger.cpp
@@ -37,8 +37,6 @@
#include "common/debugger.cpp"
-extern int gDebugLevel;
-
namespace Scumm {
void CDECL debugC(int channel, const char *s, ...) {
@@ -595,7 +593,7 @@ bool ScummDebugger::Cmd_DebugLevel(int argc, const char **argv) {
if (_vm->_debugMode == false)
DebugPrintf("Debugging is not enabled at this time\n");
else
- DebugPrintf("Debugging is currently set at level %d\n", ConfMan.getInt("debuglevel"));
+ DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel);
} else { // set level
gDebugLevel = atoi(argv[1]);
if (gDebugLevel > 0) {
diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp
index 93ff181070..ec1d47e0db 100644
--- a/scumm/scumm.cpp
+++ b/scumm/scumm.cpp
@@ -1058,7 +1058,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
g_scumm = this;
// Read settings from the detector & config manager
- _debugMode = ConfMan.hasKey("debuglevel");
+ _debugMode = (gDebugLevel > 0);
_dumpScripts = detector->_dumpScripts;
_bootParam = ConfMan.getInt("boot_param");
diff --git a/simon/debugger.cpp b/simon/debugger.cpp
index 4d1a1b6d64..8e59970a71 100644
--- a/simon/debugger.cpp
+++ b/simon/debugger.cpp
@@ -25,8 +25,6 @@
#include "simon/debugger.h"
#include "simon/simon.h"
-extern int gDebugLevel;
-
namespace Simon {
Debugger::Debugger(SimonEngine *vm)
@@ -89,7 +87,7 @@ bool Debugger::Cmd_DebugLevel(int argc, const char **argv) {
if (_vm->_debugMode == false)
DebugPrintf("Debugging is not enabled at this time\n");
else
- DebugPrintf("Debugging is currently set at level %d\n", ConfMan.getInt("debuglevel"));
+ DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel);
} else { // set level
gDebugLevel = atoi(argv[1]);
if (gDebugLevel > 0 && gDebugLevel < 10) {
diff --git a/simon/simon.cpp b/simon/simon.cpp
index 51e89adea4..7455d39b5c 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -695,7 +695,7 @@ int SimonEngine::init(GameDetector &detector) {
warning ("MIDI Player init failed: \"%s\"", midi.getErrorName (ret));
midi.set_volume(ConfMan.getInt("music_volume"));
- _debugMode = ConfMan.hasKey("debuglevel");
+ _debugMode = (gDebugLevel > 0);
if (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute") == 1)
midi.pause(_music_paused ^= 1);
@@ -4003,13 +4003,13 @@ int SimonEngine::go() {
_continous_vgascript = false;
_draw_images_debug=false;
- if (ConfMan.getInt("debuglevel") == 2)
+ if (gDebugLevel == 2)
_continous_mainscript = true;
- if (ConfMan.getInt("debuglevel") == 3)
+ if (gDebugLevel == 3)
_continous_vgascript = true;
- if (ConfMan.getInt("debuglevel") == 4)
+ if (gDebugLevel == 4)
_start_mainscript = true;
- if (ConfMan.getInt("debuglevel") == 5)
+ if (gDebugLevel == 5)
_start_vgascript = true;
if (_game & GF_TALKIE) {