iidxhook/d3d9exhook: Use -1 to specify default adapter instead of 0 because the indexing starts at 0

Originally thought the default monitor showed up again later, it does not
This commit is contained in:
Will Xyen
2020-01-10 17:36:34 -05:00
parent 66d1131664
commit 214a31b24d
23 changed files with 56 additions and 76 deletions
+7 -17
View File
@@ -20,7 +20,7 @@
"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_FORCED_REFRESHRATE_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
@@ -35,7 +35,7 @@
#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
#define IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE -1
void iidxhook_config_gfx_init(struct cconfig *config)
{
@@ -148,7 +148,7 @@ void iidxhook_config_gfx_init(struct cconfig *config)
cconfig_util_set_int(
config,
IIDXHOOK_CONFIG_GFX_FORCED_RR_KEY,
IIDXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_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)");
@@ -157,8 +157,8 @@ void iidxhook_config_gfx_init(struct cconfig *config)
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");
"D3D9 device adapter (monitor), -1 to use default, "
"0, 1, 2 etc. to use specified adapter");
}
void iidxhook_config_gfx_get(
@@ -346,13 +346,13 @@ void iidxhook_config_gfx_get(
if (!cconfig_util_get_int(
config,
IIDXHOOK_CONFIG_GFX_FORCED_RR_KEY,
IIDXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_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_FORCED_REFRESHRATE_KEY,
IIDXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE);
}
@@ -367,14 +367,4 @@ void iidxhook_config_gfx_get(
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;
}
}
+2 -2
View File
@@ -278,7 +278,7 @@ static void iidxhook_util_d3d9_fix_create_device_apply_window_mode(
}
}
if (iidxhook_util_d3d9_config.device_adapter != D3DADAPTER_DEFAULT) {
if (iidxhook_util_d3d9_config.device_adapter >= 0) {
log_info(
"Forcing adapter %d -> %d",
irp->args.ctx_create_device.adapter,
@@ -1007,7 +1007,7 @@ void iidxhook_util_d3d9_init_config(struct iidxhook_util_d3d9_config *config)
config->scale_back_buffer_filter =
IIDXHOOK_UTIL_D3D9_BACK_BUFFER_SCALE_FILTER_NONE;
config->forced_refresh_rate = -1;
config->device_adapter = D3DADAPTER_DEFAULT;
config->device_adapter = -1;
}
void iidxhook_util_d3d9_configure(
+2 -2
View File
@@ -169,8 +169,8 @@ struct iidxhook_util_d3d9_config {
/**
* override device adapter (monitor)
* 0 (D3DADAPTER_DEFAULT) to use default (whatever the game sends), 1, 2
* etc. to use specified adapter
* -1 to use default (whatever the game sends)
* 0, 1, 2 etc. to use specified adapter
*/
int32_t device_adapter;
};