ScummVM API documentation
plugin_engine.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 //
24 // Plugin system functions.
25 //
26 //=============================================================================
27 
28 #ifndef AGS_ENGINE_PLUGIN_PLUGIN_ENGINE_H
29 #define AGS_ENGINE_PLUGIN_PLUGIN_ENGINE_H
30 
31 #include "common/std/vector.h"
32 #include "ags/engine/ac/dynobj/cc_script_object.h"
33 #include "ags/engine/game/game_init.h"
34 #include "ags/shared/game/plugin_info.h"
35 #include "ags/shared/util/string.h"
36 
37 namespace AGS3 {
38 
39 class IAGSEngine;
40 namespace AGS {
41 namespace Shared {
42 class Stream;
43 } // namespace Shared
44 } // namespace AGS
45 
46 using namespace AGS; // FIXME later
47 
48 
49 //
50 // PluginObjectReader is a managed object unserializer registered by plugin.
51 //
53  const Shared::String Type;
54  ICCObjectReader *const Reader = nullptr;
55 
57  : Type(type), Reader(reader) {}
58 };
59 
60 
61 void pl_stop_plugins();
62 void pl_startup_plugins();
63 NumberPtr pl_run_plugin_hooks(int event, NumberPtr data);
64 void pl_run_plugin_init_gfx_hooks(const char *driverName, void *data);
65 int pl_run_plugin_debug_hooks(const char *scriptfile, int linenum);
66 // Finds a plugin that wants this event, starting with pl_index;
67 // returns TRUE on success and fills its index and name;
68 // returns FALSE if no more suitable plugins found.
69 bool pl_query_next_plugin_for_event(int event, int &pl_index, Shared::String &pl_name);
70 // Runs event for a plugin identified by an index it was registered under.
71 int pl_run_plugin_hook_by_index(int pl_index, int event, int data);
72 // Runs event for a plugin identified by its name.
73 int pl_run_plugin_hook_by_name(Shared::String &pl_name, int event, int data);
74 
75 // Tries to register plugins, either by loading dynamic libraries, or getting any kind of replacement
76 Engine::GameInitError pl_register_plugins(const std::vector<Shared::PluginInfo> &infos);
77 bool pl_is_plugin_loaded(const char *pl_name);
78 
79 //returns whether _any_ plugins want a particular event
80 bool pl_any_want_hook(int event);
81 
82 void pl_set_file_handle(long data, AGS::Shared::Stream *stream);
83 void pl_clear_file_handle();
84 
85 bool RegisterPluginStubs(const char* name);
86 
87 } // namespace AGS3
88 
89 #endif
Definition: achievements_tables.h:27
Definition: vector.h:39
Definition: cc_script_object.h:121
Definition: plugin_engine.h:52
Type
Definition: log.h:33
Definition: types.h:112
Definition: error.h:153
Definition: string.h:62
Definition: stream.h:52
Definition: ags.h:40