graphics: rewrite image scaler (#278)

## Link to GitHub Issue, if one exists
Fixes #276 

## Description of change

Note: this change is not compatible with previous screen resize config;
i.e., if you had the zoom setting dialed into a certain view, after this
change it won't be the same area, so you'll have to set up a scene
again. I think this is a worthwhile cost since the old logic is just
broken in weird ways, and preserving old settings is really tedious math
(for a feature that not many people use). Besides, this change will only
use the new Scenes values from the JSON.

Rewrite the DX9 image scaler logic.

* Previously, the rendering surface was fixed at `4096*4096 px`. Now,
this is relative to the backbuffer dimensions, which depends on the game
& respects user provided `-forceres`.
* Remove "center" option, make it the default.

Above two changes fix the aspect ratio issue (scaling in portrait games
not respecting screen ratio) and things breaking at higher res (1080p
when zoomed out far enough, or when forced to run at 4k resolution for
example)

* Use `scenes` leaf of screen resize JSON config for Scene 1 as well,
completely removing ourselves from being compatible with older spice2x
versions for these values.
* Add additional bounds check before calling `StretchRect` to avoid
users getting stuck with a bad layout, which can kill performance.

## Compiling
🦾 

## Testing
Tested 32 bit (popn / ddr), 64 bit (ldj), portrait and landscape modes
(kfc)
This commit is contained in:
bicarus-dev
2025-03-28 17:23:01 -07:00
committed by GitHub
parent 45a52cff90
commit 104a9cbffd
11 changed files with 200 additions and 87 deletions
+13 -3
View File
@@ -218,6 +218,17 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
.setting_name = "1280,720",
.category = "Graphics (Full Screen)"
},
{
// FullscreenOrientationFlip
.title = "Full Screen Orientation Swap",
.name = "forceresswap",
.desc =
"Allows you to play portrait games in in landscape (and vice versa) by transposing resolution and applying image scaling.\n\n"
"Works great for some games, but can COMPLETELY BREAK other games - YMMV!\n\n"
"Strongly consider combining this with -forceres option to render at monitor native resolution",
.type = OptionType::Bool,
.category = "Graphics (Full Screen)"
},
{
// Graphics9On12
.title = "DirectX 9 on 12 (DEPRECATED - use -dx9on12 instead)",
@@ -2039,9 +2050,8 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
.name = "sdvxlandscape",
.desc =
"Allows you to play in landscape by transposing resolution and applying image scaling.\n\n"
"Only for SDVX5 and above!\n\n"
"Can also be combined with -forceres option to render at larger or smaller resolution, "
"and with image resize option to zoom into certain areas of the screen",
"Works only for SDVX5 and above! This is identical to -forceorientation.\n\n"
"Will launch at 1080p by default; strongly consider combining this with -forceres option to render at monitor native resolution",
.type = OptionType::Bool,
.game_name = "Sound Voltex",
.category = "Game Options"