diff --git a/Module.mk b/Module.mk
index 05800ca..95bb28c 100644
--- a/Module.mk
+++ b/Module.mk
@@ -453,8 +453,6 @@ $(zipdir)/iidx-25-to-26.zip: \
dist/iidx/config.bat \
dist/iidx/gamestart-25.bat \
dist/iidx/gamestart-26.bat \
- dist/iidx/iidxhook-25.conf \
- dist/iidx/iidxhook-26.conf \
dist/iidx/launcher-25.xml \
dist/iidx/launcher-26.xml \
dist/shared/ea3-ident.xml \
diff --git a/dist/iidx/gamestart-25.bat b/dist/iidx/gamestart-25.bat
index 9d3b617..a467479 100644
--- a/dist/iidx/gamestart-25.bat
+++ b/dist/iidx/gamestart-25.bat
@@ -48,5 +48,4 @@ cd /d %CONTENT_DIR%
%BEMANITOOLS_DIR%\launcher.exe^
%BEMANITOOLS_DIR%\launcher-25.xml^
- --config %BEMANITOOLS_DIR%\iidxhook-25.conf^
%*
\ No newline at end of file
diff --git a/dist/iidx/gamestart-26.bat b/dist/iidx/gamestart-26.bat
index 0918808..508a8ec 100644
--- a/dist/iidx/gamestart-26.bat
+++ b/dist/iidx/gamestart-26.bat
@@ -48,5 +48,4 @@ cd /d %CONTENT_DIR%
%BEMANITOOLS_DIR%\launcher.exe^
%BEMANITOOLS_DIR%\launcher-26.xml^
- --config %BEMANITOOLS_DIR%\iidxhook-26.conf^
%*
\ No newline at end of file
diff --git a/dist/iidx/iidxhook-25.conf b/dist/iidx/iidxhook-25.conf
deleted file mode 100644
index f14335a..0000000
--- a/dist/iidx/iidxhook-25.conf
+++ /dev/null
@@ -1,56 +0,0 @@
-# Run the game in a framed window (requires windowed option)
-gfx.framed=false
-
-# Software limit the frame rate of the rendering loop in hz, e.g. 60 or 59.95 (0.0 = no software limit)
-gfx.frame_rate_limit=0.0
-
-# Patch the GPU device ID detection (leave empty to disable), format XXXX:YYYY, two 4 digit hex numbers (vid:pid). Examples: 1002:7146 (RV515, Radeon X1300), 1002:95C5 (RV620 LE, Radeon HD3450)
-gfx.pci_id=1002:7146
-
-# Run the game windowed
-gfx.windowed=false
-
-# Windowed width, 0 for default size
-gfx.window_width=0
-
-# Windowed height, 0 for default size
-gfx.window_height=0
-
-# Up-/downscale the back buffer's width. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding height parameter.
-gfx.scale_back_buffer_width=0
-
-# Up-/downscale the back buffer's height. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding width parameter.
-gfx.scale_back_buffer_height=0
-
-# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
-gfx.scale_back_buffer_filter=none
-
-# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
-gfx.forced_refresh_rate=-1
-
-# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
-gfx.device_adapter=-1
-
-# Disables the camera emulation
-cam.disable_emu=false
-
-# Disable camera 1. Use, i.e., if you only have one camera and want it to be mapped to camera 2 ingame.
-cam.disable_camera1=false
-
-# Disable camera 2. Use, i.e., if you have more than one camera but only want to map camera 1 ingame.
-cam.disable_camera2=false
-
-# Override camera device ID 1 detection (copy from device manager, do not escape) Leave blank to automatically detect
-cam.device_id1=
-
-# Override camera device ID 2 detection (copy from device manager, do not escape) Leave blank to automatically detect
-cam.device_id2=
-
-# Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted readers)
-io.disable_card_reader_emu=false
-
-# Disable BIO2 emulation and enable usage of real BIO2 hardware
-io.disable_bio2_emu=false
-
-# Disables the poll limiter, warning very high CPU usage may arise
-io.disable_poll_limiter=false
diff --git a/dist/iidx/iidxhook-26.conf b/dist/iidx/iidxhook-26.conf
deleted file mode 100644
index f14335a..0000000
--- a/dist/iidx/iidxhook-26.conf
+++ /dev/null
@@ -1,56 +0,0 @@
-# Run the game in a framed window (requires windowed option)
-gfx.framed=false
-
-# Software limit the frame rate of the rendering loop in hz, e.g. 60 or 59.95 (0.0 = no software limit)
-gfx.frame_rate_limit=0.0
-
-# Patch the GPU device ID detection (leave empty to disable), format XXXX:YYYY, two 4 digit hex numbers (vid:pid). Examples: 1002:7146 (RV515, Radeon X1300), 1002:95C5 (RV620 LE, Radeon HD3450)
-gfx.pci_id=1002:7146
-
-# Run the game windowed
-gfx.windowed=false
-
-# Windowed width, 0 for default size
-gfx.window_width=0
-
-# Windowed height, 0 for default size
-gfx.window_height=0
-
-# Up-/downscale the back buffer's width. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding height parameter.
-gfx.scale_back_buffer_width=0
-
-# Up-/downscale the back buffer's height. This does not change the game's rendering resolution but scales the final frame. Use this to target the native resolution of your monitor/TV, e.g. to avoid over-/underscan, bad image quality or latency caused by the monitors internal upscaler. 0 to disable this feature. Must be set in combination with the corresponding width parameter.
-gfx.scale_back_buffer_height=0
-
-# Filter type to use for up-/downscaling the back buffer. Only used if scaling feature was enabled by setting the scaling width and height parameters. Available types: none, linear, point (refer to D3DTEXTUREFILTERTYPE for explanation).
-gfx.scale_back_buffer_filter=none
-
-# Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
-gfx.forced_refresh_rate=-1
-
-# D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter
-gfx.device_adapter=-1
-
-# Disables the camera emulation
-cam.disable_emu=false
-
-# Disable camera 1. Use, i.e., if you only have one camera and want it to be mapped to camera 2 ingame.
-cam.disable_camera1=false
-
-# Disable camera 2. Use, i.e., if you have more than one camera but only want to map camera 1 ingame.
-cam.disable_camera2=false
-
-# Override camera device ID 1 detection (copy from device manager, do not escape) Leave blank to automatically detect
-cam.device_id1=
-
-# Override camera device ID 2 detection (copy from device manager, do not escape) Leave blank to automatically detect
-cam.device_id2=
-
-# Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted readers)
-io.disable_card_reader_emu=false
-
-# Disable BIO2 emulation and enable usage of real BIO2 hardware
-io.disable_bio2_emu=false
-
-# Disables the poll limiter, warning very high CPU usage may arise
-io.disable_poll_limiter=false
diff --git a/dist/iidx/launcher-25.xml b/dist/iidx/launcher-25.xml
index 7f944ae..8c7ead4 100644
--- a/dist/iidx/launcher-25.xml
+++ b/dist/iidx/launcher-25.xml
@@ -65,6 +65,57 @@
iidxhook8.dll
+
+
+
+ -1
+
+ -1
+
+ 0.0
+
+ 1002
+ 7146
+
+
+ 1
+ 1
+
+ 0
+ 0
+
+
+
+ 0
+ 0
+
+ none
+
+
+
+
+ 0
+
+
+ 0
+
+
+
+
+
+ 0
+
+
+
+
+
+
+ 0
+
+ 0
+
+ 0
+
diff --git a/dist/iidx/launcher-26.xml b/dist/iidx/launcher-26.xml
index 7f944ae..8c7ead4 100644
--- a/dist/iidx/launcher-26.xml
+++ b/dist/iidx/launcher-26.xml
@@ -65,6 +65,57 @@
iidxhook8.dll
+
+
+
+ -1
+
+ -1
+
+ 0.0
+
+ 1002
+ 7146
+
+
+ 1
+ 1
+
+ 0
+ 0
+
+
+
+ 0
+ 0
+
+ none
+
+
+
+
+ 0
+
+
+ 0
+
+
+
+
+
+ 0
+
+
+
+
+
+
+ 0
+
+ 0
+
+ 0
+
diff --git a/src/main/camhook/Module.mk b/src/main/camhook/Module.mk
index 0a6b19e..b3498c5 100644
--- a/src/main/camhook/Module.mk
+++ b/src/main/camhook/Module.mk
@@ -1,6 +1,8 @@
libs += camhook
libs_camhook := \
+ core \
+ iface-core \
hook \
hooklib \
cconfig \
diff --git a/src/main/camhook/config-cam.c b/src/main/camhook/config-cam.c
index 5be2cd7..f662491 100644
--- a/src/main/camhook/config-cam.c
+++ b/src/main/camhook/config-cam.c
@@ -1,9 +1,13 @@
#include "cconfig/cconfig-util.h"
+#include "core/config-ext.h"
+
#include "camhook/config-cam.h"
#include "iface-core/log.h"
+#include "util/str.h"
+
#define CAMHOOK_CONFIG_CAM_DISABLE_EMU_KEY "cam.disable_emu"
#define CAMHOOK_CONFIG_CAM_DEFAULT_DISABLE_EMU_VALUE false
@@ -124,3 +128,26 @@ void camhook_config_cam_get(
}
}
}
+
+void camhook_config_cam_get2(
+ const bt_core_config_t *config,
+ struct camhook_config_cam *config_cam,
+ size_t num_cams,
+ bool use_port_layout)
+{
+ char key[32];
+
+ bt_core_config_ext_bool_get(config, "camera/disable_emu", &config_cam->disable_emu);
+
+ if (use_port_layout) {
+ bt_core_config_ext_s32_get(config, "camera/port_layout", &config_cam->port_layout);
+ }
+
+ for (size_t i = 0; i < num_cams; ++i) {
+ str_format(key, sizeof(key), "camera/device_%d/disable", i);
+ bt_core_config_ext_bool_get(config, key, &config_cam->disable_camera[i]);
+
+ str_format(key, sizeof(key), "camera/device_%d/id", i);
+ bt_core_config_ext_str_get(config, key, config_cam->device_id[i], sizeof(config_cam->device_id[i]) - 1);
+ }
+}
\ No newline at end of file
diff --git a/src/main/camhook/config-cam.h b/src/main/camhook/config-cam.h
index df0ad7d..e583b34 100644
--- a/src/main/camhook/config-cam.h
+++ b/src/main/camhook/config-cam.h
@@ -5,6 +5,8 @@
#include "cconfig/cconfig.h"
+#include "iface-core/config.h"
+
#define CAMHOOK_CONFIG_CAM_MAX 2
struct camhook_config_cam {
@@ -26,4 +28,10 @@ void camhook_config_cam_get(
size_t num_cams,
bool use_port_layout);
+void camhook_config_cam_get2(
+ const bt_core_config_t *config,
+ struct camhook_config_cam *config_cam,
+ size_t num_cams,
+ bool use_port_layout);
+
#endif
\ No newline at end of file
diff --git a/src/main/iidxhook8/Module.mk b/src/main/iidxhook8/Module.mk
index ccf6423..170dcf9 100644
--- a/src/main/iidxhook8/Module.mk
+++ b/src/main/iidxhook8/Module.mk
@@ -7,6 +7,7 @@ ldflags_iidxhook8 := \
-lmf \
-lmfplat \
-lole32 \
+ -lws2_32 \
deplibs_iidxhook8 := \
avs \
@@ -34,3 +35,4 @@ libs_iidxhook8 := \
src_iidxhook8 := \
config-io.c \
dllmain.c \
+ iidxhook8.c \
diff --git a/src/main/iidxhook8/config-io.c b/src/main/iidxhook8/config-io.c
index 7aca5fa..c2374f9 100644
--- a/src/main/iidxhook8/config-io.c
+++ b/src/main/iidxhook8/config-io.c
@@ -1,5 +1,7 @@
#include "cconfig/cconfig-util.h"
+#include "core/config-ext.h"
+
#include "iface-core/log.h"
#include "iidxhook8/config-io.h"
@@ -75,3 +77,12 @@ void iidxhook8_config_io_get(
IIDXHOOK8_CONFIG_IO_DEFAULT_DISABLE_POLL_LIMITER_VALUE);
}
}
+
+void iidxhook8_config_io_get2(
+ const bt_core_config_t *config,
+ struct iidxhook8_config_io *config_io)
+{
+ bt_core_config_ext_bool_get(config, "io/disable_card_reader_emu", &config_io->disable_card_reader_emu);
+ bt_core_config_ext_bool_get(config, "io/disable_bio2_emu", &config_io->disable_bio2_emu);
+ bt_core_config_ext_bool_get(config, "io/disable_poll_limiter", &config_io->disable_poll_limiter);
+}
\ No newline at end of file
diff --git a/src/main/iidxhook8/config-io.h b/src/main/iidxhook8/config-io.h
index beaf6e4..158e4e3 100644
--- a/src/main/iidxhook8/config-io.h
+++ b/src/main/iidxhook8/config-io.h
@@ -5,6 +5,8 @@
#include "cconfig/cconfig.h"
+#include "iface-core/config.h"
+
struct iidxhook8_config_io {
bool disable_card_reader_emu;
bool disable_bio2_emu;
@@ -16,4 +18,8 @@ void iidxhook8_config_io_init(struct cconfig *config);
void iidxhook8_config_io_get(
struct iidxhook8_config_io *config_io, struct cconfig *config);
+void iidxhook8_config_io_get2(
+ const bt_core_config_t *config,
+ struct iidxhook8_config_io *config_io);
+
#endif
\ No newline at end of file
diff --git a/src/main/iidxhook8/dllmain.c b/src/main/iidxhook8/dllmain.c
index 23eb0e6..f8f6588 100644
--- a/src/main/iidxhook8/dllmain.c
+++ b/src/main/iidxhook8/dllmain.c
@@ -1,259 +1,6 @@
#include
-#include
-#include
-#include
-#include
-
-#include "cconfig/cconfig-hook.h"
-
-#include "hook/d3d9.h"
-
-#include "hooklib/acp.h"
-#include "hooklib/adapter.h"
-#include "hooklib/rs232.h"
-#include "hooklib/setupapi.h"
-
-#include "iface-core/log.h"
-#include "iface-core/thread.h"
-
-#include "iface-io/eam.h"
-#include "iface-io/iidx.h"
-
-#include "iidxhook-d3d9/bb-scale-hd.h"
-
-#include "iidxhook-util/acio.h"
-#include "iidxhook-util/config-gfx.h"
-#include "iidxhook-util/d3d9.h"
-
-#include "bio2emu-iidx/bi2a.h"
-#include "bio2emu/emu.h"
-
-#include "camhook/cam.h"
-#include "camhook/config-cam.h"
-#include "iidxhook8/config-io.h"
-
-#include "module/io-ext.h"
-#include "module/io.h"
-
-#include "sdk/module/core/log.h"
-#include "sdk/module/core/thread.h"
-#include "sdk/module/hook.h"
-
-#include "util/str.h"
-
-#define IIDXHOOK8_INFO_HEADER \
- "iidxhook for Cannon Ballers/Rootage" \
- ", build " __DATE__ " " __TIME__ ", gitrev " STRINGIFY(GITREV) "\n"
-#define IIDXHOOK8_CMD_USAGE \
- "Usage: launcher.exe -K iidxhook8.dll [options...]"
-
-static const hook_d3d9_irp_handler_t iidxhook_d3d9_handlers[] = {
- iidxhook_d3d9_bb_scale_hd_d3d9_irp_handler,
- iidxhook_util_d3d9_irp_handler,
-};
-
-static module_io_t *iidxhook_module_io_iidx;
-static module_io_t *iidxhook_module_io_eam;
-
-static void _iidxhook8_io_iidx_init(module_io_t **module)
-{
- bt_io_iidx_api_t api;
-
- module_io_ext_load_and_init(
- "iidxio.dll", "bt_module_io_iidx_api_get", module);
- module_io_api_get(*module, &api);
- bt_io_iidx_api_set(&api);
-}
-
-static void _iidxhook8_io_eam_init(module_io_t **module)
-{
- bt_io_eam_api_t api;
-
- module_io_ext_load_and_init(
- "eamio.dll", "bt_module_io_eam_api_get", module);
- module_io_api_get(*module, &api);
- bt_io_eam_api_set(&api);
-}
-
-static void
-iidxhook8_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx)
-{
- struct iidxhook_util_d3d9_config d3d9_config;
-
- iidxhook_util_d3d9_init_config(&d3d9_config);
-
- d3d9_config.windowed = config_gfx->windowed;
- d3d9_config.framed = config_gfx->framed;
- d3d9_config.override_window_width = config_gfx->window_width;
- d3d9_config.override_window_height = config_gfx->window_height;
- d3d9_config.framerate_limit = config_gfx->frame_rate_limit;
- d3d9_config.pci_vid = config_gfx->pci_id_vid;
- d3d9_config.pci_pid = config_gfx->pci_id_pid;
- d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
- d3d9_config.device_adapter = config_gfx->device_adapter;
-
- iidxhook_util_d3d9_configure(&d3d9_config);
-
- // The "old"/current scaling feature does not work with 20-26 because
- // the render engine changed and provides its own built-in scaling feature
- if (config_gfx->scale_back_buffer_width > 0 &&
- config_gfx->scale_back_buffer_height > 0) {
- iidxhook_d3d9_bb_scale_hd_init(
- config_gfx->scale_back_buffer_width,
- config_gfx->scale_back_buffer_height);
- }
-
- hook_d3d9_init(iidxhook_d3d9_handlers, lengthof(iidxhook_d3d9_handlers));
-}
-
-struct iidxhook8_config_io iidxhook8_config_io;
-struct camhook_config_cam config_cam;
-
-static struct bio2emu_port bio2_emu = {
- .port = "COM4",
- .wport = L"COM4",
- .dispatcher = bio2_emu_bi2a_dispatch_request,
-};
-
-static bool
-_iidxhook8_main_init(HMODULE game_module, const bt_core_config_t *config_)
-{
- struct cconfig *config;
-
- struct iidxhook_config_gfx config_gfx;
-
- log_info("-------------------------------------------------------------");
- log_info("--------------- Begin iidxhook dll_entry_init ---------------");
- log_info("-------------------------------------------------------------");
-
- config = cconfig_init();
-
- iidxhook_config_gfx_init(config);
- iidxhook8_config_io_init(config);
- camhook_config_cam_init(config, 2, false);
-
- if (!cconfig_hook_config_init(
- config,
- IIDXHOOK8_INFO_HEADER "\n" IIDXHOOK8_CMD_USAGE,
- CCONFIG_CMD_USAGE_OUT_DBG)) {
- cconfig_finit(config);
-
- exit(EXIT_FAILURE);
- }
-
- iidxhook_config_gfx_get(&config_gfx, config);
- iidxhook8_config_io_get(&iidxhook8_config_io, config);
- camhook_config_cam_get(&config_cam, config, 2, false);
-
- cconfig_finit(config);
-
- log_info(IIDXHOOK8_INFO_HEADER);
- log_info("Initializing iidxhook...");
-
- acp_hook_init();
- adapter_hook_init();
-
- iidxhook8_setup_d3d9_hooks(&config_gfx);
-
- /* Start up IIDXIO.DLL */
- if (!iidxhook8_config_io.disable_bio2_emu) {
- log_info("Starting IIDX IO backend");
-
- _iidxhook8_io_iidx_init(&iidxhook_module_io_iidx);
-
- if (!bt_io_iidx_init()) {
- log_fatal("Initializing IIDX IO backend failed");
- }
- }
-
- /* Start up EAMIO.DLL */
- if (!iidxhook8_config_io.disable_card_reader_emu) {
- log_misc("Initializing card reader backend");
-
- _iidxhook8_io_eam_init(&iidxhook_module_io_eam);
-
- if (!bt_io_eam_init()) {
- log_fatal("Initializing card reader backend failed");
- }
- }
-
- /* iohooks are okay, even if emu is diabled since the fake handlers won't be
- * used */
- /* Set up IO emulation hooks _after_ IO API setup to allow
- API implementations with real IO devices */
- iohook_push_handler(iidxhook_util_acio_dispatch_irp);
- iohook_push_handler(bio2emu_port_dispatch_irp);
-
- rs232_hook_init();
- rs232_hook_limit_hooks();
-
- if (!iidxhook8_config_io.disable_bio2_emu) {
- bio2emu_init();
- bio2_emu_bi2a_init(&bio2_emu, iidxhook8_config_io.disable_poll_limiter);
- }
-
- if (!iidxhook8_config_io.disable_card_reader_emu) {
- iidxhook_util_acio_init(false);
- }
-
- // camera hooks
- if (!config_cam.disable_emu) {
- camhook_init(&config_cam);
- }
-
- log_info("-------------------------------------------------------------");
- log_info("---------------- End iidxhook dll_entry_init ----------------");
- log_info("-------------------------------------------------------------");
-
- return true;
-}
-
-static void _iidxhook8_main_fini()
-{
- if (!config_cam.disable_emu) {
- camhook_fini();
- }
-
- if (!iidxhook8_config_io.disable_card_reader_emu) {
- log_misc("Shutting down card reader backend");
- bt_io_eam_fini();
-
- bt_io_eam_api_clear();
- module_io_free(&iidxhook_module_io_eam);
- }
-
- if (!iidxhook8_config_io.disable_bio2_emu) {
- log_misc("Shutting down IIDX IO backend");
- bt_io_iidx_fini();
-
- bt_io_iidx_api_clear();
- module_io_free(&iidxhook_module_io_iidx);
- }
-}
-
-void bt_module_core_log_api_set(const bt_core_log_api_t *api)
-{
- bt_core_log_api_set(api);
-}
-
-void bt_module_core_thread_api_set(const bt_core_thread_api_t *api)
-{
- bt_core_thread_api_set(api);
-}
-
-void bt_module_hook_api_get(bt_hook_api_t *api)
-{
- api->version = 1;
-
- api->v1.main_init = _iidxhook8_main_init;
- api->v1.main_fini = _iidxhook8_main_fini;
-}
-
-/**
- * Hook library CB/Rootage
- */
BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
{
return TRUE;
-}
+}
\ No newline at end of file
diff --git a/src/main/iidxhook8/iidxhook8.c b/src/main/iidxhook8/iidxhook8.c
new file mode 100644
index 0000000..64a9093
--- /dev/null
+++ b/src/main/iidxhook8/iidxhook8.c
@@ -0,0 +1,225 @@
+#define LOG_MODULE "iidxhook8"
+
+#include
+
+#include
+#include
+#include
+#include
+
+#include "hook/d3d9.h"
+
+#include "hooklib/acp.h"
+#include "hooklib/adapter.h"
+#include "hooklib/rs232.h"
+#include "hooklib/setupapi.h"
+
+#include "iface-core/config.h"
+#include "iface-core/log.h"
+#include "iface-core/thread.h"
+
+#include "iface-io/eam.h"
+#include "iface-io/iidx.h"
+
+#include "iidxhook-d3d9/bb-scale-hd.h"
+
+#include "iidxhook-util/acio.h"
+#include "iidxhook-util/config-gfx.h"
+#include "iidxhook-util/d3d9.h"
+
+#include "bio2emu-iidx/bi2a.h"
+#include "bio2emu/emu.h"
+
+#include "camhook/cam.h"
+#include "camhook/config-cam.h"
+#include "iidxhook8/config-io.h"
+
+#include "module/io-ext.h"
+#include "module/io.h"
+
+#include "sdk/module/core/config.h"
+#include "sdk/module/core/log.h"
+#include "sdk/module/core/thread.h"
+#include "sdk/module/hook.h"
+
+#include "util/str.h"
+
+static const hook_d3d9_irp_handler_t iidxhook_d3d9_handlers[] = {
+ iidxhook_d3d9_bb_scale_hd_d3d9_irp_handler,
+ iidxhook_util_d3d9_irp_handler,
+};
+
+static module_io_t *iidxhook_module_io_iidx;
+static module_io_t *iidxhook_module_io_eam;
+
+static void _iidxhook8_io_iidx_init(module_io_t **module)
+{
+ bt_io_iidx_api_t api;
+
+ module_io_ext_load_and_init(
+ "iidxio.dll", "bt_module_io_iidx_api_get", module);
+ module_io_api_get(*module, &api);
+ bt_io_iidx_api_set(&api);
+}
+
+static void _iidxhook8_io_eam_init(module_io_t **module)
+{
+ bt_io_eam_api_t api;
+
+ module_io_ext_load_and_init(
+ "eamio.dll", "bt_module_io_eam_api_get", module);
+ module_io_api_get(*module, &api);
+ bt_io_eam_api_set(&api);
+}
+
+static void
+iidxhook8_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx)
+{
+ struct iidxhook_util_d3d9_config d3d9_config;
+
+ iidxhook_util_d3d9_init_config(&d3d9_config);
+
+ d3d9_config.windowed = config_gfx->windowed;
+ d3d9_config.framed = config_gfx->framed;
+ d3d9_config.override_window_width = config_gfx->window_width;
+ d3d9_config.override_window_height = config_gfx->window_height;
+ d3d9_config.framerate_limit = config_gfx->frame_rate_limit;
+ d3d9_config.pci_vid = config_gfx->pci_id_vid;
+ d3d9_config.pci_pid = config_gfx->pci_id_pid;
+ d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
+ d3d9_config.device_adapter = config_gfx->device_adapter;
+
+ iidxhook_util_d3d9_configure(&d3d9_config);
+
+ // The "old"/current scaling feature does not work with 20-26 because
+ // the render engine changed and provides its own built-in scaling feature
+ if (config_gfx->scale_back_buffer_width > 0 &&
+ config_gfx->scale_back_buffer_height > 0) {
+ iidxhook_d3d9_bb_scale_hd_init(
+ config_gfx->scale_back_buffer_width,
+ config_gfx->scale_back_buffer_height);
+ }
+
+ hook_d3d9_init(iidxhook_d3d9_handlers, lengthof(iidxhook_d3d9_handlers));
+}
+
+struct iidxhook8_config_io iidxhook8_config_io;
+struct camhook_config_cam config_cam;
+
+static struct bio2emu_port bio2_emu = {
+ .port = "COM4",
+ .wport = L"COM4",
+ .dispatcher = bio2_emu_bi2a_dispatch_request,
+};
+
+static bool
+_iidxhook8_main_init(HMODULE game_module, const bt_core_config_t *config)
+{
+ iidxhook_config_gfx_t config_gfx;
+
+ log_info("iidxhook for Cannon Ballers and Rootage");
+ log_info("build " __DATE__ " " __TIME__ ", gitrev " STRINGIFY(GITREV));
+
+ iidxhook_util_config_gfx_get2(config, &config_gfx);
+ iidxhook8_config_io_get2(config, &iidxhook8_config_io);
+ camhook_config_cam_get2(config, &config_cam, 2, false);
+
+ acp_hook_init();
+ adapter_hook_init();
+
+ iidxhook8_setup_d3d9_hooks(&config_gfx);
+
+ /* Start up IIDXIO.DLL */
+ if (!iidxhook8_config_io.disable_bio2_emu) {
+ log_info("Starting IIDX IO backend");
+
+ _iidxhook8_io_iidx_init(&iidxhook_module_io_iidx);
+
+ if (!bt_io_iidx_init()) {
+ log_fatal("Initializing IIDX IO backend failed");
+ }
+ }
+
+ /* Start up EAMIO.DLL */
+ if (!iidxhook8_config_io.disable_card_reader_emu) {
+ log_misc("Initializing card reader backend");
+
+ _iidxhook8_io_eam_init(&iidxhook_module_io_eam);
+
+ if (!bt_io_eam_init()) {
+ log_fatal("Initializing card reader backend failed");
+ }
+ }
+
+ /* iohooks are okay, even if emu is diabled since the fake handlers won't be
+ * used */
+ /* Set up IO emulation hooks _after_ IO API setup to allow
+ API implementations with real IO devices */
+ iohook_push_handler(iidxhook_util_acio_dispatch_irp);
+ iohook_push_handler(bio2emu_port_dispatch_irp);
+
+ rs232_hook_init();
+ rs232_hook_limit_hooks();
+
+ if (!iidxhook8_config_io.disable_bio2_emu) {
+ bio2emu_init();
+ bio2_emu_bi2a_init(&bio2_emu, iidxhook8_config_io.disable_poll_limiter);
+ }
+
+ if (!iidxhook8_config_io.disable_card_reader_emu) {
+ iidxhook_util_acio_init(false);
+ }
+
+ // camera hooks
+ if (!config_cam.disable_emu) {
+ camhook_init(&config_cam);
+ }
+
+ return true;
+}
+
+static void _iidxhook8_main_fini()
+{
+ if (!config_cam.disable_emu) {
+ camhook_fini();
+ }
+
+ if (!iidxhook8_config_io.disable_card_reader_emu) {
+ log_misc("Shutting down card reader backend");
+ bt_io_eam_fini();
+
+ bt_io_eam_api_clear();
+ module_io_free(&iidxhook_module_io_eam);
+ }
+
+ if (!iidxhook8_config_io.disable_bio2_emu) {
+ log_misc("Shutting down IIDX IO backend");
+ bt_io_iidx_fini();
+
+ bt_io_iidx_api_clear();
+ module_io_free(&iidxhook_module_io_iidx);
+ }
+}
+
+void bt_module_core_config_api_set(const bt_core_config_api_t *api)
+{
+ bt_core_config_api_set(api);
+}
+
+void bt_module_core_log_api_set(const bt_core_log_api_t *api)
+{
+ bt_core_log_api_set(api);
+}
+
+void bt_module_core_thread_api_set(const bt_core_thread_api_t *api)
+{
+ bt_core_thread_api_set(api);
+}
+
+void bt_module_hook_api_get(bt_hook_api_t *api)
+{
+ api->version = 1;
+
+ api->v1.main_init = _iidxhook8_main_init;
+ api->v1.main_fini = _iidxhook8_main_fini;
+}
diff --git a/src/main/iidxhook8/iidxhook8.def b/src/main/iidxhook8/iidxhook8.def
index 734c3d3..77cb42c 100644
--- a/src/main/iidxhook8/iidxhook8.def
+++ b/src/main/iidxhook8/iidxhook8.def
@@ -4,6 +4,7 @@ EXPORTS
DllMain@12 @1 NONAME
; Bemanitools 6 API
+ bt_module_core_config_api_set
bt_module_core_log_api_set
bt_module_core_thread_api_set
bt_module_hook_api_get
\ No newline at end of file
diff --git a/src/main/iidxhook8/iidxhook8.h b/src/main/iidxhook8/iidxhook8.h
new file mode 100644
index 0000000..17e833c
--- /dev/null
+++ b/src/main/iidxhook8/iidxhook8.h
@@ -0,0 +1,9 @@
+#ifndef IIDXHOOK8_H
+#define IIDXHOOK8_H
+
+#include "sdk/module/core/config.h"
+#include "sdk/module/core/log.h"
+#include "sdk/module/core/thread.h"
+#include "sdk/module/hook.h"
+
+#endif
\ No newline at end of file
diff --git a/src/main/iidxhook9/Module.mk b/src/main/iidxhook9/Module.mk
index 80eb9b6..863a8af 100644
--- a/src/main/iidxhook9/Module.mk
+++ b/src/main/iidxhook9/Module.mk
@@ -7,6 +7,7 @@ ldflags_iidxhook9 := \
-lmf \
-lmfplat \
-lole32 \
+ -lws2_32 \
deplibs_iidxhook9 := \
avs \
diff --git a/src/main/sdvxhook2-cn/Module.mk b/src/main/sdvxhook2-cn/Module.mk
index 0ca1e30..e186e8e 100644
--- a/src/main/sdvxhook2-cn/Module.mk
+++ b/src/main/sdvxhook2-cn/Module.mk
@@ -7,6 +7,7 @@ ldflags_sdvxhook2-cn := \
-lmf \
-lmfplat \
-lole32 \
+ -lws2_32 \
deplibs_sdvxhook2-cn := \
avs \