2009-01-10 18:42:49 +00:00
|
|
|
//============================================================================
|
2003-09-25 16:20:34 +00:00
|
|
|
//
|
2016-12-30 00:00:30 +00:00
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
2003-09-25 16:20:34 +00:00
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2019-01-01 15:05:51 +00:00
|
|
|
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
|
2010-04-10 21:37:23 +00:00
|
|
|
// and the Stella Team
|
2003-09-25 16:20:34 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2003-09-25 16:20:34 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#include "bspf.hxx"
|
2019-05-01 21:13:17 +00:00
|
|
|
#include "Logger.hxx"
|
2007-09-03 18:37:24 +00:00
|
|
|
|
2003-09-25 16:20:34 +00:00
|
|
|
#include "Console.hxx"
|
The first version of a GUI for event remapping is here!
Now for the things that aren't finished yet:
- Only the most basic functions can be remapped. If you
erase the mapping for those that can't yet be remapped,
you'll have to delete the 'keymap' line from stellarc and
start over.
- Core events can only be remapped to other keys on the keyboard.
I haven't got the joystick remapping working yet (but it should
be easy to do).
- The TIA needs to be modified to show 320 pixels horizontally.
Right now, I'm using 8 pixel-width fonts on a framebuffer of
160 pixels, so there's not a lot of horizontal real estate.
So text will probably overwrite other stuff. This is cosmetic,
and WILL be fixed.
- Modification of the TIA will break every frontends rendering
code. It had to be done sometime ...
- I haven't yet added any user feedback mechanism for the user. So when
you go into remap mode and are about to remap a key, you won't
know it :) I'll be adding arrows (like in XMAME) ...
I've added a "Game Information" menu, which shows things like Game name,
manufacturer, rarity, type, etc. Basically stuff from the stella.pro file.
It has no purpose other than for coolness :)
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@193 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2003-09-28 21:59:24 +00:00
|
|
|
#include "EventHandler.hxx"
|
2007-09-03 18:37:24 +00:00
|
|
|
#include "Event.hxx"
|
2005-02-21 02:23:57 +00:00
|
|
|
#include "OSystem.hxx"
|
2007-09-03 18:37:24 +00:00
|
|
|
#include "Settings.hxx"
|
2016-12-10 17:08:28 +00:00
|
|
|
#include "TIA.hxx"
|
2018-08-31 23:22:56 +00:00
|
|
|
#include "Sound.hxx"
|
2007-09-03 18:37:24 +00:00
|
|
|
|
2014-04-30 16:53:21 +00:00
|
|
|
#include "FBSurface.hxx"
|
2014-05-12 23:34:25 +00:00
|
|
|
#include "TIASurface.hxx"
|
2007-09-03 18:37:24 +00:00
|
|
|
#include "FrameBuffer.hxx"
|
2005-08-24 22:54:30 +00:00
|
|
|
|
2006-12-15 16:43:12 +00:00
|
|
|
#ifdef DEBUGGER_SUPPORT
|
2005-08-24 22:54:30 +00:00
|
|
|
#include "Debugger.hxx"
|
|
|
|
#endif
|
2019-05-02 20:28:39 +00:00
|
|
|
#ifdef GUI_SUPPORT
|
|
|
|
#include "Font.hxx"
|
|
|
|
#include "StellaFont.hxx"
|
|
|
|
#include "StellaMediumFont.hxx"
|
|
|
|
#include "StellaLargeFont.hxx"
|
|
|
|
#include "ConsoleFont.hxx"
|
|
|
|
#include "Launcher.hxx"
|
|
|
|
#include "Menu.hxx"
|
|
|
|
#include "CommandMenu.hxx"
|
|
|
|
#include "TimeMachine.hxx"
|
|
|
|
#endif
|
2005-08-24 22:54:30 +00:00
|
|
|
|
2003-09-25 16:20:34 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-05-12 23:34:25 +00:00
|
|
|
FrameBuffer::FrameBuffer(OSystem& osystem)
|
Reworked the mapping of joysticks yet again. After some thought, it
made no sense to restrict Stella to only work with two joysticks, since
there's no reason one couldn't use four devices, with each one emulating
a paddle (once I get paddle remapping done). So I've removed that
restriction, and also removed the 'leftport' and 'rightport' arguments.
The one case where remapping a joystick *does* make sense is for
multiple Stelladaptors. In that case, there might only be one
Stelladaptor installed, but you'd like it to emulate the right virtual
port. Previously this wasn't possible, but now it is with the addition
of the 'sa1' and 'sa2' commandline arguments. These arguments accept
either 'left' or 'right', specifying which virtual port to emulate.
Updated the InputDialog virtual device tab for remapping Stelladaptors.
Shortened some keynames in EventHandler, so that the actual character is
used (for example, ? instead of QUESTION).
Some fixes for the OS/2 port.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@884 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-11-19 22:26:14 +00:00
|
|
|
: myOSystem(osystem),
|
2007-01-30 17:13:10 +00:00
|
|
|
myInitializedCount(0),
|
2015-12-05 01:30:17 +00:00
|
|
|
myPausedCount(0),
|
2018-01-19 22:02:11 +00:00
|
|
|
myStatsEnabled(false),
|
2018-03-24 19:28:08 +00:00
|
|
|
myLastScanlines(0),
|
|
|
|
myGrabMouse(false),
|
2019-05-11 17:03:07 +00:00
|
|
|
myHiDPIEnabled(false),
|
2018-01-31 19:44:39 +00:00
|
|
|
myCurrentModeList(nullptr)
|
2018-07-25 11:18:21 +00:00
|
|
|
{
|
|
|
|
}
|
2003-10-01 19:01:02 +00:00
|
|
|
|
2017-11-17 17:00:17 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
FrameBuffer::~FrameBuffer()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-10-17 18:02:16 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-02-05 22:09:57 +00:00
|
|
|
bool FrameBuffer::initialize()
|
|
|
|
{
|
2014-03-07 22:12:39 +00:00
|
|
|
// Get desktop resolution and supported renderers
|
2019-05-02 20:28:39 +00:00
|
|
|
vector<Common::Size> windowedDisplays;
|
2019-04-20 20:53:50 +00:00
|
|
|
queryHardware(myFullscreenDisplays, windowedDisplays, myRenderers);
|
|
|
|
uInt32 query_w = windowedDisplays[0].w, query_h = windowedDisplays[0].h;
|
2014-02-05 22:09:57 +00:00
|
|
|
|
2014-02-22 17:31:16 +00:00
|
|
|
// Check the 'maxres' setting, which is an undocumented developer feature
|
|
|
|
// that specifies the desktop size (not normally set)
|
2019-05-02 20:28:39 +00:00
|
|
|
const Common::Size& s = myOSystem.settings().getSize("maxres");
|
2014-11-07 23:28:40 +00:00
|
|
|
if(s.valid())
|
2014-02-22 17:31:16 +00:00
|
|
|
{
|
2014-04-29 14:52:35 +00:00
|
|
|
query_w = s.w;
|
|
|
|
query_h = s.h;
|
2014-02-22 17:31:16 +00:00
|
|
|
}
|
2014-04-28 16:47:10 +00:00
|
|
|
// Various parts of the codebase assume a minimum screen size
|
2019-05-11 17:03:07 +00:00
|
|
|
myAbsDesktopSize.w = std::max(query_w, FBMinimum::Width);
|
|
|
|
myAbsDesktopSize.h = std::max(query_h, FBMinimum::Height);
|
|
|
|
myDesktopSize = myAbsDesktopSize;
|
|
|
|
|
|
|
|
// Check for HiDPI mode (is it activated, and can we use it?)
|
|
|
|
myHiDPIEnabled = myOSystem.settings().getBool("hidpi") &&
|
|
|
|
((myAbsDesktopSize.w / 2) >= FBMinimum::Width) &&
|
|
|
|
((myAbsDesktopSize.h / 2) >= FBMinimum::Height);
|
|
|
|
|
|
|
|
// In HiDPI mode, the desktop resolution is essentially halved
|
|
|
|
// Later, the output is scaled and rendered in 2x mode
|
|
|
|
if(hidpiEnabled())
|
|
|
|
{
|
|
|
|
myDesktopSize.w = myAbsDesktopSize.w / hidpiScaleFactor();
|
|
|
|
myDesktopSize.h = myAbsDesktopSize.h / hidpiScaleFactor();
|
|
|
|
}
|
2014-02-05 22:09:57 +00:00
|
|
|
|
2019-05-02 20:28:39 +00:00
|
|
|
#ifdef GUI_SUPPORT
|
2014-02-05 22:09:57 +00:00
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
// Create fonts to draw text
|
|
|
|
// NOTE: the logic determining appropriate font sizes is done here,
|
|
|
|
// so that the UI classes can just use the font they expect,
|
|
|
|
// and not worry about it
|
|
|
|
// This logic should also take into account the size of the
|
|
|
|
// framebuffer, and try to be intelligent about font sizes
|
|
|
|
// We can probably add ifdefs to take care of corner cases,
|
|
|
|
// but that means we've failed to abstract it enough ...
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// This font is used in a variety of situations when a really small
|
|
|
|
// font is needed; we let the specific widget/dialog decide when to
|
|
|
|
// use it
|
2017-07-21 23:40:13 +00:00
|
|
|
mySmallFont = make_unique<GUI::Font>(GUI::stellaDesc);
|
2014-02-05 22:09:57 +00:00
|
|
|
|
|
|
|
// The general font used in all UI elements
|
|
|
|
// This is determined by the size of the framebuffer
|
2019-04-23 18:08:03 +00:00
|
|
|
if(myOSystem.settings().getBool("minimal_ui"))
|
|
|
|
myFont = make_unique<GUI::Font>(GUI::stellaLargeDesc);
|
|
|
|
else
|
|
|
|
myFont = make_unique<GUI::Font>(GUI::stellaMediumDesc);
|
2014-02-05 22:09:57 +00:00
|
|
|
|
|
|
|
// The info font used in all UI elements
|
|
|
|
// This is determined by the size of the framebuffer
|
2019-04-03 22:57:30 +00:00
|
|
|
myInfoFont = make_unique<GUI::Font>(GUI::consoleDesc);
|
2014-02-05 22:09:57 +00:00
|
|
|
|
|
|
|
// The font used by the ROM launcher
|
2019-04-03 22:57:30 +00:00
|
|
|
const string& lf = myOSystem.settings().getString("launcherfont");
|
|
|
|
if(lf == "small")
|
|
|
|
myLauncherFont = make_unique<GUI::Font>(GUI::consoleDesc);
|
|
|
|
else if(lf == "medium")
|
|
|
|
myLauncherFont = make_unique<GUI::Font>(GUI::stellaMediumDesc);
|
2014-02-05 22:09:57 +00:00
|
|
|
else
|
2019-04-03 22:57:30 +00:00
|
|
|
myLauncherFont = make_unique<GUI::Font>(GUI::stellaLargeDesc);
|
2019-05-02 20:28:39 +00:00
|
|
|
#endif
|
2014-02-05 22:09:57 +00:00
|
|
|
|
2014-04-28 16:47:10 +00:00
|
|
|
// Determine possible TIA windowed zoom levels
|
2019-05-11 17:03:07 +00:00
|
|
|
uInt32 minZoom = 2 * hidpiScaleFactor();
|
2019-03-10 17:49:30 +00:00
|
|
|
uInt32 maxZoom = maxWindowSizeForScreen(
|
|
|
|
TIAConstants::viewableWidth, TIAConstants::viewableHeight,
|
2019-05-11 17:03:07 +00:00
|
|
|
myAbsDesktopSize.w, myAbsDesktopSize.h);
|
|
|
|
for(uInt32 zoom = minZoom; zoom <= maxZoom; ++zoom)
|
2014-04-28 16:47:10 +00:00
|
|
|
{
|
|
|
|
ostringstream desc;
|
|
|
|
desc << "Zoom " << zoom << "x";
|
2014-11-19 22:29:33 +00:00
|
|
|
VarList::push_back(myTIAZoomLevels, desc.str(), zoom);
|
2014-04-28 16:47:10 +00:00
|
|
|
}
|
|
|
|
|
2018-08-12 21:01:43 +00:00
|
|
|
setUIPalette();
|
|
|
|
|
|
|
|
myGrabMouse = myOSystem.settings().getBool("grabmouse");
|
|
|
|
|
|
|
|
// Create a TIA surface; we need it for rendering TIA images
|
|
|
|
myTIASurface = make_unique<TIASurface>(myOSystem);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void FrameBuffer::setUIPalette()
|
|
|
|
{
|
|
|
|
// Set palette for GUI (upper area of array)
|
2017-12-16 23:48:30 +00:00
|
|
|
int palID = 0;
|
|
|
|
if(myOSystem.settings().getString("uipalette") == "classic")
|
|
|
|
palID = 1;
|
|
|
|
else if(myOSystem.settings().getString("uipalette") == "light")
|
|
|
|
palID = 2;
|
2014-09-03 13:27:33 +00:00
|
|
|
|
2018-08-12 21:01:43 +00:00
|
|
|
for(uInt32 i = 0, j = 256; i < kNumColors - 256; ++i, ++j)
|
2014-05-12 23:34:25 +00:00
|
|
|
{
|
2017-05-15 01:47:49 +00:00
|
|
|
uInt8 r = (ourGUIColors[palID][i] >> 16) & 0xff;
|
|
|
|
uInt8 g = (ourGUIColors[palID][i] >> 8) & 0xff;
|
|
|
|
uInt8 b = ourGUIColors[palID][i] & 0xff;
|
2014-05-12 23:34:25 +00:00
|
|
|
|
|
|
|
myPalette[j] = mapRGB(r, g, b);
|
|
|
|
}
|
|
|
|
FBSurface::setPalette(myPalette);
|
2014-02-05 22:09:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
FBInitStatus FrameBuffer::createDisplay(const string& title,
|
2019-05-11 17:03:07 +00:00
|
|
|
uInt32 width, uInt32 height,
|
|
|
|
bool honourHiDPI)
|
2003-10-17 18:02:16 +00:00
|
|
|
{
|
2018-08-28 18:49:50 +00:00
|
|
|
++myInitializedCount;
|
2014-04-29 14:52:35 +00:00
|
|
|
myScreenTitle = title;
|
2006-12-03 01:24:34 +00:00
|
|
|
|
2019-05-11 17:03:07 +00:00
|
|
|
// In HiDPI mode, all created displays must be scaled by 2x
|
|
|
|
if(honourHiDPI && hidpiEnabled())
|
|
|
|
{
|
|
|
|
width *= hidpiScaleFactor();
|
|
|
|
height *= hidpiScaleFactor();
|
|
|
|
}
|
|
|
|
|
2010-07-22 15:41:46 +00:00
|
|
|
// A 'windowed' system is defined as one where the window size can be
|
|
|
|
// larger than the screen size, as there's some sort of window manager
|
|
|
|
// that takes care of it (all current desktop systems fall in this category)
|
|
|
|
// However, some systems have no concept of windowing, and have hard limits
|
|
|
|
// on how large a window can be (ie, the size of the 'desktop' is the
|
|
|
|
// absolute upper limit on window size)
|
|
|
|
//
|
|
|
|
// If the WINDOWED_SUPPORT macro is defined, we treat the system as the
|
|
|
|
// former type; if not, as the latter type
|
2006-12-03 01:24:34 +00:00
|
|
|
|
2013-09-28 00:51:10 +00:00
|
|
|
bool useFullscreen = false;
|
2009-06-05 14:05:23 +00:00
|
|
|
#ifdef WINDOWED_SUPPORT
|
2014-04-28 16:47:10 +00:00
|
|
|
// We assume that a desktop of at least minimum acceptable size means that
|
|
|
|
// we're running on a 'large' system, and the window size requirements
|
|
|
|
// can be relaxed
|
2010-07-22 15:41:46 +00:00
|
|
|
// Otherwise, we treat the system as if WINDOWED_SUPPORT is not defined
|
2019-03-10 17:49:30 +00:00
|
|
|
if(myDesktopSize.w < FBMinimum::Width && myDesktopSize.h < FBMinimum::Height &&
|
2018-01-15 13:44:09 +00:00
|
|
|
(myDesktopSize.w < width || myDesktopSize.h < height))
|
2017-12-15 00:59:45 +00:00
|
|
|
return FBInitStatus::FailTooLarge;
|
2010-11-07 16:19:26 +00:00
|
|
|
|
2014-06-04 12:15:54 +00:00
|
|
|
useFullscreen = myOSystem.settings().getBool("fullscreen");
|
2010-07-22 15:41:46 +00:00
|
|
|
#else
|
|
|
|
// Make sure this mode is even possible
|
|
|
|
// We only really need to worry about it in non-windowed environments,
|
|
|
|
// where requesting a window that's too large will probably cause a crash
|
2014-04-29 14:52:35 +00:00
|
|
|
if(myDesktopSize.w < width || myDesktopSize.h < height)
|
2017-12-15 00:59:45 +00:00
|
|
|
return FBInitStatus::FailTooLarge;
|
2019-03-31 18:39:14 +00:00
|
|
|
|
|
|
|
useFullscreen = true;
|
2009-06-05 14:05:23 +00:00
|
|
|
#endif
|
|
|
|
|
2008-06-19 12:01:31 +00:00
|
|
|
// Set the available video modes for this framebuffer
|
|
|
|
setAvailableVidModes(width, height);
|
2008-04-02 21:22:16 +00:00
|
|
|
|
2008-06-19 12:01:31 +00:00
|
|
|
// Initialize video subsystem (make sure we get a valid mode)
|
2014-03-08 22:15:02 +00:00
|
|
|
string pre_about = about();
|
2019-04-08 21:14:27 +00:00
|
|
|
const FrameBuffer::VideoMode& mode = getSavedVidMode(useFullscreen);
|
2015-09-14 18:14:00 +00:00
|
|
|
if(width <= mode.screen.w && height <= mode.screen.h)
|
2008-05-30 19:07:55 +00:00
|
|
|
{
|
2018-08-31 23:22:56 +00:00
|
|
|
// Changing the video mode can take some time, during which the last
|
|
|
|
// sound played may get 'stuck'
|
|
|
|
// So we mute the sound until the operation completes
|
|
|
|
bool oldMuteState = myOSystem.sound().mute(true);
|
2014-05-12 23:34:25 +00:00
|
|
|
if(setVideoMode(myScreenTitle, mode))
|
2008-06-19 12:01:31 +00:00
|
|
|
{
|
2014-06-02 14:34:12 +00:00
|
|
|
myImageRect = mode.image;
|
|
|
|
myScreenSize = mode.screen;
|
|
|
|
|
2014-05-12 23:34:25 +00:00
|
|
|
// Inform TIA surface about new mode
|
2017-12-21 01:26:22 +00:00
|
|
|
if(myOSystem.eventHandler().state() != EventHandlerState::LAUNCHER &&
|
|
|
|
myOSystem.eventHandler().state() != EventHandlerState::DEBUGGER)
|
2014-05-12 23:34:25 +00:00
|
|
|
myTIASurface->initialize(myOSystem.console(), mode);
|
|
|
|
|
2009-06-05 14:05:23 +00:00
|
|
|
// Did we get the requested fullscreen state?
|
2014-05-12 23:34:25 +00:00
|
|
|
myOSystem.settings().setValue("fullscreen", fullScreen());
|
|
|
|
resetSurfaces();
|
2009-08-07 11:45:14 +00:00
|
|
|
setCursorState();
|
2018-08-31 23:22:56 +00:00
|
|
|
|
|
|
|
myOSystem.sound().mute(oldMuteState);
|
2008-06-19 12:01:31 +00:00
|
|
|
}
|
2010-08-11 21:53:19 +00:00
|
|
|
else
|
|
|
|
{
|
2019-05-01 21:13:17 +00:00
|
|
|
Logger::log("ERROR: Couldn't initialize video subsystem", 0);
|
2017-12-15 00:59:45 +00:00
|
|
|
return FBInitStatus::FailNotSupported;
|
2010-08-11 21:53:19 +00:00
|
|
|
}
|
2008-05-30 19:07:55 +00:00
|
|
|
}
|
2008-06-19 12:01:31 +00:00
|
|
|
else
|
2017-12-15 00:59:45 +00:00
|
|
|
return FBInitStatus::FailTooLarge;
|
2005-05-12 18:45:21 +00:00
|
|
|
|
2019-05-02 20:28:39 +00:00
|
|
|
#ifdef GUI_SUPPORT
|
2005-05-12 18:45:21 +00:00
|
|
|
// Erase any messages from a previous run
|
2008-06-19 12:01:31 +00:00
|
|
|
myMsg.counter = 0;
|
|
|
|
|
|
|
|
// Create surfaces for TIA statistics and general messages
|
2019-05-11 17:03:07 +00:00
|
|
|
const GUI::Font& f = hidpiEnabled() ? infoFont() : font();
|
2017-12-19 15:56:01 +00:00
|
|
|
myStatsMsg.color = kColorInfo;
|
2019-05-11 17:03:07 +00:00
|
|
|
myStatsMsg.w = f.getMaxCharWidth() * 40 + 3;
|
|
|
|
myStatsMsg.h = (f.getFontHeight() + 2) * 3;
|
2008-12-25 23:05:16 +00:00
|
|
|
|
2014-11-09 15:10:47 +00:00
|
|
|
if(!myStatsMsg.surface)
|
2018-01-15 13:44:09 +00:00
|
|
|
{
|
2014-11-09 15:10:47 +00:00
|
|
|
myStatsMsg.surface = allocateSurface(myStatsMsg.w, myStatsMsg.h);
|
2018-01-15 13:44:09 +00:00
|
|
|
myStatsMsg.surface->attributes().blending = true;
|
2018-01-31 07:37:31 +00:00
|
|
|
myStatsMsg.surface->attributes().blendalpha = 92; //aligned with TimeMachineDialog
|
2018-01-15 13:44:09 +00:00
|
|
|
myStatsMsg.surface->applyAttributes();
|
|
|
|
}
|
2014-11-09 15:10:47 +00:00
|
|
|
|
|
|
|
if(!myMsg.surface)
|
2019-03-10 17:49:30 +00:00
|
|
|
myMsg.surface = allocateSurface(FBMinimum::Width, font().getFontHeight()+10);
|
2019-05-02 20:28:39 +00:00
|
|
|
#endif
|
2006-12-11 00:15:34 +00:00
|
|
|
|
2014-06-30 22:46:33 +00:00
|
|
|
// Print initial usage message, but only print it later if the status has changed
|
2014-11-09 15:10:47 +00:00
|
|
|
if(myInitializedCount == 1)
|
2014-01-31 16:23:10 +00:00
|
|
|
{
|
2019-05-01 21:13:17 +00:00
|
|
|
Logger::log(about(), 1);
|
2014-01-31 16:23:10 +00:00
|
|
|
}
|
2014-03-08 22:15:02 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
string post_about = about();
|
|
|
|
if(post_about != pre_about)
|
2019-05-01 21:13:17 +00:00
|
|
|
Logger::log(post_about, 1);
|
2014-03-08 22:15:02 +00:00
|
|
|
}
|
2008-05-30 19:07:55 +00:00
|
|
|
|
2017-12-15 00:59:45 +00:00
|
|
|
return FBInitStatus::Success;
|
2003-10-26 19:40:39 +00:00
|
|
|
}
|
The first version of a GUI for event remapping is here!
Now for the things that aren't finished yet:
- Only the most basic functions can be remapped. If you
erase the mapping for those that can't yet be remapped,
you'll have to delete the 'keymap' line from stellarc and
start over.
- Core events can only be remapped to other keys on the keyboard.
I haven't got the joystick remapping working yet (but it should
be easy to do).
- The TIA needs to be modified to show 320 pixels horizontally.
Right now, I'm using 8 pixel-width fonts on a framebuffer of
160 pixels, so there's not a lot of horizontal real estate.
So text will probably overwrite other stuff. This is cosmetic,
and WILL be fixed.
- Modification of the TIA will break every frontends rendering
code. It had to be done sometime ...
- I haven't yet added any user feedback mechanism for the user. So when
you go into remap mode and are about to remap a key, you won't
know it :) I'll be adding arrows (like in XMAME) ...
I've added a "Game Information" menu, which shows things like Game name,
manufacturer, rarity, type, etc. Basically stuff from the stella.pro file.
It has no purpose other than for coolness :)
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@193 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2003-09-28 21:59:24 +00:00
|
|
|
|
2003-10-26 19:40:39 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2018-07-25 11:18:21 +00:00
|
|
|
void FrameBuffer::update(bool force)
|
2003-10-26 19:40:39 +00:00
|
|
|
{
|
2018-07-25 11:18:21 +00:00
|
|
|
// Onscreen messages are a special case and require different handling than
|
|
|
|
// other objects; they aren't UI dialogs in the normal sense nor are they
|
|
|
|
// TIA images, and they need to be rendered on top of everything
|
|
|
|
// The logic is split in two pieces:
|
|
|
|
// - at the top of ::update(), to determine whether underlying dialogs
|
|
|
|
// need to be force-redrawn
|
|
|
|
// - at the bottom of ::update(), to actually draw them (this must come
|
|
|
|
// last, since they are always drawn on top of everything else).
|
|
|
|
|
|
|
|
// Full rendering is required when messages are enabled
|
|
|
|
force |= myMsg.counter >= 0;
|
|
|
|
|
|
|
|
// Detect when a message has been turned off; one last redraw is required
|
|
|
|
// in this case, to draw over the area that the message occupied
|
|
|
|
if(myMsg.counter == 0)
|
|
|
|
myMsg.counter = -1;
|
2015-03-15 17:36:46 +00:00
|
|
|
|
2014-05-12 23:34:25 +00:00
|
|
|
switch(myOSystem.eventHandler().state())
|
Huge changes across the map. Lets see if I can remember it all ...
There is now an SDL OpenGL port with filtering and alpha-blending.
It's a work in progress right now, but is already quite stable.
It's not as optimized as the software version yet, but this will
change as well. For now, you have to compile the SDL version in
either normal software mode or OpenGL mode. This will change
before the 1.4 release.
When entering menu mode, the emulation is now suspended. And when
pause is pressed, you can't enter menu mode. Because of these changes,
CPU use has dropped dramatically when viewing menus. This will benefit
all ports, since menus are now redrawn only when necessary, instead of
at the current framerate.
For a reference, on a Pentium-IV 2.4GHz, the software SDL version
maxes CPU usage at 9%, and the SDL OpenGL version at 13.5%. This is
at 60 fps and a zoomlevel of 4. While some small improvements can
(possibly) be made to the OpenGL version, I think we'll soon be hitting
the glass ceiling.
Work on the Porting.txt document is progressing, and I estimate it to
be 45% complete.
The Windows version still doesn't compile, and I still haven't looked
at it. Rest assured that it will be done before 1.4. There will be
a simultaneous release, even if the Linux versions are finished.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@200 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2003-11-06 22:22:33 +00:00
|
|
|
{
|
2018-07-25 11:18:21 +00:00
|
|
|
case EventHandlerState::NONE:
|
2017-12-21 01:26:22 +00:00
|
|
|
case EventHandlerState::EMULATION:
|
2018-05-23 22:13:43 +00:00
|
|
|
// Do nothing; emulation mode is handled separately (see below)
|
2018-07-25 11:18:21 +00:00
|
|
|
return;
|
2003-10-26 19:40:39 +00:00
|
|
|
|
2017-12-21 01:26:22 +00:00
|
|
|
case EventHandlerState::PAUSE:
|
2007-01-30 17:13:10 +00:00
|
|
|
{
|
2017-10-14 10:22:21 +00:00
|
|
|
// Show a pause message immediately and then every 7 seconds
|
2018-07-25 11:18:21 +00:00
|
|
|
if(myPausedCount-- <= 0)
|
2007-01-30 17:13:10 +00:00
|
|
|
{
|
2017-12-15 17:10:40 +00:00
|
|
|
myPausedCount = uInt32(7 * myOSystem.frameRate());
|
2017-12-15 00:59:45 +00:00
|
|
|
showMessage("Paused", MessagePosition::MiddleCenter);
|
2007-01-30 17:13:10 +00:00
|
|
|
}
|
2018-07-25 11:18:21 +00:00
|
|
|
if(force)
|
|
|
|
myTIASurface->render();
|
|
|
|
|
2017-12-21 01:26:22 +00:00
|
|
|
break; // EventHandlerState::PAUSE
|
2007-01-30 17:13:10 +00:00
|
|
|
}
|
|
|
|
|
2019-05-02 20:28:39 +00:00
|
|
|
#ifdef GUI_SUPPORT
|
2017-12-21 01:26:22 +00:00
|
|
|
case EventHandlerState::OPTIONSMENU:
|
2005-02-27 23:41:19 +00:00
|
|
|
{
|
2018-07-25 11:18:21 +00:00
|
|
|
force |= myOSystem.menu().needsRedraw();
|
|
|
|
if(force)
|
|
|
|
{
|
|
|
|
myTIASurface->render();
|
|
|
|
myOSystem.menu().draw(force);
|
|
|
|
}
|
2017-12-21 01:26:22 +00:00
|
|
|
break; // EventHandlerState::OPTIONSMENU
|
2005-02-27 23:41:19 +00:00
|
|
|
}
|
Huge changes across the map. Lets see if I can remember it all ...
There is now an SDL OpenGL port with filtering and alpha-blending.
It's a work in progress right now, but is already quite stable.
It's not as optimized as the software version yet, but this will
change as well. For now, you have to compile the SDL version in
either normal software mode or OpenGL mode. This will change
before the 1.4 release.
When entering menu mode, the emulation is now suspended. And when
pause is pressed, you can't enter menu mode. Because of these changes,
CPU use has dropped dramatically when viewing menus. This will benefit
all ports, since menus are now redrawn only when necessary, instead of
at the current framerate.
For a reference, on a Pentium-IV 2.4GHz, the software SDL version
maxes CPU usage at 9%, and the SDL OpenGL version at 13.5%. This is
at 60 fps and a zoomlevel of 4. While some small improvements can
(possibly) be made to the OpenGL version, I think we'll soon be hitting
the glass ceiling.
Work on the Porting.txt document is progressing, and I estimate it to
be 45% complete.
The Windows version still doesn't compile, and I still haven't looked
at it. Rest assured that it will be done before 1.4. There will be
a simultaneous release, even if the Linux versions are finished.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@200 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2003-11-06 22:22:33 +00:00
|
|
|
|
2017-12-21 01:26:22 +00:00
|
|
|
case EventHandlerState::CMDMENU:
|
2005-08-29 18:36:42 +00:00
|
|
|
{
|
2018-07-25 11:18:21 +00:00
|
|
|
force |= myOSystem.commandMenu().needsRedraw();
|
|
|
|
if(force)
|
|
|
|
{
|
|
|
|
myTIASurface->render();
|
|
|
|
myOSystem.commandMenu().draw(force);
|
|
|
|
}
|
2017-12-21 01:26:22 +00:00
|
|
|
break; // EventHandlerState::CMDMENU
|
|
|
|
}
|
|
|
|
|
|
|
|
case EventHandlerState::TIMEMACHINE:
|
|
|
|
{
|
2018-07-25 11:18:21 +00:00
|
|
|
force |= myOSystem.timeMachine().needsRedraw();
|
|
|
|
if(force)
|
|
|
|
{
|
|
|
|
myTIASurface->render();
|
|
|
|
myOSystem.timeMachine().draw(force);
|
|
|
|
}
|
2017-12-21 01:26:22 +00:00
|
|
|
break; // EventHandlerState::TIMEMACHINE
|
2005-08-29 18:36:42 +00:00
|
|
|
}
|
|
|
|
|
2017-12-21 01:26:22 +00:00
|
|
|
case EventHandlerState::LAUNCHER:
|
Added first pass of the ROM launcher. When you press 'Start' in the ROM
launcher, it launches Frostbite. Then pressing 'Escape' goes back to the
launcher, and you're able to then launch Frostbite again! Success !!!
Still TODO is actually get a ROM listing and use the selected game, but
the fact that it works multiple times for some game means that the
infrastructure is working correctly :)
Changed behaviour of the 'Escape' key. Specifically, it now only acts
as a key to enter ROM launcher mode. In the case where the emulation
was started without the launcher, the key will now do nothing. From now
on, the only way to quit Stella is Ctrl-Q (or equivalent for OSX),
close the window, or from the 'Quit' button.
Also, the 'Enter launcher mode' event will eventually be made remappable,
as will the 'Enter menu mode' event (currently the 'Tab' key).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@412 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-05-06 18:39:00 +00:00
|
|
|
{
|
2018-07-25 11:18:21 +00:00
|
|
|
force |= myOSystem.launcher().draw(force);
|
2017-12-21 01:26:22 +00:00
|
|
|
break; // EventHandlerState::LAUNCHER
|
Added first pass of the ROM launcher. When you press 'Start' in the ROM
launcher, it launches Frostbite. Then pressing 'Escape' goes back to the
launcher, and you're able to then launch Frostbite again! Success !!!
Still TODO is actually get a ROM listing and use the selected game, but
the fact that it works multiple times for some game means that the
infrastructure is working correctly :)
Changed behaviour of the 'Escape' key. Specifically, it now only acts
as a key to enter ROM launcher mode. In the case where the emulation
was started without the launcher, the key will now do nothing. From now
on, the only way to quit Stella is Ctrl-Q (or equivalent for OSX),
close the window, or from the 'Quit' button.
Also, the 'Enter launcher mode' event will eventually be made remappable,
as will the 'Enter menu mode' event (currently the 'Tab' key).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@412 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2005-05-06 18:39:00 +00:00
|
|
|
}
|
2019-05-02 20:28:39 +00:00
|
|
|
#endif
|
2004-06-23 03:43:47 +00:00
|
|
|
|
2019-05-02 20:28:39 +00:00
|
|
|
#ifdef DEBUGGER_SUPPORT
|
2017-12-21 01:26:22 +00:00
|
|
|
case EventHandlerState::DEBUGGER:
|
2005-06-23 14:33:12 +00:00
|
|
|
{
|
2018-07-25 11:18:21 +00:00
|
|
|
force |= myOSystem.debugger().draw(force);
|
2017-12-21 01:26:22 +00:00
|
|
|
break; // EventHandlerState::DEBUGGER
|
2005-06-23 14:33:12 +00:00
|
|
|
}
|
2019-05-02 20:28:39 +00:00
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
break;
|
2003-10-26 19:40:39 +00:00
|
|
|
}
|
|
|
|
|
2006-12-18 12:53:33 +00:00
|
|
|
// Draw any pending messages
|
2018-07-25 11:18:21 +00:00
|
|
|
// The logic here determines whether to draw the message
|
|
|
|
// If the message is to be disabled, logic inside the draw method
|
|
|
|
// indicates that, and then the code at the top of this method sees
|
|
|
|
// the change and redraws everything
|
2009-01-10 18:42:49 +00:00
|
|
|
if(myMsg.enabled)
|
2018-07-25 11:18:21 +00:00
|
|
|
force |= drawMessage();
|
2006-12-18 12:53:33 +00:00
|
|
|
|
2018-07-25 11:18:21 +00:00
|
|
|
// Push buffers to screen only when necessary
|
|
|
|
if(force)
|
|
|
|
renderToScreen();
|
2003-09-25 16:20:34 +00:00
|
|
|
}
|
|
|
|
|
2018-05-23 22:13:43 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2018-07-30 21:19:09 +00:00
|
|
|
void FrameBuffer::updateInEmulationMode(float framesPerSecond)
|
2018-05-23 22:13:43 +00:00
|
|
|
{
|
2018-07-25 11:18:21 +00:00
|
|
|
// Update method that is specifically tailored to emulation mode
|
|
|
|
// Typically called from a thread, so it needs to be separate from
|
|
|
|
// the normal update() method
|
|
|
|
//
|
|
|
|
// We don't worry about selective rendering here; the rendering
|
|
|
|
// always happens at the full framerate
|
2018-05-23 22:13:43 +00:00
|
|
|
|
|
|
|
myTIASurface->render();
|
|
|
|
|
|
|
|
// Show frame statistics
|
|
|
|
if(myStatsMsg.enabled)
|
2018-07-30 21:19:09 +00:00
|
|
|
drawFrameStats(framesPerSecond);
|
2018-05-23 22:13:43 +00:00
|
|
|
|
2018-06-08 22:30:33 +00:00
|
|
|
myLastScanlines = myOSystem.console().tia().frameBufferScanlinesLastFrame();
|
2018-05-23 22:13:43 +00:00
|
|
|
myPausedCount = 0;
|
|
|
|
|
|
|
|
// Draw any pending messages
|
|
|
|
if(myMsg.enabled)
|
|
|
|
drawMessage();
|
|
|
|
|
2018-07-25 11:18:21 +00:00
|
|
|
// Push buffers to screen
|
|
|
|
renderToScreen();
|
2018-05-23 22:13:43 +00:00
|
|
|
}
|
|
|
|
|
2005-03-13 03:38:41 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2006-03-19 18:17:48 +00:00
|
|
|
void FrameBuffer::showMessage(const string& message, MessagePosition position,
|
2012-01-03 20:52:45 +00:00
|
|
|
bool force)
|
2005-03-13 03:38:41 +00:00
|
|
|
{
|
2019-05-02 20:28:39 +00:00
|
|
|
#ifdef GUI_SUPPORT
|
Revamped the result on floating pins for TIA reads. Previously, this was
controlled by 'tiafloat', which has now been removed. Now, all
undriven pins take on the last value on the databus. This fixes a bug
in those reads where bit 6 or bits 6 & 7 are also undriven (previously,
these bits would always be zero, and only bits 0-5 were from lastdatabus.
Added new commandline argument 'tiadriven', which defaults to false.
In this default case, relevant bits take on values from the databus.
If true, relevant bits still take on databus values, but some are
randomly driven high as well. This helps to expose bugs when
developers assume the values for undriven/floating bits.
Added 'uimessages' commandline argument and associated UI item. When
disabled, messages which are normally shown in-game are disabled.
Certain messages which indicate a serious error are still shown, however.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1900 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-11-10 20:12:50 +00:00
|
|
|
// Only show messages if they've been enabled
|
2018-05-27 18:47:12 +00:00
|
|
|
if(myMsg.surface == nullptr || !(force || myOSystem.settings().getBool("uimessages")))
|
Revamped the result on floating pins for TIA reads. Previously, this was
controlled by 'tiafloat', which has now been removed. Now, all
undriven pins take on the last value on the databus. This fixes a bug
in those reads where bit 6 or bits 6 & 7 are also undriven (previously,
these bits would always be zero, and only bits 0-5 were from lastdatabus.
Added new commandline argument 'tiadriven', which defaults to false.
In this default case, relevant bits take on values from the databus.
If true, relevant bits still take on databus values, but some are
randomly driven high as well. This helps to expose bugs when
developers assume the values for undriven/floating bits.
Added 'uimessages' commandline argument and associated UI item. When
disabled, messages which are normally shown in-game are disabled.
Certain messages which indicate a serious error are still shown, however.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1900 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-11-10 20:12:50 +00:00
|
|
|
return;
|
|
|
|
|
2006-03-19 18:17:48 +00:00
|
|
|
// Precompute the message coordinates
|
2008-06-19 12:01:31 +00:00
|
|
|
myMsg.text = message;
|
2014-05-12 23:34:25 +00:00
|
|
|
myMsg.counter = uInt32(myOSystem.frameRate()) << 1; // Show message for 2 seconds
|
2018-05-27 19:11:42 +00:00
|
|
|
if(myMsg.counter == 0) myMsg.counter = 60;
|
2012-01-03 20:52:45 +00:00
|
|
|
myMsg.color = kBtnTextColor;
|
2006-03-19 18:17:48 +00:00
|
|
|
|
2014-02-05 22:09:57 +00:00
|
|
|
myMsg.w = font().getStringWidth(myMsg.text) + 10;
|
|
|
|
myMsg.h = font().getFontHeight() + 8;
|
2014-05-07 20:02:47 +00:00
|
|
|
myMsg.surface->setSrcSize(myMsg.w, myMsg.h);
|
2019-05-11 17:03:07 +00:00
|
|
|
myMsg.surface->setDstSize(myMsg.w * hidpiScaleFactor(), myMsg.h * hidpiScaleFactor());
|
2009-01-10 18:42:49 +00:00
|
|
|
myMsg.position = position;
|
|
|
|
myMsg.enabled = true;
|
2019-05-02 20:28:39 +00:00
|
|
|
#endif
|
2009-01-10 18:42:49 +00:00
|
|
|
}
|
|
|
|
|
2018-01-17 18:03:25 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2018-07-30 21:19:09 +00:00
|
|
|
void FrameBuffer::drawFrameStats(float framesPerSecond)
|
2018-01-17 18:03:25 +00:00
|
|
|
{
|
2019-05-02 20:28:39 +00:00
|
|
|
#ifdef GUI_SUPPORT
|
2018-01-17 18:03:25 +00:00
|
|
|
const ConsoleInfo& info = myOSystem.console().about();
|
2018-07-30 21:19:09 +00:00
|
|
|
int xPos = 2, yPos = 0;
|
2019-05-11 17:03:07 +00:00
|
|
|
const GUI::Font& f = hidpiEnabled() ? infoFont() : font();
|
|
|
|
const int dy = f.getFontHeight() + 2;
|
2018-07-30 21:19:09 +00:00
|
|
|
|
|
|
|
ostringstream ss;
|
2018-01-17 18:03:25 +00:00
|
|
|
|
|
|
|
myStatsMsg.surface->invalidate();
|
2018-02-05 12:45:34 +00:00
|
|
|
|
|
|
|
// draw scanlines
|
2018-08-08 15:39:10 +00:00
|
|
|
ColorId color = myOSystem.console().tia().frameBufferScanlinesLastFrame() != myLastScanlines ?
|
|
|
|
kDbgColorRed : myStatsMsg.color;
|
2018-07-30 21:19:09 +00:00
|
|
|
|
|
|
|
ss
|
|
|
|
<< myOSystem.console().tia().frameBufferScanlinesLastFrame()
|
|
|
|
<< " / "
|
|
|
|
<< std::fixed << std::setprecision(1) << myOSystem.console().getFramerate()
|
|
|
|
<< "Hz => "
|
|
|
|
<< info.DisplayFormat;
|
|
|
|
|
2019-05-11 17:03:07 +00:00
|
|
|
myStatsMsg.surface->drawString(f, ss.str(), xPos, yPos,
|
2018-01-17 18:03:25 +00:00
|
|
|
myStatsMsg.w, color, TextAlign::Left, 0, true, kBGColor);
|
2018-01-21 10:05:00 +00:00
|
|
|
|
2018-07-30 21:19:09 +00:00
|
|
|
yPos += dy;
|
|
|
|
ss.str("");
|
2018-01-21 10:05:00 +00:00
|
|
|
|
2018-07-30 21:19:09 +00:00
|
|
|
ss
|
|
|
|
<< std::fixed << std::setprecision(1) << framesPerSecond
|
2018-07-31 15:07:51 +00:00
|
|
|
<< "fps @ "
|
2018-07-30 21:40:48 +00:00
|
|
|
<< std::fixed << std::setprecision(0) << 100 * myOSystem.settings().getFloat("speed")
|
2018-07-30 21:19:09 +00:00
|
|
|
<< "% speed";
|
2018-02-12 22:32:03 +00:00
|
|
|
|
2019-05-11 17:03:07 +00:00
|
|
|
myStatsMsg.surface->drawString(f, ss.str(), xPos, yPos,
|
2018-01-17 18:03:25 +00:00
|
|
|
myStatsMsg.w, myStatsMsg.color, TextAlign::Left, 0, true, kBGColor);
|
|
|
|
|
2018-07-30 21:19:09 +00:00
|
|
|
yPos += dy;
|
|
|
|
ss.str("");
|
|
|
|
|
|
|
|
ss << info.BankSwitch;
|
|
|
|
if (myOSystem.settings().getBool("dev.settings")) ss << "| Developer";
|
|
|
|
|
2019-05-11 17:03:07 +00:00
|
|
|
myStatsMsg.surface->drawString(f, ss.str(), xPos, yPos,
|
|
|
|
myStatsMsg.w, myStatsMsg.color, TextAlign::Left, 0, true, kBGColor);
|
2018-01-17 18:03:25 +00:00
|
|
|
|
2018-01-31 07:37:31 +00:00
|
|
|
myStatsMsg.surface->setDstPos(myImageRect.x() + 10, myImageRect.y() + 8);
|
2019-05-11 17:03:07 +00:00
|
|
|
myStatsMsg.surface->setDstSize(myStatsMsg.w * hidpiScaleFactor(),
|
|
|
|
myStatsMsg.h * hidpiScaleFactor());
|
2018-01-17 18:03:25 +00:00
|
|
|
myStatsMsg.surface->render();
|
2019-05-02 20:28:39 +00:00
|
|
|
#endif
|
2018-01-17 18:03:25 +00:00
|
|
|
}
|
|
|
|
|
2009-01-10 18:42:49 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void FrameBuffer::toggleFrameStats()
|
|
|
|
{
|
2017-11-23 21:13:37 +00:00
|
|
|
showFrameStats(!myStatsEnabled);
|
2017-11-24 19:38:21 +00:00
|
|
|
myOSystem.settings().setValue(
|
|
|
|
myOSystem.settings().getBool("dev.settings") ? "dev.stats" : "plr.stats", myStatsEnabled);
|
2009-01-10 18:42:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void FrameBuffer::showFrameStats(bool enable)
|
|
|
|
{
|
2017-11-23 21:13:37 +00:00
|
|
|
myStatsEnabled = myStatsMsg.enabled = enable;
|
2009-01-10 18:42:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void FrameBuffer::enableMessages(bool enable)
|
|
|
|
{
|
|
|
|
if(enable)
|
|
|
|
{
|
2010-04-14 15:41:42 +00:00
|
|
|
// Only re-enable frame stats if they were already enabled before
|
2017-11-23 21:13:37 +00:00
|
|
|
myStatsMsg.enabled = myStatsEnabled;
|
2009-01-10 18:42:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Temporarily disable frame stats
|
|
|
|
myStatsMsg.enabled = false;
|
2006-03-19 18:17:48 +00:00
|
|
|
|
2009-01-10 18:42:49 +00:00
|
|
|
// Erase old messages on the screen
|
|
|
|
myMsg.enabled = false;
|
|
|
|
myMsg.counter = 0;
|
2018-07-25 11:18:21 +00:00
|
|
|
update(true); // Force update immediately
|
2009-01-10 18:42:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2018-07-25 11:18:21 +00:00
|
|
|
inline bool FrameBuffer::drawMessage()
|
2009-01-10 18:42:49 +00:00
|
|
|
{
|
2019-05-02 20:28:39 +00:00
|
|
|
#ifdef GUI_SUPPORT
|
2018-07-25 11:18:21 +00:00
|
|
|
// Either erase the entire message (when time is reached),
|
|
|
|
// or show again this frame
|
|
|
|
if(myMsg.counter == 0)
|
|
|
|
{
|
|
|
|
myMsg.enabled = false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(myMsg.counter < 0)
|
|
|
|
{
|
|
|
|
myMsg.enabled = false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-01-10 18:42:49 +00:00
|
|
|
// Draw the bounded box and text
|
2019-05-02 20:28:39 +00:00
|
|
|
const Common::Rect& dst = myMsg.surface->dstRect();
|
2017-12-22 02:34:17 +00:00
|
|
|
|
2009-01-10 18:42:49 +00:00
|
|
|
switch(myMsg.position)
|
2006-03-19 18:17:48 +00:00
|
|
|
{
|
2017-12-15 00:59:45 +00:00
|
|
|
case MessagePosition::TopLeft:
|
2008-06-19 12:01:31 +00:00
|
|
|
myMsg.x = 5;
|
|
|
|
myMsg.y = 5;
|
2006-03-19 18:17:48 +00:00
|
|
|
break;
|
|
|
|
|
2017-12-15 00:59:45 +00:00
|
|
|
case MessagePosition::TopCenter:
|
2017-12-22 02:34:17 +00:00
|
|
|
myMsg.x = (myImageRect.width() - dst.width()) >> 1;
|
2008-06-19 12:01:31 +00:00
|
|
|
myMsg.y = 5;
|
2006-03-19 18:17:48 +00:00
|
|
|
break;
|
|
|
|
|
2017-12-15 00:59:45 +00:00
|
|
|
case MessagePosition::TopRight:
|
2017-12-22 02:34:17 +00:00
|
|
|
myMsg.x = myImageRect.width() - dst.width() - 5;
|
2008-06-19 12:01:31 +00:00
|
|
|
myMsg.y = 5;
|
2006-03-19 18:17:48 +00:00
|
|
|
break;
|
|
|
|
|
2017-12-15 00:59:45 +00:00
|
|
|
case MessagePosition::MiddleLeft:
|
2008-06-19 12:01:31 +00:00
|
|
|
myMsg.x = 5;
|
2017-12-22 02:34:17 +00:00
|
|
|
myMsg.y = (myImageRect.height() - dst.height()) >> 1;
|
2006-03-19 18:17:48 +00:00
|
|
|
break;
|
|
|
|
|
2017-12-15 00:59:45 +00:00
|
|
|
case MessagePosition::MiddleCenter:
|
2017-12-22 02:34:17 +00:00
|
|
|
myMsg.x = (myImageRect.width() - dst.width()) >> 1;
|
|
|
|
myMsg.y = (myImageRect.height() - dst.height()) >> 1;
|
2006-03-19 18:17:48 +00:00
|
|
|
break;
|
|
|
|
|
2017-12-15 00:59:45 +00:00
|
|
|
case MessagePosition::MiddleRight:
|
2017-12-22 02:34:17 +00:00
|
|
|
myMsg.x = myImageRect.width() - dst.width() - 5;
|
|
|
|
myMsg.y = (myImageRect.height() - dst.height()) >> 1;
|
2006-03-19 18:17:48 +00:00
|
|
|
break;
|
|
|
|
|
2017-12-15 00:59:45 +00:00
|
|
|
case MessagePosition::BottomLeft:
|
2008-06-19 12:01:31 +00:00
|
|
|
myMsg.x = 5;
|
2017-12-22 02:34:17 +00:00
|
|
|
myMsg.y = myImageRect.height() - dst.height() - 5;
|
2006-03-19 18:17:48 +00:00
|
|
|
break;
|
|
|
|
|
2017-12-15 00:59:45 +00:00
|
|
|
case MessagePosition::BottomCenter:
|
2017-12-22 02:34:17 +00:00
|
|
|
myMsg.x = (myImageRect.width() - dst.width()) >> 1;
|
|
|
|
myMsg.y = myImageRect.height() - dst.height() - 5;
|
2006-03-19 18:17:48 +00:00
|
|
|
break;
|
|
|
|
|
2017-12-15 00:59:45 +00:00
|
|
|
case MessagePosition::BottomRight:
|
2017-12-22 02:34:17 +00:00
|
|
|
myMsg.x = myImageRect.width() - dst.width() - 5;
|
|
|
|
myMsg.y = myImageRect.height() - dst.height() - 5;
|
2006-03-19 18:17:48 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-03-13 03:38:41 +00:00
|
|
|
|
2014-05-04 16:59:11 +00:00
|
|
|
myMsg.surface->setDstPos(myMsg.x + myImageRect.x(), myMsg.y + myImageRect.y());
|
2012-01-03 20:52:45 +00:00
|
|
|
myMsg.surface->fillRect(1, 1, myMsg.w-2, myMsg.h-2, kBtnColor);
|
2017-12-17 12:28:23 +00:00
|
|
|
myMsg.surface->frameRect(0, 0, myMsg.w, myMsg.h, kColor);
|
|
|
|
myMsg.surface->drawString(font(), myMsg.text, 5, 4,
|
2017-12-15 00:59:45 +00:00
|
|
|
myMsg.w, myMsg.color, TextAlign::Left);
|
2018-07-25 11:18:21 +00:00
|
|
|
myMsg.surface->render();
|
|
|
|
myMsg.counter--;
|
2019-05-02 20:28:39 +00:00
|
|
|
#endif
|
2006-03-18 00:00:30 +00:00
|
|
|
|
2018-07-25 11:18:21 +00:00
|
|
|
return true;
|
2006-03-18 00:00:30 +00:00
|
|
|
}
|
|
|
|
|
2017-12-13 18:15:09 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2017-12-15 17:10:40 +00:00
|
|
|
void FrameBuffer::setPauseDelay()
|
2017-12-13 18:15:09 +00:00
|
|
|
{
|
2017-12-15 17:10:40 +00:00
|
|
|
myPausedCount = uInt32(2 * myOSystem.frameRate());
|
2017-12-13 18:15:09 +00:00
|
|
|
}
|
|
|
|
|
2008-12-12 15:51:07 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-11-15 18:29:13 +00:00
|
|
|
shared_ptr<FBSurface> FrameBuffer::allocateSurface(int w, int h, const uInt32* data)
|
2008-12-12 15:51:07 +00:00
|
|
|
{
|
2014-11-09 15:10:47 +00:00
|
|
|
// Add new surface to the list
|
|
|
|
mySurfaceList.push_back(createSurface(w, h, data));
|
2008-12-12 15:51:07 +00:00
|
|
|
|
2014-11-09 15:10:47 +00:00
|
|
|
// And return a pointer to it (pointer should be treated read-only)
|
2014-11-15 18:29:13 +00:00
|
|
|
return mySurfaceList.at(mySurfaceList.size() - 1);
|
2008-12-12 15:51:07 +00:00
|
|
|
}
|
|
|
|
|
2018-06-07 15:16:26 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void FrameBuffer::freeSurfaces()
|
|
|
|
{
|
|
|
|
for(auto& s: mySurfaceList)
|
|
|
|
s->free();
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void FrameBuffer::reloadSurfaces()
|
|
|
|
{
|
|
|
|
for(auto& s: mySurfaceList)
|
|
|
|
s->reload();
|
|
|
|
}
|
|
|
|
|
2008-12-12 15:51:07 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-05-12 23:34:25 +00:00
|
|
|
void FrameBuffer::resetSurfaces()
|
2008-12-12 15:51:07 +00:00
|
|
|
{
|
2008-12-20 23:32:46 +00:00
|
|
|
// Free all resources for each surface, then reload them
|
|
|
|
// Due to possible timing and/or synchronization issues, all free()'s
|
|
|
|
// are done first, then all reload()'s
|
|
|
|
// Any derived FrameBuffer classes that call this method should be
|
|
|
|
// aware of these restrictions, and act accordingly
|
|
|
|
|
2018-06-07 15:16:26 +00:00
|
|
|
freeSurfaces();
|
|
|
|
reloadSurfaces();
|
2018-07-25 11:18:21 +00:00
|
|
|
|
|
|
|
update(true); // force full update
|
2008-12-12 15:51:07 +00:00
|
|
|
}
|
|
|
|
|
2009-01-03 15:44:13 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-06-02 14:34:12 +00:00
|
|
|
void FrameBuffer::setPalette(const uInt32* raw_palette)
|
2009-01-03 15:44:13 +00:00
|
|
|
{
|
2006-01-10 02:09:34 +00:00
|
|
|
// Set palette for normal fill
|
2014-05-12 23:34:25 +00:00
|
|
|
for(int i = 0; i < 256; ++i)
|
2006-01-10 02:09:34 +00:00
|
|
|
{
|
2017-05-15 01:47:49 +00:00
|
|
|
uInt8 r = (raw_palette[i] >> 16) & 0xff;
|
|
|
|
uInt8 g = (raw_palette[i] >> 8) & 0xff;
|
|
|
|
uInt8 b = raw_palette[i] & 0xff;
|
2003-10-26 19:40:39 +00:00
|
|
|
|
2014-05-12 23:34:25 +00:00
|
|
|
myPalette[i] = mapRGB(r, g, b);
|
2005-03-28 00:04:54 +00:00
|
|
|
}
|
|
|
|
|
2014-05-12 23:34:25 +00:00
|
|
|
// Let the TIA surface know about the new palette
|
2014-06-02 14:34:12 +00:00
|
|
|
myTIASurface->setPalette(myPalette, raw_palette);
|
2003-10-26 19:40:39 +00:00
|
|
|
}
|
|
|
|
|
2009-01-10 18:52:55 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2017-12-21 01:26:22 +00:00
|
|
|
void FrameBuffer::stateChanged(EventHandlerState state)
|
2009-01-10 18:52:55 +00:00
|
|
|
{
|
|
|
|
// Make sure any onscreen messages are removed
|
|
|
|
myMsg.enabled = false;
|
|
|
|
myMsg.counter = 0;
|
2018-07-25 11:18:21 +00:00
|
|
|
|
|
|
|
update(true); // force full update
|
2009-01-10 18:52:55 +00:00
|
|
|
}
|
|
|
|
|
2005-05-01 20:11:07 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void FrameBuffer::setFullscreen(bool enable)
|
|
|
|
{
|
2019-03-31 19:12:48 +00:00
|
|
|
#ifdef WINDOWED_SUPPORT
|
2018-08-15 16:03:08 +00:00
|
|
|
// Switching between fullscreen and windowed modes will invariably mean
|
|
|
|
// that the 'window' resolution changes. Currently, dialogs are not
|
|
|
|
// able to resize themselves when they are actively being shown
|
|
|
|
// (they would have to be closed and then re-opened, etc).
|
|
|
|
// For now, we simply disallow screen switches in such modes
|
|
|
|
switch(myOSystem.eventHandler().state())
|
|
|
|
{
|
|
|
|
case EventHandlerState::EMULATION:
|
|
|
|
case EventHandlerState::PAUSE:
|
|
|
|
break; // continue with processing (aka, allow a mode switch)
|
2019-05-12 00:46:23 +00:00
|
|
|
case EventHandlerState::DEBUGGER:
|
|
|
|
case EventHandlerState::LAUNCHER:
|
|
|
|
if(myOSystem.eventHandler().overlay().baseDialogIsActive())
|
|
|
|
break; // allow a mode switch when there is only one dialog
|
|
|
|
[[fallthrough]];
|
2018-08-15 16:03:08 +00:00
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-08-31 23:22:56 +00:00
|
|
|
// Changing the video mode can take some time, during which the last
|
|
|
|
// sound played may get 'stuck'
|
|
|
|
// So we mute the sound until the operation completes
|
|
|
|
bool oldMuteState = myOSystem.sound().mute(true);
|
|
|
|
|
2014-06-02 14:34:12 +00:00
|
|
|
const VideoMode& mode = getSavedVidMode(enable);
|
2015-06-13 23:58:37 +00:00
|
|
|
if(setVideoMode(myScreenTitle, mode))
|
2014-06-02 14:34:12 +00:00
|
|
|
{
|
|
|
|
myImageRect = mode.image;
|
|
|
|
myScreenSize = mode.screen;
|
2003-10-26 19:40:39 +00:00
|
|
|
|
2014-06-02 14:34:12 +00:00
|
|
|
// Inform TIA surface about new mode
|
2017-12-21 01:26:22 +00:00
|
|
|
if(myOSystem.eventHandler().state() != EventHandlerState::LAUNCHER &&
|
|
|
|
myOSystem.eventHandler().state() != EventHandlerState::DEBUGGER)
|
2014-06-02 14:34:12 +00:00
|
|
|
myTIASurface->initialize(myOSystem.console(), mode);
|
2003-10-26 19:40:39 +00:00
|
|
|
|
2014-06-02 14:34:12 +00:00
|
|
|
// Did we get the requested fullscreen state?
|
|
|
|
myOSystem.settings().setValue("fullscreen", fullScreen());
|
|
|
|
resetSurfaces();
|
|
|
|
setCursorState();
|
|
|
|
}
|
2018-08-31 23:22:56 +00:00
|
|
|
myOSystem.sound().mute(oldMuteState);
|
2019-03-31 19:12:48 +00:00
|
|
|
#endif
|
2005-03-28 00:04:54 +00:00
|
|
|
}
|
|
|
|
|
2014-04-28 16:47:10 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void FrameBuffer::toggleFullscreen()
|
|
|
|
{
|
|
|
|
setFullscreen(!fullScreen());
|
|
|
|
}
|
|
|
|
|
2005-03-28 00:04:54 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2019-04-08 21:14:27 +00:00
|
|
|
bool FrameBuffer::changeVidMode(int direction)
|
2005-03-28 00:04:54 +00:00
|
|
|
{
|
2017-12-21 01:26:22 +00:00
|
|
|
EventHandlerState state = myOSystem.eventHandler().state();
|
|
|
|
bool tiaMode = (state != EventHandlerState::DEBUGGER &&
|
|
|
|
state != EventHandlerState::LAUNCHER);
|
2008-06-19 12:01:31 +00:00
|
|
|
|
2019-04-08 21:14:27 +00:00
|
|
|
// Only applicable when in TIA/emulation mode
|
|
|
|
if(!tiaMode)
|
Reworked 'fullres' argument to also accept the 'auto' option. In this case,
fullscreen resolutions will be automatically chosen based on the required
size for the window. The image will be centered and keep the same aspect
ratio, however, so operation will still work correctly on widescreen
monitors. 'Auto' will be the new default. Otherwise, if a specific
resolution is requested, Stella will try to accomodate it *only* if it fits
into the resolution; otherwise the smallest resolution that fits will be
used.
Removed 'zoom_ui' and 'zoom_tia'. The UI can now only be at 1x mode.
Aded 'tia_filter' commandline argument, which specifies to the filter
to use when rendering the tia image. For now, these accept 'zoom1x',
'zoom2x'..., up to 'zoom10x', and duplicate previous behaviour. Eventually,
Scalexx and HQxx filters may be added. Still TODO is add this to the UI.
First pass at making the standard build use a minimum of zoom2x for the TIA,
so the UI can be larger and use a better looking font. There's still work
to do in this area, especially for those ports with limited hardware that
support zoom1x only.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1544 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2008-07-22 14:54:39 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
if(direction == +1)
|
|
|
|
myCurrentModeList->next();
|
|
|
|
else if(direction == -1)
|
|
|
|
myCurrentModeList->previous();
|
2014-04-29 14:52:35 +00:00
|
|
|
else
|
|
|
|
return false;
|
Added preliminary framework for using advanced scalers. Right now,
functionality is exactly the same as before; Alt-Equals goes to the
next valid scaler, and Alt-Minus goes to the previous one.
What were previously zoomed modes are now treated as scalers, named
'Zoom1x', 'Zoom2x', etc. Various scalexx and hqxx modes will also be made
available.
For now, and probably forever, these advanced scaling modes will only
be available for OpenGL, since if you don't have a card that can handle
GL well, the scalers will probably be too much anyway. Also, the advanced
scaling will not be available in UI mode, only OpenGL emulation mode.
The UI (Launcher, Debugger) and emulation modes are now scaled separately,
specified with the new settings 'scale_ui' and 'scale_tia'. The 'zoom'
setting has been removed.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1133 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-10-14 20:08:29 +00:00
|
|
|
|
2018-08-31 23:22:56 +00:00
|
|
|
// Changing the video mode can take some time, during which the last
|
|
|
|
// sound played may get 'stuck'
|
|
|
|
// So we mute the sound until the operation completes
|
|
|
|
bool oldMuteState = myOSystem.sound().mute(true);
|
|
|
|
|
2014-04-29 14:52:35 +00:00
|
|
|
const VideoMode& mode = myCurrentModeList->current();
|
2014-05-12 23:34:25 +00:00
|
|
|
if(setVideoMode(myScreenTitle, mode))
|
2008-06-19 12:01:31 +00:00
|
|
|
{
|
2014-06-02 14:34:12 +00:00
|
|
|
myImageRect = mode.image;
|
|
|
|
myScreenSize = mode.screen;
|
|
|
|
|
2014-05-14 22:04:59 +00:00
|
|
|
// Inform TIA surface about new mode
|
2014-06-02 14:34:12 +00:00
|
|
|
myTIASurface->initialize(myOSystem.console(), mode);
|
2014-05-14 22:04:59 +00:00
|
|
|
|
2014-05-12 23:34:25 +00:00
|
|
|
resetSurfaces();
|
2014-04-29 14:52:35 +00:00
|
|
|
showMessage(mode.description);
|
2018-08-31 23:22:56 +00:00
|
|
|
myOSystem.sound().mute(oldMuteState);
|
2019-04-08 21:14:27 +00:00
|
|
|
|
|
|
|
if(fullScreen())
|
2019-04-14 17:27:28 +00:00
|
|
|
myOSystem.settings().setValue("tia.fs_stretch",
|
2019-04-08 21:14:27 +00:00
|
|
|
mode.stretch == VideoMode::Stretch::Fill);
|
|
|
|
else
|
|
|
|
myOSystem.settings().setValue("tia.zoom", mode.zoom);
|
|
|
|
|
2014-04-29 14:52:35 +00:00
|
|
|
return true;
|
2008-06-19 12:01:31 +00:00
|
|
|
}
|
2018-08-31 23:22:56 +00:00
|
|
|
myOSystem.sound().mute(oldMuteState);
|
2019-04-08 21:14:27 +00:00
|
|
|
|
2014-04-29 14:52:35 +00:00
|
|
|
return false;
|
2003-10-26 19:40:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2005-03-28 00:04:54 +00:00
|
|
|
void FrameBuffer::setCursorState()
|
2003-10-26 19:40:39 +00:00
|
|
|
{
|
2017-01-28 23:15:30 +00:00
|
|
|
// Always grab mouse in emulation (if enabled) and emulating a controller
|
|
|
|
// that always uses the mouse
|
2011-05-06 14:29:39 +00:00
|
|
|
bool emulation =
|
2017-12-21 01:26:22 +00:00
|
|
|
myOSystem.eventHandler().state() == EventHandlerState::EMULATION;
|
2017-01-28 23:15:30 +00:00
|
|
|
bool analog = myOSystem.hasConsole() ?
|
2019-03-29 23:17:24 +00:00
|
|
|
(myOSystem.console().leftController().isAnalog() ||
|
|
|
|
myOSystem.console().rightController().isAnalog()) : false;
|
2017-09-18 18:48:49 +00:00
|
|
|
bool alwaysUseMouse = BSPF::equalsIgnoreCase("always", myOSystem.settings().getString("usemouse"));
|
2017-01-28 23:15:30 +00:00
|
|
|
|
2017-11-23 21:13:37 +00:00
|
|
|
grabMouse(emulation && (analog || alwaysUseMouse) && myGrabMouse);
|
2015-06-28 18:16:33 +00:00
|
|
|
|
|
|
|
// Show/hide cursor in UI/emulation mode based on 'cursor' setting
|
|
|
|
switch(myOSystem.settings().getInt("cursor"))
|
|
|
|
{
|
|
|
|
case 0: showCursor(false); break;
|
|
|
|
case 1: showCursor(emulation); break;
|
|
|
|
case 2: showCursor(!emulation); break;
|
|
|
|
case 3: showCursor(true); break;
|
|
|
|
}
|
2003-10-01 19:01:02 +00:00
|
|
|
}
|
|
|
|
|
2017-11-23 21:13:37 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void FrameBuffer::enableGrabMouse(bool enable)
|
|
|
|
{
|
|
|
|
myGrabMouse = enable;
|
|
|
|
setCursorState();
|
|
|
|
}
|
|
|
|
|
2011-06-07 13:40:59 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void FrameBuffer::toggleGrabMouse()
|
|
|
|
{
|
2017-11-23 21:13:37 +00:00
|
|
|
myGrabMouse = !myGrabMouse;
|
2011-06-07 13:40:59 +00:00
|
|
|
setCursorState();
|
2017-11-24 19:38:21 +00:00
|
|
|
myOSystem.settings().setValue("grabmouse", myGrabMouse);
|
2011-06-07 13:40:59 +00:00
|
|
|
}
|
|
|
|
|
Added preliminary framework for using advanced scalers. Right now,
functionality is exactly the same as before; Alt-Equals goes to the
next valid scaler, and Alt-Minus goes to the previous one.
What were previously zoomed modes are now treated as scalers, named
'Zoom1x', 'Zoom2x', etc. Various scalexx and hqxx modes will also be made
available.
For now, and probably forever, these advanced scaling modes will only
be available for OpenGL, since if you don't have a card that can handle
GL well, the scalers will probably be too much anyway. Also, the advanced
scaling will not be available in UI mode, only OpenGL emulation mode.
The UI (Launcher, Debugger) and emulation modes are now scaled separately,
specified with the new settings 'scale_ui' and 'scale_tia'. The 'zoom'
setting has been removed.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1133 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-10-14 20:08:29 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2008-06-19 12:01:31 +00:00
|
|
|
uInt32 FrameBuffer::maxWindowSizeForScreen(uInt32 baseWidth, uInt32 baseHeight,
|
2014-10-21 23:02:20 +00:00
|
|
|
uInt32 screenWidth, uInt32 screenHeight) const
|
Added preliminary framework for using advanced scalers. Right now,
functionality is exactly the same as before; Alt-Equals goes to the
next valid scaler, and Alt-Minus goes to the previous one.
What were previously zoomed modes are now treated as scalers, named
'Zoom1x', 'Zoom2x', etc. Various scalexx and hqxx modes will also be made
available.
For now, and probably forever, these advanced scaling modes will only
be available for OpenGL, since if you don't have a card that can handle
GL well, the scalers will probably be too much anyway. Also, the advanced
scaling will not be available in UI mode, only OpenGL emulation mode.
The UI (Launcher, Debugger) and emulation modes are now scaled separately,
specified with the new settings 'scale_ui' and 'scale_tia'. The 'zoom'
setting has been removed.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1133 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-10-14 20:08:29 +00:00
|
|
|
{
|
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for
those systems which don't actually have a windowing environment. When
this is set, toggling from fullscreen will not be possible, and certain
window-related UI functions will not be accessible.
Completely revamped video subsystem. Windowed and fullscreen modes are
now dealt with separately. Windows can be zoomed using the 'zoom_ui'
and 'zoom_tia' arguments. Fullscreen modes are now set by resolution,
not zoom, so you can specify to always use a certain fullscreen
resolution, and the images will be scaled appropriately. This also
fixes the fullscreen issues on widescreen monitors; just select a
widescreen video mode, and the aspect ratio will always be correct.
Removed dirty-rect support for software rendering of the TIA image,
as it ended up being slower than just updating the entire image.
For those resolutions where it will start to slow down (1024x768 or
higher), one should be using OpenGL.
Fixed issue in Windows when returning from fullscreen mode made the
window constantly 'shrink' in size. It was related to auto-detecting
the desktop resolution, which is really the job of SDL. As such, all
further releases of Stella will require SDL 1.2.10, which includes
this auto-detection code internally.
Made ROM launcher resizable, configurable in sizes from 320x240
to 800x600. Updated the UIDialog to change these quantities from the
UI (Stella will need to be restarted for it to take effect).
Removed aspect ratio support, since it was causing problems, and the
new fullscreen mode work has made it obsolete. i *may* consider it
again in the future, if there's sufficient demand.
Added 'fullres' commandline argument, used to set the fullscreen
resolution.
Added 'launcherres' commandline argument, used to set the ROM
launcher resolution. This replaces 'launchersize' argument, which
has been removed.
Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia',
respectively. Their function remains the same.
Changed meaning of 'gl_fsmax' argument to specify what modes to use
fullscreen OpenGL scaling (previously, this was a boolean, and
didn't consider different modes).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
|
|
|
uInt32 multiplier = 1;
|
|
|
|
for(;;)
|
Added preliminary framework for using advanced scalers. Right now,
functionality is exactly the same as before; Alt-Equals goes to the
next valid scaler, and Alt-Minus goes to the previous one.
What were previously zoomed modes are now treated as scalers, named
'Zoom1x', 'Zoom2x', etc. Various scalexx and hqxx modes will also be made
available.
For now, and probably forever, these advanced scaling modes will only
be available for OpenGL, since if you don't have a card that can handle
GL well, the scalers will probably be too much anyway. Also, the advanced
scaling will not be available in UI mode, only OpenGL emulation mode.
The UI (Launcher, Debugger) and emulation modes are now scaled separately,
specified with the new settings 'scale_ui' and 'scale_tia'. The 'zoom'
setting has been removed.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1133 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-10-14 20:08:29 +00:00
|
|
|
{
|
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for
those systems which don't actually have a windowing environment. When
this is set, toggling from fullscreen will not be possible, and certain
window-related UI functions will not be accessible.
Completely revamped video subsystem. Windowed and fullscreen modes are
now dealt with separately. Windows can be zoomed using the 'zoom_ui'
and 'zoom_tia' arguments. Fullscreen modes are now set by resolution,
not zoom, so you can specify to always use a certain fullscreen
resolution, and the images will be scaled appropriately. This also
fixes the fullscreen issues on widescreen monitors; just select a
widescreen video mode, and the aspect ratio will always be correct.
Removed dirty-rect support for software rendering of the TIA image,
as it ended up being slower than just updating the entire image.
For those resolutions where it will start to slow down (1024x768 or
higher), one should be using OpenGL.
Fixed issue in Windows when returning from fullscreen mode made the
window constantly 'shrink' in size. It was related to auto-detecting
the desktop resolution, which is really the job of SDL. As such, all
further releases of Stella will require SDL 1.2.10, which includes
this auto-detection code internally.
Made ROM launcher resizable, configurable in sizes from 320x240
to 800x600. Updated the UIDialog to change these quantities from the
UI (Stella will need to be restarted for it to take effect).
Removed aspect ratio support, since it was causing problems, and the
new fullscreen mode work has made it obsolete. i *may* consider it
again in the future, if there's sufficient demand.
Added 'fullres' commandline argument, used to set the fullscreen
resolution.
Added 'launcherres' commandline argument, used to set the ROM
launcher resolution. This replaces 'launchersize' argument, which
has been removed.
Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia',
respectively. Their function remains the same.
Changed meaning of 'gl_fsmax' argument to specify what modes to use
fullscreen OpenGL scaling (previously, this was a boolean, and
didn't consider different modes).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
|
|
|
// Figure out the zoomed size of the window
|
2008-06-19 12:01:31 +00:00
|
|
|
uInt32 width = baseWidth * multiplier;
|
|
|
|
uInt32 height = baseHeight * multiplier;
|
Added preliminary framework for using advanced scalers. Right now,
functionality is exactly the same as before; Alt-Equals goes to the
next valid scaler, and Alt-Minus goes to the previous one.
What were previously zoomed modes are now treated as scalers, named
'Zoom1x', 'Zoom2x', etc. Various scalexx and hqxx modes will also be made
available.
For now, and probably forever, these advanced scaling modes will only
be available for OpenGL, since if you don't have a card that can handle
GL well, the scalers will probably be too much anyway. Also, the advanced
scaling will not be available in UI mode, only OpenGL emulation mode.
The UI (Launcher, Debugger) and emulation modes are now scaled separately,
specified with the new settings 'scale_ui' and 'scale_tia'. The 'zoom'
setting has been removed.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1133 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-10-14 20:08:29 +00:00
|
|
|
|
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for
those systems which don't actually have a windowing environment. When
this is set, toggling from fullscreen will not be possible, and certain
window-related UI functions will not be accessible.
Completely revamped video subsystem. Windowed and fullscreen modes are
now dealt with separately. Windows can be zoomed using the 'zoom_ui'
and 'zoom_tia' arguments. Fullscreen modes are now set by resolution,
not zoom, so you can specify to always use a certain fullscreen
resolution, and the images will be scaled appropriately. This also
fixes the fullscreen issues on widescreen monitors; just select a
widescreen video mode, and the aspect ratio will always be correct.
Removed dirty-rect support for software rendering of the TIA image,
as it ended up being slower than just updating the entire image.
For those resolutions where it will start to slow down (1024x768 or
higher), one should be using OpenGL.
Fixed issue in Windows when returning from fullscreen mode made the
window constantly 'shrink' in size. It was related to auto-detecting
the desktop resolution, which is really the job of SDL. As such, all
further releases of Stella will require SDL 1.2.10, which includes
this auto-detection code internally.
Made ROM launcher resizable, configurable in sizes from 320x240
to 800x600. Updated the UIDialog to change these quantities from the
UI (Stella will need to be restarted for it to take effect).
Removed aspect ratio support, since it was causing problems, and the
new fullscreen mode work has made it obsolete. i *may* consider it
again in the future, if there's sufficient demand.
Added 'fullres' commandline argument, used to set the fullscreen
resolution.
Added 'launcherres' commandline argument, used to set the ROM
launcher resolution. This replaces 'launchersize' argument, which
has been removed.
Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia',
respectively. Their function remains the same.
Changed meaning of 'gl_fsmax' argument to specify what modes to use
fullscreen OpenGL scaling (previously, this was a boolean, and
didn't consider different modes).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
|
|
|
if((width > screenWidth) || (height > screenHeight))
|
|
|
|
break;
|
Added preliminary framework for using advanced scalers. Right now,
functionality is exactly the same as before; Alt-Equals goes to the
next valid scaler, and Alt-Minus goes to the previous one.
What were previously zoomed modes are now treated as scalers, named
'Zoom1x', 'Zoom2x', etc. Various scalexx and hqxx modes will also be made
available.
For now, and probably forever, these advanced scaling modes will only
be available for OpenGL, since if you don't have a card that can handle
GL well, the scalers will probably be too much anyway. Also, the advanced
scaling will not be available in UI mode, only OpenGL emulation mode.
The UI (Launcher, Debugger) and emulation modes are now scaled separately,
specified with the new settings 'scale_ui' and 'scale_tia'. The 'zoom'
setting has been removed.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1133 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-10-14 20:08:29 +00:00
|
|
|
|
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for
those systems which don't actually have a windowing environment. When
this is set, toggling from fullscreen will not be possible, and certain
window-related UI functions will not be accessible.
Completely revamped video subsystem. Windowed and fullscreen modes are
now dealt with separately. Windows can be zoomed using the 'zoom_ui'
and 'zoom_tia' arguments. Fullscreen modes are now set by resolution,
not zoom, so you can specify to always use a certain fullscreen
resolution, and the images will be scaled appropriately. This also
fixes the fullscreen issues on widescreen monitors; just select a
widescreen video mode, and the aspect ratio will always be correct.
Removed dirty-rect support for software rendering of the TIA image,
as it ended up being slower than just updating the entire image.
For those resolutions where it will start to slow down (1024x768 or
higher), one should be using OpenGL.
Fixed issue in Windows when returning from fullscreen mode made the
window constantly 'shrink' in size. It was related to auto-detecting
the desktop resolution, which is really the job of SDL. As such, all
further releases of Stella will require SDL 1.2.10, which includes
this auto-detection code internally.
Made ROM launcher resizable, configurable in sizes from 320x240
to 800x600. Updated the UIDialog to change these quantities from the
UI (Stella will need to be restarted for it to take effect).
Removed aspect ratio support, since it was causing problems, and the
new fullscreen mode work has made it obsolete. i *may* consider it
again in the future, if there's sufficient demand.
Added 'fullres' commandline argument, used to set the fullscreen
resolution.
Added 'launcherres' commandline argument, used to set the ROM
launcher resolution. This replaces 'launchersize' argument, which
has been removed.
Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia',
respectively. Their function remains the same.
Changed meaning of 'gl_fsmax' argument to specify what modes to use
fullscreen OpenGL scaling (previously, this was a boolean, and
didn't consider different modes).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
|
|
|
++multiplier;
|
|
|
|
}
|
|
|
|
return multiplier > 1 ? multiplier - 1 : 1;
|
Added preliminary framework for using advanced scalers. Right now,
functionality is exactly the same as before; Alt-Equals goes to the
next valid scaler, and Alt-Minus goes to the previous one.
What were previously zoomed modes are now treated as scalers, named
'Zoom1x', 'Zoom2x', etc. Various scalexx and hqxx modes will also be made
available.
For now, and probably forever, these advanced scaling modes will only
be available for OpenGL, since if you don't have a card that can handle
GL well, the scalers will probably be too much anyway. Also, the advanced
scaling will not be available in UI mode, only OpenGL emulation mode.
The UI (Launcher, Debugger) and emulation modes are now scaled separately,
specified with the new settings 'scale_ui' and 'scale_tia'. The 'zoom'
setting has been removed.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1133 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-10-14 20:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2008-06-19 12:01:31 +00:00
|
|
|
void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
|
Added preliminary framework for using advanced scalers. Right now,
functionality is exactly the same as before; Alt-Equals goes to the
next valid scaler, and Alt-Minus goes to the previous one.
What were previously zoomed modes are now treated as scalers, named
'Zoom1x', 'Zoom2x', etc. Various scalexx and hqxx modes will also be made
available.
For now, and probably forever, these advanced scaling modes will only
be available for OpenGL, since if you don't have a card that can handle
GL well, the scalers will probably be too much anyway. Also, the advanced
scaling will not be available in UI mode, only OpenGL emulation mode.
The UI (Launcher, Debugger) and emulation modes are now scaled separately,
specified with the new settings 'scale_ui' and 'scale_tia'. The 'zoom'
setting has been removed.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1133 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-10-14 20:08:29 +00:00
|
|
|
{
|
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for
those systems which don't actually have a windowing environment. When
this is set, toggling from fullscreen will not be possible, and certain
window-related UI functions will not be accessible.
Completely revamped video subsystem. Windowed and fullscreen modes are
now dealt with separately. Windows can be zoomed using the 'zoom_ui'
and 'zoom_tia' arguments. Fullscreen modes are now set by resolution,
not zoom, so you can specify to always use a certain fullscreen
resolution, and the images will be scaled appropriately. This also
fixes the fullscreen issues on widescreen monitors; just select a
widescreen video mode, and the aspect ratio will always be correct.
Removed dirty-rect support for software rendering of the TIA image,
as it ended up being slower than just updating the entire image.
For those resolutions where it will start to slow down (1024x768 or
higher), one should be using OpenGL.
Fixed issue in Windows when returning from fullscreen mode made the
window constantly 'shrink' in size. It was related to auto-detecting
the desktop resolution, which is really the job of SDL. As such, all
further releases of Stella will require SDL 1.2.10, which includes
this auto-detection code internally.
Made ROM launcher resizable, configurable in sizes from 320x240
to 800x600. Updated the UIDialog to change these quantities from the
UI (Stella will need to be restarted for it to take effect).
Removed aspect ratio support, since it was causing problems, and the
new fullscreen mode work has made it obsolete. i *may* consider it
again in the future, if there's sufficient demand.
Added 'fullres' commandline argument, used to set the fullscreen
resolution.
Added 'launcherres' commandline argument, used to set the ROM
launcher resolution. This replaces 'launchersize' argument, which
has been removed.
Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia',
respectively. Their function remains the same.
Changed meaning of 'gl_fsmax' argument to specify what modes to use
fullscreen OpenGL scaling (previously, this was a boolean, and
didn't consider different modes).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
|
|
|
myWindowedModeList.clear();
|
2014-09-01 21:17:33 +00:00
|
|
|
|
2014-11-02 23:40:20 +00:00
|
|
|
for(auto& mode: myFullscreenModeLists)
|
|
|
|
mode.clear();
|
2019-04-20 20:53:50 +00:00
|
|
|
for(size_t i = myFullscreenModeLists.size(); i < myFullscreenDisplays.size(); ++i)
|
2014-09-01 21:17:33 +00:00
|
|
|
myFullscreenModeLists.push_back(VideoModeList());
|
2008-06-19 12:01:31 +00:00
|
|
|
|
2014-04-28 16:47:10 +00:00
|
|
|
// Check if zooming is allowed for this state (currently only allowed
|
|
|
|
// for TIA screens)
|
2017-12-21 01:26:22 +00:00
|
|
|
EventHandlerState state = myOSystem.eventHandler().state();
|
|
|
|
bool tiaMode = (state != EventHandlerState::DEBUGGER &&
|
|
|
|
state != EventHandlerState::LAUNCHER);
|
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for
those systems which don't actually have a windowing environment. When
this is set, toggling from fullscreen will not be possible, and certain
window-related UI functions will not be accessible.
Completely revamped video subsystem. Windowed and fullscreen modes are
now dealt with separately. Windows can be zoomed using the 'zoom_ui'
and 'zoom_tia' arguments. Fullscreen modes are now set by resolution,
not zoom, so you can specify to always use a certain fullscreen
resolution, and the images will be scaled appropriately. This also
fixes the fullscreen issues on widescreen monitors; just select a
widescreen video mode, and the aspect ratio will always be correct.
Removed dirty-rect support for software rendering of the TIA image,
as it ended up being slower than just updating the entire image.
For those resolutions where it will start to slow down (1024x768 or
higher), one should be using OpenGL.
Fixed issue in Windows when returning from fullscreen mode made the
window constantly 'shrink' in size. It was related to auto-detecting
the desktop resolution, which is really the job of SDL. As such, all
further releases of Stella will require SDL 1.2.10, which includes
this auto-detection code internally.
Made ROM launcher resizable, configurable in sizes from 320x240
to 800x600. Updated the UIDialog to change these quantities from the
UI (Stella will need to be restarted for it to take effect).
Removed aspect ratio support, since it was causing problems, and the
new fullscreen mode work has made it obsolete. i *may* consider it
again in the future, if there's sufficient demand.
Added 'fullres' commandline argument, used to set the fullscreen
resolution.
Added 'launcherres' commandline argument, used to set the ROM
launcher resolution. This replaces 'launchersize' argument, which
has been removed.
Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia',
respectively. Their function remains the same.
Changed meaning of 'gl_fsmax' argument to specify what modes to use
fullscreen OpenGL scaling (previously, this was a boolean, and
didn't consider different modes).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
|
|
|
|
2014-04-28 16:47:10 +00:00
|
|
|
// TIA mode allows zooming at integral factors in windowed modes,
|
|
|
|
// and also non-integral factors in fullscreen mode
|
|
|
|
if(tiaMode)
|
2008-06-19 12:01:31 +00:00
|
|
|
{
|
2014-04-28 16:47:10 +00:00
|
|
|
// TIA windowed modes
|
2019-05-11 17:03:07 +00:00
|
|
|
uInt32 minZoom = 2 * hidpiScaleFactor();
|
2014-04-28 16:47:10 +00:00
|
|
|
uInt32 maxZoom = maxWindowSizeForScreen(baseWidth, baseHeight,
|
2019-05-11 17:03:07 +00:00
|
|
|
myAbsDesktopSize.w, myAbsDesktopSize.h);
|
2009-01-14 20:31:07 +00:00
|
|
|
|
2019-04-08 21:14:27 +00:00
|
|
|
#if 0 // FIXME - does this apply any longer??
|
2014-04-28 16:47:10 +00:00
|
|
|
// Aspect ratio
|
2019-04-08 21:14:27 +00:00
|
|
|
uInt32 aspect = myOSystem.settings().getInt(
|
|
|
|
myOSystem.console().tia().frameLayout() == FrameLayout::ntsc ?
|
|
|
|
"tia.aspectn" : "tia.aspectp");
|
|
|
|
#endif
|
2009-01-14 20:31:07 +00:00
|
|
|
|
2019-04-03 22:57:30 +00:00
|
|
|
// Determine all zoom levels
|
2019-05-11 17:03:07 +00:00
|
|
|
for(uInt32 zoom = minZoom; zoom <= maxZoom; ++zoom)
|
2008-06-19 12:01:31 +00:00
|
|
|
{
|
2014-04-28 16:47:10 +00:00
|
|
|
ostringstream desc;
|
|
|
|
desc << "Zoom " << zoom << "x";
|
2016-12-30 00:00:30 +00:00
|
|
|
|
2019-04-08 21:14:27 +00:00
|
|
|
VideoMode mode(baseWidth*zoom, baseHeight*zoom, baseWidth*zoom, baseHeight*zoom,
|
|
|
|
VideoMode::Stretch::Fill, desc.str(), zoom);
|
2014-04-28 16:47:10 +00:00
|
|
|
myWindowedModeList.add(mode);
|
2008-06-19 12:01:31 +00:00
|
|
|
}
|
Added preliminary framework for using advanced scalers. Right now,
functionality is exactly the same as before; Alt-Equals goes to the
next valid scaler, and Alt-Minus goes to the previous one.
What were previously zoomed modes are now treated as scalers, named
'Zoom1x', 'Zoom2x', etc. Various scalexx and hqxx modes will also be made
available.
For now, and probably forever, these advanced scaling modes will only
be available for OpenGL, since if you don't have a card that can handle
GL well, the scalers will probably be too much anyway. Also, the advanced
scaling will not be available in UI mode, only OpenGL emulation mode.
The UI (Launcher, Debugger) and emulation modes are now scaled separately,
specified with the new settings 'scale_ui' and 'scale_tia'. The 'zoom'
setting has been removed.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1133 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-10-14 20:08:29 +00:00
|
|
|
|
2014-04-28 16:47:10 +00:00
|
|
|
// TIA fullscreen mode
|
2019-04-20 20:53:50 +00:00
|
|
|
for(uInt32 i = 0; i < myFullscreenDisplays.size(); ++i)
|
2014-09-01 21:17:33 +00:00
|
|
|
{
|
|
|
|
maxZoom = maxWindowSizeForScreen(baseWidth, baseHeight,
|
2019-04-20 20:53:50 +00:00
|
|
|
myFullscreenDisplays[i].w, myFullscreenDisplays[i].h);
|
2019-04-08 21:14:27 +00:00
|
|
|
|
|
|
|
// 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,
|
2019-04-20 20:53:50 +00:00
|
|
|
myFullscreenDisplays[i].w, myFullscreenDisplays[i].h,
|
2019-04-08 21:14:27 +00:00
|
|
|
VideoMode::Stretch::Preserve,
|
|
|
|
"Preserve aspect, no stretch", maxZoom, i);
|
|
|
|
myFullscreenModeLists[i].add(mode1);
|
|
|
|
VideoMode mode2(baseWidth*maxZoom, baseHeight*maxZoom,
|
2019-04-20 20:53:50 +00:00
|
|
|
myFullscreenDisplays[i].w, myFullscreenDisplays[i].h,
|
2019-04-08 21:14:27 +00:00
|
|
|
VideoMode::Stretch::Fill,
|
|
|
|
"Ignore aspect, full stretch", maxZoom, i);
|
|
|
|
myFullscreenModeLists[i].add(mode2);
|
2014-09-01 21:17:33 +00:00
|
|
|
}
|
2014-04-28 16:47:10 +00:00
|
|
|
}
|
|
|
|
else // UI mode
|
2008-06-19 12:01:31 +00:00
|
|
|
{
|
2014-04-28 16:47:10 +00:00
|
|
|
// Windowed and fullscreen mode differ only in screen size
|
|
|
|
myWindowedModeList.add(
|
2019-05-12 21:42:30 +00:00
|
|
|
VideoMode(baseWidth, baseHeight, baseWidth, baseHeight, VideoMode::Stretch::None)
|
2014-04-28 16:47:10 +00:00
|
|
|
);
|
2019-04-20 20:53:50 +00:00
|
|
|
for(uInt32 i = 0; i < myFullscreenDisplays.size(); ++i)
|
2014-09-01 21:17:33 +00:00
|
|
|
{
|
|
|
|
myFullscreenModeLists[i].add(
|
2019-04-20 20:53:50 +00:00
|
|
|
VideoMode(baseWidth, baseHeight, myFullscreenDisplays[i].w, myFullscreenDisplays[i].h,
|
2019-05-12 21:42:30 +00:00
|
|
|
VideoMode::Stretch::None, "", 1, i)
|
2014-09-01 21:17:33 +00:00
|
|
|
);
|
|
|
|
}
|
2006-11-18 13:29:12 +00:00
|
|
|
}
|
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for
those systems which don't actually have a windowing environment. When
this is set, toggling from fullscreen will not be possible, and certain
window-related UI functions will not be accessible.
Completely revamped video subsystem. Windowed and fullscreen modes are
now dealt with separately. Windows can be zoomed using the 'zoom_ui'
and 'zoom_tia' arguments. Fullscreen modes are now set by resolution,
not zoom, so you can specify to always use a certain fullscreen
resolution, and the images will be scaled appropriately. This also
fixes the fullscreen issues on widescreen monitors; just select a
widescreen video mode, and the aspect ratio will always be correct.
Removed dirty-rect support for software rendering of the TIA image,
as it ended up being slower than just updating the entire image.
For those resolutions where it will start to slow down (1024x768 or
higher), one should be using OpenGL.
Fixed issue in Windows when returning from fullscreen mode made the
window constantly 'shrink' in size. It was related to auto-detecting
the desktop resolution, which is really the job of SDL. As such, all
further releases of Stella will require SDL 1.2.10, which includes
this auto-detection code internally.
Made ROM launcher resizable, configurable in sizes from 320x240
to 800x600. Updated the UIDialog to change these quantities from the
UI (Stella will need to be restarted for it to take effect).
Removed aspect ratio support, since it was causing problems, and the
new fullscreen mode work has made it obsolete. i *may* consider it
again in the future, if there's sufficient demand.
Added 'fullres' commandline argument, used to set the fullscreen
resolution.
Added 'launcherres' commandline argument, used to set the ROM
launcher resolution. This replaces 'launchersize' argument, which
has been removed.
Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia',
respectively. Their function remains the same.
Changed meaning of 'gl_fsmax' argument to specify what modes to use
fullscreen OpenGL scaling (previously, this was a boolean, and
didn't consider different modes).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
|
|
|
}
|
Added preliminary framework for using advanced scalers. Right now,
functionality is exactly the same as before; Alt-Equals goes to the
next valid scaler, and Alt-Minus goes to the previous one.
What were previously zoomed modes are now treated as scalers, named
'Zoom1x', 'Zoom2x', etc. Various scalexx and hqxx modes will also be made
available.
For now, and probably forever, these advanced scaling modes will only
be available for OpenGL, since if you don't have a card that can handle
GL well, the scalers will probably be too much anyway. Also, the advanced
scaling will not be available in UI mode, only OpenGL emulation mode.
The UI (Launcher, Debugger) and emulation modes are now scaled separately,
specified with the new settings 'scale_ui' and 'scale_tia'. The 'zoom'
setting has been removed.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1133 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-10-14 20:08:29 +00:00
|
|
|
|
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for
those systems which don't actually have a windowing environment. When
this is set, toggling from fullscreen will not be possible, and certain
window-related UI functions will not be accessible.
Completely revamped video subsystem. Windowed and fullscreen modes are
now dealt with separately. Windows can be zoomed using the 'zoom_ui'
and 'zoom_tia' arguments. Fullscreen modes are now set by resolution,
not zoom, so you can specify to always use a certain fullscreen
resolution, and the images will be scaled appropriately. This also
fixes the fullscreen issues on widescreen monitors; just select a
widescreen video mode, and the aspect ratio will always be correct.
Removed dirty-rect support for software rendering of the TIA image,
as it ended up being slower than just updating the entire image.
For those resolutions where it will start to slow down (1024x768 or
higher), one should be using OpenGL.
Fixed issue in Windows when returning from fullscreen mode made the
window constantly 'shrink' in size. It was related to auto-detecting
the desktop resolution, which is really the job of SDL. As such, all
further releases of Stella will require SDL 1.2.10, which includes
this auto-detection code internally.
Made ROM launcher resizable, configurable in sizes from 320x240
to 800x600. Updated the UIDialog to change these quantities from the
UI (Stella will need to be restarted for it to take effect).
Removed aspect ratio support, since it was causing problems, and the
new fullscreen mode work has made it obsolete. i *may* consider it
again in the future, if there's sufficient demand.
Added 'fullres' commandline argument, used to set the fullscreen
resolution.
Added 'launcherres' commandline argument, used to set the ROM
launcher resolution. This replaces 'launchersize' argument, which
has been removed.
Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia',
respectively. Their function remains the same.
Changed meaning of 'gl_fsmax' argument to specify what modes to use
fullscreen OpenGL scaling (previously, this was a boolean, and
didn't consider different modes).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2019-04-08 21:14:27 +00:00
|
|
|
const FrameBuffer::VideoMode& FrameBuffer::getSavedVidMode(bool fullscreen)
|
Added 'WINDOWED_SUPPORT' compile-time argument, which can be used for
those systems which don't actually have a windowing environment. When
this is set, toggling from fullscreen will not be possible, and certain
window-related UI functions will not be accessible.
Completely revamped video subsystem. Windowed and fullscreen modes are
now dealt with separately. Windows can be zoomed using the 'zoom_ui'
and 'zoom_tia' arguments. Fullscreen modes are now set by resolution,
not zoom, so you can specify to always use a certain fullscreen
resolution, and the images will be scaled appropriately. This also
fixes the fullscreen issues on widescreen monitors; just select a
widescreen video mode, and the aspect ratio will always be correct.
Removed dirty-rect support for software rendering of the TIA image,
as it ended up being slower than just updating the entire image.
For those resolutions where it will start to slow down (1024x768 or
higher), one should be using OpenGL.
Fixed issue in Windows when returning from fullscreen mode made the
window constantly 'shrink' in size. It was related to auto-detecting
the desktop resolution, which is really the job of SDL. As such, all
further releases of Stella will require SDL 1.2.10, which includes
this auto-detection code internally.
Made ROM launcher resizable, configurable in sizes from 320x240
to 800x600. Updated the UIDialog to change these quantities from the
UI (Stella will need to be restarted for it to take effect).
Removed aspect ratio support, since it was causing problems, and the
new fullscreen mode work has made it obsolete. i *may* consider it
again in the future, if there's sufficient demand.
Added 'fullres' commandline argument, used to set the fullscreen
resolution.
Added 'launcherres' commandline argument, used to set the ROM
launcher resolution. This replaces 'launchersize' argument, which
has been removed.
Changed 'scale_ui' and 'scale_tia' to 'zoom_ui' and 'zoom_tia',
respectively. Their function remains the same.
Changed meaning of 'gl_fsmax' argument to specify what modes to use
fullscreen OpenGL scaling (previously, this was a boolean, and
didn't consider different modes).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1323 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-06-20 16:33:23 +00:00
|
|
|
{
|
2014-04-28 16:47:10 +00:00
|
|
|
if(fullscreen)
|
2014-09-01 21:17:33 +00:00
|
|
|
{
|
|
|
|
Int32 i = getCurrentDisplayIndex();
|
|
|
|
if(i < 0)
|
|
|
|
{
|
|
|
|
// default to the first display
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
myCurrentModeList = &myFullscreenModeLists[i];
|
|
|
|
}
|
2008-06-19 12:01:31 +00:00
|
|
|
else
|
|
|
|
myCurrentModeList = &myWindowedModeList;
|
|
|
|
|
|
|
|
// Now select the best resolution depending on the state
|
|
|
|
// UI modes (launcher and debugger) have only one supported resolution
|
|
|
|
// so the 'current' one is the only valid one
|
2019-05-12 21:42:30 +00:00
|
|
|
EventHandlerState state = myOSystem.eventHandler().state();
|
2017-12-21 01:26:22 +00:00
|
|
|
if(state == EventHandlerState::DEBUGGER || state == EventHandlerState::LAUNCHER)
|
2019-04-08 21:14:27 +00:00
|
|
|
myCurrentModeList->setByZoom(1);
|
|
|
|
else // TIA mode
|
|
|
|
{
|
|
|
|
if(fullscreen)
|
2019-04-14 17:27:28 +00:00
|
|
|
myCurrentModeList->setByStretch(myOSystem.settings().getBool("tia.fs_stretch")
|
2019-04-08 21:14:27 +00:00
|
|
|
? VideoMode::Stretch::Fill : VideoMode::Stretch::Preserve);
|
|
|
|
else
|
|
|
|
myCurrentModeList->setByZoom(myOSystem.settings().getInt("tia.zoom"));
|
|
|
|
}
|
2014-04-28 16:47:10 +00:00
|
|
|
|
|
|
|
return myCurrentModeList->current();
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
//
|
|
|
|
// VideoMode implementation
|
|
|
|
//
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2019-04-08 21:14:27 +00:00
|
|
|
FrameBuffer::VideoMode::VideoMode()
|
2019-05-12 21:42:30 +00:00
|
|
|
: stretch(VideoMode::Stretch::None),
|
2019-04-08 21:14:27 +00:00
|
|
|
description(""),
|
2014-04-28 16:47:10 +00:00
|
|
|
zoom(1),
|
2019-04-08 21:14:27 +00:00
|
|
|
fsIndex(-1)
|
2014-04-28 16:47:10 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2019-04-08 21:14:27 +00:00
|
|
|
FrameBuffer::VideoMode::VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
|
|
|
|
Stretch smode, const string& desc,
|
|
|
|
uInt32 zoomLevel, Int32 fsindex)
|
|
|
|
: stretch(smode),
|
|
|
|
description(desc),
|
|
|
|
zoom(zoomLevel),
|
|
|
|
fsIndex(fsindex)
|
2014-04-28 16:47:10 +00:00
|
|
|
{
|
2019-04-08 21:14:27 +00:00
|
|
|
// First set default size and positioning
|
2019-03-10 17:49:30 +00:00
|
|
|
sw = std::max(sw, TIAConstants::viewableWidth);
|
|
|
|
sh = std::max(sh, TIAConstants::viewableHeight);
|
2016-04-03 00:35:00 +00:00
|
|
|
iw = std::min(iw, sw);
|
|
|
|
ih = std::min(ih, sh);
|
2014-04-28 16:47:10 +00:00
|
|
|
int ix = (sw - iw) >> 1;
|
|
|
|
int iy = (sh - ih) >> 1;
|
2019-05-02 20:28:39 +00:00
|
|
|
image = Common::Rect(ix, iy, ix+iw, iy+ih);
|
|
|
|
screen = Common::Size(sw, sh);
|
2014-04-28 16:47:10 +00:00
|
|
|
|
2019-04-08 21:14:27 +00:00
|
|
|
// Now resize based on windowed/fullscreen mode and stretch factor
|
|
|
|
iw = image.width();
|
|
|
|
ih = image.height();
|
2014-04-28 16:47:10 +00:00
|
|
|
|
2014-09-01 21:17:33 +00:00
|
|
|
if(fsIndex != -1)
|
2008-06-19 12:01:31 +00:00
|
|
|
{
|
2019-04-08 21:14:27 +00:00
|
|
|
switch(stretch)
|
2014-06-02 14:34:12 +00:00
|
|
|
{
|
2019-04-08 21:14:27 +00:00
|
|
|
case Stretch::Preserve:
|
2014-04-28 16:47:10 +00:00
|
|
|
{
|
2019-04-08 21:14:27 +00:00
|
|
|
float stretchFactor = 1.0;
|
|
|
|
float scaleX = float(iw) / screen.w;
|
|
|
|
float scaleY = float(ih) / screen.h;
|
|
|
|
|
|
|
|
// Scale to all available space, keep aspect correct
|
|
|
|
if(scaleX > scaleY)
|
|
|
|
stretchFactor = float(screen.w) / iw;
|
|
|
|
else
|
|
|
|
stretchFactor = float(screen.h) / ih;
|
|
|
|
|
|
|
|
iw = uInt32(stretchFactor * iw);
|
|
|
|
ih = uInt32(stretchFactor * ih);
|
|
|
|
break;
|
2014-04-28 16:47:10 +00:00
|
|
|
}
|
2019-04-08 21:14:27 +00:00
|
|
|
|
|
|
|
case Stretch::Fill:
|
|
|
|
// Scale to all available space
|
|
|
|
iw = screen.w;
|
|
|
|
ih = screen.h;
|
|
|
|
break;
|
2019-05-12 21:42:30 +00:00
|
|
|
|
|
|
|
case Stretch::None:
|
|
|
|
// Don't do any scaling at all
|
|
|
|
break;
|
2014-04-28 16:47:10 +00:00
|
|
|
}
|
2008-07-04 14:27:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-04-08 21:14:27 +00:00
|
|
|
// In windowed mode, currently the size is scaled to the screen
|
|
|
|
// TODO - this may be updated if/when we allow variable-sized windows
|
|
|
|
switch(stretch)
|
|
|
|
{
|
|
|
|
case Stretch::Preserve:
|
|
|
|
case Stretch::Fill:
|
2019-05-12 21:42:30 +00:00
|
|
|
case Stretch::None:
|
2019-04-08 21:14:27 +00:00
|
|
|
screen.w = iw;
|
|
|
|
screen.h = ih;
|
|
|
|
break;
|
|
|
|
}
|
2008-07-04 14:27:17 +00:00
|
|
|
}
|
|
|
|
|
2014-04-28 16:47:10 +00:00
|
|
|
// Now re-calculate the dimensions
|
2016-04-03 00:35:00 +00:00
|
|
|
iw = std::min(iw, screen.w);
|
|
|
|
ih = std::min(ih, screen.h);
|
2014-04-28 16:47:10 +00:00
|
|
|
|
|
|
|
image.moveTo((screen.w - iw) >> 1, (screen.h - ih) >> 1);
|
|
|
|
image.setWidth(iw);
|
|
|
|
image.setHeight(ih);
|
2008-07-04 14:27:17 +00:00
|
|
|
}
|
|
|
|
|
2019-04-08 21:14:27 +00:00
|
|
|
|
2014-04-28 16:47:10 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
//
|
|
|
|
// VideoModeList implementation
|
|
|
|
//
|
2008-07-04 14:27:17 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
FrameBuffer::VideoModeList::VideoModeList()
|
2009-06-05 14:05:23 +00:00
|
|
|
: myIdx(-1)
|
2008-07-04 14:27:17 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-04-28 16:47:10 +00:00
|
|
|
void FrameBuffer::VideoModeList::add(const VideoMode& mode)
|
2008-07-04 14:27:17 +00:00
|
|
|
{
|
2014-11-09 03:05:19 +00:00
|
|
|
myModeList.emplace_back(mode);
|
2008-07-04 14:27:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void FrameBuffer::VideoModeList::clear()
|
|
|
|
{
|
|
|
|
myModeList.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2014-11-07 23:28:40 +00:00
|
|
|
bool FrameBuffer::VideoModeList::empty() const
|
2008-07-04 14:27:17 +00:00
|
|
|
{
|
2014-11-07 23:28:40 +00:00
|
|
|
return myModeList.empty();
|
2008-07-04 14:27:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
uInt32 FrameBuffer::VideoModeList::size() const
|
|
|
|
{
|
2015-09-14 21:44:24 +00:00
|
|
|
return uInt32(myModeList.size());
|
2008-07-04 14:27:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
Reworked 'fullres' argument to also accept the 'auto' option. In this case,
fullscreen resolutions will be automatically chosen based on the required
size for the window. The image will be centered and keep the same aspect
ratio, however, so operation will still work correctly on widescreen
monitors. 'Auto' will be the new default. Otherwise, if a specific
resolution is requested, Stella will try to accomodate it *only* if it fits
into the resolution; otherwise the smallest resolution that fits will be
used.
Removed 'zoom_ui' and 'zoom_tia'. The UI can now only be at 1x mode.
Aded 'tia_filter' commandline argument, which specifies to the filter
to use when rendering the tia image. For now, these accept 'zoom1x',
'zoom2x'..., up to 'zoom10x', and duplicate previous behaviour. Eventually,
Scalexx and HQxx filters may be added. Still TODO is add this to the UI.
First pass at making the standard build use a minimum of zoom2x for the TIA,
so the UI can be larger and use a better looking font. There's still work
to do in this area, especially for those ports with limited hardware that
support zoom1x only.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1544 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2008-07-22 14:54:39 +00:00
|
|
|
void FrameBuffer::VideoModeList::previous()
|
2008-07-04 14:27:17 +00:00
|
|
|
{
|
|
|
|
--myIdx;
|
2015-09-14 18:14:00 +00:00
|
|
|
if(myIdx < 0) myIdx = int(myModeList.size()) - 1;
|
2008-07-04 14:27:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2019-04-08 21:14:27 +00:00
|
|
|
const FrameBuffer::VideoMode& FrameBuffer::VideoModeList::current() const
|
2008-07-04 14:27:17 +00:00
|
|
|
{
|
|
|
|
return myModeList[myIdx];
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
Reworked 'fullres' argument to also accept the 'auto' option. In this case,
fullscreen resolutions will be automatically chosen based on the required
size for the window. The image will be centered and keep the same aspect
ratio, however, so operation will still work correctly on widescreen
monitors. 'Auto' will be the new default. Otherwise, if a specific
resolution is requested, Stella will try to accomodate it *only* if it fits
into the resolution; otherwise the smallest resolution that fits will be
used.
Removed 'zoom_ui' and 'zoom_tia'. The UI can now only be at 1x mode.
Aded 'tia_filter' commandline argument, which specifies to the filter
to use when rendering the tia image. For now, these accept 'zoom1x',
'zoom2x'..., up to 'zoom10x', and duplicate previous behaviour. Eventually,
Scalexx and HQxx filters may be added. Still TODO is add this to the UI.
First pass at making the standard build use a minimum of zoom2x for the TIA,
so the UI can be larger and use a better looking font. There's still work
to do in this area, especially for those ports with limited hardware that
support zoom1x only.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1544 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2008-07-22 14:54:39 +00:00
|
|
|
void FrameBuffer::VideoModeList::next()
|
2008-07-04 14:27:17 +00:00
|
|
|
{
|
|
|
|
myIdx = (myIdx + 1) % myModeList.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2019-04-08 21:14:27 +00:00
|
|
|
void FrameBuffer::VideoModeList::setByZoom(uInt32 zoom)
|
2008-07-04 14:27:17 +00:00
|
|
|
{
|
2014-04-28 16:47:10 +00:00
|
|
|
for(uInt32 i = 0; i < myModeList.size(); ++i)
|
2008-07-04 14:27:17 +00:00
|
|
|
{
|
2014-04-28 16:47:10 +00:00
|
|
|
if(myModeList[i].zoom == zoom)
|
2008-07-04 14:27:17 +00:00
|
|
|
{
|
|
|
|
myIdx = i;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
myIdx = 0;
|
|
|
|
}
|
|
|
|
|
2019-04-08 21:14:27 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void FrameBuffer::VideoModeList::setByStretch(FrameBuffer::VideoMode::Stretch stretch)
|
|
|
|
{
|
|
|
|
for(uInt32 i = 0; i < myModeList.size(); ++i)
|
|
|
|
{
|
|
|
|
if(myModeList[i].stretch == stretch)
|
|
|
|
{
|
|
|
|
myIdx = i;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
myIdx = 0;
|
|
|
|
}
|
|
|
|
|
2014-01-31 16:23:10 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
/*
|
|
|
|
Palette is defined as follows:
|
2017-12-17 09:09:59 +00:00
|
|
|
*** Base colors ***
|
2014-01-31 16:23:10 +00:00
|
|
|
kColor Normal foreground color (non-text)
|
|
|
|
kBGColor Normal background color (non-text)
|
2017-05-04 12:06:32 +00:00
|
|
|
kBGColorLo Disabled background color dark (non-text)
|
|
|
|
kBGColorHi Disabled background color light (non-text)
|
2014-01-31 16:23:10 +00:00
|
|
|
kShadowColor Item is disabled
|
2017-12-17 09:09:59 +00:00
|
|
|
*** Text colors ***
|
2014-01-31 16:23:10 +00:00
|
|
|
kTextColor Normal text color
|
|
|
|
kTextColorHi Highlighted text color
|
|
|
|
kTextColorEm Emphasized text color
|
2018-01-25 16:00:41 +00:00
|
|
|
kTextColorInv Color for selected text
|
2017-12-17 09:09:59 +00:00
|
|
|
*** UI elements (dialog and widgets) ***
|
2014-01-31 16:23:10 +00:00
|
|
|
kDlgColor Dialog background
|
|
|
|
kWidColor Widget background
|
2018-01-24 19:53:00 +00:00
|
|
|
kWidColorHi Widget highlight color
|
2014-01-31 16:23:10 +00:00
|
|
|
kWidFrameColor Border for currently selected widget
|
2017-12-17 09:09:59 +00:00
|
|
|
*** Button colors ***
|
2014-01-31 16:23:10 +00:00
|
|
|
kBtnColor Normal button background
|
|
|
|
kBtnColorHi Highlighted button background
|
2018-01-25 14:10:37 +00:00
|
|
|
kBtnBorderColor,
|
|
|
|
kBtnBorderColorHi,
|
2014-01-31 16:23:10 +00:00
|
|
|
kBtnTextColor Normal button font color
|
|
|
|
kBtnTextColorHi Highlighted button font color
|
2017-12-17 09:09:59 +00:00
|
|
|
*** Checkbox colors ***
|
2014-01-31 16:23:10 +00:00
|
|
|
kCheckColor Color of 'X' in checkbox
|
2017-12-17 09:09:59 +00:00
|
|
|
*** Scrollbar colors ***
|
2014-01-31 16:23:10 +00:00
|
|
|
kScrollColor Normal scrollbar color
|
|
|
|
kScrollColorHi Highlighted scrollbar color
|
2018-08-22 09:10:45 +00:00
|
|
|
*** Debugger colors ***
|
|
|
|
kDbgChangedColor Background color for changed cells
|
|
|
|
kDbgChangedTextColor Text color for changed cells
|
|
|
|
kDbgColorHi Highlighted color in debugger data cells
|
|
|
|
kDbgColorRed Red color in debugger
|
2017-12-17 09:09:59 +00:00
|
|
|
*** Slider colors ***
|
2018-02-01 17:21:57 +00:00
|
|
|
kSliderColor Enabled slider
|
|
|
|
kSliderColorHi Focussed slider
|
|
|
|
kSliderBGColor Enabled slider background
|
|
|
|
kSliderBGColorHi Focussed slider background
|
|
|
|
kSliderBGColorLo Disabled slider background
|
2018-01-24 13:37:07 +00:00
|
|
|
*** Other colors ***
|
|
|
|
kColorInfo TIA output position color
|
2018-01-26 11:55:05 +00:00
|
|
|
kColorTitleBar Title bar color
|
|
|
|
kColorTitleText Title text color
|
2018-01-28 13:37:31 +00:00
|
|
|
kColorTitleBarLo Disabled title bar color
|
|
|
|
kColorTitleTextLo Disabled title text color
|
2014-01-31 16:23:10 +00:00
|
|
|
*/
|
2017-12-16 23:48:30 +00:00
|
|
|
uInt32 FrameBuffer::ourGUIColors[3][kNumColors-256] = {
|
2014-09-03 13:27:33 +00:00
|
|
|
// Standard
|
2018-01-25 16:00:41 +00:00
|
|
|
{ 0x686868, 0x000000, 0xa38c61, 0xdccfa5, 0x404040, // base
|
|
|
|
0x000000, 0xac3410, 0x9f0000, 0xf0f0cf, // text
|
|
|
|
0xc9af7c, 0xf0f0cf, 0xd55941, 0xc80000, // UI elements
|
|
|
|
0xac3410, 0xd55941, 0x686868, 0xdccfa5, 0xf0f0cf, 0xf0f0cf, // buttons
|
|
|
|
0xac3410, // checkbox
|
2018-08-28 18:49:50 +00:00
|
|
|
0xac3410, 0xd55941, // scrollbar
|
2018-01-25 16:00:41 +00:00
|
|
|
0xc80000, 0x00ff00, 0xc8c8ff, 0xc80000, // debugger
|
2018-08-22 09:10:45 +00:00
|
|
|
0xac3410, 0xd55941, 0xdccfa5, 0xf0f0cf, 0xa38c61, // slider
|
2018-01-26 11:55:05 +00:00
|
|
|
0xffffff, 0xac3410, 0xf0f0cf, 0x686868, 0xdccfa5 // other
|
2017-12-19 17:10:01 +00:00
|
|
|
},
|
2014-09-03 13:27:33 +00:00
|
|
|
// Classic
|
2018-01-25 16:00:41 +00:00
|
|
|
{ 0x686868, 0x000000, 0x404040, 0x404040, 0x404040, // base
|
2018-01-26 10:33:46 +00:00
|
|
|
0x20a020, 0x00ff00, 0xc80000, 0x000000, // text
|
2018-01-25 16:00:41 +00:00
|
|
|
0x000000, 0x000000, 0x00ff00, 0xc80000, // UI elements
|
|
|
|
0x000000, 0x000000, 0x686868, 0x00ff00, 0x20a020, 0x00ff00, // buttons
|
|
|
|
0x20a020, // checkbox
|
2018-08-28 18:49:50 +00:00
|
|
|
0x20a020, 0x00ff00, // scrollbar
|
2018-01-25 16:00:41 +00:00
|
|
|
0xc80000, 0x00ff00, 0xc8c8ff, 0xc80000, // debugger
|
2018-08-22 09:10:45 +00:00
|
|
|
0x20a020, 0x00ff00, 0x404040, 0x686868, 0x404040, // slider
|
2018-02-06 11:46:27 +00:00
|
|
|
0x00ff00, 0x20a020, 0x000000, 0x686868, 0x404040 // other
|
2017-12-16 23:48:30 +00:00
|
|
|
},
|
|
|
|
// Light
|
2018-01-26 10:33:46 +00:00
|
|
|
{ 0x808080, 0x000000, 0xc0c0c0, 0xe1e1e1, 0x333333, // base
|
|
|
|
0x000000, 0xBDDEF9, 0x0078d7, 0x000000, // text
|
2018-01-25 16:00:41 +00:00
|
|
|
0xf0f0f0, 0xffffff, 0x0078d7, 0x0f0f0f, // UI elements
|
|
|
|
0xe1e1e1, 0xe5f1fb, 0x808080, 0x0078d7, 0x000000, 0x000000, // buttons
|
|
|
|
0x333333, // checkbox
|
2018-08-28 18:49:50 +00:00
|
|
|
0xc0c0c0, 0x808080, // scrollbar
|
2018-01-25 16:00:41 +00:00
|
|
|
0xffc0c0, 0x000000, 0xe00000, 0xc00000, // debugger
|
2018-08-22 09:10:45 +00:00
|
|
|
0x333333, 0x0078d7, 0xc0c0c0, 0xffffff, 0xc0c0c0, // slider 0xBDDEF9| 0xe1e1e1 | 0xffffff
|
2018-01-26 11:55:05 +00:00
|
|
|
0xffffff, 0x333333, 0xf0f0f0, 0x808080, 0xc0c0c0 // other
|
2014-09-03 13:27:33 +00:00
|
|
|
}
|
2014-01-31 16:23:10 +00:00
|
|
|
};
|