diff --git a/Changes.txt b/Changes.txt index cc3b433a2..697fe0511 100644 --- a/Changes.txt +++ b/Changes.txt @@ -70,6 +70,10 @@ * PNG/ZIP image support is now conditionally compiled into Stella. All major ports (Linux/macOS/Windows) have it enabled by default. + * SDL/GUI support is now conditionally compiled into Stella. All major + ports (Linux/macOS/Windows) have it enabled by default. This is + currently used only by the libretro port. + -Have fun! diff --git a/Makefile b/Makefile index ba9abf7e3..318efa343 100644 --- a/Makefile +++ b/Makefile @@ -150,13 +150,12 @@ MODULES := $(MODULES) # After the game specific modules follow the shared modules MODULES += \ + src/common \ + src/common/audio \ + src/common/tv_filters \ src/emucore \ src/emucore/tia \ - src/emucore/tia/frame-manager \ - src/gui \ - src/common \ - src/common/tv_filters \ - src/common/audio + src/emucore/tia/frame-manager ###################################################################### # The build rules follow - normally you should have no need to diff --git a/configure b/configure index c6c7c2859..85c81550a 100755 --- a/configure +++ b/configure @@ -14,6 +14,7 @@ CXXFLAGS="$CXXFLAGS $CPPFLAGS" # default option behaviour yes/no +_build_gui=yes _build_windowed=yes _build_sound=yes _build_debugger=yes @@ -190,9 +191,11 @@ Installation directories: --datadir=DIR directory to install icons/data files [PREFIX/share] Optional Features: + --enable-gui enable/disable the entire built-in UI [enabled] + --disable-gui --enable-sound enable/disable sound support [enabled] --disable-sound - --enable-debugger enable/disable all debugger options [disabled] + --enable-debugger enable/disable all debugger options [enabled] --disable-debugger --enable-joystick enable/disable joystick support [enabled] --disable-joystick @@ -235,6 +238,8 @@ done # for parm in ... for ac_option in $@; do case "$ac_option" in + --enable-gui) _build_gui=yes ;; + --disable-gui) _build_gui=no ;; --enable-sound) _build_sound=yes ;; --disable-sound) _build_sound=no ;; --enable-debugger) _build_debugger=yes ;; @@ -530,6 +535,7 @@ if test -n "$_host"; then case "$_host" in retron77) echo "Compiling for $_host, disabling windowed mode, debugger and cheats." + _build_gui=yes _build_windowed=no _build_debugger=no _build_cheats=no @@ -686,6 +692,16 @@ echo echo_n "Summary:" echo +if test "$_build_gui" = "yes" ; then + echo_n " GUI enabled" + echo +else + echo_n " GUI disabled" + echo + _build_debugger=no + _build_cheats=no +fi + if test "$_build_sound" = "yes" ; then echo_n " Sound support enabled" echo @@ -797,7 +813,7 @@ LIBPNG="$SRC/libpng" ZLIB="$SRC/zlib" SQLITE="$SRC/common/repository/sqlite" -INCLUDES="-I$CORE -I$COMMON -I$TV -I$GUI -I$TIA -I$TIA_FRAME_MANAGER" +INCLUDES="-I$CORE -I$COMMON -I$TV -I$TIA -I$TIA_FRAME_MANAGER" INCLUDES="$INCLUDES `$_sdlconfig --cflags`" if test "$_build_static" = yes ; then @@ -838,6 +854,12 @@ case $_host_os in ;; esac +if test "$_build_gui" = yes ; then + DEFINES="$DEFINES -DGUI_SUPPORT" + MODULES="$MODULES $GUI" + INCLUDES="$INCLUDES -I$GUI" +fi + if test "$_build_windowed" = yes ; then DEFINES="$DEFINES -DWINDOWED_SUPPORT" fi diff --git a/src/common/FBSurfaceSDL2.cxx b/src/common/FBSurfaceSDL2.cxx index 2b1a52fd4..0bb63c2f4 100644 --- a/src/common/FBSurfaceSDL2.cxx +++ b/src/common/FBSurfaceSDL2.cxx @@ -77,13 +77,13 @@ uInt32 FBSurfaceSDL2::height() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const GUI::Rect& FBSurfaceSDL2::srcRect() const +const Common::Rect& FBSurfaceSDL2::srcRect() const { return mySrcGUIR; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const GUI::Rect& FBSurfaceSDL2::dstRect() const +const Common::Rect& FBSurfaceSDL2::dstRect() const { return myDstGUIR; } diff --git a/src/common/FBSurfaceSDL2.hxx b/src/common/FBSurfaceSDL2.hxx index f55f1d0d9..4c83c3d0f 100644 --- a/src/common/FBSurfaceSDL2.hxx +++ b/src/common/FBSurfaceSDL2.hxx @@ -45,8 +45,8 @@ class FBSurfaceSDL2 : public FBSurface uInt32 width() const override; uInt32 height() const override; - const GUI::Rect& srcRect() const override; - const GUI::Rect& dstRect() const override; + const Common::Rect& srcRect() const override; + const Common::Rect& dstRect() const override; void setSrcPos(uInt32 x, uInt32 y) override; void setSrcSize(uInt32 w, uInt32 h) override; void setDstPos(uInt32 x, uInt32 y) override; @@ -92,7 +92,7 @@ class FBSurfaceSDL2 : public FBSurface unique_ptr myStaticData; // The data to use when the buffer contents are static uInt32 myStaticPitch; // The number of bytes in a row of static data - GUI::Rect mySrcGUIR, myDstGUIR; + Common::Rect mySrcGUIR, myDstGUIR; }; #endif diff --git a/src/common/FrameBufferSDL2.cxx b/src/common/FrameBufferSDL2.cxx index f3b3eb062..ec882ddb8 100644 --- a/src/common/FrameBufferSDL2.cxx +++ b/src/common/FrameBufferSDL2.cxx @@ -20,15 +20,13 @@ #include "Logger.hxx" #include "Console.hxx" -#include "Font.hxx" #include "OSystem.hxx" #include "Settings.hxx" +#include "ThreadDebugging.hxx" #include "FBSurfaceSDL2.hxx" #include "FrameBufferSDL2.hxx" -#include "ThreadDebugging.hxx" - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FrameBufferSDL2::FrameBufferSDL2(OSystem& osystem) : FrameBuffer(osystem), @@ -83,8 +81,8 @@ FrameBufferSDL2::~FrameBufferSDL2() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FrameBufferSDL2::queryHardware(vector& fullscreenRes, - vector& windowedRes, +void FrameBufferSDL2::queryHardware(vector& fullscreenRes, + vector& windowedRes, VariantList& renderers) { ASSERT_MAIN_THREAD; @@ -377,7 +375,7 @@ unique_ptr // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FrameBufferSDL2::readPixels(uInt8* pixels, uInt32 pitch, - const GUI::Rect& rect) const + const Common::Rect& rect) const { ASSERT_MAIN_THREAD; diff --git a/src/common/FrameBufferSDL2.hxx b/src/common/FrameBufferSDL2.hxx index 1e68e3a9e..8aed202ab 100644 --- a/src/common/FrameBufferSDL2.hxx +++ b/src/common/FrameBufferSDL2.hxx @@ -95,7 +95,7 @@ class FrameBufferSDL2 : public FrameBuffer @param pitch The pitch (in bytes) for the pixel data @param rect The bounding rectangle for the buffer */ - void readPixels(uInt8* buffer, uInt32 pitch, const GUI::Rect& rect) const override; + void readPixels(uInt8* buffer, uInt32 pitch, const Common::Rect& rect) const override; /** Clear the frame buffer @@ -115,8 +115,8 @@ class FrameBufferSDL2 : public FrameBuffer @param windowedRes Maximum resolution supported in windowed mode @param renderers List of renderer names (internal name -> end-user name) */ - void queryHardware(vector& fullscreenRes, - vector& windowedRes, + void queryHardware(vector& fullscreenRes, + vector& windowedRes, VariantList& renderers) override; /** diff --git a/src/common/PJoystickHandler.cxx b/src/common/PJoystickHandler.cxx index eb5f91a7f..b7f65b3d5 100644 --- a/src/common/PJoystickHandler.cxx +++ b/src/common/PJoystickHandler.cxx @@ -21,9 +21,12 @@ #include "Joystick.hxx" #include "Settings.hxx" #include "EventHandler.hxx" -#include "DialogContainer.hxx" #include "PJoystickHandler.hxx" +#ifdef GUI_SUPPORT + #include "DialogContainer.hxx" +#endif + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PhysicalJoystickHandler::PhysicalJoystickHandler( OSystem& system, EventHandler& handler, Event& event) @@ -565,7 +568,9 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value) // (only pass on the event if the state has changed) if(value != j->axisLastValue[axis]) { + #ifdef GUI_SUPPORT myHandler.overlay().handleJoyAxisEvent(stick, axis, value); + #endif j->axisLastValue[axis] = value; } } @@ -608,8 +613,10 @@ void PhysicalJoystickHandler::handleBtnEvent(int stick, int button, bool pressed // Determine which mode we're in, then send the event to the appropriate place if(myHandler.state() == EventHandlerState::EMULATION) myHandler.handleEvent(j->btnTable[button][kEmulationMode], pressed); + #ifdef GUI_SUPPORT else if(myHandler.hasOverlay()) myHandler.overlay().handleJoyBtnEvent(stick, button, pressed); + #endif break; // Regular button // These events don't have to pass through handleEvent, since @@ -671,6 +678,7 @@ void PhysicalJoystickHandler::handleHatEvent(int stick, int hat, int value) myHandler.handleEvent(j->hatTable[hat][int(JoyHat::LEFT)][kEmulationMode], value & EVENT_HATLEFT_M); } +#ifdef GUI_SUPPORT else if(myHandler.hasOverlay()) { if(value == EVENT_HATCENTER_M) @@ -687,6 +695,7 @@ void PhysicalJoystickHandler::handleHatEvent(int stick, int hat, int value) myHandler.overlay().handleJoyHatEvent(stick, hat, JoyHat::LEFT); } } +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx index e43b514e8..48169bc8c 100644 --- a/src/common/PKeyboardHandler.cxx +++ b/src/common/PKeyboardHandler.cxx @@ -25,12 +25,14 @@ #include "StellaKeys.hxx" #include "TIASurface.hxx" #include "PNGLibrary.hxx" -#include "DialogContainer.hxx" #include "PKeyboardHandler.hxx" #ifdef DEBUGGER_SUPPORT #include "Debugger.hxx" #endif +#ifdef GUI_SUPPORT + #include "DialogContainer.hxx" +#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PhysicalKeyboardHandler::PhysicalKeyboardHandler( @@ -337,8 +339,10 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod, bool pre break; default: + #ifdef GUI_SUPPORT if(myHandler.hasOverlay()) myHandler.overlay().handleKeyEvent(key, mod, pressed); + #endif break; } } diff --git a/src/common/PNGLibrary.cxx b/src/common/PNGLibrary.cxx index b27882a9f..b5d625f6d 100644 --- a/src/common/PNGLibrary.cxx +++ b/src/common/PNGLibrary.cxx @@ -131,7 +131,7 @@ void PNGLibrary::saveImage(const string& filename, const VariantList& comments) throw runtime_error("ERROR: Couldn't create snapshot file"); const FrameBuffer& fb = myOSystem.frameBuffer(); - const GUI::Rect& rect = fb.imageRect(); + const Common::Rect& rect = fb.imageRect(); png_uint_32 width = rect.width(), height = rect.height(); // Get framebuffer pixel data (we get ABGR format) @@ -149,7 +149,7 @@ void PNGLibrary::saveImage(const string& filename, const VariantList& comments) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PNGLibrary::saveImage(const string& filename, const FBSurface& surface, - const GUI::Rect& rect, const VariantList& comments) + const Common::Rect& rect, const VariantList& comments) { ofstream out(filename, std::ios_base::binary); if(!out.is_open()) @@ -347,7 +347,7 @@ void PNGLibrary::takeSnapshot(uInt32 number) string message = "Snapshot saved"; try { - GUI::Rect rect; + Common::Rect rect; const FBSurface& surface = myOSystem.frameBuffer().tiaSurface().baseSurface(rect); myOSystem.png().saveImage(filename, surface, rect, comments); } diff --git a/src/common/PNGLibrary.hxx b/src/common/PNGLibrary.hxx index ee61d302a..a0beb9976 100644 --- a/src/common/PNGLibrary.hxx +++ b/src/common/PNGLibrary.hxx @@ -15,11 +15,11 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. //============================================================================ +#if defined(PNG_SUPPORT) + #ifndef PNGLIBRARY_HXX #define PNGLIBRARY_HXX -#if defined(PNG_SUPPORT) - #include class OSystem; @@ -82,7 +82,7 @@ class PNGLibrary more detailed error message. */ void saveImage(const string& filename, const FBSurface& surface, - const GUI::Rect& rect = GUI::EmptyRect, + const Common::Rect& rect = Common::EmptyRect, const VariantList& comments = EmptyVarList); /** @@ -199,6 +199,6 @@ class PNGLibrary PNGLibrary& operator=(PNGLibrary&&) = delete; }; -#endif // PNG_SUPPORT - #endif + +#endif // PNG_SUPPORT diff --git a/src/common/Rect.hxx b/src/common/Rect.hxx index 7ee96a218..44510d88c 100644 --- a/src/common/Rect.hxx +++ b/src/common/Rect.hxx @@ -25,7 +25,7 @@ #include "bspf.hxx" -namespace GUI { +namespace Common { /* This small class is an helper for position and size values. @@ -163,6 +163,6 @@ struct Rect // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - static const Rect EmptyRect; -} // End of namespace GUI +} // End of namespace Common #endif diff --git a/src/common/Variant.hxx b/src/common/Variant.hxx index 61182f783..215d75e1f 100644 --- a/src/common/Variant.hxx +++ b/src/common/Variant.hxx @@ -52,7 +52,7 @@ class Variant Variant(float f) { buf().str(""); buf() << f; data = buf().str(); } Variant(double d) { buf().str(""); buf() << d; data = buf().str(); } Variant(bool b) { buf().str(""); buf() << b; data = buf().str(); } - Variant(const GUI::Size& s) { buf().str(""); buf() << s; data = buf().str(); } + Variant(const Common::Size& s) { buf().str(""); buf() << s; data = buf().str(); } // Conversion methods const string& toString() const { return data; } @@ -72,7 +72,7 @@ class Variant return parsed; } const bool toBool() const { return data == "1" || data == "true"; } - const GUI::Size toSize() const { return GUI::Size(data); } + const Common::Size toSize() const { return Common::Size(data); } // Comparison bool operator==(const Variant& v) const { return data == v.data; } diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 019930945..bb7fe799e 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -91,8 +91,8 @@ Debugger::~Debugger() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Debugger::initialize() { - const GUI::Size& s = myOSystem.settings().getSize("dbg.res"); - const GUI::Size& d = myOSystem.frameBuffer().desktopSize(); + const Common::Size& s = myOSystem.settings().getSize("dbg.res"); + const Common::Size& d = myOSystem.frameBuffer().desktopSize(); myWidth = s.w; myHeight = s.h; // The debugger dialog is resizable, within certain bounds @@ -102,7 +102,7 @@ void Debugger::initialize() myWidth = std::min(myWidth, uInt32(d.w)); myHeight = std::min(myHeight, uInt32(d.h)); - myOSystem.settings().setValue("dbg.res", GUI::Size(myWidth, myHeight)); + myOSystem.settings().setValue("dbg.res", Common::Size(myWidth, myHeight)); delete myBaseDialog; myBaseDialog = myDialog = nullptr; myDialog = new DebuggerDialog(myOSystem, *this, 0, 0, myWidth, myHeight); diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx index fbb763baa..098e1d30a 100644 --- a/src/debugger/gui/DataGridWidget.cxx +++ b/src/debugger/gui/DataGridWidget.cxx @@ -668,9 +668,9 @@ void DataGridWidget::drawWidget(bool hilite) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GUI::Rect DataGridWidget::getEditRect() const +Common::Rect DataGridWidget::getEditRect() const { - GUI::Rect r(1, 0, _colWidth, _rowHeight); + Common::Rect r(1, 0, _colWidth, _rowHeight); const int rowoffset = _currentRow * _rowHeight; const int coloffset = _currentCol * _colWidth + 4; r.top += rowoffset; diff --git a/src/debugger/gui/DataGridWidget.hxx b/src/debugger/gui/DataGridWidget.hxx index d3ea250b1..f4a17f275 100644 --- a/src/debugger/gui/DataGridWidget.hxx +++ b/src/debugger/gui/DataGridWidget.hxx @@ -92,7 +92,7 @@ class DataGridWidget : public EditableWidget void endEditMode() override; void abortEditMode() override; - GUI::Rect getEditRect() const override; + Common::Rect getEditRect() const override; void receivedFocusWidget() override; void lostFocusWidget() override; diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index d3ab25ae1..0edb5f9b4 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -430,7 +430,7 @@ void DebuggerDialog::showFatalMessage(const string& msg) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DebuggerDialog::addTiaArea() { - const GUI::Rect& r = getTiaBounds(); + const Common::Rect& r = getTiaBounds(); myTiaOutput = new TiaOutputWidget(this, *myNFont, r.left, r.top, r.width(), r.height()); } @@ -438,7 +438,7 @@ void DebuggerDialog::addTiaArea() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DebuggerDialog::addTabArea() { - const GUI::Rect& r = getTabBounds(); + const Common::Rect& r = getTabBounds(); const int vBorder = 4; // The tab widget @@ -488,7 +488,7 @@ void DebuggerDialog::addTabArea() void DebuggerDialog::addStatusArea() { const int lineHeight = myLFont->getLineHeight(); - const GUI::Rect& r = getStatusBounds(); + const Common::Rect& r = getStatusBounds(); int xpos, ypos; xpos = r.left; ypos = r.top; @@ -540,7 +540,7 @@ void DebuggerDialog::addRomArea() 0b0100000 }; - const GUI::Rect& r = getRomBounds(); + const Common::Rect& r = getRomBounds(); const int VBORDER = 4; WidgetArray wid1, wid2; ButtonWidget* b; @@ -681,47 +681,47 @@ void DebuggerDialog::addRomArea() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GUI::Rect DebuggerDialog::getTiaBounds() const +Common::Rect DebuggerDialog::getTiaBounds() const { // The area showing the TIA image (NTSC and PAL supported, up to 260 lines) - GUI::Rect r(0, 0, 320, std::max(260, int(_h * 0.35))); + Common::Rect r(0, 0, 320, std::max(260, int(_h * 0.35))); return r; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GUI::Rect DebuggerDialog::getRomBounds() const +Common::Rect DebuggerDialog::getRomBounds() const { // The ROM area is the full area to the right of the tabs - const GUI::Rect& status = getStatusBounds(); - GUI::Rect r(status.right + 1, 0, _w, _h); + const Common::Rect& status = getStatusBounds(); + Common::Rect r(status.right + 1, 0, _w, _h); return r; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GUI::Rect DebuggerDialog::getStatusBounds() const +Common::Rect DebuggerDialog::getStatusBounds() const { // The status area is the full area to the right of the TIA image // extending as far as necessary // 30% of any space above 1030 pixels will be allocated to this area - const GUI::Rect& tia = getTiaBounds(); + const Common::Rect& tia = getTiaBounds(); int x1 = tia.right + 1; int y1 = 0; int x2 = tia.right + 225 + (_w > 1030 ? int(0.35 * (_w - 1030)) : 0); int y2 = tia.bottom; - GUI::Rect r(x1, y1, x2, y2); + Common::Rect r(x1, y1, x2, y2); return r; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GUI::Rect DebuggerDialog::getTabBounds() const +Common::Rect DebuggerDialog::getTabBounds() const { // The tab area is the full area below the TIA image - const GUI::Rect& tia = getTiaBounds(); - const GUI::Rect& status = getStatusBounds(); - GUI::Rect r(0, tia.bottom + 1, status.right + 1, _h); + const Common::Rect& tia = getTiaBounds(); + const Common::Rect& status = getStatusBounds(); + Common::Rect r(0, tia.bottom + 1, status.right + 1, _h); return r; } diff --git a/src/debugger/gui/DebuggerDialog.hxx b/src/debugger/gui/DebuggerDialog.hxx index b313bd0e3..d9daa9801 100644 --- a/src/debugger/gui/DebuggerDialog.hxx +++ b/src/debugger/gui/DebuggerDialog.hxx @@ -98,10 +98,10 @@ class DebuggerDialog : public Dialog void addStatusArea(); void addRomArea(); - GUI::Rect getTiaBounds() const; - GUI::Rect getRomBounds() const; - GUI::Rect getStatusBounds() const; - GUI::Rect getTabBounds() const; + Common::Rect getTiaBounds() const; + Common::Rect getRomBounds() const; + Common::Rect getStatusBounds() const; + Common::Rect getTabBounds() const; private: enum { diff --git a/src/debugger/gui/RomListSettings.cxx b/src/debugger/gui/RomListSettings.cxx index 3aee70913..49c822540 100644 --- a/src/debugger/gui/RomListSettings.cxx +++ b/src/debugger/gui/RomListSettings.cxx @@ -102,7 +102,7 @@ void RomListSettings::center() { // Make sure the menu is exactly where it should be, in case the image // offset has changed - const GUI::Rect& image = instance().frameBuffer().imageRect(); + const Common::Rect& image = instance().frameBuffer().imageRect(); uInt32 x = image.x() + _xorig; uInt32 y = image.y() + _yorig; uInt32 tx = image.x() + image.width(); diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index 91123f8e5..73c1fb233 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -469,8 +469,8 @@ void RomListWidget::drawWidget(bool hilite) int i, pos, xpos, ypos, len = int(dlist.size()); ColorId textColor = onTop ? kTextColor : kColor; - const GUI::Rect& r = getEditRect(); - const GUI::Rect& l = getLineRect(); + const Common::Rect& r = getEditRect(); + const Common::Rect& l = getLineRect(); // Draw a thin frame around the list and to separate columns s.frameRect(_x, _y, _w + 1, _h, hilite ? kWidColorHi : kColor); @@ -568,9 +568,9 @@ void RomListWidget::drawWidget(bool hilite) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GUI::Rect RomListWidget::getLineRect() const +Common::Rect RomListWidget::getLineRect() const { - GUI::Rect r(2, 1, _w, _fontHeight); + Common::Rect r(2, 1, _w, _fontHeight); const int yoffset = (_selectedItem - _currentPos) * _fontHeight, xoffset = CheckboxWidget::boxSize() + 10; r.top += yoffset; @@ -582,9 +582,9 @@ GUI::Rect RomListWidget::getLineRect() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GUI::Rect RomListWidget::getEditRect() const +Common::Rect RomListWidget::getEditRect() const { - GUI::Rect r(2, 1, _w, _fontHeight); + Common::Rect r(2, 1, _w, _fontHeight); const int yoffset = (_selectedItem - _currentPos) * _fontHeight; r.top += yoffset; r.bottom += yoffset; diff --git a/src/debugger/gui/RomListWidget.hxx b/src/debugger/gui/RomListWidget.hxx index 7a9e46ffc..58f1d4bc9 100644 --- a/src/debugger/gui/RomListWidget.hxx +++ b/src/debugger/gui/RomListWidget.hxx @@ -70,8 +70,8 @@ class RomListWidget : public EditableWidget void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void drawWidget(bool hilite) override; - GUI::Rect getLineRect() const; - GUI::Rect getEditRect() const override; + Common::Rect getLineRect() const; + Common::Rect getEditRect() const override; int findItem(int x, int y) const; void recalc(); diff --git a/src/debugger/gui/TiaOutputWidget.cxx b/src/debugger/gui/TiaOutputWidget.cxx index 2fca4c86a..d767fa5db 100644 --- a/src/debugger/gui/TiaOutputWidget.cxx +++ b/src/debugger/gui/TiaOutputWidget.cxx @@ -81,7 +81,7 @@ void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix) // to skip borders, add 1 to origin int x = _x + 1, y = _y + 1; - GUI::Rect rect(x, y, x + width*2, y + height); + Common::Rect rect(x, y, x + width*2, y + height); string message = "Snapshot saved"; try { diff --git a/src/emucore/Cart.hxx b/src/emucore/Cart.hxx index d40ef8ab2..efd529158 100644 --- a/src/emucore/Cart.hxx +++ b/src/emucore/Cart.hxx @@ -27,7 +27,9 @@ class GuiObject; #include "bspf.hxx" #include "Device.hxx" #include "Settings.hxx" -#include "Font.hxx" +#ifdef DEBUGGER_SUPPORT + #include "Font.hxx" +#endif /** A cartridge is a device which contains the machine code for a @@ -199,6 +201,7 @@ class Cartridge : public Device */ virtual uInt32 thumbCallback(uInt8 function, uInt32 value1, uInt32 value2) { return 0; } + #ifdef DEBUGGER_SUPPORT /** Get optional debugger widget responsible for displaying info about the cart. This can be used when the debugWidget runs out of space. @@ -220,6 +223,7 @@ class Cartridge : public Device { return nullptr; } + #endif protected: /** diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 6bb2c9fe2..94fae8e6e 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -50,8 +50,6 @@ #include "FrameBuffer.hxx" #include "TIASurface.hxx" #include "OSystem.hxx" -#include "Menu.hxx" -#include "CommandMenu.hxx" #include "Serializable.hxx" #include "Serializer.hxx" #include "TimerManager.hxx" @@ -64,13 +62,12 @@ #include "frame-manager/FrameLayoutDetector.hxx" #include "frame-manager/YStartDetector.hxx" -#ifdef DEBUGGER_SUPPORT - #include "Debugger.hxx" -#endif - #ifdef CHEATCODE_SUPPORT #include "CheatManager.hxx" #endif +#ifdef DEBUGGER_SUPPORT + #include "Debugger.hxx" +#endif #include "Console.hxx" diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 98c66d41a..9ae8a48c7 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -22,23 +22,16 @@ #include "Logger.hxx" #include "Base.hxx" -#include "CommandMenu.hxx" #include "Console.hxx" -#include "DialogContainer.hxx" #include "Event.hxx" #include "FrameBuffer.hxx" #include "FSNode.hxx" -#include "Launcher.hxx" -#include "TimeMachine.hxx" -#include "Menu.hxx" #include "OSystem.hxx" #include "Joystick.hxx" #include "Paddles.hxx" #include "PJoystickHandler.hxx" #include "PointingDevice.hxx" #include "PropsSet.hxx" -#include "ListWidget.hxx" -#include "ScrollBarWidget.hxx" #include "Settings.hxx" #include "Sound.hxx" #include "StateManager.hxx" @@ -58,6 +51,15 @@ #ifdef DEBUGGER_SUPPORT #include "Debugger.hxx" #endif +#ifdef GUI_SUPPORT + #include "Menu.hxx" + #include "CommandMenu.hxx" + #include "DialogContainer.hxx" + #include "Launcher.hxx" + #include "TimeMachine.hxx" + #include "ListWidget.hxx" + #include "ScrollBarWidget.hxx" +#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EventHandler::EventHandler(OSystem& osystem) @@ -100,11 +102,13 @@ void EventHandler::initialize() Paddles::setMouseSensitivity(myOSystem.settings().getInt("msense")); PointingDevice::setSensitivity(myOSystem.settings().getInt("tsense")); +#ifdef GUI_SUPPORT // Set quick select delay when typing characters in listwidgets ListWidget::setQuickSelectDelay(myOSystem.settings().getInt("listdelay")); // Set number of lines a mousewheel will scroll ScrollBarWidget::setWheelLines(myOSystem.settings().getInt("mwheel")); +#endif // Integer to string conversions (for HEX) use upper or lower-case Common::Base::setHexUppercase(myOSystem.settings().getBool("dbg.uhex")); @@ -230,9 +234,11 @@ void EventHandler::poll(uInt64 time) } else if(myOverlay) { + #ifdef GUI_SUPPORT // Update the current dialog container at regular intervals // Used to implement continuous events myOverlay->updateTime(time); + #endif } // Turn off all mouse-related items; if they haven't been taken care of @@ -244,9 +250,11 @@ void EventHandler::poll(uInt64 time) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EventHandler::handleTextEvent(char text) { +#ifdef GUI_SUPPORT // Text events are only used in GUI mode if(myOverlay) myOverlay->handleTextEvent(text); +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -262,8 +270,10 @@ void EventHandler::handleMouseMotionEvent(int x, int y, int xrel, int yrel) } mySkipMouseMotion = false; } +#ifdef GUI_SUPPORT else if(myOverlay) myOverlay->handleMouseMotionEvent(x, y); +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -285,8 +295,10 @@ void EventHandler::handleMouseButtonEvent(MouseButton b, bool pressed, return; } } +#ifdef GUI_SUPPORT else if(myOverlay) myOverlay->handleMouseButtonEvent(b, pressed, x, y); +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1121,16 +1133,20 @@ void EventHandler::setMouseControllerMode(const string& enable) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EventHandler::enterMenuMode(EventHandlerState state) { +#ifdef GUI_SUPPORT setState(state); myOverlay->reStack(); myOSystem.sound().mute(true); +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EventHandler::leaveMenuMode() { +#ifdef GUI_SUPPORT setState(EventHandlerState::EMULATION); myOSystem.sound().mute(false); +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1187,6 +1203,7 @@ void EventHandler::leaveDebugMode() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EventHandler::enterTimeMachineMenuMode(uInt32 numWinds, bool unwind) { +#ifdef GUI_SUPPORT // add one extra state if we are in Time Machine mode // TODO: maybe remove this state if we leave the menu at this new state myOSystem.state().addExtraState("enter Time Machine dialog"); // force new state @@ -1196,6 +1213,7 @@ void EventHandler::enterTimeMachineMenuMode(uInt32 numWinds, bool unwind) myOSystem.timeMachine().setEnterWinds(unwind ? numWinds : -numWinds); enterMenuMode(EventHandlerState::TIMEMACHINE); +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1224,6 +1242,7 @@ void EventHandler::setState(EventHandlerState state) enableTextEvents(false); break; + #ifdef GUI_SUPPORT case EventHandlerState::OPTIONSMENU: myOverlay = &myOSystem.menu(); enableTextEvents(true); @@ -1244,15 +1263,17 @@ void EventHandler::setState(EventHandlerState state) myOverlay = &myOSystem.launcher(); enableTextEvents(true); break; + #endif - case EventHandlerState::DEBUGGER: #ifdef DEBUGGER_SUPPORT + case EventHandlerState::DEBUGGER: myOverlay = &myOSystem.debugger(); enableTextEvents(true); - #endif break; + #endif case EventHandlerState::NONE: + default: break; } diff --git a/src/emucore/FBSurface.cxx b/src/emucore/FBSurface.cxx index ef3aa22a4..3854035ff 100644 --- a/src/emucore/FBSurface.cxx +++ b/src/emucore/FBSurface.cxx @@ -17,11 +17,14 @@ #include -#include "Font.hxx" #include "Rect.hxx" #include "FrameBuffer.hxx" #include "FBSurface.hxx" +#ifdef GUI_SUPPORT + #include "Font.hxx" +#endif + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FBSurface::FBSurface() : myPixels(nullptr), @@ -37,7 +40,7 @@ FBSurface::FBSurface() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurface::readPixels(uInt8* buffer, uInt32 pitch, const GUI::Rect& rect) const +void FBSurface::readPixels(uInt8* buffer, uInt32 pitch, const Common::Rect& rect) const { uInt8* src = reinterpret_cast(myPixels + rect.y() * myPitch + rect.x()); @@ -166,6 +169,7 @@ void FBSurface::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, ColorId color) void FBSurface::drawChar(const GUI::Font& font, uInt8 chr, uInt32 tx, uInt32 ty, ColorId color, ColorId shadowColor) { +#ifdef GUI_SUPPORT if(shadowColor != kNone) { drawChar(font, chr, tx + 1, ty + 0, shadowColor); @@ -220,6 +224,7 @@ void FBSurface::drawChar(const GUI::Font& font, uInt8 chr, buffer += myPitch; } +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -310,6 +315,7 @@ void FBSurface::drawString(const GUI::Font& font, const string& s, ColorId color, TextAlign align, int deltax, bool useEllipsis, ColorId shadowColor) { +#ifdef GUI_SUPPORT const string ELLIPSIS = "\x1d"; // "..." const int leftX = x, rightX = x + w; uInt32 i; @@ -358,6 +364,7 @@ void FBSurface::drawString(const GUI::Font& font, const string& s, x += w; } +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/FBSurface.hxx b/src/emucore/FBSurface.hxx index 4611e513e..f1aa8ffb7 100644 --- a/src/emucore/FBSurface.hxx +++ b/src/emucore/FBSurface.hxx @@ -23,6 +23,8 @@ class TIASurface; namespace GUI { class Font; +} +namespace Common { struct Rect; } @@ -63,7 +65,7 @@ class FBSurface @param pitch The pitch (in bytes) for the pixel data @param rect The bounding rectangle for the buffer */ - void readPixels(uInt8* buffer, uInt32 pitch, const GUI::Rect& rect) const; + void readPixels(uInt8* buffer, uInt32 pitch, const Common::Rect& rect) const; ////////////////////////////////////////////////////////////////////////// // Note: The drawing primitives below will work, but do not take @@ -238,8 +240,8 @@ class FBSurface These methods answer the current *rendering* dimensions of the specified surface. */ - virtual const GUI::Rect& srcRect() const = 0; - virtual const GUI::Rect& dstRect() const = 0; + virtual const Common::Rect& srcRect() const = 0; + virtual const Common::Rect& dstRect() const = 0; /** These methods set the origin point and width/height for the diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index d48900fa7..a12f9bc64 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -21,15 +21,6 @@ #include "Console.hxx" #include "EventHandler.hxx" #include "Event.hxx" -#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" #include "OSystem.hxx" #include "Settings.hxx" #include "TIA.hxx" @@ -42,6 +33,17 @@ #ifdef DEBUGGER_SUPPORT #include "Debugger.hxx" #endif +#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 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FrameBuffer::FrameBuffer(OSystem& osystem) @@ -64,13 +66,13 @@ FrameBuffer::~FrameBuffer() bool FrameBuffer::initialize() { // Get desktop resolution and supported renderers - vector windowedDisplays; + vector windowedDisplays; queryHardware(myFullscreenDisplays, windowedDisplays, myRenderers); uInt32 query_w = windowedDisplays[0].w, query_h = windowedDisplays[0].h; // Check the 'maxres' setting, which is an undocumented developer feature // that specifies the desktop size (not normally set) - const GUI::Size& s = myOSystem.settings().getSize("maxres"); + const Common::Size& s = myOSystem.settings().getSize("maxres"); if(s.valid()) { query_w = s.w; @@ -80,6 +82,7 @@ bool FrameBuffer::initialize() myDesktopSize.w = std::max(query_w, FBMinimum::Width); myDesktopSize.h = std::max(query_h, FBMinimum::Height); +#ifdef GUI_SUPPORT //////////////////////////////////////////////////////////////////// // Create fonts to draw text // NOTE: the logic determining appropriate font sizes is done here, @@ -115,6 +118,7 @@ bool FrameBuffer::initialize() myLauncherFont = make_unique(GUI::stellaMediumDesc); else myLauncherFont = make_unique(GUI::stellaLargeDesc); +#endif // Determine possible TIA windowed zoom levels uInt32 maxZoom = maxWindowSizeForScreen( @@ -236,6 +240,7 @@ FBInitStatus FrameBuffer::createDisplay(const string& title, else return FBInitStatus::FailTooLarge; +#ifdef GUI_SUPPORT // Erase any messages from a previous run myMsg.counter = 0; @@ -254,6 +259,7 @@ FBInitStatus FrameBuffer::createDisplay(const string& title, if(!myMsg.surface) myMsg.surface = allocateSurface(FBMinimum::Width, font().getFontHeight()+10); +#endif // Print initial usage message, but only print it later if the status has changed if(myInitializedCount == 1) @@ -311,6 +317,7 @@ void FrameBuffer::update(bool force) break; // EventHandlerState::PAUSE } + #ifdef GUI_SUPPORT case EventHandlerState::OPTIONSMENU: { force |= myOSystem.menu().needsRedraw(); @@ -349,14 +356,17 @@ void FrameBuffer::update(bool force) force |= myOSystem.launcher().draw(force); break; // EventHandlerState::LAUNCHER } + #endif + #ifdef DEBUGGER_SUPPORT case EventHandlerState::DEBUGGER: { - #ifdef DEBUGGER_SUPPORT force |= myOSystem.debugger().draw(force); - #endif break; // EventHandlerState::DEBUGGER } + #endif + default: + break; } // Draw any pending messages @@ -403,6 +413,7 @@ void FrameBuffer::updateInEmulationMode(float framesPerSecond) void FrameBuffer::showMessage(const string& message, MessagePosition position, bool force) { +#ifdef GUI_SUPPORT // Only show messages if they've been enabled if(myMsg.surface == nullptr || !(force || myOSystem.settings().getBool("uimessages"))) return; @@ -419,11 +430,13 @@ void FrameBuffer::showMessage(const string& message, MessagePosition position, myMsg.surface->setDstSize(myMsg.w, myMsg.h); myMsg.position = position; myMsg.enabled = true; +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FrameBuffer::drawFrameStats(float framesPerSecond) { +#ifdef GUI_SUPPORT const ConsoleInfo& info = myOSystem.console().about(); int xPos = 2, yPos = 0; const int dy = font().getFontHeight() + 2; @@ -469,6 +482,7 @@ void FrameBuffer::drawFrameStats(float framesPerSecond) myStatsMsg.surface->setDstPos(myImageRect.x() + 10, myImageRect.y() + 8); myStatsMsg.surface->render(); +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -508,6 +522,7 @@ void FrameBuffer::enableMessages(bool enable) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - inline bool FrameBuffer::drawMessage() { +#ifdef GUI_SUPPORT // Either erase the entire message (when time is reached), // or show again this frame if(myMsg.counter == 0) @@ -522,7 +537,7 @@ inline bool FrameBuffer::drawMessage() } // Draw the bounded box and text - const GUI::Rect& dst = myMsg.surface->dstRect(); + const Common::Rect& dst = myMsg.surface->dstRect(); switch(myMsg.position) { @@ -579,6 +594,7 @@ inline bool FrameBuffer::drawMessage() myMsg.w, myMsg.color, TextAlign::Left); myMsg.surface->render(); myMsg.counter--; +#endif return true; } @@ -956,8 +972,8 @@ FrameBuffer::VideoMode::VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, ih = std::min(ih, sh); int ix = (sw - iw) >> 1; int iy = (sh - ih) >> 1; - image = GUI::Rect(ix, iy, ix+iw, iy+ih); - screen = GUI::Size(sw, sh); + image = Common::Rect(ix, iy, ix+iw, iy+ih); + screen = Common::Size(sw, sh); // Now resize based on windowed/fullscreen mode and stretch factor iw = image.width(); diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx index ade0edfda..3ecc80e74 100644 --- a/src/emucore/FrameBuffer.hxx +++ b/src/emucore/FrameBuffer.hxx @@ -59,8 +59,8 @@ class FrameBuffer { enum class Stretch { Preserve, Fill }; - GUI::Rect image; - GUI::Size screen; + Common::Rect image; + Common::Size screen; Stretch stretch; string description; uInt32 zoom; @@ -169,19 +169,19 @@ class FrameBuffer Note that this will take into account the current scaling (if any) as well as image 'centering'. */ - const GUI::Rect& imageRect() const { return myImageRect; } + const Common::Rect& imageRect() const { return myImageRect; } /** Returns the current dimensions of the framebuffer window. This is the entire area containing the framebuffer image as well as any 'unusable' area. */ - const GUI::Size& screenSize() const { return myScreenSize; } + const Common::Size& screenSize() const { return myScreenSize; } /** Returns the current dimensions of the users' desktop. */ - const GUI::Size& desktopSize() const { return myDesktopSize; } + const Common::Size& desktopSize() const { return myDesktopSize; } /** Get the supported renderers for the video hardware. @@ -195,14 +195,6 @@ class FrameBuffer */ const VariantList& supportedTIAZoomLevels() const { return myTIAZoomLevels; } - /** - Get the font object(s) of the framebuffer - */ - const GUI::Font& font() const { return *myFont; } - const GUI::Font& infoFont() const { return *myInfoFont; } - const GUI::Font& smallFont() const { return *mySmallFont; } - const GUI::Font& launcherFont() const { return *myLauncherFont; } - /** Get the TIA surface associated with the framebuffer. */ @@ -263,6 +255,16 @@ class FrameBuffer */ void stateChanged(EventHandlerState state); + #ifdef GUI_SUPPORT + /** + Get the font object(s) of the framebuffer + */ + const GUI::Font& font() const { return *myFont; } + const GUI::Font& infoFont() const { return *myInfoFont; } + const GUI::Font& smallFont() const { return *mySmallFont; } + const GUI::Font& launcherFont() const { return *myLauncherFont; } + #endif + ////////////////////////////////////////////////////////////////////// // The following methods are system-specific and can/must be // implemented in derived classes. @@ -314,7 +316,7 @@ class FrameBuffer @param pitch The pitch (in bytes) for the pixel data @param rect The bounding rectangle for the buffer */ - virtual void readPixels(uInt8* buffer, uInt32 pitch, const GUI::Rect& rect) const = 0; + virtual void readPixels(uInt8* buffer, uInt32 pitch, const Common::Rect& rect) const = 0; /** Clear the framebuffer. @@ -331,8 +333,8 @@ class FrameBuffer @param windowedRes Maximum resolution supported in windowed mode @param renderers List of renderer names (internal name -> end-user name) */ - virtual void queryHardware(vector& fullscreenRes, - vector& windowedRes, + virtual void queryHardware(vector& fullscreenRes, + vector& windowedRes, VariantList& renderers) = 0; virtual Int32 getCurrentDisplayIndex() = 0; @@ -490,22 +492,23 @@ class FrameBuffer // Dimensions of the actual image, after zooming, and taking into account // any image 'centering' - GUI::Rect myImageRect; + Common::Rect myImageRect; // Dimensions of the main window (not always the same as the image) - GUI::Size myScreenSize; + Common::Size myScreenSize; // Maximum dimensions of the desktop area - GUI::Size myDesktopSize; + Common::Size myDesktopSize; // The resolution of the attached displays in fullscreen mode // The primary display is typically the first in the array // Windowed modes use myDesktopSize directly - vector myFullscreenDisplays; + vector myFullscreenDisplays; // Supported renderers VariantList myRenderers; + #ifdef GUI_SUPPORT // The font object to use for the normal in-game GUI unique_ptr myFont; @@ -517,6 +520,7 @@ class FrameBuffer // The font object to use for the ROM launcher unique_ptr myLauncherFont; + #endif // The TIASurface class takes responsibility for TIA rendering unique_ptr myTIASurface; diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index ae3b74fca..56b5d99df 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -46,12 +46,7 @@ #include "Settings.hxx" #include "PropsSet.hxx" #include "EventHandler.hxx" -#include "Menu.hxx" -#include "CommandMenu.hxx" -#include "Launcher.hxx" -#include "TimeMachine.hxx" #include "PNGLibrary.hxx" -#include "Widget.hxx" #include "Console.hxx" #include "Random.hxx" #include "StateManager.hxx" @@ -64,6 +59,13 @@ #include "repository/KeyValueRepositoryNoop.hxx" #include "repository/KeyValueRepositoryConfigfile.hxx" +#ifdef GUI_SUPPORT + #include "Menu.hxx" + #include "CommandMenu.hxx" + #include "Launcher.hxx" + #include "TimeMachine.hxx" + #include "Widget.hxx" +#endif #include "OSystem.hxx" @@ -156,16 +158,6 @@ bool OSystem::create() myEventHandler = MediaFactory::createEventHandler(*this); myEventHandler->initialize(); -#ifdef CHEATCODE_SUPPORT - myCheatManager = make_unique(*this); - myCheatManager->loadCheatDatabase(); -#endif - - // Create various subsystems (menu and launcher GUI objects, etc) - myMenu = make_unique(*this); - myCommandMenu = make_unique(*this); - myTimeMachine = make_unique(*this); - myLauncher = make_unique(*this); myStateManager = make_unique(*this); myTimerManager = make_unique(); myAudioSettings = make_unique(*mySettings); @@ -178,6 +170,19 @@ bool OSystem::create() // Create random number generator myRandom = make_unique(uInt32(TimerManager::getTicks())); +#ifdef CHEATCODE_SUPPORT + myCheatManager = make_unique(*this); + myCheatManager->loadCheatDatabase(); +#endif + +#ifdef GUI_SUPPORT + // Create various subsystems (menu and launcher GUI objects, etc) + myMenu = make_unique(*this); + myCommandMenu = make_unique(*this); + myTimeMachine = make_unique(*this); + myLauncher = make_unique(*this); +#endif + #ifdef PNG_SUPPORT // Create PNG handler myPNGLib = make_unique(*this); @@ -299,26 +304,31 @@ FBInitStatus OSystem::createFrameBuffer() { case EventHandlerState::EMULATION: case EventHandlerState::PAUSE: + #ifdef GUI_SUPPORT case EventHandlerState::OPTIONSMENU: case EventHandlerState::CMDMENU: case EventHandlerState::TIMEMACHINE: + #endif if((fbstatus = myConsole->initializeVideo()) != FBInitStatus::Success) return fbstatus; break; + #ifdef GUI_SUPPORT case EventHandlerState::LAUNCHER: if((fbstatus = myLauncher->initializeVideo()) != FBInitStatus::Success) return fbstatus; break; + #endif - case EventHandlerState::DEBUGGER: #ifdef DEBUGGER_SUPPORT + case EventHandlerState::DEBUGGER: if((fbstatus = myDebugger->initializeVideo()) != FBInitStatus::Success) return fbstatus; - #endif break; + #endif case EventHandlerState::NONE: // Should never happen + default: Logger::log("ERROR: Unknown emulation state in createFrameBuffer()", 0); break; } @@ -430,6 +440,7 @@ bool OSystem::hasConsole() const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool OSystem::createLauncher(const string& startdir) { +#ifdef GUI_SUPPORT closeConsole(); if(mySound) @@ -451,6 +462,9 @@ bool OSystem::createLauncher(const string& startdir) myLauncherUsed = myLauncherUsed || status; return status; +#else + return false; +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/OSystem.hxx b/src/emucore/OSystem.hxx index e9229d8cd..cc770f855 100644 --- a/src/emucore/OSystem.hxx +++ b/src/emucore/OSystem.hxx @@ -18,12 +18,6 @@ #ifndef OSYSTEM_HXX #define OSYSTEM_HXX -#ifdef PNG_SUPPORT -class PNGLibrary; -#endif -#ifdef CHEATCODE_SUPPORT -class CheatManager; -#endif class CommandMenu; class Console; class Debugger; @@ -41,6 +35,13 @@ class TimerManager; class VideoDialog; class EmulationWorker; class AudioSettings; +class SettingsDb; +#ifdef PNG_SUPPORT + class PNGLibrary; +#endif +#ifdef CHEATCODE_SUPPORT + class CheatManager; +#endif #include @@ -52,10 +53,6 @@ class AudioSettings; #include "bspf.hxx" #include "repository/KeyValueRepository.hxx" -#ifdef SQLITE_SUPPORT -#include "SettingsDb.hxx" -#endif - /** This class provides an interface for accessing operating system specific functions. It also comprises an overall parent object, to which all the @@ -138,34 +135,6 @@ class OSystem */ AudioSettings& audioSettings() { return *myAudioSettings; } - /** - Get the settings menu of the system. - - @return The settings menu object - */ - Menu& menu() const { return *myMenu; } - - /** - Get the command menu of the system. - - @return The command menu object - */ - CommandMenu& commandMenu() const { return *myCommandMenu; } - - /** - Get the ROM launcher of the system. - - @return The launcher object - */ - Launcher& launcher() const { return *myLauncher; } - - /** - Get the time machine of the system (manages state files). - - @return The time machine object - */ - TimeMachine& timeMachine() const { return *myTimeMachine; } - /** Get the state manager of the system. @@ -194,32 +163,62 @@ class OSystem */ void saveConfig(); -#ifdef DEBUGGER_SUPPORT + #ifdef DEBUGGER_SUPPORT /** Get the ROM debugger of the system. @return The debugger object */ Debugger& debugger() const { return *myDebugger; } -#endif + #endif -#ifdef CHEATCODE_SUPPORT + #ifdef CHEATCODE_SUPPORT /** Get the cheat manager of the system. @return The cheatmanager object */ CheatManager& cheat() const { return *myCheatManager; } -#endif + #endif -#ifdef PNG_SUPPORT + #ifdef PNG_SUPPORT /** Get the PNG handler of the system. @return The PNGlib object */ PNGLibrary& png() const { return *myPNGLib; } -#endif + #endif + + #ifdef GUI_SUPPORT + /** + Get the settings menu of the system. + + @return The settings menu object + */ + Menu& menu() const { return *myMenu; } + + /** + Get the command menu of the system. + + @return The command menu object + */ + CommandMenu& commandMenu() const { return *myCommandMenu; } + + /** + Get the ROM launcher of the system. + + @return The launcher object + */ + Launcher& launcher() const { return *myLauncher; } + + /** + Get the time machine of the system (manages state files). + + @return The time machine object + */ + TimeMachine& timeMachine() const { return *myTimeMachine; } + #endif /** Set all config file paths for the OSystem. @@ -473,6 +472,7 @@ class OSystem // Pointer to audio settings object unique_ptr myAudioSettings; + #ifdef GUI_SUPPORT // Pointer to the Menu object unique_ptr myMenu; @@ -481,10 +481,10 @@ class OSystem // Pointer to the Launcher object unique_ptr myLauncher; - bool myLauncherUsed; // Pointer to the TimeMachine object unique_ptr myTimeMachine; + #endif #ifdef DEBUGGER_SUPPORT // Pointer to the Debugger object @@ -510,6 +510,9 @@ class OSystem // The list of log messages string myLogMessages; + // Indicates whether ROM launcher was ever opened during this run + bool myLauncherUsed; + // Indicates whether to stop the main loop bool myQuitLoop; diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index dfa7f84e0..289c4815b 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -106,7 +106,7 @@ Settings::Settings() // ROM browser options setPermanent("exitlauncher", "false"); - setPermanent("launcherres", GUI::Size(900, 600)); + setPermanent("launcherres", Common::Size(900, 600)); setPermanent("launcherfont", "medium"); setPermanent("launcherroms", "true"); setPermanent("romviewer", "1"); @@ -115,8 +115,8 @@ Settings::Settings() // UI-related options #ifdef DEBUGGER_SUPPORT setPermanent("dbg.res", - GUI::Size(DebuggerDialog::kMediumFontMinW, - DebuggerDialog::kMediumFontMinH)); + Common::Size(DebuggerDialog::kMediumFontMinW, + DebuggerDialog::kMediumFontMinH)); #endif setPermanent("uipalette", "standard"); setPermanent("listdelay", "300"); diff --git a/src/emucore/Settings.hxx b/src/emucore/Settings.hxx index fecea763a..1da0d49f8 100644 --- a/src/emucore/Settings.hxx +++ b/src/emucore/Settings.hxx @@ -100,7 +100,7 @@ class Settings float getFloat(const string& key) const { return value(key).toFloat(); } bool getBool(const string& key) const { return value(key).toBool(); } const string& getString(const string& key) const { return value(key).toString(); } - const GUI::Size getSize(const string& key) const { return value(key).toSize(); } + const Common::Size getSize(const string& key) const { return value(key).toSize(); } protected: /** diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx index b42b0ad4b..4b684c2ae 100644 --- a/src/emucore/TIASurface.cxx +++ b/src/emucore/TIASurface.cxx @@ -124,7 +124,7 @@ void TIASurface::setPalette(const uInt32* tia_palette, const uInt32* rgb_palette } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const FBSurface& TIASurface::baseSurface(GUI::Rect& rect) const +const FBSurface& TIASurface::baseSurface(Common::Rect& rect) const { uInt32 tiaw = myTIA->width(), width = tiaw * 2, height = myTIA->height(); rect.setBounds(0, 0, width, height); diff --git a/src/emucore/TIASurface.hxx b/src/emucore/TIASurface.hxx index 8113d8c85..d4f980010 100644 --- a/src/emucore/TIASurface.hxx +++ b/src/emucore/TIASurface.hxx @@ -69,7 +69,7 @@ class TIASurface /** Get the TIA base surface for use in saving to a PNG image. */ - const FBSurface& baseSurface(GUI::Rect& rect) const; + const FBSurface& baseSurface(Common::Rect& rect) const; /** Use the palette to map a single indexed pixel color. This is used by the TIA output widget. diff --git a/src/gui/CheckListWidget.cxx b/src/gui/CheckListWidget.cxx index 56ceec54b..aba7e48bf 100644 --- a/src/gui/CheckListWidget.cxx +++ b/src/gui/CheckListWidget.cxx @@ -113,7 +113,7 @@ void CheckListWidget::drawWidget(bool hilite) const int y = _y + 2 + _fontHeight * i + 2; ColorId textColor = kTextColor; - GUI::Rect r(getEditRect()); + Common::Rect r(getEditRect()); // Draw the selected item inverted, on a highlighted background. if (_selectedItem == pos) @@ -147,9 +147,9 @@ void CheckListWidget::drawWidget(bool hilite) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GUI::Rect CheckListWidget::getEditRect() const +Common::Rect CheckListWidget::getEditRect() const { - GUI::Rect r(2, 1, _w, _fontHeight); + Common::Rect r(2, 1, _w, _fontHeight); const int yoffset = (_selectedItem - _currentPos) * _fontHeight, xoffset = CheckboxWidget::boxSize() + 10; r.top += yoffset; diff --git a/src/gui/CheckListWidget.hxx b/src/gui/CheckListWidget.hxx index c1568e7a4..682a35ba9 100644 --- a/src/gui/CheckListWidget.hxx +++ b/src/gui/CheckListWidget.hxx @@ -51,7 +51,7 @@ class CheckListWidget : public ListWidget void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void drawWidget(bool hilite) override; - GUI::Rect getEditRect() const override; + Common::Rect getEditRect() const override; protected: BoolArray _stateList; diff --git a/src/gui/ContextMenu.cxx b/src/gui/ContextMenu.cxx index 5a3a93161..a6c1f1ab6 100644 --- a/src/gui/ContextMenu.cxx +++ b/src/gui/ContextMenu.cxx @@ -84,7 +84,7 @@ void ContextMenu::center() { // Make sure the menu is exactly where it should be, in case the image // offset has changed - const GUI::Rect& image = instance().frameBuffer().imageRect(); + const Common::Rect& image = instance().frameBuffer().imageRect(); recalc(image); uInt32 x = image.x() + _xorig; uInt32 y = image.y() + _yorig; @@ -97,7 +97,7 @@ void ContextMenu::center() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void ContextMenu::recalc(const GUI::Rect& image) +void ContextMenu::recalc(const Common::Rect& image) { // Now is the time to adjust the height // If it's higher than the screen, we need to scroll through diff --git a/src/gui/ContextMenu.hxx b/src/gui/ContextMenu.hxx index 913f1dbc1..36b82aabd 100644 --- a/src/gui/ContextMenu.hxx +++ b/src/gui/ContextMenu.hxx @@ -94,7 +94,7 @@ class ContextMenu : public Dialog, public CommandSender void drawDialog() override; - void recalc(const GUI::Rect& image); + void recalc(const Common::Rect& image); int findItem(int x, int y) const; void drawCurrentSelection(int item); diff --git a/src/gui/DeveloperDialog.cxx b/src/gui/DeveloperDialog.cxx index eaa0663be..a99788c8d 100644 --- a/src/gui/DeveloperDialog.cxx +++ b/src/gui/DeveloperDialog.cxx @@ -488,7 +488,7 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font) fontHeight = font.getFontHeight(), lineHeight = font.getLineHeight(); int xpos, ypos, pwidth; - const GUI::Size& ds = instance().frameBuffer().desktopSize(); + const Common::Size& ds = instance().frameBuffer().desktopSize(); xpos = HBORDER; ypos = VBORDER; @@ -809,7 +809,7 @@ void DeveloperDialog::loadConfig() uInt32 w, h; // Debugger size - const GUI::Size& ds = instance().settings().getSize("dbg.res"); + const Common::Size& ds = instance().settings().getSize("dbg.res"); w = ds.w; h = ds.h; myDebuggerWidthSlider->setValue(w); @@ -887,7 +887,7 @@ void DeveloperDialog::saveConfig() myDebuggerFontStyle->getSelectedTag().toString()); // Debugger size instance().settings().setValue("dbg.res", - GUI::Size(myDebuggerWidthSlider->getValue(), + Common::Size(myDebuggerWidthSlider->getValue(), myDebuggerHeightSlider->getValue())); // Debugger font size instance().settings().setValue("dbg.fontsize", myDebuggerFontSize->getSelectedTag().toString()); diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 50bdf952d..5a2dc4c8c 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -162,8 +162,8 @@ void Dialog::center() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Dialog::positionAt(uInt32 pos) { - const GUI::Size& screen = instance().frameBuffer().screenSize(); - const GUI::Rect& dst = _surface->dstRect(); + const Common::Size& screen = instance().frameBuffer().screenSize(); + const Common::Rect& dst = _surface->dstRect(); int top = std::min(screen.h - dst.height(), screen.h >> 5); int btm = std::min(screen.h - dst.height(), screen.h - dst.height() - (screen.h >> 5)); @@ -869,7 +869,7 @@ Widget* Dialog::TabFocus::getNewFocus() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Dialog::getDynamicBounds(uInt32& w, uInt32& h) const { - const GUI::Rect& r = instance().frameBuffer().imageRect(); + const Common::Rect& r = instance().frameBuffer().imageRect(); if(r.width() <= FBMinimum::Width || r.height() <= FBMinimum::Height) { diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx index d7a2f2e56..a3ba894a7 100644 --- a/src/gui/DialogContainer.cxx +++ b/src/gui/DialogContainer.cxx @@ -128,7 +128,7 @@ bool DialogContainer::needsRedraw() const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DialogContainer::addDialog(Dialog* d) { - const GUI::Rect& r = myOSystem.frameBuffer().imageRect(); + const Common::Rect& r = myOSystem.frameBuffer().imageRect(); if(uInt32(d->getWidth()) > r.width() || uInt32(d->getHeight()) > r.height()) myOSystem.frameBuffer().showMessage( "Unable to show dialog box; FIX THE CODE"); diff --git a/src/gui/EditTextWidget.cxx b/src/gui/EditTextWidget.cxx index 85e1778ba..e36cb184c 100644 --- a/src/gui/EditTextWidget.cxx +++ b/src/gui/EditTextWidget.cxx @@ -104,9 +104,9 @@ void EditTextWidget::drawWidget(bool hilite) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GUI::Rect EditTextWidget::getEditRect() const +Common::Rect EditTextWidget::getEditRect() const { - GUI::Rect r(2, 1, _w - 2, _h); + Common::Rect r(2, 1, _w - 2, _h); return r; } diff --git a/src/gui/EditTextWidget.hxx b/src/gui/EditTextWidget.hxx index a15b80cc3..417e53a2c 100644 --- a/src/gui/EditTextWidget.hxx +++ b/src/gui/EditTextWidget.hxx @@ -40,7 +40,7 @@ class EditTextWidget : public EditableWidget void endEditMode() override; void abortEditMode() override; - GUI::Rect getEditRect() const override; + Common::Rect getEditRect() const override; void handleMouseDown(int x, int y, MouseButton b, int clickCount) override; void handleMouseEntered() override; diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx index 689b6c546..cd1371215 100644 --- a/src/gui/EditableWidget.cxx +++ b/src/gui/EditableWidget.cxx @@ -202,7 +202,7 @@ void EditableWidget::drawCaret() if (!_editable || !isVisible() || !_boss->isVisible() || !_hasFocus) return; - const GUI::Rect& editRect = getEditRect(); + const Common::Rect& editRect = getEditRect(); int x = editRect.left; int y = editRect.top; diff --git a/src/gui/EditableWidget.hxx b/src/gui/EditableWidget.hxx index 66fb75174..cdebcb647 100644 --- a/src/gui/EditableWidget.hxx +++ b/src/gui/EditableWidget.hxx @@ -68,7 +68,7 @@ class EditableWidget : public Widget, public CommandSender virtual void endEditMode() { clearFlags(Widget::FLAG_WANTS_RAWDATA); } virtual void abortEditMode() { clearFlags(Widget::FLAG_WANTS_RAWDATA); } - virtual GUI::Rect getEditRect() const = 0; + virtual Common::Rect getEditRect() const = 0; virtual int getCaretOffset() const; void drawCaret(); bool setCaretPos(int newPos); diff --git a/src/gui/InputTextDialog.cxx b/src/gui/InputTextDialog.cxx index 14627850f..983f410e8 100644 --- a/src/gui/InputTextDialog.cxx +++ b/src/gui/InputTextDialog.cxx @@ -133,7 +133,7 @@ void InputTextDialog::center() { // Make sure the menu is exactly where it should be, in case the image // offset has changed - const GUI::Rect& image = instance().frameBuffer().imageRect(); + const Common::Rect& image = instance().frameBuffer().imageRect(); uInt32 x = image.x() + myXOrig; uInt32 y = image.y() + myYOrig; uInt32 tx = image.x() + image.width(); diff --git a/src/gui/Launcher.cxx b/src/gui/Launcher.cxx index f3d7bfcb1..35fb29211 100644 --- a/src/gui/Launcher.cxx +++ b/src/gui/Launcher.cxx @@ -29,8 +29,8 @@ Launcher::Launcher(OSystem& osystem) : DialogContainer(osystem) { - const GUI::Size& s = myOSystem.settings().getSize("launcherres"); - const GUI::Size& d = myOSystem.frameBuffer().desktopSize(); + const Common::Size& s = myOSystem.settings().getSize("launcherres"); + const Common::Size& d = myOSystem.frameBuffer().desktopSize(); myWidth = s.w; myHeight = s.h; // The launcher dialog is resizable, within certain bounds @@ -40,7 +40,7 @@ Launcher::Launcher(OSystem& osystem) myWidth = std::min(myWidth, uInt32(d.w)); myHeight = std::min(myHeight, uInt32(d.h)); - myOSystem.settings().setValue("launcherres", GUI::Size(myWidth, myHeight)); + myOSystem.settings().setValue("launcherres", Common::Size(myWidth, myHeight)); myBaseDialog = new LauncherDialog(myOSystem, *this, 0, 0, myWidth, myHeight); } diff --git a/src/gui/ListWidget.hxx b/src/gui/ListWidget.hxx index 845bfb862..038395e2e 100644 --- a/src/gui/ListWidget.hxx +++ b/src/gui/ListWidget.hxx @@ -76,7 +76,7 @@ class ListWidget : public EditableWidget void handleCommand(CommandSender* sender, int cmd, int data, int id) override; virtual void drawWidget(bool hilite) override = 0; - virtual GUI::Rect getEditRect() const override = 0; + virtual Common::Rect getEditRect() const override = 0; int findItem(int x, int y) const; void recalc(); diff --git a/src/gui/PopUpWidget.cxx b/src/gui/PopUpWidget.cxx index e24d80cf7..814b1abfa 100644 --- a/src/gui/PopUpWidget.cxx +++ b/src/gui/PopUpWidget.cxx @@ -119,8 +119,8 @@ void PopUpWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount) if(isEnabled() && !myMenu->isVisible()) { // Add menu just underneath parent widget - const GUI::Rect& image = instance().frameBuffer().imageRect(); - const GUI::Rect& srect = dialog().surface().dstRect(); + const Common::Rect& image = instance().frameBuffer().imageRect(); + const Common::Rect& srect = dialog().surface().dstRect(); uInt32 tx = srect.x(), ty = srect.y(); tx += getAbsX() + _labelWidth - image.x(); ty += getAbsY() + getHeight() - image.y(); diff --git a/src/gui/RomInfoWidget.cxx b/src/gui/RomInfoWidget.cxx index 6f2a6a1a8..5b523b1c6 100644 --- a/src/gui/RomInfoWidget.cxx +++ b/src/gui/RomInfoWidget.cxx @@ -36,8 +36,8 @@ RomInfoWidget::RomInfoWidget(GuiObject* boss, const GUI::Font& font, mySurfaceIsValid(false), myHaveProperties(false), myAvail(w > 400 ? - GUI::Size(TIAConstants::viewableWidth*2, TIAConstants::viewableHeight*2) : - GUI::Size(TIAConstants::viewableWidth, TIAConstants::viewableHeight)) + Common::Size(TIAConstants::viewableWidth*2, TIAConstants::viewableHeight*2) : + Common::Size(TIAConstants::viewableWidth, TIAConstants::viewableHeight)) { _flags = Widget::FLAG_ENABLED; _bgcolor = kDlgColor; @@ -109,7 +109,7 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node) instance().png().loadImage(filename, *mySurface); // Scale surface to available image area - const GUI::Rect& src = mySurface->srcRect(); + const Common::Rect& src = mySurface->srcRect(); float scale = std::min(float(myAvail.w) / src.width(), float(myAvail.h) / src.height()); mySurface->setDstSize(uInt32(src.width() * scale), uInt32(src.height() * scale)); mySurfaceIsValid = true; @@ -178,13 +178,13 @@ void RomInfoWidget::drawWidget(bool hilite) if(mySurfaceIsValid) { - const GUI::Rect& dst = mySurface->dstRect(); + const Common::Rect& dst = mySurface->dstRect(); uInt32 x = _x + ((_w - dst.width()) >> 1); uInt32 y = _y + ((yoff - dst.height()) >> 1); // Make sure when positioning the snapshot surface that we take // the dialog surface position into account - const GUI::Rect& s_dst = s.dstRect(); + const Common::Rect& s_dst = s.dstRect(); mySurface->setDstPos(x + s_dst.x(), y + s_dst.y()); } else if(mySurfaceErrorMsg != "") diff --git a/src/gui/RomInfoWidget.hxx b/src/gui/RomInfoWidget.hxx index 5a0a87674..88639130f 100644 --- a/src/gui/RomInfoWidget.hxx +++ b/src/gui/RomInfoWidget.hxx @@ -64,7 +64,7 @@ class RomInfoWidget : public Widget string mySurfaceErrorMsg; // How much space available for the PNG image - GUI::Size myAvail; + Common::Size myAvail; private: // Following constructors and assignment operators not supported diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx index 8ce4394b1..88f2eb59b 100644 --- a/src/gui/StringListWidget.cxx +++ b/src/gui/StringListWidget.cxx @@ -82,7 +82,7 @@ void StringListWidget::drawWidget(bool hilite) s.frameRect(_x + 1, _y + 1 + _fontHeight * i, _w - 1, _fontHeight, onTop ? kWidColorHi : kBGColorLo); } - GUI::Rect r(getEditRect()); + Common::Rect r(getEditRect()); if (_selectedItem == pos && _editMode) { adjustOffset(); @@ -101,9 +101,9 @@ void StringListWidget::drawWidget(bool hilite) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GUI::Rect StringListWidget::getEditRect() const +Common::Rect StringListWidget::getEditRect() const { - GUI::Rect r(2, 1, _w - 2, _fontHeight); + Common::Rect r(2, 1, _w - 2, _fontHeight); const int offset = std::max(0, (_selectedItem - _currentPos) * _fontHeight); r.top += offset; r.bottom += offset; diff --git a/src/gui/StringListWidget.hxx b/src/gui/StringListWidget.hxx index 41bfdbab8..d311b5918 100644 --- a/src/gui/StringListWidget.hxx +++ b/src/gui/StringListWidget.hxx @@ -35,7 +35,7 @@ class StringListWidget : public ListWidget void handleMouseEntered() override; void handleMouseLeft() override; void drawWidget(bool hilite) override; - GUI::Rect getEditRect() const override; + Common::Rect getEditRect() const override; protected: bool _hilite; diff --git a/src/gui/TimeMachineDialog.cxx b/src/gui/TimeMachineDialog.cxx index b31870791..6d2d03dad 100644 --- a/src/gui/TimeMachineDialog.cxx +++ b/src/gui/TimeMachineDialog.cxx @@ -242,8 +242,8 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent, void TimeMachineDialog::center() { // Place on the bottom of the screen, centered horizontally - const GUI::Size& screen = instance().frameBuffer().screenSize(); - const GUI::Rect& dst = surface().dstRect(); + const Common::Size& screen = instance().frameBuffer().screenSize(); + const Common::Rect& dst = surface().dstRect(); surface().setDstPos((screen.w - dst.width()) >> 1, screen.h - dst.height() - 10); } diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx index da81dc7d2..52b4759d7 100644 --- a/src/gui/UIDialog.cxx +++ b/src/gui/UIDialog.cxx @@ -57,7 +57,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent, int lwidth, pwidth, bwidth; WidgetArray wid; VariantList items; - const GUI::Size& ds = instance().frameBuffer().desktopSize(); + const Common::Size& ds = instance().frameBuffer().desktopSize(); // Set real dimensions setSize(64 * fontWidth + HBORDER * 2, 11 * (lineHeight + V_GAP) + V_GAP * 9 + VBORDER + _th, @@ -246,7 +246,7 @@ void UIDialog::loadConfig() myRomPath->setText(settings.getString("romdir")); // Launcher size - const GUI::Size& ls = settings.getSize("launcherres"); + const Common::Size& ls = settings.getSize("launcherres"); uInt32 w = ls.w, h = ls.h; w = std::max(w, FBMinimum::Width); @@ -302,7 +302,7 @@ void UIDialog::saveConfig() // Launcher size settings.setValue("launcherres", - GUI::Size(myLauncherWidthSlider->getValue(), + Common::Size(myLauncherWidthSlider->getValue(), myLauncherHeightSlider->getValue())); // Launcher font diff --git a/src/libretro/FBSurfaceLIBRETRO.hxx b/src/libretro/FBSurfaceLIBRETRO.hxx index 43b6ca597..76c0e7717 100644 --- a/src/libretro/FBSurfaceLIBRETRO.hxx +++ b/src/libretro/FBSurfaceLIBRETRO.hxx @@ -42,8 +42,8 @@ class FBSurfaceLIBRETRO : public FBSurface uInt32 width() const override { return myWidth; } uInt32 height() const override { return myHeight; } - const GUI::Rect& srcRect() const override { return mySrcGUIR; } - const GUI::Rect& dstRect() const override { return myDstGUIR; } + const Common::Rect& srcRect() const override { return mySrcGUIR; } + const Common::Rect& dstRect() const override { return myDstGUIR; } void setSrcPos(uInt32 x, uInt32 y) override { } void setSrcSize(uInt32 w, uInt32 h) override { } void setDstPos(uInt32 x, uInt32 y) override { } @@ -73,7 +73,7 @@ class FBSurfaceLIBRETRO : public FBSurface private: FrameBufferLIBRETRO& myFB; - GUI::Rect mySrcGUIR, myDstGUIR; + Common::Rect mySrcGUIR, myDstGUIR; private: unique_ptr myPixelData; diff --git a/src/libretro/FrameBufferLIBRETRO.cxx b/src/libretro/FrameBufferLIBRETRO.cxx index 625fac8f8..5f9da5885 100644 --- a/src/libretro/FrameBufferLIBRETRO.cxx +++ b/src/libretro/FrameBufferLIBRETRO.cxx @@ -30,8 +30,8 @@ FrameBufferLIBRETRO::FrameBufferLIBRETRO(OSystem& osystem) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FrameBufferLIBRETRO::queryHardware(vector& fullscreenRes, - vector& windowedRes, +void FrameBufferLIBRETRO::queryHardware(vector& fullscreenRes, + vector& windowedRes, VariantList& renderers) { fullscreenRes.emplace_back(1920, 1080); diff --git a/src/libretro/FrameBufferLIBRETRO.hxx b/src/libretro/FrameBufferLIBRETRO.hxx index e98335689..2b2c96c80 100644 --- a/src/libretro/FrameBufferLIBRETRO.hxx +++ b/src/libretro/FrameBufferLIBRETRO.hxx @@ -91,7 +91,7 @@ class FrameBufferLIBRETRO : public FrameBuffer @param pitch The pitch (in bytes) for the pixel data @param rect The bounding rectangle for the buffer */ - void readPixels(uInt8* buffer, uInt32 pitch, const GUI::Rect& rect) const override { } + void readPixels(uInt8* buffer, uInt32 pitch, const Common::Rect& rect) const override { } /** Clear the frame buffer @@ -111,8 +111,8 @@ class FrameBufferLIBRETRO : public FrameBuffer @param windowedRes Maximum resolution supported in windowed mode @param renderers List of renderer names (internal name -> end-user name) */ - void queryHardware(vector& fullscreenRes, - vector& windowedRes, + void queryHardware(vector& fullscreenRes, + vector& windowedRes, VariantList& renderers) override; /** diff --git a/src/libretro/Makefile.common b/src/libretro/Makefile.common index e52802d78..9d3aa84d5 100644 --- a/src/libretro/Makefile.common +++ b/src/libretro/Makefile.common @@ -1,5 +1,5 @@ LIBRETRO_COMM_DIR = $(CORE_DIR)/../libretro-common -INCFLAGS := -I. -I$(CORE_DIR) -I$(CORE_DIR)/libretro -I$(CORE_DIR)/emucore -I$(CORE_DIR)/emucore/tia -I$(CORE_DIR)/common -I$(CORE_DIR)/common/audio -I$(CORE_DIR)/common/tv_filters -I$(CORE_DIR)/gui +INCFLAGS := -I. -I$(CORE_DIR) -I$(CORE_DIR)/libretro -I$(CORE_DIR)/emucore -I$(CORE_DIR)/emucore/tia -I$(CORE_DIR)/common -I$(CORE_DIR)/common/audio -I$(CORE_DIR)/common/tv_filters ifneq (,$(findstring msvc2003,$(platform))) INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc @@ -31,7 +31,6 @@ SOURCES_CXX := \ $(CORE_DIR)/common/repository/KeyValueRepositoryConfigfile.cxx \ $(CORE_DIR)/common/tv_filters/AtariNTSC.cxx \ $(CORE_DIR)/common/tv_filters/NTSCFilter.cxx \ - $(CORE_DIR)/common/ZipHandler.cxx \ $(CORE_DIR)/emucore/Bankswitch.cxx \ $(CORE_DIR)/emucore/Cart3EPlus.cxx \ $(CORE_DIR)/emucore/Cart4KSC.cxx \ @@ -76,18 +75,6 @@ SOURCES_CXX := \ $(CORE_DIR)/emucore/tia/Player.cxx \ $(CORE_DIR)/emucore/tia/Playfield.cxx \ $(CORE_DIR)/emucore/tia/TIA.cxx \ - $(CORE_DIR)/gui/ColorWidget.cxx \ - $(CORE_DIR)/gui/DeveloperDialog.cxx \ - $(CORE_DIR)/gui/FileListWidget.cxx \ - $(CORE_DIR)/gui/JoystickDialog.cxx \ - $(CORE_DIR)/gui/LoggerDialog.cxx \ - $(CORE_DIR)/gui/MinUICommandDialog.cxx \ - $(CORE_DIR)/gui/RadioButtonWidget.cxx \ - $(CORE_DIR)/gui/SnapshotDialog.cxx \ - $(CORE_DIR)/gui/TimeLineWidget.cxx \ - $(CORE_DIR)/gui/TimeMachine.cxx \ - $(CORE_DIR)/gui/TimeMachineDialog.cxx \ - $(CORE_DIR)/common/PNGLibrary.cxx \ $(CORE_DIR)/emucore/AtariVox.cxx \ $(CORE_DIR)/emucore/Booster.cxx \ $(CORE_DIR)/emucore/Cart.cxx \ @@ -140,43 +127,6 @@ SOURCES_CXX := \ $(CORE_DIR)/emucore/Settings.cxx \ $(CORE_DIR)/emucore/Switches.cxx \ $(CORE_DIR)/emucore/System.cxx \ - $(CORE_DIR)/emucore/Thumbulator.cxx \ - $(CORE_DIR)/gui/AboutDialog.cxx \ - $(CORE_DIR)/gui/AudioDialog.cxx \ - $(CORE_DIR)/gui/BrowserDialog.cxx \ - $(CORE_DIR)/gui/CheckListWidget.cxx \ - $(CORE_DIR)/gui/ComboDialog.cxx \ - $(CORE_DIR)/gui/CommandDialog.cxx \ - $(CORE_DIR)/gui/CommandMenu.cxx \ - $(CORE_DIR)/gui/ContextMenu.cxx \ - $(CORE_DIR)/gui/Dialog.cxx \ - $(CORE_DIR)/gui/DialogContainer.cxx \ - $(CORE_DIR)/gui/EditableWidget.cxx \ - $(CORE_DIR)/gui/EditTextWidget.cxx \ - $(CORE_DIR)/gui/EventMappingWidget.cxx \ - $(CORE_DIR)/gui/Font.cxx \ - $(CORE_DIR)/gui/GameInfoDialog.cxx \ - $(CORE_DIR)/gui/GameList.cxx \ - $(CORE_DIR)/gui/GlobalPropsDialog.cxx \ - $(CORE_DIR)/gui/HelpDialog.cxx \ - $(CORE_DIR)/gui/InputDialog.cxx \ - $(CORE_DIR)/gui/InputTextDialog.cxx \ - $(CORE_DIR)/gui/Launcher.cxx \ - $(CORE_DIR)/gui/LauncherDialog.cxx \ - $(CORE_DIR)/gui/ListWidget.cxx \ - $(CORE_DIR)/gui/Menu.cxx \ - $(CORE_DIR)/gui/MessageBox.cxx \ - $(CORE_DIR)/gui/OptionsDialog.cxx \ - $(CORE_DIR)/gui/PopUpWidget.cxx \ - $(CORE_DIR)/gui/ProgressDialog.cxx \ - $(CORE_DIR)/gui/RomAuditDialog.cxx \ - $(CORE_DIR)/gui/RomInfoWidget.cxx \ - $(CORE_DIR)/gui/ScrollBarWidget.cxx \ - $(CORE_DIR)/gui/StellaSettingsDialog.cxx \ - $(CORE_DIR)/gui/StringListWidget.cxx \ - $(CORE_DIR)/gui/TabWidget.cxx \ - $(CORE_DIR)/gui/UIDialog.cxx \ - $(CORE_DIR)/gui/VideoDialog.cxx \ - $(CORE_DIR)/gui/Widget.cxx + $(CORE_DIR)/emucore/Thumbulator.cxx SOURCES_C := diff --git a/src/libretro/Stella.vcxproj b/src/libretro/Stella.vcxproj index 0c6fd8da4..945ac977f 100644 --- a/src/libretro/Stella.vcxproj +++ b/src/libretro/Stella.vcxproj @@ -148,7 +148,6 @@ - @@ -161,7 +160,6 @@ - @@ -207,19 +205,6 @@ - - - - - - - - - - - - - @@ -273,42 +258,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -317,7 +266,6 @@ - @@ -325,6 +273,7 @@ + @@ -336,7 +285,6 @@ - @@ -397,22 +345,6 @@ - - - - - - - - - - - - - - - - @@ -475,47 +407,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/macos/stella.xcodeproj/project.pbxproj b/src/macos/stella.xcodeproj/project.pbxproj index d84e88556..bd5e0d6b7 100644 --- a/src/macos/stella.xcodeproj/project.pbxproj +++ b/src/macos/stella.xcodeproj/project.pbxproj @@ -3059,6 +3059,7 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( SDL_SUPPORT, + GUI_SUPPORT, CHEATCODE_SUPPORT, DEBUGGER_SUPPORT, JOYSTICK_SUPPORT, @@ -3115,6 +3116,7 @@ GCC_OPTIMIZATION_LEVEL = 3; GCC_PREPROCESSOR_DEFINITIONS = ( SDL_SUPPORT, + GUI_SUPPORT, CHEATCODE_SUPPORT, DEBUGGER_SUPPORT, JOYSTICK_SUPPORT, diff --git a/src/windows/Stella.vcxproj b/src/windows/Stella.vcxproj index 8c84a528e..104038853 100644 --- a/src/windows/Stella.vcxproj +++ b/src/windows/Stella.vcxproj @@ -157,7 +157,7 @@ Disabled ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;DEBUG_BUILD;SDL_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) + BSPF_WINDOWS;WIN32;NOMINMAX;DEBUG_BUILD;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) false EnableFastChecks MultiThreadedDLL @@ -193,7 +193,7 @@ Disabled ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;DEBUG_BUILD;SDL_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) + BSPF_WINDOWS;WIN32;NOMINMAX;DEBUG_BUILD;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) false EnableFastChecks MultiThreadedDLL @@ -226,7 +226,7 @@ true false ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) + BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) MultiThreadedDLL false @@ -260,7 +260,7 @@ true false ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) + BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) MultiThreadedDLL false @@ -298,7 +298,7 @@ AnySuitable true ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) + BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) MultiThreadedDLL false @@ -335,7 +335,7 @@ Default true ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) + BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) MultiThreadedDLL false @@ -1405,4 +1405,4 @@ - \ No newline at end of file +