Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL: Set better default scaler for high-resolution games #3313

Merged
merged 2 commits into from Sep 2, 2021

Conversation

@eriktorbjorn
Copy link
Member

@eriktorbjorn eriktorbjorn commented Aug 26, 2021

Now that we have higher scale factors than 3, it makes sense to try and figure out a default scaler for high-resolution games that approximate the window size of a low resolution game.

That also means that we are not necessarily restricted to the normal scaler, since AdvMame has both 2x and 4x versions.

Since my own default scaler is Normal 3x, this change won't affect me much personally, though.

Now that we have higher scale factors than 3, it makes sense to try and
figure out a default scaler for high-resolution games that approximate
the window size of a low resolution game.

That also means that we are not necessarily restricted to the normal
scaler, since AdvMame has both 2x and 4x versions.

// Only the normal scaler has a 1x mode.
if (scaleFactor == 1)
mode = ScalerMan.findScalerPluginIndex("normal");

This comment has been minimized.

@criezy

criezy Aug 28, 2021
Member

Maybe replace this special case for the factor 1 with a more robust check that the factor exists for the current scaler?

This is not tested, but I think it would look like this:

const Common::Array<uint> &factors = _scalerPlugins[mode]->get<ScalerPluginObject>().getFactors();
if (Common::find(factors.begin(), factors.end(), scaleFactor) == factors.end())
	mode = ScalerMan.findScalerPluginIndex("normal");

I think your code probably works with all the currently existing scaler plugins and supported game resolutions. So this is a suggestion to make is more future-proof rather than to fix an existing issue.

This comment has been minimized.

@eriktorbjorn

eriktorbjorn Aug 29, 2021
Author Member

Sounds reasonable, and seems to work. (I get the idea of your implementation, but I'm not fluent in that kind of C++ trickery so I'm copying your implementation of it.)

Instead of falling back to the normal scaler if the new scale factor is
1, explicitly check if the desired scaler is available at the new scale
factor. Suggested by criezy, and I'm shamelessly copying his
implementation because this sort of C++ trickery is something I'm not
fluent in.

At the moment, this shouldn't make any difference. But I guess in the
future, there may be a scaler that's available at 3x and 4x, but not 2x,
or something like that.
@sev-
Copy link
Member

@sev- sev- commented Sep 2, 2021

Thank you!

@sev- sev- merged commit 9df1052 into scummvm:master Sep 2, 2021
7 checks passed
7 checks passed
@github-actions
Windows (win32, x86-windows, x86, --enable-faad --enable-mpeg2 --enable-discord, curl discord-rpc...
Details
@github-actions
Windows (x64, x64, x64-windows, --enable-faad --enable-mpeg2 --enable-discord, curl discord-rpc f...
Details
@github-actions
Windows (arm64, arm64, arm64-windows, --enable-faad --enable-mpeg2 --enable-discord --disable-fri...
Details
@github-actions
Xcode (macosx, -scheme ScummVM-macOS, --disable-nasm --enable-faad --enable-mpeg2, a52dec faad2 f...
Details
@github-actions
Xcode (ios7, -scheme ScummVM-iOS CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO, --disable-nasm --...
Details
@github-actions
Ubuntu (ubuntu-latest, sdl2-config, --enable-c++11, libsdl2-dev libsdl2-net-dev liba52-dev libjpe...
Details
@github-actions
Ubuntu (ubuntu-18.04, sdl-config, --disable-c++11, libsdl1.2-dev libsdl-net1.2-dev liba52-dev lib...
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants