[Scummvm-cvs-logs] scummvm master -> bd2bfe85c97189e72199e5d0554ec4bd192a80b2

bluegr md5 at scummvm.org
Fri May 13 15:15:07 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
bd2bfe85c9 SCI: Don't include several debug tables when REDUCE_MEMORY_USAGE is defined


Commit: bd2bfe85c97189e72199e5d0554ec4bd192a80b2
    https://github.com/scummvm/scummvm/commit/bd2bfe85c97189e72199e5d0554ec4bd192a80b2
Author: md5 (md5 at scummvm.org)
Date: 2011-05-13T06:12:52-07:00

Commit Message:
SCI: Don't include several debug tables when REDUCE_MEMORY_USAGE is defined

Changed paths:
    engines/sci/engine/scriptdebug.cpp
    engines/sci/engine/vm.cpp
    engines/sci/sound/drivers/gm_names.h
    engines/sci/sound/drivers/midi.cpp



diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 77bea5b..16098ab 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -31,6 +31,10 @@
 
 namespace Sci {
 
+// This table is only used for debugging. Don't include it for devices
+// with not enough available memory (e.g. phones), where REDUCE_MEMORY_USAGE
+// is defined
+#ifndef REDUCE_MEMORY_USAGE
 const char *opcodeNames[] = {
 	   "bnot",       "add",      "sub",      "mul",      "div",
 		"mod",       "shr",      "shl",      "xor",      "and",
@@ -59,6 +63,7 @@ const char *opcodeNames[] = {
 	   "-agi",      "-ali",     "-ati",     "-api",     "-sgi",
 	   "-sli",      "-sti",     "-spi"
 };
+#endif	// REDUCE_MEMORY_USAGE
 
 // Disassembles one command from the heap, returns address of next command or 0 if a ret was encountered.
 reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode) {
@@ -110,7 +115,9 @@ reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode
 	if (printBWTag)
 		debugN("[%c] ", opsize ? 'B' : 'W');
 
+#ifndef REDUCE_MEMORY_USAGE
 	debugN("%s", opcodeNames[opcode]);
+#endif
 
 	i = 0;
 	while (g_opcode_formats[opcode][i]) {
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 25b1302..4995749 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -114,7 +114,9 @@ static bool validate_variable(reg_t *r, reg_t *stack_base, int type, int max, in
 	return true;
 }
 
+#ifndef REDUCE_MEMORY_USAGE
 extern const char *opcodeNames[]; // from scriptdebug.cpp
+#endif
 
 static reg_t read_var(EngineState *s, int type, int index) {
 	if (validate_variable(s->variables[type], s->stack_base, type, s->variablesMax[type], index)) {
diff --git a/engines/sci/sound/drivers/gm_names.h b/engines/sci/sound/drivers/gm_names.h
index 915996e..bfe5ff8 100644
--- a/engines/sci/sound/drivers/gm_names.h
+++ b/engines/sci/sound/drivers/gm_names.h
@@ -25,6 +25,11 @@
 
 namespace Sci {
 
+// These tables are only used for debugging. Don't include them for devices
+// with not enough available memory (e.g. phones), where REDUCE_MEMORY_USAGE
+// is defined
+#ifndef REDUCE_MEMORY_USAGE
+
 static const char *GmInstrumentNames[] = {
 	/*000*/  "Acoustic Grand Piano",
 	/*001*/  "Bright Acoustic Piano",
@@ -212,6 +217,8 @@ static const char *GmPercussionNames[] = {
 	/*81*/  "Open Triangle"
 };
 
+#endif	// REDUCE_MEMORY_USAGE
+
 } // End of namespace Sci
 
 #endif // SCI_SOUND_DRIVERS_GM_NAMES_H
diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp
index ac24076..93a2308 100644
--- a/engines/sci/sound/drivers/midi.cpp
+++ b/engines/sci/sound/drivers/midi.cpp
@@ -816,11 +816,13 @@ void MidiPlayer_Midi::mapMt32ToGm(byte *data, size_t size) {
 		if (_patchMap[i] == MIDI_UNMAPPED) {
 			debugC(kDebugLevelSound, "[Unmapped]");
 		} else {
+#ifndef REDUCE_MEMORY_USAGE
 			if (_patchMap[i] >= 128) {
 				debugC(kDebugLevelSound, "%s [Rhythm]", GmPercussionNames[_patchMap[i] - 128]);
 			} else {
 				debugC(kDebugLevelSound, "%s", GmInstrumentNames[_patchMap[i]]);
 			}
+#endif
 		}
 
 		_keyShift[i] = CLIP<uint8>(keyshift, 0, 48) - 24;
@@ -852,10 +854,12 @@ void MidiPlayer_Midi::mapMt32ToGm(byte *data, size_t size) {
 				}
 			}
 
+#ifndef REDUCE_MEMORY_USAGE
 			if (_percussionMap[ins] == MIDI_UNMAPPED)
 				debugC(kDebugLevelSound, "[Unmapped]");
 			else
 				debugC(kDebugLevelSound, "%s", GmPercussionNames[_percussionMap[ins]]);
+#endif
 
 			_percussionVelocityScale[ins] = *(data + pos + 4 * i + 3) * 127 / 100;
 		}






More information about the Scummvm-git-logs mailing list