mirror of https://github.com/stella-emu/stella.git
Enable conditional compilation for PNG support. Some ports (libretro) don't need it at all.
This commit is contained in:
parent
32d90c1935
commit
eb13d515fb
|
@ -59,6 +59,9 @@
|
||||||
|
|
||||||
* Fixed 'Dancing Plate (Unknown) (PAL)' to use joystick.
|
* Fixed 'Dancing Plate (Unknown) (PAL)' to use joystick.
|
||||||
|
|
||||||
|
* PNG image support is now conditionally compiled into Stella. All
|
||||||
|
major ports (Linux/macOS/Windows) have it enabled by default.
|
||||||
|
|
||||||
-Have fun!
|
-Have fun!
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ _build_sound=yes
|
||||||
_build_debugger=yes
|
_build_debugger=yes
|
||||||
_build_joystick=yes
|
_build_joystick=yes
|
||||||
_build_cheats=yes
|
_build_cheats=yes
|
||||||
|
_build_png=yes
|
||||||
_build_static=no
|
_build_static=no
|
||||||
_build_profile=no
|
_build_profile=no
|
||||||
_build_debug=no
|
_build_debug=no
|
||||||
|
@ -198,6 +199,8 @@ Optional Features:
|
||||||
--disable-joystick
|
--disable-joystick
|
||||||
--enable-cheats enable/disable cheatcode support [enabled]
|
--enable-cheats enable/disable cheatcode support [enabled]
|
||||||
--disable-cheats
|
--disable-cheats
|
||||||
|
--enable-png enable/disable PNG image support [enabled]
|
||||||
|
--disable-png
|
||||||
--enable-windowed enable/disable windowed rendering modes [enabled]
|
--enable-windowed enable/disable windowed rendering modes [enabled]
|
||||||
--disable-windowed
|
--disable-windowed
|
||||||
--enable-shared build shared binary [enabled]
|
--enable-shared build shared binary [enabled]
|
||||||
|
@ -237,6 +240,8 @@ for ac_option in $@; do
|
||||||
--disable-joystick) _build_joystick=no ;;
|
--disable-joystick) _build_joystick=no ;;
|
||||||
--enable-cheats) _build_cheats=yes ;;
|
--enable-cheats) _build_cheats=yes ;;
|
||||||
--disable-cheats) _build_cheats=no ;;
|
--disable-cheats) _build_cheats=no ;;
|
||||||
|
--enable-png) _build_png=yes ;;
|
||||||
|
--disable-png) _build_png=no ;;
|
||||||
--enable-windowed) _build_windowed=yes ;;
|
--enable-windowed) _build_windowed=yes ;;
|
||||||
--disable-windowed) _build_windowed=no ;;
|
--disable-windowed) _build_windowed=no ;;
|
||||||
--enable-shared) _build_static=no ;;
|
--enable-shared) _build_static=no ;;
|
||||||
|
@ -669,6 +674,14 @@ else
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "$_build_png" = yes ; then
|
||||||
|
echo_n " PNG image support enabled"
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo_n " PNG image support disabled"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
if test "$_build_windowed" = "yes" ; then
|
if test "$_build_windowed" = "yes" ; then
|
||||||
echo_n " Windowed rendering modes enabled"
|
echo_n " Windowed rendering modes enabled"
|
||||||
echo
|
echo
|
||||||
|
@ -802,6 +815,10 @@ if test "$_build_cheats" = yes ; then
|
||||||
INCLUDES="$INCLUDES -I$CHEAT"
|
INCLUDES="$INCLUDES -I$CHEAT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "$_build_png" = yes ; then
|
||||||
|
DEFINES="$DEFINES -DPNG_SUPPORT"
|
||||||
|
fi
|
||||||
|
|
||||||
if test "$_build_profile" = no ; then
|
if test "$_build_profile" = no ; then
|
||||||
_build_profile=
|
_build_profile=
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -546,9 +546,11 @@ bool PhysicalKeyboardHandler::handleAltEvent(StellaKey key, StellaMod mod, bool
|
||||||
myOSystem.state().toggleTimeMachine();
|
myOSystem.state().toggleTimeMachine();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef PNG_SUPPORT
|
||||||
case KBDK_S:
|
case KBDK_S:
|
||||||
myOSystem.png().toggleContinuousSnapshots(StellaModTest::isShift(mod));
|
myOSystem.png().toggleContinuousSnapshots(StellaModTest::isShift(mod));
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
handled = false;
|
handled = false;
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
#if defined(PNG_SUPPORT)
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
@ -493,3 +495,5 @@ void PNGLibrary::png_user_error(png_structp ctx, png_const_charp str)
|
||||||
PNGLibrary::ReadInfoType PNGLibrary::ReadInfo = {
|
PNGLibrary::ReadInfoType PNGLibrary::ReadInfo = {
|
||||||
nullptr, nullptr, 0, 0, 0, 0, 0
|
nullptr, nullptr, 0, 0, 0, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // PNG_SUPPORT
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#ifndef PNGLIBRARY_HXX
|
#ifndef PNGLIBRARY_HXX
|
||||||
#define PNGLIBRARY_HXX
|
#define PNGLIBRARY_HXX
|
||||||
|
|
||||||
|
#if defined(PNG_SUPPORT)
|
||||||
|
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
|
|
||||||
class OSystem;
|
class OSystem;
|
||||||
|
@ -197,4 +199,6 @@ class PNGLibrary
|
||||||
PNGLibrary& operator=(PNGLibrary&&) = delete;
|
PNGLibrary& operator=(PNGLibrary&&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // PNG_SUPPORT
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -61,9 +61,10 @@ void TiaOutputWidget::loadConfig()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix)
|
void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix)
|
||||||
{
|
{
|
||||||
if (execDepth > 0) {
|
#ifdef PNG_SUPPORT
|
||||||
|
if(execDepth > 0)
|
||||||
drawWidget(false);
|
drawWidget(false);
|
||||||
}
|
|
||||||
ostringstream sspath;
|
ostringstream sspath;
|
||||||
sspath << instance().snapshotSaveDir()
|
sspath << instance().snapshotSaveDir()
|
||||||
<< instance().console().properties().get(PropType::Cart_Name);
|
<< instance().console().properties().get(PropType::Cart_Name);
|
||||||
|
@ -93,6 +94,9 @@ void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix)
|
||||||
if (execDepth == 0) {
|
if (execDepth == 0) {
|
||||||
instance().frameBuffer().showMessage(message);
|
instance().frameBuffer().showMessage(message);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
instance().frameBuffer().showMessage("PNG image saving not supported");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -118,7 +118,9 @@ void EventHandler::reset(EventHandlerState state)
|
||||||
{
|
{
|
||||||
setState(state);
|
setState(state);
|
||||||
myOSystem.state().reset();
|
myOSystem.state().reset();
|
||||||
|
#ifdef PNG_SUPPORT
|
||||||
myOSystem.png().setContinuousSnapInterval(0);
|
myOSystem.png().setContinuousSnapInterval(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Reset events almost immediately after starting emulation mode
|
// Reset events almost immediately after starting emulation mode
|
||||||
// We wait a little while (0.5s), since 'hold' events may be present,
|
// We wait a little while (0.5s), since 'hold' events may be present,
|
||||||
|
@ -219,9 +221,11 @@ void EventHandler::poll(uInt64 time)
|
||||||
cheat->evaluate();
|
cheat->evaluate();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_SUPPORT
|
||||||
// Handle continuous snapshots
|
// Handle continuous snapshots
|
||||||
if(myOSystem.png().continuousSnapEnabled())
|
if(myOSystem.png().continuousSnapEnabled())
|
||||||
myOSystem.png().updateTime(time);
|
myOSystem.png().updateTime(time);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if(myOverlay)
|
else if(myOverlay)
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,7 +81,10 @@ OSystem::OSystem()
|
||||||
myFeatures += "Debugger ";
|
myFeatures += "Debugger ";
|
||||||
#endif
|
#endif
|
||||||
#ifdef CHEATCODE_SUPPORT
|
#ifdef CHEATCODE_SUPPORT
|
||||||
myFeatures += "Cheats";
|
myFeatures += "Cheats ";
|
||||||
|
#endif
|
||||||
|
#ifdef PNG_SUPPORT
|
||||||
|
myFeatures += "PNG";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Get build info
|
// Get build info
|
||||||
|
@ -154,8 +157,10 @@ bool OSystem::create()
|
||||||
// Create random number generator
|
// Create random number generator
|
||||||
myRandom = make_unique<Random>(uInt32(TimerManager::getTicks()));
|
myRandom = make_unique<Random>(uInt32(TimerManager::getTicks()));
|
||||||
|
|
||||||
|
#ifdef PNG_SUPPORT
|
||||||
// Create PNG handler
|
// Create PNG handler
|
||||||
myPNGLib = make_unique<PNGLibrary>(*this);
|
myPNGLib = make_unique<PNGLibrary>(*this);
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
#ifndef OSYSTEM_HXX
|
#ifndef OSYSTEM_HXX
|
||||||
#define OSYSTEM_HXX
|
#define OSYSTEM_HXX
|
||||||
|
|
||||||
|
#ifdef PNG_SUPPORT
|
||||||
|
class PNGLibrary;
|
||||||
|
#endif
|
||||||
#ifdef CHEATCODE_SUPPORT
|
#ifdef CHEATCODE_SUPPORT
|
||||||
class CheatManager;
|
class CheatManager;
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,7 +32,6 @@ class Menu;
|
||||||
class TimeMachine;
|
class TimeMachine;
|
||||||
class FrameBuffer;
|
class FrameBuffer;
|
||||||
class EventHandler;
|
class EventHandler;
|
||||||
class PNGLibrary;
|
|
||||||
class Properties;
|
class Properties;
|
||||||
class PropertiesSet;
|
class PropertiesSet;
|
||||||
class Random;
|
class Random;
|
||||||
|
@ -173,13 +175,6 @@ class OSystem
|
||||||
*/
|
*/
|
||||||
TimerManager& timer() const { return *myTimerManager; }
|
TimerManager& timer() const { return *myTimerManager; }
|
||||||
|
|
||||||
/**
|
|
||||||
Get the PNG handler of the system.
|
|
||||||
|
|
||||||
@return The PNGlib object
|
|
||||||
*/
|
|
||||||
PNGLibrary& png() const { return *myPNGLib; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This method should be called to initiate the process of loading settings
|
This method should be called to initiate the process of loading settings
|
||||||
from the config file. It takes care of loading settings, applying
|
from the config file. It takes care of loading settings, applying
|
||||||
|
@ -212,6 +207,15 @@ class OSystem
|
||||||
CheatManager& cheat() const { return *myCheatManager; }
|
CheatManager& cheat() const { return *myCheatManager; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_SUPPORT
|
||||||
|
/**
|
||||||
|
Get the PNG handler of the system.
|
||||||
|
|
||||||
|
@return The PNGlib object
|
||||||
|
*/
|
||||||
|
PNGLibrary& png() const { return *myPNGLib; }
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set all config file paths for the OSystem.
|
Set all config file paths for the OSystem.
|
||||||
*/
|
*/
|
||||||
|
@ -491,15 +495,17 @@ class OSystem
|
||||||
unique_ptr<CheatManager> myCheatManager;
|
unique_ptr<CheatManager> myCheatManager;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_SUPPORT
|
||||||
|
// PNG object responsible for loading/saving PNG images
|
||||||
|
unique_ptr<PNGLibrary> myPNGLib;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Pointer to the StateManager object
|
// Pointer to the StateManager object
|
||||||
unique_ptr<StateManager> myStateManager;
|
unique_ptr<StateManager> myStateManager;
|
||||||
|
|
||||||
// Pointer to the TimerManager object
|
// Pointer to the TimerManager object
|
||||||
unique_ptr<TimerManager> myTimerManager;
|
unique_ptr<TimerManager> myTimerManager;
|
||||||
|
|
||||||
// PNG object responsible for loading/saving PNG images
|
|
||||||
unique_ptr<PNGLibrary> myPNGLib;
|
|
||||||
|
|
||||||
// The list of log messages
|
// The list of log messages
|
||||||
string myLogMessages;
|
string myLogMessages;
|
||||||
|
|
||||||
|
|
|
@ -398,7 +398,9 @@ void TIASurface::render()
|
||||||
if(mySaveSnapFlag)
|
if(mySaveSnapFlag)
|
||||||
{
|
{
|
||||||
mySaveSnapFlag = false;
|
mySaveSnapFlag = false;
|
||||||
|
#ifdef PNG_SUPPORT
|
||||||
myOSystem.png().takeSnapshot();
|
myOSystem.png().takeSnapshot();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,9 +95,10 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
|
||||||
|
|
||||||
// Initialize to empty properties entry
|
// Initialize to empty properties entry
|
||||||
mySurfaceErrorMsg = "";
|
mySurfaceErrorMsg = "";
|
||||||
mySurfaceIsValid = true;
|
mySurfaceIsValid = false;
|
||||||
myRomInfo.clear();
|
myRomInfo.clear();
|
||||||
|
|
||||||
|
#ifdef PNG_SUPPORT
|
||||||
// Get a valid filename representing a snapshot file for this rom
|
// Get a valid filename representing a snapshot file for this rom
|
||||||
const string& filename = instance().snapshotLoadDir() +
|
const string& filename = instance().snapshotLoadDir() +
|
||||||
myProperties.get(PropType::Cart_Name) + ".png";
|
myProperties.get(PropType::Cart_Name) + ".png";
|
||||||
|
@ -111,12 +112,15 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
|
||||||
const GUI::Rect& src = mySurface->srcRect();
|
const GUI::Rect& src = mySurface->srcRect();
|
||||||
float scale = std::min(float(myAvail.w) / src.width(), float(myAvail.h) / src.height());
|
float scale = std::min(float(myAvail.w) / src.width(), float(myAvail.h) / src.height());
|
||||||
mySurface->setDstSize(uInt32(src.width() * scale), uInt32(src.height() * scale));
|
mySurface->setDstSize(uInt32(src.width() * scale), uInt32(src.height() * scale));
|
||||||
|
mySurfaceIsValid = true;
|
||||||
}
|
}
|
||||||
catch(const runtime_error& e)
|
catch(const runtime_error& e)
|
||||||
{
|
{
|
||||||
mySurfaceIsValid = false;
|
|
||||||
mySurfaceErrorMsg = e.what();
|
mySurfaceErrorMsg = e.what();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
mySurfaceErrorMsg = "PNG image loading not supported";
|
||||||
|
#endif
|
||||||
if(mySurface)
|
if(mySurface)
|
||||||
mySurface->setVisible(mySurfaceIsValid);
|
mySurface->setVisible(mySurfaceIsValid);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue