mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-25 01:57:47 +01:00
add new "center_window" setting
This commit is contained in:
parent
f6b92bb80f
commit
57287686db
@ -42,6 +42,7 @@ typedef struct CNCDDRAWCONFIG
|
|||||||
int d3d9_filter;
|
int d3d9_filter;
|
||||||
int anti_aliased_fonts_min_size;
|
int anti_aliased_fonts_min_size;
|
||||||
int min_font_size;
|
int min_font_size;
|
||||||
|
int center_window;
|
||||||
BOOL vhack;
|
BOOL vhack;
|
||||||
char screenshot_dir[MAX_PATH];
|
char screenshot_dir[MAX_PATH];
|
||||||
BOOL toggle_borderless;
|
BOOL toggle_borderless;
|
||||||
|
4
inc/dd.h
4
inc/dd.h
@ -52,6 +52,10 @@ HRESULT dd_CreateEx(GUID* lpGuid, LPVOID* lplpDD, REFIID iid, IUnknown* pUnkOute
|
|||||||
#define LIMIT_BLTFAST 2
|
#define LIMIT_BLTFAST 2
|
||||||
#define LIMIT_UNLOCK 3
|
#define LIMIT_UNLOCK 3
|
||||||
|
|
||||||
|
#define CENTER_WINDOW_NEVER 0
|
||||||
|
#define CENTER_WINDOW_AUTO 1
|
||||||
|
#define CENTER_WINDOW_ALWAYS 2
|
||||||
|
|
||||||
#ifndef CREATE_WAITABLE_TIMER_HIGH_RESOLUTION
|
#ifndef CREATE_WAITABLE_TIMER_HIGH_RESOLUTION
|
||||||
#define CREATE_WAITABLE_TIMER_HIGH_RESOLUTION 0x00000002
|
#define CREATE_WAITABLE_TIMER_HIGH_RESOLUTION 0x00000002
|
||||||
#endif
|
#endif
|
||||||
|
@ -54,6 +54,7 @@ void cfg_load()
|
|||||||
GET_INT(g_config.d3d9_filter, "d3d9_filter", FILTER_CUBIC);
|
GET_INT(g_config.d3d9_filter, "d3d9_filter", FILTER_CUBIC);
|
||||||
GET_INT(g_config.anti_aliased_fonts_min_size, "anti_aliased_fonts_min_size", 13);
|
GET_INT(g_config.anti_aliased_fonts_min_size, "anti_aliased_fonts_min_size", 13);
|
||||||
GET_INT(g_config.min_font_size, "min_font_size", 0);
|
GET_INT(g_config.min_font_size, "min_font_size", 0);
|
||||||
|
GET_INT(g_config.center_window, "center_window", CENTER_WINDOW_AUTO);
|
||||||
GET_BOOL(g_config.vhack, "vhack", FALSE);
|
GET_BOOL(g_config.vhack, "vhack", FALSE);
|
||||||
GET_STRING("screenshotdir", ".\\Screenshots\\", g_config.screenshot_dir, sizeof(g_config.screenshot_dir));
|
GET_STRING("screenshotdir", ".\\Screenshots\\", g_config.screenshot_dir, sizeof(g_config.screenshot_dir));
|
||||||
GET_BOOL(g_config.toggle_borderless, "toggle_borderless", FALSE);
|
GET_BOOL(g_config.toggle_borderless, "toggle_borderless", FALSE);
|
||||||
@ -250,6 +251,10 @@ static void cfg_create_ini()
|
|||||||
"; Raise the size of small fonts to X\n"
|
"; Raise the size of small fonts to X\n"
|
||||||
"min_font_size=0\n"
|
"min_font_size=0\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
"; Center window to screen when game changes the display resolution\n"
|
||||||
|
"; Possible values: 0 = never center, 1 = automatic, 2 = always center\n"
|
||||||
|
"center_window=1\n"
|
||||||
|
"\n"
|
||||||
"; Enable upscale hack for high resolution patches (Supports C&C1, Red Alert 1, Worms 2 and KKND Xtreme)\n"
|
"; Enable upscale hack for high resolution patches (Supports C&C1, Red Alert 1, Worms 2 and KKND Xtreme)\n"
|
||||||
"vhack=false\n"
|
"vhack=false\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
9
src/dd.c
9
src/dd.c
@ -710,9 +710,14 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
|
|||||||
g_ddraw.render.height = g_config.window_rect.bottom;
|
g_ddraw.render.height = g_config.window_rect.bottom;
|
||||||
|
|
||||||
/* temporary fix: center window for games that keep changing their resolution */
|
/* temporary fix: center window for games that keep changing their resolution */
|
||||||
if ((g_ddraw.width || g_config.infantryhack) &&
|
if (g_config.center_window &&
|
||||||
|
(g_ddraw.width || g_config.infantryhack || g_config.center_window == CENTER_WINDOW_ALWAYS) &&
|
||||||
(g_ddraw.width != dwWidth || g_ddraw.height != dwHeight) &&
|
(g_ddraw.width != dwWidth || g_ddraw.height != dwHeight) &&
|
||||||
(dwWidth > g_config.window_rect.right || dwHeight > g_config.window_rect.bottom))
|
(
|
||||||
|
dwWidth > g_config.window_rect.right ||
|
||||||
|
dwHeight > g_config.window_rect.bottom ||
|
||||||
|
g_config.center_window == CENTER_WINDOW_ALWAYS)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
g_config.window_rect.left = -32000;
|
g_config.window_rect.left = -32000;
|
||||||
g_config.window_rect.top = -32000;
|
g_config.window_rect.top = -32000;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user