aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett Brown <themagnificentmrb@gmail.com>2024-02-08 17:55:33 -0800
committerGitHub <noreply@github.com>2024-02-08 17:55:33 -0800
commitea913daea46ddef5052e9fa7aff3f976eccba60e (patch)
tree880a2809dc5cf1b52667361fcd394db661d9fc36
parente20ee08b4b949a59cb7ac7a20fb82f824e79c284 (diff)
parent7e411667cf8295e56d7cc0b499682471a4b62710 (diff)
Merge pull request #24650 from garbear/game-improvements
Minor game improvements
-rw-r--r--addons/resource.language.en_gb/resources/strings.po11
-rw-r--r--xbmc/games/GameTypes.h6
-rw-r--r--xbmc/games/addons/GameClientProperties.cpp2
-rw-r--r--xbmc/games/agents/input/AgentController.cpp2
-rw-r--r--xbmc/games/agents/input/AgentInput.cpp6
-rw-r--r--xbmc/games/controllers/input/DefaultButtonMap.cpp16
-rw-r--r--xbmc/games/ports/input/PortManager.cpp3
-rw-r--r--xbmc/peripherals/PeripheralTypes.h5
-rw-r--r--xbmc/peripherals/devices/Peripheral.cpp2
-rw-r--r--xbmc/peripherals/devices/Peripheral.h2
-rw-r--r--xbmc/peripherals/devices/PeripheralJoystick.h6
-rw-r--r--xbmc/peripherals/devices/PeripheralKeyboard.h2
-rw-r--r--xbmc/peripherals/devices/PeripheralMouse.h2
13 files changed, 45 insertions, 20 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index 9d6024fc2b..e4505faddf 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -2947,7 +2947,9 @@ msgctxt "#629"
msgid "View mode"
msgstr ""
+#. Label for stretching the displayed video to its normal size
#: system/settings/settings.xml
+#: xbmc/games/dialogs/osd/DialogGameStretchMode.cpp
#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp
msgctxt "#630"
msgid "Normal"
@@ -2959,6 +2961,8 @@ msgctxt "#631"
msgid "Zoom"
msgstr ""
+#. Label for stretching the displayed video to a 4:3 aspect ratio
+#: xbmc/games/dialogs/osd/DialogGameStretchMode.cpp
#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp
msgctxt "#632"
msgid "Stretch 4:3"
@@ -2970,12 +2974,15 @@ msgctxt "#633"
msgid "Wide zoom"
msgstr ""
+#. Label for stretching the displayed video to a 16:9 aspect ratio
#: system/settings/settings.xml
#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp
msgctxt "#634"
msgid "Stretch 16:9"
msgstr ""
+#. Label for stretching the displayed video to the original size of the video stream
+#: xbmc/games/dialogs/osd/DialogGameStretchMode.cpp
#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp
msgctxt "#635"
msgid "Original size"
@@ -18605,14 +18612,14 @@ msgid "270°"
msgstr ""
#. Label of thumbnail in the in-game menu for stretching the video to fullscreen
-#: xbmc/games/dialogs/osd/DialogGameViewMode.h
+#: xbmc/games/dialogs/osd/DialogGameStretchMode.cpp
msgctxt "#35232"
msgid "Fullscreen"
msgstr ""
#. Label of the setting in the in-game menu for stretching the game to fit the monitor
#: addons/skin.estuary/xml/Custom_1101_SettingsList.xml
-#: xbmc/games/dialogs/osdDialogGameViewMode.cpp
+#: xbmc/games/dialogs/osd/DialogGameStretchMode.cpp
msgctxt "#35233"
msgid "Stretch mode"
msgstr ""
diff --git a/xbmc/games/GameTypes.h b/xbmc/games/GameTypes.h
index 76881aa00a..b0cca6c250 100644
--- a/xbmc/games/GameTypes.h
+++ b/xbmc/games/GameTypes.h
@@ -77,5 +77,11 @@ using GameAgentPtr = std::shared_ptr<CGameAgent>;
*/
using GameAgentVec = std::vector<GameAgentPtr>;
+/*!
+ * \ingroup games
+ *
+ * \brief Name of the resources directory for game clients
+ */
+constexpr auto GAME_CLIENT_RESOURCES_DIRECTORY = "resources";
} // namespace GAME
} // namespace KODI
diff --git a/xbmc/games/addons/GameClientProperties.cpp b/xbmc/games/addons/GameClientProperties.cpp
index 4f7273a913..f3d97858bd 100644
--- a/xbmc/games/addons/GameClientProperties.cpp
+++ b/xbmc/games/addons/GameClientProperties.cpp
@@ -32,8 +32,6 @@ using namespace ADDON;
using namespace GAME;
using namespace XFILE;
-#define GAME_CLIENT_RESOURCES_DIRECTORY "resources"
-
CGameClientProperties::CGameClientProperties(const CGameClient& parent, AddonProps_Game& props)
: m_parent(parent), m_properties(props)
{
diff --git a/xbmc/games/agents/input/AgentController.cpp b/xbmc/games/agents/input/AgentController.cpp
index a52921979c..e70f4fa10c 100644
--- a/xbmc/games/agents/input/AgentController.cpp
+++ b/xbmc/games/agents/input/AgentController.cpp
@@ -43,8 +43,6 @@ CAgentController::CAgentController(PERIPHERALS::PeripheralPtr peripheral)
default:
break;
}
-
- Initialize();
}
CAgentController::~CAgentController()
diff --git a/xbmc/games/agents/input/AgentInput.cpp b/xbmc/games/agents/input/AgentInput.cpp
index afef2afe8d..099f0a7cce 100644
--- a/xbmc/games/agents/input/AgentInput.cpp
+++ b/xbmc/games/agents/input/AgentInput.cpp
@@ -439,7 +439,11 @@ void CAgentInput::ProcessAgentControllers(const PERIPHERALS::PeripheralVector& p
if (it == m_controllers.end())
{
// Handle new controller
- m_controllers.emplace_back(std::make_shared<CAgentController>(peripheral));
+ std::shared_ptr<CAgentController> agentController =
+ std::make_shared<CAgentController>(peripheral);
+ agentController->Initialize();
+ m_controllers.emplace_back(std::move(agentController));
+
SetChanged(true);
}
else
diff --git a/xbmc/games/controllers/input/DefaultButtonMap.cpp b/xbmc/games/controllers/input/DefaultButtonMap.cpp
index 54cdac026e..ddf315d734 100644
--- a/xbmc/games/controllers/input/DefaultButtonMap.cpp
+++ b/xbmc/games/controllers/input/DefaultButtonMap.cpp
@@ -37,15 +37,23 @@ bool CDefaultButtonMap::Load()
switch (m_device->Type())
{
case PERIPHERALS::PERIPHERAL_KEYBOARD:
- return m_strControllerId == DEFAULT_KEYBOARD_ID;
+ {
+ if (m_strControllerId == DEFAULT_KEYBOARD_ID)
+ return true;
+ break;
+ }
case PERIPHERALS::PERIPHERAL_MOUSE:
- return m_strControllerId == DEFAULT_MOUSE_ID;
+ {
+ if (m_strControllerId == DEFAULT_MOUSE_ID)
+ return true;
+ break;
+ }
default:
break;
}
- CLog::Log(LOGDEBUG, "Failed to load button map for \"{}\" with profile {}", m_device->Location(),
- m_strControllerId);
+ CLog::Log(LOGDEBUG, "Failed to load default button map for \"{}\" with profile {}",
+ m_device->Location(), m_strControllerId);
return false;
}
diff --git a/xbmc/games/ports/input/PortManager.cpp b/xbmc/games/ports/input/PortManager.cpp
index 4bf9309c45..fb664b7ebc 100644
--- a/xbmc/games/ports/input/PortManager.cpp
+++ b/xbmc/games/ports/input/PortManager.cpp
@@ -67,7 +67,8 @@ void CPortManager::LoadXML()
{
if (!CFileUtils::Exists(m_xmlPath))
{
- CLog::Log(LOGDEBUG, "Can't load port config, file doesn't exist: {}", m_xmlPath);
+ CLog::Log(LOGDEBUG, "Can't load port config, file doesn't exist: {}",
+ CURL::GetRedacted(m_xmlPath));
return;
}
diff --git a/xbmc/peripherals/PeripheralTypes.h b/xbmc/peripherals/PeripheralTypes.h
index 0a7f74c89f..f5785d0cf1 100644
--- a/xbmc/peripherals/PeripheralTypes.h
+++ b/xbmc/peripherals/PeripheralTypes.h
@@ -26,6 +26,11 @@ namespace PERIPHERALS
/// \ingroup peripherals
/// \{
+/*!
+ * \brief Indicates a joystick has no preference for port number
+ */
+constexpr auto JOYSTICK_NO_PORT_REQUESTED = -1;
+
enum PeripheralBusType
{
PERIPHERAL_BUS_UNKNOWN = 0,
diff --git a/xbmc/peripherals/devices/Peripheral.cpp b/xbmc/peripherals/devices/Peripheral.cpp
index 18ea89b77a..bb00d516a3 100644
--- a/xbmc/peripherals/devices/Peripheral.cpp
+++ b/xbmc/peripherals/devices/Peripheral.cpp
@@ -795,7 +795,7 @@ bool CPeripheral::operator!=(const PeripheralScanResult& right) const
return !(*this == right);
}
-CDateTime CPeripheral::LastActive()
+CDateTime CPeripheral::LastActive() const
{
return CDateTime();
}
diff --git a/xbmc/peripherals/devices/Peripheral.h b/xbmc/peripherals/devices/Peripheral.h
index 95acef1344..4977cb65eb 100644
--- a/xbmc/peripherals/devices/Peripheral.h
+++ b/xbmc/peripherals/devices/Peripheral.h
@@ -262,7 +262,7 @@ public:
*
* \return The time of last activation, or invalid if unknown/never active
*/
- virtual CDateTime LastActive();
+ virtual CDateTime LastActive() const;
/*!
* \brief Get the controller profile that best represents this peripheral
diff --git a/xbmc/peripherals/devices/PeripheralJoystick.h b/xbmc/peripherals/devices/PeripheralJoystick.h
index 8dd87ed464..916125b9a8 100644
--- a/xbmc/peripherals/devices/PeripheralJoystick.h
+++ b/xbmc/peripherals/devices/PeripheralJoystick.h
@@ -21,8 +21,6 @@
#include <string>
#include <vector>
-#define JOYSTICK_PORT_UNKNOWN (-1)
-
namespace KODI
{
namespace JOYSTICK
@@ -66,7 +64,7 @@ public:
void UnregisterJoystickDriverHandler(KODI::JOYSTICK::IDriverHandler* handler) override;
KODI::JOYSTICK::IDriverReceiver* GetDriverReceiver() override { return this; }
KODI::KEYMAP::IKeymap* GetKeymap(const std::string& controllerId) override;
- CDateTime LastActive() override { return m_lastActive; }
+ CDateTime LastActive() const override { return m_lastActive; }
KODI::GAME::ControllerPtr ControllerProfile() const override;
void SetControllerProfile(const KODI::GAME::ControllerPtr& controller) override;
@@ -132,7 +130,7 @@ protected:
// State parameters
std::string m_strProvider;
- int m_requestedPort = JOYSTICK_PORT_UNKNOWN;
+ int m_requestedPort{JOYSTICK_NO_PORT_REQUESTED};
unsigned int m_buttonCount = 0;
unsigned int m_hatCount = 0;
unsigned int m_axisCount = 0;
diff --git a/xbmc/peripherals/devices/PeripheralKeyboard.h b/xbmc/peripherals/devices/PeripheralKeyboard.h
index 2c5dea6c68..f1c3927544 100644
--- a/xbmc/peripherals/devices/PeripheralKeyboard.h
+++ b/xbmc/peripherals/devices/PeripheralKeyboard.h
@@ -34,7 +34,7 @@ public:
void RegisterKeyboardDriverHandler(KODI::KEYBOARD::IKeyboardDriverHandler* handler,
bool bPromiscuous) override;
void UnregisterKeyboardDriverHandler(KODI::KEYBOARD::IKeyboardDriverHandler* handler) override;
- CDateTime LastActive() override { return m_lastActive; }
+ CDateTime LastActive() const override { return m_lastActive; }
KODI::GAME::ControllerPtr ControllerProfile() const override;
// implementation of IKeyboardDriverHandler
diff --git a/xbmc/peripherals/devices/PeripheralMouse.h b/xbmc/peripherals/devices/PeripheralMouse.h
index e93ba0abe5..8735a32ffa 100644
--- a/xbmc/peripherals/devices/PeripheralMouse.h
+++ b/xbmc/peripherals/devices/PeripheralMouse.h
@@ -34,7 +34,7 @@ public:
void RegisterMouseDriverHandler(KODI::MOUSE::IMouseDriverHandler* handler,
bool bPromiscuous) override;
void UnregisterMouseDriverHandler(KODI::MOUSE::IMouseDriverHandler* handler) override;
- CDateTime LastActive() override { return m_lastActive; }
+ CDateTime LastActive() const override { return m_lastActive; }
KODI::GAME::ControllerPtr ControllerProfile() const override;
// implementation of IMouseDriverHandler