1
0
mirror of https://github.com/djhackersdev/bemanitools.git synced 2025-02-22 13:10:36 +01:00

d3d9ex: add windowed position setting

This commit is contained in:
Will Xyen 2021-02-04 23:18:13 -08:00
parent 592967e191
commit 18f6d9ef70
5 changed files with 71 additions and 2 deletions

View File

@ -34,7 +34,7 @@ gfx.framed=true
# Run the game windowed # Run the game windowed
gfx.windowed=false gfx.windowed=false
# Confine mouse coursor to window # Confine mouse cursor to window
gfx.confined=false gfx.confined=false
# Windowed width, -1 for default size # Windowed width, -1 for default size
@ -43,6 +43,12 @@ gfx.window_width=-1
# Windowed height, -1 for default size # Windowed height, -1 for default size
gfx.window_height=-1 gfx.window_height=-1
# Windowed X, -1 for default X position
gfx.window_x=-1
# Windowed Y, -1 for default Y position
gfx.window_y=-1
# 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)
gfx.forced_refresh_rate=-1 gfx.forced_refresh_rate=-1

View File

@ -19,7 +19,7 @@ gfx.framed=true
# Run the game windowed # Run the game windowed
gfx.windowed=false gfx.windowed=false
# Confine mouse coursor to window # Confine mouse cursor to window
gfx.confined=false gfx.confined=false
# Windowed width, -1 for default size # Windowed width, -1 for default size
@ -28,6 +28,12 @@ gfx.window_width=1080
# Windowed height, -1 for default size # Windowed height, -1 for default size
gfx.window_height=1920 gfx.window_height=1920
# Windowed X, -1 for default X position
gfx.window_x=-1
# Windowed Y, -1 for default Y position
gfx.window_y=-1
# 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)
gfx.forced_refresh_rate=-1 gfx.forced_refresh_rate=-1

View File

@ -13,6 +13,8 @@
#define D3D9EXHOOK_CONFIG_GFX_CONFINED_KEY "gfx.confined" #define D3D9EXHOOK_CONFIG_GFX_CONFINED_KEY "gfx.confined"
#define D3D9EXHOOK_CONFIG_GFX_WINDOW_WIDTH_KEY "gfx.window_width" #define D3D9EXHOOK_CONFIG_GFX_WINDOW_WIDTH_KEY "gfx.window_width"
#define D3D9EXHOOK_CONFIG_GFX_WINDOW_HEIGHT_KEY "gfx.window_height" #define D3D9EXHOOK_CONFIG_GFX_WINDOW_HEIGHT_KEY "gfx.window_height"
#define D3D9EXHOOK_CONFIG_GFX_WINDOW_X_KEY "gfx.window_x"
#define D3D9EXHOOK_CONFIG_GFX_WINDOW_Y_KEY "gfx.window_y"
#define D3D9EXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_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_DEVICE_ADAPTER_KEY "gfx.device_adapter"
#define D3D9EXHOOK_CONFIG_GFX_FORCE_ORIENTATION_KEY "gfx.force_orientation" #define D3D9EXHOOK_CONFIG_GFX_FORCE_ORIENTATION_KEY "gfx.force_orientation"
@ -24,6 +26,8 @@
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_CONFINED_VALUE false #define D3D9EXHOOK_CONFIG_GFX_DEFAULT_CONFINED_VALUE false
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_WIDTH_VALUE -1 #define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_WIDTH_VALUE -1
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE -1 #define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE -1
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_X_VALUE -1
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_Y_VALUE -1
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE -1 #define D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCED_RR_VALUE -1
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE -1 #define D3D9EXHOOK_CONFIG_GFX_DEFAULT_DEVICE_ADAPTER_VALUE -1
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCE_ORIENTATION_VALUE -1 #define D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCE_ORIENTATION_VALUE -1
@ -62,6 +66,18 @@ void d3d9exhook_config_gfx_init(struct cconfig *config)
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE, D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE,
"Windowed height, -1 for default size"); "Windowed height, -1 for default size");
cconfig_util_set_int(
config,
D3D9EXHOOK_CONFIG_GFX_WINDOW_X_KEY,
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_X_VALUE,
"Windowed X, -1 for default X position");
cconfig_util_set_int(
config,
D3D9EXHOOK_CONFIG_GFX_WINDOW_Y_KEY,
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_Y_VALUE,
"Windowed Y, -1 for default Y position");
cconfig_util_set_int( cconfig_util_set_int(
config, config,
D3D9EXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY, D3D9EXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY,
@ -161,6 +177,30 @@ void d3d9exhook_config_gfx_get(
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE); D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_HEIGHT_VALUE);
} }
if (!cconfig_util_get_int(
config,
D3D9EXHOOK_CONFIG_GFX_WINDOW_X_KEY,
&config_gfx->window_x,
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_X_VALUE)) {
log_warning(
"Invalid value for key '%s' specified, fallback "
"to default '%d'",
D3D9EXHOOK_CONFIG_GFX_WINDOW_X_KEY,
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_X_VALUE);
}
if (!cconfig_util_get_int(
config,
D3D9EXHOOK_CONFIG_GFX_WINDOW_Y_KEY,
&config_gfx->window_y,
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_Y_VALUE)) {
log_warning(
"Invalid value for key '%s' specified, fallback "
"to default '%d'",
D3D9EXHOOK_CONFIG_GFX_WINDOW_Y_KEY,
D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOW_Y_VALUE);
}
if (!cconfig_util_get_int( if (!cconfig_util_get_int(
config, config,
D3D9EXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY, D3D9EXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY,

View File

@ -15,6 +15,8 @@ struct d3d9exhook_config_gfx {
bool confined; bool confined;
int32_t window_width; int32_t window_width;
int32_t window_height; int32_t window_height;
int32_t window_x;
int32_t window_y;
int32_t forced_refresh_rate; int32_t forced_refresh_rate;
int32_t device_adapter; int32_t device_adapter;
int32_t force_orientation; int32_t force_orientation;

View File

@ -88,6 +88,8 @@ static bool d3d9ex_confined;
static int32_t d3d9ex_force_refresh_rate = -1; static int32_t d3d9ex_force_refresh_rate = -1;
static int32_t d3d9ex_window_width = -1; static int32_t d3d9ex_window_width = -1;
static int32_t d3d9ex_window_height = -1; static int32_t d3d9ex_window_height = -1;
static int32_t d3d9ex_window_x = -1;
static int32_t d3d9ex_window_y = -1;
static bool d3d9ex_window_framed; static bool d3d9ex_window_framed;
static int32_t d3d9ex_device_adapter = -1; static int32_t d3d9ex_device_adapter = -1;
static int32_t d3d9ex_force_orientation = -1; static int32_t d3d9ex_force_orientation = -1;
@ -174,6 +176,17 @@ my_MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint)
nWidth = d3d9ex_window_width; nWidth = d3d9ex_window_width;
nHeight = d3d9ex_window_height; nHeight = d3d9ex_window_height;
} }
if (d3d9ex_window_x != -1 && d3d9ex_window_y != -1) {
log_misc(
"Overriding window position from %dx%d with %dx%d",
X,
Y,
d3d9ex_window_x,
d3d9ex_window_y);
X = d3d9ex_window_x;
Y = d3d9ex_window_y;
}
if (d3d9ex_window_framed) { if (d3d9ex_window_framed) {
/* we have to adjust the window size, because the window needs to /* we have to adjust the window size, because the window needs to
@ -458,6 +471,8 @@ void d3d9ex_configure(struct d3d9exhook_config_gfx *gfx_config)
d3d9ex_window_framed = gfx_config->framed; d3d9ex_window_framed = gfx_config->framed;
d3d9ex_window_width = gfx_config->window_width; d3d9ex_window_width = gfx_config->window_width;
d3d9ex_window_height = gfx_config->window_height; d3d9ex_window_height = gfx_config->window_height;
d3d9ex_window_x = gfx_config->window_x;
d3d9ex_window_y = gfx_config->window_y;
d3d9ex_force_refresh_rate = gfx_config->forced_refresh_rate; d3d9ex_force_refresh_rate = gfx_config->forced_refresh_rate;
d3d9ex_device_adapter = gfx_config->device_adapter; d3d9ex_device_adapter = gfx_config->device_adapter;