Implement function "HasHookCallHook(wups_loader_hook_type_t hook_type)" which returns true when a plugin exists that has implemented the given hook

This commit is contained in:
Maschell 2019-03-01 19:20:32 +01:00
parent 492571207d
commit e647925e50
2 changed files with 16 additions and 0 deletions

View File

@ -32,6 +32,21 @@ extern "C" {
} }
#endif #endif
bool HasHookCallHook(wups_loader_hook_type_t hook_type) {
for(int32_t plugin_index=0; plugin_index<gbl_replacement_data.number_used_plugins; plugin_index++) {
replacement_data_plugin_t * plugin_data = &gbl_replacement_data.plugin_data[plugin_index];
for(int32_t j=0; j<plugin_data->number_used_hooks; j++) {
replacement_data_hook_t * hook_data = &plugin_data->hooks[j];
if(hook_data->type == hook_type) {
return true;
}
}
}
return false;
}
void CallHookEx(wups_loader_hook_type_t hook_type, int32_t plugin_index_needed) { void CallHookEx(wups_loader_hook_type_t hook_type, int32_t plugin_index_needed) {
for(int32_t plugin_index=0; plugin_index<gbl_replacement_data.number_used_plugins; plugin_index++) { for(int32_t plugin_index=0; plugin_index<gbl_replacement_data.number_used_plugins; plugin_index++) {
replacement_data_plugin_t * plugin_data = &gbl_replacement_data.plugin_data[plugin_index]; replacement_data_plugin_t * plugin_data = &gbl_replacement_data.plugin_data[plugin_index];

View File

@ -9,6 +9,7 @@ extern "C" {
#include <wups.h> #include <wups.h>
#include <stddef.h> #include <stddef.h>
bool HasHookCallHook(wups_loader_hook_type_t hook_type);
void CallHook(wups_loader_hook_type_t hook_type); void CallHook(wups_loader_hook_type_t hook_type);
void CallHookEx(wups_loader_hook_type_t hook_type, int32_t plugin_index_needed); void CallHookEx(wups_loader_hook_type_t hook_type, int32_t plugin_index_needed);