1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
|
/* 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 "ags/lib/allegro.h"
#include "ags/plugins/plugin_base.h"
#include "ags/plugins/ags_agi/ags_agi.h"
#include "ags/plugins/ags_app_open_url/ags_app_open_url.h"
#include "ags/plugins/ags_blend/ags_blend.h"
#include "ags/plugins/ags_bm_font_renderer/ags_bm_font_renderer.h"
#include "ags/plugins/ags_clipboard/ags_clipboard.h"
#include "ags/plugins/ags_collision_detector/ags_collision_detector.h"
#include "ags/plugins/ags_consoles/ags_consoles.h"
#include "ags/plugins/ags_controller/ags_controller.h"
#include "ags/plugins/ags_controller/ags_controller_arcnor.h"
#include "ags/plugins/ags_creditz/ags_creditz1.h"
#include "ags/plugins/ags_creditz/ags_creditz2.h"
#include "ags/plugins/ags_fire/ags_fire.h"
#include "ags/plugins/ags_flashlight/ags_flashlight.h"
#include "ags/plugins/ags_galaxy_steam/ags_wadjeteye_steam.h"
#include "ags/plugins/ags_galaxy_steam/ags_galaxy_steam.h"
#include "ags/plugins/ags_joy/ags_joy.h"
#include "ags/plugins/ags_nickenstien_gfx/ags_nickenstien_gfx.h"
#include "ags/plugins/ags_pal_render/ags_pal_render.h"
#include "ags/plugins/ags_parallax/ags_parallax.h"
#include "ags/plugins/ags_shell/ags_shell.h"
#include "ags/plugins/ags_snow_rain/ags_snow_rain.h"
#include "ags/plugins/ags_sock/ags_sock.h"
#include "ags/plugins/ags_sprite_font/ags_sprite_font.h"
#include "ags/plugins/ags_sprite_font/ags_sprite_font_clifftop.h"
#include "ags/plugins/ags_sprite_video/ags_sprite_video.h"
#include "ags/plugins/ags_tcp_ip/ags_tcp_ip.h"
#include "ags/plugins/ags_touch/ags_touch.h"
#include "ags/plugins/ags_trans/ags_trans.h"
#include "ags/plugins/ags_wadjet_util/ags_wadjet_util.h"
#include "ags/plugins/ags_waves/ags_waves.h"
#include "ags/ags.h"
#include "ags/detection.h"
#include "common/str.h"
namespace AGS3 {
namespace Plugins {
Plugins::PluginBase *pluginOpen(const char *filename) {
Common::String fname(filename);
// Check for if the game specifies a specific plugin version for this game
int version = 0;
for (const ::AGS::PluginVersion *v = ::AGS::g_vm->getNeededPlugins();
v && v->_plugin; ++v) {
if (Common::String(v->_plugin).equalsIgnoreCase(filename)) {
version = v->_version;
break;
}
}
if (fname.equalsIgnoreCase("ags_tcp_ip"))
return new AGSTcpIp::AGSTcpIp();
if (fname.equalsIgnoreCase("AGS_AGI"))
return new AGSAgi::AGSAgi();
if (fname.equalsIgnoreCase("agsappopenurl"))
return new AGSAppOpenURL::AGSAppOpenURL();
if (fname.equalsIgnoreCase("AGSBlend"))
return new AGSBlend::AGSBlend();
if (fname.equalsIgnoreCase("AGSBMFontRenderer"))
return new AGSBMFontRenderer::AGSBMFontRenderer();
if (fname.equalsIgnoreCase("AGSClipboard"))
return new AGSClipboard::AGSClipboard();
if (fname.equalsIgnoreCase("AGSConsoles"))
return new AGSConsoles::AGSConsoles();
if (fname.equalsIgnoreCase("AGSController") || fname.equalsIgnoreCase("agscontrollerpulp"))
return new AGSController::AGSController();
if (fname.equalsIgnoreCase("agscontrollerplugin"))
return new AGSController::AGSControllerArcnor();
if (fname.equalsIgnoreCase("AGS_Collision_Detector"))
return new AGSCollisionDetector::AGSCollisionDetector();
if (fname.equalsIgnoreCase("agsCreditz"))
return new AGSCreditz::AGSCreditz1();
if (fname.equalsIgnoreCase("agsCreditz2"))
return new AGSCreditz::AGSCreditz2();
if (fname.equalsIgnoreCase("ags_d3d") || fname.equalsIgnoreCase("ags_spritevideo"))
return new AGSSpriteVideo::AGSSpriteVideo();
if (fname.equalsIgnoreCase("AGS_Fire"))
return new AGSFire::AGSFire();
if (fname.equalsIgnoreCase("AGSFlashlight"))
return new AGSFlashlight::AGSFlashlight();
if (fname.equalsIgnoreCase("AGSJoy"))
return new AGSJoy::AGSJoy();
if (fname.equalsIgnoreCase("AGSPalRender"))
return new AGSPalRender::AGSPalRender();
if (fname.equalsIgnoreCase("ags_parallax") ||
fname.equalsIgnoreCase("AGSParallax"))
return new AGSParallax::AGSParallax();
if (fname.equalsIgnoreCase("ags_shell") || fname.equalsIgnoreCase("agsshell"))
return new AGSShell::AGSShell();
if (fname.equalsIgnoreCase("AGSSnowRain") || fname.equalsIgnoreCase("ags_snowrain"))
return new AGSSnowRain::AGSSnowRain();
if (fname.equalsIgnoreCase("AGSSock"))
return new AGSSock::AGSSock();
if (fname.equalsIgnoreCase("AGSSpriteFont") || fname.equalsIgnoreCase("agsplugin.spritefont")) {
if (version == ::AGS::kClifftopGames)
return new AGSSpriteFont::AGSSpriteFontClifftopGames();
return new AGSSpriteFont::AGSSpriteFont();
}
if (fname.equalsIgnoreCase("agsgalaxy") || fname.equalsIgnoreCase("agsgalaxy-unified") ||
fname.equalsIgnoreCase("agsgalaxy-disjoint"))
return new AGSGalaxySteam::AGSGalaxy();
if (fname.equalsIgnoreCase("ags_Nickenstien_GFX"))
return new AGSNickenstienGFX::AGSNickenstienGFX();
if (fname.equalsIgnoreCase("agsteam") && version == ::AGS::kWadjetEye)
return new AGSGalaxySteam::AGSWadjetEyeSteam();
if (fname.equalsIgnoreCase("agsteam") || fname.equalsIgnoreCase("agsteam-unified") ||
fname.equalsIgnoreCase("agsteam-disjoint"))
return new AGSGalaxySteam::AGSSteam();
if (fname.equalsIgnoreCase("AGSTouch"))
return new AGSTouch::AGSTouch();
if (fname.equalsIgnoreCase("AGSTrans"))
return new AGSTrans::AGSTrans();
if (fname.equalsIgnoreCase("AGSWadjetUtil"))
return new AGSWadjetUtil::AGSWadjetUtil();
if (fname.equalsIgnoreCase("agswaves"))
return new AGSWaves::AGSWaves();
debug("Plugin '%s' is not yet supported", fname.c_str());
return nullptr;
}
int pluginClose(Plugins::PluginBase *lib) {
PluginBase *plugin = static_cast<PluginBase *>(lib);
delete plugin;
return 0;
}
const char *pluginError() {
return nullptr;
}
/*------------------------------------------------------------------*/
ScriptMethodParams::ScriptMethodParams() {
}
ScriptMethodParams::ScriptMethodParams(int val1) {
push_back(val1);
}
ScriptMethodParams::ScriptMethodParams(int val1, int val2) {
push_back(val1);
push_back(val2);
}
ScriptMethodParams::ScriptMethodParams(int val1, int val2, int val3) {
push_back(val1);
push_back(val2);
push_back(val3);
}
ScriptMethodParams::ScriptMethodParams(int val1, int val2, int val3, int val4) {
push_back(val1);
push_back(val2);
push_back(val3);
push_back(val4);
}
#define GET_CHAR c = format[0]; format.deleteChar(0)
Common::String ScriptMethodParams::format(int formatIndex) {
Common::String result;
Common::String format((const char *)(*this)[formatIndex]);
Common::String paramFormat;
char c;
++formatIndex;
while (!format.empty()) {
GET_CHAR;
if (c != '%') {
result += c;
} else if (format.hasPrefix("%")) {
GET_CHAR;
result += '%';
} else {
// Form up a format specifier
paramFormat = "%";
while (!format.empty()) {
GET_CHAR;
paramFormat += c;
if (Common::isAlpha(c))
break;
}
// Convert the parameter to a string. Not sure if all the
// casts are necessary, but it's better safe than sorry
// for big endian systems
switch (tolower(paramFormat.lastChar())) {
case 'c':
result += Common::String::format(paramFormat.c_str(), (char)(*this)[formatIndex]);
break;
case 's':
case 'p':
result += Common::String::format(paramFormat.c_str(), (void *)(*this)[formatIndex]);
break;
default:
result += Common::String::format(paramFormat.c_str(), (int)(*this)[formatIndex]);
break;
}
formatIndex++;
}
}
return result;
}
} // namespace Plugins
} // namespace AGS3
|