Skip to content

Commit

Permalink
Merge pull request xbmc#14019 from garbear/rp-geometry
Browse files Browse the repository at this point in the history
Game OSD: Add rotation setting
  • Loading branch information
garbear authored Jun 14, 2018
2 parents 90d8efd + 0464a50 commit 74e2c37
Show file tree
Hide file tree
Showing 68 changed files with 961 additions and 724 deletions.
38 changes: 37 additions & 1 deletion addons/resource.language.en_gb/resources/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -17334,7 +17334,43 @@ 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 ""

#. Label of thumbnail in the in-game menu for stretching the video to fullscreen
#: xbmc/games/dialogs/osd/DialogGameViewMode.h
msgctxt "#35232"
msgid "Fullscreen"
msgstr ""

#empty strings from id 35233 to 35249

#: xbmc/windows/GUIMediaWindow.cpp
msgctxt "#35250"
Expand Down
11 changes: 9 additions & 2 deletions addons/skin.estuary/xml/Custom_1101_SettingsList.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down
3 changes: 2 additions & 1 deletion addons/skin.estuary/xml/DialogSelect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
2 changes: 1 addition & 1 deletion addons/skin.estuary/xml/GameOSD.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
12 changes: 8 additions & 4 deletions addons/skin.estuary/xml/Includes_DialogSelect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@
<control type="gamewindow">
<width>444</width>
<height>250</height>
<scalingmethod>$INFO[ListItem.Property(game.scalingmethod)]</scalingmethod>
<videofilter>$INFO[ListItem.Property(game.videofilter)]</videofilter>
<viewmode>$INFO[ListItem.Property(game.viewmode)]</viewmode>
<rotation>$INFO[ListItem.Property(game.videorotation)]</rotation>
</control>
<control type="label">
<top>250</top>
Expand Down Expand Up @@ -218,8 +219,9 @@
<control type="gamewindow">
<width>444</width>
<height>250</height>
<scalingmethod>$INFO[ListItem.Property(game.scalingmethod)]</scalingmethod>
<videofilter>$INFO[ListItem.Property(game.videofilter)]</videofilter>
<viewmode>$INFO[ListItem.Property(game.viewmode)]</viewmode>
<rotation>$INFO[ListItem.Property(game.videorotation)]</rotation>
</control>
<control type="label">
<top>250</top>
Expand Down Expand Up @@ -292,8 +294,9 @@
<control type="gamewindow">
<width>444</width>
<height>250</height>
<scalingmethod>$INFO[ListItem.Property(game.scalingmethod)]</scalingmethod>
<videofilter>$INFO[ListItem.Property(game.videofilter)]</videofilter>
<viewmode>$INFO[ListItem.Property(game.viewmode)]</viewmode>
<rotation>$INFO[ListItem.Property(game.videorotation)]</rotation>
</control>
<control type="label">
<top>250</top>
Expand Down Expand Up @@ -322,8 +325,9 @@
<control type="gamewindow">
<width>444</width>
<height>250</height>
<scalingmethod>$INFO[ListItem.Property(game.scalingmethod)]</scalingmethod>
<videofilter>$INFO[ListItem.Property(game.videofilter)]</videofilter>
<viewmode>$INFO[ListItem.Property(game.viewmode)]</viewmode>
<rotation>$INFO[ListItem.Property(game.videorotation)]</rotation>
</control>
<control type="label">
<top>250</top>
Expand Down
3 changes: 1 addition & 2 deletions xbmc/GUIInfoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2081,8 +2081,7 @@ const infomap videoplayer[] = {{ "title", VIDEOPLAYER_TITLE },
/// The following values are possible:
/// - normal
/// - 4:3
/// - 16:9
/// - nonlinear
/// - fullscreen
/// - original
/// }
/// \table_end
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set(SOURCES DataCacheCore.cpp

set(HEADERS DataCacheCore.h
FFmpeg.h
GameSettings.h
IPlayer.h
IPlayerCallback.h
VideoSettings.h)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 Team Kodi
* Copyright (C) 2017-2018 Team Kodi
* http://kodi.tv
*
* This Program is free software; you can redistribute it and/or modify
Expand All @@ -17,29 +17,39 @@
* <http://www.gnu.org/licenses/>.
*
*/
#pragma once

#include "RenderGeometry.h"
#include "settings/GameSettings.h"
#include "settings/MediaSettings.h"

using namespace KODI;
using namespace RETRO;

CRenderGeometry::CRenderGeometry(const CRect &dimensions) :
m_dimensions(dimensions)
namespace KODI
{
namespace RETRO
{
}

void CRenderGeometry::Reset()
// NOTE: Only append
enum class SCALINGMETHOD
{
}
AUTO = 0,
NEAREST = 1,
LINEAR = 2,
MAX = LINEAR
};

bool CRenderGeometry::operator==(const CRenderGeometry &rhs) const
// NOTE: Only append
enum class VIEWMODE
{
return m_dimensions == rhs.m_dimensions;
}
Normal = 0,
Stretch4x3 = 1,
Fullscreen = 2,
Original = 3,
Max = Original
};

bool CRenderGeometry::operator<(const CRenderGeometry &rhs) const
enum class RENDERFEATURE
{
return m_dimensions.Area() < rhs.m_dimensions.Area();
ROTATION,
STRETCH,
ZOOM,
PIXEL_RATIO,
};

}
}
14 changes: 6 additions & 8 deletions xbmc/cores/RetroPlayer/RetroPlayerUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,17 @@
using namespace KODI;
using namespace RETRO;

std::string CRetroPlayerUtils::ViewModeToDescription(ViewMode viewMode)
std::string CRetroPlayerUtils::ViewModeToDescription(VIEWMODE viewMode)
{
switch (viewMode)
{
case ViewModeNormal:
case VIEWMODE::Normal:
return "normal";
case ViewModeStretch4x3:
case VIEWMODE::Stretch4x3:
return "4:3";
case ViewModeStretch16x9:
return "16:9";
case ViewModeStretch16x9Nonlin:
return "nonlinear";
case ViewModeOriginal:
case VIEWMODE::Fullscreen:
return "fullscreen";
case VIEWMODE::Original:
return "original";
default:
break;
Expand Down
6 changes: 4 additions & 2 deletions xbmc/cores/RetroPlayer/RetroPlayerUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

#pragma once

#include "cores/IPlayer.h"
#include "cores/GameSettings.h"

#include <string>

namespace KODI
{
Expand All @@ -29,7 +31,7 @@ namespace RETRO
class CRetroPlayerUtils
{
public:
static std::string ViewModeToDescription(ViewMode viewMode);
static std::string ViewModeToDescription(VIEWMODE viewMode);
};
}
}
2 changes: 0 additions & 2 deletions xbmc/cores/RetroPlayer/buffers/IRenderBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

#pragma once

#include "cores/IPlayer.h"

extern "C" {
#include "libavutil/pixfmt.h"
}
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/RetroPlayer/buffers/RenderBufferManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ std::string CRenderBufferManager::GetRenderSystemName(IRenderBufferPool *renderB
return "";
}

bool CRenderBufferManager::HasScalingMethod(ESCALINGMETHOD scalingMethod) const
bool CRenderBufferManager::HasScalingMethod(SCALINGMETHOD scalingMethod) const
{
CRenderVideoSettings videoSettings;
videoSettings.SetScalingMethod(scalingMethod);
Expand Down
6 changes: 2 additions & 4 deletions xbmc/cores/RetroPlayer/buffers/RenderBufferManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#pragma once

#include "cores/RetroPlayer/RetroPlayerTypes.h"
#include "cores/IPlayer.h"
#include "cores/GameSettings.h"
#include "threads/CriticalSection.h"

#include <memory>
Expand All @@ -47,11 +47,9 @@ namespace RETRO

std::string GetRenderSystemName(IRenderBufferPool *renderBufferPool) const;

bool HasScalingMethod(ESCALINGMETHOD scalingMethod) const;
bool HasScalingMethod(SCALINGMETHOD scalingMethod) const;

protected:
static std::vector<ESCALINGMETHOD> GetScalingMethods();

struct RenderBufferPools
{
IRendererFactory* factory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using namespace KODI;
using namespace RETRO;

CRenderBufferGuiTexture::CRenderBufferGuiTexture(ESCALINGMETHOD scalingMethod) :
CRenderBufferGuiTexture::CRenderBufferGuiTexture(SCALINGMETHOD scalingMethod) :
m_scalingMethod(scalingMethod)
{
m_textureFormat = XB_FMT_A8R8G8B8;
Expand Down Expand Up @@ -99,13 +99,13 @@ AVPixelFormat CRenderBufferGuiTexture::TranslateFormat(unsigned int textureForma
return AV_PIX_FMT_NONE;
}

TEXTURE_SCALING CRenderBufferGuiTexture::TranslateScalingMethod(ESCALINGMETHOD scalingMethod)
TEXTURE_SCALING CRenderBufferGuiTexture::TranslateScalingMethod(SCALINGMETHOD scalingMethod)
{
switch (scalingMethod)
{
case VS_SCALINGMETHOD_NEAREST:
case SCALINGMETHOD::NEAREST:
return TEXTURE_SCALING::NEAREST;
case VS_SCALINGMETHOD_LINEAR:
case SCALINGMETHOD::LINEAR:
return TEXTURE_SCALING::LINEAR;
default:
break;
Expand Down
8 changes: 4 additions & 4 deletions xbmc/cores/RetroPlayer/buffers/video/RenderBufferGuiTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#pragma once

#include "cores/RetroPlayer/buffers/BaseRenderBuffer.h"
#include "cores/IPlayer.h"
#include "cores/GameSettings.h"
#include "guilib/Texture.h"
#include "guilib/TextureFormats.h"

Expand All @@ -34,7 +34,7 @@ namespace RETRO
class CRenderBufferGuiTexture : public CBaseRenderBuffer
{
public:
CRenderBufferGuiTexture(ESCALINGMETHOD scalingMethod);
CRenderBufferGuiTexture(SCALINGMETHOD scalingMethod);
virtual ~CRenderBufferGuiTexture() = default;

// implementation of IRenderBuffer via CBaseRenderBuffer
Expand All @@ -49,10 +49,10 @@ namespace RETRO

protected:
AVPixelFormat TranslateFormat(unsigned int textureFormat);
TEXTURE_SCALING TranslateScalingMethod(ESCALINGMETHOD scalingMethod);
TEXTURE_SCALING TranslateScalingMethod(SCALINGMETHOD scalingMethod);

// Texture parameters
ESCALINGMETHOD m_scalingMethod;
SCALINGMETHOD m_scalingMethod;
unsigned int m_textureFormat = XB_FMT_UNKNOWN;
std::unique_ptr<CTexture> m_texture;
};
Expand Down
4 changes: 2 additions & 2 deletions xbmc/cores/RetroPlayer/guibridge/GUIGameRenderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ bool CGUIGameRenderManager::IsPlayingGame()
return m_callback != nullptr;
}

bool CGUIGameRenderManager::SupportsRenderFeature(ERENDERFEATURE feature)
bool CGUIGameRenderManager::SupportsRenderFeature(RENDERFEATURE feature)
{
CSingleLock lock(m_callbackMutex);

Expand All @@ -199,7 +199,7 @@ bool CGUIGameRenderManager::SupportsRenderFeature(ERENDERFEATURE feature)
return false;
}

bool CGUIGameRenderManager::SupportsScalingMethod(ESCALINGMETHOD method)
bool CGUIGameRenderManager::SupportsScalingMethod(SCALINGMETHOD method)
{
CSingleLock lock(m_callbackMutex);

Expand Down
Loading

0 comments on commit 74e2c37

Please sign in to comment.