ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
externals.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * This file is based on WME Lite.
24  * http://dead-code.org/redir.php?target=wmelite
25  * Copyright (c) 2011 Jan Nedoma
26  */
27 
28 #include "engines/wintermute/base/base_scriptable.h"
29 #include "engines/wintermute/base/scriptables/script.h"
30 #include "engines/wintermute/base/scriptables/script_value.h"
31 #include "engines/wintermute/base/scriptables/script_stack.h"
32 
33 #ifndef WINTERMUTE_EXTERNALS_H
34 #define WINTERMUTE_EXTERNALS_H
35 
36 namespace Wintermute {
37 
38 // Implemented in their respective .cpp-files
39 bool EmulateGetURLExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
40 bool EmulateToolsExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
41 bool EmulateImgExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
42 bool EmulateShell32ExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
43 bool EmulateInstallUtilExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
44 bool EmulateDLLTestExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
45 bool EmulateKernel32ExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
46 bool EmulateHTTPConnectExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
47 bool EmulateRoutineExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
48 bool EmulateProtectExternalCalls(BaseGame *, ScStack *, ScStack *, ScScript::TExternalFunction *);
49 
50 bool EmulateExternalCall(BaseGame *inGame, ScStack *stack, ScStack *thisStack, ScScript::TExternalFunction *function) {
51 
52  if (strcmp(function->dll_name, "geturl.dll") == 0) {
53  return EmulateGetURLExternalCalls(inGame, stack, thisStack, function);
54  }
55 
56  if (strcmp(function->dll_name, "tools.dll") == 0) {
57  return EmulateToolsExternalCalls(inGame, stack, thisStack, function);
58  }
59 
60  if (strcmp(function->dll_name, "img.dll") == 0) {
61  return EmulateImgExternalCalls(inGame, stack, thisStack, function);
62  }
63 
64  if (strcmp(function->dll_name, "shell32.dll") == 0) {
65  return EmulateShell32ExternalCalls(inGame, stack, thisStack, function);
66  }
67 
68  if (strcmp(function->dll_name, "installutil.dll") == 0) {
69  return EmulateInstallUtilExternalCalls(inGame, stack, thisStack, function);
70  }
71 
72  if (strcmp(function->dll_name, "dlltest.dll") == 0) {
73  return EmulateDLLTestExternalCalls(inGame, stack, thisStack, function);
74  }
75 
76  if (strcmp(function->dll_name, "kernel32.dll") == 0) {
77  return EmulateKernel32ExternalCalls(inGame, stack, thisStack, function);
78  }
79 
80  if (strcmp(function->dll_name, "httpconnect.dll") == 0) {
81  return EmulateHTTPConnectExternalCalls(inGame, stack, thisStack, function);
82  }
83 
84  if (strcmp(function->dll_name, "routine.dll") == 0) {
85  return EmulateRoutineExternalCalls(inGame, stack, thisStack, function);
86  }
87 
88  if (strcmp(function->dll_name, "protect.dll") == 0) {
89  return EmulateProtectExternalCalls(inGame, stack, thisStack, function);
90  }
91 
92  warning("External function %s from %s library is not known by ScummVM", function->name, function->dll_name);
93  return STATUS_FAILED;
94 }
95 
96 } // End of namespace Wintermute
97 
98 #endif
void warning(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: achievements_tables.h:27