diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index bdfe6e4d33f0a..8315ab08a6ce4 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -5466,6 +5466,7 @@ msgstr ""
#empty strings from id 12374 to 12375
+#: xbmc/games/dialogs/osd/DialogGameAudioSettings.cpp
#: xbmc/settings/dialogs/GUIDialogAudioDSPSettings.cpp
#: xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp
#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp
@@ -5473,6 +5474,7 @@ msgctxt "#12376"
msgid "Set as default for all media"
msgstr ""
+#: xbmc/games/dialogs/osd/DialogGameAudioSettings.cpp
#: xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp
#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp
msgctxt "#12377"
@@ -6508,6 +6510,7 @@ msgstr ""
#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp
#: addons/skin.estuary/xml/Variables.xml
+#: addons/skin.estuary/xml/Custom_1101_SettingsList.xml
#: addons/skin.estuary/xml/Custom_1106_VideoOSDSettings.xml
msgctxt "#13395"
msgid "Video settings"
@@ -16964,7 +16967,48 @@ msgctxt "#35220"
msgid "Game providers"
msgstr ""
-#empty strings from id 35221 to 35249
+#. Title of the game OSD menu
+#: addons/skin.estuary/xml/GameOSD.xml
+msgctxt "#35221"
+msgid "Game Menu"
+msgstr ""
+
+#. Label of button for stopping game playback
+#: addons/skin.estuary/xml/GameOSD.xml
+msgctxt "#35222"
+msgid "Exit"
+msgstr ""
+
+#. Label of button for opening the saved game manager
+#: addons/skin.estuary/xml/GameOSD.xml
+msgctxt "#35223"
+msgid "Saved Games"
+msgstr ""
+
+#. Title of the audio settings window for gameplay
+#: addons/skin.estuary/xml/Custom_1101_SettingsList.xml
+#: xbmc/games/dialogs/osd/DialogGameAudioSettings.cpp
+msgctxt "#35224"
+msgid "Audio settings"
+msgstr ""
+
+#. Label of button for opening the input configuration dialog
+#: addons/skin.estuary/xml/Custom_1101_SettingsList.xml
+msgctxt "#35225"
+msgid "Input settings"
+msgstr ""
+
+#. Label of game menu button for opening the cheat manager
+msgctxt "#35226"
+msgid "Cheats"
+msgstr ""
+
+#. Title of the dialog for game achievements
+msgctxt "#35227"
+msgid "Achievements"
+msgstr ""
+
+#empty strings from id 35230 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 81805648eca12..738b66b6f453b 100644
--- a/addons/skin.estuary/xml/Custom_1101_SettingsList.xml
+++ b/addons/skin.estuary/xml/Custom_1101_SettingsList.xml
@@ -137,6 +137,45 @@
Integer.IsEqual(System.StereoscopicMode,9)
+
+ String.IsEqual(window(home).Property(settingslist_content),game_osd)
+ 700
+ 360
+ 0
+ 11100
+ 11100
+ vertical
+
+ Video settings button
+ 700
+ DialogSettingButton
+
+ ActivateWindow(gamevideosettings)
+
+
+ Audio settings button
+ 700
+ DialogSettingButton
+
+ ActivateWindow(gameaudiosettings)
+
+
+ Input settings button
+ 700
+ DialogSettingButton
+
+ ActivateWindow(gamecontrollers)
+
+
+
diff --git a/addons/skin.estuary/xml/GameOSD.xml b/addons/skin.estuary/xml/GameOSD.xml
new file mode 100644
index 0000000000000..8c54446a6085f
--- /dev/null
+++ b/addons/skin.estuary/xml/GameOSD.xml
@@ -0,0 +1,72 @@
+
+
+ 11101
+ Animation_DialogPopupOpenClose
+
+
+ 50%
+ 560
+ 50%
+ 700
+ !Window.IsActive(1101)
+ VisibleChange
+
+
+
+
+
+
+
+ 0
+ 80
+
+ 700
+ 360
+ 0
+ 11100
+ 11100
+ vertical
+
+ Resume button
+ 700
+ DialogSettingButton
+
+ Dialog.Close(GameOSD)
+
+
+ Restart button
+ 700
+ DialogSettingButton
+
+ PlayerControl(Previous)
+
+
+ Stop button
+ 700
+ DialogSettingButton
+
+ PlayerControl(Stop)
+
+
+
+ Settings button
+ 700
+ DialogSettingButton
+
+ SetProperty(settingslist_content,game_osd,home)
+ SetProperty(settingslist_header,$LOCALIZE[5],home)
+ ActivateWindow(1101)
+
+
+
+
+
+
diff --git a/cmake/treedata/common/games.txt b/cmake/treedata/common/games.txt
index 03d42bc29f1e3..b2faeadd1d367 100644
--- a/cmake/treedata/common/games.txt
+++ b/cmake/treedata/common/games.txt
@@ -7,6 +7,7 @@ xbmc/games/controllers/dialogs games/controllers/dialogs
xbmc/games/controllers/guicontrols games/controllers/guicontrols
xbmc/games/controllers/windows games/controllers/windows
xbmc/games/dialogs games/dialogs
+xbmc/games/dialogs/osd games/dialogs/osd
xbmc/games/ports games/ports
xbmc/games/tags games/tags
xbmc/games/windows games/windows
diff --git a/xbmc/cores/RetroPlayer/RetroPlayer.cpp b/xbmc/cores/RetroPlayer/RetroPlayer.cpp
index 0d0c74ead81e6..673a2803cb7cb 100644
--- a/xbmc/cores/RetroPlayer/RetroPlayer.cpp
+++ b/xbmc/cores/RetroPlayer/RetroPlayer.cpp
@@ -26,6 +26,7 @@
#include "games/addons/GameClient.h"
#include "games/tags/GameInfoTag.h"
#include "games/GameUtils.h"
+#include "settings/MediaSettings.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "utils/MathUtils.h"
@@ -54,6 +55,14 @@ bool CRetroPlayer::OpenFile(const CFileItem& file, const CPlayerOptions& options
std::string redactedPath = CURL::GetRedacted(file.GetPath());
CLog::Log(LOGINFO, "RetroPlayer: Opening: %s", redactedPath.c_str());
+ // Reset game settings
+ CMediaSettings::GetInstance().GetCurrentGameSettings() = CMediaSettings::GetInstance().GetDefaultGameSettings();
+
+ //! @todo - Remove this when RetroPlayer has a renderer
+ CVideoSettings &videoSettings = CMediaSettings::GetInstance().GetCurrentVideoSettings();
+ videoSettings.m_ScalingMethod = CMediaSettings::GetInstance().GetCurrentGameSettings().ScalingMethod();
+ videoSettings.m_ViewMode = CMediaSettings::GetInstance().GetCurrentGameSettings().ViewMode();
+
CSingleLock lock(m_mutex);
if (IsPlaying())
diff --git a/xbmc/games/dialogs/osd/CMakeLists.txt b/xbmc/games/dialogs/osd/CMakeLists.txt
new file mode 100644
index 0000000000000..d729b9d8689e7
--- /dev/null
+++ b/xbmc/games/dialogs/osd/CMakeLists.txt
@@ -0,0 +1,11 @@
+set(SOURCES DialogGameAudioSettings.cpp
+ DialogGameOSD.cpp
+ DialogGameVideoSettings.cpp
+)
+
+set(HEADERS DialogGameAudioSettings.h
+ DialogGameOSD.h
+ DialogGameVideoSettings.h
+)
+
+core_add_library(gameosddialogs)
diff --git a/xbmc/games/dialogs/osd/DialogGameAudioSettings.cpp b/xbmc/games/dialogs/osd/DialogGameAudioSettings.cpp
new file mode 100644
index 0000000000000..e6f07f5209d4f
--- /dev/null
+++ b/xbmc/games/dialogs/osd/DialogGameAudioSettings.cpp
@@ -0,0 +1,166 @@
+/*
+ * 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
+ * .
+ *
+ */
+
+#include "DialogGameAudioSettings.h"
+#include "cores/AudioEngine/Utils/AEUtil.h"
+#include "dialogs/GUIDialogYesNo.h"
+#include "guilib/GUIWindowManager.h"
+#include "guilib/LocalizeStrings.h"
+#include "guilib/WindowIDs.h"
+#include "profiles/ProfilesManager.h"
+#include "settings/lib/Setting.h"
+#include "settings/lib/SettingsManager.h"
+#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
+#include "utils/log.h"
+#include "utils/StringUtils.h"
+#include "Application.h"
+#include "ServiceBroker.h"
+
+using namespace KODI;
+using namespace GAME;
+
+// Audio settings
+#define SETTING_GAME_VOLUME "game.volume"
+#define SETTING_GAME_DSP "game.dsp"
+
+// Audio actions
+#define SETTING_GAME_MAKE_DEFAULT "game.makedefault"
+
+CDialogGameAudioSettings::CDialogGameAudioSettings() :
+ CGUIDialogSettingsManualBase(WINDOW_DIALOG_GAME_AUDIO_SETTINGS, "DialogSettings.xml")
+{
+}
+
+void CDialogGameAudioSettings::FrameMove()
+{
+ // Update the volume setting if necessary
+ float newVolume = g_application.GetVolume(false);
+ if (newVolume != m_volume)
+ GetSettingsManager()->SetNumber(SETTING_GAME_VOLUME, newVolume);
+
+ CGUIDialogSettingsManualBase::FrameMove();
+}
+
+void CDialogGameAudioSettings::OnSettingChanged(std::shared_ptr setting)
+{
+ if (!setting)
+ return;
+
+ CGUIDialogSettingsManualBase::OnSettingChanged(setting);
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == SETTING_GAME_VOLUME)
+ {
+ m_volume = static_cast(std::static_pointer_cast(setting)->GetValue());
+ g_application.SetVolume(m_volume, false); // false - value is not in percent
+ }
+}
+
+void CDialogGameAudioSettings::OnSettingAction(std::shared_ptr setting)
+{
+ if (!setting)
+ return;
+
+ CGUIDialogSettingsManualBase::OnSettingAction(setting);
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == SETTING_GAME_DSP)
+ {
+ g_windowManager.ActivateWindow(WINDOW_DIALOG_AUDIO_DSP_OSD_SETTINGS);
+ }
+ else if (settingId == SETTING_GAME_MAKE_DEFAULT)
+ Save();
+}
+
+void CDialogGameAudioSettings::Save()
+{
+ if (!g_passwordManager.CheckSettingLevelLock(SettingLevel::Expert) &&
+ CProfilesManager::GetInstance().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
+ return;
+
+ // Prompt user if they are sure
+ // "Set as default for all media"
+ // "This will reset any previously saved values. Are you sure?"
+ if (!CGUIDialogYesNo::ShowAndGetInput(CVariant{12376}, CVariant{12377}))
+ return;
+
+ CMediaSettings::GetInstance().GetDefaultGameSettings() = CMediaSettings::GetInstance().GetCurrentGameSettings();
+ CServiceBroker::GetSettings().Save();
+}
+
+void CDialogGameAudioSettings::SetupView()
+{
+ CGUIDialogSettingsManualBase::SetupView();
+
+ SetHeading(35224); // "Audio settings"
+ SET_CONTROL_HIDDEN(CONTROL_SETTINGS_OKAY_BUTTON);
+ SET_CONTROL_HIDDEN(CONTROL_SETTINGS_CUSTOM_BUTTON);
+ SET_CONTROL_LABEL(CONTROL_SETTINGS_CANCEL_BUTTON, 15067); // "Close"
+}
+
+void CDialogGameAudioSettings::InitializeSettings()
+{
+ CGUIDialogSettingsManualBase::InitializeSettings();
+
+ const std::shared_ptr category = AddCategory("gameaudiosettings", -1);
+ if (!category)
+ {
+ CLog::Log(LOGERROR, "CDialogGameAudioSettings: unable to setup settings");
+ return;
+ }
+
+ // Get all necessary setting groups
+ const std::shared_ptr groupAudio = AddGroup(category);
+ if (!groupAudio)
+ {
+ CLog::Log(LOGERROR, "CDialogGameAudioSettings: unable to setup settings");
+ return;
+ }
+ const std::shared_ptr groupActions = AddGroup(category);
+ if (!groupActions)
+ {
+ CLog::Log(LOGERROR, "CDialogGameAudioSettings: unable to setup settings");
+ return;
+ }
+
+ CGameSettings &gameSettings = CMediaSettings::GetInstance().GetCurrentGameSettings();
+
+ m_dspEnabled = CServiceBroker::GetSettings().GetBool(CSettings::SETTING_AUDIOOUTPUT_DSPADDONSENABLED);
+
+ m_volume = g_application.GetVolume(false);
+ std::shared_ptr settingAudioVolume = AddSlider(groupAudio, SETTING_GAME_VOLUME, 13376, SettingLevel::Basic, m_volume, 14054, VOLUME_MINIMUM, VOLUME_MAXIMUM / 100.0f, VOLUME_MAXIMUM);
+ std::static_pointer_cast(settingAudioVolume->GetControl())->SetFormatter(SettingFormatterPercentAsDecibel);
+
+ if (m_dspEnabled)
+ AddButton(groupAudio, SETTING_GAME_DSP, 24136, SettingLevel::Basic);
+}
+
+std::string CDialogGameAudioSettings::SettingFormatterPercentAsDecibel(std::shared_ptr control, const CVariant &value, const CVariant &minimum, const CVariant &step, const CVariant &maximum)
+{
+ if (!control || !value.isDouble())
+ return "";
+
+ std::string formatString = control->GetFormatString();
+ if (control->GetFormatLabel() > -1)
+ formatString = g_localizeStrings.Get(control->GetFormatLabel());
+
+ return StringUtils::Format(formatString.c_str(), CAEUtil::PercentToGain(value.asFloat()));
+}
diff --git a/xbmc/games/dialogs/osd/DialogGameAudioSettings.h b/xbmc/games/dialogs/osd/DialogGameAudioSettings.h
new file mode 100644
index 0000000000000..ad2a647655d38
--- /dev/null
+++ b/xbmc/games/dialogs/osd/DialogGameAudioSettings.h
@@ -0,0 +1,65 @@
+#pragma once
+
+/*
+ * Copyright (C) 2005-2014 Team XBMC
+ * http://xbmc.org
+ *
+ * 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 XBMC; see the file COPYING. If not, see
+ * .
+ *
+ */
+
+#include "settings/dialogs/GUIDialogSettingsManualBase.h"
+
+#include
+#include
+#include
+
+class CVariant;
+
+namespace KODI
+{
+namespace GAME
+{
+ class CDialogGameAudioSettings : public CGUIDialogSettingsManualBase
+ {
+ public:
+ CDialogGameAudioSettings();
+ virtual ~CDialogGameAudioSettings() = default;
+
+ // specialization of CGUIWindow via CGUIDialogSettingsManualBase
+ virtual void FrameMove();
+
+ protected:
+ // implementations of ISettingCallback via CGUIDialogSettingsManualBase
+ virtual void OnSettingChanged(std::shared_ptr setting);
+ virtual void OnSettingAction(std::shared_ptr setting);
+
+ // specialization of CGUIDialogSettingsBase via CGUIDialogSettingsManualBase
+ virtual bool AllowResettingSettings() const { return false; }
+ virtual void Save();
+ virtual void SetupView();
+
+ // specialization of CGUIDialogSettingsManualBase
+ virtual void InitializeSettings();
+
+ // Utility function
+ static std::string SettingFormatterPercentAsDecibel(std::shared_ptr control, const CVariant &value, const CVariant &minimum, const CVariant &step, const CVariant &maximum);
+
+ // External parameters
+ float m_volume = 100.0f; // Application volume
+ bool m_dspEnabled = false; // Value of "AudioDSP enabled" setting
+ };
+}
+}
diff --git a/xbmc/games/dialogs/osd/DialogGameOSD.cpp b/xbmc/games/dialogs/osd/DialogGameOSD.cpp
new file mode 100644
index 0000000000000..7d8b716c87abc
--- /dev/null
+++ b/xbmc/games/dialogs/osd/DialogGameOSD.cpp
@@ -0,0 +1,80 @@
+/*
+ * 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
+ * .
+ *
+ */
+
+#include "DialogGameOSD.h"
+#include "guilib/GUIMessage.h"
+#include "guilib/GUIWindowManager.h"
+#include "input/Action.h"
+#include "input/ActionIDs.h"
+
+using namespace KODI;
+using namespace GAME;
+
+CDialogGameOSD::CDialogGameOSD() :
+ CGUIDialog(WINDOW_DIALOG_GAME_OSD, "GameOSD.xml")
+{
+ // Initialize CGUIWindow
+ m_loadType = KEEP_IN_MEMORY;
+}
+
+bool CDialogGameOSD::OnAction(const CAction &action)
+{
+ switch (action.GetID())
+ {
+ case ACTION_SHOW_OSD:
+ {
+ Close();
+ return true;
+ }
+ case ACTION_PREV_ITEM:
+ case ACTION_STOP:
+ {
+ Close();
+ }
+ default:
+ break;
+ }
+
+ return CGUIDialog::OnAction(action);
+}
+
+bool CDialogGameOSD::OnMessage(CGUIMessage& message)
+{
+ switch (message.GetMessage())
+ {
+ case GUI_MSG_WINDOW_DEINIT: // Fired when OSD is hidden
+ {
+ // Remove our subdialogs if visible
+ CGUIDialog *pDialog = g_windowManager.GetDialog(WINDOW_DIALOG_GAME_VIDEO_SETTINGS);
+ if (pDialog && pDialog->IsDialogRunning())
+ pDialog->Close(true);
+
+ pDialog = g_windowManager.GetDialog(WINDOW_DIALOG_GAME_AUDIO_SETTINGS);
+ if (pDialog && pDialog->IsDialogRunning())
+ pDialog->Close(true);
+
+ break;
+ }
+ default:
+ break;
+ }
+
+ return CGUIDialog::OnMessage(message);
+}
diff --git a/xbmc/games/dialogs/osd/DialogGameOSD.h b/xbmc/games/dialogs/osd/DialogGameOSD.h
new file mode 100644
index 0000000000000..f9ebc59c0a050
--- /dev/null
+++ b/xbmc/games/dialogs/osd/DialogGameOSD.h
@@ -0,0 +1,40 @@
+/*
+ * 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
+ * .
+ *
+ */
+#pragma once
+
+#include "guilib/GUIDialog.h"
+
+namespace KODI
+{
+namespace GAME
+{
+ class CDialogGameOSD : public CGUIDialog
+ {
+ public:
+ CDialogGameOSD();
+
+ virtual ~CDialogGameOSD() = default;
+
+ // implementation of CGUIControl via CGUIDialog
+ virtual bool OnAction(const CAction &action) override;
+ virtual bool OnMessage(CGUIMessage &message) override;
+ };
+}
+}
\ No newline at end of file
diff --git a/xbmc/games/dialogs/osd/DialogGameVideoSettings.cpp b/xbmc/games/dialogs/osd/DialogGameVideoSettings.cpp
new file mode 100644
index 0000000000000..55de03c3a621a
--- /dev/null
+++ b/xbmc/games/dialogs/osd/DialogGameVideoSettings.cpp
@@ -0,0 +1,187 @@
+/*
+ * 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
+ * .
+ *
+ */
+
+#include "DialogGameVideoSettings.h"
+#include "dialogs/GUIDialogYesNo.h"
+#include "guilib/GUIWindowManager.h"
+#include "guilib/WindowIDs.h"
+#include "profiles/ProfilesManager.h"
+#include "settings/lib/Setting.h"
+#include "settings/lib/SettingsManager.h"
+#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
+#include "utils/log.h"
+#include "utils/Variant.h"
+#include "video/ViewModeSettings.h"
+#include "Application.h"
+#include "ApplicationPlayer.h"
+#include "GUIPassword.h"
+#include "ServiceBroker.h"
+
+using namespace KODI;
+using namespace GAME;
+
+// Video dimensions
+#define SETTING_GAME_SCALINGMETHOD "game.scalingmethod"
+#define SETTING_GAME_VIEW_MODE "game.viewmode"
+
+// Video actions
+#define SETTING_GAME_MAKE_DEFAULT "game.save"
+#define SETTING_GAME_CALIBRATION "game.calibration"
+
+CDialogGameVideoSettings::CDialogGameVideoSettings() :
+ CGUIDialogSettingsManualBase(WINDOW_DIALOG_GAME_VIDEO_SETTINGS, "DialogSettings.xml")
+{
+}
+
+void CDialogGameVideoSettings::OnSettingChanged(std::shared_ptr setting)
+{
+ if (!setting)
+ return;
+
+ CGUIDialogSettingsManualBase::OnSettingChanged(setting);
+
+ CGameSettings &gameSettings = CMediaSettings::GetInstance().GetCurrentGameSettings();
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == SETTING_GAME_SCALINGMETHOD)
+ {
+ gameSettings.SetScalingMethod(static_cast(std::static_pointer_cast(setting)->GetValue()));
+
+ //! @todo
+ CVideoSettings &videoSettings = CMediaSettings::GetInstance().GetCurrentVideoSettings();
+ videoSettings.m_ScalingMethod = static_cast(std::static_pointer_cast(setting)->GetValue());
+ }
+ else if (settingId == SETTING_GAME_VIEW_MODE)
+ {
+ gameSettings.SetViewMode(std::static_pointer_cast(setting)->GetValue());
+
+ g_application.m_pPlayer->SetRenderViewMode(gameSettings.ViewMode());
+ }
+}
+
+void CDialogGameVideoSettings::OnSettingAction(std::shared_ptr setting)
+{
+ if (!setting)
+ return;
+
+ CGUIDialogSettingsManualBase::OnSettingChanged(setting);
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == SETTING_GAME_CALIBRATION)
+ {
+ // Launch calibration window
+ if (CProfilesManager::GetInstance().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE &&
+ g_passwordManager.CheckSettingLevelLock(CServiceBroker::GetSettings().GetSetting(CSettings::SETTING_VIDEOSCREEN_GUICALIBRATION)->GetLevel()))
+ return;
+ g_windowManager.ForceActivateWindow(WINDOW_SCREEN_CALIBRATION);
+ }
+ //! @todo implement
+ else if (settingId == SETTING_GAME_MAKE_DEFAULT)
+ Save();
+}
+
+void CDialogGameVideoSettings::Save()
+{
+ if (CProfilesManager::GetInstance().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE &&
+ !g_passwordManager.CheckSettingLevelLock(::SettingLevel::Expert))
+ return;
+
+ // Prompt user if they are sure
+ if (CGUIDialogYesNo::ShowAndGetInput(CVariant(12376), CVariant(12377)))
+ {
+ CMediaSettings::GetInstance().GetDefaultGameSettings() = CMediaSettings::GetInstance().GetCurrentGameSettings();
+ CServiceBroker::GetSettings().Save();
+ }
+}
+
+void CDialogGameVideoSettings::SetupView()
+{
+ CGUIDialogSettingsManualBase::SetupView();
+
+ SetHeading(13395);
+ SET_CONTROL_HIDDEN(CONTROL_SETTINGS_OKAY_BUTTON);
+ SET_CONTROL_HIDDEN(CONTROL_SETTINGS_CUSTOM_BUTTON);
+ SET_CONTROL_LABEL(CONTROL_SETTINGS_CANCEL_BUTTON, 15067);
+}
+
+void CDialogGameVideoSettings::InitializeSettings()
+{
+ CGUIDialogSettingsManualBase::InitializeSettings();
+
+ const std::shared_ptr category = AddCategory("gamevideosettings", -1);
+ if (!category)
+ {
+ CLog::Log(LOGERROR, "CDialogGameVideoSettings: unable to setup settings");
+ return;
+ }
+
+ // Get all necessary setting groups
+ const std::shared_ptr groupVideo = AddGroup(category);
+ if (!groupVideo)
+ {
+ CLog::Log(LOGERROR, "CDialogGameVideoSettings: unable to setup settings");
+ return;
+ }
+ const std::shared_ptr groupActions = AddGroup(category);
+ if (!groupActions)
+ {
+ CLog::Log(LOGERROR, "CDialogGameVideoSettings: unable to setup settings");
+ return;
+ }
+
+ CGameSettings &gameSettings = CMediaSettings::GetInstance().GetCurrentGameSettings();
+
+ TranslatableIntegerSettingOptions entries;
+ entries.push_back(std::make_pair(16301, VS_SCALINGMETHOD_NEAREST));
+ entries.push_back(std::make_pair(16302, VS_SCALINGMETHOD_LINEAR));
+ entries.push_back(std::make_pair(16303, VS_SCALINGMETHOD_CUBIC ));
+ entries.push_back(std::make_pair(16304, VS_SCALINGMETHOD_LANCZOS2));
+ entries.push_back(std::make_pair(16323, VS_SCALINGMETHOD_SPLINE36_FAST));
+ entries.push_back(std::make_pair(16315, VS_SCALINGMETHOD_LANCZOS3_FAST));
+ entries.push_back(std::make_pair(16322, VS_SCALINGMETHOD_SPLINE36));
+ entries.push_back(std::make_pair(16305, VS_SCALINGMETHOD_LANCZOS3));
+ entries.push_back(std::make_pair(16306, VS_SCALINGMETHOD_SINC8));
+// entries.push_back(make_pair(?????, VS_SCALINGMETHOD_NEDI));
+ entries.push_back(std::make_pair(16307, VS_SCALINGMETHOD_BICUBIC_SOFTWARE));
+ entries.push_back(std::make_pair(16308, VS_SCALINGMETHOD_LANCZOS_SOFTWARE));
+ entries.push_back(std::make_pair(16309, VS_SCALINGMETHOD_SINC_SOFTWARE));
+ entries.push_back(std::make_pair(13120, VS_SCALINGMETHOD_VDPAU_HARDWARE));
+ entries.push_back(std::make_pair(16319, VS_SCALINGMETHOD_DXVA_HARDWARE));
+
+ // Remove unsupported methods
+ for(TranslatableIntegerSettingOptions::iterator it = entries.begin(); it != entries.end(); )
+ {
+ if (g_application.m_pPlayer->Supports(static_cast(it->second)))
+ ++it;
+ else
+ it = entries.erase(it);
+ }
+
+ // Video settings
+ AddSpinner(groupVideo, SETTING_GAME_SCALINGMETHOD, 16300, SettingLevel::Basic, static_cast(gameSettings.ScalingMethod()), entries);
+
+ if (g_application.m_pPlayer->Supports(RENDERFEATURE_STRETCH) || g_application.m_pPlayer->Supports(RENDERFEATURE_PIXEL_RATIO))
+ AddList(groupVideo, SETTING_GAME_VIEW_MODE, 629, SettingLevel::Basic, gameSettings.ViewMode(), CViewModeSettings::ViewModesFiller, 629);
+
+ // General settings
+ AddButton(groupActions, SETTING_GAME_MAKE_DEFAULT, 12376, SettingLevel::Basic);
+ AddButton(groupActions, SETTING_GAME_CALIBRATION, 214, SettingLevel::Basic);
+}
diff --git a/xbmc/games/dialogs/osd/DialogGameVideoSettings.h b/xbmc/games/dialogs/osd/DialogGameVideoSettings.h
new file mode 100644
index 0000000000000..7c19dc93fa6f5
--- /dev/null
+++ b/xbmc/games/dialogs/osd/DialogGameVideoSettings.h
@@ -0,0 +1,48 @@
+/*
+ * 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
+ * .
+ *
+ */
+#pragma once
+
+#include "settings/dialogs/GUIDialogSettingsManualBase.h"
+
+namespace KODI
+{
+namespace GAME
+{
+ class CDialogGameVideoSettings : public CGUIDialogSettingsManualBase
+ {
+ public:
+ CDialogGameVideoSettings();
+ virtual ~CDialogGameVideoSettings() = default;
+
+ protected:
+ // implementation of ISettingCallback via CGUIDialogSettingsManualBase
+ virtual void OnSettingChanged(std::shared_ptr setting);
+ virtual void OnSettingAction(std::shared_ptr setting);
+
+ // specialization of CGUIDialogSettingsBase via CGUIDialogSettingsManualBase
+ virtual bool AllowResettingSettings() const { return false; }
+ virtual void Save();
+ virtual void SetupView();
+
+ // specialization of CGUIDialogSettingsManualBase
+ virtual void InitializeSettings();
+ };
+}
+}
diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp
index 1664afec7fa7c..0844ac294500f 100644
--- a/xbmc/guilib/GUIWindowManager.cpp
+++ b/xbmc/guilib/GUIWindowManager.cpp
@@ -149,6 +149,9 @@
#include "games/controllers/windows/GUIControllerWindow.h"
#include "games/dialogs/GUIDialogSavestates.h"
#include "games/windows/GUIWindowGames.h"
+#include "games/dialogs/osd/DialogGameAudioSettings.h"
+#include "games/dialogs/osd/DialogGameOSD.h"
+#include "games/dialogs/osd/DialogGameVideoSettings.h"
using namespace KODI;
using namespace PVR;
@@ -301,6 +304,9 @@ void CGUIWindowManager::CreateWindows()
Add(new GAME::CGUIControllerWindow);
Add(new GAME::CGUIDialogSavestates);
Add(new GAME::CGUIWindowGames);
+ Add(new GAME::CDialogGameOSD);
+ Add(new GAME::CDialogGameVideoSettings);
+ Add(new GAME::CDialogGameAudioSettings);
}
bool CGUIWindowManager::DestroyWindows()
@@ -403,6 +409,9 @@ bool CGUIWindowManager::DestroyWindows()
DestroyWindow(WINDOW_DIALOG_GAME_CONTROLLERS);
DestroyWindow(WINDOW_DIALOG_SAVESTATES);
DestroyWindow(WINDOW_GAMES);
+ DestroyWindow(WINDOW_DIALOG_GAME_OSD);
+ DestroyWindow(WINDOW_DIALOG_GAME_VIDEO_SETTINGS);
+ DestroyWindow(WINDOW_DIALOG_GAME_AUDIO_SETTINGS);
Remove(WINDOW_SETTINGS_SERVICE);
Remove(WINDOW_SETTINGS_MYPVR);
diff --git a/xbmc/guilib/WindowIDs.h b/xbmc/guilib/WindowIDs.h
index feec709ab6db2..4b8df23e1bf9f 100644
--- a/xbmc/guilib/WindowIDs.h
+++ b/xbmc/guilib/WindowIDs.h
@@ -147,6 +147,9 @@
#define WINDOW_DIALOG_GAME_CONTROLLERS 10820
#define WINDOW_GAMES 10821
#define WINDOW_DIALOG_SAVESTATES 10822
+#define WINDOW_DIALOG_GAME_OSD 10823
+#define WINDOW_DIALOG_GAME_VIDEO_SETTINGS 10824
+#define WINDOW_DIALOG_GAME_AUDIO_SETTINGS 10825
//#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 aa223acf1ee62..f459e9788e08a 100644
--- a/xbmc/input/WindowTranslator.cpp
+++ b/xbmc/input/WindowTranslator.cpp
@@ -149,7 +149,10 @@ static const std::map WindowMapping =
{ "addon" , WINDOW_ADDON_START },
{ "eventlog" , WINDOW_EVENT_LOG},
{ "tvtimerrules" , WINDOW_TV_TIMER_RULES},
- { "radiotimerrules" , WINDOW_RADIO_TIMER_RULES}
+ { "radiotimerrules" , WINDOW_RADIO_TIMER_RULES},
+ { "gameosd" , WINDOW_DIALOG_GAME_OSD },
+ { "gamevideosettings" , WINDOW_DIALOG_GAME_VIDEO_SETTINGS },
+ { "gameaudiosettings" , WINDOW_DIALOG_GAME_AUDIO_SETTINGS },
};
struct FallbackWindowMapping
diff --git a/xbmc/settings/CMakeLists.txt b/xbmc/settings/CMakeLists.txt
index 39bd69d652f34..1579ae3612099 100644
--- a/xbmc/settings/CMakeLists.txt
+++ b/xbmc/settings/CMakeLists.txt
@@ -2,6 +2,7 @@ set(SOURCES AdvancedSettings.cpp
AudioDSPSettings.cpp
DiscSettings.cpp
DisplaySettings.cpp
+ GameSettings.cpp
MediaSettings.cpp
MediaSourceSettings.cpp
SettingAddon.cpp
@@ -20,6 +21,7 @@ set(HEADERS AdvancedSettings.h
AudioDSPSettings.h
DiscSettings.h
DisplaySettings.h
+ GameSettings.h
MediaSettings.h
MediaSourceSettings.h
SettingAddon.h
diff --git a/xbmc/settings/GameSettings.cpp b/xbmc/settings/GameSettings.cpp
new file mode 100644
index 0000000000000..9c0bbe94ff6d5
--- /dev/null
+++ b/xbmc/settings/GameSettings.cpp
@@ -0,0 +1,27 @@
+/*
+ * 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
+ * .
+ *
+ */
+
+#include "GameSettings.h"
+
+void CGameSettings::Reset()
+{
+ m_scalingMethod = VS_SCALINGMETHOD_NEAREST;
+ m_viewMode = 0;
+}
diff --git a/xbmc/settings/GameSettings.h b/xbmc/settings/GameSettings.h
new file mode 100644
index 0000000000000..fb1fa806f73c5
--- /dev/null
+++ b/xbmc/settings/GameSettings.h
@@ -0,0 +1,42 @@
+/*
+ * 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
+ * .
+ *
+ */
+#pragma once
+
+#include "cores/IPlayer.h"
+
+class CGameSettings
+{
+public:
+ CGameSettings() { Reset(); }
+
+ // Restore game settings to default
+ void Reset();
+
+ ESCALINGMETHOD ScalingMethod() const { return m_scalingMethod; }
+ void SetScalingMethod(ESCALINGMETHOD scalingMethod) { m_scalingMethod = scalingMethod; }
+
+ int ViewMode() const { return m_viewMode; }
+ void SetViewMode(int viewMode) { m_viewMode = viewMode; }
+
+private:
+ // Video settings
+ ESCALINGMETHOD m_scalingMethod;
+ int m_viewMode;
+};
diff --git a/xbmc/settings/MediaSettings.cpp b/xbmc/settings/MediaSettings.cpp
index 41d111b440902..dd3fd7cd549f5 100644
--- a/xbmc/settings/MediaSettings.cpp
+++ b/xbmc/settings/MediaSettings.cpp
@@ -153,6 +153,19 @@ bool CMediaSettings::Load(const TiXmlNode *settings)
}
}
+ m_defaultGameSettings.Reset();
+ pElement = settings->FirstChildElement("defaultgamesettings");
+ if (pElement != nullptr)
+ {
+ int scalingMethod;
+ if (XMLUtils::GetInt(pElement, "scalingmethod", scalingMethod, VS_SCALINGMETHOD_NEAREST, VS_SCALINGMETHOD_MAX))
+ m_defaultGameSettings.SetScalingMethod(static_cast(scalingMethod));
+
+ int viewMode;
+ if (XMLUtils::GetInt(pElement, "viewmode", viewMode, ViewModeNormal, ViewModeZoom110Width))
+ m_defaultGameSettings.SetViewMode(viewMode);
+ }
+
// mymusic settings
pElement = settings->FirstChildElement("mymusic");
if (pElement != NULL)
@@ -254,6 +267,15 @@ bool CMediaSettings::Save(TiXmlNode *settings) const
}
}
+ // Default game settings
+ TiXmlElement gameSettingsNode("defaultgamesettings");
+ pNode = settings->InsertEndChild(gameSettingsNode);
+ if (pNode == nullptr)
+ return false;
+
+ XMLUtils::SetInt(pNode, "scalingmethod", m_defaultGameSettings.ScalingMethod());
+ XMLUtils::SetInt(pNode, "viewmode", m_defaultGameSettings.ViewMode());
+
// mymusic
pNode = settings->FirstChild("mymusic");
if (pNode == NULL)
diff --git a/xbmc/settings/MediaSettings.h b/xbmc/settings/MediaSettings.h
index f7f5afe1b366f..b64b99df29c39 100644
--- a/xbmc/settings/MediaSettings.h
+++ b/xbmc/settings/MediaSettings.h
@@ -26,6 +26,7 @@
#include "settings/lib/ISettingsHandler.h"
#include "settings/lib/ISubSettings.h"
#include "settings/AudioDSPSettings.h"
+#include "settings/GameSettings.h"
#include "settings/VideoSettings.h"
#include "threads/CriticalSection.h"
@@ -61,6 +62,11 @@ class CMediaSettings : public ISettingCallback, public ISettingsHandler, public
const CAudioSettings& GetCurrentAudioSettings() const { return m_currentAudioSettings; }
CAudioSettings& GetCurrentAudioSettings() { return m_currentAudioSettings; }
+ const CGameSettings& GetDefaultGameSettings() const { return m_defaultGameSettings; }
+ CGameSettings& GetDefaultGameSettings() { return m_defaultGameSettings; }
+ const CGameSettings& GetCurrentGameSettings() const { return m_currentGameSettings; }
+ CGameSettings& GetCurrentGameSettings() { return m_currentGameSettings; }
+
/*! \brief Retrieve the watched mode for the given content type
\param content Current content type
\return the current watch mode for this content type, WATCH_MODE_ALL if the content type is unknown.
@@ -112,6 +118,9 @@ class CMediaSettings : public ISettingCallback, public ISettingsHandler, public
CAudioSettings m_defaultAudioSettings;
CAudioSettings m_currentAudioSettings;
+ CGameSettings m_defaultGameSettings;
+ CGameSettings m_currentGameSettings;
+
typedef std::map WatchedModes;
WatchedModes m_watchedModes;
diff --git a/xbmc/video/windows/GUIWindowFullScreen.cpp b/xbmc/video/windows/GUIWindowFullScreen.cpp
index b3977f6ab6564..5ae72947cfd58 100644
--- a/xbmc/video/windows/GUIWindowFullScreen.cpp
+++ b/xbmc/video/windows/GUIWindowFullScreen.cpp
@@ -449,7 +449,7 @@ void CGUIWindowFullScreen::SeekChapter(int iChapter)
void CGUIWindowFullScreen::ToggleOSD()
{
- CGUIDialogVideoOSD *pOSD = g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_OSD);
+ CGUIDialog *pOSD = g_windowManager.GetWindow(GetOSDWindowID());
if (pOSD)
{
if (pOSD->IsDialogRunning())
@@ -463,10 +463,11 @@ void CGUIWindowFullScreen::ToggleOSD()
void CGUIWindowFullScreen::TriggerOSD()
{
- CGUIDialogVideoOSD *pOSD = g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_OSD);
+ CGUIDialog *pOSD = g_windowManager.GetWindow(GetOSDWindowID());
if (pOSD && !pOSD->IsDialogRunning())
{
- pOSD->SetAutoClose(3000);
+ if (!g_application.m_pPlayer->IsPlayingGame())
+ pOSD->SetAutoClose(3000);
pOSD->Open();
}
}
@@ -475,3 +476,11 @@ bool CGUIWindowFullScreen::HasVisibleControls()
{
return m_controlStats->nCountVisible > 0;
}
+
+int CGUIWindowFullScreen::GetOSDWindowID()
+{
+ if (g_application.m_pPlayer->IsPlayingGame())
+ return WINDOW_DIALOG_GAME_OSD;
+ else
+ return WINDOW_DIALOG_VIDEO_OSD;
+}
diff --git a/xbmc/video/windows/GUIWindowFullScreen.h b/xbmc/video/windows/GUIWindowFullScreen.h
index 5553e94ec82dc..819a816e53af7 100644
--- a/xbmc/video/windows/GUIWindowFullScreen.h
+++ b/xbmc/video/windows/GUIWindowFullScreen.h
@@ -44,6 +44,7 @@ class CGUIWindowFullScreen : public CGUIWindow
void SeekChapter(int iChapter);
void ToggleOSD();
void TriggerOSD();
+ int GetOSDWindowID();
bool m_viewModeChanged;
unsigned int m_dwShowViewModeTimeout;