From c9ea1aa79189f267b0325ced825268c6f5a6cbd0 Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Tue, 16 Aug 2022 22:03:06 +0200 Subject: [PATCH] added JPG loading support --- src/common/PKeyboardHandler.cxx | 2 +- src/common/PNGLibrary.cxx | 9 +- src/common/PNGLibrary.hxx | 8 +- src/debugger/gui/TiaOutputWidget.cxx | 4 +- src/emucore/EventHandler.cxx | 8 +- src/emucore/EventHandler.hxx | 2 +- src/emucore/OSystem.cxx | 11 +- src/emucore/OSystem.hxx | 21 ++- src/emucore/TIASurface.cxx | 2 +- src/gui/RomImageWidget.cxx | 196 +++++++++++++++++---------- src/gui/RomImageWidget.hxx | 7 +- src/windows/Stella.vcxproj | 45 +++--- src/windows/Stella.vcxproj.filters | 18 +++ 13 files changed, 209 insertions(+), 124 deletions(-) diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx index 5c6f37d6b..1bb76a9fa 100644 --- a/src/common/PKeyboardHandler.cxx +++ b/src/common/PKeyboardHandler.cxx @@ -709,7 +709,7 @@ PhysicalKeyboardHandler::DefaultCommonMapping = { { Event::ToggleFrameStats, KBDK_L, MOD3 }, { Event::ToggleTimeMachine, KBDK_T, MOD3 }, - #ifdef PNG_SUPPORT + #ifdef IMAGE_SUPPORT { Event::ToggleContSnapshots, KBDK_S, MOD3 | KBDM_CTRL }, { Event::ToggleContSnapshotsFrame, KBDK_S, KBDM_SHIFT | MOD3 | KBDM_CTRL }, #endif diff --git a/src/common/PNGLibrary.cxx b/src/common/PNGLibrary.cxx index 6612000de..304f74bbc 100644 --- a/src/common/PNGLibrary.cxx +++ b/src/common/PNGLibrary.cxx @@ -15,21 +15,16 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. //============================================================================ -#if defined(PNG_SUPPORT) +#ifdef IMAGE_SUPPORT -#include - -#include "bspf.hxx" #include "OSystem.hxx" #include "Console.hxx" #include "FrameBuffer.hxx" #include "FBSurface.hxx" #include "Props.hxx" -#include "Settings.hxx" #include "TIASurface.hxx" #include "Version.hxx" #include "PNGLibrary.hxx" -#include "Rect.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PNGLibrary::PNGLibrary(OSystem& osystem) @@ -504,4 +499,4 @@ void PNGLibrary::png_user_error(const png_structp ctx, png_const_charp str) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PNGLibrary::ReadInfoType PNGLibrary::ReadInfo; -#endif // PNG_SUPPORT +#endif // IMAGE_SUPPORT diff --git a/src/common/PNGLibrary.hxx b/src/common/PNGLibrary.hxx index 9d4d7f8a4..4933bcf46 100644 --- a/src/common/PNGLibrary.hxx +++ b/src/common/PNGLibrary.hxx @@ -15,7 +15,7 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. //============================================================================ -#if defined(PNG_SUPPORT) +#ifdef IMAGE_SUPPORT #ifndef PNGLIBRARY_HXX #define PNGLIBRARY_HXX @@ -23,11 +23,7 @@ #include class OSystem; -class FrameBuffer; class FBSurface; -class Properties; - -#include "bspf.hxx" /** This class implements a thin wrapper around the libpng library, and @@ -207,4 +203,4 @@ class PNGLibrary #endif -#endif // PNG_SUPPORT +#endif // IMAGE_SUPPORT diff --git a/src/debugger/gui/TiaOutputWidget.cxx b/src/debugger/gui/TiaOutputWidget.cxx index 5ac422166..4c1144914 100644 --- a/src/debugger/gui/TiaOutputWidget.cxx +++ b/src/debugger/gui/TiaOutputWidget.cxx @@ -47,7 +47,7 @@ TiaOutputWidget::TiaOutputWidget(GuiObject* boss, const GUI::Font& font, VarList::push_back(l, "Fill to scanline", "scanline"); VarList::push_back(l, "Toggle breakpoint", "bp"); VarList::push_back(l, "Set zoom position", "zoom"); -#ifdef PNG_SUPPORT +#ifdef IMAGE_SUPPORT VarList::push_back(l, "Save snapshot", "snap"); #endif myMenu = make_unique(this, font, l); @@ -65,7 +65,7 @@ void TiaOutputWidget::loadConfig() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix) { -#ifdef PNG_SUPPORT +#ifdef IMAGE_SUPPORT if(execDepth > 0) drawWidget(false); diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index a635cd5de..e3ac95ca8 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -146,7 +146,7 @@ void EventHandler::reset(EventHandlerState state) { setState(state); myOSystem.state().reset(); -#ifdef PNG_SUPPORT +#ifdef IMAGE_SUPPORT myOSystem.png().setContinuousSnapInterval(0); #endif myFryingFlag = false; @@ -274,7 +274,7 @@ void EventHandler::poll(uInt64 time) cheat->evaluate(); #endif - #ifdef PNG_SUPPORT + #ifdef IMAGE_SUPPORT // Handle continuous snapshots if(myOSystem.png().continuousSnapEnabled()) myOSystem.png().updateTime(time); @@ -1495,7 +1495,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated) if(pressed && !repeated) myOSystem.toggleTimeMachine(); return; - #ifdef PNG_SUPPORT + #ifdef IMAGE_SUPPORT case Event::ToggleContSnapshots: if(pressed && !repeated) myOSystem.png().toggleContinuousSnapshots(false); return; @@ -2827,7 +2827,7 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { { { Event::LoadState, "Load state" }, { Event::LoadAllStates, "Load saved TM states for current game" }, -#ifdef PNG_SUPPORT +#ifdef IMAGE_SUPPORT { Event::TakeSnapshot, "Snapshot" }, { Event::ToggleContSnapshots, "Save continuous snapsh. (as defined)" }, { Event::ToggleContSnapshotsFrame,"Save continuous snapsh. (every frame)" }, diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index d85afa969..9a389f5ae 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -514,7 +514,7 @@ class EventHandler static constexpr Int32 COMBO_SIZE = 16, EVENTS_PER_COMBO = 8, - #ifdef PNG_SUPPORT + #ifdef IMAGE_SUPPORT PNG_SIZE = 3, #else PNG_SIZE = 0, diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index 05dca1e17..61f9c42f7 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -54,6 +54,7 @@ #include "PropsSet.hxx" #include "EventHandler.hxx" #include "PNGLibrary.hxx" +#include "JPGLibrary.hxx" #include "Console.hxx" #include "Random.hxx" #include "StateManager.hxx" @@ -90,8 +91,8 @@ OSystem::OSystem() #ifdef CHEATCODE_SUPPORT myFeatures += "Cheats "; #endif - #ifdef PNG_SUPPORT - myFeatures += "PNG "; + #ifdef IMAGE_SUPPORT + myFeatures += "Images "; #endif #ifdef ZIP_SUPPORT myFeatures += "ZIP"; @@ -196,9 +197,11 @@ bool OSystem::initialize(const Settings::Options& options) myHighScoresManager->setRepository(getHighscoreRepository()); #endif -#ifdef PNG_SUPPORT +#ifdef IMAGE_SUPPORT // Create PNG handler myPNGLib = make_unique(*this); + // Create JPG handler + myJPGLib = make_unique(*this); #endif // Detect serial port for AtariVox-USB @@ -289,7 +292,7 @@ void OSystem::setConfigPaths() buildDirIfRequired(myCfgDir, myBaseDir, "cfg"); #endif -#ifdef PNG_SUPPORT +#ifdef IMAGE_SUPPORT const string& ssSaveDir = mySettings->getString("snapsavedir"); if(ssSaveDir == EmptyString) mySnapshotSaveDir = userDir(); diff --git a/src/emucore/OSystem.hxx b/src/emucore/OSystem.hxx index 683caf4c6..692482ebe 100644 --- a/src/emucore/OSystem.hxx +++ b/src/emucore/OSystem.hxx @@ -46,8 +46,9 @@ class AudioSettings; class TimeMachine; class VideoAudioDialog; #endif -#ifdef PNG_SUPPORT +#ifdef IMAGE_SUPPORT class PNGLibrary; + class JPGLibrary; #endif #include @@ -249,14 +250,21 @@ class OSystem TimeMachine& timeMachine() const { return *myTimeMachine; } #endif - #ifdef PNG_SUPPORT + #ifdef IMAGE_SUPPORT /** Get the PNG handler of the system. @return The PNGlib object */ PNGLibrary& png() const { return *myPNGLib; } - #endif + + /** + Get the JPG handler of the system. + + @return The JPGlib object + */ + JPGLibrary& jpg() const { return *myJPGLib; } +#endif /** Set all config file paths for the OSystem. @@ -293,7 +301,7 @@ class OSystem const FSNode& cfgDir() const { return myCfgDir; } #endif - #ifdef PNG_SUPPORT + #ifdef IMAGE_SUPPORT /** Return the full/complete path name for saving and loading PNG snapshots. @@ -561,9 +569,12 @@ class OSystem unique_ptr myTimeMachine; #endif - #ifdef PNG_SUPPORT + #ifdef IMAGE_SUPPORT // PNG object responsible for loading/saving PNG images unique_ptr myPNGLib; + + // JPG object responsible for loading/saving JPG images + unique_ptr myJPGLib; #endif // Pointer to the StateManager object diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx index 2b53ddb05..48679adf7 100644 --- a/src/emucore/TIASurface.cxx +++ b/src/emucore/TIASurface.cxx @@ -601,7 +601,7 @@ void TIASurface::render(bool shade) if(mySaveSnapFlag) { mySaveSnapFlag = false; - #ifdef PNG_SUPPORT + #ifdef IMAGE_SUPPORT myOSystem.png().takeSnapshot(); #endif } diff --git a/src/gui/RomImageWidget.cxx b/src/gui/RomImageWidget.cxx index f9c36ed59..e966e3825 100644 --- a/src/gui/RomImageWidget.cxx +++ b/src/gui/RomImageWidget.cxx @@ -20,6 +20,7 @@ #include "Dialog.hxx" #include "FBSurface.hxx" #include "Font.hxx" +#include "JPGLibrary.hxx" #include "OSystem.hxx" #include "PNGLibrary.hxx" #include "Props.hxx" @@ -59,7 +60,7 @@ void RomImageWidget::clearProperties() { myHaveProperties = mySurfaceIsValid = false; if(mySurface) - mySurface->setVisible(mySurfaceIsValid); + mySurface->setVisible(false); // Decide whether the information should be shown immediately if(instance().eventHandler().state() == EventHandlerState::LAUNCHER) @@ -84,6 +85,7 @@ void RomImageWidget::parseProperties(const FSNode& node, bool full) // Create navigation surface myNavSurface = instance().frameBuffer().allocateSurface( _w, myImageHeight); + myNavSurface->setDstRect(Common::Rect(_x, _y, _x + _w, _y + myImageHeight)); FBSurface::Attributes& attr = myNavSurface->attributes(); @@ -103,77 +105,73 @@ void RomImageWidget::parseProperties(const FSNode& node, bool full) dialog().addRenderCallback([this]() { if(mySurfaceIsValid) - { mySurface->render(); - if(isHighlighted()) - myNavSurface->render(); - } + if(isHighlighted()) + myNavSurface->render(); }); } -#ifdef PNG_SUPPORT +#ifdef IMAGE_SUPPORT if(!full) { myImageIdx = 0; myImageList.clear(); - mySurfaceErrorMsg = ""; // Get a valid filename representing a snapshot file for this rom and load the snapshot const string& path = instance().snapshotLoadDir().getPath(); // 1. Try to load first snapshot by property name - string fileName = path + myProperties.get(PropType::Cart_Name) + ".png"; + string fileName = path + myProperties.get(PropType::Cart_Name);// +".png"; // TODO: try jpg - mySurfaceIsValid = loadPng(fileName); + tryImageTypes(fileName); + + loadImage(fileName); if(!mySurfaceIsValid) { // 2. If none exists, try to load first snapshot by ROM file name - fileName = path + node.getNameWithExt("png"); - mySurfaceIsValid = loadPng(fileName); + fileName = path + node.getNameWithExt("png"); // TODO: try jpg + loadImage(fileName); } if(mySurfaceIsValid) myImageList.emplace_back(fileName); else // 3. If no ROM snapshots exist, try to load a default snapshot - mySurfaceIsValid = loadPng(path + "default_snapshot.png"); + loadImage(path + "default_snapshot.png"); // TODO: try jpg??? } else { - const string& oldFileName = myImageList.size() ? myImageList[0].getPath() : ""; + const string& oldFileName = myImageList.size() ? myImageList[0].getPath() : EmptyString; // Try to find all snapshots by property and ROM file name myImageList.clear(); getImageList(myProperties.get(PropType::Cart_Name), node.getNameWithExt()); // The first file found before must not be the first file now, if files by - // property *and* ROM name are found + // property *and* ROM name are found (TODO: fix that!) if(myImageList.size() && myImageList[0].getPath() != oldFileName) - { - mySurfaceErrorMsg = ""; - mySurfaceIsValid = loadPng(myImageList[0].getPath()); - } + loadImage(myImageList[0].getPath()); } #else mySurfaceIsValid = false; mySurfaceErrorMsg = "PNG image loading not supported"; + setDirty(); #endif if(mySurface) mySurface->setVisible(mySurfaceIsValid); - - setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool RomImageWidget::changeImage(int direction) { +#ifdef IMAGE_SUPPORT if(direction == -1 && myImageIdx) - return loadPng(myImageList[--myImageIdx].getPath()); + return loadImage(myImageList[--myImageIdx].getPath()); else if(direction == 1 && myImageIdx < myImageList.size() - 1) - return loadPng(myImageList[++myImageIdx].getPath()); - + return loadImage(myImageList[++myImageIdx].getPath()); +#endif return false; } -#ifdef PNG_SUPPORT +#ifdef IMAGE_SUPPORT // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool RomImageWidget::getImageList(const string& propName, const string& romName) { @@ -181,7 +179,7 @@ bool RomImageWidget::getImageList(const string& propName, const string& romName) const string rgxPropName = std::regex_replace(propName, symbols, R"(\$&)"); const string rgxRomName = std::regex_replace(romName, symbols, R"(\$&)"); // Look for or (# is a number) - const std::regex rgx("^(" + rgxPropName + "|" + rgxRomName + ")(_\\d+){0,1}\\.png$"); + const std::regex rgx("^(" + rgxPropName + "|" + rgxRomName + ")(_\\d+){0,1}\\.(png|jpg)$"); FSNode::NameFilter filter = ([&](const FSNode& node) { @@ -197,20 +195,60 @@ bool RomImageWidget::getImageList(const string& propName, const string& romName) // the end of the list std::sort(myImageList.begin(), myImageList.end(), [](const FSNode& node1, const FSNode& node2) - { - return BSPF::compareIgnoreCase(node1.getNameWithExt(), node2.getNameWithExt()) < 0; + { + int compare = BSPF::compareIgnoreCase(node1.getNameWithExt(), node2.getNameWithExt()); + return + compare < 0 || + (compare == 0 && + node1.getName().substr(node1.getName().find_last_of('.') + 1) > + node2.getName().substr(node2.getName().find_last_of('.') + 1)); // PNGs first! } ); return myImageList.size() > 0; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool RomImageWidget::tryImageTypes(string& fileName) +{ + if(loadImage(fileName + ".png")) + { + fileName += ".png"; + return true; + } + if(loadImage(fileName + ".jpg")) + { + fileName += ".jpg"; + return true; + } + return false; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool RomImageWidget::loadImage(const string& fileName) +{ + mySurfaceErrorMsg.clear(); + + const string::size_type idx = fileName.find_last_of('.'); + + if(idx != string::npos && fileName.substr(idx + 1) == "png") + mySurfaceIsValid = loadPng(fileName); + else + mySurfaceIsValid = loadJpg(fileName); + + if(mySurface) + mySurface->setVisible(mySurfaceIsValid); + + setDirty(); + return mySurfaceIsValid; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool RomImageWidget::loadPng(const string& fileName) { try { VariantList comments; - instance().png().loadImage(fileName, *mySurface, comments); + instance().png().loadImage(fileName, *mySurface, comments); // Scale surface to available image area const Common::Rect& src = mySurface->srcRect(); @@ -219,7 +257,7 @@ bool RomImageWidget::loadPng(const string& fileName) mySurface->setDstSize(static_cast(src.w() * scale), static_cast(src.h() * scale)); // Retrieve label for loaded image - myLabel = ""; + myLabel.clear(); for(auto comment = comments.begin(); comment != comments.end(); ++comment) { if(comment->first == "Title") @@ -231,8 +269,6 @@ bool RomImageWidget::loadPng(const string& fileName) && comment->second.toString().find("Stella") == 0) myLabel = "Snapshot"; // default for Stella snapshots with missing "Title" comment } - - setDirty(); return true; } catch(const runtime_error& e) @@ -242,6 +278,25 @@ bool RomImageWidget::loadPng(const string& fileName) return false; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool RomImageWidget::loadJpg(const string& fileName) +{ + try + { + VariantList comments; + instance().jpg().loadImage(fileName, *mySurface, comments); + + myLabel.clear(); + return true; + } + catch(const runtime_error& e) + { + mySurfaceErrorMsg = e.what(); + } + //mySurfaceErrorMsg = "JPG image loading not supported"; + return false; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void RomImageWidget::handleMouseUp(int x, int y, MouseButton b, int clickCount) { @@ -285,51 +340,50 @@ void RomImageWidget::drawWidget(bool hilite) const Common::Rect& s_dst = s.dstRect(); mySurface->setDstPos(x + s_dst.x(), y + s_dst.y()); - // Draw the image label and counter - ostringstream buf; - buf << myImageIdx + 1 << "/" << myImageList.size(); - const int yText = _y + myImageHeight + _font.getFontHeight() / 8; - const int wText = _font.getStringWidth(buf.str()); - - if(myLabel.length()) - s.drawString(_font, myLabel, _x, yText, _w - wText - _font.getMaxCharWidth() * 2, _textcolor); - if(myImageList.size()) - s.drawString(_font, buf.str(), _x + _w - wText, yText, wText, _textcolor); - - // Draw the navigation arrows - myNavSurface->invalidate(); - if(isHighlighted() && - ((myMouseLeft && myImageIdx) || (!myMouseLeft && myImageIdx < myImageList.size() - 1))) - { - const int w = _w / 64; - const int w2 = 1; // w / 2; - const int ax = myMouseLeft ? _w / 12 - w / 2 : _w - _w / 12 - w / 2; - const int ay = myImageHeight >> 1; - const int dx = (_w / 32) * (myMouseLeft ? 1 : -1); - const int dy = myImageHeight / 16; - - for(int i = 0; i < w; ++i) - { - myNavSurface->line(ax + dx + i + w2, ay - dy, ax + i + w2, ay, kBGColor); - myNavSurface->line(ax + dx + i + w2, ay + dy, ax + i + w2, ay, kBGColor); - myNavSurface->line(ax + dx + i, ay - dy + w2, ax + i, ay + w2, kBGColor); - myNavSurface->line(ax + dx + i, ay + dy + w2, ax + i, ay + w2, kBGColor); - myNavSurface->line(ax + dx + i + w2, ay - dy + w2, ax + i + w2, ay + w2, kBGColor); - myNavSurface->line(ax + dx + i + w2, ay + dy + w2, ax + i + w2, ay + w2, kBGColor); - } - for(int i = 0; i < w; ++i) - { - myNavSurface->line(ax + dx + i, ay - dy, ax + i, ay, kColorInfo); - myNavSurface->line(ax + dx + i, ay + dy, ax + i, ay, kColorInfo); - } - myNavSurface->setDstRect(mySurface->dstRect()); - } } - else if(mySurfaceErrorMsg != "") + else if(!mySurfaceErrorMsg.empty()) { const uInt32 x = _x + ((_w - _font.getStringWidth(mySurfaceErrorMsg)) >> 1); const uInt32 y = _y + ((yoff - _font.getLineHeight()) >> 1); s.drawString(_font, mySurfaceErrorMsg, x, y, _w - 10, _textcolor); } + // Draw the image label and counter + ostringstream buf; + buf << myImageIdx + 1 << "/" << myImageList.size(); + const int yText = _y + myImageHeight + _font.getFontHeight() / 8; + const int wText = _font.getStringWidth(buf.str()); + + if(myLabel.length()) + s.drawString(_font, myLabel, _x, yText, _w - wText - _font.getMaxCharWidth() * 2, _textcolor); + if(myImageList.size()) + s.drawString(_font, buf.str(), _x + _w - wText, yText, wText, _textcolor); + + // Draw the navigation arrows + myNavSurface->invalidate(); + if(isHighlighted() && + ((myMouseLeft && myImageIdx) || (!myMouseLeft && myImageIdx < myImageList.size() - 1))) + { + const int w = _w / 64; + const int w2 = 1; // w / 2; + const int ax = myMouseLeft ? _w / 12 - w / 2 : _w - _w / 12 - w / 2; + const int ay = myImageHeight >> 1; + const int dx = (_w / 32) * (myMouseLeft ? 1 : -1); + const int dy = myImageHeight / 16; + + for(int i = 0; i < w; ++i) + { + myNavSurface->line(ax + dx + i + w2, ay - dy, ax + i + w2, ay, kBGColor); + myNavSurface->line(ax + dx + i + w2, ay + dy, ax + i + w2, ay, kBGColor); + myNavSurface->line(ax + dx + i, ay - dy + w2, ax + i, ay + w2, kBGColor); + myNavSurface->line(ax + dx + i, ay + dy + w2, ax + i, ay + w2, kBGColor); + myNavSurface->line(ax + dx + i + w2, ay - dy + w2, ax + i + w2, ay + w2, kBGColor); + myNavSurface->line(ax + dx + i + w2, ay + dy + w2, ax + i + w2, ay + w2, kBGColor); + } + for(int i = 0; i < w; ++i) + { + myNavSurface->line(ax + dx + i, ay - dy, ax + i, ay, kColorInfo); + myNavSurface->line(ax + dx + i, ay + dy, ax + i, ay, kColorInfo); + } + } clearDirty(); } diff --git a/src/gui/RomImageWidget.hxx b/src/gui/RomImageWidget.hxx index 8a5e96753..39e42257f 100644 --- a/src/gui/RomImageWidget.hxx +++ b/src/gui/RomImageWidget.hxx @@ -42,16 +42,19 @@ class RomImageWidget : public Widget, public CommandSender protected: void drawWidget(bool hilite) override; -#ifdef PNG_SUPPORT +#ifdef IMAGE_SUPPORT void handleMouseUp(int x, int y, MouseButton b, int clickCount) override; void handleMouseMoved(int x, int y) override; #endif private: void parseProperties(const FSNode& node, bool full = true); - #ifdef PNG_SUPPORT + #ifdef IMAGE_SUPPORT bool getImageList(const string& propName, const string& romName); + bool tryImageTypes(string& fileName); + bool loadImage(const string& fileName); bool loadPng(const string& fileName); + bool loadJpg(const string& fileName); #endif private: diff --git a/src/windows/Stella.vcxproj b/src/windows/Stella.vcxproj index e889ba1d6..f2702112e 100755 --- a/src/windows/Stella.vcxproj +++ b/src/windows/Stella.vcxproj @@ -249,8 +249,8 @@ Disabled - ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\httplib;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;DEBUG_BUILD;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;HTTP_LIB_SUPPORT;%(PreprocessorDefinitions) + ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\nanojpeg;..\httplib;%(AdditionalIncludeDirectories) + BSPF_WINDOWS;WIN32;NOMINMAX;DEBUG_BUILD;SDL_SUPPORT;GUI_SUPPORT;IMAGE_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;HTTP_LIB_SUPPORT;%(PreprocessorDefinitions) false EnableFastChecks MultiThreadedDLL @@ -283,8 +283,8 @@ Disabled - ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;%(AdditionalIncludeDirectories) - 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) + ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\nanojpeg;%(AdditionalIncludeDirectories) + BSPF_WINDOWS;WIN32;NOMINMAX;DEBUG_BUILD;SDL_SUPPORT;GUI_SUPPORT;IMAGE_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) false EnableFastChecks MultiThreadedDLL @@ -320,8 +320,8 @@ Disabled - ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\httplib;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;DEBUG_BUILD;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;HTTP_LIB_SUPPORT;%(PreprocessorDefinitions) + ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\nanojpeg;..\httplib;%(AdditionalIncludeDirectories) + BSPF_WINDOWS;WIN32;NOMINMAX;DEBUG_BUILD;SDL_SUPPORT;GUI_SUPPORT;IMAGE_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;HTTP_LIB_SUPPORT;%(PreprocessorDefinitions) false EnableFastChecks MultiThreadedDLL @@ -356,8 +356,8 @@ Disabled - ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;DEBUG_BUILD;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) + ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\nanojpeg;%(AdditionalIncludeDirectories) + BSPF_WINDOWS;WIN32;NOMINMAX;DEBUG_BUILD;SDL_SUPPORT;GUI_SUPPORT;IMAGE_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) false EnableFastChecks MultiThreadedDLL @@ -390,8 +390,8 @@ true true - ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\httplib;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;HTTP_LIB_SUPPORT;%(PreprocessorDefinitions) + ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\nanojpeg;..\httplib;%(AdditionalIncludeDirectories) + BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;IMAGE_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;HTTP_LIB_SUPPORT;%(PreprocessorDefinitions) MultiThreadedDLL false @@ -425,8 +425,8 @@ true true - ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\httplib;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;HTTP_LIB_SUPPORT;%(PreprocessorDefinitions) + ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\nanojpeg;..\httplib;%(AdditionalIncludeDirectories) + BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;IMAGE_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;HTTP_LIB_SUPPORT;%(PreprocessorDefinitions) MultiThreadedDLL false @@ -460,8 +460,8 @@ true false - ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) + ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\nanojpeg;%(AdditionalIncludeDirectories) + BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;IMAGE_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) MultiThreadedDLL false @@ -499,8 +499,8 @@ MaxSpeed AnySuitable true - ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\httplib;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;HTTP_LIB_SUPPORT;%(PreprocessorDefinitions) + ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\nanojpeg;..\httplib;%(AdditionalIncludeDirectories) + BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;IMAGE_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;HTTP_LIB_SUPPORT;%(PreprocessorDefinitions) MultiThreadedDLL false @@ -538,8 +538,8 @@ MaxSpeed AnySuitable true - ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\httplib;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;HTTP_LIB_SUPPORT;%(PreprocessorDefinitions) + ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\nanojpeg;..\httplib;%(AdditionalIncludeDirectories) + BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;IMAGE_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;HTTP_LIB_SUPPORT;%(PreprocessorDefinitions) MultiThreadedDLL false @@ -577,8 +577,8 @@ Full Default true - ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;PNG_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) + ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;..\json;..\common\repository\sqlite;..\sqlite;..\nanojpeg;%(AdditionalIncludeDirectories) + BSPF_WINDOWS;WIN32;NOMINMAX;NDEBUG;SDL_SUPPORT;GUI_SUPPORT;IMAGE_SUPPORT;ZIP_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) MultiThreadedDLL false @@ -623,6 +623,7 @@ + @@ -938,6 +939,7 @@ + CompileAsC CompileAsC @@ -1798,6 +1800,7 @@ + @@ -2167,6 +2170,8 @@ + + diff --git a/src/windows/Stella.vcxproj.filters b/src/windows/Stella.vcxproj.filters index 7e3371379..d7ad6046c 100644 --- a/src/windows/Stella.vcxproj.filters +++ b/src/windows/Stella.vcxproj.filters @@ -94,6 +94,9 @@ {e216a718-4078-4a08-b134-4987ec071e31} + + {7836da03-0e67-481a-b16a-529a1042d215} + @@ -1149,6 +1152,12 @@ Source Files\gui + + Source Files + + + Header Files\nanojpeg + @@ -2378,6 +2387,15 @@ Header Files\gui + + Header Files + + + Header Files\nanojpeg + + + Header Files\nanojpeg +