[Scummvm-git-logs] scummvm master -> 7cdf0f4b583b7363056f46921cb860359ca4cbda
aquadran
noreply at scummvm.org
Sat Nov 16 05:16:40 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:
7cdf0f4b58 WINTERMUTE: Added external routine.dll implementation for "Stroke of Fate" duology
Commit: 7cdf0f4b583b7363056f46921cb860359ca4cbda
https://github.com/scummvm/scummvm/commit/7cdf0f4b583b7363056f46921cb860359ca4cbda
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2024-11-16T06:16:36+01:00
Commit Message:
WINTERMUTE: Added external routine.dll implementation for "Stroke of Fate" duology
Changed paths:
A engines/wintermute/ext/dll_routine.cpp
engines/wintermute/ext/externals.h
engines/wintermute/module.mk
diff --git a/engines/wintermute/ext/dll_routine.cpp b/engines/wintermute/ext/dll_routine.cpp
new file mode 100644
index 00000000000..c20e9083bfc
--- /dev/null
+++ b/engines/wintermute/ext/dll_routine.cpp
@@ -0,0 +1,113 @@
+/* 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/file/base_savefile_manager_file.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 EmulateRoutineExternalCalls(BaseGame *inGame, ScStack *stack, ScStack *thisStack, ScScript::TExternalFunction *function) {
+ //////////////////////////////////////////////////////////////////////////
+ // GetCaption
+ // Used to get game's window caption for "Stroke of Fate" duology
+ // Specification: external "routine.dll" cdecl string GetCaption(int)
+ // Known usage: GetCaption(Game.Hwnd)
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(function->name, "GetCaption") == 0) {
+ stack->correctParams(1);
+ /*int hwnd =*/ stack->pop()->getInt();
+
+ stack->pushString("Wintermute Engine");
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // SetCaption
+ // Used to change game's window caption for "Stroke of Fate" duology
+ // Specification: external "routine.dll" cdecl void SetCaption(int, string)
+ // Known usage: SetCaption(Game.Hwnd, <Title>)
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(function->name, "SetCaption") == 0) {
+ stack->correctParams(2);
+ /*int hwnd =*/ stack->pop()->getInt();
+ /*const char *title =*/ stack->pop()->getString();
+
+ // do nothing
+
+ stack->pushNULL();
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // GetDPI
+ // Used to get display DPI for "Stroke of Fate" duology
+ // Specification: external "routine.dll" cdecl int GetDPI()
+ // Known usage: GetDPI()
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(function->name, "GetDPI") == 0) {
+ stack->correctParams(0);
+
+ stack->pushInt(96); // standard Windows settings 96 DPI
+
+ return STATUS_OK;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // RemoveFile
+ // Used to remove screenshot files for "Stroke of Fate" duology
+ // Specification: external "routine.dll" cdecl bool RemoveFile(string)
+ // Known usage: RenameFile(oldname, newname);
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(function->name, "RemoveFile") == 0) {
+ stack->correctParams(1);
+ const char *filename = stack->pop()->getString();
+
+ bool ret = sfmFileRemove(filename);
+ stack->pushInt(ret);
+
+ return STATUS_OK;
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // RenameFile
+ // Used to rename screenshot files for "Stroke of Fate" duology
+ // Specification: external "routine.dll" cdecl bool RenameFile(string, string)
+ // Known usage: RenameFile(oldname, newname);
+ //////////////////////////////////////////////////////////////////////////
+ if (strcmp(function->name, "RenameFile") == 0) {
+ stack->correctParams(2);
+ const char *oldName = stack->pop()->getString();
+ const char *newName = stack->pop()->getString();
+
+ bool ret = sfmFileRename(oldName, newName);
+ stack->pushInt(ret);
+
+ 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 347d797e8ac..2961dfea0b2 100644
--- a/engines/wintermute/ext/externals.h
+++ b/engines/wintermute/ext/externals.h
@@ -43,6 +43,7 @@ bool EmulateInstallUtilExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript:
bool EmulateDLLTestExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
bool EmulateKernel32ExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
bool EmulateHTTPConnectExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
+bool EmulateRoutineExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
bool EmulateExternalCall(BaseGame *inGame, ScStack *stack, ScStack *thisStack, ScScript::TExternalFunction *function) {
@@ -94,6 +95,12 @@ bool EmulateExternalCall(BaseGame *inGame, ScStack *stack, ScStack *thisStack, S
}
}
+ if (strcmp(function->dll_name, "routine.dll") == 0) {
+ if (!DID_FAIL(EmulateRoutineExternalCalls(inGame, stack, thisStack, function))) {
+ return STATUS_OK;
+ }
+ }
+
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 28dcb973f48..222bb6edbb1 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_routine.o \
ext/dll_shell32.o \
ext/dll_tools.o \
ext/scene_achievements.o \
More information about the Scummvm-git-logs
mailing list