forked from TeamTofuShop/segatools
Add option to enable/disable hook
This commit is contained in:
@ -1,6 +1,8 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
void unity_config_load(struct unity_config *cfg, const wchar_t *filename) {
|
void unity_config_load(struct unity_config *cfg, const wchar_t *filename) {
|
||||||
|
cfg->enable = GetPrivateProfileIntW(L"unity",L"enable",1,filename);
|
||||||
|
|
||||||
GetPrivateProfileStringW(
|
GetPrivateProfileStringW(
|
||||||
L"unity",
|
L"unity",
|
||||||
L"targetAssembly",
|
L"targetAssembly",
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
struct unity_config {
|
struct unity_config {
|
||||||
|
bool enable;
|
||||||
wchar_t target_assembly[MAX_PATH];
|
wchar_t target_assembly[MAX_PATH];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,6 +34,10 @@ static const struct hook_symbol unity_kernel32_syms[] = {
|
|||||||
void unity_hook_init(const struct unity_config *cfg, HINSTANCE self) {
|
void unity_hook_init(const struct unity_config *cfg, HINSTANCE self) {
|
||||||
assert(cfg != NULL);
|
assert(cfg != NULL);
|
||||||
|
|
||||||
|
if (!cfg->enable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (unity_hook_initted) {
|
if (unity_hook_initted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user