[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.205,1.206 debugger.cpp,1.112,1.113 resource.cpp,1.182,1.183 script.cpp,1.144,1.145 scumm.h,1.356,1.357 scummvm.cpp,2.540,2.541 sound.cpp,1.311,1.312

James Brown ender at users.sourceforge.net
Sat Jan 10 03:02:01 CET 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv20432/scumm

Modified Files:
	actor.cpp debugger.cpp resource.cpp script.cpp scumm.h 
	scummvm.cpp sound.cpp 
Log Message:
More conversion to debug channels


Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -d -r1.205 -r1.206
--- actor.cpp	8 Jan 2004 21:21:40 -0000	1.205
+++ actor.cpp	10 Jan 2004 11:01:46 -0000	1.206
@@ -817,7 +817,9 @@
 
 Actor *ScummEngine::derefActor(int id, const char *errmsg) const {
 	if (id == 0)
-		debug(3, "derefActor(0, \"%s\") in script %d, opcode 0x%x", errmsg, vm.slot[_curExecScript].number, _opcode);
+		debugC(DEBUG_ACTORS, "derefActor(0, \"%s\") in script %d, opcode 0x%x", 
+			errmsg, vm.slot[_curExecScript].number, _opcode);
+
 	if (id < 0 || id >= _numActors || _actors[id].number != id) {
 		if (errmsg)
 			error("Invalid actor %d in %s", id, errmsg);
@@ -829,9 +831,11 @@
 
 Actor *ScummEngine::derefActorSafe(int id, const char *errmsg) const {
 	if (id == 0)
-		debug(3, "derefActorSafe(0, \"%s\") in script %d, opcode 0x%x", errmsg, vm.slot[_curExecScript].number, _opcode);
+		debugC(DEBUG_ACTORS, "derefActorSafe(0, \"%s\") in script %d, opcode 0x%x", 
+			errmsg, vm.slot[_curExecScript].number, _opcode);
+
 	if (id < 0 || id >= _numActors || _actors[id].number != id) {
-		debug(2, "Invalid actor %d in %s (script %d, opcode 0x%x) - This is potentially a BIG problem.",
+		debugC(DEBUG_ACTORS, "Invalid actor %d in %s (script %d, opcode 0x%x)",
 			 id, errmsg, vm.slot[_curExecScript].number, _opcode);
 		return NULL;
 	}

Index: debugger.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.cpp,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- debugger.cpp	10 Jan 2004 05:20:15 -0000	1.112
+++ debugger.cpp	10 Jan 2004 11:01:46 -0000	1.113
@@ -47,7 +47,9 @@
 #endif
         va_list va;
 
-        if (!(g_scumm->_debugFlags & channel))
+	// FIXME: Still spew all debug at -d9, for crashes in startup etc.
+	//	  Add setting from commandline ( / abstract channel interface)
+        if (!(g_scumm->_debugFlags & channel) && (g_debugLevel < 9))
                 return;
 
         va_start(va, s);

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -d -r1.182 -r1.183
--- resource.cpp	8 Jan 2004 17:07:21 -0000	1.182
+++ resource.cpp	10 Jan 2004 11:01:46 -0000	1.183
@@ -46,7 +46,7 @@
 	char buf2[128] = "";
 	byte encByte = 0;
 
-	debug(9, "openRoom(%d)", room);
+	debugC(DEBUG_GENERAL, "openRoom(%d)", room);
 	assert(room >= 0);
 
 	/* Don't load the same room again */
@@ -210,7 +210,7 @@
 }
 
 bool ScummEngine::openResourceFile(const char *filename, byte encByte) {
-	debug(9, "openResourceFile(%s)", filename);
+	debugC(DEBUG_GENERAL, "openResourceFile(%s)", filename);
 
 	if (_fileHandle.isOpen()) {
 		_fileHandle.close();
@@ -252,7 +252,7 @@
 	int num, i;
 	bool stop = false;
 
-	debug(9, "readIndexFile()");
+	debugC(DEBUG_GENERAL, "readIndexFile()");
 
 	closeRoom();
 	openRoom(0);
@@ -550,7 +550,7 @@
 	int i;
 	byte *ptr;
 
-	debug(9, "loadCharset(%d)", no);
+	debugC(DEBUG_GENERAL, "loadCharset(%d)", no);
 
 	/* FIXME - hack around crash in Indy4 (occurs if you try to load after dieing) */
 	if (_gameId == GID_INDY4 && no == 0)
@@ -577,7 +577,7 @@
 void ScummEngine::ensureResourceLoaded(int type, int i) {
 	void *addr = NULL;
 
-	debug(9, "ensureResourceLoaded(%s,%d)", resTypeFromId(type), i);
+	debugC(DEBUG_RESOURCE, "ensureResourceLoaded(%s,%d)", resTypeFromId(type), i);
 
 	if (type == rtRoom && i > 0x7F && _version < 7) {
 		i = _resourceMapper[i & 0x7F];
@@ -615,7 +615,7 @@
 	uint32 fileOffs;
 	uint32 size, tag;
 
-	debug(2, "loadResource(%s,%d)", resTypeFromId(type),idx);
+	debugC(DEBUG_RESOURCE, "loadResource(%s,%d)", resTypeFromId(type),idx);
 
 	if (type == rtCharset && (_features & GF_SMALL_HEADER)) {
 		loadCharset(idx);
@@ -698,7 +698,7 @@
 	int pri, best_pri;
 	uint32 best_size = 0, best_offs = 0;
 
-	debug(9, "readSoundResource(%s,%d)", resTypeFromId(type), idx);
+	debugC(DEBUG_RESOURCE, "readSoundResource(%s,%d)", resTypeFromId(type), idx);
 
 	pos = 0;
 
@@ -707,7 +707,7 @@
 	basetag = fileReadDword();
 	total_size = _fileHandle.readUint32BE();
 
-	debug(8, "  basetag: %s, total_size=%d", tag2str(TO_BE_32(basetag)), total_size);
+	debugC(DEBUG_RESOURCE, "  basetag: %s, total_size=%d", tag2str(TO_BE_32(basetag)), total_size);
 
 	if (basetag == MKID('MIDI') || basetag == MKID('iMUS')) {
 		if (_midiDriver != MD_PCSPK && _midiDriver != MD_PCJR) {
@@ -760,7 +760,7 @@
 			if ((_midiDriver == MD_PCSPK || _midiDriver == MD_PCJR) && pri != 11)
 				pri = -1;
 
-			debug(8, "    tag: %s, total_size=%d, pri=%d", tag2str(TO_BE_32(tag)), size, pri);
+			debugC(DEBUG_RESOURCE, "    tag: %s, total_size=%d, pri=%d", tag2str(TO_BE_32(tag)), size, pri);
 
 
 			if (pri > best_pri) {
@@ -793,8 +793,8 @@
 		return 1;
 	} else if (basetag == MKID('DIGI')) {
 		// Use in Putt-Putt Demo
-		debug(1, "Found base tag DIGI in sound %d, size %d", idx, total_size);
-		debug(1, "It was at position %d", _fileHandle.pos());
+		debugC(DEBUG_SOUND, "Found base tag DIGI in sound %d, size %d", idx, total_size);
+		debugC(DEBUG_SOUND, "It was at position %d", _fileHandle.pos());
 
 		_fileHandle.seek(-12, SEEK_CUR);
 		total_size = _fileHandle.readUint32BE();
@@ -807,8 +807,8 @@
 		int i = 0;
 		File dmuFile;
 		char buffer[128];
-		debug(1, "Found base tag FMUS in sound %d, size %d", idx, total_size);
-		debug(1, "It was at position %d", _fileHandle.pos());
+		debugC(DEBUG_SOUND, "Found base tag FMUS in sound %d, size %d", idx, total_size);
+		debugC(DEBUG_SOUND, "It was at position %d", _fileHandle.pos());
 		
 		_fileHandle.seek(4, SEEK_CUR);
 		// HSHD size
@@ -823,7 +823,7 @@
 			buffer[i] = _fileHandle.readByte();
 		}
 		buffer[tmpsize - 11] = '\0';
-		debug(1, "FMUS file %s", buffer);
+		debugC(DEBUG_SOUND, "FMUS file %s", buffer);
 		if (dmuFile.open(buffer, getGameDataPath()) == false) {
 			warning("Can't open music file %s*", buffer);
 			res.roomoffs[type][idx] = 0xFFFFFFFF;
@@ -831,7 +831,7 @@
 		}
 		dmuFile.seek(4, SEEK_SET);
 		total_size = dmuFile.readUint32BE();
-		debug(1, "dmu file size %d", total_size);
+		debugC(DEBUG_SOUND, "dmu file size %d", total_size);
 		dmuFile.seek(-8, SEEK_CUR);
 		dmuFile.read(createResource(type, idx, total_size), total_size);
 		dmuFile.close();
@@ -1275,7 +1275,7 @@
 		} else {
 			dw = 500000 * 256 / ticks;
 		}
-		debug(4, "  ticks = %d, speed = %ld", ticks, dw);
+		debugC(DEBUG_SOUND, "  ticks = %d, speed = %ld", ticks, dw);
 			
 		// Write a tempo change Meta event
 		memcpy(ptr, "\x00\xFF\x51\x03", 4); ptr += 4;
@@ -1297,7 +1297,7 @@
 			if (instr[i*16 + 13])
 				warning("Sound %d instrument %d uses percussion", idx, i);
 
-			debug(4, "Sound %d: instrument %d on channel %d.", idx, i, ch);
+			debugC(DEBUG_SOUND, "Sound %d: instrument %d on channel %d.", idx, i, ch);
 
 			memcpy(ptr, ADLIB_INSTR_MIDI_HACK, sizeof(ADLIB_INSTR_MIDI_HACK));
 
@@ -1537,7 +1537,7 @@
 				{
 					delay = convert_extraflags(ptr + 30 + 22, src_ptr + 1);
 					delay2 = convert_extraflags(ptr + 30 + 40, src_ptr + 6);
-					debug(4, "delays: %d / %d", delay, delay2);
+					debugC(DEBUG_SOUND, "delays: %d / %d", delay, delay2);
 					if (delay2 >= 0 && delay2 < delay)
 						delay = delay2;
 					if (delay == -1)
@@ -1565,13 +1565,13 @@
 						note += 12;
 						freq >>= 1;
 					}
-					debug(4, "Freq: %d (%x) Note: %d", freq, freq, note);
+					debugC(DEBUG_SOUND, "Freq: %d (%x) Note: %d", freq, freq, note);
 					if (freq < 0x80)
 						note = 0;
 					else
 						note += freq2note[freq - 0x80];
 	
-					debug(4, "Note: %d", note);
+					debugC(DEBUG_SOUND, "Note: %d", note);
 					if (note <= 0)
 						note = 1;
 					else if (note > 127)
@@ -1740,7 +1740,7 @@
 		return NULL;
 
 	if (!res.address[type]) {
-		debug(9, "getResourceAddress(%s,%d), res.address[type] == NULL", resTypeFromId(type), idx);
+		debugC(DEBUG_RESOURCE, "getResourceAddress(%s,%d), res.address[type] == NULL", resTypeFromId(type), idx);
 		return NULL;
 	}
 
@@ -1749,13 +1749,13 @@
 	}
 
 	if (!(ptr = (byte *)res.address[type][idx])) {
-		debug(9, "getResourceAddress(%s,%d) == NULL", resTypeFromId(type), idx);
+		debugC(DEBUG_RESOURCE, "getResourceAddress(%s,%d) == NULL", resTypeFromId(type), idx);
 		return NULL;
 	}
 
 	setResourceCounter(type, idx, 1);
 
-	debug(9, "getResourceAddress(%s,%d) == %p", resTypeFromId(type), idx, ptr + sizeof(MemBlkHeader));
+	debug(DEBUG_RESOURCE, "getResourceAddress(%s,%d) == %p", resTypeFromId(type), idx, ptr + sizeof(MemBlkHeader));
 	return ptr + sizeof(MemBlkHeader);
 }
 
@@ -1797,7 +1797,7 @@
 	byte *ptr;
 
 	CHECK_HEAP
-	debug(9, "createResource(%s,%d,%d)", resTypeFromId(type), idx, size);
+	debugC(DEBUG_RESOURCE, "createResource(%s,%d,%d)", resTypeFromId(type), idx, size);
 
 	if (!validateResource("allocating", type, idx))
 		return NULL;
@@ -1844,7 +1844,7 @@
 	assert(idx >= 0 && idx < res.num[type]);
 
 	if ((ptr = res.address[type][idx]) != NULL) {
-		debug(9, "nukeResource(%s,%d)", resTypeFromId(type), idx);
+		debugC(DEBUG_RESOURCE, "nukeResource(%s,%d)", resTypeFromId(type), idx);
 		res.address[type][idx] = 0;
 		res.flags[type][idx] = 0;
 		_allocatedSize -= ((MemBlkHeader *)ptr)->size;
@@ -1962,7 +1962,7 @@
 
 	increaseResourceCounter();
 
-	debug(5, "Expired resources, mem %d -> %d", oldAllocatedSize, _allocatedSize);
+	debugC(DEBUG_RESOURCE, "Expired resources, mem %d -> %d", oldAllocatedSize, _allocatedSize);
 }
 
 void ScummEngine::freeResources() {

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- script.cpp	10 Jan 2004 05:20:15 -0000	1.144
+++ script.cpp	10 Jan 2004 11:01:47 -0000	1.145
@@ -411,7 +411,7 @@
 		}
 		_opcode = fetchScriptByte();
 		vm.slot[_currentScript].didexec = 1;
-		debug(7, "Script %d, offset 0x%x: [%X] %s()",
+		debugC(DEBUG_OPCODES, "Script %d, offset 0x%x: [%X] %s()",
 				vm.slot[_currentScript].number,
 				_scriptPointer - _scriptOrgPointer,
 				_opcode,
@@ -460,7 +460,7 @@
 	else
 		copyprotbypassed = true;
 
-	debug(9, "readvar(%d)", var);
+	debug(DEBUG_VARS, "readvar(%d)", var);
 
 	if (var & 0x2000 && !(_features & GF_NEW_OPCODES)) {
 		a = fetchScriptWord();

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.356
retrieving revision 1.357
diff -u -d -r1.356 -r1.357
--- scumm.h	10 Jan 2004 05:20:15 -0000	1.356
+++ scumm.h	10 Jan 2004 11:01:47 -0000	1.357
@@ -121,11 +121,14 @@
 };
 
 enum {
-	DEBUG_SCRIPTS	=	1 << 0,		// Track script execution (start/stop/pause)
-	DEBUG_OPCODES	=	1 << 1,		// Track opcode invocations
-	DEBUG_IMUSE	=	1 << 2,		// Track iMUSE events
-	DEBUG_RESOURCE	=	1 << 3,		// Track resource loading / allocation
-	DEBUG_VARS	=	1 << 4		// Track variable changes
+	DEBUG_GENERAL	=	1 << 0,		// General debug
+	DEBUG_SCRIPTS	=	1 << 2,		// Track script execution (start/stop/pause)
+	DEBUG_OPCODES	=	1 << 3,		// Track opcode invocations
+	DEBUG_VARS	=	1 << 4,		// Track variable changes
+	DEBUG_RESOURCE	=	1 << 5,		// Track resource loading / allocation
+	DEBUG_IMUSE	=	1 << 6,		// Track iMUSE events
+	DEBUG_SOUND	=	1 << 7,		// General Sound Debug
+	DEBUG_ACTORS	=	1 << 8		// General Actor Debug
 };
 
 
@@ -135,7 +138,8 @@
 	{"OPCODES", "Track opcode execution", DEBUG_OPCODES},
 	{"IMUSE", "Track iMUSE events", DEBUG_IMUSE},
 	{"RESOURCE", "Track resource loading/management", DEBUG_RESOURCE},
-	{"VARS", "Track variable changes", DEBUG_VARS}
+	{"VARS", "Track variable changes", DEBUG_VARS},
+	{"ACTORS", "Actor-related debug", DEBUG_ACTORS}
 };
 
 struct MemBlkHeader {

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.540
retrieving revision 2.541
diff -u -d -r2.540 -r2.541
--- scummvm.cpp	9 Jan 2004 22:10:32 -0000	2.540
+++ scummvm.cpp	10 Jan 2004 11:01:47 -0000	2.541
@@ -1951,7 +1951,7 @@
 	int i, where;
 
 	CHECK_HEAP;
-	debug(1, "Loading room %d", room);
+	debugC(DEBUG_GENERAL, "Loading room %d", room);
 
 	clearMsgQueue();
 

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.311
retrieving revision 1.312
diff -u -d -r1.311 -r1.312
--- sound.cpp	8 Jan 2004 20:37:25 -0000	1.311
+++ sound.cpp	10 Jan 2004 11:01:47 -0000	1.312
@@ -101,7 +101,7 @@
 				data[j] = _soundQue[i + j];
 			i += num;
 
-			debug(5, "processSoundQues(%d,%d,%d,%d,%d,%d,%d,%d,%d)",
+			debugC(DEBUG_IMUSE, "processSoundQues(%d,%d,%d,%d,%d,%d,%d,%d,%d)",
 						data[0] >> 8, data[0] & 0xFF,
 						data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
 
@@ -120,7 +120,9 @@
 	int rate;
 	byte flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE;
 	
-	debug(3, "playSound #%d (room %d)", soundID, _vm->getResourceRoomNr(rtSound, soundID));
+	debugC(DEBUG_SOUND, "playSound #%d (room %d)", soundID, 
+		_vm->getResourceRoomNr(rtSound, soundID));
+
 	ptr = _vm->getResourceAddress(rtSound, soundID);
 	if (!ptr) {
 		return;





More information about the Scummvm-git-logs mailing list