[Scummvm-git-logs] scummvm master -> 01eb55b049ea4c2d1c2cca704cc84c8f9b295651

lolbot-iichan lolbot_iichan at mail.ru
Sat May 16 22:15:44 UTC 2020


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
01eb55b049 WINTERMUTE: Support Foxtail 1.2.902.4379 (#2256)


Commit: 01eb55b049ea4c2d1c2cca704cc84c8f9b295651
    https://github.com/scummvm/scummvm/commit/01eb55b049ea4c2d1c2cca704cc84c8f9b295651
Author: lolbot-iichan (lolbot_iichan at mail.ru)
Date: 2020-05-17T01:15:41+03:00

Commit Message:
WINTERMUTE: Support Foxtail 1.2.902.4379 (#2256)

* WINTERMUTE: Add FoxTail 1.2.902 engine and package detection
* WINTERMUTE: Add support for FoxTail 1.2.902 opcodes

Changed paths:
  A engines/wintermute/base/scriptables/script_opcodes.h
    engines/wintermute/base/base_engine.h
    engines/wintermute/base/base_game.cpp
    engines/wintermute/base/scriptables/dcscript.h
    engines/wintermute/base/scriptables/script.cpp
    engines/wintermute/base/scriptables/script.h
    engines/wintermute/detection_tables.h


diff --git a/engines/wintermute/base/base_engine.h b/engines/wintermute/base/base_engine.h
index 02d4c9e74c..bb67a600d4 100644
--- a/engines/wintermute/base/base_engine.h
+++ b/engines/wintermute/base/base_engine.h
@@ -116,6 +116,7 @@ enum WMETargetExecutable {
 	FOXTAIL_1_2_362,
 	FOXTAIL_1_2_527,
 	FOXTAIL_1_2_896,
+	FOXTAIL_1_2_902,
 	FOXTAIL_LATEST_VERSION
 };
 
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index 6c1faaa237..798a2bc305 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -2705,6 +2705,8 @@ ScValue *BaseGame::scGetProperty(const Common::String &name) {
 			_scValue->setString("1.2.527");
 		} else if (BaseEngine::instance().getTargetExecutable() == FOXTAIL_1_2_896) {
 			_scValue->setString("1.2.896");
+		} else if (BaseEngine::instance().getTargetExecutable() == FOXTAIL_1_2_902) {
+			_scValue->setString("1.2.902");
 		} else {
 			_scValue->setString("UNKNOWN");
 		}
diff --git a/engines/wintermute/base/scriptables/dcscript.h b/engines/wintermute/base/scriptables/dcscript.h
index 8047baaa68..96bea23375 100644
--- a/engines/wintermute/base/scriptables/dcscript.h
+++ b/engines/wintermute/base/scriptables/dcscript.h
@@ -111,6 +111,15 @@ typedef enum {
 	II_DEF_CONST_VAR
 } TInstruction;
 
+// operation code types
+typedef enum {
+	OPCODES_UNCHANGED = 0,
+#ifdef ENABLE_FOXTAIL
+	OPCODES_FOXTAIL_1_2_896,
+	OPCODES_FOXTAIL_1_2_902
+#endif
+} TOpcodesType;
+
 // external data types
 typedef enum {
 	TYPE_VOID = 0,
diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp
index 05934db961..09ff121d0e 100644
--- a/engines/wintermute/base/scriptables/script.cpp
+++ b/engines/wintermute/base/scriptables/script.cpp
@@ -35,9 +35,15 @@
 #include "engines/wintermute/base/gfx/base_renderer.h"
 #include "engines/wintermute/ext/externals.h"
 #include "common/memstream.h"
+
+#ifdef ENABLE_FOXTAIL
+#include "engines/wintermute/base/scriptables/script_opcodes.h"
+#endif
+
 #if EXTENDED_DEBUGGER_ENABLED
 #include "engines/wintermute/base/scriptables/debuggable/debuggable_script.h"
 #endif
+
 namespace Wintermute {
 
 IMPLEMENT_PERSISTENT(ScScript, false)
@@ -100,7 +106,7 @@ ScScript::ScScript(BaseGame *inGame, ScEngine *engine) : BaseClass(inGame) {
 	_tracingMode = false;
 
 #ifdef ENABLE_FOXTAIL
-	_needAltOpcodes = BaseEngine::instance().isFoxTail(FOXTAIL_1_2_896, FOXTAIL_LATEST_VERSION);	
+	initOpcodesType();	
 #endif
 }
 
@@ -518,8 +524,16 @@ char *ScScript::getString() {
 
 #ifdef ENABLE_FOXTAIL
 //////////////////////////////////////////////////////////////////////////
-// FoxTail 1.2.896 is using unusual opcodes table, let's map them here
-// NOTE: Those opcodes are never used at FoxTail 1.2.896.4370:
+void ScScript::initOpcodesType() {
+	_opcodesType = BaseEngine::instance().isFoxTail(FOXTAIL_1_2_896, FOXTAIL_1_2_896) ? OPCODES_FOXTAIL_1_2_896 :
+	               BaseEngine::instance().isFoxTail(FOXTAIL_1_2_902, FOXTAIL_LATEST_VERSION) ? OPCODES_FOXTAIL_1_2_902 :
+	               OPCODES_UNCHANGED;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// FoxTail 1.2.896+ is using unusual opcodes tables, let's map them here
+// NOTE: Those opcodes are never used at FoxTail 1.2.896 and 1.2.902:
 //   II_CMP_STRICT_EQ
 //   II_CMP_STRICT_NE
 //   II_DEF_CONST_VAR
@@ -531,57 +545,14 @@ uint32 ScScript::decodeAltOpcodes(uint32 inst) {
 		return (uint32)(-1);
 	}
 
-	uint32 foxtail_1_2_896_mapping[] = {
-		II_CMP_LE,
-		II_JMP,
-		II_POP_REG1,
-		II_PUSH_BOOL,
-		II_MODULO,
-		II_POP_EMPTY,
-		II_CALL_BY_EXP,
-		II_CMP_L,
-		II_PUSH_FLOAT,
-		II_NOT,
-		II_PUSH_THIS,
-		II_PUSH_BY_EXP,
-		II_PUSH_THIS_FROM_STACK,
-		II_CMP_G,
-		II_DEF_GLOB_VAR,
-		II_PUSH_STRING,
-		II_PUSH_REG1,
-		II_DEF_VAR,
-		/* unused */ (uint32)(-1),
-		II_RET_EVENT,
-		II_PUSH_VAR_REF,
-		II_CMP_NE,
-		/* unused */ II_DBG_LINE,
-		II_OR,
-		II_POP_VAR,
-		II_AND,
-		II_EXTERNAL_CALL,
-		II_CORRECT_STACK,
-		II_RET,
-		II_DIV,
-		II_PUSH_VAR,
-		II_SUB,
-		II_CALL,
-		II_CREATE_OBJECT,
-		II_MUL,
-		II_POP_BY_EXP,
-		/*unused */ (uint32)(-1),
-		II_PUSH_NULL,
-		II_JMP_FALSE,
-		II_ADD,
-		II_CMP_GE,
-		/* unused */ (uint32)(-1),
-		/* unused */ (uint32)(-1),
-		II_PUSH_INT,
-		II_CMP_EQ,
-		II_POP_THIS,
-		II_SCOPE
-	};
-
-	return foxtail_1_2_896_mapping[inst];
+	switch (_opcodesType) {
+	case OPCODES_FOXTAIL_1_2_896:
+		return foxtail_1_2_896_mapping[inst];
+	case OPCODES_FOXTAIL_1_2_902:
+		return foxtail_1_2_902_mapping[inst];
+	default:
+		return inst;
+	}
 }
 #endif
 
@@ -601,7 +572,7 @@ bool ScScript::executeInstruction() {
 	uint32 inst = getDWORD();
 
 #ifdef ENABLE_FOXTAIL
-	if (_needAltOpcodes) {
+	if (_opcodesType) {
 		inst = decodeAltOpcodes(inst);
 	}
 #endif
@@ -1394,7 +1365,7 @@ bool ScScript::persist(BasePersistenceManager *persistMgr) {
 	if (!persistMgr->getIsSaving()) {
 		_tracingMode = false;
 #ifdef ENABLE_FOXTAIL
-		_needAltOpcodes = BaseEngine::instance().isFoxTail(FOXTAIL_1_2_896, FOXTAIL_LATEST_VERSION);	
+		initOpcodesType();	
 #endif
 	}
 
diff --git a/engines/wintermute/base/scriptables/script.h b/engines/wintermute/base/scriptables/script.h
index 52afc36a47..2efdb18f0a 100644
--- a/engines/wintermute/base/scriptables/script.h
+++ b/engines/wintermute/base/scriptables/script.h
@@ -169,7 +169,8 @@ private:
 	virtual void postInstHook(uint32 inst);
 
 #ifdef ENABLE_FOXTAIL
-	bool _needAltOpcodes;
+	TOpcodesType _opcodesType;
+	void initOpcodesType();
 	uint32 decodeAltOpcodes(uint32 inst);
 #endif
 };
diff --git a/engines/wintermute/base/scriptables/script_opcodes.h b/engines/wintermute/base/scriptables/script_opcodes.h
new file mode 100644
index 0000000000..ccb024286f
--- /dev/null
+++ b/engines/wintermute/base/scriptables/script_opcodes.h
@@ -0,0 +1,136 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#ifndef WINTERMUTE_SCOPCODES_H
+#define WINTERMUTE_SCOPCODES_H
+
+namespace Wintermute {
+
+const uint32 foxtail_1_2_896_mapping[] = {
+	II_CMP_LE,
+	II_JMP,
+	II_POP_REG1,
+	II_PUSH_BOOL,
+	II_MODULO,
+	II_POP_EMPTY,
+	II_CALL_BY_EXP,
+	II_CMP_L,
+	II_PUSH_FLOAT,
+	II_NOT,
+	II_PUSH_THIS,
+	II_PUSH_BY_EXP,
+	II_PUSH_THIS_FROM_STACK,
+	II_CMP_G,
+	II_DEF_GLOB_VAR,
+	II_PUSH_STRING,
+	II_PUSH_REG1,
+	II_DEF_VAR,
+	II_PUSH_VAR_THIS,
+	II_RET_EVENT,
+	II_PUSH_VAR_REF,
+	II_CMP_NE,
+	II_DBG_LINE,
+	II_OR,
+	II_POP_VAR,
+	II_AND,
+	II_EXTERNAL_CALL,
+	II_CORRECT_STACK,
+	II_RET,
+	II_DIV,
+	II_PUSH_VAR,
+	II_SUB,
+	II_CALL,
+	II_CREATE_OBJECT,
+	II_MUL,
+	II_POP_BY_EXP,
+	II_DEF_CONST_VAR,
+	II_PUSH_NULL,
+	II_JMP_FALSE,
+	II_ADD,
+	II_CMP_GE,
+	II_CMP_STRICT_EQ,
+	II_CMP_STRICT_NE,
+	II_PUSH_INT,
+	II_CMP_EQ,
+	II_POP_THIS,
+	II_SCOPE
+};
+
+const uint32 foxtail_1_2_902_mapping[] = {
+	II_CMP_L,
+	II_CALL,
+	II_DEF_GLOB_VAR,
+	II_DBG_LINE,
+	II_JMP_FALSE,
+	II_CMP_STRICT_EQ,
+	II_PUSH_FLOAT,
+	II_CALL_BY_EXP,
+	II_MODULO,
+	II_PUSH_THIS,
+	II_CMP_GE,
+	II_PUSH_BOOL,
+	II_PUSH_VAR,
+	II_PUSH_VAR_REF,
+	II_POP_BY_EXP,
+	II_CMP_STRICT_NE,
+	II_RET_EVENT,
+	II_PUSH_BY_EXP,
+	II_CORRECT_STACK,
+	II_POP_VAR,
+	II_CMP_G,
+	II_PUSH_THIS_FROM_STACK,
+	II_JMP,
+	II_AND,
+	II_CREATE_OBJECT,
+	II_POP_REG1,
+	II_PUSH_STRING,
+	II_POP_EMPTY,
+	II_DIV,
+	II_ADD,
+	II_RET,
+	II_EXTERNAL_CALL,
+	II_NOT,
+	II_OR,
+	II_SUB,
+	II_PUSH_INT,
+	II_DEF_VAR,
+	II_SCOPE,
+	II_CMP_EQ,
+	II_MUL,
+	II_POP_THIS,
+	II_CMP_LE,
+	II_PUSH_REG1,
+	II_DEF_CONST_VAR,
+	II_PUSH_NULL,
+	II_CMP_NE,
+	II_PUSH_VAR_THIS
+};
+
+} // End of namespace Wintermute
+
+#endif
diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h
index a036b75a88..3a79771550 100644
--- a/engines/wintermute/detection_tables.h
+++ b/engines/wintermute/detection_tables.h
@@ -1071,6 +1071,26 @@ static const WMEGameDescription gameDescriptions[] = {
 	WME_WINENTRY("foxtail", "1.2.896.4371",
 		WME_ENTRY1s("data.dcp", "ca9842a6461cc7b00e63b5bc11813971", 154006242), Common::UA_UKR, ADGF_UNSTABLE, FOXTAIL_1_2_896),
 
+	// FoxTail 1.2.902.4379 (English)
+	WME_WINENTRY("foxtail", "1.2.902.4379",
+		WME_ENTRY1s("data.dcp", "a4a5458afa42ac1d90f4050b033421a4", 153987445), Common::EN_ANY, ADGF_UNSTABLE, FOXTAIL_1_2_902),
+
+	// FoxTail 1.2.902.4379 (German)
+	WME_WINENTRY("foxtail", "1.2.902.4379",
+		WME_ENTRY1s("data.dcp", "a4a5458afa42ac1d90f4050b033421a4", 153987445), Common::DE_DEU, ADGF_UNSTABLE, FOXTAIL_1_2_902),
+
+	// FoxTail 1.2.902.4379 (Polish)
+	WME_WINENTRY("foxtail", "1.2.902.4379",
+		WME_ENTRY1s("data.dcp", "a4a5458afa42ac1d90f4050b033421a4", 153987445), Common::PL_POL, ADGF_UNSTABLE, FOXTAIL_1_2_902),
+
+	// FoxTail 1.2.902.4379 (Russian)
+	WME_WINENTRY("foxtail", "1.2.902.4379",
+		WME_ENTRY1s("data.dcp", "a4a5458afa42ac1d90f4050b033421a4", 153987445), Common::RU_RUS, ADGF_UNSTABLE, FOXTAIL_1_2_902),
+
+	// FoxTail 1.2.902.4379 (Ukranian)
+	WME_WINENTRY("foxtail", "1.2.902.4379",
+		WME_ENTRY1s("data.dcp", "a4a5458afa42ac1d90f4050b033421a4", 153987445), Common::UA_UKR, ADGF_UNSTABLE, FOXTAIL_1_2_902),
+
 	// Framed (Beta)
 	WME_WINENTRY("framed", "Beta",
 		WME_ENTRY1s("data.dcp", "e7259fb36f2c6f9f28242291e0c3de98", 34690568), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, WME_1_8_11),




More information about the Scummvm-git-logs mailing list