summaryrefslogtreecommitdiffstats
path: root/xbmc/guilib/guiinfo/GamesGUIInfo.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /xbmc/guilib/guiinfo/GamesGUIInfo.cpp
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--xbmc/guilib/guiinfo/GamesGUIInfo.cpp87
1 files changed, 87 insertions, 0 deletions
diff --git a/xbmc/guilib/guiinfo/GamesGUIInfo.cpp b/xbmc/guilib/guiinfo/GamesGUIInfo.cpp
new file mode 100644
index 0000000..5428c3a
--- /dev/null
+++ b/xbmc/guilib/guiinfo/GamesGUIInfo.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "guilib/guiinfo/GamesGUIInfo.h"
+
+#include "FileItem.h"
+#include "Util.h"
+#include "cores/RetroPlayer/RetroPlayerUtils.h"
+#include "games/tags/GameInfoTag.h"
+#include "guilib/guiinfo/GUIInfo.h"
+#include "guilib/guiinfo/GUIInfoLabels.h"
+#include "settings/MediaSettings.h"
+#include "utils/StringUtils.h"
+#include "utils/Variant.h"
+#include "utils/log.h"
+
+using namespace KODI::GUILIB::GUIINFO;
+using namespace KODI::GAME;
+using namespace KODI::RETRO;
+
+//! @todo Savestates were removed from v18
+//#define FILEITEM_PROPERTY_SAVESTATE_DURATION "duration"
+
+bool CGamesGUIInfo::InitCurrentItem(CFileItem *item)
+{
+ if (item && item->IsGame())
+ {
+ CLog::Log(LOGDEBUG, "CGamesGUIInfo::InitCurrentItem({})", item->GetPath());
+
+ item->LoadGameTag();
+ CGameInfoTag* tag = item->GetGameInfoTag(); // creates item if not yet set, so no nullptr checks needed
+
+ if (tag->GetTitle().empty())
+ {
+ // No title in tag, show filename only
+ tag->SetTitle(CUtil::GetTitleFromPath(item->GetPath()));
+ }
+ return true;
+ }
+ return false;
+}
+
+bool CGamesGUIInfo::GetLabel(std::string& value, const CFileItem *item, int contextWindow, const CGUIInfo &info, std::string *fallback) const
+{
+ switch (info.m_info)
+ {
+ ///////////////////////////////////////////////////////////////////////////////////////////////
+ // RETROPLAYER_*
+ ///////////////////////////////////////////////////////////////////////////////////////////////
+ case RETROPLAYER_VIDEO_FILTER:
+ {
+ value = CMediaSettings::GetInstance().GetCurrentGameSettings().VideoFilter();
+ return true;
+ }
+ case RETROPLAYER_STRETCH_MODE:
+ {
+ STRETCHMODE stretchMode = CMediaSettings::GetInstance().GetCurrentGameSettings().StretchMode();
+ value = CRetroPlayerUtils::StretchModeToIdentifier(stretchMode);
+ return true;
+ }
+ case RETROPLAYER_VIDEO_ROTATION:
+ {
+ const unsigned int rotationDegCCW = CMediaSettings::GetInstance().GetCurrentGameSettings().RotationDegCCW();
+ value = std::to_string(rotationDegCCW);
+ return true;
+ }
+ default:
+ break;
+ }
+
+ return false;
+}
+
+bool CGamesGUIInfo::GetInt(int& value, const CGUIListItem *gitem, int contextWindow, const CGUIInfo &info) const
+{
+ return false;
+}
+
+bool CGamesGUIInfo::GetBool(bool& value, const CGUIListItem *gitem, int contextWindow, const CGUIInfo &info) const
+{
+ return false;
+}