diff options
author | Garrett Brown <themagnificentmrb@gmail.com> | 2017-10-20 21:16:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-20 21:16:10 -0700 |
commit | 031b112da177208fc43c3cd140db552f017c231b (patch) | |
tree | b0aa75ba0f944a657ae024b68ee8812c99c43d03 | |
parent | b51bf10e0725759047cbcdac88afdc9e2960c89e (diff) | |
parent | b487213d68b5440910eaf1791a43ed760b614c0d (diff) |
Merge pull request #12919 from garbear/rp-viewmode
Add RetroPlayer.ViewMode infolabel
-rw-r--r-- | xbmc/GUIInfoManager.cpp | 55 | ||||
-rw-r--r-- | xbmc/GUIInfoManager.h | 1 | ||||
-rw-r--r-- | xbmc/cores/RetroPlayer/CMakeLists.txt | 8 | ||||
-rw-r--r-- | xbmc/cores/RetroPlayer/RetroPlayerUtils.cpp | 45 | ||||
-rw-r--r-- | xbmc/cores/RetroPlayer/RetroPlayerUtils.h | 34 | ||||
-rw-r--r-- | xbmc/guiinfo/GUIInfoLabels.h | 2 |
6 files changed, 143 insertions, 2 deletions
diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index 886581c258..0439dde177 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -55,6 +55,7 @@ #include "powermanagement/PowerManager.h" #include "settings/AdvancedSettings.h" #include "settings/DisplaySettings.h" +#include "settings/GameSettings.h" #include "settings/MediaSettings.h" #include "settings/Settings.h" #include "settings/SkinSettings.h" @@ -73,6 +74,7 @@ #include <memory> #include <math.h> #include "cores/DataCacheCore.h" +#include "cores/RetroPlayer/RetroPlayerUtils.h" #include "guiinfo/GUIInfoLabels.h" #include "messaging/ApplicationMessenger.h" @@ -117,6 +119,7 @@ #define SYSHEATUPDATEINTERVAL 60000 +using namespace KODI; using namespace XFILE; using namespace MUSIC_INFO; using namespace ADDON; @@ -2181,6 +2184,29 @@ const infomap videoplayer[] = {{ "title", VIDEOPLAYER_TITLE }, { "dbid", VIDEOPLAYER_DBID } }; +/// \page modules__General__List_of_gui_access +/// \section modules__General__List_of_gui_access_RetroPlayer RetroPlayer +/// @{ +/// \table_start +/// \table_h3{ Labels, Type, Description } +/// \table_row3{ <b>`ViewMode`</b>, +/// \anchor RetroPlayer_ViewMode +/// _string_, +/// Returns the view mode of the currently-playing game.\n +/// The following values are possible: +/// - normal +/// - 4:3 +/// - 16:9 +/// - nonlinear +/// - original +/// } +/// \table_end +/// +/// ----------------------------------------------------------------------------- +/// @} +const infomap retroplayer[] = {{ "viewmode", RETROPLAYER_VIEWMODE}, +}; + const infomap player_process[] = { { "videodecoder", PLAYER_PROCESS_VIDEODECODER }, @@ -5550,6 +5576,14 @@ int CGUIInfoManager::TranslateSingleString(const std::string &strCondition, bool return videoplayer[i].val; } } + else if (cat.name == "retroplayer") + { + for (size_t i = 0; i < sizeof(retroplayer) / sizeof(infomap); i++) + { + if (prop.name == retroplayer[i].str) + return retroplayer[i].val; + } + } else if (cat.name == "slideshow") { for (size_t i = 0; i < sizeof(slideshow) / sizeof(infomap); i++) @@ -6192,6 +6226,9 @@ std::string CGUIInfoManager::GetLabel(int info, int contextWindow, std::string * case VIDEOPLAYER_EPISODENAME: strLabel = GetVideoLabel(info); break; + case RETROPLAYER_VIEWMODE: + strLabel = GetGameLabel(info); + break; case VIDEOPLAYER_VIDEO_CODEC: if(g_application.m_pPlayer->IsPlaying()) { @@ -8928,6 +8965,24 @@ std::string CGUIInfoManager::GetVideoLabel(int item) return ""; } +std::string CGUIInfoManager::GetGameLabel(int item) +{ + if (!g_application.m_pPlayer->IsPlaying()) + return ""; + + switch (item) + { + case RETROPLAYER_VIEWMODE: + { + ViewMode viewMode = CMediaSettings::GetInstance().GetCurrentGameSettings().ViewMode(); + return RETRO::CRetroPlayerUtils::ViewModeToDescription(viewMode); + } + default: + break; + } + return ""; +} + int64_t CGUIInfoManager::GetPlayTime() const { int64_t ret = lrint(g_application.GetTime() * 1000); diff --git a/xbmc/GUIInfoManager.h b/xbmc/GUIInfoManager.h index 8b434e7d57..2f132ced81 100644 --- a/xbmc/GUIInfoManager.h +++ b/xbmc/GUIInfoManager.h @@ -173,6 +173,7 @@ public: std::string GetMusicLabel(int item); std::string GetMusicTagLabel(int info, const CFileItem *item); std::string GetVideoLabel(int item); + std::string GetGameLabel(int item); std::string GetPlaylistLabel(int item, int playlistid = -1 /* PLAYLIST_NONE */) const; std::string GetMusicPartyModeLabel(int item); const std::string GetMusicPlaylistInfo(const GUIInfo& info); diff --git a/xbmc/cores/RetroPlayer/CMakeLists.txt b/xbmc/cores/RetroPlayer/CMakeLists.txt index b3501e36d3..96feb17dab 100644 --- a/xbmc/cores/RetroPlayer/CMakeLists.txt +++ b/xbmc/cores/RetroPlayer/CMakeLists.txt @@ -2,13 +2,17 @@ set(SOURCES RetroPlayer.cpp RetroPlayerAudio.cpp RetroPlayerAutoSave.cpp RetroPlayerInput.cpp - RetroPlayerVideo.cpp) + RetroPlayerUtils.cpp + RetroPlayerVideo.cpp +) set(HEADERS RetroPlayer.h RetroPlayerAudio.h RetroPlayerAutoSave.h RetroPlayerInput.h RetroPlayerTypes.h - RetroPlayerVideo.h) + RetroPlayerUtils.h + RetroPlayerVideo.h +) core_add_library(retroplayer) diff --git a/xbmc/cores/RetroPlayer/RetroPlayerUtils.cpp b/xbmc/cores/RetroPlayer/RetroPlayerUtils.cpp new file mode 100644 index 0000000000..c91ebe45d9 --- /dev/null +++ b/xbmc/cores/RetroPlayer/RetroPlayerUtils.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2017 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Program; see the file COPYING. If not, see + * <http://www.gnu.org/licenses/>. + * + */ + +#include "RetroPlayerUtils.h" + +using namespace KODI; +using namespace RETRO; + +std::string CRetroPlayerUtils::ViewModeToDescription(ViewMode viewMode) +{ + switch (viewMode) + { + case ViewModeNormal: + return "normal"; + case ViewModeStretch4x3: + return "4:3"; + case ViewModeStretch16x9: + return "16:9"; + case ViewModeStretch16x9Nonlin: + return "nonlinear"; + case ViewModeOriginal: + return "original"; + default: + break; + } + + return ""; +} diff --git a/xbmc/cores/RetroPlayer/RetroPlayerUtils.h b/xbmc/cores/RetroPlayer/RetroPlayerUtils.h new file mode 100644 index 0000000000..f144d357cc --- /dev/null +++ b/xbmc/cores/RetroPlayer/RetroPlayerUtils.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2017 Team Kodi + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this Program; see the file COPYING. If not, see + * <http://www.gnu.org/licenses/>. + * + */ +#pragma once + +#include "cores/IPlayer.h" + +namespace KODI +{ +namespace RETRO +{ + class CRetroPlayerUtils + { + public: + static std::string ViewModeToDescription(ViewMode viewMode); + }; +} +} diff --git a/xbmc/guiinfo/GUIInfoLabels.h b/xbmc/guiinfo/GUIInfoLabels.h index 10aee084a6..c1df5f7d18 100644 --- a/xbmc/guiinfo/GUIInfoLabels.h +++ b/xbmc/guiinfo/GUIInfoLabels.h @@ -277,6 +277,8 @@ #define VIDEOPLAYER_USER_RATING 319 #define VIDEOPLAYER_DBID 320 +#define RETROPLAYER_VIEWMODE 330 + #define CONTAINER_HAS_PARENT_ITEM 341 #define CONTAINER_CAN_FILTER 342 #define CONTAINER_CAN_FILTERADVANCED 343 |