aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/resource.language.en_gb/resources/strings.po32
-rw-r--r--addons/skin.estuary/xml/Custom_1101_SettingsList.xml11
-rw-r--r--addons/skin.estuary/xml/DialogSelect.xml3
-rw-r--r--addons/skin.estuary/xml/GameOSD.xml2
-rw-r--r--addons/skin.estuary/xml/Includes_DialogSelect.xml4
-rw-r--r--xbmc/cores/RetroPlayer/guibridge/GUIGameSettings.cpp2
-rw-r--r--xbmc/cores/RetroPlayer/guibridge/IGUIRenderSettings.h5
-rw-r--r--xbmc/cores/RetroPlayer/guicontrols/GUIGameControl.cpp17
-rw-r--r--xbmc/cores/RetroPlayer/guicontrols/GUIGameControl.h4
-rw-r--r--xbmc/cores/RetroPlayer/guicontrols/GUIRenderSettings.cpp12
-rw-r--r--xbmc/cores/RetroPlayer/guicontrols/GUIRenderSettings.h2
-rw-r--r--xbmc/cores/RetroPlayer/rendering/RPRenderManager.cpp3
-rw-r--r--xbmc/cores/RetroPlayer/rendering/RenderVideoSettings.cpp7
-rw-r--r--xbmc/cores/RetroPlayer/rendering/RenderVideoSettings.h4
-rw-r--r--xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPBaseRenderer.cpp13
-rw-r--r--xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPBaseRenderer.h1
-rw-r--r--xbmc/games/dialogs/osd/CMakeLists.txt2
-rw-r--r--xbmc/games/dialogs/osd/DialogGameVideoRotation.cpp114
-rw-r--r--xbmc/games/dialogs/osd/DialogGameVideoRotation.h54
-rw-r--r--xbmc/games/dialogs/osd/DialogGameViewMode.h2
-rw-r--r--xbmc/guilib/GUIControlFactory.cpp4
-rw-r--r--xbmc/guilib/GUIWindowManager.cpp3
-rw-r--r--xbmc/guilib/WindowIDs.h1
-rw-r--r--xbmc/input/WindowTranslator.cpp1
-rw-r--r--xbmc/settings/GameSettings.cpp14
-rw-r--r--xbmc/settings/GameSettings.h4
-rw-r--r--xbmc/settings/MediaSettings.cpp5
27 files changed, 316 insertions, 10 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index 4d3f46638c..957f6bf478 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -17334,7 +17334,37 @@ msgctxt "#35226"
msgid "Advanced settings"
msgstr ""
-#empty strings from id 35227 to 35249
+#. Label of button in the in-game menu for changing the video rotation
+#: addons/skin.estuary/xml/Custom_1101_SettingsList.xml
+msgctxt "#35227"
+msgid "Rotation"
+msgstr ""
+
+#. Label of the thumbnail for when the video is not rotated and is displayed normally
+#: xbmc/games/dialogs/osd/DialogGameVideoRotation.cpp
+msgctxt "#35228"
+msgid "0°"
+msgstr ""
+
+#. Label of the thumbnail for when the video is rotated to the right
+#: xbmc/games/dialogs/osd/DialogGameVideoRotation.cpp
+msgctxt "#35229"
+msgid "90°"
+msgstr ""
+
+#. Label of the thumbnail for when the video is rotated upside down
+#: xbmc/games/dialogs/osd/DialogGameVideoRotation.cpp
+msgctxt "#35230"
+msgid "180°"
+msgstr ""
+
+#. Label of the thumbnail for when the video is rotated to the left
+#: xbmc/games/dialogs/osd/DialogGameVideoRotation.cpp
+msgctxt "#35231"
+msgid "270°"
+msgstr ""
+
+#empty strings from id 35232 to 35249
#: xbmc/windows/GUIMediaWindow.cpp
msgctxt "#35250"
diff --git a/addons/skin.estuary/xml/Custom_1101_SettingsList.xml b/addons/skin.estuary/xml/Custom_1101_SettingsList.xml
index 93c308b06c..785e690171 100644
--- a/addons/skin.estuary/xml/Custom_1101_SettingsList.xml
+++ b/addons/skin.estuary/xml/Custom_1101_SettingsList.xml
@@ -8,7 +8,7 @@
<height>460</height>
<centertop>50%</centertop>
<width>700</width>
- <visible>!Window.IsActive(DialogSettings.xml) + !Window.IsActive(DialogSlider.xml) + !Window.IsActive(GameVideoFilter) + !Window.IsActive(GameViewMode) + !Window.IsActive(GameControllers)</visible>
+ <visible>!Window.IsActive(DialogSettings.xml) + !Window.IsActive(DialogSlider.xml) + !Window.IsActive(GameVideoFilter) + !Window.IsActive(GameViewMode) + !Window.IsActive(GameControllers) + !Window.IsActive(GameVideoRotation)</visible>
<animation effect="fade" time="200">VisibleChange</animation>
<include content="DialogBackgroundCommons">
<param name="width" value="700" />
@@ -110,7 +110,7 @@
<defaultcontrol always="true">14101</defaultcontrol>
<visible>String.IsEqual(window(home).Property(settingslist_content),games)</visible>
<width>700</width>
- <height>360</height>
+ <height>430</height>
<itemgap>0</itemgap>
<onup>14100</onup>
<ondown>14100</ondown>
@@ -129,6 +129,13 @@
<label>$LOCALIZE[629]</label>
<onclick>ActivateWindow(GameViewMode)</onclick>
</control>
+ <control type="button" id="14106">
+ <description>Video rotation button</description>
+ <width>700</width>
+ <include>DialogSettingButton</include>
+ <label>$LOCALIZE[35227]</label>
+ <onclick>ActivateWindow(GameVideoRotation)</onclick>
+ </control>
<control type="button" id="14104">
<description>Volume button</description>
<width>700</width>
diff --git a/addons/skin.estuary/xml/DialogSelect.xml b/addons/skin.estuary/xml/DialogSelect.xml
index caaba8e1ee..0570fcd0b9 100644
--- a/addons/skin.estuary/xml/DialogSelect.xml
+++ b/addons/skin.estuary/xml/DialogSelect.xml
@@ -4,8 +4,9 @@
<include>Animation_DialogPopupOpenClose</include>
<depth>DepthOSD</depth>
<controls>
- <include condition="![Window.IsActive(gameviewmode) | Window.IsActive(gamevideofilter)]">DefaultDialogSelectLayout</include>
+ <include condition="![Window.IsActive(gameviewmode) | Window.IsActive(gamevideofilter) | Window.IsActive(gamevideorotation)]">DefaultDialogSelectLayout</include>
<include condition="Window.IsActive(gamevideofilter)">GameDialogSelectFilterLayout</include>
<include condition="Window.IsActive(gameviewmode)">GameDialogSelectViewLayout</include>
+ <include condition="Window.IsActive(gamevideorotation)">GameDialogSelectViewLayout</include>
</controls>
</window>
diff --git a/addons/skin.estuary/xml/GameOSD.xml b/addons/skin.estuary/xml/GameOSD.xml
index 54e89b3acf..ad0e0863c1 100644
--- a/addons/skin.estuary/xml/GameOSD.xml
+++ b/addons/skin.estuary/xml/GameOSD.xml
@@ -8,7 +8,7 @@
<height>400</height>
<centertop>50%</centertop>
<width>700</width>
- <visible>!Window.IsActive(1101) + !Window.IsActive(GameVideoFilter) + !Window.IsActive(GameViewMode) + !Window.IsActive(GameControllers)</visible>
+ <visible>!Window.IsActive(1101) + !Window.IsActive(GameVideoFilter) + !Window.IsActive(GameViewMode) + !Window.IsActive(GameControllers) + !Window.IsActive(GameVideoRotation)</visible>
<animation effect="fade" time="200">VisibleChange</animation>
<include content="DialogBackgroundCommons">
<param name="width" value="700" />
diff --git a/addons/skin.estuary/xml/Includes_DialogSelect.xml b/addons/skin.estuary/xml/Includes_DialogSelect.xml
index d1945bca72..9643b3cedd 100644
--- a/addons/skin.estuary/xml/Includes_DialogSelect.xml
+++ b/addons/skin.estuary/xml/Includes_DialogSelect.xml
@@ -190,6 +190,7 @@
<height>250</height>
<scalingmethod>$INFO[ListItem.Property(game.scalingmethod)]</scalingmethod>
<viewmode>$INFO[ListItem.Property(game.viewmode)]</viewmode>
+ <rotation>$INFO[ListItem.Property(game.videorotation)]</rotation>
</control>
<control type="label">
<top>250</top>
@@ -220,6 +221,7 @@
<height>250</height>
<scalingmethod>$INFO[ListItem.Property(game.scalingmethod)]</scalingmethod>
<viewmode>$INFO[ListItem.Property(game.viewmode)]</viewmode>
+ <rotation>$INFO[ListItem.Property(game.videorotation)]</rotation>
</control>
<control type="label">
<top>250</top>
@@ -294,6 +296,7 @@
<height>250</height>
<scalingmethod>$INFO[ListItem.Property(game.scalingmethod)]</scalingmethod>
<viewmode>$INFO[ListItem.Property(game.viewmode)]</viewmode>
+ <rotation>$INFO[ListItem.Property(game.videorotation)]</rotation>
</control>
<control type="label">
<top>250</top>
@@ -324,6 +327,7 @@
<height>250</height>
<scalingmethod>$INFO[ListItem.Property(game.scalingmethod)]</scalingmethod>
<viewmode>$INFO[ListItem.Property(game.viewmode)]</viewmode>
+ <rotation>$INFO[ListItem.Property(game.videorotation)]</rotation>
</control>
<control type="label">
<top>250</top>
diff --git a/xbmc/cores/RetroPlayer/guibridge/GUIGameSettings.cpp b/xbmc/cores/RetroPlayer/guibridge/GUIGameSettings.cpp
index 58266afb08..e02be1981e 100644
--- a/xbmc/cores/RetroPlayer/guibridge/GUIGameSettings.cpp
+++ b/xbmc/cores/RetroPlayer/guibridge/GUIGameSettings.cpp
@@ -72,6 +72,7 @@ void CGUIGameSettings::UpdateSettings()
// Get settings from GUI
ESCALINGMETHOD scalingMethod = m_guiSettings.ScalingMethod();
ViewMode viewMode = m_guiSettings.ViewMode();
+ unsigned int rotationDegCCW = m_guiSettings.RotationDegCCW();
// Save settings for renderer
if (m_processInfo.HasScalingMethod(scalingMethod))
@@ -79,4 +80,5 @@ void CGUIGameSettings::UpdateSettings()
else
m_renderSettings.VideoSettings().SetScalingMethod(m_processInfo.GetDefaultScalingMethod());
m_renderSettings.VideoSettings().SetRenderViewMode(viewMode);
+ m_renderSettings.VideoSettings().SetRenderRotation(rotationDegCCW);
}
diff --git a/xbmc/cores/RetroPlayer/guibridge/IGUIRenderSettings.h b/xbmc/cores/RetroPlayer/guibridge/IGUIRenderSettings.h
index bddafaa63a..28cff2dcb1 100644
--- a/xbmc/cores/RetroPlayer/guibridge/IGUIRenderSettings.h
+++ b/xbmc/cores/RetroPlayer/guibridge/IGUIRenderSettings.h
@@ -45,6 +45,11 @@ namespace RETRO
virtual bool HasViewMode() const { return true; }
/*!
+ * \brief Returns true if this render target has a video rotation set
+ */
+ virtual bool HasRotation() const { return true; }
+
+ /*!
* \brief Get the settings used to render this target
*
* \return The render settings
diff --git a/xbmc/cores/RetroPlayer/guicontrols/GUIGameControl.cpp b/xbmc/cores/RetroPlayer/guicontrols/GUIGameControl.cpp
index 9671c99920..aa6ec26e76 100644
--- a/xbmc/cores/RetroPlayer/guicontrols/GUIGameControl.cpp
+++ b/xbmc/cores/RetroPlayer/guicontrols/GUIGameControl.cpp
@@ -57,8 +57,10 @@ CGUIGameControl::CGUIGameControl(const CGUIGameControl &other) :
CGUIControl(other),
m_scalingMethodInfo(other.m_scalingMethodInfo),
m_viewModeInfo(other.m_viewModeInfo),
+ m_rotationInfo(other.m_rotationInfo),
m_bHasScalingMethod(other.m_bHasScalingMethod),
m_bHasViewMode(other.m_bHasViewMode),
+ m_bHasRotation(other.m_bHasRotation),
m_renderSettings(new CGUIRenderSettings(*this))
{
m_renderSettings->SetSettings(other.m_renderSettings->GetSettings());
@@ -81,6 +83,11 @@ void CGUIGameControl::SetViewMode(const GUILIB::GUIINFO::CGUIInfoLabel &viewMode
m_viewModeInfo = viewMode;
}
+void CGUIGameControl::SetRotation(const KODI::GUILIB::GUIINFO::CGUIInfoLabel &rotation)
+{
+ m_rotationInfo = rotation;
+}
+
IGUIRenderSettings *CGUIGameControl::GetRenderSettings() const
{
return m_renderSettings.get();
@@ -156,6 +163,15 @@ void CGUIGameControl::UpdateInfo(const CGUIListItem *item /* = nullptr */)
m_renderSettings->SetViewMode(static_cast<ViewMode>(viewMode));
m_bHasViewMode = true;
}
+
+ std::string strRotation = m_rotationInfo.GetItemLabel(item);
+ if (StringUtils::IsNaturalNumber(strRotation))
+ {
+ unsigned int rotation;
+ std::istringstream(std::move(strRotation)) >> rotation;
+ m_renderSettings->SetRotationDegCCW(rotation);
+ m_bHasRotation = true;
+ }
}
}
@@ -163,6 +179,7 @@ void CGUIGameControl::Reset()
{
m_bHasScalingMethod = false;
m_bHasViewMode = false;
+ m_bHasRotation = false;
m_renderSettings->Reset();
}
diff --git a/xbmc/cores/RetroPlayer/guicontrols/GUIGameControl.h b/xbmc/cores/RetroPlayer/guicontrols/GUIGameControl.h
index 6464d6dc3d..bc34a9bda0 100644
--- a/xbmc/cores/RetroPlayer/guicontrols/GUIGameControl.h
+++ b/xbmc/cores/RetroPlayer/guicontrols/GUIGameControl.h
@@ -43,10 +43,12 @@ public:
// GUI functions
void SetScalingMethod(const KODI::GUILIB::GUIINFO::CGUIInfoLabel &scalingMethod);
void SetViewMode(const KODI::GUILIB::GUIINFO::CGUIInfoLabel &viewMode);
+ void SetRotation(const KODI::GUILIB::GUIINFO::CGUIInfoLabel &rotation);
// Rendering functions
bool HasScalingMethod() const { return m_bHasScalingMethod; }
bool HasViewMode() const { return m_bHasViewMode; }
+ bool HasRotation() const { return m_bHasRotation; }
IGUIRenderSettings *GetRenderSettings() const;
// implementation of CGUIControl
@@ -69,10 +71,12 @@ private:
// GUI properties
KODI::GUILIB::GUIINFO::CGUIInfoLabel m_scalingMethodInfo;
KODI::GUILIB::GUIINFO::CGUIInfoLabel m_viewModeInfo;
+ KODI::GUILIB::GUIINFO::CGUIInfoLabel m_rotationInfo;
// Rendering properties
bool m_bHasScalingMethod = false;
bool m_bHasViewMode = false;
+ bool m_bHasRotation = false;
std::unique_ptr<CGUIRenderSettings> m_renderSettings;
std::shared_ptr<CGUIRenderHandle> m_renderHandle;
};
diff --git a/xbmc/cores/RetroPlayer/guicontrols/GUIRenderSettings.cpp b/xbmc/cores/RetroPlayer/guicontrols/GUIRenderSettings.cpp
index 039a4e2146..0b1341fa74 100644
--- a/xbmc/cores/RetroPlayer/guicontrols/GUIRenderSettings.cpp
+++ b/xbmc/cores/RetroPlayer/guicontrols/GUIRenderSettings.cpp
@@ -40,6 +40,11 @@ bool CGUIRenderSettings::HasViewMode() const
return m_guiControl.HasViewMode();
}
+bool CGUIRenderSettings::HasRotation() const
+{
+ return m_guiControl.HasRotation();
+}
+
CRenderSettings CGUIRenderSettings::GetSettings() const
{
CSingleLock lock(m_mutex);
@@ -81,3 +86,10 @@ void CGUIRenderSettings::SetViewMode(ViewMode viewMode)
m_renderSettings.VideoSettings().SetRenderViewMode(viewMode);
}
+
+void CGUIRenderSettings::SetRotationDegCCW(unsigned int rotationDegCCW)
+{
+ CSingleLock lock(m_mutex);
+
+ m_renderSettings.VideoSettings().SetRenderRotation(rotationDegCCW);
+}
diff --git a/xbmc/cores/RetroPlayer/guicontrols/GUIRenderSettings.h b/xbmc/cores/RetroPlayer/guicontrols/GUIRenderSettings.h
index 7981459a75..4a40e4163e 100644
--- a/xbmc/cores/RetroPlayer/guicontrols/GUIRenderSettings.h
+++ b/xbmc/cores/RetroPlayer/guicontrols/GUIRenderSettings.h
@@ -41,6 +41,7 @@ namespace RETRO
// implementation of IGUIRenderSettings
bool HasScalingMethod() const override;
bool HasViewMode() const override;
+ bool HasRotation() const override;
CRenderSettings GetSettings() const override;
// Render functions
@@ -49,6 +50,7 @@ namespace RETRO
void SetGeometry(CRenderGeometry geometry);
void SetScalingMethod(ESCALINGMETHOD scalingMethod);
void SetViewMode(ViewMode viewMode);
+ void SetRotationDegCCW(unsigned int rotationDegCCW);
private:
// Construction parameters
diff --git a/xbmc/cores/RetroPlayer/rendering/RPRenderManager.cpp b/xbmc/cores/RetroPlayer/rendering/RPRenderManager.cpp
index 88c6188d47..fdddf42df2 100644
--- a/xbmc/cores/RetroPlayer/rendering/RPRenderManager.cpp
+++ b/xbmc/cores/RetroPlayer/rendering/RPRenderManager.cpp
@@ -347,6 +347,7 @@ std::shared_ptr<CRPBaseRenderer> CRPRenderManager::GetRenderer(const IGUIRenderS
{
renderer->SetScalingMethod(effectiveRenderSettings.VideoSettings().GetScalingMethod());
renderer->SetViewMode(effectiveRenderSettings.VideoSettings().GetRenderViewMode());
+ renderer->SetRenderRotation(effectiveRenderSettings.VideoSettings().GetRenderRotation());
}
return renderer;
@@ -537,6 +538,8 @@ CRenderVideoSettings CRPRenderManager::GetEffectiveSettings(const IGUIRenderSett
effectiveSettings.SetScalingMethod(settings->GetSettings().VideoSettings().GetScalingMethod());
if (settings->HasViewMode())
effectiveSettings.SetRenderViewMode(settings->GetSettings().VideoSettings().GetRenderViewMode());
+ if (settings->HasRotation())
+ effectiveSettings.SetRenderRotation(settings->GetSettings().VideoSettings().GetRenderRotation());
}
// Sanitize settings
diff --git a/xbmc/cores/RetroPlayer/rendering/RenderVideoSettings.cpp b/xbmc/cores/RetroPlayer/rendering/RenderVideoSettings.cpp
index e96e54b59c..74c7d2b7ec 100644
--- a/xbmc/cores/RetroPlayer/rendering/RenderVideoSettings.cpp
+++ b/xbmc/cores/RetroPlayer/rendering/RenderVideoSettings.cpp
@@ -27,12 +27,14 @@ void CRenderVideoSettings::Reset()
{
m_scalingMethod = VS_SCALINGMETHOD_AUTO;
m_viewMode = ViewModeNormal;
+ m_rotationDegCCW = 0;
}
bool CRenderVideoSettings::operator==(const CRenderVideoSettings &rhs) const
{
return m_scalingMethod == rhs.m_scalingMethod &&
- m_viewMode == rhs.m_viewMode;
+ m_viewMode == rhs.m_viewMode &&
+ m_rotationDegCCW == rhs.m_rotationDegCCW;
}
bool CRenderVideoSettings::operator<(const CRenderVideoSettings &rhs) const
@@ -43,5 +45,8 @@ bool CRenderVideoSettings::operator<(const CRenderVideoSettings &rhs) const
if (m_viewMode < rhs.m_viewMode) return true;
if (m_viewMode > rhs.m_viewMode) return false;
+ if (m_rotationDegCCW < rhs.m_rotationDegCCW) return true;
+ if (m_rotationDegCCW > rhs.m_rotationDegCCW) return false;
+
return false;
}
diff --git a/xbmc/cores/RetroPlayer/rendering/RenderVideoSettings.h b/xbmc/cores/RetroPlayer/rendering/RenderVideoSettings.h
index ff74eab47b..85b20b60e2 100644
--- a/xbmc/cores/RetroPlayer/rendering/RenderVideoSettings.h
+++ b/xbmc/cores/RetroPlayer/rendering/RenderVideoSettings.h
@@ -47,9 +47,13 @@ namespace RETRO
ViewMode GetRenderViewMode() const { return m_viewMode; }
void SetRenderViewMode(ViewMode mode) { m_viewMode = mode; }
+ unsigned int GetRenderRotation() const { return m_rotationDegCCW; }
+ void SetRenderRotation(unsigned int rotationDegCCW) { m_rotationDegCCW = rotationDegCCW; }
+
private:
ESCALINGMETHOD m_scalingMethod;
ViewMode m_viewMode;
+ unsigned int m_rotationDegCCW;
};
}
}
diff --git a/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPBaseRenderer.cpp b/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPBaseRenderer.cpp
index 2bf2130d64..e95e0c0180 100644
--- a/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPBaseRenderer.cpp
+++ b/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPBaseRenderer.cpp
@@ -164,6 +164,11 @@ void CRPBaseRenderer::SetViewMode(ViewMode viewMode)
CalculateViewMode();
}
+void CRPBaseRenderer::SetRenderRotation(unsigned int rotationDegCCW)
+{
+ m_renderSettings.VideoSettings().SetRenderRotation(rotationDegCCW);
+}
+
void CRPBaseRenderer::CalculateViewMode()
{
const ViewMode viewMode = m_renderSettings.VideoSettings().GetRenderViewMode();
@@ -308,6 +313,7 @@ void CRPBaseRenderer::CalculateViewMode()
inline void CRPBaseRenderer::ReorderDrawPoints()
{
const CRect &destRect = m_renderSettings.Geometry().Dimensions();
+ const unsigned int renderRotation = m_renderSettings.VideoSettings().GetRenderRotation();
// 0 - top left, 1 - top right, 2 - bottom right, 3 - bottom left
float origMat[4][2] =
@@ -321,16 +327,17 @@ inline void CRPBaseRenderer::ReorderDrawPoints()
bool changeAspect = false;
int pointOffset = 0;
- switch (m_renderOrientation)
+ const unsigned int renderOrientation = (m_renderOrientation + renderRotation) % 360;
+ switch (renderOrientation)
{
- case 90:
+ case 270:
pointOffset = 1;
changeAspect = true;
break;
case 180:
pointOffset = 2;
break;
- case 270:
+ case 90:
pointOffset = 3;
changeAspect = true;
break;
diff --git a/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPBaseRenderer.h b/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPBaseRenderer.h
index 9fa68bc8fb..9ee144b8c1 100644
--- a/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPBaseRenderer.h
+++ b/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPBaseRenderer.h
@@ -74,6 +74,7 @@ namespace RETRO
// Set render settings
void SetScalingMethod(ESCALINGMETHOD method);
void SetViewMode(ViewMode viewMode);
+ void SetRenderRotation(unsigned int rotationDegCCW);
bool IsVisible() const;
diff --git a/xbmc/games/dialogs/osd/CMakeLists.txt b/xbmc/games/dialogs/osd/CMakeLists.txt
index 6d630cff93..68a365e7e5 100644
--- a/xbmc/games/dialogs/osd/CMakeLists.txt
+++ b/xbmc/games/dialogs/osd/CMakeLists.txt
@@ -1,6 +1,7 @@
set(SOURCES DialogGameAdvancedSettings.cpp
DialogGameOSD.cpp
DialogGameVideoFilter.cpp
+ DialogGameVideoRotation.cpp
DialogGameVideoSelect.cpp
DialogGameViewMode.cpp
DialogGameVolume.cpp
@@ -9,6 +10,7 @@ set(SOURCES DialogGameAdvancedSettings.cpp
set(HEADERS DialogGameAdvancedSettings.h
DialogGameOSD.h
DialogGameVideoFilter.h
+ DialogGameVideoRotation.h
DialogGameVideoSelect.h
DialogGameViewMode.h
DialogGameVolume.h
diff --git a/xbmc/games/dialogs/osd/DialogGameVideoRotation.cpp b/xbmc/games/dialogs/osd/DialogGameVideoRotation.cpp
new file mode 100644
index 0000000000..c0d908e0c7
--- /dev/null
+++ b/xbmc/games/dialogs/osd/DialogGameVideoRotation.cpp
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2018 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 "DialogGameVideoRotation.h"
+#include "guilib/LocalizeStrings.h"
+#include "guilib/WindowIDs.h"
+#include "settings/GameSettings.h"
+#include "settings/MediaSettings.h"
+#include "utils/Variant.h"
+#include "FileItem.h"
+
+using namespace KODI;
+using namespace GAME;
+
+CDialogGameVideoRotation::CDialogGameVideoRotation() :
+ CDialogGameVideoSelect(WINDOW_DIALOG_GAME_VIDEO_ROTATION)
+{
+}
+
+std::string CDialogGameVideoRotation::GetHeading()
+{
+ return g_localizeStrings.Get(35227); // "Rotation"
+}
+
+void CDialogGameVideoRotation::PreInit()
+{
+ m_rotations.clear();
+
+ // Present the user with clockwise rotation
+ m_rotations.push_back(0);
+ m_rotations.push_back(270);
+ m_rotations.push_back(180);
+ m_rotations.push_back(90);
+}
+
+void CDialogGameVideoRotation::GetItems(CFileItemList &items)
+{
+ for (unsigned int rotation : m_rotations)
+ {
+ CFileItemPtr item = std::make_shared<CFileItem>(GetRotationLabel(rotation));
+ item->SetProperty("game.videorotation", CVariant{ rotation });
+ items.Add(std::move(item));
+ }
+}
+
+void CDialogGameVideoRotation::OnItemFocus(unsigned int index)
+{
+ if (index < m_rotations.size())
+ {
+ const unsigned int rotationDegCCW = m_rotations[index];
+
+ CGameSettings &gameSettings = CMediaSettings::GetInstance().GetCurrentGameSettings();
+ if (gameSettings.RotationDegCCW() != rotationDegCCW)
+ {
+ gameSettings.SetRotationDegCCW(rotationDegCCW);
+ gameSettings.NotifyObservers(ObservableMessageSettingsChanged);
+ }
+ }
+}
+
+unsigned int CDialogGameVideoRotation::GetFocusedItem() const
+{
+ CGameSettings &gameSettings = CMediaSettings::GetInstance().GetCurrentGameSettings();
+
+ for (unsigned int i = 0; i < m_rotations.size(); i++)
+ {
+ const unsigned int rotationDegCCW = m_rotations[i];
+ if (rotationDegCCW == gameSettings.RotationDegCCW())
+ return i;
+ }
+
+ return 0;
+}
+
+void CDialogGameVideoRotation::PostExit()
+{
+ m_rotations.clear();
+}
+
+std::string CDialogGameVideoRotation::GetRotationLabel(unsigned int rotationDegCCW)
+{
+ switch (rotationDegCCW)
+ {
+ case 0:
+ return g_localizeStrings.Get(35228); // 0
+ case 90:
+ return g_localizeStrings.Get(35231); // 270
+ case 180:
+ return g_localizeStrings.Get(35230); // 180
+ case 270:
+ return g_localizeStrings.Get(35229); // 90
+ default:
+ break;
+ }
+
+ return "";
+}
diff --git a/xbmc/games/dialogs/osd/DialogGameVideoRotation.h b/xbmc/games/dialogs/osd/DialogGameVideoRotation.h
new file mode 100644
index 0000000000..791abd35fc
--- /dev/null
+++ b/xbmc/games/dialogs/osd/DialogGameVideoRotation.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2018 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 "DialogGameVideoSelect.h"
+
+#include <string>
+#include <vector>
+
+namespace KODI
+{
+namespace GAME
+{
+ class CDialogGameVideoRotation : public CDialogGameVideoSelect
+ {
+ public:
+ CDialogGameVideoRotation();
+ ~CDialogGameVideoRotation() override = default;
+
+ protected:
+ // implementation of CDialogGameVideoSelect
+ std::string GetHeading() override;
+ void PreInit() override;
+ void GetItems(CFileItemList &items) override;
+ void OnItemFocus(unsigned int index) override;
+ unsigned int GetFocusedItem() const override;
+ void PostExit() override;
+
+ private:
+ // Helper functions
+ static std::string GetRotationLabel(unsigned int rotationDegCCW);
+
+ // Dialog parameters
+ std::vector<unsigned int> m_rotations; // Degrees counter-clockwise
+ };
+}
+}
diff --git a/xbmc/games/dialogs/osd/DialogGameViewMode.h b/xbmc/games/dialogs/osd/DialogGameViewMode.h
index a0d23423e5..f6250cafa5 100644
--- a/xbmc/games/dialogs/osd/DialogGameViewMode.h
+++ b/xbmc/games/dialogs/osd/DialogGameViewMode.h
@@ -23,6 +23,8 @@
#include "DialogGameVideoSelect.h"
#include "cores/IPlayer.h"
+#include <vector>
+
namespace KODI
{
namespace GAME
diff --git a/xbmc/guilib/GUIControlFactory.cpp b/xbmc/guilib/GUIControlFactory.cpp
index 188d6fda93..8d60f032ac 100644
--- a/xbmc/guilib/GUIControlFactory.cpp
+++ b/xbmc/guilib/GUIControlFactory.cpp
@@ -1155,6 +1155,10 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl
GUIINFO::CGUIInfoLabel viewMode;
GetInfoLabel(pControlNode, "viewmode", viewMode, parentID);
static_cast<RETRO::CGUIGameControl*>(control)->SetViewMode(viewMode);
+
+ GUIINFO::CGUIInfoLabel rotation;
+ GetInfoLabel(pControlNode, "rotation", rotation, parentID);
+ static_cast<RETRO::CGUIGameControl*>(control)->SetRotation(rotation);
}
break;
case CGUIControl::GUICONTROL_FADELABEL:
diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp
index 6dedfa4464..f7f2cf84ef 100644
--- a/xbmc/guilib/GUIWindowManager.cpp
+++ b/xbmc/guilib/GUIWindowManager.cpp
@@ -159,6 +159,7 @@
#include "games/dialogs/osd/DialogGameAdvancedSettings.h"
#include "games/dialogs/osd/DialogGameOSD.h"
#include "games/dialogs/osd/DialogGameVideoFilter.h"
+#include "games/dialogs/osd/DialogGameVideoRotation.h"
#include "games/dialogs/osd/DialogGameViewMode.h"
#include "games/dialogs/osd/DialogGameVolume.h"
@@ -324,6 +325,7 @@ void CGUIWindowManager::CreateWindows()
Add(new GAME::CDialogGameViewMode);
Add(new GAME::CDialogGameVolume);
Add(new GAME::CDialogGameAdvancedSettings);
+ Add(new GAME::CDialogGameVideoRotation);
Add(new RETRO::CGameWindowFullScreen);
}
@@ -437,6 +439,7 @@ bool CGUIWindowManager::DestroyWindows()
DestroyWindow(WINDOW_DIALOG_GAME_VIEW_MODE);
DestroyWindow(WINDOW_DIALOG_GAME_VOLUME);
DestroyWindow(WINDOW_DIALOG_GAME_ADVANCED_SETTINGS);
+ DestroyWindow(WINDOW_DIALOG_GAME_VIDEO_ROTATION);
DestroyWindow(WINDOW_FULLSCREEN_GAME);
Remove(WINDOW_SETTINGS_SERVICE);
diff --git a/xbmc/guilib/WindowIDs.h b/xbmc/guilib/WindowIDs.h
index 99afceaf44..e5d53be1d0 100644
--- a/xbmc/guilib/WindowIDs.h
+++ b/xbmc/guilib/WindowIDs.h
@@ -161,6 +161,7 @@
#define WINDOW_DIALOG_GAME_VIEW_MODE 10824
#define WINDOW_DIALOG_GAME_VOLUME 10825
#define WINDOW_DIALOG_GAME_ADVANCED_SETTINGS 10826
+#define WINDOW_DIALOG_GAME_VIDEO_ROTATION 10827
//#define WINDOW_VIRTUAL_KEYBOARD 11000
// WINDOW_ID's from 11100 to 11199 reserved for Skins
diff --git a/xbmc/input/WindowTranslator.cpp b/xbmc/input/WindowTranslator.cpp
index b84b95380a..a2b9b5c4cd 100644
--- a/xbmc/input/WindowTranslator.cpp
+++ b/xbmc/input/WindowTranslator.cpp
@@ -160,6 +160,7 @@ const CWindowTranslator::WindowMapByName CWindowTranslator::WindowMappingByName
{ "gameviewmode" , WINDOW_DIALOG_GAME_VIEW_MODE },
{ "gamevolume" , WINDOW_DIALOG_GAME_VOLUME },
{ "gameadvancedsettings" , WINDOW_DIALOG_GAME_ADVANCED_SETTINGS },
+ { "gamevideorotation" , WINDOW_DIALOG_GAME_VIDEO_ROTATION },
};
namespace
diff --git a/xbmc/settings/GameSettings.cpp b/xbmc/settings/GameSettings.cpp
index 2289f3d009..0835fd60d0 100644
--- a/xbmc/settings/GameSettings.cpp
+++ b/xbmc/settings/GameSettings.cpp
@@ -26,6 +26,7 @@ CGameSettings &CGameSettings::operator=(const CGameSettings &rhs)
{
m_scalingMethod = rhs.m_scalingMethod;
m_viewMode = rhs.m_viewMode;
+ m_rotationDegCCW = rhs.m_rotationDegCCW;
}
return *this;
}
@@ -34,12 +35,14 @@ void CGameSettings::Reset()
{
m_scalingMethod = VS_SCALINGMETHOD_AUTO;
m_viewMode = ViewModeNormal;
+ m_rotationDegCCW = 0;
}
bool CGameSettings::operator==(const CGameSettings &rhs) const
{
return m_scalingMethod == rhs.m_scalingMethod &&
- m_viewMode == rhs.m_viewMode;
+ m_viewMode == rhs.m_viewMode &&
+ m_rotationDegCCW == rhs.m_rotationDegCCW;
}
void CGameSettings::SetScalingMethod(ESCALINGMETHOD scalingMethod)
@@ -59,3 +62,12 @@ void CGameSettings::SetViewMode(enum ViewMode viewMode)
SetChanged();
}
}
+
+void CGameSettings::SetRotationDegCCW(unsigned int rotation)
+{
+ if (rotation != m_rotationDegCCW)
+ {
+ m_rotationDegCCW = rotation;
+ SetChanged();
+ }
+}
diff --git a/xbmc/settings/GameSettings.h b/xbmc/settings/GameSettings.h
index 01e8c2ce7f..4341337068 100644
--- a/xbmc/settings/GameSettings.h
+++ b/xbmc/settings/GameSettings.h
@@ -43,8 +43,12 @@ public:
enum ViewMode ViewMode() const { return m_viewMode; }
void SetViewMode(enum ViewMode viewMode);
+ unsigned int RotationDegCCW() const { return m_rotationDegCCW; }
+ void SetRotationDegCCW(unsigned int rotation);
+
private:
// Video settings
ESCALINGMETHOD m_scalingMethod;
enum ViewMode m_viewMode;
+ unsigned int m_rotationDegCCW;
};
diff --git a/xbmc/settings/MediaSettings.cpp b/xbmc/settings/MediaSettings.cpp
index 497730bdef..516d416a4a 100644
--- a/xbmc/settings/MediaSettings.cpp
+++ b/xbmc/settings/MediaSettings.cpp
@@ -141,6 +141,10 @@ bool CMediaSettings::Load(const TiXmlNode *settings)
int viewMode;
if (XMLUtils::GetInt(pElement, "viewmode", viewMode, ViewModeNormal, ViewModeZoom110Width))
m_defaultGameSettings.SetViewMode(static_cast<ViewMode>(viewMode));
+
+ int rotation;
+ if (XMLUtils::GetInt(pElement, "rotation", rotation, 0, 270) && rotation >= 0)
+ m_defaultGameSettings.SetRotationDegCCW(static_cast<unsigned int>(rotation));
}
// mymusic settings
@@ -237,6 +241,7 @@ bool CMediaSettings::Save(TiXmlNode *settings) const
XMLUtils::SetInt(pNode, "scalingmethod", m_defaultGameSettings.ScalingMethod());
XMLUtils::SetInt(pNode, "viewmode", m_defaultGameSettings.ViewMode());
+ XMLUtils::SetInt(pNode, "rotation", m_defaultGameSettings.RotationDegCCW());
// mymusic
pNode = settings->FirstChild("mymusic");