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
This commit is contained in:
Max Horn 2005-04-23 13:52:27 +00:00
parent e70c98fa22
commit 8fddaada1d
10 changed files with 15 additions and 27 deletions

2
README
View File

@ -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:

View File

@ -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"));
}

View File

@ -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() {

View File

@ -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);

View File

@ -201,5 +201,7 @@ void CDECL debug(int level, const char *s, ...);
void CDECL debug(const char *s, ...);
void checkHeap();
extern int gDebugLevel;
#endif

View File

@ -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:\\

View File

@ -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) {

View File

@ -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");

View File

@ -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) {

View File

@ -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) {