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
@@ -12,7 +12,7 @@
#define D3D9EXHOOK_CONFIG_GFX_WINDOWED_KEY "gfx.windowed"
#define D3D9EXHOOK_CONFIG_GFX_WINDOW_WIDTH_KEY "gfx.window_width"
#define D3D9EXHOOK_CONFIG_GFX_WINDOW_HEIGHT_KEY "gfx.window_height"
#define D3D9EXHOOK_CONFIG_GFX_FORCED_RR_KEY "gfx.forced_refresh_rate"
#define D3D9EXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY "gfx.forced_refresh_rate"
#define D3D9EXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY "gfx.device_adapter"
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_FRAMED_VALUE false
@@ -20,7 +20,7 @@
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_WIDTH_VALUE -1
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE -1
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE -1
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE D3DADAPTER_DEFAULT
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE -1
void d3d9exhook_config_gfx_init(struct cconfig *config)
{
@@ -50,7 +50,7 @@ void d3d9exhook_config_gfx_init(struct cconfig *config)
cconfig_util_set_int(
config,
D3D9EXHOOK_CONFIG_GFX_FORCED_RR_KEY,
D3D9EXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY,
D3D9EXHOOK_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)");
@@ -59,8 +59,8 @@ void d3d9exhook_config_gfx_init(struct cconfig *config)
config,
D3D9EXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE,
"D3D9ex device adapter (monitor), 0 (D3DADAPTER_DEFAULT) to use "
"default, 1, 2 etc. to use specified adapter");
"D3D9ex device adapter (monitor), -1 to use default,"
"0, 1, 2 etc. to use specified adapter");
}
void d3d9exhook_config_gfx_get(
@@ -116,13 +116,13 @@ void d3d9exhook_config_gfx_get(
if (!cconfig_util_get_int(
config,
D3D9EXHOOK_CONFIG_GFX_FORCED_RR_KEY,
D3D9EXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY,
&config_gfx->forced_refresh_rate,
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE)) {
log_warning(
"Invalid value for key '%s' specified, fallback "
"to default '%d'",
D3D9EXHOOK_CONFIG_GFX_FORCED_RR_KEY,
D3D9EXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY,
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE);
}
@@ -137,14 +137,4 @@ void d3d9exhook_config_gfx_get(
D3D9EXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE);
}
if (config_gfx->device_adapter < 0) {
log_warning(
"Invalid value for key '%s' specified, fallback "
"to default '%d'",
D3D9EXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE);
config_gfx->device_adapter =
D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE;
}
}
+2 -2
View File
@@ -86,7 +86,7 @@ static int32_t d3d9ex_force_refresh_rate = -1;
static int32_t d3d9ex_window_width = -1;
static int32_t d3d9ex_window_height = -1;
static bool d3d9ex_window_framed;
static int32_t d3d9ex_device_adapter = D3DADAPTER_DEFAULT;
static int32_t d3d9ex_device_adapter = -1;
/* ------------------------------------------------------------------------- */
@@ -212,7 +212,7 @@ static HRESULT STDCALL my_CreateDeviceEx(
}
}
if (d3d9ex_device_adapter != D3DADAPTER_DEFAULT) {
if (d3d9ex_device_adapter >= 0) {
log_info("Forcing adapter %d -> %d", adapter, d3d9ex_device_adapter);
adapter = d3d9ex_device_adapter;
}