mai2: move serial hook inserters

This commit is contained in:
Hay1tsme 2023-12-04 03:28:38 -05:00
parent 9d8a38bbf7
commit ccdd07e262
2 changed files with 9 additions and 14 deletions

View File

@ -13,14 +13,13 @@
#include "hook/process.h" #include "hook/process.h"
#include "hook/table.h" #include "hook/table.h"
#include "hook/iohook.h"
#include "hooklib/dvd.h" #include "hooklib/dvd.h"
#include "hooklib/serial.h"
#include "hooklib/spike.h" #include "hooklib/spike.h"
#include "hooklib/path.h" #include "hooklib/path.h"
#include "hooklib/reg.h" #include "hooklib/reg.h"
#include "hooklib/procaddr.h" #include "hooklib/procaddr.h"
#include "hooklib/serial.h"
#include "mai2hook/config.h" #include "mai2hook/config.h"
#include "mai2hook/io4.h" #include "mai2hook/io4.h"
@ -47,14 +46,6 @@ static DWORD CALLBACK mai2_pre_startup(void)
mai2_hook_config_load(&mai2_hook_cfg, L".\\segatools.ini"); mai2_hook_config_load(&mai2_hook_cfg, L".\\segatools.ini");
HMODULE mono = LoadLibraryW(L".\\MonoBleedingEdge\\EmbedRuntime\\mono-2.0-bdwgc.dll"); // load this so we can hook it maybe
if (mono == NULL) {
dprintf("Failed to load mono-2.0-bdwgc.dll\n");
} else {
serial_hook_apply_hooks(mono);
iohook_apply_hooks(mono);
}
/* Hook Win32 APIs */ /* Hook Win32 APIs */
dvd_hook_init(&mai2_hook_cfg.dvd, mai2_hook_mod); dvd_hook_init(&mai2_hook_cfg.dvd, mai2_hook_mod);

View File

@ -3,11 +3,13 @@
#include <windows.h> #include <windows.h>
#include "hook/table.h" #include "hook/table.h"
#include "hook/iohook.h"
#include "hooklib/dll.h" #include "hooklib/dll.h"
#include "hooklib/path.h" #include "hooklib/path.h"
#include "hooklib/reg.h" #include "hooklib/reg.h"
#include "hooklib/procaddr.h" #include "hooklib/procaddr.h"
#include "hooklib/serial.h"
#include "util/dprintf.h" #include "util/dprintf.h"
@ -20,13 +22,13 @@ static HMODULE (WINAPI *next_LoadLibraryExW)(const wchar_t *name, HANDLE hFile,
static const struct hook_symbol unity_kernel32_syms[] = { static const struct hook_symbol unity_kernel32_syms[] = {
{ {
.name = "LoadLibraryW", .name = "LoadLibraryW",
.patch = my_LoadLibraryW, .patch = my_LoadLibraryW,
.link = (void **) &next_LoadLibraryW, .link = (void **) &next_LoadLibraryW,
},{ },{
.name = "LoadLibraryExW", .name = "LoadLibraryExW",
.patch = my_LoadLibraryExW, .patch = my_LoadLibraryExW,
.link = (void **) &next_LoadLibraryExW, .link = (void **) &next_LoadLibraryExW,
} }
}; };
@ -105,6 +107,8 @@ static HMODULE WINAPI my_LoadLibraryW(const wchar_t *name)
path_hook_insert_hooks(result); path_hook_insert_hooks(result);
reg_hook_insert_hooks(result); reg_hook_insert_hooks(result);
proc_addr_insert_hooks(result); proc_addr_insert_hooks(result);
serial_hook_apply_hooks(result);
iohook_apply_hooks(result);
} }
} }