From e7a22b59f86f40241a29ec24019ea27811deb1ab Mon Sep 17 00:00:00 2001 From: yinsimei Date: Wed, 28 Jun 2017 16:30:05 +0200 Subject: SLUDGE: add several debug infos and exit when error --- engines/sludge/fileset.cpp | 6 +++--- engines/sludge/newfatal.cpp | 5 +++-- engines/sludge/sludger.cpp | 8 ++------ 3 files changed, 8 insertions(+), 11 deletions(-) (limited to 'engines/sludge') diff --git a/engines/sludge/fileset.cpp b/engines/sludge/fileset.cpp index 0a68f7a5b2..deb4a22147 100644 --- a/engines/sludge/fileset.cpp +++ b/engines/sludge/fileset.cpp @@ -226,15 +226,15 @@ void setFileIndices(Common::File *fp, int numLanguages, unsigned int skipBefore) startOfSubIndex = fp->pos() + 4; fp->seek(fp->readUint32LE(), SEEK_CUR); - debug(kSludgeDebugDataLoad, "startOfSubIndex: %i", startOfTextIndex); + debug(kSludgeDebugDataLoad, "startOfSubIndex: %i", startOfSubIndex); startOfObjectIndex = fp->pos() + 4; fp->seek(fp->readUint32LE(), SEEK_CUR); - debug(kSludgeDebugDataLoad, "startOfObjectIndex: %i", startOfTextIndex); + debug(kSludgeDebugDataLoad, "startOfObjectIndex: %i", startOfObjectIndex); // Remember that the data section starts here startOfDataIndex = fp->pos(); - debug(kSludgeDebugDataLoad, "startOfDataIndex: %i", startOfTextIndex); + debug(kSludgeDebugDataLoad, "startOfDataIndex: %i", startOfDataIndex); } } // End of namespace Sludge diff --git a/engines/sludge/newfatal.cpp b/engines/sludge/newfatal.cpp index a44290ab36..8bafd1fcf2 100644 --- a/engines/sludge/newfatal.cpp +++ b/engines/sludge/newfatal.cpp @@ -91,13 +91,15 @@ extern SDL_Event quit_event; #endif int inFatal(const char *str) { + error(str); + delete []str; #if 0 FILE *fatFile = fopen("fatal.txt", "wt"); if (fatFile) { fprintf(fatFile, "FATAL:\n%s\n", str); fclose(fatFile); } -#endif + fatalMessage = copyString(str); if (fatalMessage == NULL) fatalMessage = copyString("Out of memory"); @@ -108,7 +110,6 @@ int inFatal(const char *str) { EGL_Close(); #endif -#if 0 SDL_Quit(); atexit(displayFatal); diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp index cf2a0539a1..cc30de2031 100644 --- a/engines/sludge/sludger.cpp +++ b/engines/sludge/sludger.cpp @@ -850,18 +850,14 @@ bool continueFunction(loadedFunction *fun) { while (keepLooping) { advanceNow = true; + debug(kSludgeDebugStackMachine, "Executing command line %i : ", fun->runThisLine); param = fun->compiledLines[fun->runThisLine].param; com = fun->compiledLines[fun->runThisLine].theCommand; // fprintf (stderr, "com: %d param: %d (%s)\n", com, param, // (com < numSludgeCommands) ? sludgeText[com] : ERROR_UNKNOWN_MCODE); fflush(stderr); if (numBIFNames) { - setFatalInfo( - (fun->originalNumber < numUserFunc) ? - allUserFunc[fun->originalNumber] : - "Unknown user function", - (com < numSludgeCommands) ? - sludgeText[com] : ERROR_UNKNOWN_MCODE); + setFatalInfo((fun->originalNumber < numUserFunc) ? allUserFunc[fun->originalNumber] : "Unknown user function", (com < numSludgeCommands) ? sludgeText[com] : ERROR_UNKNOWN_MCODE); // newDebug ( // (com < numSludgeCommands) ? sludgeText[com] : "Unknown SLUDGE machine code", // param); -- cgit v1.2.3