mirror of https://github.com/stella-emu/stella.git
Make sure fullscreen TIA modes actually use real fullscreen dimensions.
Previously, they would sometimes use desktop dimensions, and on current versions of SDL, this would exclude areas meant for taskbars, etc. So the resulting image was smaller than it should have been.
This commit is contained in:
parent
efb196224a
commit
36da2bcabc
|
@ -29,6 +29,9 @@
|
|||
- delayed player 1 swap
|
||||
- stuffed player move
|
||||
|
||||
* Fullscreen TIA modes no longer assume that desktop taskbars, etc
|
||||
are present, hence they are scaled to the proper fullscreen size.
|
||||
|
||||
* Added proper Retron77 port. (TODO: doc)
|
||||
|
||||
* Reworked ROM properties database, making it load faster in certain
|
||||
|
|
|
@ -82,27 +82,38 @@ FrameBufferSDL2::~FrameBufferSDL2()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferSDL2::queryHardware(vector<GUI::Size>& displays,
|
||||
void FrameBufferSDL2::queryHardware(vector<GUI::Size>& fullscreenRes,
|
||||
vector<GUI::Size>& windowedRes,
|
||||
VariantList& renderers)
|
||||
{
|
||||
ASSERT_MAIN_THREAD;
|
||||
|
||||
// First get the maximum windowed desktop resolution
|
||||
// Get number of displays (for most systems, this will be '1')
|
||||
int maxDisplays = SDL_GetNumVideoDisplays();
|
||||
|
||||
// First get the maximum fullscreen desktop resolution
|
||||
SDL_DisplayMode display;
|
||||
for(int i = 0; i < maxDisplays; ++i)
|
||||
{
|
||||
SDL_GetDesktopDisplayMode(i, &display);
|
||||
fullscreenRes.emplace_back(display.w, display.h);
|
||||
}
|
||||
|
||||
// Now get the maximum windowed desktop resolution
|
||||
// Try to take into account taskbars, etc, if available
|
||||
#if SDL_VERSION_ATLEAST(2,0,5)
|
||||
SDL_Rect r;
|
||||
for(int i = 0; i < maxDisplays; ++i)
|
||||
{
|
||||
// Display bounds minus dock
|
||||
SDL_GetDisplayUsableBounds(i, &r); // Requires SDL-2.0.5 or higher
|
||||
displays.emplace_back(r.w, r.h);
|
||||
windowedRes.emplace_back(r.w, r.h);
|
||||
}
|
||||
#else
|
||||
SDL_DisplayMode display;
|
||||
for(int i = 0; i < maxDisplays; ++i)
|
||||
{
|
||||
SDL_GetDesktopDisplayMode(i, &display);
|
||||
displays.emplace_back(display.w, display.h);
|
||||
windowedRes.emplace_back(display.w, display.h);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -108,9 +108,16 @@ class FrameBufferSDL2 : public FrameBuffer
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
This method is called to query and initialize the video hardware
|
||||
for desktop and fullscreen resolution information.
|
||||
for desktop and fullscreen resolution information. Since several
|
||||
monitors may be attached, we need the resolution for all of them.
|
||||
|
||||
@param fullscreenRes Maximum resolution supported in fullscreen mode
|
||||
@param windowedRes Maximum resolution supported in windowed mode
|
||||
@param renderers List of renderer names (internal name -> end-user name)
|
||||
*/
|
||||
void queryHardware(vector<GUI::Size>& displays, VariantList& renderers) override;
|
||||
void queryHardware(vector<GUI::Size>& fullscreenRes,
|
||||
vector<GUI::Size>& windowedRes,
|
||||
VariantList& renderers) override;
|
||||
|
||||
/**
|
||||
This method is called to query the video hardware for the index
|
||||
|
|
|
@ -63,8 +63,9 @@ FrameBuffer::~FrameBuffer()
|
|||
bool FrameBuffer::initialize()
|
||||
{
|
||||
// Get desktop resolution and supported renderers
|
||||
queryHardware(myDisplays, myRenderers);
|
||||
uInt32 query_w = myDisplays[0].w, query_h = myDisplays[0].h;
|
||||
vector<GUI::Size> windowedDisplays;
|
||||
queryHardware(myFullscreenDisplays, windowedDisplays, myRenderers);
|
||||
uInt32 query_w = windowedDisplays[0].w, query_h = windowedDisplays[0].h;
|
||||
|
||||
// Check the 'maxres' setting, which is an undocumented developer feature
|
||||
// that specifies the desktop size (not normally set)
|
||||
|
@ -815,7 +816,7 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
|
|||
|
||||
for(auto& mode: myFullscreenModeLists)
|
||||
mode.clear();
|
||||
for(size_t i = myFullscreenModeLists.size(); i < myDisplays.size(); ++i)
|
||||
for(size_t i = myFullscreenModeLists.size(); i < myFullscreenDisplays.size(); ++i)
|
||||
myFullscreenModeLists.push_back(VideoModeList());
|
||||
|
||||
// Check if zooming is allowed for this state (currently only allowed
|
||||
|
@ -851,21 +852,21 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
|
|||
}
|
||||
|
||||
// TIA fullscreen mode
|
||||
for(uInt32 i = 0; i < myDisplays.size(); ++i)
|
||||
for(uInt32 i = 0; i < myFullscreenDisplays.size(); ++i)
|
||||
{
|
||||
maxZoom = maxWindowSizeForScreen(baseWidth, baseHeight,
|
||||
myDisplays[i].w, myDisplays[i].h);
|
||||
myFullscreenDisplays[i].w, myFullscreenDisplays[i].h);
|
||||
|
||||
// Add both normal aspect and filled modes
|
||||
// It's easier to define them both now, and simply switch between
|
||||
// them when necessary
|
||||
VideoMode mode1(baseWidth*maxZoom, baseHeight*maxZoom,
|
||||
myDisplays[i].w, myDisplays[i].h,
|
||||
myFullscreenDisplays[i].w, myFullscreenDisplays[i].h,
|
||||
VideoMode::Stretch::Preserve,
|
||||
"Preserve aspect, no stretch", maxZoom, i);
|
||||
myFullscreenModeLists[i].add(mode1);
|
||||
VideoMode mode2(baseWidth*maxZoom, baseHeight*maxZoom,
|
||||
myDisplays[i].w, myDisplays[i].h,
|
||||
myFullscreenDisplays[i].w, myFullscreenDisplays[i].h,
|
||||
VideoMode::Stretch::Fill,
|
||||
"Ignore aspect, full stretch", maxZoom, i);
|
||||
myFullscreenModeLists[i].add(mode2);
|
||||
|
@ -877,10 +878,10 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
|
|||
myWindowedModeList.add(
|
||||
VideoMode(baseWidth, baseHeight, baseWidth, baseHeight, VideoMode::Stretch::Fill)
|
||||
);
|
||||
for(uInt32 i = 0; i < myDisplays.size(); ++i)
|
||||
for(uInt32 i = 0; i < myFullscreenDisplays.size(); ++i)
|
||||
{
|
||||
myFullscreenModeLists[i].add(
|
||||
VideoMode(baseWidth, baseHeight, myDisplays[i].w, myDisplays[i].h,
|
||||
VideoMode(baseWidth, baseHeight, myFullscreenDisplays[i].w, myFullscreenDisplays[i].h,
|
||||
VideoMode::Stretch::Fill, "", 1, i)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -324,9 +324,16 @@ class FrameBuffer
|
|||
protected:
|
||||
/**
|
||||
This method is called to query and initialize the video hardware
|
||||
for desktop and fullscreen resolution information.
|
||||
for desktop and fullscreen resolution information. Since several
|
||||
monitors may be attached, we need the resolution for all of them.
|
||||
|
||||
@param fullscreenRes Maximum resolution supported in fullscreen mode
|
||||
@param windowedRes Maximum resolution supported in windowed mode
|
||||
@param renderers List of renderer names (internal name -> end-user name)
|
||||
*/
|
||||
virtual void queryHardware(vector<GUI::Size>& mons, VariantList& ren) = 0;
|
||||
virtual void queryHardware(vector<GUI::Size>& fullscreenRes,
|
||||
vector<GUI::Size>& windowedRes,
|
||||
VariantList& renderers) = 0;
|
||||
|
||||
virtual Int32 getCurrentDisplayIndex() = 0;
|
||||
|
||||
|
@ -491,9 +498,10 @@ class FrameBuffer
|
|||
// Maximum dimensions of the desktop area
|
||||
GUI::Size myDesktopSize;
|
||||
|
||||
// The resolution of the attached displays
|
||||
// The primary display is first in the array
|
||||
vector<GUI::Size> myDisplays;
|
||||
// The resolution of the attached displays in fullscreen mode
|
||||
// The primary display is typically the first in the array
|
||||
// Windowed modes use myDesktopSize directly
|
||||
vector<GUI::Size> myFullscreenDisplays;
|
||||
|
||||
// Supported renderers
|
||||
VariantList myRenderers;
|
||||
|
|
|
@ -30,9 +30,12 @@ FrameBufferLIBRETRO::FrameBufferLIBRETRO(OSystem& osystem)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferLIBRETRO::queryHardware(vector<GUI::Size>& displays, VariantList& renderers)
|
||||
void FrameBufferLIBRETRO::queryHardware(vector<GUI::Size>& fullscreenRes,
|
||||
vector<GUI::Size>& windowedRes,
|
||||
VariantList& renderers)
|
||||
{
|
||||
displays.emplace_back(1920, 1080);
|
||||
fullscreenRes.emplace_back(1920, 1080);
|
||||
windowedRes.emplace_back(1920, 1080);
|
||||
|
||||
VarList::push_back(renderers, "software", "Software");
|
||||
}
|
||||
|
@ -41,12 +44,12 @@ void FrameBufferLIBRETRO::queryHardware(vector<GUI::Size>& displays, VariantList
|
|||
unique_ptr<FBSurface>
|
||||
FrameBufferLIBRETRO::createSurface(uInt32 w, uInt32 h, const uInt32* data) const
|
||||
{
|
||||
unique_ptr<FBSurface> ptr = make_unique<FBSurfaceLIBRETRO>(const_cast<FrameBufferLIBRETRO&>(*this), w, h, data);
|
||||
unique_ptr<FBSurface> ptr = make_unique<FBSurfaceLIBRETRO>
|
||||
(const_cast<FrameBufferLIBRETRO&>(*this), w, h, data);
|
||||
|
||||
if(w == 565 && h == 320)
|
||||
{
|
||||
uInt32 pitch;
|
||||
|
||||
ptr.get()->basePtr(myRenderSurface, pitch);
|
||||
}
|
||||
|
||||
|
|
|
@ -104,9 +104,16 @@ class FrameBufferLIBRETRO : public FrameBuffer
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
This method is called to query and initialize the video hardware
|
||||
for desktop and fullscreen resolution information.
|
||||
for desktop and fullscreen resolution information. Since several
|
||||
monitors may be attached, we need the resolution for all of them.
|
||||
|
||||
@param fullscreenRes Maximum resolution supported in fullscreen mode
|
||||
@param windowedRes Maximum resolution supported in windowed mode
|
||||
@param renderers List of renderer names (internal name -> end-user name)
|
||||
*/
|
||||
void queryHardware(vector<GUI::Size>& displays, VariantList& renderers) override;
|
||||
void queryHardware(vector<GUI::Size>& fullscreenRes,
|
||||
vector<GUI::Size>& windowedRes,
|
||||
VariantList& renderers) override;
|
||||
|
||||
/**
|
||||
This method is called to query the video hardware for the index
|
||||
|
|
Loading…
Reference in New Issue