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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun Aug 23 23:57:30 CEST 2009


Revision: 43678
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43678&view=rev
Author:   thebluegr
Date:     2009-08-23 21:57:30 +0000 (Sun, 23 Aug 2009)

Log Message:
-----------
- Added more mappings from Sierra's internal IDs to our own ones. Hopefully, all SCI0-SCI11 games can now be detected correctly from the fallback detector
- Simplified some checks for old script types

Modified Paths:
--------------
    scummvm/trunk/engines/sci/detection.cpp
    scummvm/trunk/engines/sci/engine/game.cpp
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/kernel.h
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/seg_manager.cpp
    scummvm/trunk/engines/sci/engine/seg_manager.h
    scummvm/trunk/engines/sci/engine/static_selectors.cpp
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/engine/vm.h

Modified: scummvm/trunk/engines/sci/detection.cpp
===================================================================
--- scummvm/trunk/engines/sci/detection.cpp	2009-08-23 21:22:51 UTC (rev 43677)
+++ scummvm/trunk/engines/sci/detection.cpp	2009-08-23 21:57:30 UTC (rev 43678)
@@ -2412,7 +2412,18 @@
 		{NULL, 0, NULL, 0}}, Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH},
 		0
 	},
+#endif
 
+	// Slater & Charlie go camping
+	{{"slater", "", {
+		{"resource.000", 0, "1846b57fe84774be72f7c50ab3c90df0", 2256126},
+		{"resource.map", 0, "21f85414124dc23e54544a5536dc35cd", 4044},
+		{"resource.msg", 0, "c44f51fb955eae266fecf360ebcd5ad2", 1132},
+		{NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO, GUIO_NOSPEECH},
+		0
+	},
+
+#ifdef ENABLE_SCI32
 	// RAMA - English DOS/Windows Demo
 	// Executable scanning reports "2.100.002", VERSION file reports "000.000.008"
 	{{"rama", "Demo", {
@@ -3045,15 +3056,20 @@
 Common::String convertSierraGameId(Common::String sierraId) {
 	// TODO: SCI32 IDs
 
-	// TODO: astrochicken
-	// TODO: The internal id of christmas1998 is "demo"
-	if (sierraId == "card")
-		return "christmas1990";
-	// TODO: christmas1992
+	// TODO: The internal id of christmas1988 is "demo"
+	if (sierraId == "card") {
+		// This could either be christmas1990 or christmas1992
+		// christmas1990 has a "resource.001" file, whereas 
+		// christmas1992 has a "resource.000" file
+		return (Common::File::exists("resource.001")) ? "christmas1990" : "christmas1992";
+	}
 	if (sierraId == "arthur")
 		return "camelot";
-	if (sierraId == "brain")
-		return "castlebrain";
+	if (sierraId == "brain") {
+		// This could either be The Castle of Dr. Brain, or The Island of Dr. Brain
+		// castlebrain has resource.001, whereas islandbrain doesn't
+		return (Common::File::exists("resource.001")) ? "castlebrain" : "islandbrain";
+	}
 	// iceman is the same
 	// longbow is the same
 	if (sierraId == "eco")
@@ -3068,8 +3084,8 @@
 		return "hoyle1";
 	if (sierraId == "solitare")
 		return "hoyle2";
-	// TODO: hoyle3
-	// TODO: hoyle4
+	// hoyle3 is the same
+	// hoyle4 is the same
 	if (sierraId == "kq1")
 		return "kq1sci";
 	if (sierraId == "kq4")
@@ -3081,9 +3097,10 @@
 	// lsl5 is the same
 	// lsl6 is the same
 	// TODO: lslcasino
-	// TODO: fairytales
-	// TODO: mothergoose
-	// TODO: msastrochicken
+	if (sierraId == "tales")
+		return "fairytales";
+	if (sierraId == "mg")
+		return "mothergoose";
 	if (sierraId == "cb1")
 		return "laurabow";
 	if (sierraId == "lb2")
@@ -3102,13 +3119,27 @@
 		return "qfg2";
 	if (sierraId == "qfg1")
 		return "qfg3";
-	// TODO: slater
+	if (sierraId == "thegame")
+		return "slater";
 	if (sierraId == "sq1")
 		return "sq1sci";
-	// sq3 is the same
+	if (sierraId == "sq3") {
+		// Both SQ3 and the separately released subgame, Astro Chicken,
+		// have internal ID "sq3", but Astro Chicken only has "resource.map"
+		// and "resource.001". Detect if it's SQ3 by the existence of
+		// "resource.002"
+		return (Common::File::exists("resource.002")) ? "sq3" : "astrochicken";
+	}
+	if (sierraId == "sq4") {
+		// Both SQ4 and the separately released subgame, Ms. Astro Chicken,
+		// have internal ID "sq4", but Astro Chicken only has "resource.map"
+		// and "resource.001". Detect if it's SQ4 by the existence of
+		// "resource.000" (which exists in both SQ4 floppy and CD, but not in
+		// the subgame)
+		return (Common::File::exists("resource.000")) ? "sq4" : "msastrochicken";
+	}
 	// sq4 is the same
 	// sq5 is the same
-	// TODO: islandbrain
 
 	return sierraId;
 }
@@ -3185,12 +3216,8 @@
 	// Determine the game id
 	ResourceManager *resMgr = new ResourceManager(fslist);
 	SciVersion version = resMgr->sciVersion();
-	Kernel *kernel = new Kernel(resMgr, true);
-	bool hasOldScriptHeader = kernel->hasOldScriptHeader();
-	delete kernel;
-
-	SegManager *segManager = new SegManager(resMgr, version, hasOldScriptHeader);
-	if (!script_instantiate(resMgr, segManager, version, hasOldScriptHeader, 0)) {
+	SegManager *segManager = new SegManager(resMgr, version);
+	if (!script_instantiate(resMgr, segManager, version, 0)) {
 		warning("fallbackDetect(): Could not instantiate script 0");
 		SearchMan.remove("SCI_detection");
 		return 0;

Modified: scummvm/trunk/engines/sci/engine/game.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/game.cpp	2009-08-23 21:22:51 UTC (rev 43677)
+++ scummvm/trunk/engines/sci/engine/game.cpp	2009-08-23 21:57:30 UTC (rev 43678)
@@ -191,7 +191,7 @@
 // Architectural stuff: Init/Unintialize engine
 int script_init_engine(EngineState *s) {
 	s->kernel_opt_flags = 0;
-	s->seg_manager = new SegManager(s->resmgr, s->_version, ((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader());
+	s->seg_manager = new SegManager(s->resmgr, s->_version);
 	s->gc_countdown = GC_INTERVAL - 1;
 
 	SegmentId script_000_segment = s->seg_manager->getSegment(0, SCRIPT_GET_LOCK);
@@ -294,7 +294,7 @@
 	s->stack_base = stack->entries;
 	s->stack_top = s->stack_base + VM_STACK_SIZE;
 
-	if (!script_instantiate(s->resmgr, s->seg_manager, s->_version, ((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader(), 0)) {
+	if (!script_instantiate(s->resmgr, s->seg_manager, s->_version, 0)) {
 		warning("game_init(): Could not instantiate script 0");
 		return 1;
 	}

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2009-08-23 21:22:51 UTC (rev 43677)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2009-08-23 21:57:30 UTC (rev 43678)
@@ -363,15 +363,12 @@
 	"Arithmetic"
 };
 
-Kernel::Kernel(ResourceManager *resmgr, bool minimalLoad) : _resmgr(resmgr) {
+Kernel::Kernel(ResourceManager *resmgr) : _resmgr(resmgr) {
 	memset(&_selectorMap, 0, sizeof(_selectorMap));	// FIXME: Remove this once/if we C++ify selector_map_t
 
 	loadSelectorNames();
 	detectSciFeatures();
 
-	if (minimalLoad)	// If we're only asked to detect game features, stop here
-		return;
-
 	mapSelectors();      // Map a few special selectors for later use
 	loadOpcodes();
 	loadKernelNames();

Modified: scummvm/trunk/engines/sci/engine/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.h	2009-08-23 21:22:51 UTC (rev 43677)
+++ scummvm/trunk/engines/sci/engine/kernel.h	2009-08-23 21:57:30 UTC (rev 43678)
@@ -67,10 +67,8 @@
 public:
 	/**
 	 * Initializes the SCI kernel
-	 * @param minimalLoad If true, only the selector names are loaded, to detect game features.
-	 * It's set to true by the advanced game detector to speed it up
 	 */
-	Kernel(ResourceManager *resmgr, bool minimalLoad = false);
+	Kernel(ResourceManager *resmgr);
 	~Kernel();
 
 	uint getOpcodesSize() const { return _opcodes.size(); }

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2009-08-23 21:22:51 UTC (rev 43677)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2009-08-23 21:57:30 UTC (rev 43678)
@@ -219,7 +219,7 @@
 	if (s.isLoading()) {
 		// FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch.
 		delete obj;
-		obj = new SegManager(resMgr, version, ((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader());
+		obj = new SegManager(resMgr, version);
 	}
 
 	obj->saveLoadWithSerializer(s);

Modified: scummvm/trunk/engines/sci/engine/seg_manager.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.cpp	2009-08-23 21:22:51 UTC (rev 43677)
+++ scummvm/trunk/engines/sci/engine/seg_manager.cpp	2009-08-23 21:57:30 UTC (rev 43678)
@@ -52,7 +52,7 @@
 
 #define INVALID_SCRIPT_ID -1
 
-SegManager::SegManager(ResourceManager *resMgr, SciVersion version, bool oldScriptHeader) {
+SegManager::SegManager(ResourceManager *resMgr, SciVersion version) {
 	id_seg_map = new IntMapper();
 	reserved_id = INVALID_SCRIPT_ID;
 	id_seg_map->checkKey(reserved_id, true);	// reserve entry 0 for INVALID_SCRIPT_ID
@@ -68,7 +68,6 @@
 	exports_wide = 0;
 	_version = version;
 	_resMgr = resMgr;
-	_oldScriptHeader = oldScriptHeader;
 
 	int result = 0;
 
@@ -150,7 +149,7 @@
 	if (!script || (_version >= SCI_VERSION_1_1 && !heap)) {
 		error("SegManager::setScriptSize: failed to load %s", !script ? "script" : "heap");
 	}
-	if (_oldScriptHeader) {
+	if (_version == SCI_VERSION_0_EARLY) {	// check if we got an old script header
 		scr.buf_size = script->size + READ_LE_UINT16(script->data) * 2;
 		//locals_size = READ_LE_UINT16(script->data) * 2;
 	} else if (_version < SCI_VERSION_1_1) {
@@ -445,7 +444,7 @@
 	SegmentId segment;
 
 	if ((load & SCRIPT_GET_LOAD) == SCRIPT_GET_LOAD)
-		script_instantiate(_resMgr, this, _version, _oldScriptHeader, script_nr);
+		script_instantiate(_resMgr, this, _version, script_nr);
 
 	segment = segGet(script_nr);
 
@@ -987,7 +986,7 @@
 		Resource *script = _resMgr->findResource(ResourceId(kResourceTypeScript, scriptnr), 0);
 
 		if (script) {
-			if (_oldScriptHeader)
+			if (version == SCI_VERSION_0_EARLY)	// check if we got an old script header
 				magic_offset = seeker = 2;
 			else
 				magic_offset = seeker = 0;

Modified: scummvm/trunk/engines/sci/engine/seg_manager.h
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.h	2009-08-23 21:22:51 UTC (rev 43677)
+++ scummvm/trunk/engines/sci/engine/seg_manager.h	2009-08-23 21:57:30 UTC (rev 43678)
@@ -58,7 +58,7 @@
 	/**
 	 * Initialize the segment manager
 	 */
-	SegManager(ResourceManager *resMgr, SciVersion version, bool oldScriptHeader);
+	SegManager(ResourceManager *resMgr, SciVersion version);
 
 	/**
 	 * Deallocate all memory associated with the segment manager
@@ -342,7 +342,6 @@
 
 private:
 	IntMapper *id_seg_map; ///< id - script id; seg - index of heap
-	bool _oldScriptHeader;
 public: // TODO: make private
 	Common::Array<MemObject *> _heap;
 	int reserved_id;

Modified: scummvm/trunk/engines/sci/engine/static_selectors.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/static_selectors.cpp	2009-08-23 21:22:51 UTC (rev 43677)
+++ scummvm/trunk/engines/sci/engine/static_selectors.cpp	2009-08-23 21:57:30 UTC (rev 43678)
@@ -499,10 +499,12 @@
 	} while (0)
 
 Common::StringList Kernel::checkStaticSelectorNames() {
+	Common::StringList names;
+	if (!g_engine)
+		return names;
+
 	Common::String gameID = ((SciEngine*)g_engine)->getGameID();
-	
-	Common::StringList names;
-	
+
 	if (gameID == "kq4sci")
 		USE_SELECTOR_TABLE(kq4_demo_selectors);
 	else if (gameID == "lsl3" || gameID == "iceman") // identical, except iceman has "flags" 

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2009-08-23 21:22:51 UTC (rev 43677)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2009-08-23 21:57:30 UTC (rev 43678)
@@ -208,7 +208,7 @@
 	Script *scr = s->seg_manager->getScriptIfLoaded(seg);
 
 	if (!scr)  // Script not present yet?
-		seg = script_instantiate(s->resmgr, s->seg_manager, s->_version, ((SciEngine*)g_engine)->getKernel()->hasOldScriptHeader(), script);
+		seg = script_instantiate(s->resmgr, s->seg_manager, s->_version, script);
 	else
 		scr->unmarkDeleted();
 
@@ -1761,11 +1761,11 @@
 	return seg_id;
 }
 
-int script_instantiate(ResourceManager *resMgr, SegManager *segManager, SciVersion version, bool oldScriptHeader, int script_nr) {
+int script_instantiate(ResourceManager *resMgr, SegManager *segManager, SciVersion version, int script_nr) {
 	if (version >= SCI_VERSION_1_1)
 		return script_instantiate_sci11(resMgr, segManager, version, script_nr);
 	else
-		return script_instantiate_sci0(resMgr, segManager, version, oldScriptHeader, script_nr);
+		return script_instantiate_sci0(resMgr, segManager, version, (version == SCI_VERSION_0_EARLY), script_nr);
 }
 
 void script_uninstantiate_sci0(SegManager *segManager, SciVersion version, int script_nr, SegmentId seg) {

Modified: scummvm/trunk/engines/sci/engine/vm.h
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.h	2009-08-23 21:22:51 UTC (rev 43677)
+++ scummvm/trunk/engines/sci/engine/vm.h	2009-08-23 21:57:30 UTC (rev 43678)
@@ -489,7 +489,7 @@
  * @param[in] script_nr		The script number to load
  * @return					The script's segment ID or 0 if out of heap
  */
-int script_instantiate(ResourceManager *resMgr, SegManager *segManager, SciVersion version, bool oldScriptHeader, int script_nr);
+int script_instantiate(ResourceManager *resMgr, SegManager *segManager, SciVersion version, int script_nr);
 
 /**
  * Decreases the numer of lockers of a script and unloads it if that number


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