From b2e0d9f3d6afedd7428e5909b82765c261e9568e Mon Sep 17 00:00:00 2001 From: icex2 Date: Mon, 20 Mar 2023 23:52:43 +0100 Subject: [PATCH] feat(iidx19): Add back btools monitor check for iidxhook5 Provide an option for non final lincle revisions and if the "modern" monitor check is not delivering stable results on the final lincle revision, e.g. using the original "pendual lcd" monitor. --- dist/iidx/iidxhook-19.conf | 3 +++ src/main/iidxhook-util/chart-patch.h | 4 ++-- src/main/iidxhook3/dllmain.c | 4 ++-- src/main/iidxhook4-cn/dllmain.c | 4 ++-- src/main/iidxhook4/dllmain.c | 4 ++-- src/main/iidxhook5/dllmain.c | 19 +++++++++++++++++++ 6 files changed, 30 insertions(+), 8 deletions(-) diff --git a/dist/iidx/iidxhook-19.conf b/dist/iidx/iidxhook-19.conf index 3f07d94..51a5995 100755 --- a/dist/iidx/iidxhook-19.conf +++ b/dist/iidx/iidxhook-19.conf @@ -7,6 +7,9 @@ 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 diff --git a/src/main/iidxhook-util/chart-patch.h b/src/main/iidxhook-util/chart-patch.h index 84e009f..a89aafb 100644 --- a/src/main/iidxhook-util/chart-patch.h +++ b/src/main/iidxhook-util/chart-patch.h @@ -7,8 +7,8 @@ /* 9th to DD */ #define IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_9_TO_13 59.95 -/* GOLD to Resort Anthem */ -#define IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_14_TO_18_VGA 60.05 +/* GOLD to Lincle */ +#define IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_14_TO_19_VGA 60.05 /** * Install hooks to intercept chart file loading. This allows you to patch diff --git a/src/main/iidxhook3/dllmain.c b/src/main/iidxhook3/dllmain.c index 45697bd..1563161 100644 --- a/src/main/iidxhook3/dllmain.c +++ b/src/main/iidxhook3/dllmain.c @@ -95,14 +95,14 @@ iidxhook3_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx) 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_18_VGA); + 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_18_VGA); + IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_14_TO_19_VGA); iidxhook_util_chart_patch_set_refresh_rate(config_gfx->monitor_check); } diff --git a/src/main/iidxhook4-cn/dllmain.c b/src/main/iidxhook4-cn/dllmain.c index d8dc096..9475342 100644 --- a/src/main/iidxhook4-cn/dllmain.c +++ b/src/main/iidxhook4-cn/dllmain.c @@ -90,14 +90,14 @@ iidxhook4_cn_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx) 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_18_VGA); + 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_18_VGA); + IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_14_TO_19_VGA); iidxhook_util_chart_patch_set_refresh_rate(config_gfx->monitor_check); } diff --git a/src/main/iidxhook4/dllmain.c b/src/main/iidxhook4/dllmain.c index 8c291d8..e047fd7 100644 --- a/src/main/iidxhook4/dllmain.c +++ b/src/main/iidxhook4/dllmain.c @@ -80,14 +80,14 @@ iidxhook4_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx) 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_18_VGA); + 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_18_VGA); + IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_14_TO_19_VGA); iidxhook_util_chart_patch_set_refresh_rate(config_gfx->monitor_check); } diff --git a/src/main/iidxhook5/dllmain.c b/src/main/iidxhook5/dllmain.c index a533d34..e13b545 100644 --- a/src/main/iidxhook5/dllmain.c +++ b/src/main/iidxhook5/dllmain.c @@ -26,6 +26,7 @@ #include "hooklib/setupapi.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" @@ -73,6 +74,23 @@ iidxhook5_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx) 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)); @@ -150,6 +168,7 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param) 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) {