aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett Brown <themagnificentmrb@gmail.com>2018-07-05 18:16:59 -0700
committerGarrett Brown <themagnificentmrb@gmail.com>2018-08-13 12:03:35 -0700
commit4abbd40cdf9e84dab4795bbca1abc56284c1413f (patch)
tree38e288923612d7a58d944360e0dd517b2b72484c
parente5ba62354aba1e179d2a4a74d131f37e736511fd (diff)
RetroPlayer: Import savestate code from game add-ons
Code shuffle only. No functional changes.
-rw-r--r--cmake/treedata/common/games.txt1
-rw-r--r--cmake/treedata/common/retroplayer.txt1
-rw-r--r--xbmc/DatabaseManager.cpp1
-rw-r--r--xbmc/cores/RetroPlayer/RetroPlayer.cpp4
-rw-r--r--xbmc/cores/RetroPlayer/playback/ReversiblePlayback.cpp10
-rw-r--r--xbmc/cores/RetroPlayer/playback/ReversiblePlayback.h8
-rw-r--r--xbmc/cores/RetroPlayer/savestates/CMakeLists.txt (renamed from xbmc/games/addons/savestates/CMakeLists.txt)2
-rw-r--r--xbmc/cores/RetroPlayer/savestates/Savestate.cpp (renamed from xbmc/games/addons/savestates/Savestate.cpp)4
-rw-r--r--xbmc/cores/RetroPlayer/savestates/Savestate.h (renamed from xbmc/games/addons/savestates/Savestate.h)2
-rw-r--r--xbmc/cores/RetroPlayer/savestates/SavestateDatabase.cpp (renamed from xbmc/games/addons/savestates/SavestateDatabase.cpp)2
-rw-r--r--xbmc/cores/RetroPlayer/savestates/SavestateDatabase.h (renamed from xbmc/games/addons/savestates/SavestateDatabase.h)2
-rw-r--r--xbmc/cores/RetroPlayer/savestates/SavestateDefines.h (renamed from xbmc/games/addons/savestates/SavestateDefines.h)0
-rw-r--r--xbmc/cores/RetroPlayer/savestates/SavestateReader.cpp (renamed from xbmc/games/addons/savestates/SavestateReader.cpp)4
-rw-r--r--xbmc/cores/RetroPlayer/savestates/SavestateReader.h (renamed from xbmc/games/addons/savestates/SavestateReader.h)5
-rw-r--r--xbmc/cores/RetroPlayer/savestates/SavestateTranslator.cpp (renamed from xbmc/games/addons/savestates/SavestateTranslator.cpp)2
-rw-r--r--xbmc/cores/RetroPlayer/savestates/SavestateTranslator.h (renamed from xbmc/games/addons/savestates/SavestateTranslator.h)2
-rw-r--r--xbmc/cores/RetroPlayer/savestates/SavestateUtils.cpp (renamed from xbmc/games/addons/savestates/SavestateUtils.cpp)2
-rw-r--r--xbmc/cores/RetroPlayer/savestates/SavestateUtils.h (renamed from xbmc/games/addons/savestates/SavestateUtils.h)2
-rw-r--r--xbmc/cores/RetroPlayer/savestates/SavestateWriter.cpp (renamed from xbmc/games/addons/savestates/SavestateWriter.cpp)6
-rw-r--r--xbmc/cores/RetroPlayer/savestates/SavestateWriter.h (renamed from xbmc/games/addons/savestates/SavestateWriter.h)5
-rw-r--r--xbmc/games/dialogs/GUIDialogSelectGameClient.cpp12
-rw-r--r--xbmc/games/windows/GUIWindowGames.cpp1
-rw-r--r--xbmc/guilib/guiinfo/GamesGUIInfo.cpp2
23 files changed, 42 insertions, 38 deletions
diff --git a/cmake/treedata/common/games.txt b/cmake/treedata/common/games.txt
index 9f25c6cf83..7ae2d35ae5 100644
--- a/cmake/treedata/common/games.txt
+++ b/cmake/treedata/common/games.txt
@@ -1,7 +1,6 @@
xbmc/games games
xbmc/games/addons games/addons
xbmc/games/addons/input games/addons/input
-xbmc/games/addons/savestates games/addons/savestates
xbmc/games/addons/streams games/addons/streams
xbmc/games/controllers games/controllers
xbmc/games/controllers/dialogs games/controllers/dialogs
diff --git a/cmake/treedata/common/retroplayer.txt b/cmake/treedata/common/retroplayer.txt
index 3ab373ec97..cf9c9c5f52 100644
--- a/cmake/treedata/common/retroplayer.txt
+++ b/cmake/treedata/common/retroplayer.txt
@@ -10,5 +10,6 @@ xbmc/cores/RetroPlayer/process cores/RetroPlaye
xbmc/cores/RetroPlayer/rendering cores/RetroPlayer/rendering
xbmc/cores/RetroPlayer/rendering/VideoRenderers cores/RetroPlayer/rendering/VideoRenderers
xbmc/cores/RetroPlayer/rendering/VideoShaders cores/RetroPlayer/rendering/VideoShaders
+xbmc/cores/RetroPlayer/savestates cores/RetroPlayer/savestates
xbmc/cores/RetroPlayer/streams cores/RetroPlayer/streams
xbmc/cores/RetroPlayer/streams/memory cores/RetroPlayer/streams/memory
diff --git a/xbmc/DatabaseManager.cpp b/xbmc/DatabaseManager.cpp
index 9762013488..55b53b2fce 100644
--- a/xbmc/DatabaseManager.cpp
+++ b/xbmc/DatabaseManager.cpp
@@ -15,7 +15,6 @@
#include "video/VideoDatabase.h"
#include "pvr/PVRDatabase.h"
#include "pvr/epg/EpgDatabase.h"
-#include "games/addons/savestates/SavestateDatabase.h"
#include "settings/AdvancedSettings.h"
using namespace PVR;
diff --git a/xbmc/cores/RetroPlayer/RetroPlayer.cpp b/xbmc/cores/RetroPlayer/RetroPlayer.cpp
index f225dd0116..b1065d1c95 100644
--- a/xbmc/cores/RetroPlayer/RetroPlayer.cpp
+++ b/xbmc/cores/RetroPlayer/RetroPlayer.cpp
@@ -18,12 +18,12 @@
#include "cores/RetroPlayer/playback/ReversiblePlayback.h"
#include "cores/RetroPlayer/process/RPProcessInfo.h"
#include "cores/RetroPlayer/rendering/RPRenderManager.h"
+#include "cores/RetroPlayer/savestates/Savestate.h"
+#include "cores/RetroPlayer/savestates/SavestateUtils.h"
#include "cores/RetroPlayer/streams/RPStreamManager.h"
#include "dialogs/GUIDialogYesNo.h"
#include "filesystem/File.h"
#include "games/addons/input/GameClientInput.h"
-#include "games/addons/savestates/Savestate.h"
-#include "games/addons/savestates/SavestateUtils.h"
#include "games/addons/GameClient.h"
#include "games/dialogs/osd/DialogGameVideoSelect.h"
#include "games/tags/GameInfoTag.h"
diff --git a/xbmc/cores/RetroPlayer/playback/ReversiblePlayback.cpp b/xbmc/cores/RetroPlayer/playback/ReversiblePlayback.cpp
index 67b11b2a27..71a7132040 100644
--- a/xbmc/cores/RetroPlayer/playback/ReversiblePlayback.cpp
+++ b/xbmc/cores/RetroPlayer/playback/ReversiblePlayback.cpp
@@ -7,12 +7,12 @@
*/
#include "ReversiblePlayback.h"
+#include "cores/RetroPlayer/savestates/Savestate.h"
+#include "cores/RetroPlayer/savestates/SavestateReader.h"
+#include "cores/RetroPlayer/savestates/SavestateWriter.h"
#include "cores/RetroPlayer/streams/memory/BasicMemoryStream.h"
#include "cores/RetroPlayer/streams/memory/DeltaPairMemoryStream.h"
#include "games/addons/GameClient.h"
-#include "games/addons/savestates/Savestate.h"
-#include "games/addons/savestates/SavestateReader.h"
-#include "games/addons/savestates/SavestateWriter.h"
#include "games/GameServices.h"
#include "games/GameSettings.h"
#include "threads/SingleLock.h"
@@ -29,8 +29,8 @@ using namespace RETRO;
CReversiblePlayback::CReversiblePlayback(GAME::CGameClient* gameClient, double fps, size_t serializeSize) :
m_gameClient(gameClient),
m_gameLoop(this, fps),
- m_savestateWriter(new GAME::CSavestateWriter),
- m_savestateReader(new GAME::CSavestateReader),
+ m_savestateWriter(new CSavestateWriter),
+ m_savestateReader(new CSavestateReader),
m_totalFrameCount(0),
m_pastFrameCount(0),
m_futureFrameCount(0),
diff --git a/xbmc/cores/RetroPlayer/playback/ReversiblePlayback.h b/xbmc/cores/RetroPlayer/playback/ReversiblePlayback.h
index 3a56ae9d4d..45075c8458 100644
--- a/xbmc/cores/RetroPlayer/playback/ReversiblePlayback.h
+++ b/xbmc/cores/RetroPlayer/playback/ReversiblePlayback.h
@@ -22,12 +22,12 @@ namespace KODI
namespace GAME
{
class CGameClient;
- class CSavestateReader;
- class CSavestateWriter;
}
namespace RETRO
{
+ class CSavestateReader;
+ class CSavestateWriter;
class IMemoryStream;
class CReversiblePlayback : public IPlayback,
@@ -77,8 +77,8 @@ namespace RETRO
CCriticalSection m_mutex;
// Savestate functionality
- std::unique_ptr<GAME::CSavestateWriter> m_savestateWriter;
- std::unique_ptr<GAME::CSavestateReader> m_savestateReader;
+ std::unique_ptr<CSavestateWriter> m_savestateWriter;
+ std::unique_ptr<CSavestateReader> m_savestateReader;
// Playback stats
uint64_t m_totalFrameCount;
diff --git a/xbmc/games/addons/savestates/CMakeLists.txt b/xbmc/cores/RetroPlayer/savestates/CMakeLists.txt
index c334fedb51..5f835e5914 100644
--- a/xbmc/games/addons/savestates/CMakeLists.txt
+++ b/xbmc/cores/RetroPlayer/savestates/CMakeLists.txt
@@ -13,4 +13,4 @@ set(HEADERS Savestate.h
SavestateUtils.h
SavestateWriter.h)
-core_add_library(gamesavestates)
+core_add_library(retroplayer_savestates)
diff --git a/xbmc/games/addons/savestates/Savestate.cpp b/xbmc/cores/RetroPlayer/savestates/Savestate.cpp
index 9488a61228..ed0ab3e1b9 100644
--- a/xbmc/games/addons/savestates/Savestate.cpp
+++ b/xbmc/cores/RetroPlayer/savestates/Savestate.cpp
@@ -16,7 +16,7 @@
#include <tinyxml.h>
using namespace KODI;
-using namespace GAME;
+using namespace RETRO;
void CSavestate::Reset()
{
@@ -96,7 +96,7 @@ bool CSavestate::Serialize(const std::string& path) const
if (m_type == SAVETYPE::SLOT)
XMLUtils::SetInt(pElement, SAVESTATE_FIELD_SLOT, m_slot);
XMLUtils::SetString(pElement, SAVESTATE_FIELD_LABEL, m_label);
- XMLUtils::SetLong(pElement, SAVESTATE_FIELD_SIZE, m_size);
+ XMLUtils::SetLong(pElement, SAVESTATE_FIELD_SIZE, static_cast<long>(m_size));
XMLUtils::SetString(pElement, SAVESTATE_FIELD_GAMECLIENT, m_gameClient);
XMLUtils::SetString(pElement, SAVESTATE_FIELD_GAME_PATH, m_gamePath);
XMLUtils::SetString(pElement, SAVESTATE_FIELD_GAME_CRC, m_gameCRC);
diff --git a/xbmc/games/addons/savestates/Savestate.h b/xbmc/cores/RetroPlayer/savestates/Savestate.h
index dd82d8343e..886b7fa442 100644
--- a/xbmc/games/addons/savestates/Savestate.h
+++ b/xbmc/cores/RetroPlayer/savestates/Savestate.h
@@ -17,7 +17,7 @@ class CVariant;
namespace KODI
{
-namespace GAME
+namespace RETRO
{
enum class SAVETYPE
{
diff --git a/xbmc/games/addons/savestates/SavestateDatabase.cpp b/xbmc/cores/RetroPlayer/savestates/SavestateDatabase.cpp
index f32e11f3c8..6b987f7ca8 100644
--- a/xbmc/games/addons/savestates/SavestateDatabase.cpp
+++ b/xbmc/cores/RetroPlayer/savestates/SavestateDatabase.cpp
@@ -19,7 +19,7 @@
#include "FileItem.h"
using namespace KODI;
-using namespace GAME;
+using namespace RETRO;
CSavestateDatabase::CSavestateDatabase() = default;
diff --git a/xbmc/games/addons/savestates/SavestateDatabase.h b/xbmc/cores/RetroPlayer/savestates/SavestateDatabase.h
index 0696f6bce7..9dd5c025d0 100644
--- a/xbmc/games/addons/savestates/SavestateDatabase.h
+++ b/xbmc/cores/RetroPlayer/savestates/SavestateDatabase.h
@@ -18,7 +18,7 @@ class CVariant;
namespace KODI
{
-namespace GAME
+namespace RETRO
{
class CSavestate;
diff --git a/xbmc/games/addons/savestates/SavestateDefines.h b/xbmc/cores/RetroPlayer/savestates/SavestateDefines.h
index 7646cbb12e..7646cbb12e 100644
--- a/xbmc/games/addons/savestates/SavestateDefines.h
+++ b/xbmc/cores/RetroPlayer/savestates/SavestateDefines.h
diff --git a/xbmc/games/addons/savestates/SavestateReader.cpp b/xbmc/cores/RetroPlayer/savestates/SavestateReader.cpp
index 6d071580a3..d693d64d76 100644
--- a/xbmc/games/addons/savestates/SavestateReader.cpp
+++ b/xbmc/cores/RetroPlayer/savestates/SavestateReader.cpp
@@ -12,11 +12,11 @@
#include "utils/log.h"
using namespace KODI;
-using namespace GAME;
+using namespace RETRO;
CSavestateReader::~CSavestateReader() = default;
-bool CSavestateReader::Initialize(const std::string& path, const CGameClient* gameClient)
+bool CSavestateReader::Initialize(const std::string& path, const GAME::CGameClient* gameClient)
{
bool bSuccess = false;
diff --git a/xbmc/games/addons/savestates/SavestateReader.h b/xbmc/cores/RetroPlayer/savestates/SavestateReader.h
index 8cd690de3e..99c47ede2f 100644
--- a/xbmc/games/addons/savestates/SavestateReader.h
+++ b/xbmc/cores/RetroPlayer/savestates/SavestateReader.h
@@ -19,13 +19,16 @@ namespace KODI
namespace GAME
{
class CGameClient;
+}
+namespace RETRO
+{
class CSavestateReader
{
public:
~CSavestateReader();
- bool Initialize(const std::string& path, const CGameClient* gameClient);
+ bool Initialize(const std::string& path, const GAME::CGameClient* gameClient);
bool ReadSave(uint8_t *data, size_t size);
uint64_t GetFrameCount(void) const { return m_frameCount; }
diff --git a/xbmc/games/addons/savestates/SavestateTranslator.cpp b/xbmc/cores/RetroPlayer/savestates/SavestateTranslator.cpp
index b96ad42cb1..376b4a8487 100644
--- a/xbmc/games/addons/savestates/SavestateTranslator.cpp
+++ b/xbmc/cores/RetroPlayer/savestates/SavestateTranslator.cpp
@@ -10,7 +10,7 @@
#include "SavestateDefines.h"
using namespace KODI;
-using namespace GAME;
+using namespace RETRO;
SAVETYPE CSavestateTranslator::TranslateType(const std::string& type)
{
diff --git a/xbmc/games/addons/savestates/SavestateTranslator.h b/xbmc/cores/RetroPlayer/savestates/SavestateTranslator.h
index d97d85301c..acf35dc402 100644
--- a/xbmc/games/addons/savestates/SavestateTranslator.h
+++ b/xbmc/cores/RetroPlayer/savestates/SavestateTranslator.h
@@ -14,7 +14,7 @@
namespace KODI
{
-namespace GAME
+namespace RETRO
{
class CSavestateTranslator
{
diff --git a/xbmc/games/addons/savestates/SavestateUtils.cpp b/xbmc/cores/RetroPlayer/savestates/SavestateUtils.cpp
index 1eb624a0da..3fd8d8470a 100644
--- a/xbmc/games/addons/savestates/SavestateUtils.cpp
+++ b/xbmc/cores/RetroPlayer/savestates/SavestateUtils.cpp
@@ -14,7 +14,7 @@
#define METADATA_EXTENSION ".xml"
using namespace KODI;
-using namespace GAME;
+using namespace RETRO;
std::string CSavestateUtils::MakePath(const CSavestate& save)
{
diff --git a/xbmc/games/addons/savestates/SavestateUtils.h b/xbmc/cores/RetroPlayer/savestates/SavestateUtils.h
index 4f9c38ee06..a252adf478 100644
--- a/xbmc/games/addons/savestates/SavestateUtils.h
+++ b/xbmc/cores/RetroPlayer/savestates/SavestateUtils.h
@@ -12,7 +12,7 @@
namespace KODI
{
-namespace GAME
+namespace RETRO
{
class CSavestate;
diff --git a/xbmc/games/addons/savestates/SavestateWriter.cpp b/xbmc/cores/RetroPlayer/savestates/SavestateWriter.cpp
index 91e76ab537..ca42113c40 100644
--- a/xbmc/games/addons/savestates/SavestateWriter.cpp
+++ b/xbmc/cores/RetroPlayer/savestates/SavestateWriter.cpp
@@ -7,9 +7,9 @@
*/
#include "SavestateWriter.h"
+#include "SavestateUtils.h"
#include "filesystem/File.h"
#include "games/addons/GameClient.h"
-#include "games/addons/savestates/SavestateUtils.h"
#include "pictures/Picture.h"
#include "settings/AdvancedSettings.h"
#include "utils/log.h"
@@ -18,11 +18,11 @@
#include "XBDateTime.h"
using namespace KODI;
-using namespace GAME;
+using namespace RETRO;
CSavestateWriter::~CSavestateWriter() = default;
-bool CSavestateWriter::Initialize(const CGameClient* gameClient, uint64_t frameHistoryCount)
+bool CSavestateWriter::Initialize(const GAME::CGameClient* gameClient, uint64_t frameHistoryCount)
{
//! @todo Handle savestates for standalone game clients
if (gameClient->GetGamePath().empty())
diff --git a/xbmc/games/addons/savestates/SavestateWriter.h b/xbmc/cores/RetroPlayer/savestates/SavestateWriter.h
index 1ae42db475..2c4d331827 100644
--- a/xbmc/games/addons/savestates/SavestateWriter.h
+++ b/xbmc/cores/RetroPlayer/savestates/SavestateWriter.h
@@ -19,13 +19,16 @@ namespace KODI
namespace GAME
{
class CGameClient;
+}
+namespace RETRO
+{
class CSavestateWriter
{
public:
~CSavestateWriter();
- bool Initialize(const CGameClient* gameClient, uint64_t frameHistoryCount);
+ bool Initialize(const GAME::CGameClient* gameClient, uint64_t frameHistoryCount);
bool WriteSave(const uint8_t *data, size_t size);
void WriteThumb();
bool CommitToDatabase();
diff --git a/xbmc/games/dialogs/GUIDialogSelectGameClient.cpp b/xbmc/games/dialogs/GUIDialogSelectGameClient.cpp
index 730d3e07f2..1b2cf3bf61 100644
--- a/xbmc/games/dialogs/GUIDialogSelectGameClient.cpp
+++ b/xbmc/games/dialogs/GUIDialogSelectGameClient.cpp
@@ -9,11 +9,11 @@
#include "GUIDialogSelectGameClient.h"
#include "addons/AddonInstaller.h"
#include "addons/AddonManager.h"
+#include "cores/RetroPlayer/savestates/Savestate.h"
+#include "cores/RetroPlayer/savestates/SavestateDatabase.h"
+#include "cores/RetroPlayer/savestates/SavestateUtils.h"
#include "dialogs/GUIDialogSelect.h"
#include "filesystem/AddonsDirectory.h"
-#include "games/addons/savestates/Savestate.h"
-#include "games/addons/savestates/SavestateDatabase.h"
-#include "games/addons/savestates/SavestateUtils.h"
#include "games/addons/GameClient.h"
#include "guilib/GUIComponent.h"
#include "guilib/GUIWindowManager.h"
@@ -37,11 +37,11 @@ std::string CGUIDialogSelectGameClient::ShowAndGetGameClient(const std::string &
LogGameClients(candidates, installable);
std::string extension = URIUtils::GetExtension(gamePath);
- std::string xmlPath = CSavestateUtils::MakeMetadataPath(gamePath);
+ std::string xmlPath = RETRO::CSavestateUtils::MakeMetadataPath(gamePath);
// Load savestate
- CSavestate save;
- CSavestateDatabase db;
+ RETRO::CSavestate save;
+ RETRO::CSavestateDatabase db;
CLog::Log(LOGDEBUG, "Select game client dialog: Loading savestate metadata %s", CURL::GetRedacted(xmlPath).c_str());
const bool bLoaded = db.GetSavestate(xmlPath, save);
diff --git a/xbmc/games/windows/GUIWindowGames.cpp b/xbmc/games/windows/GUIWindowGames.cpp
index 144c553a2a..ea77aaca47 100644
--- a/xbmc/games/windows/GUIWindowGames.cpp
+++ b/xbmc/games/windows/GUIWindowGames.cpp
@@ -15,7 +15,6 @@
#include "FileItem.h"
#include "games/tags/GameInfoTag.h"
#include "games/addons/GameClient.h"
-#include "games/addons/savestates/SavestateDatabase.h"
#include "guilib/GUIComponent.h"
#include "guilib/GUIWindowManager.h"
#include "guilib/WindowIDs.h"
diff --git a/xbmc/guilib/guiinfo/GamesGUIInfo.cpp b/xbmc/guilib/guiinfo/GamesGUIInfo.cpp
index b8b6d370b8..c784c1d537 100644
--- a/xbmc/guilib/guiinfo/GamesGUIInfo.cpp
+++ b/xbmc/guilib/guiinfo/GamesGUIInfo.cpp
@@ -10,8 +10,8 @@
#include "FileItem.h"
#include "Util.h"
+#include "cores/RetroPlayer/savestates/SavestateDefines.h"
#include "cores/RetroPlayer/RetroPlayerUtils.h"
-#include "games/addons/savestates/SavestateDefines.h"
#include "games/tags/GameInfoTag.h"
#include "settings/MediaSettings.h"
#include "utils/StringUtils.h"