clang-format pass
This commit is contained in:
@@ -9,5 +9,6 @@ bool cconfig_hook_config_init(
|
|||||||
const char *usage_header,
|
const char *usage_header,
|
||||||
enum cconfig_cmd_usage_out cmd_usage_out)
|
enum cconfig_cmd_usage_out cmd_usage_out)
|
||||||
{
|
{
|
||||||
return cconfig_main_config_init(config, "--config", NULL, "--help", "-h", usage_header, cmd_usage_out);
|
return cconfig_main_config_init(
|
||||||
|
config, "--config", NULL, "--help", "-h", usage_header, cmd_usage_out);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ bool cconfig_main_config_init(
|
|||||||
args_recover(&argc, &argv);
|
args_recover(&argc, &argv);
|
||||||
|
|
||||||
for (int i = 0; i < argc; i++) {
|
for (int i = 0; i < argc; i++) {
|
||||||
if (!strcmp(argv[i], help_parameter_short_name) || !strcmp(argv[i], help_parameter_name)) {
|
if (!strcmp(argv[i], help_parameter_short_name) ||
|
||||||
|
!strcmp(argv[i], help_parameter_name)) {
|
||||||
goto failure_usage;
|
goto failure_usage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,13 +52,15 @@ void d3d9exhook_config_gfx_init(struct cconfig *config)
|
|||||||
config,
|
config,
|
||||||
D3D9EXHOOK_CONFIG_GFX_FORCED_RR_KEY,
|
D3D9EXHOOK_CONFIG_GFX_FORCED_RR_KEY,
|
||||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE,
|
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)");
|
"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(
|
cconfig_util_set_int(
|
||||||
config,
|
config,
|
||||||
D3D9EXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
|
D3D9EXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
|
||||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE,
|
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), 0 (D3DADAPTER_DEFAULT) to use "
|
||||||
|
"default, 1, 2 etc. to use specified adapter");
|
||||||
}
|
}
|
||||||
|
|
||||||
void d3d9exhook_config_gfx_get(
|
void d3d9exhook_config_gfx_get(
|
||||||
@@ -142,6 +144,7 @@ void d3d9exhook_config_gfx_get(
|
|||||||
"to default '%d'",
|
"to default '%d'",
|
||||||
D3D9EXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
|
D3D9EXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
|
||||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE);
|
D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE);
|
||||||
config_gfx->device_adapter = D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE;
|
config_gfx->device_adapter =
|
||||||
|
D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,7 +201,10 @@ static HRESULT STDCALL my_CreateDeviceEx(
|
|||||||
pp->FullScreen_RefreshRateInHz = 0;
|
pp->FullScreen_RefreshRateInHz = 0;
|
||||||
} else {
|
} else {
|
||||||
if (d3d9ex_force_refresh_rate > 0) {
|
if (d3d9ex_force_refresh_rate > 0) {
|
||||||
log_info("Forcing refresh rate %d -> %d", pp->FullScreen_RefreshRateInHz, d3d9ex_force_refresh_rate);
|
log_info(
|
||||||
|
"Forcing refresh rate %d -> %d",
|
||||||
|
pp->FullScreen_RefreshRateInHz,
|
||||||
|
d3d9ex_force_refresh_rate);
|
||||||
pp->FullScreen_RefreshRateInHz = d3d9ex_force_refresh_rate;
|
pp->FullScreen_RefreshRateInHz = d3d9ex_force_refresh_rate;
|
||||||
if (fdm) {
|
if (fdm) {
|
||||||
fdm->RefreshRate = pp->FullScreen_RefreshRateInHz;
|
fdm->RefreshRate = pp->FullScreen_RefreshRateInHz;
|
||||||
|
|||||||
@@ -150,13 +150,15 @@ void iidxhook_config_gfx_init(struct cconfig *config)
|
|||||||
config,
|
config,
|
||||||
IIDXHOOK_CONFIG_GFX_FORCED_RR_KEY,
|
IIDXHOOK_CONFIG_GFX_FORCED_RR_KEY,
|
||||||
IIDXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE,
|
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)");
|
"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(
|
cconfig_util_set_int(
|
||||||
config,
|
config,
|
||||||
IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
|
IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
|
||||||
IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE,
|
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), 0 (D3DADAPTER_DEFAULT) to use default, "
|
||||||
|
"1, 2 etc. to use specified adapter");
|
||||||
}
|
}
|
||||||
|
|
||||||
void iidxhook_config_gfx_get(
|
void iidxhook_config_gfx_get(
|
||||||
@@ -372,6 +374,7 @@ void iidxhook_config_gfx_get(
|
|||||||
"to default '%d'",
|
"to default '%d'",
|
||||||
IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
|
IIDXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY,
|
||||||
IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE);
|
IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE);
|
||||||
config_gfx->device_adapter = IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE;
|
config_gfx->device_adapter =
|
||||||
|
IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -269,14 +269,22 @@ static void iidxhook_util_d3d9_fix_create_device_apply_window_mode(
|
|||||||
pp->FullScreen_RefreshRateInHz = 0;
|
pp->FullScreen_RefreshRateInHz = 0;
|
||||||
} else {
|
} else {
|
||||||
if (iidxhook_util_d3d9_config.forced_refresh_rate > 0) {
|
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);
|
log_info(
|
||||||
pp->FullScreen_RefreshRateInHz = iidxhook_util_d3d9_config.forced_refresh_rate;
|
"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) {
|
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);
|
log_info(
|
||||||
irp->args.ctx_create_device.adapter = iidxhook_util_d3d9_config.device_adapter;
|
"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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -162,13 +162,15 @@ struct iidxhook_util_d3d9_config {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Forced refresh rate
|
* Forced refresh rate
|
||||||
* -1 to not force any (try 59 or 60 if monitor check fails to lock on high refresh rate monitors)
|
* -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;
|
int32_t forced_refresh_rate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* override device adapter (monitor)
|
* override device adapter (monitor)
|
||||||
* 0 (D3DADAPTER_DEFAULT) to use default (whatever the game sends), 1, 2 etc. to use specified adapter
|
* 0 (D3DADAPTER_DEFAULT) to use default (whatever the game sends), 1, 2
|
||||||
|
* etc. to use specified adapter
|
||||||
*/
|
*/
|
||||||
int32_t device_adapter;
|
int32_t device_adapter;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -247,7 +247,9 @@ int main(int argc, const char **argv)
|
|||||||
if (path_exists(options.app_config_path)) {
|
if (path_exists(options.app_config_path)) {
|
||||||
app_config = boot_property_load(options.app_config_path);
|
app_config = boot_property_load(options.app_config_path);
|
||||||
} else {
|
} else {
|
||||||
log_warning("%s: app config file missing, using empty", options.app_config_path);
|
log_warning(
|
||||||
|
"%s: app config file missing, using empty",
|
||||||
|
options.app_config_path);
|
||||||
app_config = boot_property_load_cstring("<param>dummy</param>");
|
app_config = boot_property_load_cstring("<param>dummy</param>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ struct cstring_read_handle {
|
|||||||
size_t offset;
|
size_t offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int boot_property_cstring_read(uint32_t context, void *bytes, size_t nbytes)
|
static int
|
||||||
|
boot_property_cstring_read(uint32_t context, void *bytes, size_t nbytes)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
struct cstring_read_handle *h = TlsGetValue(context);
|
struct cstring_read_handle *h = TlsGetValue(context);
|
||||||
@@ -100,7 +101,8 @@ struct property *boot_property_load_cstring(const char *cstring)
|
|||||||
s_keyhole = TlsAlloc();
|
s_keyhole = TlsAlloc();
|
||||||
TlsSetValue(s_keyhole, &read_handle);
|
TlsSetValue(s_keyhole, &read_handle);
|
||||||
|
|
||||||
nbytes = property_read_query_memsize(boot_property_cstring_read, s_keyhole, 0, 0);
|
nbytes = property_read_query_memsize(
|
||||||
|
boot_property_cstring_read, s_keyhole, 0, 0);
|
||||||
|
|
||||||
if (nbytes < 0) {
|
if (nbytes < 0) {
|
||||||
log_fatal("Error querying configuration string");
|
log_fatal("Error querying configuration string");
|
||||||
@@ -108,10 +110,10 @@ struct property *boot_property_load_cstring(const char *cstring)
|
|||||||
|
|
||||||
buffer = xmalloc(nbytes);
|
buffer = xmalloc(nbytes);
|
||||||
prop = property_create(
|
prop = property_create(
|
||||||
PROPERTY_FLAG_READ | PROPERTY_FLAG_WRITE | PROPERTY_FLAG_CREATE | PROPERTY_FLAG_APPEND,
|
PROPERTY_FLAG_READ | PROPERTY_FLAG_WRITE | PROPERTY_FLAG_CREATE |
|
||||||
|
PROPERTY_FLAG_APPEND,
|
||||||
buffer,
|
buffer,
|
||||||
nbytes
|
nbytes);
|
||||||
);
|
|
||||||
|
|
||||||
read_handle.offset = 0;
|
read_handle.offset = 0;
|
||||||
if (!property_insert_read(prop, 0, boot_property_cstring_read, s_keyhole)) {
|
if (!property_insert_read(prop, 0, boot_property_cstring_read, s_keyhole)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user