From 83ef8e2e9d00b1a88bdac8864cdfe1d3faf1a76c Mon Sep 17 00:00:00 2001 From: icex2 Date: Mon, 3 Apr 2023 01:12:45 +0200 Subject: [PATCH] chore(iidx): Wire-up ezusb configuration in iidxhook1 and 2 Make io board type for ezusb board configurable as well as allow switching on/off additional ezusb debugging feature. --- src/main/iidxhook1/dllmain.c | 13 ++++++++++++- src/main/iidxhook2/dllmain.c | 7 ++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/iidxhook1/dllmain.c b/src/main/iidxhook1/dllmain.c index 2eadfeb..bffee17 100644 --- a/src/main/iidxhook1/dllmain.c +++ b/src/main/iidxhook1/dllmain.c @@ -27,6 +27,7 @@ #include "iidxhook-util/chart-patch.h" #include "iidxhook-util/clock.h" +#include "iidxhook-util/config-ezusb.h" #include "iidxhook-util/config-eamuse.h" #include "iidxhook-util/config-gfx.h" #include "iidxhook-util/config-misc.h" @@ -37,6 +38,7 @@ #include "iidxhook-util/settings.h" #include "iidxhook1/config-iidxhook1.h" +#include "iidxhook1/ezusb-mon.h" #include "iidxhook1/log-ezusb.h" #include "util/defs.h" @@ -123,6 +125,7 @@ my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId) { struct cconfig *config; + struct iidxhook_util_config_ezusb config_ezusb; struct iidxhook_util_config_eamuse config_eamuse; struct iidxhook_config_gfx config_gfx; struct iidxhook_config_iidxhook1 config_iidxhook1; @@ -141,6 +144,7 @@ my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId) config = cconfig_init(); + iidxhook_util_config_ezusb_init(config); iidxhook_util_config_eamuse_init(config); iidxhook_config_gfx_init(config); iidxhook_config_iidxhook1_init(config); @@ -155,6 +159,7 @@ my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId) exit(EXIT_FAILURE); } + iidxhook_util_config_ezusb_get(&config_ezusb, config); iidxhook_util_config_eamuse_get(&config_eamuse, config); iidxhook_config_gfx_get(&config_gfx, config); iidxhook_config_iidxhook1_get(&config_iidxhook1, config); @@ -234,7 +239,13 @@ my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId) iohook_push_handler(settings_hook_dispatch_irp); hook_setupapi_init(&ezusb_emu_desc_device.setupapi); - ezusb_emu_device_hook_init(ezusb_iidx_emu_msg_init()); + ezusb_emu_device_hook_init( + ezusb_iidx_emu_msg_init(config_ezusb.io_board_type)); + + if (config_ezusb.api_call_monitoring) { + ezusb_log_hook_init(); + ezusb_mon_hook_init(); + } log_info("-------------------------------------------------------------"); log_info("---------------- End iidxhook my_OpenProcess ----------------"); diff --git a/src/main/iidxhook2/dllmain.c b/src/main/iidxhook2/dllmain.c index 7927de2..c35197d 100644 --- a/src/main/iidxhook2/dllmain.c +++ b/src/main/iidxhook2/dllmain.c @@ -29,6 +29,7 @@ #include "iidxhook-util/acio.h" #include "iidxhook-util/chart-patch.h" #include "iidxhook-util/clock.h" +#include "iidxhook-util/config-ezusb.h" #include "iidxhook-util/config-eamuse.h" #include "iidxhook-util/config-gfx.h" #include "iidxhook-util/config-misc.h" @@ -121,6 +122,7 @@ my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId) { struct cconfig *config; + struct iidxhook_util_config_ezusb config_ezusb; struct iidxhook_util_config_eamuse config_eamuse; struct iidxhook_config_gfx config_gfx; struct iidxhook_config_iidxhook2 config_iidxhook2; @@ -139,6 +141,7 @@ my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId) config = cconfig_init(); + iidxhook_util_config_ezusb_init(config); iidxhook_util_config_eamuse_init(config); iidxhook_config_gfx_init(config); iidxhook_config_iidxhook2_init(config); @@ -153,6 +156,7 @@ my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId) exit(EXIT_FAILURE); } + iidxhook_util_config_ezusb_get(&config_ezusb, config); iidxhook_util_config_eamuse_get(&config_eamuse, config); iidxhook_config_gfx_get(&config_gfx, config); iidxhook_config_iidxhook2_get(&config_iidxhook2, config); @@ -228,7 +232,8 @@ my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId) iohook_push_handler(settings_hook_dispatch_irp); hook_setupapi_init(&ezusb_emu_desc_device.setupapi); - ezusb_emu_device_hook_init(ezusb_iidx_emu_msg_init()); + ezusb_emu_device_hook_init( + ezusb_iidx_emu_msg_init(config_ezusb.io_board_type)); /* Card reader emulation, same issue with hooking as IO emulation */ rs232_hook_init();