1
0
mirror of https://github.com/djhackersdev/bemanitools.git synced 2024-11-15 02:37:37 +01:00

clang-format pass

This commit is contained in:
Will Xyen 2020-01-10 17:24:47 -05:00
parent 3450686cf5
commit 66d1131664
14 changed files with 56 additions and 31 deletions

View File

@ -9,5 +9,6 @@ bool cconfig_hook_config_init(
const char *usage_header,
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);
}

View File

@ -29,7 +29,8 @@ bool cconfig_main_config_init(
args_recover(&argc, &argv);
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;
}
}

View File

@ -52,13 +52,15 @@ void d3d9exhook_config_gfx_init(struct cconfig *config)
config,
D3D9EXHOOK_CONFIG_GFX_FORCED_RR_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)");
"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,
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), 0 (D3DADAPTER_DEFAULT) to use "
"default, 1, 2 etc. to use specified adapter");
}
void d3d9exhook_config_gfx_get(
@ -142,6 +144,7 @@ void d3d9exhook_config_gfx_get(
"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;
config_gfx->device_adapter =
D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE;
}
}

View File

@ -201,7 +201,10 @@ static HRESULT STDCALL my_CreateDeviceEx(
pp->FullScreen_RefreshRateInHz = 0;
} else {
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;
if (fdm) {
fdm->RefreshRate = pp->FullScreen_RefreshRateInHz;

View File

@ -150,13 +150,15 @@ void iidxhook_config_gfx_init(struct cconfig *config)
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)");
"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");
"D3D9 device adapter (monitor), 0 (D3DADAPTER_DEFAULT) to use default, "
"1, 2 etc. to use specified adapter");
}
void iidxhook_config_gfx_get(
@ -372,6 +374,7 @@ void iidxhook_config_gfx_get(
"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;
config_gfx->device_adapter =
IIDXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE;
}
}

View File

@ -269,14 +269,22 @@ static void iidxhook_util_d3d9_fix_create_device_apply_window_mode(
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;
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;
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;
}
}

View File

@ -162,13 +162,15 @@ struct iidxhook_util_d3d9_config {
/**
* 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;
/**
* 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;
};

View File

@ -247,7 +247,9 @@ int main(int argc, const char **argv)
if (path_exists(options.app_config_path)) {
app_config = boot_property_load(options.app_config_path);
} 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>");
}

View File

@ -26,7 +26,8 @@ struct cstring_read_handle {
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;
struct cstring_read_handle *h = TlsGetValue(context);
@ -100,7 +101,8 @@ struct property *boot_property_load_cstring(const char *cstring)
s_keyhole = TlsAlloc();
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) {
log_fatal("Error querying configuration string");
@ -108,10 +110,10 @@ struct property *boot_property_load_cstring(const char *cstring)
buffer = xmalloc(nbytes);
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,
nbytes
);
nbytes);
read_handle.offset = 0;
if (!property_insert_read(prop, 0, boot_property_cstring_read, s_keyhole)) {