From 7708a4ddbbcd7e7880890be252f5be1fa6a8eabb Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 18 Oct 2011 03:10:19 +0300 Subject: SCI: Added some hacks related to new functionality in Phantasmagoria 2 The game will now start (but won't do anything exciting - it'll display its main menu, which doesn't work yet) --- engines/sci/engine/klists.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'engines/sci/engine/klists.cpp') diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index 68469f5c9a..8500f08211 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -691,6 +691,16 @@ reg_t kArray(EngineState *s, int argc, reg_t *argv) { } case 2: { // At (return value at an index) SciArray *array = s->_segMan->lookupArray(argv[1]); + if (g_sci->getGameId() == GID_PHANTASMAGORIA2) { + // HACK: Phantasmagoria 2 keeps trying to access past the end of an + // array when it starts. I'm assuming it's trying to see where the + // array ends, or tries to resize it. Adjust the array size + // accordingly, and return NULL for now. + if (array->getSize() == argv[2].toUint16()) { + array->setSize(argv[2].toUint16()); + return NULL_REG; + } + } return array->getValue(argv[2].toUint16()); } case 3: { // Atput (put value at an index) -- cgit v1.2.3 From 7e298f13a163dc2dfd18a654eaf059744b6dea75 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 3 Nov 2011 01:06:56 +0000 Subject: SCI: Fix copy/paste error --- engines/sci/engine/klists.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/sci/engine/klists.cpp') diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index 8500f08211..83e59c9c20 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -409,7 +409,7 @@ int sort_temp_cmp(const void *p1, const void *p2) { const sort_temp_t *st1 = (const sort_temp_t *)p1; const sort_temp_t *st2 = (const sort_temp_t *)p2; - if (st1->order.segment < st1->order.segment || (st1->order.segment == st1->order.segment && st1->order.offset < st2->order.offset)) + if (st1->order.segment < st2->order.segment || (st1->order.segment == st2->order.segment && st1->order.offset < st2->order.offset)) return -1; if (st1->order.segment > st2->order.segment || (st1->order.segment == st2->order.segment && st1->order.offset > st2->order.offset)) -- cgit v1.2.3