[Scummvm-cvs-logs] CVS: scummvm gameDetector.cpp,1.37,1.38 readme.txt,1.34,1.35 resource.cpp,1.71,1.72 script.cpp,1.52,1.53 scumm.h,1.142,1.143 scummvm.cpp,1.126,1.127
James Brown
ender at users.sourceforge.net
Fri Apr 26 07:14:28 CEST 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv390
Modified Files:
gameDetector.cpp readme.txt resource.cpp script.cpp scumm.h
scummvm.cpp
Log Message:
Add enhanced debugging patch.
Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gameDetector.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** gameDetector.cpp 26 Apr 2002 13:41:39 -0000 1.37
--- gameDetector.cpp 26 Apr 2002 14:13:39 -0000 1.38
***************
*** 33,41 ****
"ScummVM - Scumm Interpreter\n"
"Syntax:\n"
! "\tscummvm [-v] [-d] [-n] [-b<num>] [-t<num>] [-s<num>] [-p<path>] [-m<num>] [-f] game\n"
"Flags:\n"
"\tv - show version info and exit\n"
"\tc<num> - use cdrom <num> for cd audio\n"
! "\td - enable debug output\n"
"\tn - no subtitles for speech\n"
"\tb<num> - start in room <num>\n"
--- 33,41 ----
"ScummVM - Scumm Interpreter\n"
"Syntax:\n"
! "\tscummvm [-v] [-d[<num>]] [-n] [-b<num>] [-t<num>] [-s<num>] [-p<path>] [-m<num>] [-f] game\n"
"Flags:\n"
"\tv - show version info and exit\n"
"\tc<num> - use cdrom <num> for cd audio\n"
! "\td[<num>]- enable debug output (level <num>)\n"
"\tn - no subtitles for speech\n"
"\tb<num> - start in room <num>\n"
***************
*** 84,88 ****
case 'd':
_debugMode = true;
! break;
case 'n':
_noSubtitles = true;
--- 84,91 ----
case 'd':
_debugMode = true;
! if (*(s+1) != '\0')
! _debugLevel = atoi(s+1);
! debug(1,"Debugmode (level %d) on", _debugLevel);
! goto NextArg;
case 'n':
_noSubtitles = true;
Index: readme.txt
===================================================================
RCS file: /cvsroot/scummvm/scummvm/readme.txt,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** readme.txt 26 Apr 2002 06:08:32 -0000 1.34
--- readme.txt 26 Apr 2002 14:13:39 -0000 1.35
***************
*** 131,134 ****
--- 131,137 ----
found in the 'tools' CVS module, or in the 'scummvm-tools' package.
+ On Win9x/NT/XP you can define WIN_DBG and attach WinDbg to browse the debug
+ messages (see www.sysinternals.com/ntw2k/freeware/debugview.shtml).
+
GCC:
* Type make (or gmake if that's what GNU make is called on your
***************
*** 200,203 ****
--- 203,207 ----
-r - Enable Roland conversion. Try if music sounds incorrect.
-a - Enable amiga pal conversion, for playing Amiga versions
+ -d[<num>] - Set debug verbosity to <num>
In game Hot Keys:
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.71
retrieving revision 1.72
diff -C2 -d -r1.71 -r1.72
*** resource.cpp 24 Apr 2002 04:26:09 -0000 1.71
--- resource.cpp 26 Apr 2002 14:13:39 -0000 1.72
***************
*** 358,362 ****
int i;
! debug(9, "readResTypeList(%d,%x,%s)", id, FROM_LE_32(tag), name);
num = fileReadWordLE();
--- 358,362 ----
int i;
! debug(9, "readResTypeList(%s,%x,%s)", resTypeFromId(id), FROM_LE_32(tag), name);
num = fileReadWordLE();
***************
*** 393,398 ****
int mode)
{
! debug(9, "allocResTypeData(%d,%x,%d,%s,%d)", id, FROM_LE_32(tag), num, name,
! mode);
assert(id >= 0 && id < (int)(sizeof(res.mode) / sizeof(res.mode[0])));
--- 393,397 ----
int mode)
{
! debug(9, "allocResTypeData(%s/%s,%x,%d,%d)", resTypeFromId(id), name, FROM_LE_32(tag), num, mode);
assert(id >= 0 && id < (int)(sizeof(res.mode) / sizeof(res.mode[0])));
***************
*** 445,449 ****
void *addr;
! debug(9, "ensureResourceLoaded(%d,%d)", type, i);
if (type == rtRoom && i > 127) {
--- 444,448 ----
void *addr;
! debug(9, "ensureResourceLoaded(%s,%d)", resTypeFromId(type), i);
if (type == rtRoom && i > 127) {
***************
*** 471,475 ****
uint32 size, tag;
! // debug(1, "loadResource(%d,%d)", type,idx);
if (type == rtCharset && (_features & GF_SMALL_HEADER)) {
--- 470,474 ----
uint32 size, tag;
! // debug(1, "loadResource(%s,%d)", resTypeFromId(type),idx);
if (type == rtCharset && (_features & GF_SMALL_HEADER)) {
***************
*** 546,550 ****
uint32 best_size = 0, best_offs = 0;
! debug(9, "readSoundResource(%d,%d)", type, idx);
pos = 0;
--- 545,549 ----
uint32 best_size = 0, best_offs = 0;
! debug(9, "readSoundResource(%s,%d)", resTypeFromId(type), idx);
pos = 0;
***************
*** 622,631 ****
{
byte *ptr;
!
! debug(9, "getResourceAddress(%d,%d)", type, idx);
CHECK_HEAP validateResource("getResourceAddress", type, idx);
! if (!res.address[type])
return NULL;
if (res.mode[type] && !res.address[type][idx]) {
--- 621,631 ----
{
byte *ptr;
!
CHECK_HEAP validateResource("getResourceAddress", type, idx);
! if (!res.address[type]) {
! debug(9, "getResourceAddress(%s,%d) == NULL", resTypeFromId(type), idx);
return NULL;
+ }
if (res.mode[type] && !res.address[type][idx]) {
***************
*** 634,642 ****
! if (!(ptr = (byte *)res.address[type][idx]))
return NULL;
setResourceCounter(type, idx, 1);
return ptr + sizeof(MemBlkHeader);
}
--- 634,645 ----
! if (!(ptr = (byte *)res.address[type][idx])) {
! debug(9, "getResourceAddress(%s,%d) == NULL", resTypeFromId(type), idx);
return NULL;
+ }
setResourceCounter(type, idx, 1);
+ debug(9, "getResourceAddress(%s,%d) == %ld", resTypeFromId(type), idx, ptr + sizeof(MemBlkHeader));
return ptr + sizeof(MemBlkHeader);
}
***************
*** 681,685 ****
byte *ptr;
! CHECK_HEAP debug(9, "createResource(%d,%d,%d)", type, idx, size);
validateResource("allocating", type, idx);
--- 684,689 ----
byte *ptr;
! CHECK_HEAP
! debug(9, "createResource(%s,%d,%d)", resTypeFromId(type), idx, size);
validateResource("allocating", type, idx);
***************
*** 704,708 ****
{
if (type < rtFirst || type > rtLast || (uint) idx >= (uint) res.num[type]) {
! warning("%s Illegal Glob type %d num %d", str, type, idx);
}
}
--- 708,712 ----
{
if (type < rtFirst || type > rtLast || (uint) idx >= (uint) res.num[type]) {
! warning("%s Illegal Glob type %s (%d) num %d", str, resTypeFromId(type), type, idx);
}
}
***************
*** 712,716 ****
byte *ptr;
! debug(9, "nukeResource(%d,%d)", type, idx);
CHECK_HEAP if (!res.address[type])
--- 716,720 ----
byte *ptr;
! debug(9, "nukeResource(%s,%d)", resTypeFromId(type), idx);
CHECK_HEAP if (!res.address[type])
***************
*** 975,979 ****
increaseResourceCounter();
! debug(1, "Expired resources, mem %d -> %d", oldAllocatedSize,
_allocatedSize);
}
--- 979,983 ----
increaseResourceCounter();
! debug(5, "Expired resources, mem %d -> %d", oldAllocatedSize,
_allocatedSize);
}
***************
*** 1226,1227 ****
--- 1230,1256 ----
+ char *Scumm::resTypeFromId(int id) {
+ static char buf[100];
+
+ switch(id) {
+ case rtRoom: sprintf(buf, "Room"); break;
+ case rtScript: sprintf(buf, "Script"); break;
+ case rtCostume: sprintf(buf, "Costume"); break;
+ case rtSound: sprintf(buf, "Sound"); break;
+ case rtInventory: sprintf(buf, "Inventory"); break;
+ case rtCharset: sprintf(buf, "Charset"); break;
+ case rtString: sprintf(buf, "String"); break;
+ case rtVerb: sprintf(buf, "Verb"); break;
+ case rtActorName: sprintf(buf, "ActorName"); break;
+ case rtBuffer: sprintf(buf, "Buffer"); break;
+ case rtScaleTable:sprintf(buf, "ScaleTable"); break;
+ case rtTemp: sprintf(buf, "Temp"); break;
+ case rtFlObject: sprintf(buf, "FlObject"); break;
+ case rtMatrix: sprintf(buf, "Matrix"); break;
+ case rtBox: sprintf(buf, "Box"); break;
+ case rtLast: sprintf(buf, "Last"); break;
+ case rtNumTypes: sprintf(buf, "NumTypes"); break;
+ default: sprintf(buf,"%d", id);
+ }
+ return buf;
+ }
Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -d -r1.52 -r1.53
*** script.cpp 24 Apr 2002 04:26:09 -0000 1.52
--- script.cpp 26 Apr 2002 14:13:39 -0000 1.53
***************
*** 275,279 ****
_scriptPointerStart = _scriptPointer;
vm.slot[_currentScript].didexec = 1;
! //debug(1, "Script %d: [%X] %s()", vm.slot[_currentScript].number, _opcode, _opcodes_lookup[_opcode]);
op = getOpcode(_opcode);
(this->*op) ();
--- 275,279 ----
_scriptPointerStart = _scriptPointer;
vm.slot[_currentScript].didexec = 1;
! debug(9, "Script %d: [%X] %s()", vm.slot[_currentScript].number, _opcode, _opcodes_lookup[_opcode]);
op = getOpcode(_opcode);
(this->*op) ();
***************
*** 359,365 ****
_vars[var] = value;
! if ((_varwatch == (int)var) || (_varwatch == 0))
! printf("vars[%d] = %d (via script %d)\n", var, value,
! vm.slot[_currentScript].number);
return;
}
--- 359,368 ----
_vars[var] = value;
! if ((_varwatch == (int)var) || (_varwatch == 0)) {
! if (vm.slot[_currentScript].number < 100)
! debug(0, "vars[%d] = %d (via script-%d)", var, value, vm.slot[_currentScript].number);
! else
! debug(0, "vars[%d] = %d (via room-%d-%d)", var, value, _currentRoom, vm.slot[_currentScript].number);
! }
return;
}
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.142
retrieving revision 1.143
diff -C2 -d -r1.142 -r1.143
*** scumm.h 25 Apr 2002 08:53:10 -0000 1.142
--- scumm.h 26 Apr 2002 14:13:39 -0000 1.143
***************
*** 813,816 ****
--- 813,817 ----
void loadPtrToResource(int type, int i, byte *ptr);
void readResTypeList(int id, uint32 tag, const char *name);
+ char *resTypeFromId(int id);
void allocResTypeData(int id, uint32 tag, int num, const char *name, int mode);
byte *createResource(int type, int index, uint32 size);
***************
*** 1843,1846 ****
--- 1844,1848 ----
extern const uint32 IMxx_tags[];
extern const byte default_scale_table[768];
+ extern uint16 _debugLevel;
void outputdisplay2(Scumm *s, int disp);
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.126
retrieving revision 1.127
diff -C2 -d -r1.126 -r1.127
*** scummvm.cpp 24 Apr 2002 14:13:09 -0000 1.126
--- scummvm.cpp 26 Apr 2002 14:13:39 -0000 1.127
***************
*** 1049,1052 ****
--- 1049,1056 ----
{
char buf[1024];
+ #if defined( USE_WINDBG )
+ char buf2[1024];
+ #endif
+
va_list va;
***************
*** 1061,1066 ****
--- 1065,1083 ----
ss->number,
g_scumm->_scriptPointer - g_scumm->_scriptOrgPointer, buf);
+ #if defined( USE_WINDBG )
+ sprintf(buf2, "Error(%d:%d:0x%X): %s!\n",
+ g_scumm->_roomResource,
+ ss->number,
+ g_scumm->_scriptPointer - g_scumm->_scriptOrgPointer,
+ buf);
+ OutputDebugString(buf2);
+ #endif
+
} else {
fprintf(stderr, "Error: %s!\n", buf);
+ #if defined( USE_WINDBG )
+ sprintf(&buf[strlen(buf)], "\n");
+ OutputDebugString(buf);
+ #endif
}
// Doesn't wait for any keypress!! Is it intended to?
***************
*** 1078,1083 ****
--- 1095,1106 ----
fprintf(stderr, "WARNING: %s!\n", buf);
+ #if defined( USE_WINDBG )
+ sprintf(&buf[strlen(buf)], "\n");
+ OutputDebugString(buf);
+ #endif
}
+ uint16 _debugLevel = 1;
+
void CDECL debug(int level, const char *s, ...)
{
***************
*** 1085,1089 ****
va_list va;
! if (level > 5)
return;
--- 1108,1112 ----
va_list va;
! if (level > _debugLevel)
return;
***************
*** 1092,1095 ****
--- 1115,1124 ----
va_end(va);
printf("%s\n", buf);
+
+ #if defined( USE_WINDBG )
+ sprintf(&buf[strlen(buf)], "\n");
+ OutputDebugString(buf);
+ #endif
+
fflush(stdout);
}
More information about the Scummvm-git-logs
mailing list