2016-07-26 23:31:47 +07:00
|
|
|
#pragma once
|
2016-07-26 15:18:32 +03:00
|
|
|
|
2016-07-30 02:03:01 +03:00
|
|
|
#include "types_meta.h" // bool
|
2016-07-26 15:18:32 +03:00
|
|
|
#include "mplugin.h" // class MPlugin
|
2016-07-26 23:31:47 +07:00
|
|
|
#include "plinfo.h" // plid_t, etc
|
2016-07-26 07:22:47 +07:00
|
|
|
|
|
|
|
// Max number of plugins we can manage. This is an arbitrary, fixed number,
|
|
|
|
// for convenience. It would probably be better to dynamically grow the
|
|
|
|
// list as needed, but we do this for now.
|
|
|
|
#define MAX_PLUGINS 50
|
2016-07-26 23:31:47 +07:00
|
|
|
|
2016-07-26 07:22:47 +07:00
|
|
|
// Width required to printf above MAX, for show() functions.
|
|
|
|
#define WIDTH_MAX_PLUGINS 2
|
|
|
|
|
|
|
|
// A list of plugins.
|
2016-07-26 15:18:32 +03:00
|
|
|
class MPluginList {
|
2016-07-26 23:31:47 +07:00
|
|
|
public:
|
|
|
|
MPluginList(const char *ifile);
|
|
|
|
|
|
|
|
MPlugin *find(int pindex); // find by index
|
|
|
|
MPlugin *find(const char *findpath); // find by pathname
|
|
|
|
MPlugin *find(plid_t id); // find by plid_t
|
|
|
|
MPlugin *find_memloc(void *memptr); // find by memory location
|
|
|
|
MPlugin *find_match(const char *prefix); // find by partial prefix match
|
|
|
|
MPlugin *find_match(MPlugin *pmatch); // find by platform_match()
|
2017-01-07 01:24:40 +03:00
|
|
|
MPlugin *find(module_handle_t handle); // find by handle
|
|
|
|
MPlugin *find_empty_slot();
|
2016-07-26 23:31:47 +07:00
|
|
|
MPlugin *add(MPlugin *padd);
|
|
|
|
|
2016-07-30 02:03:01 +03:00
|
|
|
bool found_child_plugins(int source_index) const;
|
2016-07-26 23:31:47 +07:00
|
|
|
|
2016-07-30 02:03:01 +03:00
|
|
|
bool ini_startup(void); // read inifile at startup
|
|
|
|
bool ini_refresh(void); // re-read inifile
|
|
|
|
bool cmd_addload(const char *args); // load from console command
|
2016-07-26 23:31:47 +07:00
|
|
|
MPlugin *plugin_addload(plid_t plid, const char *fname, PLUG_LOADTIME now); //load from plugin
|
|
|
|
|
2016-07-30 02:03:01 +03:00
|
|
|
bool load(void); // load the list, at startup
|
|
|
|
bool refresh(PLUG_LOADTIME now); // update from re-read inifile
|
2016-07-26 23:31:47 +07:00
|
|
|
void unpause_all(void); // unpause any paused plugins
|
|
|
|
void retry_all(PLUG_LOADTIME now); // retry any pending plugin actions
|
|
|
|
void show(int source_index = 0); // list plugins to console
|
|
|
|
void show_client(edict_t *pEntity); // list plugins to player client
|
|
|
|
void clear_source_plugin_index(int source_index);
|
|
|
|
|
|
|
|
public:
|
2017-01-07 01:24:40 +03:00
|
|
|
int max_loaded_count; // index of last used entry
|
2016-07-26 23:31:47 +07:00
|
|
|
char inifile[PATH_MAX]; // full pathname
|
|
|
|
MPlugin plist[MAX_PLUGINS]; // array of plugins
|
2016-07-26 07:22:47 +07:00
|
|
|
};
|