add libretro port

This commit is contained in:
trinemark 2019-04-07 17:31:25 -05:00 committed by Stephen Anthony
parent bf865e37ab
commit cae32b0b3f
32 changed files with 6274 additions and 11 deletions

View File

@ -23,6 +23,8 @@ class AbstractFSNode;
#include "FSNodePOSIX.hxx" #include "FSNodePOSIX.hxx"
#elif defined(BSPF_WINDOWS) #elif defined(BSPF_WINDOWS)
#include "FSNodeWINDOWS.hxx" #include "FSNodeWINDOWS.hxx"
#elif defined(__LIB_RETRO__)
#include "FSNodeLIBRETRO.hxx"
#else #else
#error Unsupported platform in FSNodeFactory! #error Unsupported platform in FSNodeFactory!
#endif #endif
@ -49,6 +51,8 @@ class FilesystemNodeFactory
return make_unique<FilesystemNodePOSIX>(path); return make_unique<FilesystemNodePOSIX>(path);
#elif defined(BSPF_WINDOWS) #elif defined(BSPF_WINDOWS)
return make_unique<FilesystemNodeWINDOWS>(path); return make_unique<FilesystemNodeWINDOWS>(path);
#elif defined(__LIB_RETRO__)
return make_unique<FilesystemNodeLIBRETRO>(path);
#endif #endif
break; break;
case Type::ZIP: case Type::ZIP:

View File

@ -44,14 +44,27 @@
extern "C" { extern "C" {
int stellaMain(int argc, char* argv[]); int stellaMain(int argc, char* argv[]);
} }
#elif defined(__LIB_RETRO__)
#include "SettingsLIBRETRO.hxx"
#include "OSystemLIBRETRO.hxx"
#else #else
#error Unsupported platform! #error Unsupported platform!
#endif #endif
#include "FrameBufferSDL2.hxx" #if defined(__LIB_RETRO__)
#include "EventHandlerSDL2.hxx" #include "EventHandlerLIBRETRO.hxx"
#ifdef SOUND_SUPPORT #include "FrameBufferLIBRETRO.hxx"
#else
#include "EventHandlerSDL2.hxx"
#include "FrameBufferSDL2.hxx"
#endif
#if defined(SOUND_SUPPORT)
#if defined(__LIB_RETRO__)
#include "SoundLIBRETRO.hxx"
#else
#include "SoundSDL2.hxx" #include "SoundSDL2.hxx"
#endif
#else #else
#include "SoundNull.hxx" #include "SoundNull.hxx"
#endif #endif
@ -84,6 +97,8 @@ class MediaFactory
return make_unique<OSystemWINDOWS>(); return make_unique<OSystemWINDOWS>();
#elif defined(BSPF_MACOS) #elif defined(BSPF_MACOS)
return make_unique<OSystemMACOS>(); return make_unique<OSystemMACOS>();
#elif defined(__LIB_RETRO__)
return make_unique<OSystemLIBRETRO>();
#else #else
#error Unsupported platform for OSystem! #error Unsupported platform for OSystem!
#endif #endif
@ -101,6 +116,8 @@ class MediaFactory
return make_unique<SettingsWINDOWS>(); return make_unique<SettingsWINDOWS>();
#elif defined(BSPF_MACOS) #elif defined(BSPF_MACOS)
return make_unique<SettingsMACOS>(); return make_unique<SettingsMACOS>();
#elif defined(__LIB_RETRO__)
return make_unique<SettingsLIBRETRO>();
#else #else
#error Unsupported platform for Settings! #error Unsupported platform for Settings!
#endif #endif
@ -121,13 +138,21 @@ class MediaFactory
static unique_ptr<FrameBuffer> createVideo(OSystem& osystem) static unique_ptr<FrameBuffer> createVideo(OSystem& osystem)
{ {
#if defined(__LIB_RETRO__)
return make_unique<FrameBufferLIBRETRO>(osystem);
#else
return make_unique<FrameBufferSDL2>(osystem); return make_unique<FrameBufferSDL2>(osystem);
#endif
} }
static unique_ptr<Sound> createAudio(OSystem& osystem, AudioSettings& audioSettings) static unique_ptr<Sound> createAudio(OSystem& osystem, AudioSettings& audioSettings)
{ {
#ifdef SOUND_SUPPORT #ifdef SOUND_SUPPORT
#if defined(__LIB_RETRO__)
return make_unique<SoundLIBRETRO>(osystem, audioSettings);
#elif defined(SOUND_SUPPORT)
return make_unique<SoundSDL2>(osystem, audioSettings); return make_unique<SoundSDL2>(osystem, audioSettings);
#endif
#else #else
return make_unique<SoundNull>(osystem); return make_unique<SoundNull>(osystem);
#endif #endif
@ -135,7 +160,11 @@ class MediaFactory
static unique_ptr<EventHandler> createEventHandler(OSystem& osystem) static unique_ptr<EventHandler> createEventHandler(OSystem& osystem)
{ {
#if defined(__LIB_RETRO__)
return make_unique<EventHandlerLIBRETRO>(osystem);
#else
return make_unique<EventHandlerSDL2>(osystem); return make_unique<EventHandlerSDL2>(osystem);
#endif
} }
static void cleanUp() static void cleanUp()

View File

@ -89,6 +89,7 @@ static const string EmptyString("");
// This is defined by some systems, but Stella has other uses for it // This is defined by some systems, but Stella has other uses for it
#undef PAGE_SIZE #undef PAGE_SIZE
#undef PAGE_MASK
namespace BSPF namespace BSPF
{ {
@ -99,6 +100,9 @@ namespace BSPF
#elif defined(BSPF_WINDOWS) #elif defined(BSPF_WINDOWS)
static const string PATH_SEPARATOR = "\\"; static const string PATH_SEPARATOR = "\\";
#define ATTRIBUTE_FMT_PRINTF #define ATTRIBUTE_FMT_PRINTF
#elif defined(__LIB_RETRO__)
static const string PATH_SEPARATOR = "/";
#define ATTRIBUTE_FMT_PRINTF
#else #else
#error Update src/common/bspf.hxx for path separator #error Update src/common/bspf.hxx for path separator
#endif #endif
@ -145,7 +149,7 @@ namespace BSPF
// Compare two strings, ignoring case // Compare two strings, ignoring case
inline int compareIgnoreCase(const string& s1, const string& s2) inline int compareIgnoreCase(const string& s1, const string& s2)
{ {
#if defined BSPF_WINDOWS && !defined __GNUG__ #if (defined BSPF_WINDOWS || defined __WIN32__) && !defined __GNUG__
return _stricmp(s1.c_str(), s2.c_str()); return _stricmp(s1.c_str(), s2.c_str());
#else #else
return strcasecmp(s1.c_str(), s2.c_str()); return strcasecmp(s1.c_str(), s2.c_str());
@ -153,7 +157,7 @@ namespace BSPF
} }
inline int compareIgnoreCase(const char* s1, const char* s2) inline int compareIgnoreCase(const char* s1, const char* s2)
{ {
#if defined BSPF_WINDOWS && !defined __GNUG__ #if (defined BSPF_WINDOWS || defined __WIN32__) && !defined __GNUG__
return _stricmp(s1, s2); return _stricmp(s1, s2);
#else #else
return strcasecmp(s1, s2); return strcasecmp(s1, s2);
@ -163,7 +167,7 @@ namespace BSPF
// Test whether the first string starts with the second one (case insensitive) // Test whether the first string starts with the second one (case insensitive)
inline bool startsWithIgnoreCase(const string& s1, const string& s2) inline bool startsWithIgnoreCase(const string& s1, const string& s2)
{ {
#if defined BSPF_WINDOWS && !defined __GNUG__ #if (defined BSPF_WINDOWS || defined __WIN32__) && !defined __GNUG__
return _strnicmp(s1.c_str(), s2.c_str(), s2.length()) == 0; return _strnicmp(s1.c_str(), s2.c_str(), s2.length()) == 0;
#else #else
return strncasecmp(s1.c_str(), s2.c_str(), s2.length()) == 0; return strncasecmp(s1.c_str(), s2.c_str(), s2.length()) == 0;
@ -171,7 +175,7 @@ namespace BSPF
} }
inline bool startsWithIgnoreCase(const char* s1, const char* s2) inline bool startsWithIgnoreCase(const char* s1, const char* s2)
{ {
#if defined BSPF_WINDOWS && !defined __GNUG__ #if (defined BSPF_WINDOWS || defined __WIN32__) && !defined __GNUG__
return _strnicmp(s1, s2, strlen(s2)) == 0; return _strnicmp(s1, s2, strlen(s2)) == 0;
#else #else
return strncasecmp(s1, s2, strlen(s2)) == 0; return strncasecmp(s1, s2, strlen(s2)) == 0;
@ -239,7 +243,7 @@ namespace BSPF
std::time_t currtime; std::time_t currtime;
std::time(&currtime); std::time(&currtime);
std::tm tm_snapshot; std::tm tm_snapshot;
#if defined BSPF_WINDOWS && !defined __GNUG__ #if (defined BSPF_WINDOWS || defined __WIN32__) && (!defined __GNUG__ || defined __MINGW32__)
localtime_s(&tm_snapshot, &currtime); localtime_s(&tm_snapshot, &currtime);
#else #else
localtime_r(&currtime, &tm_snapshot); localtime_r(&currtime, &tm_snapshot);

View File

@ -77,6 +77,12 @@ Serializer::Serializer()
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 Serializer::size() const
{
return myStream->tellp();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Serializer::rewind() void Serializer::rewind()
{ {

View File

@ -207,6 +207,11 @@ class Serializer
*/ */
void putBool(bool b); void putBool(bool b);
/**
Returns the write ptr location
*/
uInt32 size() const;
private: private:
// The stream to send the serialized data to. // The stream to send the serialized data to.
unique_ptr<iostream> myStream; unique_ptr<iostream> myStream;

View File

@ -0,0 +1,38 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "OSystem.hxx"
#include "EventHandlerLIBRETRO.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandlerLIBRETRO::EventHandlerLIBRETRO(OSystem& osystem)
: EventHandler(osystem)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandlerLIBRETRO::~EventHandlerLIBRETRO()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandlerLIBRETRO::enableTextEvents(bool enable)
{}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandlerLIBRETRO::pollEvent()
{}

View File

@ -0,0 +1,59 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef EVENTHANDLER_LIBRETRO_HXX
#define EVENTHANDLER_LIBRETRO_HXX
#include "EventHandler.hxx"
/**
This class handles event collection from the point of view of the specific
backend toolkit (LIBRETRO). It converts from LIBRETRO-specific events into events
that the Stella core can understand.
@author Stephen Anthony
*/
class EventHandlerLIBRETRO : public EventHandler
{
public:
/**
Create a new LIBRETRO event handler object
*/
explicit EventHandlerLIBRETRO(OSystem& osystem);
virtual ~EventHandlerLIBRETRO();
private:
/**
Enable/disable text events (distinct from single-key events).
*/
void enableTextEvents(bool enable) override;
/**
Collects and dispatches any pending SDL2 events.
*/
void pollEvent() override;
private:
// Following constructors and assignment operators not supported
EventHandlerLIBRETRO() = delete;
EventHandlerLIBRETRO(const EventHandlerLIBRETRO&) = delete;
EventHandlerLIBRETRO(EventHandlerLIBRETRO&&) = delete;
EventHandlerLIBRETRO& operator=(const EventHandlerLIBRETRO&) = delete;
EventHandlerLIBRETRO& operator=(EventHandlerLIBRETRO&&) = delete;
};
#endif

View File

@ -0,0 +1,48 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "FBSurfaceLIBRETRO.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBSurfaceLIBRETRO::FBSurfaceLIBRETRO(FrameBufferLIBRETRO& buffer,
uInt32 width, uInt32 height, const uInt32* data)
: myFB(buffer)
{
createSurface(width, height, data);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceLIBRETRO::createSurface(uInt32 width, uInt32 height,
const uInt32* data)
{
myWidth = width;
myHeight = height;
myPixelData = make_unique<uInt32[]>(width * height);
////////////////////////////////////////////////////
// These *must* be set for the parent class
myPixels = myPixelData.get();
myPitch = width;
////////////////////////////////////////////////////
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FBSurfaceLIBRETRO::render()
{
return true;
}

View File

@ -0,0 +1,84 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef FBSURFACE_LIBRETRO_HXX
#define FBSURFACE_LIBRETRO_HXX
#include "bspf.hxx"
#include "FBSurface.hxx"
#include "FrameBufferLIBRETRO.hxx"
/**
An FBSurface suitable for the LIBRETRO Render2D API, making use of hardware
acceleration behind the scenes.
@author Stephen Anthony
*/
class FBSurfaceLIBRETRO : public FBSurface
{
public:
FBSurfaceLIBRETRO(FrameBufferLIBRETRO& buffer, uInt32 width, uInt32 height,
const uInt32* data);
virtual ~FBSurfaceLIBRETRO() { }
// Most of the surface drawing primitives are implemented in FBSurface;
void fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, ColorId color) override { }
void setDirty() override { }
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; }
void setSrcPos(uInt32 x, uInt32 y) override { }
void setSrcSize(uInt32 w, uInt32 h) override { }
void setDstPos(uInt32 x, uInt32 y) override { }
void setDstSize(uInt32 w, uInt32 h) override { }
void setVisible(bool visible) override { }
void translateCoords(Int32& x, Int32& y) const override { }
bool render() override;
void invalidate() override { }
void free() override { }
void reload() override { }
void resize(uInt32 width, uInt32 height) override { }
protected:
void applyAttributes(bool immediate) override { }
private:
void createSurface(uInt32 width, uInt32 height, const uInt32* data);
// Following constructors and assignment operators not supported
FBSurfaceLIBRETRO() = delete;
FBSurfaceLIBRETRO(const FBSurfaceLIBRETRO&) = delete;
FBSurfaceLIBRETRO(FBSurfaceLIBRETRO&&) = delete;
FBSurfaceLIBRETRO& operator=(const FBSurfaceLIBRETRO&) = delete;
FBSurfaceLIBRETRO& operator=(FBSurfaceLIBRETRO&&) = delete;
private:
FrameBufferLIBRETRO& myFB;
GUI::Rect mySrcGUIR, myDstGUIR;
private:
unique_ptr<uInt32[]> myPixelData;
uInt32 myWidth, myHeight;
};
#endif

View File

@ -0,0 +1,93 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2018 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "FSNodeLIBRETRO.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO()
{
_displayName = "rom";
_path = "";
_isDirectory = false;
_isFile = true;
_isPseudoRoot = false;
_isValid = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO(const string& p)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeLIBRETRO::exists() const
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeLIBRETRO::isReadable() const
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeLIBRETRO::isWritable() const
{
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string FilesystemNodeLIBRETRO::getShortPath() const
{
return "";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeLIBRETRO::
getChildren(AbstractFSList& myList, ListMode mode, bool hidden) const
{
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeLIBRETRO::makeDir()
{
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNodeLIBRETRO::rename(const string& newfile)
{
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFSNodePtr FilesystemNodeLIBRETRO::getParent() const
{
return nullptr;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 FilesystemNodeLIBRETRO::read(BytePtr& image) const
{
image = make_unique<uInt8[]>(512 * 1024);
extern uInt32 libretro_read_rom(void* data);
return libretro_read_rom(image.get());
}

View File

@ -0,0 +1,64 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2018 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef FS_NODE_LIBRETRO_HXX
#define FS_NODE_LIBRETRO_HXX
#include "FSNode.hxx"
// TODO - fix isFile() functionality so that it actually determines if something
// is a file; for now, it assumes a file if it isn't a directory
/*
* Implementation of the Stella file system API based on LIBRETRO API.
*
* Parts of this class are documented in the base interface class,
* AbstractFSNode.
*/
class FilesystemNodeLIBRETRO : public AbstractFSNode
{
public:
FilesystemNodeLIBRETRO();
explicit FilesystemNodeLIBRETRO(const string& path);
bool exists() const override;
const string& getName() const override { return _displayName; }
const string& getPath() const override { return _path; }
string getShortPath() const override;
bool isDirectory() const override { return _isDirectory; }
bool isFile() const override { return _isFile; }
bool isReadable() const override;
bool isWritable() const override;
bool makeDir() override;
bool rename(const string& newfile) override;
bool getChildren(AbstractFSList& list, ListMode mode, bool hidden) const override;
AbstractFSNodePtr getParent() const override;
uInt32 read(BytePtr& image) const override;
protected:
string _displayName;
string _path;
bool _isDirectory;
bool _isFile;
bool _isPseudoRoot;
bool _isValid;
};
#endif

View File

@ -0,0 +1,54 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "bspf.hxx"
#include "OSystem.hxx"
#include "FBSurfaceLIBRETRO.hxx"
#include "FrameBufferLIBRETRO.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBufferLIBRETRO::FrameBufferLIBRETRO(OSystem& osystem)
: FrameBuffer(osystem),
myRenderSurface(nullptr)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferLIBRETRO::queryHardware(vector<GUI::Size>& displays, VariantList& renderers)
{
displays.emplace_back(1920, 1080);
VarList::push_back(renderers, "software", "Software");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<FBSurface>
FrameBufferLIBRETRO::createSurface(uInt32 w, uInt32 h, const uInt32* data) const
{
unique_ptr<FBSurface> ptr = make_unique<FBSurfaceLIBRETRO>(const_cast<FrameBufferLIBRETRO&>(*this), w, h, data);
if(w == 565 && h == 320)
{
uInt32 pitch;
ptr.get()->basePtr(myRenderSurface, pitch);
}
return ptr;
}

View File

@ -0,0 +1,186 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef FRAMEBUFFER_LIBRETRO_HXX
#define FRAMEBUFFER_LIBRETRO_HXX
class OSystem;
class FBSurfaceLIBRETRO;
#include "bspf.hxx"
#include "FrameBuffer.hxx"
/**
This class implements a standard LIBRETRO 2D, hardware accelerated framebuffer.
Behind the scenes, it may be using Direct3D, OpenGL(ES), etc.
@author Stephen Anthony
*/
class FrameBufferLIBRETRO : public FrameBuffer
{
friend class FBSurfaceLIBRETRO;
public:
/**
Creates a new LIBRETRO framebuffer
*/
explicit FrameBufferLIBRETRO(OSystem& osystem);
virtual ~FrameBufferLIBRETRO() { }
//////////////////////////////////////////////////////////////////////
// The following are derived from public methods in FrameBuffer.hxx
//////////////////////////////////////////////////////////////////////
/**
Updates window title.
@param title The title of the application / window
*/
void setTitle(const string& title) override { }
/**
Shows or hides the cursor based on the given boolean value.
*/
void showCursor(bool show) override { }
/**
Answers if the display is currently in fullscreen mode.
*/
bool fullScreen() const override { return true; }
/**
This method is called to retrieve the R/G/B data from the given pixel.
@param pixel The pixel containing R/G/B data
@param r The red component of the color
@param g The green component of the color
@param b The blue component of the color
*/
inline void getRGB(uInt32 pixel, uInt8* r, uInt8* g, uInt8* b) const override { }
/**
This method is called to map a given R/G/B triple to the screen palette.
@param r The red component of the color.
@param g The green component of the color.
@param b The blue component of the color.
*/
inline uInt32 mapRGB(uInt8 r, uInt8 g, uInt8 b) const override { return (r << 16) | (g << 8) | b; }
/**
This method is called to get a copy of the specified ARGB data from the
viewable FrameBuffer area. Note that this isn't the same as any
internal surfaces that may be in use; it should return the actual data
as it is currently seen onscreen.
@param buffer A copy of the pixel data in ARGB8888 format
@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 { }
/**
Clear the frame buffer
*/
void clear() override { }
protected:
//////////////////////////////////////////////////////////////////////
// The following are derived from protected methods in FrameBuffer.hxx
//////////////////////////////////////////////////////////////////////
/**
This method is called to query and initialize the video hardware
for desktop and fullscreen resolution information.
*/
void queryHardware(vector<GUI::Size>& displays, VariantList& renderers) override;
/**
This method is called to query the video hardware for the index
of the display the current window is displayed on
@return the current display index or a negative value if no
window is displayed
*/
Int32 getCurrentDisplayIndex() override { return 0; }
/**
This method is called to change to the given video mode.
@param title The title for the created window
@param mode The video mode to use
@return False on any errors, else true
*/
bool setVideoMode(const string& title, const VideoMode& mode) override { return true; }
/**
This method is called to invalidate the contents of the entire
framebuffer (ie, mark the current content as invalid, and erase it on
the next drawing pass).
*/
void invalidate() override { }
/**
This method is called to create a surface with the given attributes.
@param w The requested width of the new surface.
@param h The requested height of the new surface.
@param data If non-null, use the given data values as a static surface
*/
unique_ptr<FBSurface>
createSurface(uInt32 w, uInt32 h, const uInt32* data) const override;
/**
Grabs or ungrabs the mouse based on the given boolean value.
*/
void grabMouse(bool grab) override { }
/**
Set the icon for the main SDL window.
*/
void setWindowIcon() override { }
/**
This method is called to provide information about the FrameBuffer.
*/
string about() const override { return "Video system: libretro"; }
/**
This method must be called after all drawing is done, and indicates
that the buffers should be pushed to the physical screen.
*/
void renderToScreen() override { }
public:
/**
Returns a pointer to the output rendering buffer
*/
uInt32* getRenderSurface() const { return myRenderSurface; }
private:
mutable uInt32* myRenderSurface;
private:
// Following constructors and assignment operators not supported
FrameBufferLIBRETRO() = delete;
FrameBufferLIBRETRO(const FrameBufferLIBRETRO&) = delete;
FrameBufferLIBRETRO(FrameBufferLIBRETRO&&) = delete;
FrameBufferLIBRETRO& operator=(const FrameBufferLIBRETRO&) = delete;
FrameBufferLIBRETRO& operator=(FrameBufferLIBRETRO&&) = delete;
};
#endif

656
src/libretro/Makefile Normal file
View File

@ -0,0 +1,656 @@
DEBUG = 0
HAVE_EXCEPTIONS = 1
HAVE_STRINGS_H = 1
LTO ?= -flto
SPACE :=
SPACE := $(SPACE) $(SPACE)
BACKSLASH :=
BACKSLASH := \$(BACKSLASH)
filter_out1 = $(filter-out $(firstword $1),$1)
filter_out2 = $(call filter_out1,$(call filter_out1,$1))
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -s),)
platform = win
else ifneq ($(findstring MINGW,$(shell uname -s)),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -s)),)
platform = osx
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
else ifneq ($(findstring win,$(shell uname -s)),)
platform = win
endif
else ifneq (,$(findstring armv,$(platform)))
ifeq (,$(findstring classic_,$(platform)))
override platform += unix
endif
else ifneq (,$(findstring rpi,$(platform)))
override platform += unix
endif
ifneq ($(platform), osx)
ifeq ($(findstring Haiku,$(shell uname -a)),)
PTHREAD_FLAGS = -lpthread
endif
endif
TARGET_NAME = stella
LIBS =
ifeq (,$(findstring msvc,$(platform)))
LIBS += -lm
endif
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
ifneq ($(GIT_VERSION)," unknown")
CXXFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
# Unix
ifneq (,$(findstring unix,$(platform)))
CFLAGS += $(LTO) $(PTHREAD_FLAGS)
CXXFLAGS += $(LTO) $(PTHREAD_FLAGS)
LDFLAGS += $(LTO) $(PTHREAD_FLAGS)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
ifneq ($(findstring SunOS,$(shell uname -a)),)
CC = gcc
SHARED := -shared -z defs
else
SHARED := -shared -Wl,--version-script=link.T -Wl,-z,defs
endif
ifneq ($(findstring Haiku,$(shell uname -a)),)
LIBS :=
endif
# ARM
ifneq (,$(findstring armv,$(platform)))
CXXFLAGS += -DARM
# Raspberry Pi
else ifneq (,$(findstring rpi,$(platform)))
CXXFLAGS += -DARM
endif
# OS X
else ifeq ($(platform), osx)
CFLAGS += $(LTO) $(PTHREAD_FLAGS)
CXXFLAGS += $(LTO) $(PTHREAD_FLAGS)
LDFLAGS += $(LTO) $(PTHREAD_FLAGS)
TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC
SHARED := -dynamiclib
arch = intel
ifeq ($(shell uname -p),powerpc)
arch = ppc
endif
ifeq ($(arch),ppc)
CXXFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
endif
OSXVER = $(shell sw_vers -productVersion | cut -d. -f 2)
OSX_GT_MOJAVE = $(shell (( $(OSXVER) >= 14)) && echo "YES")
ifneq ($(OSX_GT_MOJAVE),YES)
#this breaks compiling on Mac OS Mojave
fpic += -mmacosx-version-min=10.1
endif
# Nintendo Switch (libnx)
else ifeq ($(platform), libnx)
include $(DEVKITPRO)/libnx/switch_rules
TARGET := $(TARGET_NAME)_libretro_$(platform).a
DEFINES := -DSWITCH=1 -D__SWITCH__ -DARM
CFLAGS := $(DEFINES) -fPIE -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec -specs=$(LIBNX)/switch.specs
CFLAGS += -march=armv8-a -mtune=cortex-a57 -mtp=soft -mcpu=cortex-a57+crc+fp+simd -ffast-math
CXXFLAGS := $(ASFLAGS) $(CFLAGS)
STATIC_LINKING = 1
# Classic Platforms ####################
# Platform affix = classic_<ISA>_<µARCH>
# Help at https://modmyclassic.com/comp
# (armv7 a7, hard point, neon based) ###
# NESC, SNESC, C64 mini
else ifeq ($(platform), classic_armv7_a7)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
CXXFLAGS += -Ofast \
-flto=4 -fwhole-program -fuse-linker-plugin \
-fdata-sections -ffunction-sections -Wl,--gc-sections \
-fno-stack-protector -fno-ident -fomit-frame-pointer \
-falign-functions=1 -falign-jumps=1 -falign-loops=1 \
-fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
-fmerge-all-constants -fno-math-errno \
-marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
CFLAGS += $(CXXFLAGS)
HAVE_NEON = 1
ARCH = arm
BUILTIN_GPU = neon
USE_DYNAREC = 1
ifeq ($(shell echo `$(CC) -dumpversion` "< 4.9" | bc -l), 1)
CFLAGS += -march=armv7-a
else
CFLAGS += -march=armv7ve
# If gcc is 5.0 or later
ifeq ($(shell echo `$(CC) -dumpversion` ">= 5" | bc -l), 1)
LDFLAGS += -static-libgcc -static-libstdc++
endif
endif
#######################################
# iOS
else ifneq (,$(findstring ios,$(platform)))
CFLAGS += $(LTO) $(PTHREAD_FLAGS)
CXXFLAGS += $(LTO) $(PTHREAD_FLAGS)
LDFLAGS += $(LTO) $(PTHREAD_FLAGS)
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic := -fPIC
SHARED := -dynamiclib
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
endif
ifeq ($(platform),ios-arm64)
CC = clang -arch arm64 -isysroot $(IOSSDK)
CXX = clang++ -arch arm64 -isysroot $(IOSSDK)
else
CC = clang -arch armv7 -isysroot $(IOSSDK)
CXX = clang++ -arch armv7 -isysroot $(IOSSDK)
endif
CXXFLAGS += -DIOS
CXXFLAGS += -DARM
ifeq ($(platform),$(filter $(platform),ios9 ios-arm64))
CC += -miphoneos-version-min=8.0
CXX += -miphoneos-version-min=8.0
CFLAGS += -miphoneos-version-min=8.0
CXXFLAGS += -miphoneos-version-min=8.0
else
CC += -miphoneos-version-min=5.0
CXX += -miphoneos-version-min=5.0
CFLAGS += -miphoneos-version-min=5.0
CXXFLAGS += -miphoneos-version-min=5.0
endif
# Theos
else ifeq ($(platform), theos_ios)
CFLAGS += $(LTO)
CXXFLAGS += $(LTO)
LDFLAGS += $(LTO)
DEPLOYMENT_IOSVERSION = 5.0
TARGET = iphone:latest:$(DEPLOYMENT_IOSVERSION)
ARCHS = armv7 armv7s
TARGET_IPHONEOS_DEPLOYMENT_VERSION=$(DEPLOYMENT_IOSVERSION)
THEOS_BUILD_DIR := objs
include $(THEOS)/makefiles/common.mk
LIBRARY_NAME = $(TARGET_NAME)_libretro_ios
# QNX
else ifeq ($(platform), qnx)
TARGET := $(TARGET_NAME)_libretro_$(platform).so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=link.T
CC = qcc -Vgcc_notarmv7le
CXX = QCC -Vgcc_notarmv7le
AR = QCC -Vgcc_ntoarmv7le
CXXFLAGS += -D__BLACKBERRY_QNX__
CXXFLAGS += -DARM
HAVE_EXCEPTIONS = 1
# Vita
else ifeq ($(platform), vita)
CFLAGS += $(LTO)
CXXFLAGS += $(LTO)
LDFLAGS += $(LTO)
TARGET := $(TARGET_NAME)_libretro_$(platform).so
fpic := -fPIC
CC = arm-vita-eabi-gcc$(EXE_EXT)
CXX = arm-vita-eabi-g++$(EXE_EXT)
AR = arm-vita-eabi-ar$(EXE_EXT)
CXXFLAGS += -DVITA
HAVE_EXCEPTIONS = 1
# PS3
else ifneq (,$(filter $(platform), ps3 sncps3 psl1ght))
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CXXFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
STATIC_LINKING = 1
HAVE_STRINGS_H = 0
# sncps3
ifneq (,$(findstring sncps3,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ps3.a
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
CXX = $(CC)
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
# PS3
else ifneq (,$(findstring ps3,$(platform)))
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
CXX = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-g++.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
# Lightweight PS3 Homebrew SDK
else ifneq (,$(findstring psl1ght,$(platform)))
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
CXX = $(PS3DEV)/ppu/bin/ppu-g++$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
endif
# Xbox 360
else ifeq ($(platform), xenon)
CFLAGS += $(LTO)
CXXFLAGS += $(LTO)
LDFLAGS += $(LTO)
TARGET := $(TARGET_NAME)_libretro_xenon360.a
CC = xenon-gcc$(EXE_EXT)
CXX = xenon-g++$(EXE_EXT)
AR = xenon-ar$(EXE_EXT)
CXXFLAGS += -D__LIBXENON__ -m32 -D__ppc__
LIBS := $(PTHREAD_FLAGS)
STATIC_LINKING = 1
# Nintendo Game Cube / Wii / WiiU
else ifneq (,$(filter $(platform), ngc wii wiiu))
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
CXXFLAGS += -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
CXXFLAGS += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
STATIC_LINKING = 1
# Nintendo WiiU
ifneq (,$(findstring wiiu,$(platform)))
CXXFLAGS += -mwup
# Nintendo Wii
else ifneq (,$(findstring wii,$(platform)))
CXXFLAGS += -DGEKKO -mrvl
# Nintendo Game Cube
else ifneq (,$(findstring ngc,$(platform)))
CXXFLAGS += -DGEKKO -mrvl
endif
# Emscripten
else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_$(platform).bc
STATIC_LINKING = 1
CXXFLAGS += $(PTHREAD_FLAGS) -std=c++14
CFLAGS += $(PTHREAD_FLAGS)
LDFLAGS += $(PTHREAD_FLAGS) -std=c++14
# Genode
else ifeq ($(platform), genode)
TARGET := $(TARGET_NAME)_libretro.lib.so
PKG_CONFIG := genode-lib genode-stdcxx
CXXFLAGS += -D__GENODE__
CXXFLAGS += $(shell pkg-config --cflags $(PKG_CONFIG))
LDFLAGS += -shared --version-script=link.T
LDFLAGS += $(shell pkg-config --libs $(PKG_CONFIG))
CC = $(shell pkg-config genode-base --variable=cc)
CXX = $(shell pkg-config genode-base --variable=cxx)
LD = $(shell pkg-config genode-base --variable=ld)
AR = $(shell pkg-config genode-base --variable=ar) -rcs
LIBS =
# Windows MSVC 2003 Xbox 1
else ifeq ($(platform), xbox1_msvc2003)
CFLAGS += -D__WIN32__
CXXFLAGS += -D__WIN32__
TARGET := $(TARGET_NAME)_libretro_xdk1.lib
MSVCBINDIRPREFIX = $(XDK)/xbox/bin/vc71
CC = "$(MSVCBINDIRPREFIX)/CL.exe"
CXX = "$(MSVCBINDIRPREFIX)/CL.exe"
LD = "$(MSVCBINDIRPREFIX)/lib.exe"
export INCLUDE := $(XDK)/xbox/include
export LIB := $(XDK)/xbox/lib
PSS_STYLE :=2
CFLAGS += -D_XBOX -D_XBOX1
CXXFLAGS += -D_XBOX -D_XBOX1
STATIC_LINKING=1
HAS_GCC := 0
# Windows MSVC 2010 Xbox 360
else ifeq ($(platform), xbox360_msvc2010)
CFLAGS += -D__WIN32__
CXXFLAGS += -D__WIN32__
TARGET := $(TARGET_NAME)_libretro_xdk360.lib
MSVCBINDIRPREFIX = $(XEDK)/bin/win32
CC = "$(MSVCBINDIRPREFIX)/cl.exe"
CXX = "$(MSVCBINDIRPREFIX)/cl.exe"
LD = "$(MSVCBINDIRPREFIX)/lib.exe"
export INCLUDE := $(XEDK)/include/xbox
export LIB := $(XEDK)/lib/xbox
PSS_STYLE :=2
CFLAGS += -D_XBOX -D_XBOX360
CXXFLAGS += -D_XBOX -D_XBOX360
STATIC_LINKING=1
HAS_GCC := 0
# Windows MSVC 2017 all architectures
else ifneq (,$(findstring windows_msvc2017,$(platform)))
CFLAGS += -D__WIN32__
CXXFLAGS += -D__WIN32__
PlatformSuffix = $(subst windows_msvc2017_,,$(platform))
ifneq (,$(findstring desktop,$(PlatformSuffix)))
WinPartition = desktop
MSVC2017CompileFlags = -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP
LDFLAGS += -MANIFEST -LTCG:incremental -NXCOMPAT -DYNAMICBASE -DEBUG -OPT:REF -INCREMENTAL:NO -SUBSYSTEM:WINDOWS -MANIFESTUAC:"level='asInvoker' uiAccess='false'" -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1
LIBS += kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
else ifneq (,$(findstring uwp,$(PlatformSuffix)))
WinPartition = uwp
MSVC2017CompileFlags = -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WINDLL -D_UNICODE -DUNICODE -D__WRL_NO_DEFAULT_LIB__ -ZW:nostdlib -EHsc
LDFLAGS += -APPCONTAINER -NXCOMPAT -DYNAMICBASE -MANIFEST:NO -LTCG -OPT:REF -SUBSYSTEM:CONSOLE -MANIFESTUAC:NO -OPT:ICF -ERRORREPORT:PROMPT -NOLOGO -TLBID:1 -DEBUG:FULL -WINMD:NO
LIBS += WindowsApp.lib
endif
# Specific to this core
MSVC2017CompileFlags += -D__WIN32__ /std:c++17
CFLAGS += $(MSVC2017CompileFlags)
CXXFLAGS += $(MSVC2017CompileFlags)
TargetArchMoniker = $(subst $(WinPartition)_,,$(PlatformSuffix))
CC = cl.exe
CXX = cl.exe
reg_query = $(call filter_out2,$(subst $2,,$(shell reg query "$2" -v "$1" 2>nul)))
fix_path = $(subst $(SPACE),\ ,$(subst \,/,$1))
ProgramFiles86w := $(shell cmd /c "echo %PROGRAMFILES(x86)%")
ProgramFiles86 := $(shell cygpath "$(ProgramFiles86w)")
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir ?= $(call reg_query,InstallationFolder,HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0)
WindowsSdkDir := $(WindowsSdkDir)
WindowsSDKVersion ?= $(firstword $(foreach folder,$(subst $(subst \,/,$(WindowsSdkDir)Include/),,$(wildcard $(call fix_path,$(WindowsSdkDir)Include\*))),$(if $(wildcard $(call fix_path,$(WindowsSdkDir)Include/$(folder)/um/Windows.h)),$(folder),)))$(BACKSLASH)
WindowsSDKVersion := $(WindowsSDKVersion)
VsInstallBuildTools = $(ProgramFiles86)/Microsoft Visual Studio/2017/BuildTools
VsInstallEnterprise = $(ProgramFiles86)/Microsoft Visual Studio/2017/Enterprise
VsInstallProfessional = $(ProgramFiles86)/Microsoft Visual Studio/2017/Professional
VsInstallCommunity = $(ProgramFiles86)/Microsoft Visual Studio/2017/Community
VsInstallRoot ?= $(shell if [ -d "$(VsInstallBuildTools)" ]; then echo "$(VsInstallBuildTools)"; fi)
ifeq ($(VsInstallRoot), )
VsInstallRoot = $(shell if [ -d "$(VsInstallEnterprise)" ]; then echo "$(VsInstallEnterprise)"; fi)
endif
ifeq ($(VsInstallRoot), )
VsInstallRoot = $(shell if [ -d "$(VsInstallProfessional)" ]; then echo "$(VsInstallProfessional)"; fi)
endif
ifeq ($(VsInstallRoot), )
VsInstallRoot = $(shell if [ -d "$(VsInstallCommunity)" ]; then echo "$(VsInstallCommunity)"; fi)
endif
VsInstallRoot := $(VsInstallRoot)
VcCompilerToolsVer := $(shell cat "$(VsInstallRoot)/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt" | grep -o '[0-9\.]*')
VcCompilerToolsDir := $(VsInstallRoot)/VC/Tools/MSVC/$(VcCompilerToolsVer)
WindowsSDKSharedIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\shared")
WindowsSDKUCRTIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\ucrt")
WindowsSDKUMIncludeDir := $(shell cygpath -w "$(WindowsSdkDir)\Include\$(WindowsSDKVersion)\um")
WindowsSDKUCRTLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\ucrt\$(TargetArchMoniker)")
WindowsSDKUMLibDir := $(shell cygpath -w "$(WindowsSdkDir)\Lib\$(WindowsSDKVersion)\um\$(TargetArchMoniker)")
# For some reason the HostX86 compiler doesn't like compiling for x64
# ("no such file" opening a shared library), and vice-versa.
# Work around it for now by using the strictly x86 compiler for x86, and x64 for x64.
# NOTE: What about ARM?
ifneq (,$(findstring x64,$(TargetArchMoniker)))
VCCompilerToolsBinDir := $(VcCompilerToolsDir)\bin\HostX64
else
VCCompilerToolsBinDir := $(VcCompilerToolsDir)\bin\HostX86
endif
PATH := $(shell IFS=$$'\n'; cygpath "$(VCCompilerToolsBinDir)/$(TargetArchMoniker)"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VsInstallRoot)/Common7/IDE")
INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerToolsDir)/include")
LIB := $(shell IFS=$$'\n'; cygpath -w "$(VcCompilerToolsDir)/lib/$(TargetArchMoniker)")
ifneq (,$(findstring uwp,$(PlatformSuffix)))
LIB := $(shell IFS=$$'\n'; cygpath -w "$(LIB)/store")
endif
export INCLUDE := $(INCLUDE);$(WindowsSDKSharedIncludeDir);$(WindowsSDKUCRTIncludeDir);$(WindowsSDKUMIncludeDir)
export LIB := $(LIB);$(WindowsSDKUCRTLibDir);$(WindowsSDKUMLibDir)
TARGET := $(TARGET_NAME)_libretro.dll
PSS_STYLE :=2
LDFLAGS += -DLL
# Windows MSVC 2010 x64
else ifeq ($(platform), windows_msvc2010_x64)
CFLAGS += -D__WIN32__
CXXFLAGS += -D__WIN32__
CC = cl.exe
CXX = cl.exe
PATH := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/bin/amd64"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../IDE")
LIB := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/lib/amd64")
INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/include")
WindowsSdkDir := $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')lib/x64
WindowsSdkDir ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')lib/x64
WindowsSdkDirInc := $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')Include
WindowsSdkDirInc ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')Include
INCFLAGS_PLATFORM = -I"$(WindowsSdkDirInc)"
export INCLUDE := $(INCLUDE)
export LIB := $(LIB);$(WindowsSdkDir)
TARGET := $(TARGET_NAME)_libretro.dll
PSS_STYLE :=2
LDFLAGS += -DLL
LIBS :=
# Windows MSVC 2010 x86
else ifeq ($(platform), windows_msvc2010_x86)
CFLAGS += -D__WIN32__
CXXFLAGS += -D__WIN32__
CC = cl.exe
CXX = cl.exe
PATH := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/bin"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../IDE")
LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS100COMNTOOLS)../../VC/lib")
INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/include")
WindowsSdkDir := $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')lib
WindowsSdkDir ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')lib
WindowsSdkDirInc := $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')Include
WindowsSdkDirInc ?= $(shell reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A" -v "InstallationFolder" | grep -o '[A-Z]:\\.*')Include
INCFLAGS_PLATFORM = -I"$(WindowsSdkDirInc)"
export INCLUDE := $(INCLUDE)
export LIB := $(LIB);$(WindowsSdkDir)
TARGET := $(TARGET_NAME)_libretro.dll
PSS_STYLE :=2
LDFLAGS += -DLL
LIBS :=
# Windows MSVC 2003 x86
else ifeq ($(platform), windows_msvc2003_x86)
CFLAGS += -D__WIN32__
CXXFLAGS += -D__WIN32__
CC = cl.exe
CXX = cl.exe
PATH := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/bin"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../IDE")
INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/include")
LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS71COMNTOOLS)../../Vc7/lib")
BIN := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/bin")
WindowsSdkDir := $(INETSDK)
export INCLUDE := $(INCLUDE);$(INETSDK)/Include;src/drivers/libretro/msvc/msvc-2005
export LIB := $(LIB);$(WindowsSdkDir);$(INETSDK)/Lib
TARGET := $(TARGET_NAME)_libretro.dll
PSS_STYLE :=2
LDFLAGS += -DLL
CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
# Windows MSVC 2005 x86
else ifeq ($(platform), windows_msvc2005_x86)
CFLAGS += -D__WIN32__
CXXFLAGS += -D__WIN32__
CC = cl.exe
CXX = cl.exe
PATH := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/bin"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../IDE")
INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/include")
LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS80COMNTOOLS)../../VC/lib")
BIN := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/bin")
WindowsSdkDir := $(INETSDK)
export INCLUDE := $(INCLUDE);$(INETSDK)/Include;libretro-common/include/compat/msvc
export LIB := $(LIB);$(WindowsSdkDir);$(INETSDK)/Lib
TARGET := $(TARGET_NAME)_libretro.dll
PSS_STYLE :=2
LDFLAGS += -DLL
CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
CXXFLAGS += -D_CRT_SECURE_NO_DEPRECATE
# Windows
else
CFLAGS += $(LTO)
CXXFLAGS += $(LTO)
LDFLAGS += $(LTO)
TARGET := $(TARGET_NAME)_libretro.dll
CC = gcc
CXX = g++
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T
CXXFLAGS += -D__WIN32__
endif
CORE_DIR := ..
ifeq ($(DEBUG), 1)
ifneq (,$(findstring msvc,$(platform)))
CFLAGS += -Od -Zi -DDEBUG -D_DEBUG
CXXFLAGS += -Od -Zi -DDEBUG -D_DEBUG
ifeq ($(STATIC_LINKING),1)
CFLAGS += -MTd
CXXFLAGS += -MTd
else
CFLAGS += -MDd
CXXFLAGS += -MDd
endif
else
CFLAGS += -O0 -g -DDEBUG
CXXFLAGS += -O0 -g -DDEBUG
endif
else
ifneq (,$(findstring msvc,$(platform)))
CFLAGS += -O2 -DNDEBUG
CXXFLAGS += -O2 -DNDEBUG
else
CFLAGS += -O3 -DNDEBUG
CXXFLAGS += -O3 -DNDEBUG
endif
ifneq (,$(findstring msvc,$(platform)))
ifeq ($(STATIC_LINKING),1)
CFLAGS += -MT
CXXFLAGS += -MT
else
CFLAGS += -MD
CXXFLAGS += -MD
endif
endif
endif
include Makefile.common
OBJECTS := $(SOURCES_CXX:.cxx=.o) $(SOURCES_C:.c=.o)
ifeq ($(platform), sncps3)
WARNINGS_DEFINES =
CODE_DEFINES =
else ifneq (,$(findstring msvc,$(platform)))
WARNINGS_DEFINES =
CODE_DEFINES =
else
WARNINGS_DEFINES = -Wall -W -Wno-unused-parameter
CODE_DEFINES = -fomit-frame-pointer
endif
CXXFLAGS += $(CODE_DEFINES) $(WARNINGS_DEFINES) $(fpic)
CXXFLAGS += -D__LIB_RETRO__ -DSOUND_SUPPORT
CFLAGS = $(CXXFLAGS)
CFLAGS += -DHAVE_STDINT_H
CXXFLAGS += -DHAVE_STDINT_H
ifeq ($(platform), emscripten)
CFLAGS := $(filter-out -std=c++14,$(CFLAGS))
endif
ifeq (,$(findstring msvc,$(platform)))
ifeq ($(HAVE_STRINGS_H), 1)
CXXFLAGS += -DHAVE_STRINGS_H
endif
CXXFLAGS += -fno-rtti -pedantic
ifneq ($(HAVE_EXCEPTIONS), 1)
CXXFLAGS += -fno-exceptions
endif
endif
OBJOUT = -o
LINKOUT = -o
ifneq (,$(findstring msvc,$(platform)))
OBJOUT = -Fo
LINKOUT = -out:
ifeq ($(STATIC_LINKING),1)
LD ?= lib.exe
STATIC_LINKING=0
else
LD = link.exe
endif
else ifneq ($(platform),genode)
LD = $(CXX)
endif
INCFLAGS += $(INCFLAGS_PLATFORM)
ifeq ($(platform), theos_ios)
COMMON_FLAGS := -DIOS -DARM $(COMMON_DEFINES) $(INCFLAGS) -I$(THEOS_INCLUDE_PATH) -Wno-error
$(LIBRARY_NAME)_CFLAGS += $(CFLAGS) $(COMMON_FLAGS)
$(LIBRARY_NAME)_CXXFLAGS += $(CXXFLAGS) $(COMMON_FLAGS)
${LIBRARY_NAME}_FILES = $(SOURCES_CXX) $(SOURCES_C)
include $(THEOS_MAKE_PATH)/library.mk
else
all: $(TARGET)
$(TARGET): $(OBJECTS)
ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS)
else
+$(LD) $(fpic) $(SHARED) $(LINKOUT)$@ $(OBJECTS) $(LDFLAGS) $(LIBS)
endif
%.o: %.cxx
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $(OBJOUT)$@ $<
%.o: %.c
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $(OBJOUT)$@ $<
clean:
rm -f $(OBJECTS) $(TARGET)
endif

View File

@ -0,0 +1,180 @@
LIBRETRO_COMM_DIR = $(CORE_DIR)/../libretro-common
INCFLAGS := -I. -I$(CORE_DIR) -I$(CORE_DIR)/libretro -I$(CORE_DIR)/libretro/SDL -I$(CORE_DIR)/libretro/libpng -I$(CORE_DIR)/libretro/zlib -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
ifneq (,$(findstring msvc2003,$(platform)))
INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc
endif
SOURCES_CXX := \
$(CORE_DIR)/libretro/libretro.cxx \
$(CORE_DIR)/libretro/EventHandlerLIBRETRO.cxx \
$(CORE_DIR)/libretro/FSNodeLIBRETRO.cxx \
$(CORE_DIR)/libretro/FBSurfaceLIBRETRO.cxx \
$(CORE_DIR)/libretro/FrameBufferLIBRETRO.cxx \
$(CORE_DIR)/libretro/OSystemLIBRETRO.cxx \
$(CORE_DIR)/libretro/SettingsLIBRETRO.cxx \
$(CORE_DIR)/libretro/SoundLIBRETRO.cxx \
$(CORE_DIR)/libretro/StellaLIBRETRO.cxx \
$(CORE_DIR)/common/AudioQueue.cxx \
$(CORE_DIR)/common/AudioSettings.cxx \
$(CORE_DIR)/common/Base.cxx \
$(CORE_DIR)/common/FpsMeter.cxx \
$(CORE_DIR)/common/FSNodeZIP.cxx \
$(CORE_DIR)/common/MouseControl.cxx \
$(CORE_DIR)/common/PhysicalJoystick.cxx \
$(CORE_DIR)/common/PJoystickHandler.cxx \
$(CORE_DIR)/common/PKeyboardHandler.cxx \
$(CORE_DIR)/common/RewindManager.cxx \
$(CORE_DIR)/common/StaggeredLogger.cxx \
$(CORE_DIR)/common/StateManager.cxx \
$(CORE_DIR)/common/TimerManager.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 \
$(CORE_DIR)/emucore/CartBF.cxx \
$(CORE_DIR)/emucore/CartBFSC.cxx \
$(CORE_DIR)/emucore/CartBUS.cxx \
$(CORE_DIR)/emucore/CartCDF.cxx \
$(CORE_DIR)/emucore/CartCM.cxx \
$(CORE_DIR)/emucore/CartCTY.cxx \
$(CORE_DIR)/emucore/CartCVPlus.cxx \
$(CORE_DIR)/emucore/CartDASH.cxx \
$(CORE_DIR)/emucore/CartDetector.cxx \
$(CORE_DIR)/emucore/CartDF.cxx \
$(CORE_DIR)/emucore/CartDFSC.cxx \
$(CORE_DIR)/emucore/CartFA2.cxx \
$(CORE_DIR)/emucore/CartMDM.cxx \
$(CORE_DIR)/emucore/CartMNetwork.cxx \
$(CORE_DIR)/emucore/CartE78K.cxx \
$(CORE_DIR)/emucore/CartWD.cxx \
$(CORE_DIR)/emucore/CompuMate.cxx \
$(CORE_DIR)/emucore/ControllerDetector.cxx \
$(CORE_DIR)/emucore/DispatchResult.cxx \
$(CORE_DIR)/emucore/EmulationTiming.cxx \
$(CORE_DIR)/emucore/EmulationWorker.cxx \
$(CORE_DIR)/emucore/FBSurface.cxx \
$(CORE_DIR)/emucore/MindLink.cxx \
$(CORE_DIR)/emucore/PointingDevice.cxx \
$(CORE_DIR)/emucore/TIASurface.cxx \
$(CORE_DIR)/emucore/tia/Audio.cxx \
$(CORE_DIR)/emucore/tia/AudioChannel.cxx \
$(CORE_DIR)/emucore/tia/Background.cxx \
$(CORE_DIR)/emucore/tia/Ball.cxx \
$(CORE_DIR)/emucore/tia/DrawCounterDecodes.cxx \
$(CORE_DIR)/emucore/tia/frame-manager/AbstractFrameManager.cxx \
$(CORE_DIR)/emucore/tia/frame-manager/FrameLayoutDetector.cxx \
$(CORE_DIR)/emucore/tia/frame-manager/FrameManager.cxx \
$(CORE_DIR)/emucore/tia/frame-manager/JitterEmulation.cxx \
$(CORE_DIR)/emucore/tia/frame-manager/YStartDetector.cxx \
$(CORE_DIR)/emucore/tia/LatchedInput.cxx \
$(CORE_DIR)/emucore/tia/Missile.cxx \
$(CORE_DIR)/emucore/tia/PaddleReader.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/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 \
$(CORE_DIR)/emucore/Cart0840.cxx \
$(CORE_DIR)/emucore/Cart2K.cxx \
$(CORE_DIR)/emucore/Cart3E.cxx \
$(CORE_DIR)/emucore/Cart3F.cxx \
$(CORE_DIR)/emucore/Cart4A50.cxx \
$(CORE_DIR)/emucore/Cart4K.cxx \
$(CORE_DIR)/emucore/CartAR.cxx \
$(CORE_DIR)/emucore/CartCV.cxx \
$(CORE_DIR)/emucore/CartDPC.cxx \
$(CORE_DIR)/emucore/CartDPCPlus.cxx \
$(CORE_DIR)/emucore/CartE0.cxx \
$(CORE_DIR)/emucore/CartE7.cxx \
$(CORE_DIR)/emucore/CartEF.cxx \
$(CORE_DIR)/emucore/CartEFSC.cxx \
$(CORE_DIR)/emucore/CartF0.cxx \
$(CORE_DIR)/emucore/CartF4.cxx \
$(CORE_DIR)/emucore/CartF4SC.cxx \
$(CORE_DIR)/emucore/CartF6.cxx \
$(CORE_DIR)/emucore/CartF6SC.cxx \
$(CORE_DIR)/emucore/CartF8.cxx \
$(CORE_DIR)/emucore/CartF8SC.cxx \
$(CORE_DIR)/emucore/CartFA.cxx \
$(CORE_DIR)/emucore/CartFE.cxx \
$(CORE_DIR)/emucore/CartSB.cxx \
$(CORE_DIR)/emucore/CartUA.cxx \
$(CORE_DIR)/emucore/CartX07.cxx \
$(CORE_DIR)/emucore/Console.cxx \
$(CORE_DIR)/emucore/Control.cxx \
$(CORE_DIR)/emucore/Driving.cxx \
$(CORE_DIR)/emucore/EventHandler.cxx \
$(CORE_DIR)/emucore/FrameBuffer.cxx \
$(CORE_DIR)/emucore/FSNode.cxx \
$(CORE_DIR)/emucore/Genesis.cxx \
$(CORE_DIR)/emucore/Joystick.cxx \
$(CORE_DIR)/emucore/Keyboard.cxx \
$(CORE_DIR)/emucore/KidVid.cxx \
$(CORE_DIR)/emucore/M6502.cxx \
$(CORE_DIR)/emucore/M6532.cxx \
$(CORE_DIR)/emucore/MD5.cxx \
$(CORE_DIR)/emucore/MT24LC256.cxx \
$(CORE_DIR)/emucore/OSystem.cxx \
$(CORE_DIR)/emucore/Paddles.cxx \
$(CORE_DIR)/emucore/Props.cxx \
$(CORE_DIR)/emucore/PropsSet.cxx \
$(CORE_DIR)/emucore/SaveKey.cxx \
$(CORE_DIR)/emucore/Serializer.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
SOURCES_C :=

View File

@ -0,0 +1,42 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "FSNode.hxx"
#include "OSystemLIBRETRO.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemLIBRETRO::getBaseDirAndConfig(string& basedir, string& cfgfile,
string& savedir, string& loaddir,
bool useappdir, const string& usedir)
{
basedir = ".";
cfgfile = ".";
#if 0
// Check to see if basedir overrides are active
if(useappdir)
cout << "ERROR: base dir in app folder not supported" << endl;
else if(usedir != "")
{
basedir = FilesystemNode(usedir).getPath();
savedir = loaddir = basedir;
}
#endif
FilesystemNode desktop(".");
savedir = ".";
}

View File

@ -0,0 +1,58 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef OSYSTEM_LIBRETRO_HXX
#define OSYSTEM_LIBRETRO_HXX
#include "OSystem.hxx"
/**
This class defines an OSystem object for libretro.
It is responsible for completely implementing getBaseDirAndConfig(),
to set the base directory, config file location, and various other
save/load locations.
@author Stephen Anthony
*/
class OSystemLIBRETRO : public OSystem
{
public:
OSystemLIBRETRO() = default;
virtual ~OSystemLIBRETRO() = default;
/**
Determine the base directory and main configuration file from the
derived class. It can also use hints, as described below.
@param basedir The base directory for all configuration files
@param cfgfile The fully qualified pathname of the config file
(including the base directory)
@param savedir The default directory to save various other files
@param loaddir The default directory to load various other files
@param useappdir A hint that the base dir should be set to the
app directory; not all ports can do this, so
they are free to ignore it
@param usedir A hint that the base dir should be set to this
parameter; not all ports can do this, so
they are free to ignore it
*/
void getBaseDirAndConfig(string& basedir, string& cfgfile,
string& savedir, string& loaddir,
bool useappdir, const string& usedir) override;
};
#endif

49
src/libretro/SDL/SDL.h Normal file
View File

@ -0,0 +1,49 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef SDL_H
#define SDL_H
#include "bspf.hxx"
typedef struct SDL_version
{
uInt8 major; /**< major version */
uInt8 minor; /**< minor version */
uInt8 patch; /**< update version */
} SDL_version;
typedef enum
{
SDL_SCANCODE_UNKNOWN = 0
} SDL_Scancode;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static inline void SDL_GetVersion(SDL_version* ver)
{
ver->major = 2;
ver->minor = 0;
ver->patch = 9;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static inline void SDL_Quit(void) {}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static inline const char* SDL_GetScancodeName(SDL_Scancode scancode) { return ""; }
#endif

View File

@ -0,0 +1,24 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "SettingsLIBRETRO.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingsLIBRETRO::SettingsLIBRETRO()
: Settings()
{
}

View File

@ -0,0 +1,42 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef SETTINGS_LIBRETRO_HXX
#define SETTINGS_LIBRETRO_HXX
class OSystem;
#include "Settings.hxx"
class SettingsLIBRETRO : public Settings
{
public:
/**
Create a new LIBRETRO settings object
*/
explicit SettingsLIBRETRO();
virtual ~SettingsLIBRETRO() = default;
private:
// Following constructors and assignment operators not supported
SettingsLIBRETRO(const SettingsLIBRETRO&) = delete;
SettingsLIBRETRO(SettingsLIBRETRO&&) = delete;
SettingsLIBRETRO& operator=(const SettingsLIBRETRO&) = delete;
SettingsLIBRETRO& operator=(SettingsLIBRETRO&&) = delete;
};
#endif

View File

@ -0,0 +1,126 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifdef SOUND_SUPPORT
#include <sstream>
#include <cassert>
#include <cmath>
#include "FrameBuffer.hxx"
#include "Settings.hxx"
#include "System.hxx"
#include "OSystem.hxx"
#include "Console.hxx"
#include "SoundLIBRETRO.hxx"
#include "AudioQueue.hxx"
#include "EmulationTiming.hxx"
#include "AudioSettings.hxx"
#include "StaggeredLogger.hxx"
#include "ThreadDebugging.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundLIBRETRO::SoundLIBRETRO(OSystem& osystem, AudioSettings& audioSettings)
: Sound(osystem),
myIsInitializedFlag(false),
myEmulationTiming(nullptr),
myCurrentFragment(nullptr),
myUnderrun(false),
myAudioSettings(audioSettings)
{
ASSERT_MAIN_THREAD;
myOSystem.logMessage("SoundLIBRETRO::SoundLIBRETRO started ...", 2);
myOSystem.logMessage("SoundLIBRETRO::SoundLIBRETRO initialized", 2);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundLIBRETRO::~SoundLIBRETRO()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundLIBRETRO::open(shared_ptr<AudioQueue> audioQueue,
EmulationTiming* emulationTiming)
{
myEmulationTiming = emulationTiming;
myOSystem.logMessage("SoundLIBRETRO::open started ...", 2);
audioQueue->ignoreOverflows(!myAudioSettings.enabled());
myAudioQueue = audioQueue;
myUnderrun = true;
myCurrentFragment = nullptr;
myOSystem.logMessage("SoundLIBRETRO::open finished", 2);
myIsInitializedFlag = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundLIBRETRO::close()
{
if(!myIsInitializedFlag) return;
if (myAudioQueue) myAudioQueue->closeSink(myCurrentFragment);
myAudioQueue.reset();
myCurrentFragment = nullptr;
myOSystem.logMessage("SoundLIBRETRO::close", 2);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundLIBRETRO::dequeue(Int16* stream, uInt32* samples)
{
uInt32 outIndex = 0;
while (myAudioQueue->size())
{
Int16* nextFragment = myAudioQueue->dequeue(myCurrentFragment);
if (!nextFragment)
{
*samples = outIndex / 2;
return;
}
myCurrentFragment = nextFragment;
for (uInt32 i = 0; i < myAudioQueue->fragmentSize(); ++i)
{
Int16 sampleL, sampleR;
if (myAudioQueue->isStereo())
{
sampleL = static_cast<Int16>(myCurrentFragment[2*i + 0]);
sampleR = static_cast<Int16>(myCurrentFragment[2*i + 1]);
}
else
sampleL = sampleR = static_cast<Int16>(myCurrentFragment[i]);
stream[outIndex++] = sampleL;
stream[outIndex++] = sampleR;
}
}
*samples = outIndex / 2;
}
#endif // SOUND_SUPPORT

View File

@ -0,0 +1,144 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifdef SOUND_SUPPORT
#ifndef SOUND_LIBRETRO_HXX
#define SOUND_LIBRETRO_HXX
class OSystem;
class AudioQueue;
class EmulationTiming;
class AudioSettings;
#include "SDL_lib.hxx"
#include "bspf.hxx"
#include "Sound.hxx"
#include "AudioQueue.hxx"
/**
This class implements the sound API for LIBRTRO.
@author Stephen Anthony and Christian Speckner (DirtyHairy)
*/
class SoundLIBRETRO : public Sound
{
public:
/**
Create a new sound object. The init method must be invoked before
using the object.
*/
SoundLIBRETRO(OSystem& osystem, AudioSettings& audioSettings);
/**
Destructor
*/
virtual ~SoundLIBRETRO();
public:
/**
Enables/disables the sound subsystem.
@param enable Either true or false, to enable or disable the sound system
*/
void setEnabled(bool enable) override { }
/**
Initializes the sound device. This must be called before any
calls are made to derived methods.
*/
void open(shared_ptr<AudioQueue> audioQueue, EmulationTiming* emulationTiming) override;
/**
Should be called to close the sound device. Once called the sound
device can be started again using the open method.
*/
void close() override;
/**
Set the mute state of the sound object. While muted no sound is played.
@param state Mutes sound if true, unmute if false
@return The previous (old) mute state
*/
bool mute(bool state) override { return !myIsInitializedFlag; }
/**
Toggles the sound mute state. While muted no sound is played.
@return The previous (old) mute state
*/
bool toggleMute() override { return !myIsInitializedFlag; }
/**
Sets the volume of the sound device to the specified level. The
volume is given as a percentage from 0 to 100. Values outside
this range indicate that the volume shouldn't be changed at all.
@param percent The new volume percentage level for the sound device
*/
void setVolume(uInt32 percent) override { }
/**
Adjusts the volume of the sound device based on the given direction.
@param direction Increase or decrease the current volume by a predefined
amount based on the direction (1 = increase, -1 = decrease)
*/
void adjustVolume(Int8 direction) override { }
/**
This method is called to provide information about the sound device.
*/
string about() const override { return ""; }
public:
/**
Empties the playback buffer.
@param stream Output audio buffer
@param samples Number of audio samples read
*/
void dequeue(Int16* stream, uInt32* samples);
private:
// Indicates if the sound device was successfully initialized
bool myIsInitializedFlag;
shared_ptr<AudioQueue> myAudioQueue;
EmulationTiming* myEmulationTiming;
Int16* myCurrentFragment;
bool myUnderrun;
AudioSettings& myAudioSettings;
private:
// Following constructors and assignment operators not supported
SoundLIBRETRO() = delete;
SoundLIBRETRO(const SoundLIBRETRO&) = delete;
SoundLIBRETRO(SoundLIBRETRO&&) = delete;
SoundLIBRETRO& operator=(const SoundLIBRETRO&) = delete;
SoundLIBRETRO& operator=(SoundLIBRETRO&&) = delete;
};
#endif
#endif // SOUND_SUPPORT

519
src/libretro/Stella.vcxproj Normal file
View File

@ -0,0 +1,519 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}</ProjectGuid>
<RootNamespace>stella_libretro</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup>
<XPDeprecationWarning>false</XPDeprecationWarning>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LibraryPath>$(LibraryPath)</LibraryPath>
<IncludePath>$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LibraryPath>$(LibraryPath)</LibraryPath>
<IncludePath>$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>.\;SDL;zlib;libpng;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>__LIB_RETRO__;__WIN32__;NDEBUG;SOUND_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ObjectFileName>$(IntDir)%(RelativeDir)</ObjectFileName>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4100;4127;4146;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<CompileAs>CompileAsCpp</CompileAs>
<AssemblerOutput>NoListing</AssemblerOutput>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)stella_libretro.dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>.\;SDL;zlib;libpng;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>__LIB_RETRO__;__WIN32__;NDEBUG;SOUND_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<ObjectFileName>$(IntDir)%(RelativeDir)</ObjectFileName>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4100;4127;4146;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<CompileAs>CompileAsCpp</CompileAs>
<AssemblerOutput>NoListing</AssemblerOutput>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)stella_libretro.dll</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="libretro.cxx" />
<ClCompile Include="EventHandlerLIBRETRO.cxx" />
<ClCompile Include="FBSurfaceLIBRETRO.cxx" />
<ClCompile Include="FSNodeLIBRETRO.cxx" />
<ClCompile Include="FrameBufferLIBRETRO.cxx" />
<ClCompile Include="OSystemLIBRETRO.cxx" />
<ClCompile Include="SettingsLIBRETRO.cxx" />
<ClCompile Include="SoundLIBRETRO.cxx" />
<ClCompile Include="StellaLIBRETRO.cxx" />
<ClCompile Include="..\common\AudioQueue.cxx" />
<ClCompile Include="..\common\AudioSettings.cxx" />
<ClCompile Include="..\common\Base.cxx" />
<ClCompile Include="..\common\FpsMeter.cxx" />
<ClCompile Include="..\common\FSNodeZIP.cxx" />
<ClCompile Include="..\common\MouseControl.cxx" />
<ClCompile Include="..\common\PhysicalJoystick.cxx" />
<ClCompile Include="..\common\PJoystickHandler.cxx" />
<ClCompile Include="..\common\PKeyboardHandler.cxx" />
<ClCompile Include="..\common\RewindManager.cxx" />
<ClCompile Include="..\common\StaggeredLogger.cxx" />
<ClCompile Include="..\common\StateManager.cxx" />
<ClCompile Include="..\common\ThreadDebugging.cxx" />
<ClCompile Include="..\common\TimerManager.cxx" />
<ClCompile Include="..\common\tv_filters\AtariNTSC.cxx" />
<ClCompile Include="..\common\tv_filters\NTSCFilter.cxx" />
<ClCompile Include="..\common\ZipHandler.cxx" />
<ClCompile Include="..\emucore\Bankswitch.cxx" />
<ClCompile Include="..\emucore\Cart3EPlus.cxx" />
<ClCompile Include="..\emucore\Cart4KSC.cxx" />
<ClCompile Include="..\emucore\CartBF.cxx" />
<ClCompile Include="..\emucore\CartBFSC.cxx" />
<ClCompile Include="..\emucore\CartBUS.cxx" />
<ClCompile Include="..\emucore\CartCDF.cxx" />
<ClCompile Include="..\emucore\CartCM.cxx" />
<ClCompile Include="..\emucore\CartCTY.cxx" />
<ClCompile Include="..\emucore\CartCVPlus.cxx" />
<ClCompile Include="..\emucore\CartDASH.cxx" />
<ClCompile Include="..\emucore\CartDetector.cxx" />
<ClCompile Include="..\emucore\CartDF.cxx" />
<ClCompile Include="..\emucore\CartDFSC.cxx" />
<ClCompile Include="..\emucore\CartFA2.cxx" />
<ClCompile Include="..\emucore\CartMDM.cxx" />
<ClCompile Include="..\emucore\CartMNetwork.cxx" />
<ClCompile Include="..\emucore\CartE78K.cxx" />
<ClCompile Include="..\emucore\CartWD.cxx" />
<ClCompile Include="..\emucore\CompuMate.cxx" />
<ClCompile Include="..\emucore\ControllerDetector.cxx" />
<ClCompile Include="..\emucore\DispatchResult.cxx" />
<ClCompile Include="..\emucore\EmulationTiming.cxx" />
<ClCompile Include="..\emucore\EmulationWorker.cxx" />
<ClCompile Include="..\emucore\FBSurface.cxx" />
<ClCompile Include="..\emucore\MindLink.cxx" />
<ClCompile Include="..\emucore\PointingDevice.cxx" />
<ClCompile Include="..\emucore\ProfilingRunner.cxx" />
<ClCompile Include="..\emucore\TIASurface.cxx" />
<ClCompile Include="..\emucore\tia\Audio.cxx" />
<ClCompile Include="..\emucore\tia\AudioChannel.cxx" />
<ClCompile Include="..\emucore\tia\Background.cxx" />
<ClCompile Include="..\emucore\tia\Ball.cxx" />
<ClCompile Include="..\emucore\tia\DrawCounterDecodes.cxx" />
<ClCompile Include="..\emucore\tia\frame-manager\AbstractFrameManager.cxx" />
<ClCompile Include="..\emucore\tia\frame-manager\FrameLayoutDetector.cxx" />
<ClCompile Include="..\emucore\tia\frame-manager\FrameManager.cxx" />
<ClCompile Include="..\emucore\tia\frame-manager\JitterEmulation.cxx" />
<ClCompile Include="..\emucore\tia\frame-manager\YStartDetector.cxx" />
<ClCompile Include="..\emucore\tia\LatchedInput.cxx" />
<ClCompile Include="..\emucore\tia\Missile.cxx" />
<ClCompile Include="..\emucore\tia\PaddleReader.cxx" />
<ClCompile Include="..\emucore\tia\Player.cxx" />
<ClCompile Include="..\emucore\tia\Playfield.cxx" />
<ClCompile Include="..\emucore\tia\TIA.cxx" />
<ClCompile Include="..\gui\ColorWidget.cxx" />
<ClCompile Include="..\gui\DeveloperDialog.cxx" />
<ClCompile Include="..\gui\FileListWidget.cxx" />
<ClCompile Include="..\gui\JoystickDialog.cxx" />
<ClCompile Include="..\gui\LoggerDialog.cxx" />
<ClCompile Include="..\gui\RadioButtonWidget.cxx" />
<ClCompile Include="..\gui\SnapshotDialog.cxx" />
<ClCompile Include="..\gui\StellaSettingsDialog.cxx" />
<ClCompile Include="..\gui\TimeLineWidget.cxx" />
<ClCompile Include="..\gui\TimeMachine.cxx" />
<ClCompile Include="..\gui\TimeMachineDialog.cxx" />
<ClCompile Include="..\common\PNGLibrary.cxx" />
<ClCompile Include="..\emucore\AtariVox.cxx" />
<ClCompile Include="..\emucore\Booster.cxx" />
<ClCompile Include="..\emucore\Cart.cxx" />
<ClCompile Include="..\emucore\Cart0840.cxx" />
<ClCompile Include="..\emucore\Cart2K.cxx" />
<ClCompile Include="..\emucore\Cart3E.cxx" />
<ClCompile Include="..\emucore\Cart3F.cxx" />
<ClCompile Include="..\emucore\Cart4A50.cxx" />
<ClCompile Include="..\emucore\Cart4K.cxx" />
<ClCompile Include="..\emucore\CartAR.cxx" />
<ClCompile Include="..\emucore\CartCV.cxx" />
<ClCompile Include="..\emucore\CartDPC.cxx" />
<ClCompile Include="..\emucore\CartDPCPlus.cxx" />
<ClCompile Include="..\emucore\CartE0.cxx" />
<ClCompile Include="..\emucore\CartE7.cxx" />
<ClCompile Include="..\emucore\CartEF.cxx" />
<ClCompile Include="..\emucore\CartEFSC.cxx" />
<ClCompile Include="..\emucore\CartF0.cxx" />
<ClCompile Include="..\emucore\CartF4.cxx" />
<ClCompile Include="..\emucore\CartF4SC.cxx" />
<ClCompile Include="..\emucore\CartF6.cxx" />
<ClCompile Include="..\emucore\CartF6SC.cxx" />
<ClCompile Include="..\emucore\CartF8.cxx" />
<ClCompile Include="..\emucore\CartF8SC.cxx" />
<ClCompile Include="..\emucore\CartFA.cxx" />
<ClCompile Include="..\emucore\CartFE.cxx" />
<ClCompile Include="..\emucore\CartSB.cxx" />
<ClCompile Include="..\emucore\CartUA.cxx" />
<ClCompile Include="..\emucore\CartX07.cxx" />
<ClCompile Include="..\emucore\Console.cxx" />
<ClCompile Include="..\emucore\Control.cxx" />
<ClCompile Include="..\emucore\Driving.cxx" />
<ClCompile Include="..\emucore\EventHandler.cxx" />
<ClCompile Include="..\emucore\FrameBuffer.cxx" />
<ClCompile Include="..\emucore\FSNode.cxx" />
<ClCompile Include="..\emucore\Genesis.cxx" />
<ClCompile Include="..\emucore\Joystick.cxx" />
<ClCompile Include="..\emucore\Keyboard.cxx" />
<ClCompile Include="..\emucore\KidVid.cxx" />
<ClCompile Include="..\emucore\M6502.cxx" />
<ClCompile Include="..\emucore\M6532.cxx" />
<ClCompile Include="..\emucore\MD5.cxx" />
<ClCompile Include="..\emucore\MT24LC256.cxx" />
<ClCompile Include="..\emucore\OSystem.cxx" />
<ClCompile Include="..\emucore\Paddles.cxx" />
<ClCompile Include="..\emucore\Props.cxx" />
<ClCompile Include="..\emucore\PropsSet.cxx" />
<ClCompile Include="..\emucore\SaveKey.cxx" />
<ClCompile Include="..\emucore\Serializer.cxx" />
<ClCompile Include="..\emucore\Settings.cxx" />
<ClCompile Include="..\emucore\Switches.cxx" />
<ClCompile Include="..\emucore\System.cxx" />
<ClCompile Include="..\emucore\Thumbulator.cxx" />
<ClCompile Include="..\gui\AboutDialog.cxx" />
<ClCompile Include="..\gui\AudioDialog.cxx" />
<ClCompile Include="..\gui\BrowserDialog.cxx" />
<ClCompile Include="..\gui\CheckListWidget.cxx" />
<ClCompile Include="..\gui\ComboDialog.cxx" />
<ClCompile Include="..\gui\CommandDialog.cxx" />
<ClCompile Include="..\gui\CommandMenu.cxx" />
<ClCompile Include="..\gui\ContextMenu.cxx" />
<ClCompile Include="..\gui\Dialog.cxx" />
<ClCompile Include="..\gui\DialogContainer.cxx" />
<ClCompile Include="..\gui\EditableWidget.cxx" />
<ClCompile Include="..\gui\EditTextWidget.cxx" />
<ClCompile Include="..\gui\EventMappingWidget.cxx" />
<ClCompile Include="..\gui\Font.cxx" />
<ClCompile Include="..\gui\GameInfoDialog.cxx" />
<ClCompile Include="..\gui\GameList.cxx" />
<ClCompile Include="..\gui\GlobalPropsDialog.cxx" />
<ClCompile Include="..\gui\HelpDialog.cxx" />
<ClCompile Include="..\gui\InputDialog.cxx" />
<ClCompile Include="..\gui\InputTextDialog.cxx" />
<ClCompile Include="..\gui\Launcher.cxx" />
<ClCompile Include="..\gui\LauncherDialog.cxx" />
<ClCompile Include="..\gui\ListWidget.cxx" />
<ClCompile Include="..\gui\Menu.cxx" />
<ClCompile Include="..\gui\MessageBox.cxx" />
<ClCompile Include="..\gui\OptionsDialog.cxx" />
<ClCompile Include="..\gui\PopUpWidget.cxx" />
<ClCompile Include="..\gui\ProgressDialog.cxx" />
<ClCompile Include="..\gui\RomAuditDialog.cxx" />
<ClCompile Include="..\gui\RomInfoWidget.cxx" />
<ClCompile Include="..\gui\ScrollBarWidget.cxx" />
<ClCompile Include="..\gui\StringListWidget.cxx" />
<ClCompile Include="..\gui\TabWidget.cxx" />
<ClCompile Include="..\gui\UIDialog.cxx" />
<ClCompile Include="..\gui\VideoDialog.cxx" />
<ClCompile Include="..\gui\Widget.cxx" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\common\AudioQueue.hxx" />
<ClInclude Include="..\common\AudioSettings.hxx" />
<ClInclude Include="..\common\Base.hxx" />
<ClInclude Include="..\common\bspf.hxx" />
<ClInclude Include="..\common\FpsMeter.hxx" />
<ClInclude Include="..\common\FSNodeFactory.hxx" />
<ClInclude Include="..\common\FSNodeZIP.hxx" />
<ClInclude Include="..\common\LinkedObjectPool.hxx" />
<ClInclude Include="..\common\MediaFactory.hxx" />
<ClInclude Include="..\common\MouseControl.hxx" />
<ClInclude Include="..\common\PhysicalJoystick.hxx" />
<ClInclude Include="..\common\PJoystickHandler.hxx" />
<ClInclude Include="..\common\PKeyboardHandler.hxx" />
<ClInclude Include="..\common\RewindManager.hxx" />
<ClInclude Include="..\common\StaggeredLogger.hxx" />
<ClInclude Include="..\common\StateManager.hxx" />
<ClInclude Include="..\common\StellaKeys.hxx" />
<ClInclude Include="..\common\StringParser.hxx" />
<ClInclude Include="..\common\ThreadDebugging.hxx" />
<ClInclude Include="..\common\TimerManager.hxx" />
<ClInclude Include="..\common\tv_filters\AtariNTSC.hxx" />
<ClInclude Include="..\common\tv_filters\NTSCFilter.hxx" />
<ClInclude Include="..\common\Variant.hxx" />
<ClInclude Include="..\common\Vec.hxx" />
<ClInclude Include="..\common\ZipHandler.hxx" />
<ClInclude Include="..\emucore\AmigaMouse.hxx" />
<ClInclude Include="..\emucore\AtariMouse.hxx" />
<ClInclude Include="..\emucore\Bankswitch.hxx" />
<ClInclude Include="..\emucore\BSType.hxx" />
<ClInclude Include="..\emucore\Cart3EPlus.hxx" />
<ClInclude Include="..\emucore\Cart4KSC.hxx" />
<ClInclude Include="..\emucore\CartBF.hxx" />
<ClInclude Include="..\emucore\CartBFSC.hxx" />
<ClInclude Include="..\emucore\CartBUS.hxx" />
<ClInclude Include="..\emucore\CartCDF.hxx" />
<ClInclude Include="..\emucore\CartCM.hxx" />
<ClInclude Include="..\emucore\CartCTY.hxx" />
<ClInclude Include="..\emucore\CartCVPlus.hxx" />
<ClInclude Include="..\emucore\CartDASH.hxx" />
<ClInclude Include="..\emucore\CartDetector.hxx" />
<ClInclude Include="..\emucore\CartDF.hxx" />
<ClInclude Include="..\emucore\CartDFSC.hxx" />
<ClInclude Include="..\emucore\CartFA2.hxx" />
<ClInclude Include="..\emucore\CartMDM.hxx" />
<ClInclude Include="..\emucore\CartMNetwork.hxx" />
<ClInclude Include="..\emucore\CartE78K.hxx" />
<ClInclude Include="..\emucore\CartWD.hxx" />
<ClInclude Include="..\emucore\CompuMate.hxx" />
<ClInclude Include="..\emucore\ControllerDetector.hxx" />
<ClInclude Include="..\emucore\ControlLowLevel.hxx" />
<ClInclude Include="..\emucore\DispatchResult.hxx" />
<ClInclude Include="..\emucore\EmulationTiming.hxx" />
<ClInclude Include="..\emucore\EmulationWorker.hxx" />
<ClInclude Include="..\emucore\EventHandlerConstants.hxx" />
<ClInclude Include="..\emucore\exception\EmulationWarning.hxx" />
<ClInclude Include="..\emucore\exception\FatalEmulationError.hxx" />
<ClInclude Include="..\emucore\FBSurface.hxx" />
<ClInclude Include="..\emucore\FrameBufferConstants.hxx" />
<ClInclude Include="..\emucore\MindLink.hxx" />
<ClInclude Include="..\emucore\PointingDevice.hxx" />
<ClInclude Include="..\emucore\ProfilingRunner.hxx" />
<ClInclude Include="..\emucore\TIASurface.hxx" />
<ClInclude Include="..\emucore\tia\Audio.hxx" />
<ClInclude Include="..\emucore\tia\AudioChannel.hxx" />
<ClInclude Include="..\emucore\tia\Background.hxx" />
<ClInclude Include="..\emucore\tia\Ball.hxx" />
<ClInclude Include="..\emucore\tia\DelayQueue.hxx" />
<ClInclude Include="..\emucore\tia\DelayQueueIterator.hxx" />
<ClInclude Include="..\emucore\tia\DelayQueueIteratorImpl.hxx" />
<ClInclude Include="..\emucore\tia\DelayQueueMember.hxx" />
<ClInclude Include="..\emucore\tia\DrawCounterDecodes.hxx" />
<ClInclude Include="..\emucore\tia\frame-manager\AbstractFrameManager.hxx" />
<ClInclude Include="..\emucore\tia\frame-manager\FrameLayoutDetector.hxx" />
<ClInclude Include="..\emucore\tia\frame-manager\FrameManager.hxx" />
<ClInclude Include="..\emucore\tia\frame-manager\JitterEmulation.hxx" />
<ClInclude Include="..\emucore\tia\frame-manager\YStartDetector.hxx" />
<ClInclude Include="..\emucore\tia\FrameLayout.hxx" />
<ClInclude Include="..\emucore\tia\LatchedInput.hxx" />
<ClInclude Include="..\emucore\tia\Missile.hxx" />
<ClInclude Include="..\emucore\tia\PaddleReader.hxx" />
<ClInclude Include="..\emucore\tia\Player.hxx" />
<ClInclude Include="..\emucore\tia\Playfield.hxx" />
<ClInclude Include="..\emucore\tia\TIA.hxx" />
<ClInclude Include="..\emucore\tia\TIAConstants.hxx" />
<ClInclude Include="..\emucore\TrakBall.hxx" />
<ClInclude Include="..\gui\ColorWidget.hxx" />
<ClInclude Include="..\gui\ConsoleBFont.hxx" />
<ClInclude Include="..\gui\ConsoleMediumBFont.hxx" />
<ClInclude Include="..\gui\ConsoleMediumFont.hxx" />
<ClInclude Include="..\gui\DeveloperDialog.hxx" />
<ClInclude Include="..\gui\FileListWidget.hxx" />
<ClInclude Include="..\gui\JoystickDialog.hxx" />
<ClInclude Include="..\gui\LoggerDialog.hxx" />
<ClInclude Include="..\gui\RadioButtonWidget.hxx" />
<ClInclude Include="..\gui\SnapshotDialog.hxx" />
<ClInclude Include="..\gui\StellaSettingsDialog.hxx" />
<ClInclude Include="..\gui\TimeLineWidget.hxx" />
<ClInclude Include="..\gui\TimeMachine.hxx" />
<ClInclude Include="..\gui\TimeMachineDialog.hxx" />
<ClInclude Include="..\common\PNGLibrary.hxx" />
<ClInclude Include="..\common\Stack.hxx" />
<ClInclude Include="..\common\Version.hxx" />
<ClInclude Include="..\emucore\AtariVox.hxx" />
<ClInclude Include="..\emucore\Booster.hxx" />
<ClInclude Include="..\emucore\Cart.hxx" />
<ClInclude Include="..\emucore\Cart0840.hxx" />
<ClInclude Include="..\emucore\Cart2K.hxx" />
<ClInclude Include="..\emucore\Cart3E.hxx" />
<ClInclude Include="..\emucore\Cart3F.hxx" />
<ClInclude Include="..\emucore\Cart4A50.hxx" />
<ClInclude Include="..\emucore\Cart4K.hxx" />
<ClInclude Include="..\emucore\CartAR.hxx" />
<ClInclude Include="..\emucore\CartCV.hxx" />
<ClInclude Include="..\emucore\CartDPC.hxx" />
<ClInclude Include="..\emucore\CartDPCPlus.hxx" />
<ClInclude Include="..\emucore\CartE0.hxx" />
<ClInclude Include="..\emucore\CartE7.hxx" />
<ClInclude Include="..\emucore\CartEF.hxx" />
<ClInclude Include="..\emucore\CartEFSC.hxx" />
<ClInclude Include="..\emucore\CartF0.hxx" />
<ClInclude Include="..\emucore\CartF4.hxx" />
<ClInclude Include="..\emucore\CartF4SC.hxx" />
<ClInclude Include="..\emucore\CartF6.hxx" />
<ClInclude Include="..\emucore\CartF6SC.hxx" />
<ClInclude Include="..\emucore\CartF8.hxx" />
<ClInclude Include="..\emucore\CartF8SC.hxx" />
<ClInclude Include="..\emucore\CartFA.hxx" />
<ClInclude Include="..\emucore\CartFE.hxx" />
<ClInclude Include="..\emucore\CartSB.hxx" />
<ClInclude Include="..\emucore\CartUA.hxx" />
<ClInclude Include="..\emucore\CartX07.hxx" />
<ClInclude Include="..\emucore\Console.hxx" />
<ClInclude Include="..\emucore\Control.hxx" />
<ClInclude Include="..\emucore\DefProps.hxx" />
<ClInclude Include="..\emucore\Device.hxx" />
<ClInclude Include="..\emucore\Driving.hxx" />
<ClInclude Include="..\emucore\Event.hxx" />
<ClInclude Include="..\emucore\EventHandler.hxx" />
<ClInclude Include="..\emucore\FrameBuffer.hxx" />
<ClInclude Include="..\emucore\FSNode.hxx" />
<ClInclude Include="..\emucore\Genesis.hxx" />
<ClInclude Include="..\emucore\Joystick.hxx" />
<ClInclude Include="..\emucore\Keyboard.hxx" />
<ClInclude Include="..\emucore\KidVid.hxx" />
<ClInclude Include="..\emucore\M6502.hxx" />
<ClInclude Include="..\emucore\M6532.hxx" />
<ClInclude Include="..\emucore\MD5.hxx" />
<ClInclude Include="..\emucore\MT24LC256.hxx" />
<ClInclude Include="..\emucore\NullDev.hxx" />
<ClInclude Include="..\emucore\OSystem.hxx" />
<ClInclude Include="..\emucore\Paddles.hxx" />
<ClInclude Include="..\emucore\Props.hxx" />
<ClInclude Include="..\emucore\PropsSet.hxx" />
<ClInclude Include="..\emucore\Random.hxx" />
<ClInclude Include="..\emucore\SaveKey.hxx" />
<ClInclude Include="..\emucore\Serializable.hxx" />
<ClInclude Include="..\emucore\Serializer.hxx" />
<ClInclude Include="..\emucore\Settings.hxx" />
<ClInclude Include="..\emucore\Sound.hxx" />
<ClInclude Include="..\emucore\Switches.hxx" />
<ClInclude Include="..\emucore\System.hxx" />
<ClInclude Include="..\emucore\Thumbulator.hxx" />
<ClInclude Include="..\gui\AboutDialog.hxx" />
<ClInclude Include="..\gui\AudioDialog.hxx" />
<ClInclude Include="..\gui\BrowserDialog.hxx" />
<ClInclude Include="..\gui\CheckListWidget.hxx" />
<ClInclude Include="..\gui\ComboDialog.hxx" />
<ClInclude Include="..\gui\Command.hxx" />
<ClInclude Include="..\gui\CommandDialog.hxx" />
<ClInclude Include="..\gui\CommandMenu.hxx" />
<ClInclude Include="..\gui\ConsoleFont.hxx" />
<ClInclude Include="..\gui\ContextMenu.hxx" />
<ClInclude Include="..\gui\Dialog.hxx" />
<ClInclude Include="..\gui\DialogContainer.hxx" />
<ClInclude Include="..\gui\EditableWidget.hxx" />
<ClInclude Include="..\gui\EditTextWidget.hxx" />
<ClInclude Include="..\gui\EventMappingWidget.hxx" />
<ClInclude Include="..\gui\Font.hxx" />
<ClInclude Include="..\gui\GameInfoDialog.hxx" />
<ClInclude Include="..\gui\GameList.hxx" />
<ClInclude Include="..\gui\GlobalPropsDialog.hxx" />
<ClInclude Include="..\gui\GuiObject.hxx" />
<ClInclude Include="..\gui\HelpDialog.hxx" />
<ClInclude Include="..\gui\InputDialog.hxx" />
<ClInclude Include="..\gui\InputTextDialog.hxx" />
<ClInclude Include="..\gui\Launcher.hxx" />
<ClInclude Include="..\gui\LauncherDialog.hxx" />
<ClInclude Include="..\gui\ListWidget.hxx" />
<ClInclude Include="..\gui\Menu.hxx" />
<ClInclude Include="..\gui\MessageBox.hxx" />
<ClInclude Include="..\gui\OptionsDialog.hxx" />
<ClInclude Include="..\gui\PopUpWidget.hxx" />
<ClInclude Include="..\gui\ProgressDialog.hxx" />
<ClInclude Include="..\gui\Rect.hxx" />
<ClInclude Include="..\gui\RomAuditDialog.hxx" />
<ClInclude Include="..\gui\RomInfoWidget.hxx" />
<ClInclude Include="..\gui\ScrollBarWidget.hxx" />
<ClInclude Include="..\gui\StellaFont.hxx" />
<ClInclude Include="..\gui\StringListWidget.hxx" />
<ClInclude Include="..\gui\TabWidget.hxx" />
<ClInclude Include="..\gui\UIDialog.hxx" />
<ClInclude Include="..\gui\VideoDialog.hxx" />
<ClInclude Include="..\gui\Widget.hxx" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,419 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "bspf.hxx"
#include "StellaLIBRETRO.hxx"
#include "SoundLIBRETRO.hxx"
#include "FrameBufferLIBRETRO.hxx"
#include "AtariNTSC.hxx"
#include "AudioSettings.hxx"
#include "Serializer.hxx"
#include "StateManager.hxx"
#include "Switches.hxx"
#include "TIA.hxx"
#include "TIASurface.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StellaLIBRETRO::StellaLIBRETRO()
{
audio_buffer = make_unique<Int16[]>(audio_buffer_max);
console_timing = ConsoleTiming::ntsc;
console_format = "AUTO";
video_aspect_ntsc = 0;
video_aspect_pal = 0;
video_palette = "standard";
video_filter = NTSCFilter::PRESET_OFF;
video_ready = false;
audio_samples = 0;
audio_mode = "byrom";
video_phosphor = "byrom";
video_phosphor_blend = 60;
rom_image = make_unique<uInt8[]>(getROMMax());
system_ready = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool StellaLIBRETRO::create(bool logging)
{
system_ready = false;
FilesystemNode rom("rom");
// auto-detect properties
destroy();
myOSystem = make_unique<OSystemLIBRETRO>();
myOSystem->create();
myOSystem->settings().setValue("format", console_format);
if(myOSystem->createConsole(rom) != EmptyString)
return false;
// auto-detect settings
console_timing = myOSystem->console().timing();
phosphor_default = myOSystem->frameBuffer().tiaSurface().phosphorEnabled();
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// build play system
destroy();
myOSystem = make_unique<OSystemLIBRETRO>();
myOSystem->create();
Settings& settings = myOSystem->settings();
if(logging)
{
settings.setValue("loglevel", 999);
settings.setValue("logtoconsole", true);
}
settings.setValue("speed", 1.0);
settings.setValue("uimessages", false);
settings.setValue("format", console_format);
settings.setValue("palette", video_palette);
settings.setValue("tia.zoom", 1);
settings.setValue("tia.inter", false);
settings.setValue("tia.aspectn", 100);
settings.setValue("tia.aspectp", 100);
//fastscbios
// Fast loading of Supercharger BIOS
settings.setValue("tv.filter", video_filter);
settings.setValue("tv.phosphor", video_phosphor);
settings.setValue("tv.phosblend", video_phosphor_blend);
/*
31440 rate
fs:2 hz:50 bs:314.4 -- not supported, 0 frame lag ideal
fs:128 hz:50 bs:4.9 -- lowest supported, 0-1 frame lag measured
*/
settings.setValue(AudioSettings::SETTING_PRESET, static_cast<int>(AudioSettings::Preset::custom));
settings.setValue(AudioSettings::SETTING_SAMPLE_RATE, getAudioRate());
settings.setValue(AudioSettings::SETTING_FRAGMENT_SIZE, 128);
settings.setValue(AudioSettings::SETTING_BUFFER_SIZE, 8);
settings.setValue(AudioSettings::SETTING_HEADROOM, 0);
settings.setValue(AudioSettings::SETTING_RESAMPLING_QUALITY, static_cast<int>(AudioSettings::ResamplingQuality::nearestNeightbour));
settings.setValue(AudioSettings::SETTING_VOLUME, 100);
settings.setValue(AudioSettings::SETTING_STEREO, audio_mode);
if(myOSystem->createConsole(rom) != EmptyString)
return false;
if(video_phosphor == "never") setVideoPhosphor(1, video_phosphor_blend);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
video_ready = false;
audio_samples = 0;
system_ready = true;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaLIBRETRO::destroy()
{
system_ready = false;
video_ready = false;
audio_samples = 0;
myOSystem.reset();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaLIBRETRO::runFrame()
{
// poll input right at vsync
updateInput();
// run vblank routine and draw frame
updateVideo();
// drain generated audio
updateAudio();
// give user time to respond
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaLIBRETRO::updateInput()
{
Console& console = myOSystem->console();
console.leftController().update();
console.rightController().update();
console.switches().update();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaLIBRETRO::updateVideo()
{
TIA& tia = myOSystem->console().tia();
while (1)
{
uInt32 beam_x, beam_y;
tia.updateScanline();
tia.electronBeamPos(beam_x, beam_y);
if(!beam_y) break;
}
video_ready = tia.newFramePending();
if (video_ready)
{
FrameBuffer& frame = myOSystem->frameBuffer();
tia.renderToFrameBuffer();
frame.updateInEmulationMode(0);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaLIBRETRO::updateAudio()
{
static_cast<SoundLIBRETRO&>(myOSystem->sound()).dequeue(audio_buffer.get(), &audio_samples);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool StellaLIBRETRO::loadState(const void* data, uInt32 size)
{
Serializer state;
state.putByteArray(reinterpret_cast<const uInt8*>(data), size);
if (!myOSystem->state().loadState(state))
return false;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool StellaLIBRETRO::saveState(void* data, uInt32 size)
{
Serializer state;
if (!myOSystem->state().saveState(state))
return false;
if (state.size() > size)
return false;
state.getByteArray(reinterpret_cast<uInt8*>(data), state.size());
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 StellaLIBRETRO::getStateSize()
{
Serializer state;
if (!myOSystem->state().saveState(state))
return 0;
return state.size();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
float StellaLIBRETRO::getVideoAspect()
{
uInt32 width = myOSystem->console().tia().width() * 2;
float par;
if (getVideoNTSC())
{
if (!video_aspect_ntsc)
// non-interlace square pixel clock -- 1.0 pixel @ color burst -- double-width pixels
par = (6.1363635 / 3.579545454) / 2;
else
par = video_aspect_ntsc / 100.0;
}
else
{
if (!video_aspect_pal)
// non-interlace square pixel clock -- 0.8 pixel @ color burst -- double-width pixels
par = (7.3750000 / (4.43361875 * 4/5)) / 2;
else
par = video_aspect_pal / 100.0;
}
// display aspect ratio
return (width * par) / getVideoHeight();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void* StellaLIBRETRO::getVideoBuffer()
{
FrameBufferLIBRETRO& frame = static_cast<FrameBufferLIBRETRO&>(myOSystem->frameBuffer());
return static_cast<void*>(frame.getRenderSurface());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool StellaLIBRETRO::getVideoNTSC()
{
const ConsoleInfo& console_info = myOSystem->console().about();
string format = console_info.DisplayFormat;
return (format == "NTSC") || (format == "NTSC*") ||
(format == "PAL60") || (format == "PAL60*") ||
(format == "SECAM60") || (format == "SECAM60*");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool StellaLIBRETRO::getVideoResize()
{
if (render_width != getRenderWidth() || render_height != getRenderHeight())
{
render_width = getRenderWidth();
render_height = getRenderHeight();
return true;
}
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaLIBRETRO::setROM(const void* data, uInt32 size)
{
memcpy(rom_image.get(), data, size);
rom_size = size;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaLIBRETRO::setConsoleFormat(uInt32 mode)
{
switch(mode)
{
case 0: console_format = "AUTO"; break;
case 1: console_format = "NTSC"; break;
case 2: console_format = "PAL"; break;
case 3: console_format = "SECAM"; break;
case 4: console_format = "NTSC50"; break;
case 5: console_format = "PAL60"; break;
case 6: console_format = "SECAM60"; break;
}
if (system_ready)
myOSystem->settings().setValue("format", console_format);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaLIBRETRO::setVideoFilter(uInt32 mode)
{
switch (mode)
{
case 0: video_filter = NTSCFilter::PRESET_OFF; break;
case 1: video_filter = NTSCFilter::PRESET_COMPOSITE; break;
case 2: video_filter = NTSCFilter::PRESET_SVIDEO; break;
case 3: video_filter = NTSCFilter::PRESET_RGB; break;
case 4: video_filter = NTSCFilter::PRESET_BAD; break;
case 5: video_filter = NTSCFilter::PRESET_CUSTOM; break;
}
if (system_ready)
{
myOSystem->settings().setValue("tv.filter", static_cast<int>(video_filter));
myOSystem->frameBuffer().tiaSurface().setNTSC(video_filter);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaLIBRETRO::setVideoPalette(uInt32 mode)
{
switch (mode)
{
case 0: video_palette = "standard"; break;
case 1: video_palette = "z26"; break;
case 2: video_palette = "custom"; break;
}
if (system_ready)
{
myOSystem->settings().setValue("palette", video_palette);
myOSystem->console().setPalette(video_palette);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaLIBRETRO::setVideoPhosphor(uInt32 mode, uInt32 blend)
{
switch (mode)
{
case 0: video_phosphor = "byrom"; break;
case 1: video_phosphor = "never"; break;
case 2: video_phosphor = "always"; break;
}
video_phosphor_blend = blend;
if (system_ready)
{
myOSystem->settings().setValue("tv.phosphor", video_phosphor);
myOSystem->settings().setValue("tv.phosblend", blend);
switch (mode)
{
case 0: myOSystem->frameBuffer().tiaSurface().enablePhosphor(phosphor_default, blend); break;
case 1: myOSystem->frameBuffer().tiaSurface().enablePhosphor(false, blend); break;
case 2: myOSystem->frameBuffer().tiaSurface().enablePhosphor(true, blend); break;
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaLIBRETRO::setAudioStereo(int mode)
{
switch (mode)
{
case 0: audio_mode = "byrom"; break;
case 1: audio_mode = "mono"; break;
case 2: audio_mode = "stereo"; break;
}
if (system_ready)
{
myOSystem->settings().setValue(AudioSettings::SETTING_STEREO, audio_mode);
myOSystem->console().initializeAudio();
}
}

View File

@ -0,0 +1,156 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef STELLA_LIBRETRO_HXX
#define STELLA_LIBRETRO_HXX
#include "bspf.hxx"
#include "OSystemLIBRETRO.hxx"
#include "Console.hxx"
#include "ConsoleTiming.hxx"
#include "EmulationTiming.hxx"
#include "EventHandler.hxx"
#include "M6532.hxx"
#include "System.hxx"
#include "TIA.hxx"
#include "TIASurface.hxx"
/**
This class wraps Stella core for easier libretro maintenance
*/
class StellaLIBRETRO
{
public:
StellaLIBRETRO();
virtual ~StellaLIBRETRO() = default;
public:
OSystemLIBRETRO& osystem() { return *myOSystem; }
bool create(bool logging);
void destroy();
void reset() { myOSystem->console().system().reset(); }
void runFrame();
bool loadState(const void* data, uInt32 size);
bool saveState(void* data, uInt32 size);
public:
const char* getCoreName() { return "Stella"; }
const char* getROMExtensions() { return "a26|bin"; }
void* getROM() { return rom_image.get(); }
uInt32 getROMSize() { return rom_size; }
uInt32 getROMMax() { return 512 * 1024; }
//uInt8* getRAM() { return myOSystem->console().system().m6532().getRAM(); }
//uInt32 getRAMSize() { return 128; }
uInt32 getStateSize();
bool getConsoleNTSC() { return console_timing == ConsoleTiming::ntsc; }
float getVideoAspect();
bool getVideoNTSC();
float getVideoRate() { return getVideoNTSC() ? 60.0 : 50.0; }
bool getVideoReady() { return video_ready; }
uInt32 getVideoZoom() { return myOSystem->frameBuffer().tiaSurface().ntscEnabled() ? 2 : 1; }
bool getVideoResize();
void* getVideoBuffer();
uInt32 getVideoWidth() { return getVideoZoom()==1 ? myOSystem->console().tia().width() : getVideoWidthMax(); }
uInt32 getVideoHeight() { return myOSystem->console().tia().height(); }
uInt32 getVideoPitch() { return getVideoWidthMax() * 4; }
uInt32 getVideoWidthMax() { return AtariNTSC::outWidth(160); }
uInt32 getVideoHeightMax() { return 312; }
uInt32 getRenderWidth() { return getVideoZoom()==1 ? myOSystem->console().tia().width() * 2 : getVideoWidthMax(); }
uInt32 getRenderHeight() { return myOSystem->console().tia().height() * getVideoZoom(); }
float getAudioRate() { return getConsoleNTSC() ? (262 * 76 * 60) / 38.0 : (312 * 76 * 50) / 38.0; }
bool getAudioReady() { return audio_samples > 0; }
uInt32 getAudioSize() { return audio_samples; }
Int16* getAudioBuffer() { return audio_buffer.get(); }
public:
void setROM(const void* data, uInt32 size);
void setConsoleFormat(uInt32 mode);
void setVideoAspectNTSC(uInt32 value) { video_aspect_ntsc = value; };
void setVideoAspectPAL(uInt32 value) { video_aspect_pal = value; };
void setVideoFilter(uInt32 mode);
void setVideoPalette(uInt32 mode);
void setVideoPhosphor(uInt32 mode, uInt32 blend);
void setAudioStereo(int mode);
void setInputEvent(Event::Type type, Int32 state) { myOSystem->eventHandler().handleEvent(type, state); }
protected:
void updateInput();
void updateVideo();
void updateAudio();
private:
// Following constructors and assignment operators not supported
StellaLIBRETRO(const StellaLIBRETRO&) = delete;
StellaLIBRETRO(StellaLIBRETRO&&) = delete;
StellaLIBRETRO& operator=(const StellaLIBRETRO&) = delete;
StellaLIBRETRO& operator=(StellaLIBRETRO&&) = delete;
unique_ptr<OSystemLIBRETRO> myOSystem;
uInt32 system_ready;
unique_ptr<uInt8[]> rom_image;
uInt32 rom_size;
ConsoleTiming console_timing;
string console_format;
uInt32 render_width, render_height;
bool video_ready;
unique_ptr<Int16[]> audio_buffer;
uInt32 audio_samples;
// (31440 rate / 50 Hz) * 16-bit stereo * 1.25x padding
static const uInt32 audio_buffer_max = (31440 / 50 * 4 * 5) / 4;
private:
string video_palette;
string video_phosphor;
uInt32 video_phosphor_blend;
uInt32 video_aspect_ntsc;
uInt32 video_aspect_pal;
NTSCFilter::Preset video_filter;
string audio_mode;
bool phosphor_default;
};
#endif

View File

@ -0,0 +1,19 @@
LOCAL_PATH := $(call my-dir)
CORE_DIR := $(LOCAL_PATH)/../..
include $(CORE_DIR)/libretro/Makefile.common
COREFLAGS := -DANDROID -D__LIB_RETRO__ -DHAVE_STRINGS_H -DSOUND_SUPPORT $(INCFLAGS)
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
ifneq ($(GIT_VERSION)," unknown")
COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
include $(CLEAR_VARS)
LOCAL_MODULE := retro
LOCAL_SRC_FILES := $(SOURCES_CXX) $(SOURCES_C)
LOCAL_CXXFLAGS := $(COREFLAGS) -std=c++14
LOCAL_LDFLAGS := -Wl,-version-script=$(CORE_DIR)/libretro/link.T
include $(BUILD_SHARED_LIBRARY)

View File

@ -0,0 +1,3 @@
APP_STL := c++_static
APP_ABI := all
APP_CPPFLAGS := -fexceptions

132
src/libretro/libpng/png.h Normal file
View File

@ -0,0 +1,132 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef PNG_H
#define PNG_H
#include "bspf.hxx"
#define PNG_LIBPNG_VER_STRING "1.6.36"
#define PNG_HEADER_VERSION_STRING "libpng version 1.6.36 - December 1, 2018\n"
#define PNG_COLOR_TYPE_GRAY 0
#define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
#define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR)
#define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
#define PNG_COLOR_TYPE_RGBA PNG_COLOR_TYPE_RGB_ALPHA
#define PNG_COLOR_TYPE_GA PNG_COLOR_TYPE_GRAY_ALPHA
#define PNG_COMPRESSION_TYPE_BASE 0
#define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE
#define PNG_COLOR_MASK_PALETTE 1
#define PNG_COLOR_MASK_COLOR 2
#define PNG_COLOR_MASK_ALPHA 4
#define PNG_INTERLACE_NONE 0
#define PNG_INTERLACE_ADAM7 1
#define PNG_INTERLACE_LAST 2
#define PNG_FILTER_TYPE_BASE 0
#define PNG_INTRAPIXEL_DIFFERENCING 64
#define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE
#define PNG_TEXT_COMPRESSION_NONE_WR -3
#define PNG_TEXT_COMPRESSION_zTXt_WR -2
#define PNG_TEXT_COMPRESSION_NONE -1
#define PNG_FILLER_BEFORE 0
#define PNG_FILLER_AFTER 1
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
typedef void *png_voidp;
typedef unsigned char png_byte;
typedef png_byte *png_bytep;
typedef png_bytep *png_bytepp;
typedef uInt32 png_uint_32;
typedef char *png_charp;
typedef const png_charp png_const_charp;
typedef size_t png_size_t;
typedef struct png_struct_def
{
} png_struct;
typedef struct png_info_struct_def
{
} png_info;
typedef struct png_text_struct_def {
int compression;
png_charp key;
png_charp text;
png_size_t text_length;
} png_text;
typedef png_struct *png_structp;
typedef png_structp *png_structpp;
typedef png_info *png_infop;
typedef png_infop *png_infopp;
typedef png_text *png_textp;
typedef png_textp *png_textpp;
typedef void (*png_error_ptr) (png_structp, png_const_charp);
typedef void (*png_rw_ptr) (png_structp, png_bytep, png_size_t);
typedef void (*png_flush_ptr) (png_structp);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static inline png_structp png_create_read_struct(png_const_charp, png_voidp, png_error_ptr, png_error_ptr) { return nullptr; }
static inline png_structp png_create_write_struct(png_const_charp, png_voidp, png_error_ptr, png_error_ptr) { return nullptr; }
static inline png_infop png_create_info_struct(png_structp) { return nullptr; }
static inline void png_set_palette_to_rgb(png_structp) { }
static inline void png_set_bgr(png_structp) { }
static inline void png_set_strip_alpha(png_structp) { }
static inline void png_set_swap_alpha(png_structp) { }
static inline void png_set_filler(png_structp, png_uint_32, int) { }
static inline void png_set_packing(png_structp) { }
static inline void png_set_strip_16(png_structp) { }
static inline void png_set_text(png_structp, png_infop, png_textp, int) { }
static inline void png_set_read_fn(png_structp, png_voidp, png_rw_ptr) { }
static inline void png_set_write_fn(png_structp, png_voidp, png_rw_ptr, png_flush_ptr) { }
static inline png_voidp png_get_io_ptr(png_structp) { return nullptr; }
static inline png_uint_32 png_get_IHDR(png_structp, png_infop, png_uint_32*, png_uint_32*, int*, int*, int*, int*, int*) { return 0; }
static inline void png_set_IHDR(png_structp, png_infop, png_uint_32, png_uint_32, int, int, int, int, int) { }
static inline void png_read_info(png_structp, png_infop) { }
static inline void png_read_image(png_structp, png_bytepp) { }
static inline void png_read_end(png_structp, png_infop) { }
static inline void png_write_info(png_structp, png_infop) { }
static inline void png_write_image(png_structp, png_bytepp) { }
static inline void png_write_end(png_structp, png_infop) { }
static inline void png_destroy_read_struct(png_structpp, png_infopp, png_infopp) { }
static inline void png_destroy_write_struct(png_structpp, png_infopp) { }
#endif /* PNG_H */

540
src/libretro/libretro.cxx Normal file
View File

@ -0,0 +1,540 @@
#ifndef _MSC_VER
#include <stdbool.h>
#include <sched.h>
#endif
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
#include "libretro.h"
#include "StellaLIBRETRO.hxx"
#include "Event.hxx"
#include "Version.hxx"
static StellaLIBRETRO stella;
static retro_log_printf_t log_cb;
static retro_video_refresh_t video_cb;
static retro_input_poll_t input_poll_cb;
static retro_input_state_t input_state_cb;
static retro_environment_t environ_cb;
static retro_audio_sample_t audio_cb;
static retro_audio_sample_batch_t audio_batch_cb;
static struct retro_system_av_info g_av_info;
// libretro UI settings
static int setting_ntsc, setting_pal;
static int setting_stereo, setting_filter, setting_palette;
static int setting_phosphor, setting_console, setting_phosphor_blend;
static bool system_reset;
static unsigned input_devices[2];
// TODO input:
// https://github.com/libretro/blueMSX-libretro/blob/master/libretro.c
// https://github.com/libretro/libretro-o2em/blob/master/libretro.c
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uint32_t libretro_read_rom(void* data)
{
memcpy(data, stella.getROM(), stella.getROMSize());
return stella.getROMSize();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void update_input()
{
if(!input_poll_cb) return;
input_poll_cb();
#define EVENT stella.setInputEvent
EVENT(Event::JoystickZeroUp, input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP));
EVENT(Event::JoystickZeroDown, input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN));
EVENT(Event::JoystickZeroLeft, input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT));
EVENT(Event::JoystickZeroRight, input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT));
EVENT(Event::JoystickZeroFire, input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B));
EVENT(Event::JoystickOneUp, input_state_cb(1, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP));
EVENT(Event::JoystickOneDown, input_state_cb(1, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN));
EVENT(Event::JoystickOneLeft, input_state_cb(1, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT));
EVENT(Event::JoystickOneRight, input_state_cb(1, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT));
EVENT(Event::JoystickOneFire, input_state_cb(1, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B));
EVENT(Event::ConsoleLeftDiffA, input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L));
EVENT(Event::ConsoleLeftDiffB, input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2));
EVENT(Event::ConsoleColor, input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L3));
EVENT(Event::ConsoleRightDiffA, input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R));
EVENT(Event::ConsoleRightDiffB, input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2));
EVENT(Event::ConsoleBlackWhite, input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3));
EVENT(Event::ConsoleSelect, input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT));
EVENT(Event::ConsoleReset, input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START));
#undef EVENT
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void update_geometry()
{
struct retro_system_av_info av_info;
retro_get_system_av_info(&av_info);
environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &av_info);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void update_system_av()
{
struct retro_system_av_info av_info;
retro_get_system_av_info(&av_info);
environ_cb(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &av_info);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void update_variables(bool init = false)
{
bool geometry_update = false;
char key[256];
struct retro_variable var;
#define RETRO_GET(x) \
var.key = x; \
var.value = NULL; \
if(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
RETRO_GET("stella_filter")
{
int value = 0;
if(!strcmp(var.value, "disabled")) value = 0;
else if(!strcmp(var.value, "composite")) value = 1;
else if(!strcmp(var.value, "s-video")) value = 2;
else if(!strcmp(var.value, "rgb")) value = 3;
else if(!strcmp(var.value, "badly adjusted")) value = 4;
if(setting_filter != value)
{
stella.setVideoFilter(value);
geometry_update = true;
setting_filter = value;
}
}
RETRO_GET("stella_ntsc_aspect")
{
int value = 0;
if(!strcmp(var.value, "par")) value = 0;
else value = atoi(var.value);
if(setting_ntsc != value)
{
stella.setVideoAspectNTSC(value);
geometry_update = true;
setting_ntsc = value;
}
}
RETRO_GET("stella_pal_aspect")
{
int value = 0;
if(!strcmp(var.value, "par")) value = 0;
else value = atoi(var.value);
if(setting_pal != value)
{
stella.setVideoAspectPAL(value);
setting_pal = value;
geometry_update = true;
}
}
RETRO_GET("stella_palette")
{
int value = 0;
if(!strcmp(var.value, "standard")) value = 0;
else if(!strcmp(var.value, "z26")) value = 1;
if(setting_palette != value)
{
stella.setVideoPalette(value);
setting_palette = value;
}
}
RETRO_GET("stella_console")
{
int value = 0;
if(!strcmp(var.value, "auto")) value = 0;
else if(!strcmp(var.value, "ntsc")) value = 1;
else if(!strcmp(var.value, "pal")) value = 2;
else if(!strcmp(var.value, "secam")) value = 3;
else if(!strcmp(var.value, "ntsc50")) value = 4;
else if(!strcmp(var.value, "pal60")) value = 5;
else if(!strcmp(var.value, "secam60")) value = 6;
if(setting_console != value)
{
stella.setConsoleFormat(value);
setting_console = value;
system_reset = true;
}
}
RETRO_GET("stella_stereo")
{
int value = 0;
if(!strcmp(var.value, "auto")) value = 0;
else if(!strcmp(var.value, "off")) value = 1;
else if(!strcmp(var.value, "on")) value = 2;
if(setting_stereo != value)
{
stella.setAudioStereo(value);
setting_stereo = value;
}
}
RETRO_GET("stella_phosphor")
{
int value = 0;
if(!strcmp(var.value, "auto")) value = 0;
else if(!strcmp(var.value, "off")) value = 1;
else if(!strcmp(var.value, "on")) value = 2;
if(setting_phosphor != value)
{
stella.setVideoPhosphor(value, setting_phosphor_blend);
setting_phosphor = value;
}
}
RETRO_GET("stella_phosphor_blend")
{
int value = 0;
value = atoi(var.value);
if(setting_phosphor_blend != value)
{
stella.setVideoPhosphor(setting_phosphor, value);
setting_phosphor_blend = value;
}
}
if(!init && !system_reset)
{
if(geometry_update) update_geometry();
}
#undef RETRO_GET
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static bool reset_system()
{
// clean restart
stella.destroy();
// apply libretro settings first
update_variables(true);
// start system
if(!stella.create(log_cb ? true : false)) return false;
// reset libretro window
update_geometry();
system_reset = false;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unsigned retro_api_version()
{
return RETRO_API_VERSION;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unsigned retro_get_region()
{
return stella.getVideoNTSC() ? RETRO_REGION_NTSC : RETRO_REGION_PAL;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_set_video_refresh(retro_video_refresh_t cb) { video_cb = cb; }
void retro_set_audio_sample(retro_audio_sample_t cb) { audio_cb = cb; }
void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb) { audio_batch_cb = cb; }
void retro_set_input_poll(retro_input_poll_t cb) { input_poll_cb = cb; }
void retro_set_input_state(retro_input_state_t cb) { input_state_cb = cb; }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_get_system_info(struct retro_system_info *info)
{
memset(info,0,sizeof(retro_system_info));
info->library_name = stella.getCoreName();
#ifndef GIT_VERSION
#define GIT_VERSION ""
#endif
info->library_version = STELLA_VERSION GIT_VERSION;
info->valid_extensions = stella.getROMExtensions();
info->need_fullpath = false;
info->block_extract = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_get_system_av_info(struct retro_system_av_info *info)
{
memset(info,0,sizeof(retro_system_av_info));
info->timing.fps = stella.getVideoRate();
info->timing.sample_rate = stella.getAudioRate();
info->geometry.base_width = stella.getRenderWidth();
info->geometry.base_height = stella.getRenderHeight();
info->geometry.max_width = stella.getVideoWidthMax();
info->geometry.max_height = stella.getVideoHeightMax();
info->geometry.aspect_ratio = stella.getVideoAspect();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_set_controller_port_device(unsigned port, unsigned device)
{
if(port < 2)
{
switch (device)
{
case RETRO_DEVICE_NONE:
input_devices[port] = RETRO_DEVICE_NONE;
break;
case RETRO_DEVICE_JOYPAD:
input_devices[port] = RETRO_DEVICE_JOYPAD;
break;
case RETRO_DEVICE_MOUSE:
input_devices[port] = RETRO_DEVICE_MOUSE;
break;
case RETRO_DEVICE_KEYBOARD:
input_devices[port] = RETRO_DEVICE_KEYBOARD;
break;
default:
if (log_cb) log_cb(RETRO_LOG_ERROR, "%s\n", "[libretro]: Invalid device, setting type to RETRO_DEVICE_JOYPAD ...");
input_devices[port] = RETRO_DEVICE_JOYPAD;
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_set_environment(retro_environment_t cb)
{
environ_cb = cb;
struct retro_variable variables[] = {
// Adding more variables and rearranging them is safe.
{ "stella_console", "Console display; auto|ntsc|pal|secam|ntsc50|pal60|secam60"},
{ "stella_filter", "TV effects; disabled|composite|s-video|rgb|badly adjusted"},
{ "stella_ntsc_aspect", "NTSC aspect %; par|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|50|75|76|77|78|79|80|81|82|83|84|85"},
{ "stella_pal_aspect", "PAL aspect %; par|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|50|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103"},
{ "stella_stereo", "Stereo sound; auto|off|on"},
{ "stella_palette", "Palette colors; standard|z26"},
{ "stella_phosphor", "Phosphor mode; auto|off|on"},
{ "stella_phosphor_blend", "Phosphor blend %; 60|65|70|75|80|85|90|95|100|0|5|10|15|20|25|30|35|40|45|50|55"},
{ NULL, NULL },
};
environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_init()
{
struct retro_log_callback log;
unsigned level = 4;
log_cb = NULL;
if(environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log)) log_cb = log.log;
environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool retro_load_game(const struct retro_game_info *info)
{
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888;
struct retro_input_descriptor desc[] = {
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "Left" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "Up" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "Down" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "Right" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "Fire" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "Left Difficulty A" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, "Left Difficulty B" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L3, "Color" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "Right Difficulty A" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2, "Right Difficulty B" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3, "Black/White" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Select" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Reset" },
{ 1, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "Left" },
{ 1, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "Up" },
{ 1, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "Down" },
{ 1, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "Right" },
{ 1, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "Fire" },
{ 0 },
};
if(!info || info->size >= stella.getROMMax()) return false;
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc);
if(!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
{
if(log_cb) log_cb(RETRO_LOG_INFO, "[Stella]: XRGB8888 is not supported.\n");
return false;
}
stella.setROM(info->data, info->size);
return reset_system();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool retro_load_game_special(unsigned game_type, const struct retro_game_info *info, size_t num_info)
{
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_reset()
{
stella.reset();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_run()
{
bool updated = false;
if(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
update_variables();
if(system_reset)
{
reset_system();
update_system_av();
return;
}
update_input();
stella.runFrame();
if(stella.getVideoResize())
update_geometry();
//printf("retro_run - %d %d %d - %d\n", stella.getVideoWidth(), stella.getVideoHeight(), stella.getVideoPitch(), stella.getAudioSize() );
if(stella.getVideoReady())
video_cb(stella.getVideoBuffer(), stella.getVideoWidth(), stella.getVideoHeight(), stella.getVideoPitch());
if(stella.getAudioReady())
audio_batch_cb(stella.getAudioBuffer(), stella.getAudioSize());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_unload_game()
{
stella.destroy();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_deinit()
{
stella.destroy();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t retro_serialize_size()
{
return stella.getStateSize();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool retro_serialize(void *data, size_t size)
{
return stella.saveState(data, size);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool retro_unserialize(const void *data, size_t size)
{
return stella.loadState(data, size);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void *retro_get_memory_data(unsigned id)
{
switch (id)
{
//case RETRO_MEMORY_SYSTEM_RAM: return stella.getRAM();
default: return NULL;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t retro_get_memory_size(unsigned id)
{
switch (id)
{
//case RETRO_MEMORY_SYSTEM_RAM: return stella.getRAMSize();
default: return 0;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_cheat_reset()
{}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_cheat_set(unsigned index, bool enabled, const char *code)
{}

2365
src/libretro/libretro.h Normal file

File diff suppressed because it is too large Load Diff

4
src/libretro/link.T Normal file
View File

@ -0,0 +1,4 @@
{
global: retro_*;
local: *;
};

111
src/libretro/zlib/zlib.h Normal file
View File

@ -0,0 +1,111 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef ZLIB_H
#define ZLIB_H
#include "bspf.hxx"
#define Z_NO_FLUSH 0
#define Z_PARTIAL_FLUSH 1
#define Z_SYNC_FLUSH 2
#define Z_FULL_FLUSH 3
#define Z_FINISH 4
#define Z_BLOCK 5
#define Z_TREES 6
#define Z_OK 0
#define Z_STREAM_END 1
#define Z_NEED_DICT 2
#define Z_ERRNO (-1)
#define Z_STREAM_ERROR (-2)
#define Z_DATA_ERROR (-3)
#define Z_MEM_ERROR (-4)
#define Z_BUF_ERROR (-5)
#define Z_VERSION_ERROR (-6)
#define Z_NO_COMPRESSION 0
#define Z_BEST_SPEED 1
#define Z_BEST_COMPRESSION 9
#define Z_DEFAULT_COMPRESSION (-1)
#define Z_FILTERED 1
#define Z_HUFFMAN_ONLY 2
#define Z_RLE 3
#define Z_FIXED 4
#define Z_DEFAULT_STRATEGY 0
#define Z_BINARY 0
#define Z_TEXT 1
#define Z_ASCII Z_TEXT
#define Z_UNKNOWN 2
#define Z_DEFLATED 8
#define Z_NULL 0
#define MAX_WBITS 16
#define Bytef uInt8
typedef struct z_stream_s {
uInt8* next_in;
uInt32 avail_in;
uInt32 total_in;
uInt8* next_out;
uInt32 avail_out;
uInt32 total_out;
char* msg;
void* zalloc;
void* zfree;
void* opaque;
int data_type;
uInt32 adler;
uInt32 reserved;
} z_stream;
typedef z_stream *z_streamp;
struct gzFile_s {
unsigned have;
unsigned char *next;
uInt64 pos;
};
typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static inline int inflateInit2(z_streamp, int) { return Z_ERRNO; }
static inline bool readStream(z_streamp, int, int, int) { return false; }
static inline int inflate(z_streamp, int) { return Z_ERRNO; }
static inline int inflateEnd(z_streamp) { return Z_ERRNO; }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static inline gzFile gzopen(const char*, const char*) { return nullptr; }
static inline int gzread(gzFile, void*, unsigned) { return Z_ERRNO; }
static inline int gzclose(gzFile) { return Z_ERRNO; }
#endif /* ZLIB_H */