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 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 * Improved 'DASH' bankswitching scheme support; there is now a debugger
tab for changing banks and viewing internal cart RAM, and tab for changing banks and viewing internal cart RAM, and
@ -25,9 +25,13 @@
scaled to the available space, and can better accommodate sizes scaled to the available space, and can better accommodate sizes
other than those generated by Stella itself. 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 * Removed the 'bank' command from the debugger prompt, as it only worked
with certain bankswitch types. The bankswitch UI should now be used (inconsistently) with certain bankswitch types. The bankswitch UI
to query/set bank state. should now be used to query/set bank state.
* Fixed bug in disassembly output; instructions at $F000 were never * Fixed bug in disassembly output; instructions at $F000 were never
being highlighted during execution. 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 * 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 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 // First get the maximum windowed desktop resolution
SDL_DisplayMode desktop; SDL_DisplayMode display;
SDL_GetDesktopDisplayMode(0, &desktop); int maxDisplays = SDL_GetNumVideoDisplays();
w = desktop.w; for(int i = 0; i < maxDisplays; ++i)
h = desktop.h; {
SDL_GetDesktopDisplayMode(i, &display);
displays.push_back(GUI::Size(display.w, display.h));
}
// For now, supported render types are hardcoded; eventually, SDL may // For now, supported render types are hardcoded; eventually, SDL may
// provide a method to query this // provide a method to query this
@ -97,6 +101,12 @@ void FrameBufferSDL2::queryHardware(uInt32& w, uInt32& h, VariantList& renderers
renderers.push_back("Software", "software"); renderers.push_back("Software", "software");
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Int32 FrameBufferSDL2::getCurrentDisplayIndex()
{
return SDL_GetWindowDisplayIndex(myWindow);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferSDL2::setVideoMode(const string& title, const VideoMode& mode, bool FrameBufferSDL2::setVideoMode(const string& title, const VideoMode& mode,
bool /*fullscreen_toggle*/) bool /*fullscreen_toggle*/)
@ -116,9 +126,26 @@ bool FrameBufferSDL2::setVideoMode(const string& title, const VideoMode& mode,
myRenderer = NULL; 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") uInt32 pos = myOSystem.settings().getBool("center")
? SDL_WINDOWPOS_CENTERED : SDL_WINDOWPOS_UNDEFINED; ? SDL_WINDOWPOS_CENTERED_DISPLAY(displayIndex)
uInt32 flags = mode.fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0; : 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 // OSX seems to have issues with destroying the window, and wants to keep
// the same handle // the same handle

View File

@ -115,7 +115,16 @@ class FrameBufferSDL2 : public FrameBuffer
This method is called to query and initialize the video hardware This method is called to query and initialize the video hardware
for desktop and fullscreen resolution information. 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. This method is called to change to the given video mode.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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