mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2026-04-18 23:57:33 -05:00
refact(iidxhook5): Use sdk-hook and support new config api
Summary: Test Plan: Summary: Test Plan:
This commit is contained in:
parent
4f97282d97
commit
baf3e5ff81
|
|
@ -374,7 +374,6 @@ $(zipdir)/iidx-19.zip: \
|
|||
build/bin/indep-32/vefxio.dll \
|
||||
dist/iidx/config.bat \
|
||||
dist/iidx/gamestart-19.bat \
|
||||
dist/iidx/iidxhook-19.conf \
|
||||
dist/iidx/launcher-19.xml \
|
||||
dist/shared/ea3-ident.xml \
|
||||
dist/shared/ea3-license.xml \
|
||||
|
|
|
|||
1
dist/iidx/gamestart-19.bat
vendored
1
dist/iidx/gamestart-19.bat
vendored
|
|
@ -48,5 +48,4 @@ cd /d %CONTENT_DIR%
|
|||
|
||||
%BEMANITOOLS_DIR%\launcher.exe^
|
||||
%BEMANITOOLS_DIR%\launcher-19.xml^
|
||||
--config %BEMANITOOLS_DIR%\iidxhook-19.conf^
|
||||
%*
|
||||
47
dist/iidx/iidxhook-19.conf
vendored
47
dist/iidx/iidxhook-19.conf
vendored
|
|
@ -1,47 +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
|
||||
|
||||
# Enable/disable software monitor check/auto timebase or set a pre-determined refresh value. -1 disables this feature. 0 enables auto detecting the current refresh rate on startup. Setting any positive value > 0 allows you to set a pre-determined refresh rate (e.g. retrieved from the monitor check on newer IIDX games). Either the auto detected value or pre-determined value is used to patch any chart files in-memory to fix song synchronization issues. Requires constant refresh rate!!!
|
||||
gfx.monitor_check=-1.000000
|
||||
|
||||
# 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
|
||||
|
||||
# Fix diagonal tearing with video cards other than Radeon X1300 and HD3450
|
||||
gfx.diagonal_tearing_fix=false
|
||||
|
||||
# Disable card reader emulation and enable usage of real card reader hardware on COM1 (for games supporting slotted/wavepass readers)
|
||||
io.disable_card_reader_emu=false
|
||||
|
||||
# Disable ezusb IO emulation and enable usage of real ezusb1/2 IO hardware
|
||||
io.disable_io_emu=false
|
||||
|
||||
# Path to store the settings, e.g. bookkeeping, operator settings. d:, e: and f: drive configuration/settings data
|
||||
misc.settings_path=.\
|
||||
41
dist/iidx/launcher-19.xml
vendored
41
dist/iidx/launcher-19.xml
vendored
|
|
@ -68,6 +68,47 @@
|
|||
<path __type="str">iidxhook5.dll</path>
|
||||
<config kind="inline">
|
||||
<hook>
|
||||
<gfx>
|
||||
<device>
|
||||
<!-- D3D9 device adapter (monitor), -1 to use default, 0, 1, 2 etc. to use specified adapter -->
|
||||
<adapter __type="s8">-1</adapter>
|
||||
<!-- Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors) -->
|
||||
<forced_refresh_rate __type="s16">-1</forced_refresh_rate>
|
||||
<!-- Software limit the frame rate of the rendering loop in hz, e.g. 60 or 59.95 (0.0 = no software limit) -->
|
||||
<frame_rate_limit __type="float">0.0</frame_rate_limit>
|
||||
<!-- 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) -->
|
||||
<pci_id_vid __type="str">1002</pci_id_vid>
|
||||
<pci_id_pid __type="str">7146</pci_id_pid>
|
||||
</device>
|
||||
<window>
|
||||
<windowed __type="bool">1</windowed>
|
||||
<framed __type="bool">1</framed>
|
||||
<!-- Windowed height, 0 for default size -->
|
||||
<width __type="u16">0</width>
|
||||
<height __type="u16">0</height>
|
||||
</window>
|
||||
<back_buffer_scale>
|
||||
<!-- 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. -->
|
||||
<width __type="u16">0</width>
|
||||
<height __type="u16">0</height>
|
||||
<!-- 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). -->
|
||||
<filter __type="str">none</filter>
|
||||
</back_buffer_scale>
|
||||
<game>
|
||||
<!-- Enable/disable software monitor check/auto timebase or set a pre-determined refresh value. -1 disables this feature. 0 enables auto detecting the current refresh rate on startup. Setting any positive value > 0 allows you to set a pre-determined refresh rate (e.g. retrieved from the monitor check on newer IIDX games). Either the auto detected value or pre-determined value is used to patch any chart files in-memory to fix song synchronization issues. Requires constant refresh rate!!! -->
|
||||
<monitor_check __type="float">-1.000000</monitor_check>
|
||||
<!-- Fix diagonal tearing with video cards other than Radeon X1300 and HD3450 -->
|
||||
<diagonal_tearing_fix __type="bool">0</diagonal_tearing_fix>
|
||||
</game>
|
||||
</gfx>
|
||||
<io>
|
||||
<disable_card_reader_emu __type="bool">0</disable_card_reader_emu>
|
||||
<disable_io_emu __type="bool">0</disable_io_emu>
|
||||
</io>
|
||||
<misc>
|
||||
<!-- Path to store the settings, e.g. bookkeeping, operator settings. d:, e: and f: drive configuration/settings data -->
|
||||
<settings_path __type="str">.\</settings_path>
|
||||
</misc>
|
||||
</hook>
|
||||
</config>
|
||||
</hook>
|
||||
|
|
|
|||
|
|
@ -32,4 +32,5 @@ libs_iidxhook5 := \
|
|||
|
||||
src_iidxhook5 := \
|
||||
dllmain.c \
|
||||
iidxhook5.c \
|
||||
ifs-snd-redir.c \
|
||||
|
|
|
|||
|
|
@ -1,270 +1,6 @@
|
|||
#include <windows.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "cconfig/cconfig-hook.h"
|
||||
|
||||
#include "ezusb-iidx-emu/nodes.h"
|
||||
|
||||
#include "ezusb2-emu/desc.h"
|
||||
#include "ezusb2-emu/device.h"
|
||||
|
||||
#include "ezusb2-iidx-emu/msg.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-util/acio.h"
|
||||
#include "iidxhook-util/chart-patch.h"
|
||||
#include "iidxhook-util/config-gfx.h"
|
||||
#include "iidxhook-util/config-io.h"
|
||||
#include "iidxhook-util/config-misc.h"
|
||||
#include "iidxhook-util/d3d9.h"
|
||||
#include "iidxhook-util/settings.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"
|
||||
|
||||
#include "ifs-snd-redir.h"
|
||||
|
||||
#define IIDXHOOK5_INFO_HEADER \
|
||||
"iidxhook for Lincle" \
|
||||
", build " __DATE__ " " __TIME__ ", gitrev " STRINGIFY(GITREV)
|
||||
#define IIDXHOOK5_CMD_USAGE \
|
||||
"Usage: launcher.exe -K iidxhook5.dll <bm2dx.dll> [options...]"
|
||||
|
||||
static const hook_d3d9_irp_handler_t iidxhook_d3d9_handlers[] = {
|
||||
iidxhook_util_d3d9_irp_handler,
|
||||
};
|
||||
|
||||
static struct iidxhook_config_io config_io;
|
||||
static module_io_t *iidxhook_module_io_iidx;
|
||||
static module_io_t *iidxhook_module_io_eam;
|
||||
|
||||
static void _iidxhook5_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 _iidxhook5_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
|
||||
iidxhook5_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.scale_back_buffer_width = config_gfx->scale_back_buffer_width;
|
||||
d3d9_config.scale_back_buffer_height = config_gfx->scale_back_buffer_height;
|
||||
d3d9_config.scale_back_buffer_filter = config_gfx->scale_back_buffer_filter;
|
||||
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
|
||||
d3d9_config.device_adapter = config_gfx->device_adapter;
|
||||
d3d9_config.iidx14_to_19_nvidia_fix = true;
|
||||
d3d9_config.iidx18_and_19_diagonal_tearing_fix =
|
||||
config_gfx->diagonal_tearing_fix;
|
||||
|
||||
if (config_gfx->monitor_check == 0) {
|
||||
log_info("Auto monitor check enabled");
|
||||
|
||||
d3d9_config.iidx09_to_19_monitor_check_cb =
|
||||
iidxhook_util_chart_patch_set_refresh_rate;
|
||||
iidxhook_util_chart_patch_init(
|
||||
IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_14_TO_19_VGA);
|
||||
} else if (config_gfx->monitor_check > 0) {
|
||||
log_info(
|
||||
"Manual monitor check, resulting refresh rate: %f",
|
||||
config_gfx->monitor_check);
|
||||
|
||||
iidxhook_util_chart_patch_init(
|
||||
IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_14_TO_19_VGA);
|
||||
iidxhook_util_chart_patch_set_refresh_rate(config_gfx->monitor_check);
|
||||
}
|
||||
|
||||
iidxhook_util_d3d9_configure(&d3d9_config);
|
||||
|
||||
hook_d3d9_init(iidxhook_d3d9_handlers, lengthof(iidxhook_d3d9_handlers));
|
||||
}
|
||||
|
||||
static bool
|
||||
_iidxhook5_main_init(HMODULE game_module, const bt_core_config_t *config_)
|
||||
{
|
||||
struct cconfig *config;
|
||||
|
||||
struct iidxhook_config_gfx config_gfx;
|
||||
struct iidxhook_config_misc config_misc;
|
||||
|
||||
log_info("-------------------------------------------------------------");
|
||||
log_info("--------------- Begin iidxhook dll_entry_init ---------------");
|
||||
log_info("-------------------------------------------------------------");
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_gfx_init(config);
|
||||
iidxhook_config_io_init(config);
|
||||
iidxhook_config_misc_init(config);
|
||||
|
||||
if (!cconfig_hook_config_init(
|
||||
config,
|
||||
IIDXHOOK5_INFO_HEADER "\n" IIDXHOOK5_CMD_USAGE,
|
||||
CCONFIG_CMD_USAGE_OUT_DBG)) {
|
||||
cconfig_finit(config);
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
iidxhook_config_gfx_get(&config_gfx, config);
|
||||
iidxhook_config_io_get(&config_io, config);
|
||||
iidxhook_config_misc_get(&config_misc, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
log_info(IIDXHOOK5_INFO_HEADER);
|
||||
log_info("Initializing iidxhook...");
|
||||
|
||||
acp_hook_init();
|
||||
adapter_hook_init();
|
||||
settings_hook_init();
|
||||
|
||||
iidxhook5_setup_d3d9_hooks(&config_gfx);
|
||||
|
||||
if (strlen(config_misc.settings_path) > 0) {
|
||||
settings_hook_set_path(config_misc.settings_path);
|
||||
}
|
||||
|
||||
if (!config_io.disable_io_emu) {
|
||||
log_info("Starting IIDX IO backend");
|
||||
|
||||
_iidxhook5_io_iidx_init(&iidxhook_module_io_iidx);
|
||||
|
||||
if (!bt_io_iidx_init()) {
|
||||
log_fatal("Initializing IIDX IO backend failed");
|
||||
}
|
||||
} else {
|
||||
log_info("IIDX IO emulation backend disabled");
|
||||
}
|
||||
|
||||
if (!config_io.disable_card_reader_emu) {
|
||||
log_misc("Initializing card reader backend");
|
||||
|
||||
_iidxhook5_io_eam_init(&iidxhook_module_io_eam);
|
||||
|
||||
if (!bt_io_eam_init()) {
|
||||
log_fatal("Initializing card reader backend failed");
|
||||
}
|
||||
} else {
|
||||
log_info("Card reader emulation backend disabled");
|
||||
}
|
||||
|
||||
/* Set up IO emulation hooks _after_ IO API setup to allow
|
||||
API implementations with real IO devices */
|
||||
iohook_push_handler(ezusb2_emu_device_dispatch_irp);
|
||||
iohook_push_handler(iidxhook_util_acio_dispatch_irp);
|
||||
iohook_push_handler(iidxhook_util_chart_patch_dispatch_irp);
|
||||
iohook_push_handler(settings_hook_dispatch_irp);
|
||||
|
||||
if (!config_io.disable_io_emu) {
|
||||
hook_setupapi_init(&ezusb2_emu_desc_device.setupapi);
|
||||
ezusb2_emu_device_hook_init(ezusb2_iidx_emu_msg_init());
|
||||
}
|
||||
|
||||
iidxhook5_ifs_snd_redir_init();
|
||||
|
||||
/* Card reader emulation, same issue with hooking as IO emulation */
|
||||
rs232_hook_init();
|
||||
|
||||
if (!config_io.disable_card_reader_emu) {
|
||||
/* Do not use legacy mode, first version with wave pass readers */
|
||||
iidxhook_util_acio_init(false);
|
||||
}
|
||||
|
||||
log_info("-------------------------------------------------------------");
|
||||
log_info("---------------- End iidxhook dll_entry_init ----------------");
|
||||
log_info("-------------------------------------------------------------");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void _iidxhook5_main_fini()
|
||||
{
|
||||
if (!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 (!config_io.disable_io_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 = _iidxhook5_main_init;
|
||||
api->v1.main_fini = _iidxhook5_main_fini;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook library for Lincle
|
||||
*/
|
||||
BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
236
src/main/iidxhook5/iidxhook5.c
Normal file
236
src/main/iidxhook5/iidxhook5.c
Normal file
|
|
@ -0,0 +1,236 @@
|
|||
#define LOG_MODULE "iidxhook5"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ezusb-iidx-emu/nodes.h"
|
||||
|
||||
#include "ezusb2-emu/desc.h"
|
||||
#include "ezusb2-emu/device.h"
|
||||
|
||||
#include "ezusb2-iidx-emu/msg.h"
|
||||
|
||||
#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-util/acio.h"
|
||||
#include "iidxhook-util/chart-patch.h"
|
||||
#include "iidxhook-util/config-gfx.h"
|
||||
#include "iidxhook-util/config-io.h"
|
||||
#include "iidxhook-util/config-misc.h"
|
||||
#include "iidxhook-util/d3d9.h"
|
||||
#include "iidxhook-util/settings.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"
|
||||
|
||||
#include "ifs-snd-redir.h"
|
||||
|
||||
static const hook_d3d9_irp_handler_t iidxhook_d3d9_handlers[] = {
|
||||
iidxhook_util_d3d9_irp_handler,
|
||||
};
|
||||
|
||||
static struct iidxhook_config_io config_io;
|
||||
static module_io_t *iidxhook_module_io_iidx;
|
||||
static module_io_t *iidxhook_module_io_eam;
|
||||
|
||||
static void _iidxhook5_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 _iidxhook5_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
|
||||
iidxhook5_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.scale_back_buffer_width = config_gfx->scale_back_buffer_width;
|
||||
d3d9_config.scale_back_buffer_height = config_gfx->scale_back_buffer_height;
|
||||
d3d9_config.scale_back_buffer_filter = config_gfx->scale_back_buffer_filter;
|
||||
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
|
||||
d3d9_config.device_adapter = config_gfx->device_adapter;
|
||||
d3d9_config.iidx14_to_19_nvidia_fix = true;
|
||||
d3d9_config.iidx18_and_19_diagonal_tearing_fix =
|
||||
config_gfx->diagonal_tearing_fix;
|
||||
|
||||
if (config_gfx->monitor_check == 0) {
|
||||
log_info("Auto monitor check enabled");
|
||||
|
||||
d3d9_config.iidx09_to_19_monitor_check_cb =
|
||||
iidxhook_util_chart_patch_set_refresh_rate;
|
||||
iidxhook_util_chart_patch_init(
|
||||
IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_14_TO_19_VGA);
|
||||
} else if (config_gfx->monitor_check > 0) {
|
||||
log_info(
|
||||
"Manual monitor check, resulting refresh rate: %f",
|
||||
config_gfx->monitor_check);
|
||||
|
||||
iidxhook_util_chart_patch_init(
|
||||
IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_14_TO_19_VGA);
|
||||
iidxhook_util_chart_patch_set_refresh_rate(config_gfx->monitor_check);
|
||||
}
|
||||
|
||||
iidxhook_util_d3d9_configure(&d3d9_config);
|
||||
|
||||
hook_d3d9_init(iidxhook_d3d9_handlers, lengthof(iidxhook_d3d9_handlers));
|
||||
}
|
||||
|
||||
static bool
|
||||
_iidxhook5_main_init(HMODULE game_module, const bt_core_config_t *config)
|
||||
{
|
||||
iidxhook_config_gfx_t config_gfx;
|
||||
iidxhook_config_misc_t config_misc;
|
||||
|
||||
log_info("iidxhook for Lincle");
|
||||
log_info("build " __DATE__ " " __TIME__ ", gitrev " STRINGIFY(GITREV));
|
||||
|
||||
iidxhook_util_config_gfx_get2(config, &config_gfx);
|
||||
iidxhook_util_config_misc_get2(config, &config_misc);
|
||||
iidxhook_util_config_io_get2(config, &config_io);
|
||||
|
||||
acp_hook_init();
|
||||
adapter_hook_init();
|
||||
settings_hook_init();
|
||||
|
||||
iidxhook5_setup_d3d9_hooks(&config_gfx);
|
||||
|
||||
if (strlen(config_misc.settings_path) > 0) {
|
||||
settings_hook_set_path(config_misc.settings_path);
|
||||
}
|
||||
|
||||
if (!config_io.disable_io_emu) {
|
||||
log_info("Starting IIDX IO backend");
|
||||
|
||||
_iidxhook5_io_iidx_init(&iidxhook_module_io_iidx);
|
||||
|
||||
if (!bt_io_iidx_init()) {
|
||||
log_fatal("Initializing IIDX IO backend failed");
|
||||
}
|
||||
} else {
|
||||
log_info("IIDX IO emulation backend disabled");
|
||||
}
|
||||
|
||||
if (!config_io.disable_card_reader_emu) {
|
||||
log_misc("Initializing card reader backend");
|
||||
|
||||
_iidxhook5_io_eam_init(&iidxhook_module_io_eam);
|
||||
|
||||
if (!bt_io_eam_init()) {
|
||||
log_fatal("Initializing card reader backend failed");
|
||||
}
|
||||
} else {
|
||||
log_info("Card reader emulation backend disabled");
|
||||
}
|
||||
|
||||
/* Set up IO emulation hooks _after_ IO API setup to allow
|
||||
API implementations with real IO devices */
|
||||
iohook_push_handler(ezusb2_emu_device_dispatch_irp);
|
||||
iohook_push_handler(iidxhook_util_acio_dispatch_irp);
|
||||
iohook_push_handler(iidxhook_util_chart_patch_dispatch_irp);
|
||||
iohook_push_handler(settings_hook_dispatch_irp);
|
||||
|
||||
if (!config_io.disable_io_emu) {
|
||||
hook_setupapi_init(&ezusb2_emu_desc_device.setupapi);
|
||||
ezusb2_emu_device_hook_init(ezusb2_iidx_emu_msg_init());
|
||||
}
|
||||
|
||||
iidxhook5_ifs_snd_redir_init();
|
||||
|
||||
/* Card reader emulation, same issue with hooking as IO emulation */
|
||||
rs232_hook_init();
|
||||
|
||||
if (!config_io.disable_card_reader_emu) {
|
||||
/* Do not use legacy mode, first version with wave pass readers */
|
||||
iidxhook_util_acio_init(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void _iidxhook5_main_fini()
|
||||
{
|
||||
if (!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 (!config_io.disable_io_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 = _iidxhook5_main_init;
|
||||
api->v1.main_fini = _iidxhook5_main_fini;
|
||||
}
|
||||
|
|
@ -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
|
||||
9
src/main/iidxhook5/iidxhook5.h
Normal file
9
src/main/iidxhook5/iidxhook5.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef IIDXHOOK5_H
|
||||
#define IIDXHOOK5_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
|
||||
Loading…
Reference in New Issue
Block a user