diff --git a/Module.mk b/Module.mk
index f77964c..e67e75e 100644
--- a/Module.mk
+++ b/Module.mk
@@ -667,7 +667,6 @@ $(zipdir)/sdvx-05-cn.zip: \
build/bin/indep-64/sdvxio.dll \
dist/sdvx5/config.bat \
dist/sdvx5/gamestart-cn.bat \
- dist/sdvx5/sdvxhook2-cn.conf \
dist/sdvx5/launcher-cn.xml \
dist/shared/ea3-ident.xml \
dist/shared/ea3-license.xml \
@@ -683,6 +682,7 @@ $(zipdir)/sdvx-hwio-x86.zip: \
build/bin/indep-32/sdvxio-bio2.dll \
build/bin/indep-32/vigem-sdvxio.exe \
dist/sdvx/eamio-icca.xml \
+ dist/sdvx/sdvxio-bio2.xml \
| $(zipdir)/
$(V)echo ... $@
$(V)zip -j $@ $^
@@ -694,6 +694,7 @@ $(zipdir)/sdvx-hwio-x64.zip: \
build/bin/indep-64/sdvxio-bio2.dll \
build/bin/indep-64/vigem-sdvxio.exe \
dist/sdvx/eamio-icca.xml \
+ dist/sdvx/sdvxio-bio2.xml \
| $(zipdir)/
$(V)echo ... $@
$(V)zip -j $@ $^
diff --git a/dist/sdvx5/gamestart-cn.bat b/dist/sdvx5/gamestart-cn.bat
index 265fce1..bf836d3 100644
--- a/dist/sdvx5/gamestart-cn.bat
+++ b/dist/sdvx5/gamestart-cn.bat
@@ -20,6 +20,18 @@ set CONTENT_DIR=%CD%\..
set BEMANITOOLS_DIR=%CONTENT_DIR%\bemanitools
set MODULES_DIR=%CONTENT_DIR%\modules
+if not exist "%BEMANITOOLS_DIR%" (
+ echo The bemanitools directory "%BEMANITOOLS_DIR%" does not exist.
+ pause
+ exit 1
+)
+
+if not exist "%MODULES_DIR%" (
+ echo The game modules directory "%MODULES_DIR%" does not exist.
+ pause
+ exit 1
+)
+
:: Keep that data vanilla, no need to copy these around anymore
:: Just add them to the env PATH so launcher can find the libs and game executable
:: Remark: This also requires admin privileges to propage correctly to launcher
@@ -31,4 +43,6 @@ set PATH=^
:: Current working dir is the game's root folder
cd /d %CONTENT_DIR%
-%BEMANITOOLS_DIR%\launcher %BEMANITOOLS_DIR%\launcher-cn.xml --config %BEMANITOOLS_DIR%\sdvxhook2-cn.conf %*
\ No newline at end of file
+%BEMANITOOLS_DIR%\launcher.exe^
+ %BEMANITOOLS_DIR%\launcher-cn.xml^
+ %*
\ No newline at end of file
diff --git a/dist/sdvx5/launcher-cn.xml b/dist/sdvx5/launcher-cn.xml
index 4ec2939..bbb1610 100644
--- a/dist/sdvx5/launcher-cn.xml
+++ b/dist/sdvx5/launcher-cn.xml
@@ -58,15 +58,63 @@
bemanitools/ea3-service.xml
-
-
- sdvxhook2-cn.dll
-
-
-
-
-
-
+
+
+ 1
+ sdvxhook2-cn.dll
+
+
+
+
+
+ -1
+
+ -1
+
+ -1
+
+
+ -1
+ -1
+
+
+
+
+ 0
+
+ 1
+
+ 0
+
+ 720
+
+ 1280
+
+ -1
+
+ -1
+
+
+
+
+ 0
+
+
+ 1
+
+
+
+
+
+
+ 0
+
+ prop/unis.xml
+
+
+
+
+
0
0
diff --git a/dist/sdvx5/sdvxhook2-cn.conf b/dist/sdvx5/sdvxhook2-cn.conf
deleted file mode 100644
index c02c139..0000000
--- a/dist/sdvx5/sdvxhook2-cn.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-# Disable IO emulation and enable usage of real KFCA hardware
-io.disable_io_emu=false
-
-# Path to unis version file under the prop.s folder
-cn.unis_path=prop/unis.xml
-
-# Run the game in a framed window (requires windowed option)
-gfx.framed=true
-
-# Run the game windowed
-gfx.windowed=false
-
-# Windowed width, -1 for default size
-gfx.window_width=720
-
-# Windowed height, -1 for default size
-gfx.window_height=1280
-
-# Disables the camera emulation
-cam.disable_emu=false
-
-# Override camera device ID detection (copy from device manager, do not escape)
-cam.device_id1=
-
diff --git a/src/main/sdvxhook2-cn/Module.mk b/src/main/sdvxhook2-cn/Module.mk
index 5e15090..9cb1d4a 100644
--- a/src/main/sdvxhook2-cn/Module.mk
+++ b/src/main/sdvxhook2-cn/Module.mk
@@ -22,7 +22,6 @@ libs_sdvxhook2-cn := \
d3d9exhook \
hook \
hooklib \
- cconfig \
util \
iface \
iface-io \
@@ -32,7 +31,8 @@ libs_sdvxhook2-cn := \
src_sdvxhook2-cn := \
acio.c \
- kfca.c \
- dllmain.c \
config-cn.c \
+ dllmain.c \
+ kfca.c \
+ sdvxhook2-cn.c \
unis-version.c \
diff --git a/src/main/sdvxhook2-cn/config-cn.c b/src/main/sdvxhook2-cn/config-cn.c
index f1233a5..1a2c99e 100644
--- a/src/main/sdvxhook2-cn/config-cn.c
+++ b/src/main/sdvxhook2-cn/config-cn.c
@@ -1,55 +1,10 @@
-#include "cconfig/cconfig-util.h"
-
-#include "iface-core/log.h"
+#include "core/config-ext.h"
#include "sdvxhook2-cn/config-cn.h"
-#define SDVXHOOK2_CN_CONFIG_DISABLE_IO_EMU_KEY "io.disable_io_emu"
-#define SDVXHOOK2_CN_CONFIG_UNIS_PATH_KEY "cn.unis_path"
-
-#define SDVXHOOK2_CN_CONFIG_DEFAULT_DISABLE_IO_EMU_VALUE false
-#define SDVXHOOK2_CN_CONFIG_DEFAULT_UNIS_PATH_VALUE "prop/unis.xml"
-
-void sdvxhook2_cn_config_init(struct cconfig *config)
-{
- cconfig_util_set_bool(
- config,
- SDVXHOOK2_CN_CONFIG_DISABLE_IO_EMU_KEY,
- SDVXHOOK2_CN_CONFIG_DEFAULT_DISABLE_IO_EMU_VALUE,
- "Disable IO emulation and enable usage of real KFCA hardware");
-
- cconfig_util_set_str(
- config,
- SDVXHOOK2_CN_CONFIG_UNIS_PATH_KEY,
- SDVXHOOK2_CN_CONFIG_DEFAULT_UNIS_PATH_VALUE,
- "Path to unis version file under the prop.s folder");
-}
-
void sdvxhook2_cn_config_get(
- struct sdvxhook2_cn_config *cn_config, struct cconfig *config)
+ const bt_core_config_t *config, sdvxhook2_cn_config_t *config_out)
{
- if (!cconfig_util_get_bool(
- config,
- SDVXHOOK2_CN_CONFIG_DISABLE_IO_EMU_KEY,
- &cn_config->disable_io_emu,
- SDVXHOOK2_CN_CONFIG_DEFAULT_DISABLE_IO_EMU_VALUE)) {
- log_warning(
- "Invalid value for key '%s' specified, fallback "
- "to default '%d'",
- SDVXHOOK2_CN_CONFIG_DISABLE_IO_EMU_KEY,
- SDVXHOOK2_CN_CONFIG_DEFAULT_DISABLE_IO_EMU_VALUE);
- }
-
- if (!cconfig_util_get_str(
- config,
- SDVXHOOK2_CN_CONFIG_UNIS_PATH_KEY,
- cn_config->unis_path,
- sizeof(cn_config->unis_path),
- SDVXHOOK2_CN_CONFIG_DEFAULT_UNIS_PATH_VALUE)) {
- log_warning(
- "Invalid value for key '%s' specified, fallback "
- "to default '%s'",
- SDVXHOOK2_CN_CONFIG_UNIS_PATH_KEY,
- SDVXHOOK2_CN_CONFIG_DEFAULT_UNIS_PATH_VALUE);
- }
+ bt_core_config_ext_bool_get(config, "io/disable_io_emu", &config_out->disable_io_emu);
+ bt_core_config_ext_str_get(config, "cn/unis_path", config_out->unis_path, sizeof(config_out->unis_path));
}
diff --git a/src/main/sdvxhook2-cn/config-cn.h b/src/main/sdvxhook2-cn/config-cn.h
index 7458b11..f7a738b 100644
--- a/src/main/sdvxhook2-cn/config-cn.h
+++ b/src/main/sdvxhook2-cn/config-cn.h
@@ -1,18 +1,16 @@
#ifndef SDVXHOOK2_CN_CONFIG_H
#define SDVXHOOK2_CN_CONFIG_H
-#include
+#include
-#include "cconfig/cconfig.h"
+#include "api/core/config.h"
-struct sdvxhook2_cn_config {
+typedef struct sdvxhook2_cn_config {
bool disable_io_emu;
char unis_path[256];
-};
-
-void sdvxhook2_cn_config_init(struct cconfig *config);
+} sdvxhook2_cn_config_t;
void sdvxhook2_cn_config_get(
- struct sdvxhook2_cn_config *cn_config, struct cconfig *config);
+ const bt_core_config_t *config, sdvxhook2_cn_config_t *config_out);
#endif
\ No newline at end of file
diff --git a/src/main/sdvxhook2-cn/dllmain.c b/src/main/sdvxhook2-cn/dllmain.c
index 94f70d3..f8f6588 100644
--- a/src/main/sdvxhook2-cn/dllmain.c
+++ b/src/main/sdvxhook2-cn/dllmain.c
@@ -1,170 +1,6 @@
#include
-#include
-#include
-#include
-#include
-
-#include "cconfig/cconfig-hook.h"
-
-#include "hooklib/acp.h"
-#include "hooklib/adapter.h"
-#include "hooklib/rs232.h"
-
-#include "iface-core/log.h"
-#include "iface-core/thread.h"
-
-#include "iface-io/sdvx.h"
-
-#include "module/io-ext.h"
-#include "module/io.h"
-
-#include "sdvxhook2-cn/acio.h"
-#include "sdvxhook2-cn/config-cn.h"
-#include "sdvxhook2-cn/unis-version.h"
-
-#include "camhook/cam.h"
-#include "camhook/config-cam.h"
-
-#include "d3d9exhook/config-gfx.h"
-#include "d3d9exhook/d3d9ex.h"
-
-#include "sdk/module/core/log.h"
-#include "sdk/module/core/thread.h"
-#include "sdk/module/hook.h"
-
-#include "util/str.h"
-
-#define SDVXHOOK2_CN_INFO_HEADER \
- "sdvxhook for VW CN" \
- ", build " __DATE__ " " __TIME__ ", gitrev " STRINGIFY(GITREV) "\n"
-#define SDVXHOOK2_CN_CMD_USAGE \
- "Usage: launcher.exe -K sdvxhook2.dll [options...]"
-
-struct sdvxhook2_cn_config config_cn;
-struct camhook_config_cam config_cam;
-struct d3d9exhook_config_gfx config_gfx;
-
-static module_io_t *_sdvxhook2_cn_module_io_sdvx;
-
-static void _sdvxhook2_cn_io_sdvx_init(module_io_t **module)
-{
- bt_io_sdvx_api_t api;
-
- module_io_ext_load_and_init(
- "sdvxio.dll", "bt_module_io_sdvx_api_get", module);
- module_io_api_get(*module, &api);
- bt_io_sdvx_api_set(&api);
-}
-
-static bool
-_sdvxhook2_cn_main_init(HMODULE game_module, const bt_core_config_t *config_)
-{
- struct cconfig *config;
-
- log_info("--- Begin sdvxhook dll_entry_init ---");
-
- config = cconfig_init();
-
- sdvxhook2_cn_config_init(config);
- d3d9exhook_config_gfx_init(config);
- camhook_config_cam_init(config, 1, false);
-
- if (!cconfig_hook_config_init(
- config,
- SDVXHOOK2_CN_INFO_HEADER "\n" SDVXHOOK2_CN_CMD_USAGE,
- CCONFIG_CMD_USAGE_OUT_STDOUT)) {
- cconfig_finit(config);
- exit(EXIT_FAILURE);
- }
-
- sdvxhook2_cn_config_get(&config_cn, config);
- camhook_config_cam_get(&config_cam, config, 1, false);
- d3d9exhook_config_gfx_get(&config_gfx, config);
-
- cconfig_finit(config);
-
- log_info(SDVXHOOK2_CN_INFO_HEADER);
- log_info("Initializing sdvxhook2-cn...");
-
- acp_hook_init();
- adapter_hook_init();
- d3d9ex_hook_init();
-
- d3d9ex_configure(&config_gfx);
-
- /* Start up sdvxio.DLL */
- if (!config_cn.disable_io_emu) {
- log_info("Starting sdvx IO backend");
-
- _sdvxhook2_cn_io_sdvx_init(&_sdvxhook2_cn_module_io_sdvx);
-
- if (!bt_io_sdvx_init()) {
- log_fatal("Initializing sdvx IO backend failed");
- }
- }
-
- /* iohooks are okay, even if emu is diabled since the fake handlers won't be
- * used */
- iohook_push_handler(ac_io_port_dispatch_irp);
-
- rs232_hook_init();
- rs232_hook_limit_hooks();
-
- if (!config_cn.disable_io_emu) {
- ac_io_port_init();
- }
-
- // camera hooks
- if (!config_cam.disable_emu) {
- camhook_init(&config_cam);
- }
-
- unis_version_hook_init(config_cn.unis_path);
-
- log_info("--- End sdvxhook dll_entry_init ---");
-
- return true;
-}
-
-static void _sdvxhook2_cn_main_fini()
-{
- if (!config_cam.disable_emu) {
- camhook_fini();
- }
-
- if (!config_cn.disable_io_emu) {
- log_misc("Shutting down sdvx IO backend");
-
- bt_io_sdvx_fini();
-
- bt_io_sdvx_api_clear();
- module_io_free(&_sdvxhook2_cn_module_io_sdvx);
- }
-}
-
-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 = _sdvxhook2_cn_main_init;
- api->v1.main_fini = _sdvxhook2_cn_main_fini;
-}
-
-/**
- * Hook library SDVX5 CN
- */
BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
{
return TRUE;
-}
+}
\ No newline at end of file
diff --git a/src/main/sdvxhook2-cn/sdvxhook2-cn.c b/src/main/sdvxhook2-cn/sdvxhook2-cn.c
new file mode 100644
index 0000000..420e77c
--- /dev/null
+++ b/src/main/sdvxhook2-cn/sdvxhook2-cn.c
@@ -0,0 +1,138 @@
+#include
+
+#include
+#include
+#include
+#include
+
+#include "hooklib/acp.h"
+#include "hooklib/adapter.h"
+#include "hooklib/rs232.h"
+
+#include "iface-core/config.h"
+#include "iface-core/log.h"
+#include "iface-core/thread.h"
+
+#include "iface-io/sdvx.h"
+
+#include "module/io-ext.h"
+#include "module/io.h"
+
+#include "sdvxhook2-cn/acio.h"
+#include "sdvxhook2-cn/config-cn.h"
+#include "sdvxhook2-cn/unis-version.h"
+
+#include "camhook/cam.h"
+#include "camhook/config-cam.h"
+
+#include "d3d9exhook/config-gfx.h"
+#include "d3d9exhook/d3d9ex.h"
+
+#include "sdk/module/core/log.h"
+#include "sdk/module/core/thread.h"
+#include "sdk/module/hook.h"
+
+#include "util/str.h"
+
+static sdvxhook2_cn_config_t _sdvxhook2_cn_config;
+static camhook_config_cam_t _sdvxhook2_cn_config_cam;
+static d3d9exhook_config_gfx_t _sdvxhook2_cn_config_gfx;
+
+static module_io_t *_sdvxhook2_cn_module_io_sdvx;
+
+static void _sdvxhook2_cn_io_sdvx_init(module_io_t **module)
+{
+ bt_io_sdvx_api_t api;
+
+ module_io_ext_load_and_init(
+ "sdvxio.dll", "bt_module_io_sdvx_api_get", module);
+ module_io_api_get(*module, &api);
+ bt_io_sdvx_api_set(&api);
+}
+
+static bool
+_sdvxhook2_cn_main_init(HMODULE game_module, const bt_core_config_t *config)
+{
+ log_info("sdvxhook for Vivid Wave CN");
+ log_info("build " __DATE__ " " __TIME__ ", gitrev " STRINGIFY(GITREV));
+
+ sdvxhook2_cn_config_get(config, &_sdvxhook2_cn_config);
+ camhook_config_cam_get(config, &_sdvxhook2_cn_config_cam, 1, false);
+ d3d9exhook_config_gfx_get(config, &_sdvxhook2_cn_config_gfx);
+
+ acp_hook_init();
+ adapter_hook_init();
+ d3d9ex_hook_init();
+
+ d3d9ex_configure(&_sdvxhook2_cn_config_gfx);
+
+ /* Start up sdvxio.DLL */
+ if (!_sdvxhook2_cn_config.disable_io_emu) {
+ log_info("Starting sdvx IO backend");
+
+ _sdvxhook2_cn_io_sdvx_init(&_sdvxhook2_cn_module_io_sdvx);
+
+ if (!bt_io_sdvx_init()) {
+ log_fatal("Initializing sdvx IO backend failed");
+ }
+ }
+
+ /* iohooks are okay, even if emu is diabled since the fake handlers won't be
+ * used */
+ iohook_push_handler(ac_io_port_dispatch_irp);
+
+ rs232_hook_init();
+ rs232_hook_limit_hooks();
+
+ if (!_sdvxhook2_cn_config.disable_io_emu) {
+ ac_io_port_init();
+ }
+
+ // camera hooks
+ if (!_sdvxhook2_cn_config_cam.disable_emu) {
+ camhook_init(&_sdvxhook2_cn_config_cam);
+ }
+
+ unis_version_hook_init(_sdvxhook2_cn_config.unis_path);
+
+ return true;
+}
+
+static void _sdvxhook2_cn_main_fini()
+{
+ if (!_sdvxhook2_cn_config_cam.disable_emu) {
+ camhook_fini();
+ }
+
+ if (!_sdvxhook2_cn_config.disable_io_emu) {
+ log_misc("Shutting down sdvx IO backend");
+
+ bt_io_sdvx_fini();
+
+ bt_io_sdvx_api_clear();
+ module_io_free(&_sdvxhook2_cn_module_io_sdvx);
+ }
+}
+
+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 = _sdvxhook2_cn_main_init;
+ api->v1.main_fini = _sdvxhook2_cn_main_fini;
+}
\ No newline at end of file
diff --git a/src/main/sdvxhook2-cn/sdvxhook2-cn.def b/src/main/sdvxhook2-cn/sdvxhook2-cn.def
index dc4610b..1db94ef 100644
--- a/src/main/sdvxhook2-cn/sdvxhook2-cn.def
+++ b/src/main/sdvxhook2-cn/sdvxhook2-cn.def
@@ -2,3 +2,9 @@ LIBRARY sdvxhook2-cn
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/sdvxhook2-cn/sdvxhook2-cn.h b/src/main/sdvxhook2-cn/sdvxhook2-cn.h
new file mode 100644
index 0000000..9aa224f
--- /dev/null
+++ b/src/main/sdvxhook2-cn/sdvxhook2-cn.h
@@ -0,0 +1,9 @@
+#ifndef SDVXHOOK2_CN_H
+#define SDVXHOOK2_CN_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/sdvxhook2/sdvxhook2.c b/src/main/sdvxhook2/sdvxhook2.c
index 40a7f74..acdd55c 100644
--- a/src/main/sdvxhook2/sdvxhook2.c
+++ b/src/main/sdvxhook2/sdvxhook2.c
@@ -175,8 +175,6 @@ _sdvxhook2_main_init(HMODULE game_module, const bt_core_config_t *config)
adapter_hook_override(_sdvxhook2_config_adapter.override_ip);
- log_info("--- End sdvxhook dll_entry_init ---");
-
return true;
}