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
Correctly apply -keepaspect with -unevenstretchx/y. Initialize window… #8209
Conversation
… at the correct size when -intscalex/y is used.
Heya, just tested this and it works great! However, there's a tiny little issue I encountered while testing in regards to intscalex and intscaley: If you launch a game, maximize the window, and then de-maximize it, the resulting window will revert to native-resolution size instead of the multiple-of-native-resolution size. (demonstration of this bug): |
src/emu/render.cpp
Outdated
|
||
// apply automatic axial stretching if required | ||
int scale_mode = m_scale_mode; | ||
if (m_scale_mode == SCALE_FRACTIONAL_AUTO) | ||
{ | ||
bool is_rotated = (m_manager.machine().system().flags & ORIENTATION_SWAP_XY) ^ (target_orientation & ORIENTATION_SWAP_XY); | ||
scale_mode = is_rotated ^ target_is_portrait ? SCALE_FRACTIONAL_Y : SCALE_FRACTIONAL_X; | ||
scale_mode = is_rotated? SCALE_FRACTIONAL_Y : SCALE_FRACTIONAL_X; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put a space before the ?
of the ternary conditional operator.
src/emu/render.cpp
Outdated
float integer_x = std::max(1.0f, float(m_int_overscan || x_fits? render_round_nearest(xscale) : floor(xscale))); | ||
float integer_y = std::max(1.0f, float(m_int_overscan || y_fits? render_round_nearest(yscale) : floor(yscale))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put a space before the ?
of the ternary conditional operator.
src/emu/render.cpp
Outdated
//float integer_x = std::max(1.0f, float(m_int_overscan? render_round_nearest(xscale) : floor(xscale))); | ||
//float integer_y = std::max(1.0f, float(m_int_overscan? render_round_nearest(yscale) : floor(yscale))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What’s this commented code for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I fixed that.
The issue reported by SuperFromND should be fixed now. |
I’d like to hold off on merging this until after 0.233 is frozen. It might all be fine, but I’d rather not risk weird interactions of options this close to release time. The current behaviour might be less-than-ideal, but it’s a known situation. Better to do this earlier in a release cycle to give us a chance to shake out any issues. |
That's perfect, thanks! |
With MAME 0.234, unevenstretchx/y and keepaspect work correctly together [1], so it's now worthwhile to increase screen resolution so more of the screen is used for games with unusual aspect ratios. This is the maximum resolution my arcade monitor supports. Also, resize splashscreen.png to higher resolution. [1] mamedev/mame#8209
… at the correct size when -intscalex/y is used.
Fixes MAME Testers bug 7213
In MAME there are 2 scaling paths:
unevenstretch: (i.e. fractional). This applies fractional scaling to both axes, with or without keeping aspect ratio. This is the classical scaling method in MAME and has never been modified. No other modifiers apply.
nounevenstretch: (i.e. integer). This applies integer scaling to both axes. Optionally, you can turn off integer scaling on one of the 2 axes (not on both o them), by specifying -unevenstretchx (-uesx) or -unevenstretchy (-uesy). Or, alternatively, -autostretchxy will apply either -unevenstretchx or -unevenstretchy automatically based on the direction of the scanlines of the original game.
The following considerations apply to nounevenstretch:
Integer factors are calculated as the maximum possible to fit in the window area or fullscreen resolution, without cropping. In order to allow cropping, -intoverscan will be used, so that the closest integer factor is applied even if it means overscan with regards to the window area or fullscreen resolution.
By using -keepaspect, integer factors on both axes are calculated so they approach the original aspect ratio as much as possible, though this funcionality is limited due to the nature of integer scaling.
In addition to this, you can use -intscalex (-sx) / -intscaley (-sy) to force custom integer factors to any of the axes, regardless of the window area. These factors lock the size on that axis once set. They also override the fuctionality of keepaspect.
What this implementation does as compared to the previous one
mame -window -uesx -ka
will force integer scaling on y, and adjust x fractionally so it meets aspect ratio. As you resize the window, y will jump by integer factors, and x will follow.mame -window -uesx -sy 2 -ka
will force integer scaling factor 2 on y, and adjust x fractionally so it meets aspect ratio. Resizing the window won't alter the visible area (it will create black borders around).Now, in windowed mode, MAME will start with the correct window size, even when integer factors are forced on command line.
Now in Windows, you don't need to hold CTRL in order to resize the window by dragging its border.
Maximizing/minimizing correctly restores the window client area to the integer scaled resolution.