clang-format pass
This commit is contained in:
@@ -282,7 +282,7 @@ HRESULT my_GetAllocatedString(
|
|||||||
|
|
||||||
// should probably check GUID, oh well
|
// should probably check GUID, oh well
|
||||||
ret = real_GetAllocatedString(self, guidKey, ppwszValue, pcchLength);
|
ret = real_GetAllocatedString(self, guidKey, ppwszValue, pcchLength);
|
||||||
char *pMBBuffer = (char *)malloc(0x100);
|
char *pMBBuffer = (char *) malloc(0x100);
|
||||||
wcstombs(pMBBuffer, *ppwszValue, 0x100);
|
wcstombs(pMBBuffer, *ppwszValue, 0x100);
|
||||||
log_info("Obtained: %s", pMBBuffer);
|
log_info("Obtained: %s", pMBBuffer);
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Init function for cconfig for hooks
|
* Init function for cconfig for hooks
|
||||||
*
|
*
|
||||||
* calls cconfig_main_config_init with some defaults for hook dlls
|
* calls cconfig_main_config_init with some defaults for hook dlls
|
||||||
* see: cconfig_main_config_init for more details
|
* see: cconfig_main_config_init for more details
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Init function for cconfig after all cconfig_util_set's have been called
|
* Init function for cconfig after all cconfig_util_set's have been called
|
||||||
*
|
*
|
||||||
* will parse a config file first (if specified)
|
* will parse a config file first (if specified)
|
||||||
* then uses override config parameters from cmd
|
* then uses override config parameters from cmd
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Config struct for d3d9exhook
|
* Config struct for d3d9exhook
|
||||||
*
|
*
|
||||||
* Note: forced_refresh_rate sets the monitor's refresh rate
|
* Note: forced_refresh_rate sets the monitor's refresh rate
|
||||||
* (it does not limit FPS or anything)
|
* (it does not limit FPS or anything)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -267,7 +270,7 @@ void d3d9ex_hook_init(void)
|
|||||||
log_info("Inserted graphics hooks");
|
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_windowed = gfx_config->windowed;
|
||||||
d3d9ex_window_framed = gfx_config->framed;
|
d3d9ex_window_framed = gfx_config->framed;
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ void d3d9ex_hook_init(void);
|
|||||||
*
|
*
|
||||||
* @param gfx_config Config to apply.
|
* @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
|
#endif
|
||||||
|
|||||||
@@ -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>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,19 +21,20 @@ static int boot_property_fread(uint32_t context, void *bytes, size_t nbytes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct cstring_read_handle {
|
struct cstring_read_handle {
|
||||||
const char * buffer;
|
const char *buffer;
|
||||||
size_t buffer_len;
|
size_t buffer_len;
|
||||||
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);
|
||||||
|
|
||||||
if (h->offset < h->buffer_len){
|
if (h->offset < h->buffer_len) {
|
||||||
result = min(nbytes, h->buffer_len - h->offset);
|
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;
|
h->offset += result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -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