[Scummvm-cvs-logs] SF.net SVN: scummvm:[47950] scummvm/trunk/engines/sci/engine
mthreepwood at users.sourceforge.net
mthreepwood at users.sourceforge.net
Sun Feb 7 05:25:05 CET 2010
Revision: 47950
http://scummvm.svn.sourceforge.net/scummvm/?rev=47950&view=rev
Author: mthreepwood
Date: 2010-02-07 04:25:05 +0000 (Sun, 07 Feb 2010)
Log Message:
-----------
SCI1 Mac games can call kGetFarText with a NULL destination, so we need to allocate the memory. King's Quest V Mac is now playable.
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kernel.cpp
scummvm/trunk/engines/sci/engine/kstring.cpp
Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp 2010-02-07 03:00:52 UTC (rev 47949)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp 2010-02-07 04:25:05 UTC (rev 47950)
@@ -265,7 +265,7 @@
/*4a*/ DEFUN("StrLen", kStrLen, "Zr"),
/*4b*/ DEFUN("StrCpy", kStrCpy, "rZri*"),
/*4c*/ DEFUN("Format", kFormat, "r.*"),
- /*4d*/ DEFUN("GetFarText", kGetFarText, "iir"),
+ /*4d*/ DEFUN("GetFarText", kGetFarText, "iiZr"),
/*4e*/ DEFUN("ReadNumber", kReadNumber, "r"),
/*4f*/ DEFUN("BaseSetter", kBaseSetter, "o"),
/*50*/ DEFUN("DirLoop", kDirLoop, "oi"),
Modified: scummvm/trunk/engines/sci/engine/kstring.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kstring.cpp 2010-02-07 03:00:52 UTC (rev 47949)
+++ scummvm/trunk/engines/sci/engine/kstring.cpp 2010-02-07 04:25:05 UTC (rev 47950)
@@ -424,23 +424,26 @@
char *seeker;
int counter = argv[1].toUint16();
-
if (!textres) {
error("text.%d does not exist", argv[0].toUint16());
return NULL_REG;
}
- seeker = (char *) textres->data;
-
+ seeker = (char *)textres->data;
+
+ // The second parameter (counter) determines the number of the string inside the text
+ // resource.
while (counter--) {
while (*seeker++)
;
}
- /* The second parameter (counter) determines the number of the string inside the text
- ** resource.
- */
- s->_segMan->strcpy(argv[2], seeker); /* Copy the string and get return value */
+ // If the third argument is NULL, allocate memory for the destination. This occurs in
+ // SCI1 Mac games. The memory will later be freed by the game's scripts.
+ if (argv[2] == NULL_REG)
+ s->_segMan->allocDynmem(strlen(seeker) + 1, "Mac FarText", &argv[2]);
+
+ s->_segMan->strcpy(argv[2], seeker); // Copy the string and get return value
return argv[2];
}
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