[Scummvm-git-logs] scummvm master -> e8a1abd51c98956beb7146206ec1fb916086136e

aquadran noreply at scummvm.org
Sat Nov 16 06:17:10 UTC 2024


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:
e8a1abd51c WINTERMUTE: Added external protect.dll implementation for "Stroke of Fate: Operation Bunker".


Commit: e8a1abd51c98956beb7146206ec1fb916086136e
    https://github.com/scummvm/scummvm/commit/e8a1abd51c98956beb7146206ec1fb916086136e
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2024-11-16T07:17:06+01:00

Commit Message:
WINTERMUTE: Added external protect.dll implementation for "Stroke of Fate: Operation Bunker".

protect.dll file is not present in Steam game release

Changed paths:
  A engines/wintermute/ext/dll_protect.cpp
    engines/wintermute/ext/externals.h
    engines/wintermute/module.mk


diff --git a/engines/wintermute/ext/dll_protect.cpp b/engines/wintermute/ext/dll_protect.cpp
new file mode 100644
index 00000000000..a6db867cd8a
--- /dev/null
+++ b/engines/wintermute/ext/dll_protect.cpp
@@ -0,0 +1,118 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/base_scriptable.h"
+#include "engines/wintermute/base/scriptables/script.h"
+#include "engines/wintermute/base/scriptables/script_value.h"
+#include "engines/wintermute/base/scriptables/script_stack.h"
+
+namespace Wintermute {
+
+bool EmulateProtectExternalCalls(BaseGame *inGame, ScStack *stack, ScStack *thisStack, ScScript::TExternalFunction *function) {
+	//////////////////////////////////////////////////////////////////////////
+	// PSA_IsTrialMode
+	// Used to get if game is in trial mode for "Stroke of Fate: Operation Bunker"
+	// Specification: external "protect.dll" stdcall long PSA_IsTrialMode(membuffer);
+	// Known usage: long PSA_IsTrialMode(membuffer)
+	//////////////////////////////////////////////////////////////////////////
+	if (strcmp(function->name, "PSA_IsTrialMode") == 0) {
+		stack->correctParams(1);
+		/*void *buffer = */stack->pop()->getMemBuffer();
+
+		// do nothing
+
+		stack->pushInt(0);
+		return STATUS_OK;
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// PSA_IsDemoMode
+	// Used to get if game is in trial mode for "Stroke of Fate: Operation Bunker"
+	// Specification: external "protect.dll" stdcall long PSA_IsDemoMode(membuffer);
+	// Known usage: long PSA_IsDemoMode(membuffer)
+	//////////////////////////////////////////////////////////////////////////
+	if (strcmp(function->name, "PSA_IsDemoMode") == 0) {
+		stack->correctParams(1);
+		/*void *buffer = */stack->pop()->getMemBuffer();
+
+		// do nothing
+
+		stack->pushInt(0);
+		return STATUS_OK;
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// PSA_GetFeaturesGrantedByLicense
+	// Used to get if game features granted for "Stroke of Fate: Operation Bunker"
+	// Specification: external "protect.dll" stdcall long PSA_GetFeaturesGrantedByLicense(membuffer);
+	// Known usage: long PSA_GetFeaturesGrantedByLicense(membuffer)
+	//////////////////////////////////////////////////////////////////////////
+	if (strcmp(function->name, "PSA_GetFeaturesGrantedByLicense") == 0) {
+		stack->correctParams(1);
+		void *buffer = stack->pop()->getMemBuffer();
+
+		bool flag1 = false;
+		bool flag2 = false;
+		bool flag3 = false;
+		bool flag4 = false;
+		bool flag5 = false;
+		*(uint32 *)(buffer) = (flag1 ? (1 < 0) : 0) | (flag2 ? (1 < 1) : 0) | (flag3 ? (1 < 2) : 0) | (flag4 ? (1 < 3) : 0) | (flag5 ? (1 < 4) : 0);
+
+		stack->pushInt(0);
+		return STATUS_OK;
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// PSA_DisableFeaturesGrantedByLicense
+	// Reference in game scripts in "Stroke of Fate: Operation Bunker"
+	// Specification: external "protect.dll" stdcall long PSA_DisableFeaturesGrantedByLicense(membuffer);
+	// Known usage: none
+	//////////////////////////////////////////////////////////////////////////
+	if (strcmp(function->name, "PSA_DisableFeaturesGrantedByLicense") == 0) {
+		stack->correctParams(1);
+		/*void *buffer = */stack->pop()->getMemBuffer();
+
+		// do nothing
+
+		stack->pushInt(0);
+		return STATUS_OK;
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// PSA_DummyFunction
+	// Reference in game scripts in "Stroke of Fate: Operation Bunker"
+	// Specification: external "protect.dll" stdcall void PSA_DummyFunction;
+	// Known usage: none
+	//////////////////////////////////////////////////////////////////////////
+	if (strcmp(function->name, "PSA_DummyFunction") == 0) {
+		stack->correctParams(0);
+
+		// do nothing
+
+		stack->pushNULL();
+		return STATUS_OK;
+	}
+
+	return STATUS_FAILED;
+}
+
+} // End of namespace Wintermute
diff --git a/engines/wintermute/ext/externals.h b/engines/wintermute/ext/externals.h
index 32f25665583..de86568b30f 100644
--- a/engines/wintermute/ext/externals.h
+++ b/engines/wintermute/ext/externals.h
@@ -44,6 +44,7 @@ bool EmulateDLLTestExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TEx
 bool EmulateKernel32ExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
 bool EmulateHTTPConnectExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
 bool EmulateRoutineExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
+bool EmulateProtectExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
 
 bool EmulateExternalCall(BaseGame *inGame, ScStack *stack, ScStack *thisStack, ScScript::TExternalFunction *function) {
 
@@ -83,6 +84,10 @@ bool EmulateExternalCall(BaseGame *inGame, ScStack *stack, ScStack *thisStack, S
 		return EmulateRoutineExternalCalls(inGame, stack, thisStack, function);
 	}
 
+	if (strcmp(function->dll_name, "protect.dll") == 0) {
+		return EmulateProtectExternalCalls(inGame, stack, thisStack, function);
+	}
+
 	warning("External function %s from %s library is not known by ScummVM", function->name, function->dll_name);
 	return STATUS_FAILED;
 }
diff --git a/engines/wintermute/module.mk b/engines/wintermute/module.mk
index 222bb6edbb1..b64df887c88 100644
--- a/engines/wintermute/module.mk
+++ b/engines/wintermute/module.mk
@@ -98,6 +98,7 @@ MODULE_OBJS := \
 	ext/dll_img.o \
 	ext/dll_installutil.o \
 	ext/dll_kernel32.o \
+	ext/dll_protect.o \
 	ext/dll_routine.o \
 	ext/dll_shell32.o \
 	ext/dll_tools.o \




More information about the Scummvm-git-logs mailing list