forked from TeamTofuShop/segatools
GFX: add dpi-awareness switch for all games (#64)
Pretty simple, adds a new config setting to the gfx category, which defaults to enabled to disable DPI scaling if a scale higher than 100% is used, causing game windows to appear stretched and blurry. Reviewed-on: TeamTofuShop/segatools#64 Co-authored-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com> Co-committed-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com>
This commit is contained in:
@ -74,8 +74,6 @@ static DWORD CALLBACK carol_pre_startup(void)
|
|||||||
HMODULE dbghelp;
|
HMODULE dbghelp;
|
||||||
|
|
||||||
dprintf("--- Begin carol_pre_startup ---\n");
|
dprintf("--- Begin carol_pre_startup ---\n");
|
||||||
if ( !SetProcessDPIAware() )
|
|
||||||
dprintf("Failed to set process DPI awareness level!\n");
|
|
||||||
|
|
||||||
/* Pin the D3D shader compiler. This makes startup much faster. */
|
/* Pin the D3D shader compiler. This makes startup much faster. */
|
||||||
|
|
||||||
|
2
dist/carol/segatools.ini
vendored
2
dist/carol/segatools.ini
vendored
@ -72,6 +72,8 @@ windowed=1
|
|||||||
framed=1
|
framed=1
|
||||||
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
|
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
|
||||||
monitor=0
|
monitor=0
|
||||||
|
; Enable DPI awareness for the game process, preventing Windows from stretching the game window if a DPI scaling higher than 100% is used
|
||||||
|
dpiAware=1
|
||||||
|
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
; Custom IO settings
|
; Custom IO settings
|
||||||
|
2
dist/chuni/segatools.ini
vendored
2
dist/chuni/segatools.ini
vendored
@ -64,6 +64,8 @@ windowed=1
|
|||||||
framed=1
|
framed=1
|
||||||
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
|
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
|
||||||
monitor=0
|
monitor=0
|
||||||
|
; Enable DPI awareness for the game process, preventing Windows from stretching the game window if a DPI scaling higher than 100% is used
|
||||||
|
dpiAware=1
|
||||||
|
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
; LED settings
|
; LED settings
|
||||||
|
2
dist/chusan/segatools.ini
vendored
2
dist/chusan/segatools.ini
vendored
@ -90,6 +90,8 @@ windowed=1
|
|||||||
framed=0
|
framed=0
|
||||||
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
|
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
|
||||||
monitor=0
|
monitor=0
|
||||||
|
; Enable DPI awareness for the game process, preventing Windows from stretching the game window if a DPI scaling higher than 100% is used
|
||||||
|
dpiAware=1
|
||||||
|
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
; LED settings
|
; LED settings
|
||||||
|
2
dist/cxb/segatools.ini
vendored
2
dist/cxb/segatools.ini
vendored
@ -83,6 +83,8 @@ windowed=1
|
|||||||
framed=1
|
framed=1
|
||||||
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
|
; Select the monitor to run the game on. (Fullscreen only, 0 =primary screen)
|
||||||
monitor=0
|
monitor=0
|
||||||
|
; Enable DPI awareness for the game process, preventing Windows from stretching the game window if a DPI scaling higher than 100% is used
|
||||||
|
dpiAware=1
|
||||||
|
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
; Custom IO settings
|
; Custom IO settings
|
||||||
|
3
dist/diva/segatools.ini
vendored
3
dist/diva/segatools.ini
vendored
@ -69,6 +69,9 @@ enable=1
|
|||||||
windowed=1
|
windowed=1
|
||||||
; Add a frame to the game window if running windowed.
|
; Add a frame to the game window if running windowed.
|
||||||
framed=0
|
framed=0
|
||||||
|
; Enable DPI awareness for the game process, preventing Windows from stretching the game window if a DPI scaling higher than 100% is used
|
||||||
|
dpiAware=1
|
||||||
|
|
||||||
|
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
; Custom IO settings
|
; Custom IO settings
|
||||||
|
2
dist/fgo/segatools.ini
vendored
2
dist/fgo/segatools.ini
vendored
@ -92,6 +92,8 @@ enable=1
|
|||||||
windowed=0
|
windowed=0
|
||||||
; Add a frame to the game window if running windowed.
|
; Add a frame to the game window if running windowed.
|
||||||
framed=0
|
framed=0
|
||||||
|
; Enable DPI awareness for the game process, preventing Windows from stretching the game window if a DPI scaling higher than 100% is used
|
||||||
|
dpiAware=1
|
||||||
|
|
||||||
[touch]
|
[touch]
|
||||||
; WinTouch emulation setting.
|
; WinTouch emulation setting.
|
||||||
|
3
dist/idz/segatools.ini
vendored
3
dist/idz/segatools.ini
vendored
@ -97,6 +97,9 @@ windowed=0
|
|||||||
framed=1
|
framed=1
|
||||||
; Select the monitor to run the game on. (Fullscreen only, 0=primary screen)
|
; Select the monitor to run the game on. (Fullscreen only, 0=primary screen)
|
||||||
monitor=0
|
monitor=0
|
||||||
|
; Enable DPI awareness for the game process, preventing Windows from stretching the game window if a DPI scaling higher than 100% is used
|
||||||
|
dpiAware=1
|
||||||
|
|
||||||
|
|
||||||
; -----------------------------------------------------------------------------
|
; -----------------------------------------------------------------------------
|
||||||
; Custom IO settings
|
; Custom IO settings
|
||||||
|
3
dist/mercury/segatools.ini
vendored
3
dist/mercury/segatools.ini
vendored
@ -76,6 +76,9 @@ dipsw1=1
|
|||||||
[gfx]
|
[gfx]
|
||||||
; Enables the graphics hook.
|
; Enables the graphics hook.
|
||||||
enable=1
|
enable=1
|
||||||
|
; Enable DPI awareness for the game process, preventing Windows from stretching the game window if a DPI scaling higher than 100% is used
|
||||||
|
dpiAware=1
|
||||||
|
|
||||||
|
|
||||||
; Hooks related to the touch boards
|
; Hooks related to the touch boards
|
||||||
[touch]
|
[touch]
|
||||||
|
3
dist/mu3/segatools.ini
vendored
3
dist/mu3/segatools.ini
vendored
@ -72,6 +72,9 @@ dipsw1=1
|
|||||||
[gfx]
|
[gfx]
|
||||||
; Enables the graphics hook.
|
; Enables the graphics hook.
|
||||||
enable=1
|
enable=1
|
||||||
|
; Enable DPI awareness for the game process, preventing Windows from stretching the game window if a DPI scaling higher than 100% is used
|
||||||
|
dpiAware=1
|
||||||
|
|
||||||
|
|
||||||
[unity]
|
[unity]
|
||||||
; Enable Unity hook. This will allow you to run custom .NET code before the game
|
; Enable Unity hook. This will allow you to run custom .NET code before the game
|
||||||
|
@ -342,6 +342,38 @@ Nu chassis DIP switch settings:
|
|||||||
- `111`: 1920x1080
|
- `111`: 1920x1080
|
||||||
- Switch 8: Game-specific. Not used in any shipping game.
|
- Switch 8: Game-specific. Not used in any shipping game.
|
||||||
|
|
||||||
|
## `[gfx]`
|
||||||
|
|
||||||
|
### `enable`
|
||||||
|
|
||||||
|
Default: `1`
|
||||||
|
|
||||||
|
Enables graphic hooks.
|
||||||
|
|
||||||
|
### `windowed`
|
||||||
|
|
||||||
|
Default: `0`
|
||||||
|
|
||||||
|
Force the game to run windowed.
|
||||||
|
|
||||||
|
### `framed`
|
||||||
|
|
||||||
|
Default: `0`
|
||||||
|
|
||||||
|
Add a frame to the game window if running windowed.
|
||||||
|
|
||||||
|
### `monitor`
|
||||||
|
|
||||||
|
Default: `0`
|
||||||
|
|
||||||
|
Select the monitor to run the game on. (Fullscreen only, 0 = primary screen)
|
||||||
|
|
||||||
|
### `dpiAware`
|
||||||
|
|
||||||
|
Default: `1`
|
||||||
|
|
||||||
|
Sets the game to be DPI-aware. This prevents Windows automatically scaling the game window by your desktop's scaling factor, which may cause blurry graphics.
|
||||||
|
|
||||||
## `[hwmon]`
|
## `[hwmon]`
|
||||||
|
|
||||||
Configure stub implementation of the platform hardware monitor driver. The
|
Configure stub implementation of the platform hardware monitor driver. The
|
||||||
|
@ -14,4 +14,5 @@ void gfx_config_load(struct gfx_config *cfg, const wchar_t *filename)
|
|||||||
cfg->windowed = GetPrivateProfileIntW(L"gfx", L"windowed", 0, filename);
|
cfg->windowed = GetPrivateProfileIntW(L"gfx", L"windowed", 0, filename);
|
||||||
cfg->framed = GetPrivateProfileIntW(L"gfx", L"framed", 1, filename);
|
cfg->framed = GetPrivateProfileIntW(L"gfx", L"framed", 1, filename);
|
||||||
cfg->monitor = GetPrivateProfileIntW(L"gfx", L"monitor", 0, filename);
|
cfg->monitor = GetPrivateProfileIntW(L"gfx", L"monitor", 0, filename);
|
||||||
|
cfg->dpiAware = GetPrivateProfileIntW(L"gfx", L"dpiAware", 1, filename);
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,14 @@ void gfx_hook_init(const struct gfx_config *cfg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cfg->dpiAware) {
|
||||||
|
if (SetProcessDPIAware()) {
|
||||||
|
dprintf("Gfx: Game process set to DPI aware.\n");
|
||||||
|
} else {
|
||||||
|
dprintf("Gfx: Failed to set process DPI aware\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(&gfx_config, cfg, sizeof(*cfg));
|
memcpy(&gfx_config, cfg, sizeof(*cfg));
|
||||||
hook_table_apply(NULL, "user32.dll", gfx_hooks, _countof(gfx_hooks));
|
hook_table_apply(NULL, "user32.dll", gfx_hooks, _countof(gfx_hooks));
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ struct gfx_config {
|
|||||||
bool windowed;
|
bool windowed;
|
||||||
bool framed;
|
bool framed;
|
||||||
int monitor;
|
int monitor;
|
||||||
|
bool dpiAware;
|
||||||
};
|
};
|
||||||
|
|
||||||
void gfx_hook_init(const struct gfx_config *cfg);
|
void gfx_hook_init(const struct gfx_config *cfg);
|
||||||
|
Reference in New Issue
Block a user