Enable loading of r3 plugins

develop
DoctorVanGogh 2015-10-25 00:04:49 +02:00
parent daf20c16bd
commit fb4d16f477
1 changed files with 15 additions and 2 deletions

@ -272,13 +272,23 @@ bool Plugin::load(color_ostream &con)
plugin_abort_load; \ plugin_abort_load; \
return false; \ return false; \
} }
#define plugin_check_symbols(sym1,sym2) \
if (!LookupPlugin(plug, sym1) && !LookupPlugin(plug, sym2)) \
{ \
con.printerr("Plugin %s: missing symbols: %s & %s\n", name.c_str(), sym1, sym2); \
plugin_abort_load; \
return false; \
}
plugin_check_symbol("plugin_name") plugin_check_symbols("plugin_name", "name") // allow r3 plugins
plugin_check_symbol("plugin_version") plugin_check_symbols("plugin_version", "version") // allow r3 plugins
plugin_check_symbol("plugin_self") plugin_check_symbol("plugin_self")
plugin_check_symbol("plugin_init") plugin_check_symbol("plugin_init")
plugin_check_symbol("plugin_globals") plugin_check_symbol("plugin_globals")
const char ** plug_name =(const char ** ) LookupPlugin(plug, "plugin_name"); const char ** plug_name =(const char ** ) LookupPlugin(plug, "plugin_name");
if (!plug_name) // allow r3 plugin naming
plug_name = (const char ** )LookupPlugin(plug, "name");
if (name != *plug_name) if (name != *plug_name)
{ {
con.printerr("Plugin %s: name mismatch, claims to be %s\n", name.c_str(), *plug_name); con.printerr("Plugin %s: name mismatch, claims to be %s\n", name.c_str(), *plug_name);
@ -286,6 +296,9 @@ bool Plugin::load(color_ostream &con)
return false; return false;
} }
const char ** plug_version =(const char ** ) LookupPlugin(plug, "plugin_version"); const char ** plug_version =(const char ** ) LookupPlugin(plug, "plugin_version");
if (!plug_version) // allow r3 plugin version
plug_version =(const char ** ) LookupPlugin(plug, "version");
const char ** plug_git_desc_ptr = (const char**) LookupPlugin(plug, "plugin_git_description"); const char ** plug_git_desc_ptr = (const char**) LookupPlugin(plug, "plugin_git_description");
Plugin **plug_self = (Plugin**)LookupPlugin(plug, "plugin_self"); Plugin **plug_self = (Plugin**)LookupPlugin(plug, "plugin_self");
const char *dfhack_version = Version::dfhack_version(); const char *dfhack_version = Version::dfhack_version();