Applied multi-monitor fix from Magnus Lind.

Bumped version # for 4.1 release.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2987 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-09-01 21:17:33 +00:00
parent adce15f86e
commit 8c3c668276
10 changed files with 111 additions and 38 deletions

View File

@ -12,7 +12,7 @@
Release History
===========================================================================
4.0 to 4.1: (September xx, 2014)
4.0 to 4.1: (September 1, 2014)
* Improved 'DASH' bankswitching scheme support; there is now a debugger
tab for changing banks and viewing internal cart RAM, and
@ -25,9 +25,13 @@
scaled to the available space, and can better accommodate sizes
other than those generated by Stella itself.
* Improved support on multi-monitor systems. Stella will now use the
same monitor for fullscreen-windowed mode switches. Special thanks
to Magnus Lind for patches that added this functionality.
* Removed the 'bank' command from the debugger prompt, as it only worked
with certain bankswitch types. The bankswitch UI should now be used
to query/set bank state.
(inconsistently) with certain bankswitch types. The bankswitch UI
should now be used to query/set bank state.
* Fixed bug in disassembly output; instructions at $F000 were never
being highlighted during execution.

2
debian/changelog vendored
View File

@ -2,7 +2,7 @@ stella (4.1-1) stable; urgency=high
* Version 4.1 release
-- Stephen Anthony <stephena@users.sf.net> Sun, 31 Aug 2014 20:43:06 -0230
-- Stephen Anthony <stephena@users.sf.net> Mon, 01 Sep 2014 17:44:38 -0230
stella (4.0-1) stable; urgency=high

View File

@ -78,13 +78,17 @@ FrameBufferSDL2::~FrameBufferSDL2()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL2::queryHardware(uInt32& w, uInt32& h, VariantList& renderers)
void FrameBufferSDL2::queryHardware(Common::Array<GUI::Size>& displays,
VariantList& renderers)
{
// First get the maximum windowed desktop resolution
SDL_DisplayMode desktop;
SDL_GetDesktopDisplayMode(0, &desktop);
w = desktop.w;
h = desktop.h;
SDL_DisplayMode display;
int maxDisplays = SDL_GetNumVideoDisplays();
for(int i = 0; i < maxDisplays; ++i)
{
SDL_GetDesktopDisplayMode(i, &display);
displays.push_back(GUI::Size(display.w, display.h));
}
// For now, supported render types are hardcoded; eventually, SDL may
// provide a method to query this
@ -97,6 +101,12 @@ void FrameBufferSDL2::queryHardware(uInt32& w, uInt32& h, VariantList& renderers
renderers.push_back("Software", "software");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Int32 FrameBufferSDL2::getCurrentDisplayIndex()
{
return SDL_GetWindowDisplayIndex(myWindow);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferSDL2::setVideoMode(const string& title, const VideoMode& mode,
bool /*fullscreen_toggle*/)
@ -116,9 +126,26 @@ bool FrameBufferSDL2::setVideoMode(const string& title, const VideoMode& mode,
myRenderer = NULL;
}
Int32 displayIndex = mode.fsIndex;
if(displayIndex == -1)
{
// windowed mode
if (myWindow)
{
// Show it on same screen as the previous window
displayIndex = SDL_GetWindowDisplayIndex(myWindow);
}
if(displayIndex < 0)
{
// fallback to the first screen
displayIndex = 0;
}
}
uInt32 pos = myOSystem.settings().getBool("center")
? SDL_WINDOWPOS_CENTERED : SDL_WINDOWPOS_UNDEFINED;
uInt32 flags = mode.fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0;
? SDL_WINDOWPOS_CENTERED_DISPLAY(displayIndex)
: SDL_WINDOWPOS_UNDEFINED_DISPLAY(displayIndex);
uInt32 flags = mode.fsIndex != -1 ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0;
// OSX seems to have issues with destroying the window, and wants to keep
// the same handle

View File

@ -115,7 +115,16 @@ class FrameBufferSDL2 : public FrameBuffer
This method is called to query and initialize the video hardware
for desktop and fullscreen resolution information.
*/
void queryHardware(uInt32& w, uInt32& h, VariantList& renderers);
void queryHardware(Common::Array<GUI::Size>& displays, VariantList& renderers);
/**
This method is called to query the video hardware for the index
of the display the current window is displayed on
@return the current display index or a negative value if no
window is displayed
*/
Int32 getCurrentDisplayIndex();
/**
This method is called to change to the given video mode.

View File

@ -22,7 +22,7 @@
#include <cstdlib>
#define STELLA_VERSION "4.1_beta1"
#define STELLA_VERSION "4.1"
#define STELLA_BUILD atoi("$Rev$" + 6)
#endif

View File

@ -78,7 +78,9 @@ bool FrameBuffer::initialize()
{
// Get desktop resolution and supported renderers
uInt32 query_w, query_h;
queryHardware(query_w, query_h, myRenderers);
queryHardware(myDisplays, myRenderers);
query_w = myDisplays[0].w;
query_h = myDisplays[0].h;
// Check the 'maxres' setting, which is an undocumented developer feature
// that specifies the desktop size (not normally set)
@ -741,7 +743,11 @@ uInt32 FrameBuffer::maxWindowSizeForScreen(uInt32 baseWidth, uInt32 baseHeight,
void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
{
myWindowedModeList.clear();
myFullscreenModeList.clear();
for(uInt32 i = 0; i < myFullscreenModeLists.size(); ++i)
myFullscreenModeLists[i].clear();
for(uInt32 i = myFullscreenModeLists.size(); i < myDisplays.size(); ++i)
myFullscreenModeLists.push_back(VideoModeList());
// Check if zooming is allowed for this state (currently only allowed
// for TIA screens)
@ -772,26 +778,34 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
desc << "Zoom " << zoom << "x";
VideoMode mode(baseWidth*zoom, baseHeight*zoom,
baseWidth*zoom, baseHeight*zoom, false, zoom, desc.str());
baseWidth*zoom, baseHeight*zoom, -1, zoom, desc.str());
mode.applyAspectCorrection(aspect);
myWindowedModeList.add(mode);
}
// TIA fullscreen mode
VideoMode mode(baseWidth*maxZoom, baseHeight*maxZoom,
myDesktopSize.w, myDesktopSize.h, true);
mode.applyAspectCorrection(aspect, myOSystem.settings().getBool("tia.fsfill"));
myFullscreenModeList.add(mode);
for(uInt32 i = 0; i < myDisplays.size(); ++i)
{
maxZoom = maxWindowSizeForScreen(baseWidth, baseHeight,
myDisplays[i].w, myDisplays[i].h);
VideoMode mode(baseWidth*maxZoom, baseHeight*maxZoom,
myDisplays[i].w, myDisplays[i].h, i);
mode.applyAspectCorrection(aspect, myOSystem.settings().getBool("tia.fsfill"));
myFullscreenModeLists[i].add(mode);
}
}
else // UI mode
{
// Windowed and fullscreen mode differ only in screen size
myWindowedModeList.add(
VideoMode(baseWidth, baseHeight, baseWidth, baseHeight, false)
);
myFullscreenModeList.add(
VideoMode(baseWidth, baseHeight, myDesktopSize.w, myDesktopSize.h, true)
VideoMode(baseWidth, baseHeight, baseWidth, baseHeight, -1)
);
for(uInt32 i = 0; i < myDisplays.size(); ++i)
{
myFullscreenModeLists[i].add(
VideoMode(baseWidth, baseHeight, myDisplays[i].w, myDisplays[i].h, i)
);
}
}
}
@ -801,7 +815,15 @@ const VideoMode& FrameBuffer::getSavedVidMode(bool fullscreen)
EventHandler::State state = myOSystem.eventHandler().state();
if(fullscreen)
myCurrentModeList = &myFullscreenModeList;
{
Int32 i = getCurrentDisplayIndex();
if(i < 0)
{
// default to the first display
i = 0;
}
myCurrentModeList = &myFullscreenModeLists[i];
}
else
myCurrentModeList = &myWindowedModeList;
@ -822,7 +844,7 @@ const VideoMode& FrameBuffer::getSavedVidMode(bool fullscreen)
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
VideoMode::VideoMode()
: fullscreen(false),
: fsIndex(-1),
zoom(1),
description("")
{
@ -830,8 +852,8 @@ VideoMode::VideoMode()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
VideoMode::VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
bool full, uInt32 z, const string& desc)
: fullscreen(full),
Int32 full, uInt32 z, const string& desc)
: fsIndex(full),
zoom(z),
description(desc)
{
@ -852,7 +874,7 @@ void VideoMode::applyAspectCorrection(uInt32 aspect, bool stretch)
uInt32 iw = (uInt32)(float(image.width() * aspect) / 100.0);
uInt32 ih = image.height();
if(fullscreen)
if(fsIndex != -1)
{
// Fullscreen mode stretching
float stretchFactor = 1.0;

View File

@ -97,19 +97,19 @@ class VideoMode
public:
GUI::Rect image;
GUI::Size screen;
bool fullscreen;
Int32 fsIndex;
uInt32 zoom;
string description;
public:
VideoMode();
VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, bool full,
VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, Int32 full,
uInt32 z = 1, const string& desc = "");
friend ostream& operator<<(ostream& os, const VideoMode& vm)
{
os << "image=" << vm.image << " screen=" << vm.screen
<< " full= " << vm.fullscreen << " zoom=" << vm.zoom
<< " full= " << vm.fsIndex << " zoom=" << vm.zoom
<< " desc=" << vm.description;
return os;
}
@ -368,7 +368,9 @@ class FrameBuffer
This method is called to query and initialize the video hardware
for desktop and fullscreen resolution information.
*/
virtual void queryHardware(uInt32& w, uInt32& h, VariantList& ren) = 0;
virtual void queryHardware(Common::Array<GUI::Size>& mons, VariantList& ren) = 0;
virtual Int32 getCurrentDisplayIndex() = 0;
/**
This method is called to change to the given video mode.
@ -530,6 +532,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
Common::Array<GUI::Size> myDisplays;
// Supported renderers
VariantList myRenderers;
@ -563,9 +569,9 @@ class FrameBuffer
Message myStatsMsg;
// The list of all available video modes for this framebuffer
VideoModeList myWindowedModeList;
VideoModeList myFullscreenModeList;
VideoModeList* myCurrentModeList;
VideoModeList myWindowedModeList;
Common::Array<VideoModeList> myFullscreenModeLists;
// Names of the TIA zoom levels that can be used for this framebuffer
VariantList myTIAZoomLevels;

View File

@ -17,6 +17,8 @@
// $Id$
//============================================================================
#include <cmath>
#include "FrameBuffer.hxx"
#include "Settings.hxx"
#include "OSystem.hxx"

View File

@ -102,6 +102,9 @@ rm -rf $RPM_BUILD_DIR/%{name}-%{version}
%_datadir/icons/large/%{name}.png
%changelog
* Min Sep 1 2014 Stephen Anthony <stephena@users.sf.net> 4.1-1
- Version 4.1 release
* Tue Jul 1 2014 Stephen Anthony <stephena@users.sf.net> 4.0-1
- Version 4.0 release

View File

@ -190,7 +190,7 @@ local gzFile gz_open(
/* save the path name for error messages */
#ifdef _WIN32
if (fd == -2) {
len = wcstombs(NULL, path, 0);
len = wcstombs(NULL, (const wchar_t *)path, 0);
if (len == (size_t)-1)
len = 0;
}
@ -205,7 +205,7 @@ local gzFile gz_open(
#ifdef _WIN32
if (fd == -2)
if (len)
wcstombs(state->path, path, len + 1);
wcstombs(state->path, (const wchar_t *)path, len + 1);
else
*(state->path) = 0;
else
@ -240,7 +240,7 @@ local gzFile gz_open(
/* open the file with the appropriate flags (or just use fd) */
state->fd = fd > -1 ? fd : (
#ifdef _WIN32
fd == -2 ? _wopen(path, oflag, 0666) :
fd == -2 ? _wopen((const wchar_t *)path, oflag, 0666) :
#endif
open((const char *)path, oflag, 0666));
if (state->fd == -1) {