summaryrefslogtreecommitdiff
path: root/src/common/HPM.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-06-18 02:43:20 +0200
committerHaru <haru@dotalux.com>2015-06-19 13:01:03 +0200
commit4faa45ac7ed47d8a51068f8323405f4f3df80edb (patch)
treed64fb2c317d352758c2d1e07a236468f70e4d36c /src/common/HPM.c
parente9223da7d71f28a3b803e2283387960aeeb6d77a (diff)
downloadhercules-4faa45ac7ed47d8a51068f8323405f4f3df80edb.tar.gz
hercules-4faa45ac7ed47d8a51068f8323405f4f3df80edb.tar.bz2
hercules-4faa45ac7ed47d8a51068f8323405f4f3df80edb.tar.xz
hercules-4faa45ac7ed47d8a51068f8323405f4f3df80edb.zip
Improved info/error messages during plugin loading
- Each loaded plugin will now show a status message - If a plugin loads because of a missing symbol, an error message will be displayed, mentioning the name of the missing symbol. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/HPM.c')
-rw-r--r--src/common/HPM.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c
index 5a0fe16dc..cdd9bb769 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -252,6 +252,8 @@ struct hplugin *hplugin_load(const char* filename) {
if( HPM->load_sub )
HPM->load_sub(plugin);
+ ShowStatus("HPM: Loaded plugin '"CL_WHITE"%s"CL_RESET"' (%s).\n", plugin->info->name, plugin->info->version);
+
return plugin;
}
@@ -339,11 +341,14 @@ void hplugins_config_read(void) {
struct hplugin *plugin;
snprintf(filename, 60, "plugins/%s%s", hooking_plugin_name, DLL_EXT);
if ((plugin = HPM->load(filename))) {
- bool (*func)(bool *fr);
+ const char * (*func)(bool *fr);
bool (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID);
- if ((func = plugin_import(plugin->dll, "Hooked",bool (*)(bool *)))
+ if ((func = plugin_import(plugin->dll, "Hooked",const char * (*)(bool *)))
&& (addhook_sub = plugin_import(plugin->dll, "HPM_Plugin_AddHook",bool (*)(enum HPluginHookType, const char *, void *, unsigned int)))) {
- if (func(&HPM->force_return)) {
+ const char *failed = func(&HPM->force_return);
+ if (failed) {
+ ShowError("HPM: failed to retrieve '%s' for '"CL_WHITE"%s"CL_RESET"'!\n", failed, plugin_name);
+ } else {
HPM->hooking = true;
HPM->addhook_sub = addhook_sub;
}