diff --git a/dist/iidx/iidxhook-09.conf b/dist/iidx/iidxhook-09.conf index c187bf3..7631ee7 100755 --- a/dist/iidx/iidxhook-09.conf +++ b/dist/iidx/iidxhook-09.conf @@ -40,6 +40,12 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 + # Disable operator clock setting system clock time misc.disable_clock_set=false diff --git a/dist/iidx/iidxhook-10.conf b/dist/iidx/iidxhook-10.conf index 0f2c9d7..3badd4e 100755 --- a/dist/iidx/iidxhook-10.conf +++ b/dist/iidx/iidxhook-10.conf @@ -40,6 +40,12 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 + # Disable operator clock setting system clock time misc.disable_clock_set=false diff --git a/dist/iidx/iidxhook-11.conf b/dist/iidx/iidxhook-11.conf index d1b81be..d776ca8 100755 --- a/dist/iidx/iidxhook-11.conf +++ b/dist/iidx/iidxhook-11.conf @@ -40,6 +40,12 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 + # Disable operator clock setting system clock time misc.disable_clock_set=false diff --git a/dist/iidx/iidxhook-12.conf b/dist/iidx/iidxhook-12.conf index cf1b441..0f0e91c 100755 --- a/dist/iidx/iidxhook-12.conf +++ b/dist/iidx/iidxhook-12.conf @@ -40,6 +40,12 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 + # Fix broken 3D background on Happy Sky's music select (if appearing completely white) misc.happy_sky_ms_bg_fix=false diff --git a/dist/iidx/iidxhook-13.conf b/dist/iidx/iidxhook-13.conf index 037ae7e..736f78f 100755 --- a/dist/iidx/iidxhook-13.conf +++ b/dist/iidx/iidxhook-13.conf @@ -40,6 +40,12 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 + # Fix broken 3D background on DistorteD's music select (if appearing completely black) misc.distorted_ms_bg_fix=false diff --git a/dist/iidx/iidxhook-14.conf b/dist/iidx/iidxhook-14.conf index 3f221cf..fc0c919 100755 --- a/dist/iidx/iidxhook-14.conf +++ b/dist/iidx/iidxhook-14.conf @@ -37,6 +37,12 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 + # Disable operator clock setting system clock time misc.disable_clock_set=false diff --git a/dist/iidx/iidxhook-15.conf b/dist/iidx/iidxhook-15.conf index 5de6b54..3a03b89 100755 --- a/dist/iidx/iidxhook-15.conf +++ b/dist/iidx/iidxhook-15.conf @@ -37,6 +37,12 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 + # Disable operator clock setting system clock time misc.disable_clock_set=false diff --git a/dist/iidx/iidxhook-16.conf b/dist/iidx/iidxhook-16.conf index a446a0b..bf3fd93 100755 --- a/dist/iidx/iidxhook-16.conf +++ b/dist/iidx/iidxhook-16.conf @@ -40,6 +40,12 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 + # Disable operator clock setting system clock time misc.disable_clock_set=false diff --git a/dist/iidx/iidxhook-17.conf b/dist/iidx/iidxhook-17.conf index 338b59a..a723edd 100755 --- a/dist/iidx/iidxhook-17.conf +++ b/dist/iidx/iidxhook-17.conf @@ -40,6 +40,12 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 + # Disable operator clock setting system clock time misc.disable_clock_set=false diff --git a/dist/iidx/iidxhook-18.conf b/dist/iidx/iidxhook-18.conf index 3a7d5b9..73ef533 100755 --- a/dist/iidx/iidxhook-18.conf +++ b/dist/iidx/iidxhook-18.conf @@ -30,3 +30,9 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 diff --git a/dist/iidx/iidxhook-19.conf b/dist/iidx/iidxhook-19.conf index 81632cb..7ce8afc 100755 --- a/dist/iidx/iidxhook-19.conf +++ b/dist/iidx/iidxhook-19.conf @@ -27,3 +27,9 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 diff --git a/dist/iidx/iidxhook-20.conf b/dist/iidx/iidxhook-20.conf index 81632cb..7ce8afc 100755 --- a/dist/iidx/iidxhook-20.conf +++ b/dist/iidx/iidxhook-20.conf @@ -27,3 +27,9 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 diff --git a/dist/iidx/iidxhook-21.conf b/dist/iidx/iidxhook-21.conf index 81632cb..7ce8afc 100755 --- a/dist/iidx/iidxhook-21.conf +++ b/dist/iidx/iidxhook-21.conf @@ -27,3 +27,9 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 diff --git a/dist/iidx/iidxhook-22.conf b/dist/iidx/iidxhook-22.conf index 81632cb..7ce8afc 100755 --- a/dist/iidx/iidxhook-22.conf +++ b/dist/iidx/iidxhook-22.conf @@ -27,3 +27,9 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 diff --git a/dist/iidx/iidxhook-23.conf b/dist/iidx/iidxhook-23.conf index 81632cb..7ce8afc 100755 --- a/dist/iidx/iidxhook-23.conf +++ b/dist/iidx/iidxhook-23.conf @@ -27,3 +27,9 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 diff --git a/dist/iidx/iidxhook-24.conf b/dist/iidx/iidxhook-24.conf index 81632cb..7ce8afc 100755 --- a/dist/iidx/iidxhook-24.conf +++ b/dist/iidx/iidxhook-24.conf @@ -27,3 +27,9 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 diff --git a/dist/iidx/iidxhook-25.conf b/dist/iidx/iidxhook-25.conf index 21a8d1d..ac88dee 100644 --- a/dist/iidx/iidxhook-25.conf +++ b/dist/iidx/iidxhook-25.conf @@ -28,6 +28,12 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 + # Disables the camera emulation cam.disable_emu=false diff --git a/dist/iidx/iidxhook-26.conf b/dist/iidx/iidxhook-26.conf index 21a8d1d..ac88dee 100644 --- a/dist/iidx/iidxhook-26.conf +++ b/dist/iidx/iidxhook-26.conf @@ -28,6 +28,12 @@ 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), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter +gfx.device_adapter=0 + # Disables the camera emulation cam.disable_emu=false diff --git a/src/main/d3d9exhook/d3d9ex.c b/src/main/d3d9exhook/d3d9ex.c index 8a14419..e013111 100644 --- a/src/main/d3d9exhook/d3d9ex.c +++ b/src/main/d3d9exhook/d3d9ex.c @@ -200,7 +200,7 @@ static HRESULT STDCALL my_CreateDeviceEx( pp->Windowed = TRUE; pp->FullScreen_RefreshRateInHz = 0; } else { - if (d3d9ex_force_refresh_rate != -1) { + if (d3d9ex_force_refresh_rate > 0) { log_info("Forcing refresh rate %d -> %d", pp->FullScreen_RefreshRateInHz, d3d9ex_force_refresh_rate); pp->FullScreen_RefreshRateInHz = d3d9ex_force_refresh_rate; if (fdm) { diff --git a/src/main/iidxhook-util/config-gfx.c b/src/main/iidxhook-util/config-gfx.c index a74b2ac..4474ab0 100644 --- a/src/main/iidxhook-util/config-gfx.c +++ b/src/main/iidxhook-util/config-gfx.c @@ -20,6 +20,8 @@ "gfx.scale_back_buffer_height" #define IIDXHOOK_CONFIG_GFX_SCALE_BACK_BUFFER_FILTER_KEY \ "gfx.scale_back_buffer_filter" +#define IIDXHOOK_CONFIG_GFX_FORCED_RR_KEY "gfx.forced_refresh_rate" +#define IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY "gfx.device_adapter" #define IIDXHOOK_CONFIG_GFX_DEFAULT_BGVIDEO_UV_FIX_VALUE false #define IIDXHOOK_CONFIG_GFX_DEFAULT_FRAMED_VALUE false @@ -32,6 +34,8 @@ #define IIDXHOOK_CONFIG_GFX_DEFAULT_SCALE_BACK_BUFFER_WIDTH_VALUE 0 #define IIDXHOOK_CONFIG_GFX_DEFAULT_SCALE_BACK_BUFFER_HEIGHT_VALUE 0 #define IIDXHOOK_CONFIG_GFX_DEFAULT_SCALE_BACK_BUFFER_FILTER_VALUE "none" +#define IIDXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE -1 +#define IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE D3DADAPTER_DEFAULT void iidxhook_config_gfx_init(struct cconfig *config) { @@ -141,6 +145,18 @@ void iidxhook_config_gfx_init(struct cconfig *config) "linear, point (refer to " "D3DTEXTUREFILTERTYPE " " for explanation)."); + + cconfig_util_set_int( + config, + IIDXHOOK_CONFIG_GFX_FORCED_RR_KEY, + IIDXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE, + "Forced refresh rate, -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)"); + + cconfig_util_set_int( + config, + IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY, + IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE, + "D3D9 device adapter (monitor), 0 (D3DADAPTER_DEFAULT) to use default, 1, 2 etc. to use specified adapter"); } void iidxhook_config_gfx_get( @@ -325,4 +341,37 @@ void iidxhook_config_gfx_get( IIDXHOOK_CONFIG_GFX_SCALE_BACK_BUFFER_FILTER_KEY, IIDXHOOK_CONFIG_GFX_DEFAULT_SCALE_BACK_BUFFER_FILTER_VALUE); } + + if (!cconfig_util_get_int( + config, + IIDXHOOK_CONFIG_GFX_FORCED_RR_KEY, + &config_gfx->forced_refresh_rate, + IIDXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE)) { + log_warning( + "Invalid value for key '%s' specified, fallback " + "to default '%d'", + IIDXHOOK_CONFIG_GFX_FORCED_RR_KEY, + IIDXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE); + } + + if (!cconfig_util_get_int( + config, + IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY, + &config_gfx->device_adapter, + IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE)) { + log_warning( + "Invalid value for key '%s' specified, fallback " + "to default '%d'", + IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY, + IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE); + } + + if (config_gfx->device_adapter < 0) { + log_warning( + "Invalid value for key '%s' specified, fallback " + "to default '%d'", + IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY, + IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE); + config_gfx->device_adapter = IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE; + } } diff --git a/src/main/iidxhook-util/config-gfx.h b/src/main/iidxhook-util/config-gfx.h index d3af449..df02b36 100644 --- a/src/main/iidxhook-util/config-gfx.h +++ b/src/main/iidxhook-util/config-gfx.h @@ -5,6 +5,7 @@ #include "iidxhook-util/d3d9.h" +// see struct iidxhook_util_d3d9_config for more info struct iidxhook_config_gfx { bool bgvideo_uv_fix; bool framed; @@ -18,6 +19,8 @@ struct iidxhook_config_gfx { uint16_t scale_back_buffer_width; uint16_t scale_back_buffer_height; enum iidxhook_util_d3d9_back_buffer_scale_filter scale_back_buffer_filter; + int32_t forced_refresh_rate; + int32_t device_adapter; }; void iidxhook_config_gfx_init(struct cconfig *config); diff --git a/src/main/iidxhook-util/d3d9.c b/src/main/iidxhook-util/d3d9.c index 18b123d..399fd03 100644 --- a/src/main/iidxhook-util/d3d9.c +++ b/src/main/iidxhook-util/d3d9.c @@ -262,10 +262,21 @@ static void iidxhook_util_d3d9_fix_create_device_apply_window_mode( { log_assert(irp); log_assert(irp->op == HOOK_D3D9_IRP_OP_CTX_CREATE_DEVICE); + D3DPRESENT_PARAMETERS *pp = irp->args.ctx_create_device.pp; if (iidxhook_util_d3d9_config.windowed) { - irp->args.ctx_create_device.pp->Windowed = TRUE; - irp->args.ctx_create_device.pp->FullScreen_RefreshRateInHz = 0; + pp->Windowed = TRUE; + pp->FullScreen_RefreshRateInHz = 0; + } else { + if (iidxhook_util_d3d9_config.forced_refresh_rate > 0) { + log_info("Forcing refresh rate %d -> %d", pp->FullScreen_RefreshRateInHz, iidxhook_util_d3d9_config.forced_refresh_rate); + pp->FullScreen_RefreshRateInHz = iidxhook_util_d3d9_config.forced_refresh_rate; + } + } + + if (iidxhook_util_d3d9_config.device_adapter != D3DADAPTER_DEFAULT) { + log_info("Forcing adapter %d -> %d", irp->args.ctx_create_device.adapter, iidxhook_util_d3d9_config.device_adapter); + irp->args.ctx_create_device.adapter = iidxhook_util_d3d9_config.device_adapter; } } @@ -904,7 +915,9 @@ iidxhook_util_d3d9_log_config(const struct iidxhook_util_d3d9_config *config) "iidx14_to_19_nvidia_fix: %d\n" "scale_back_buffer_width: %d\n" "scale_back_buffer_height: %d\n" - "scale_back_buffer_filter: %d", + "scale_back_buffer_filter: %d\n" + "forced_refresh_rate: %d\n" + "device_adapter: %d", config->windowed, config->framed, config->override_window_width, @@ -919,7 +932,9 @@ iidxhook_util_d3d9_log_config(const struct iidxhook_util_d3d9_config *config) config->iidx14_to_19_nvidia_fix, config->scale_back_buffer_width, config->scale_back_buffer_height, - config->scale_back_buffer_filter); + config->scale_back_buffer_filter, + config->forced_refresh_rate, + config->device_adapter); } static void iidxhook_util_d3d9_validate_config( @@ -983,6 +998,8 @@ void iidxhook_util_d3d9_init_config(struct iidxhook_util_d3d9_config *config) config->scale_back_buffer_height = 0; config->scale_back_buffer_filter = IIDXHOOK_UTIL_D3D9_BACK_BUFFER_SCALE_FILTER_NONE; + config->forced_refresh_rate = -1; + config->device_adapter = D3DADAPTER_DEFAULT; } void iidxhook_util_d3d9_configure( @@ -1046,9 +1063,10 @@ iidxhook_util_d3d9_irp_handler(struct hook_d3d9_irp *irp) hr = hook_d3d9_irp_invoke_next(irp); if (hr == S_OK) { - iidxhook_util_d3d9_log_result_create_device(hr); iidxhook_util_d3d9_setup_back_buffer_scaling_post(irp); iidxhook_util_d3d9_execute_monitor_check(irp); + } else { + iidxhook_util_d3d9_log_result_create_device(hr); } return hr; diff --git a/src/main/iidxhook-util/d3d9.h b/src/main/iidxhook-util/d3d9.h index c581ed8..3a4ec2d 100644 --- a/src/main/iidxhook-util/d3d9.h +++ b/src/main/iidxhook-util/d3d9.h @@ -159,6 +159,18 @@ struct iidxhook_util_d3d9_config { * for full doc. */ enum iidxhook_util_d3d9_back_buffer_scale_filter scale_back_buffer_filter; + + /** + * Forced refresh rate + * -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors) + */ + int32_t forced_refresh_rate; + + /** + * override device adapter (monitor) + * 0 (D3DADAPTER_DEFAULT) to use default (whatever the game sends), 1, 2 etc. to use specified adapter + */ + int32_t device_adapter; }; /** diff --git a/src/main/iidxhook1/dllmain.c b/src/main/iidxhook1/dllmain.c index c94f410..8695ab7 100644 --- a/src/main/iidxhook1/dllmain.c +++ b/src/main/iidxhook1/dllmain.c @@ -95,6 +95,8 @@ static void iidxhook1_setup_d3d9_hooks( 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; if (config_gfx->monitor_check == 0) { log_info("Auto monitor check enabled"); diff --git a/src/main/iidxhook2/dllmain.c b/src/main/iidxhook2/dllmain.c index 2fb2ff3..a75d231 100644 --- a/src/main/iidxhook2/dllmain.c +++ b/src/main/iidxhook2/dllmain.c @@ -94,6 +94,8 @@ static void iidxhook2_setup_d3d9_hooks( 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; if (config_gfx->monitor_check == 0) { log_info("Auto monitor check enabled"); diff --git a/src/main/iidxhook3/dllmain.c b/src/main/iidxhook3/dllmain.c index ea0cb12..180bca4 100644 --- a/src/main/iidxhook3/dllmain.c +++ b/src/main/iidxhook3/dllmain.c @@ -91,6 +91,8 @@ iidxhook3_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx) 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; if (config_gfx->monitor_check == 0) { log_info("Auto monitor check enabled"); diff --git a/src/main/iidxhook4/dllmain.c b/src/main/iidxhook4/dllmain.c index 43ee469..5be3d69 100644 --- a/src/main/iidxhook4/dllmain.c +++ b/src/main/iidxhook4/dllmain.c @@ -72,6 +72,8 @@ iidxhook4_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx) 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; if (config_gfx->monitor_check == 0) { log_info("Auto monitor check enabled"); diff --git a/src/main/iidxhook5/dllmain.c b/src/main/iidxhook5/dllmain.c index a091970..681861d 100644 --- a/src/main/iidxhook5/dllmain.c +++ b/src/main/iidxhook5/dllmain.c @@ -70,6 +70,8 @@ iidxhook5_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx) 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; iidxhook_util_d3d9_configure(&d3d9_config); diff --git a/src/main/iidxhook6/dllmain.c b/src/main/iidxhook6/dllmain.c index 72a469f..ef72558 100644 --- a/src/main/iidxhook6/dllmain.c +++ b/src/main/iidxhook6/dllmain.c @@ -68,6 +68,8 @@ iidxhook6_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx) 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; iidxhook_util_d3d9_configure(&d3d9_config); diff --git a/src/main/iidxhook7/dllmain.c b/src/main/iidxhook7/dllmain.c index 1352628..b15958e 100644 --- a/src/main/iidxhook7/dllmain.c +++ b/src/main/iidxhook7/dllmain.c @@ -68,6 +68,8 @@ iidxhook7_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx) 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; iidxhook_util_d3d9_configure(&d3d9_config); diff --git a/src/main/iidxhook8/dllmain.c b/src/main/iidxhook8/dllmain.c index 9579ef3..95a63f3 100644 --- a/src/main/iidxhook8/dllmain.c +++ b/src/main/iidxhook8/dllmain.c @@ -68,6 +68,8 @@ iidxhook8_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx) 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; iidxhook_util_d3d9_configure(&d3d9_config);