[Scummvm-cvs-logs] scummvm master -> a9620d938dc7031e47533f0dadf3295cd6488ca8
bluegr
md5 at scummvm.org
Tue Feb 22 18:12:33 CET 2011
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
cf904b1156 SCI: Added code to aid in detecting infinite loops in scripts
8e7178a538 SCI: Fixed the detection entries for PQ4CD and QFG4CD
a9620d938d SCI: Some work on kRemapColors, and added a note that it operates on an RGBA
Commit: cf904b1156091c65486bf3124e3ef1d3fd1b6f8f
https://github.com/scummvm/scummvm/commit/cf904b1156091c65486bf3124e3ef1d3fd1b6f8f
Author: md5 (md5 at scummvm.org)
Date: 2011-02-22T08:52:44-08:00
Commit Message:
SCI: Added code to aid in detecting infinite loops in scripts
When the ABORT_ON_INFINITE_LOOP define is defined in vm.cpp, the VM will now
abort in cases where a conditional statement is followed by an unconditional
jump (which will most likely lead to an infinite loop). Aids in detecting
infinite loop bugs such as #3040722.
Changed paths:
engines/sci/engine/vm.cpp
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index a70ff5a..43d38a4 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -47,6 +47,10 @@ const reg_t NULL_REG = {0, 0};
const reg_t SIGNAL_REG = {0, SIGNAL_OFFSET};
const reg_t TRUE_REG = {0, 1};
//#define VM_DEBUG_SEND
+// Enable the define below to have the VM abort on cases where a conditional
+// statement is followed by an unconditional jump (which will most likely lead
+// to an infinite loop). Aids in detecting script bugs such as #3040722.
+//#define ABORT_ON_INFINITE_LOOP
#define SCI_XS_CALLEE_LOCALS ((SegmentId)-1)
@@ -871,6 +875,10 @@ void run_vm(EngineState *s) {
s->_executionStackPosChanged = true; // Force initialization
+#ifdef ABORT_ON_INFINITE_LOOP
+ byte prevOpcode = 0xFF;
+#endif
+
while (1) {
int var_type; // See description below
int var_number;
@@ -935,7 +943,22 @@ void run_vm(EngineState *s) {
byte extOpcode;
s->xs->addr.pc.offset += readPMachineInstruction(scr->getBuf() + s->xs->addr.pc.offset, extOpcode, opparams);
const byte opcode = extOpcode >> 1;
- //debug("%s: %d, %d, %d, %d, acc = %04x:%04x", opcodeNames[opcode], opparams[0], opparams[1], opparams[2], opparams[3], PRINT_REG(s->r_acc));
+ //debug("%s: %d, %d, %d, %d, acc = %04x:%04x, script %d, local script %d", opcodeNames[opcode], opparams[0], opparams[1], opparams[2], opparams[3], PRINT_REG(s->r_acc), scr->getScriptNumber(), local_script->getScriptNumber());
+
+#ifdef ABORT_ON_INFINITE_LOOP
+ if (prevOpcode != 0xFF) {
+ if (prevOpcode == op_eq_ || prevOpcode == op_ne_ ||
+ prevOpcode == op_gt_ || prevOpcode == op_ge_ ||
+ prevOpcode == op_lt_ || prevOpcode == op_le_ ||
+ prevOpcode == op_ugt_ || prevOpcode == op_uge_ ||
+ prevOpcode == op_ult_ || prevOpcode == op_ule_) {
+ if (opcode == op_jmp)
+ error("Infinite loop detected in script %d", scr->getScriptNumber());
+ }
+ }
+
+ prevOpcode = opcode;
+#endif
switch (opcode) {
Commit: 8e7178a538d21c815b44692f30657600b4f866bc
https://github.com/scummvm/scummvm/commit/8e7178a538d21c815b44692f30657600b4f866bc
Author: md5 (md5 at scummvm.org)
Date: 2011-02-22T09:06:29-08:00
Commit Message:
SCI: Fixed the detection entries for PQ4CD and QFG4CD
Changed paths:
engines/sci/detection_tables.h
diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index c7ef720..c1c13a0 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -2588,13 +2588,13 @@ static const struct ADGameDescription SciGameDescriptions[] = {
Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
#ifdef ENABLE_SCI32
- // Police Quest 4 - English DOS (from the Police Quest Collection)
+ // Police Quest 4 - English DOS CD (from the Police Quest Collection)
// Executable scanning reports "2.100.002", VERSION file reports "1.100.000"
- {"pq4", "", {
+ {"pq4", "CD", {
{"resource.map", 0, "379dfe80ed6bd16c47e4b950c4722eac", 11374},
{"resource.000", 0, "fd316a09b628b7032248139003369022", 18841068},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
// Police Quest 4 - English DOS
// SCI interpreter version 2.000.000 (a guess?)
@@ -2959,13 +2959,13 @@ static const struct ADGameDescription SciGameDescriptions[] = {
AD_LISTEND},
Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH },
- // Quest for Glory 4 - English DOS/Windows (from jvprat)
+ // Quest for Glory 4 CD - English DOS/Windows (from jvprat)
// Executable scanning reports "2.100.002", VERSION file reports "1.0"
- {"qfg4", "", {
+ {"qfg4", "CD", {
{"resource.map", 0, "aba367f2102e81782d961b14fbe3d630", 10246},
{"resource.000", 0, "263dce4aa34c49d3ad29bec889007b1c", 11571394},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
// RAMA - English DOS/Windows Demo
// Executable scanning reports "2.100.002", VERSION file reports "000.000.008"
Commit: a9620d938dc7031e47533f0dadf3295cd6488ca8
https://github.com/scummvm/scummvm/commit/a9620d938dc7031e47533f0dadf3295cd6488ca8
Author: md5 (md5 at scummvm.org)
Date: 2011-02-22T09:11:35-08:00
Commit Message:
SCI: Some work on kRemapColors, and added a note that it operates on an RGBA
palette
Changed paths:
engines/sci/engine/kgraphics.cpp
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 8730724..9034bd1 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -1201,14 +1201,12 @@ reg_t kShow(EngineState *s, int argc, reg_t *argv) {
}
reg_t kRemapColors(EngineState *s, int argc, reg_t *argv) {
- // TODO: This is all a stub/skeleton, thus we're invoking kStub() for now
- kStub(s, argc, argv);
-
uint16 operation = argv[0].toUint16();
switch (operation) {
- case 0: { // Initialize remapping to base. 0 turns remapping off.
- //int16 unk1 = (argc >= 2) ? argv[1].toSint16() : 0;
+ case 0: { // Set remapping to base. 0 turns remapping off.
+ int16 base = (argc >= 2) ? argv[1].toSint16() : 0;
+ warning("kRemapColors: Set remapping to base %d", base);
}
break;
case 1: { // unknown
@@ -1218,18 +1216,25 @@ reg_t kRemapColors(EngineState *s, int argc, reg_t *argv) {
//int16 unk3 = argv[3].toSint16();
//uint16 unk4 = argv[4].toUint16();
//uint16 unk5 = (argc >= 6) ? argv[5].toUint16() : 0;
+ kStub(s, argc, argv);
}
break;
case 2: { // remap by percent
- //int16 unk1 = argv[1].toSint16();
- //uint16 percent = argv[2].toUint16();
- //uint16 unk3 = (argc >= 4) ? argv[3].toUint16() : 0;
+ // NOTE: This adjusts the alpha value of a specific color, and it operates on
+ // an RGBA palette
+ int16 color = argv[1].toSint16(); // this is subtracted from a maximum color value, and can be offset by 10
+ uint16 percent = argv[2].toUint16(); // 0 - 100
+ uint16 unk3 = (argc >= 4) ? argv[3].toUint16() : 0;
+ warning("kRemapColors: RemapByPercent color %d by %d percent (unk3 = %d)", color, percent, unk3);
}
break;
case 3: { // remap to gray
- //int16 unk1 = argv[1].toSint16();
- //int16 percent = argv[2].toSint16(); // 0 - 100
- //uint16 unk3 = (argc >= 4) ? argv[3].toUint16() : 0;
+ // NOTE: This adjusts the alpha value of a specific color, and it operates on
+ // an RGBA palette
+ int16 color = argv[1].toSint16(); // this is subtracted from a maximum color value, and can be offset by 10
+ int16 percent = argv[2].toSint16(); // 0 - 100
+ uint16 unk3 = (argc >= 4) ? argv[3].toUint16() : 0;
+ warning("kRemapColors: RemapToGray color %d by %d percent (unk3 = %d)", color, percent, unk3);
}
break;
case 4: { // unknown
@@ -1237,11 +1242,13 @@ reg_t kRemapColors(EngineState *s, int argc, reg_t *argv) {
//uint16 unk2 = argv[2].toUint16();
//uint16 unk3 = argv[3].toUint16();
//uint16 unk4 = (argc >= 5) ? argv[4].toUint16() : 0;
+ kStub(s, argc, argv);
}
break;
case 5: { // increment color
//int16 unk1 = argv[1].toSint16();
//uint16 unk2 = argv[2].toUint16();
+ kStub(s, argc, argv);
}
break;
default:
More information about the Scummvm-git-logs
mailing list