[Scummvm-cvs-logs] CVS: scummvm/base engine.cpp,1.30,1.31 gameDetector.cpp,1.94,1.95 gameDetector.h,1.29,1.30 main.cpp,1.64,1.65
Max Horn
fingolfin at users.sourceforge.net
Mon Dec 27 13:55:02 CET 2004
Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8383/base
Modified Files:
engine.cpp gameDetector.cpp gameDetector.h main.cpp
Log Message:
Fix for bug #1091748 (DIG: Starting new games takes a long time); turns out querying the debuglevel from the config-manager very often is too slow
Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/engine.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- engine.cpp 25 Dec 2004 19:58:00 -0000 1.30
+++ engine.cpp 27 Dec 2004 21:54:19 -0000 1.31
@@ -158,50 +158,6 @@
#endif
}
-static void debugHelper(char *buf) {
-#ifndef _WIN32_WCE
- printf("%s\n", buf);
-#endif
-
-#if defined( USE_WINDBG )
- strcat(buf, "\n");
-#if defined( _WIN32_WCE )
- TCHAR buf_unicode[1024];
- MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf) + 1, buf_unicode, sizeof(buf_unicode));
- OutputDebugString(buf_unicode);
-#else
- OutputDebugString(buf);
-#endif
-#endif
-
- fflush(stdout);
-}
-
-void CDECL debug(int level, const char *s, ...) {
- char buf[STRINGBUFLEN];
- va_list va;
-
- if (level > ConfMan.getInt("debuglevel"))
- return;
-
- va_start(va, s);
- vsprintf(buf, s, va);
- va_end(va);
-
- debugHelper(buf);
-}
-
-void CDECL debug(const char *s, ...) {
- char buf[STRINGBUFLEN];
- va_list va;
-
- va_start(va, s);
- vsprintf(buf, s, va);
- va_end(va);
-
- debugHelper(buf);
-}
-
void checkHeap() {
#if defined(_MSC_VER)
if (_heapchk() != _HEAPOK) {
Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- gameDetector.cpp 25 Dec 2004 23:43:04 -0000 1.94
+++ gameDetector.cpp 27 Dec 2004 21:54:19 -0000 1.95
@@ -333,9 +333,9 @@
DO_OPTION_OPT('d', "debuglevel")
if (option != NULL)
ConfMan.set("debuglevel", (int)strtol(option, 0, 10), kTransientDomain);
- int debuglevel = ConfMan.getInt("debuglevel");
- if (debuglevel)
- printf("Debuglevel (from command line): %d\n", debuglevel);
+ gDebugLevel = ConfMan.getInt("debuglevel");
+ if (gDebugLevel)
+ printf("Debuglevel (from command line): %d\n", gDebugLevel);
else
printf("Debuglevel (from command line): 0 - Game only\n");
END_OPTION
@@ -510,6 +510,7 @@
void GameDetector::setTarget(const String &name) {
_targetName = name;
ConfMan.setActiveDomain(name);
+ gDebugLevel = ConfMan.getInt("debuglevel");
}
bool GameDetector::detectGame() {
Index: gameDetector.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- gameDetector.h 2 Dec 2004 00:33:39 -0000 1.29
+++ gameDetector.h 27 Dec 2004 21:54:19 -0000 1.30
@@ -38,6 +38,8 @@
GF_DEFAULT_TO_1X_SCALER = 1 << 30
};
+extern int gDebugLevel;
+
struct GameSettings {
const char *name;
const char *description;
Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/main.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- main.cpp 25 Dec 2004 22:13:44 -0000 1.64
+++ main.cpp 27 Dec 2004 21:54:19 -0000 1.65
@@ -119,7 +119,7 @@
#ifdef USE_MPEG2
"MPEG2 "
#endif
- ;
+ ;
#if defined(WIN32) && defined(NO_CONSOLE)
#include <cstdio>
@@ -184,6 +184,9 @@
#endif
+
+int gDebugLevel = 0;
+
static bool launcherDialog(GameDetector &detector, OSystem *system) {
system->beginGFXTransaction();
@@ -349,6 +352,8 @@
else
ConfMan.loadDefaultConfigFile();
+ gDebugLevel = ConfMan.getInt("debuglevel");
+
// Update the config file
ConfMan.set("versioninfo", gScummVMVersion, Common::ConfigManager::kApplicationDomain);
@@ -417,6 +422,50 @@
END_OF_MAIN();
#endif
+static void debugHelper(char *buf) {
+#ifndef _WIN32_WCE
+ printf("%s\n", buf);
+#endif
+
+#if defined( USE_WINDBG )
+ strcat(buf, "\n");
+#if defined( _WIN32_WCE )
+ TCHAR buf_unicode[1024];
+ MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf) + 1, buf_unicode, sizeof(buf_unicode));
+ OutputDebugString(buf_unicode);
+#else
+ OutputDebugString(buf);
+#endif
+#endif
+
+ fflush(stdout);
+}
+
+void CDECL debug(int level, const char *s, ...) {
+ char buf[STRINGBUFLEN];
+ va_list va;
+
+ if (level > gDebugLevel)
+ return;
+
+ va_start(va, s);
+ vsprintf(buf, s, va);
+ va_end(va);
+
+ debugHelper(buf);
+}
+
+void CDECL debug(const char *s, ...) {
+ char buf[STRINGBUFLEN];
+ va_list va;
+
+ va_start(va, s);
+ vsprintf(buf, s, va);
+ va_end(va);
+
+ debugHelper(buf);
+}
+
/*
#if !defined(__PALM_OS__) && !defined(_WIN32_WCE)
void *operator new(size_t size) {
More information about the Scummvm-git-logs
mailing list