| 439 | #endif |
| 440 | |
| 441 | bool reshade::hooks::install(const char *name, hook::address target, hook::address replacement, bool queue_enable) |
| 442 | { |
| 443 | if (target == nullptr) |
| 444 | return false; |
| 445 | |
| 446 | assert(replacement != nullptr); |
| 447 | |
| 448 | named_hook hook = find_internal(nullptr, replacement); |
| 449 | // If the hook was already installed, make sure it was installed for the same target function |
| 450 | if (hook.installed()) |
| 451 | return target == hook.target; |
| 452 | |
| 453 | // Otherwise, set up the new hook and install it |
| 454 | hook.target = target; |
| 455 | hook.replacement = replacement; |
| 456 | |
| 457 | return install_internal(name, hook, hook_method::function_hook) && |
| 458 | (queue_enable || hook::apply_queued_actions()); // Can optionally only queue up the hooks instead of installing them right away |
| 459 | } |
| 460 | bool reshade::hooks::install(const char *name, hook::address vtable[], size_t vtable_index, hook::address replacement) |
| 461 | { |
| 462 | assert(vtable != nullptr && replacement != nullptr); |
no test coverage detected