aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett Brown <themagnificentmrb@gmail.com>2023-02-23 00:17:11 -0800
committerGarrett Brown <themagnificentmrb@gmail.com>2023-03-02 18:08:56 -0800
commit985c290dfd7b5b06c826dd0aaa72160ef3ce60d3 (patch)
treefc2edcddc20c4f88269cae259fbd5be73dcfbadf
parentbaaf60a5af0164621c9ad330509c256944e20ea0 (diff)
downloadxbmc-985c290dfd7b5b06c826dd0aaa72160ef3ce60d3.tar.xz
Peripherals: Use controller image for peripheral icon by default
-rw-r--r--xbmc/peripherals/devices/Peripheral.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/xbmc/peripherals/devices/Peripheral.cpp b/xbmc/peripherals/devices/Peripheral.cpp
index 1c4a8382e3..103d88dcdc 100644
--- a/xbmc/peripherals/devices/Peripheral.cpp
+++ b/xbmc/peripherals/devices/Peripheral.cpp
@@ -11,6 +11,7 @@
#include "Util.h"
#include "XBDateTime.h"
#include "games/controllers/Controller.h"
+#include "games/controllers/ControllerLayout.h"
#include "guilib/LocalizeStrings.h"
#include "input/joysticks/interfaces/IInputHandler.h"
#include "peripherals/Peripherals.h"
@@ -674,8 +675,13 @@ std::string CPeripheral::GetIcon() const
{
std::string icon;
+ // Try controller profile
+ const GAME::ControllerPtr controller = ControllerProfile();
+ if (controller)
+ icon = controller->Layout().ImagePath();
+
// Try add-on
- if (m_busType == PERIPHERAL_BUS_ADDON)
+ if (icon.empty() && m_busType == PERIPHERAL_BUS_ADDON)
{
CPeripheralBusAddon* bus = static_cast<CPeripheralBusAddon*>(m_bus);
@@ -689,14 +695,6 @@ std::string CPeripheral::GetIcon() const
}
}
- // Try controller profile
- if (icon.empty())
- {
- const GAME::ControllerPtr controller = ControllerProfile();
- if (controller)
- icon = controller->Icon();
- }
-
// Fallback
if (icon.empty())
icon = "DefaultAddon.png";