[Scummvm-cvs-logs] SF.net SVN: scummvm:[51514] scummvm/trunk/engines/sci/engine

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Fri Jul 30 20:45:28 CEST 2010


Revision: 51514
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51514&view=rev
Author:   mthreepwood
Date:     2010-07-30 18:45:28 +0000 (Fri, 30 Jul 2010)

Log Message:
-----------
SCI: Fix saving/restoring games in fan games

The SCI Studio function library incorrectly calls kDeviceInfo with one parameter to get the current device.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel_tables.h
    scummvm/trunk/engines/sci/engine/kfile.cpp
    scummvm/trunk/engines/sci/engine/workarounds.cpp
    scummvm/trunk/engines/sci/engine/workarounds.h

Modified: scummvm/trunk/engines/sci/engine/kernel_tables.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel_tables.h	2010-07-30 16:55:36 UTC (rev 51513)
+++ scummvm/trunk/engines/sci/engine/kernel_tables.h	2010-07-30 18:45:28 UTC (rev 51514)
@@ -319,7 +319,7 @@
     { MAP_CALL(CoordPri),          SIG_EVERYWHERE,           "i(i)",                  NULL,            NULL },
     { MAP_CALL(CosDiv),            SIG_EVERYWHERE,           "ii",                    NULL,            NULL },
     { MAP_CALL(DeleteKey),         SIG_EVERYWHERE,           "l.",                    NULL,            NULL },
-    { MAP_CALL(DeviceInfo),        SIG_EVERYWHERE,           "i(r)(r)(i)",            NULL,            NULL }, // subop
+    { MAP_CALL(DeviceInfo),        SIG_EVERYWHERE,           "i(r)(r)(i)",            NULL,            kDeviceInfo_workarounds }, // subop
     { MAP_CALL(Display),           SIG_EVERYWHERE,           "[ir]([ir!]*)",          NULL,            NULL },
     // ^ we allow invalid references here, because kDisplay gets called with those in e.g. pq3 during intro
     //    restoreBits() checks and skips invalid handles, so that's fine. Sierra SCI behaved the same

Modified: scummvm/trunk/engines/sci/engine/kfile.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kfile.cpp	2010-07-30 16:55:36 UTC (rev 51513)
+++ scummvm/trunk/engines/sci/engine/kfile.cpp	2010-07-30 18:45:28 UTC (rev 51514)
@@ -282,6 +282,14 @@
 };
 
 reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv) {
+	if (g_sci->getGameId() == GID_FANMADE && argc == 1) {
+		// WORKAROUND: The fan game script library calls kDeviceInfo with one parameter.
+		// According to the scripts, it wants to call CurDevice. However, it fails to
+		// provide the subop to the function.
+		s->_segMan->strcpy(argv[0], "/");
+		return s->r_acc;
+	}
+
 	int mode = argv[0].toUint16();
 
 	switch (mode) {

Modified: scummvm/trunk/engines/sci/engine/workarounds.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/workarounds.cpp	2010-07-30 16:55:36 UTC (rev 51513)
+++ scummvm/trunk/engines/sci/engine/workarounds.cpp	2010-07-30 18:45:28 UTC (rev 51514)
@@ -139,6 +139,19 @@
 };
 
 //    gameID,           room,script,lvl,          object-name, method-name,    call,index,                workaround
+const SciWorkaroundEntry kDeviceInfo_workarounds[] = {
+	{ GID_FANMADE,        -1,   994,  1,               "Game", "save",        0xd1c,    0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Cascade Quest)
+	{ GID_FANMADE,        -1,   994,  1,               "Game", "save",        0xe55,    0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Demo Quest)
+	{ GID_FANMADE,        -1,   994,  1,               "Game", "save",        0xe57,    0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (I Want My C64 Back)
+	{ GID_FANMADE,        -1,   994,  1,               "Game", "save",        0xe5c,    0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Most of them)
+	{ GID_FANMADE,        -1,   994,  1,               "Game", "restore",     0xd1c,    0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Cascade Quest)
+	{ GID_FANMADE,        -1,   994,  1,               "Game", "restore",     0xe55,    0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Demo Quest)
+	{ GID_FANMADE,        -1,   994,  1,               "Game", "restore",     0xe57,    0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (I Want My C64 Back)
+	{ GID_FANMADE,        -1,   994,  1,               "Game", "restore",     0xe5c,    0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Most of them)
+	SCI_WORKAROUNDENTRY_TERMINATOR
+};
+
+//    gameID,           room,script,lvl,          object-name, method-name,    call,index,                workaround
 const SciWorkaroundEntry kDisplay_workarounds[] = {
 	{ GID_ISLANDBRAIN,   300,   300,  0,           "geneDude", "show",           -1,    0, { WORKAROUND_IGNORE,    0 } }, // when looking at the gene explanation chart - a parameter is an object
 	{ GID_SQ4,           391,   391,  0,          "doCatalog", "mode",         0x84,    0, { WORKAROUND_IGNORE,    0 } }, // clicking on catalog in roboter sale - a parameter is an object

Modified: scummvm/trunk/engines/sci/engine/workarounds.h
===================================================================
--- scummvm/trunk/engines/sci/engine/workarounds.h	2010-07-30 16:55:36 UTC (rev 51513)
+++ scummvm/trunk/engines/sci/engine/workarounds.h	2010-07-30 18:45:28 UTC (rev 51514)
@@ -75,6 +75,7 @@
 extern const SciWorkaroundEntry kAbs_workarounds[];
 extern const SciWorkaroundEntry kCelHigh_workarounds[];
 extern const SciWorkaroundEntry kCelWide_workarounds[];
+extern const SciWorkaroundEntry kDeviceInfo_workarounds[];
 extern const SciWorkaroundEntry kDisplay_workarounds[];
 extern const SciWorkaroundEntry kDisposeScript_workarounds[];
 extern const SciWorkaroundEntry kDoSoundFade_workarounds[];


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list