From 4c805d3d472c46d1cd11bbb47d52e8a1dd1a8f9a Mon Sep 17 00:00:00 2001 From: Will Xyen Date: Fri, 10 Jan 2020 17:24:47 -0500 Subject: [PATCH] clang-format pass --- src/main/camhook/cam.c | 2 +- src/main/cconfig/cconfig-hook.c | 3 ++- src/main/cconfig/cconfig-hook.h | 2 +- src/main/cconfig/cconfig-main.c | 3 ++- src/main/cconfig/cconfig-main.h | 2 +- src/main/d3d9exhook/config-gfx.c | 9 ++++++--- src/main/d3d9exhook/config-gfx.h | 2 +- src/main/d3d9exhook/d3d9ex.c | 7 +++++-- src/main/d3d9exhook/d3d9ex.h | 2 +- src/main/iidxhook-util/config-gfx.c | 9 ++++++--- src/main/iidxhook-util/d3d9.c | 16 ++++++++++++---- src/main/iidxhook-util/d3d9.h | 6 ++++-- src/main/launcher/main.c | 4 +++- src/main/launcher/property.c | 20 +++++++++++--------- 14 files changed, 56 insertions(+), 31 deletions(-) diff --git a/src/main/camhook/cam.c b/src/main/camhook/cam.c index f17b6cc..59810a3 100644 --- a/src/main/camhook/cam.c +++ b/src/main/camhook/cam.c @@ -282,7 +282,7 @@ HRESULT my_GetAllocatedString( // should probably check GUID, oh well ret = real_GetAllocatedString(self, guidKey, ppwszValue, pcchLength); - char *pMBBuffer = (char *)malloc(0x100); + char *pMBBuffer = (char *) malloc(0x100); wcstombs(pMBBuffer, *ppwszValue, 0x100); log_info("Obtained: %s", pMBBuffer); diff --git a/src/main/cconfig/cconfig-hook.c b/src/main/cconfig/cconfig-hook.c index f3218bb..e917fa7 100644 --- a/src/main/cconfig/cconfig-hook.c +++ b/src/main/cconfig/cconfig-hook.c @@ -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); } diff --git a/src/main/cconfig/cconfig-hook.h b/src/main/cconfig/cconfig-hook.h index 92f369e..055464d 100644 --- a/src/main/cconfig/cconfig-hook.h +++ b/src/main/cconfig/cconfig-hook.h @@ -6,7 +6,7 @@ /** * Init function for cconfig for hooks - * + * * calls cconfig_main_config_init with some defaults for hook dlls * see: cconfig_main_config_init for more details */ diff --git a/src/main/cconfig/cconfig-main.c b/src/main/cconfig/cconfig-main.c index 1cc3572..342a912 100644 --- a/src/main/cconfig/cconfig-main.c +++ b/src/main/cconfig/cconfig-main.c @@ -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; } } diff --git a/src/main/cconfig/cconfig-main.h b/src/main/cconfig/cconfig-main.h index a062c61..eea223a 100644 --- a/src/main/cconfig/cconfig-main.h +++ b/src/main/cconfig/cconfig-main.h @@ -6,7 +6,7 @@ /** * Init function for cconfig after all cconfig_util_set's have been called - * + * * will parse a config file first (if specified) * then uses override config parameters from cmd */ diff --git a/src/main/d3d9exhook/config-gfx.c b/src/main/d3d9exhook/config-gfx.c index 51ba8a0..940c107 100644 --- a/src/main/d3d9exhook/config-gfx.c +++ b/src/main/d3d9exhook/config-gfx.c @@ -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; } } diff --git a/src/main/d3d9exhook/config-gfx.h b/src/main/d3d9exhook/config-gfx.h index c223df4..5623228 100644 --- a/src/main/d3d9exhook/config-gfx.h +++ b/src/main/d3d9exhook/config-gfx.h @@ -5,7 +5,7 @@ /** * Config struct for d3d9exhook - * + * * Note: forced_refresh_rate sets the monitor's refresh rate * (it does not limit FPS or anything) */ diff --git a/src/main/d3d9exhook/d3d9ex.c b/src/main/d3d9exhook/d3d9ex.c index e013111..058afe1 100644 --- a/src/main/d3d9exhook/d3d9ex.c +++ b/src/main/d3d9exhook/d3d9ex.c @@ -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; @@ -267,7 +270,7 @@ void d3d9ex_hook_init(void) log_info("Inserted graphics hooks"); } -void d3d9ex_configure(struct d3d9exhook_config_gfx* gfx_config) +void d3d9ex_configure(struct d3d9exhook_config_gfx *gfx_config) { d3d9ex_windowed = gfx_config->windowed; d3d9ex_window_framed = gfx_config->framed; diff --git a/src/main/d3d9exhook/d3d9ex.h b/src/main/d3d9exhook/d3d9ex.h index 1daa100..67b4460 100644 --- a/src/main/d3d9exhook/d3d9ex.h +++ b/src/main/d3d9exhook/d3d9ex.h @@ -16,6 +16,6 @@ void d3d9ex_hook_init(void); * * @param gfx_config Config to apply. */ -void d3d9ex_configure(struct d3d9exhook_config_gfx* gfx_config); +void d3d9ex_configure(struct d3d9exhook_config_gfx *gfx_config); #endif diff --git a/src/main/iidxhook-util/config-gfx.c b/src/main/iidxhook-util/config-gfx.c index 4474ab0..6d7560d 100644 --- a/src/main/iidxhook-util/config-gfx.c +++ b/src/main/iidxhook-util/config-gfx.c @@ -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; } } diff --git a/src/main/iidxhook-util/d3d9.c b/src/main/iidxhook-util/d3d9.c index 399fd03..969cd08 100644 --- a/src/main/iidxhook-util/d3d9.c +++ b/src/main/iidxhook-util/d3d9.c @@ -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; } } diff --git a/src/main/iidxhook-util/d3d9.h b/src/main/iidxhook-util/d3d9.h index 3a4ec2d..6d9e6de 100644 --- a/src/main/iidxhook-util/d3d9.h +++ b/src/main/iidxhook-util/d3d9.h @@ -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; }; diff --git a/src/main/launcher/main.c b/src/main/launcher/main.c index 4e1c493..5f6f469 100644 --- a/src/main/launcher/main.c +++ b/src/main/launcher/main.c @@ -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("dummy"); } diff --git a/src/main/launcher/property.c b/src/main/launcher/property.c index a418dd8..368b092 100644 --- a/src/main/launcher/property.c +++ b/src/main/launcher/property.c @@ -21,19 +21,20 @@ static int boot_property_fread(uint32_t context, void *bytes, size_t nbytes) } struct cstring_read_handle { - const char * buffer; + const char *buffer; size_t buffer_len; 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); + struct cstring_read_handle *h = TlsGetValue(context); - if (h->offset < h->buffer_len){ + if (h->offset < h->buffer_len) { result = min(nbytes, h->buffer_len - h->offset); - memcpy(bytes, (const void *)(h->buffer + h->offset), result); + memcpy(bytes, (const void *) (h->buffer + h->offset), result); h->offset += result; } return result; @@ -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)) {