aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett Brown <themagnificentmrb@gmail.com>2023-12-31 14:08:09 -0800
committerGarrett Brown <themagnificentmrb@gmail.com>2023-12-31 14:08:09 -0800
commitfc9f90371812676461e8fb2e2d8be6cd338f2989 (patch)
tree6ff88c68e8941b9edaa03484f7c66c0d31aa17ca
parentac47cacd6eca96becdc5562a8dceab3fca05ab70 (diff)
[Games] Format with clang-format-14
-rw-r--r--xbmc/games/GameUtils.cpp3
-rw-r--r--xbmc/games/agents/GameAgentManager.cpp43
-rw-r--r--xbmc/games/controllers/dialogs/GUIDialogAxisDetection.cpp5
-rw-r--r--xbmc/games/controllers/dialogs/GUIDialogIgnoreInput.cpp11
-rw-r--r--xbmc/games/controllers/types/ControllerGrid.cpp18
-rw-r--r--xbmc/games/controllers/types/ControllerHub.cpp11
-rw-r--r--xbmc/games/controllers/types/ControllerNode.cpp5
-rw-r--r--xbmc/games/controllers/windows/GUIControllerList.cpp13
-rw-r--r--xbmc/games/ports/input/PortManager.cpp27
-rw-r--r--xbmc/games/ports/types/PortNode.cpp10
-rw-r--r--xbmc/games/ports/windows/GUIPortList.cpp5
11 files changed, 72 insertions, 79 deletions
diff --git a/xbmc/games/GameUtils.cpp b/xbmc/games/GameUtils.cpp
index 7f3a55b8a4..600abe1dbf 100644
--- a/xbmc/games/GameUtils.cpp
+++ b/xbmc/games/GameUtils.cpp
@@ -143,7 +143,8 @@ void CGameUtils::GetGameClients(const CFileItem& file,
// Sort by name
//! @todo Move to presentation code
- auto SortByName = [](const GameClientPtr& lhs, const GameClientPtr& rhs) {
+ auto SortByName = [](const GameClientPtr& lhs, const GameClientPtr& rhs)
+ {
std::string lhsName = lhs->Name();
std::string rhsName = rhs->Name();
diff --git a/xbmc/games/agents/GameAgentManager.cpp b/xbmc/games/agents/GameAgentManager.cpp
index 6657c4a878..9a16384d04 100644
--- a/xbmc/games/agents/GameAgentManager.cpp
+++ b/xbmc/games/agents/GameAgentManager.cpp
@@ -239,9 +239,9 @@ void CGameAgentManager::ProcessKeyboard()
{
CControllerTree controllers = m_gameClient->Input().GetActiveControllerTree();
- auto it = std::find_if(
- controllers.GetPorts().begin(), controllers.GetPorts().end(),
- [](const CPortNode& port) { return port.GetPortType() == PORT_TYPE::KEYBOARD; });
+ auto it = std::find_if(controllers.GetPorts().begin(), controllers.GetPorts().end(),
+ [](const CPortNode& port)
+ { return port.GetPortType() == PORT_TYPE::KEYBOARD; });
PERIPHERALS::PeripheralPtr keyboard = std::move(keyboards.at(0));
m_gameClient->Input().OpenKeyboard(it->GetActiveController().GetController(), keyboard);
@@ -261,9 +261,9 @@ void CGameAgentManager::ProcessMouse()
{
CControllerTree controllers = m_gameClient->Input().GetActiveControllerTree();
- auto it = std::find_if(
- controllers.GetPorts().begin(), controllers.GetPorts().end(),
- [](const CPortNode& port) { return port.GetPortType() == PORT_TYPE::MOUSE; });
+ auto it = std::find_if(controllers.GetPorts().begin(), controllers.GetPorts().end(),
+ [](const CPortNode& port)
+ { return port.GetPortType() == PORT_TYPE::MOUSE; });
PERIPHERALS::PeripheralPtr mouse = std::move(mice.at(0));
m_gameClient->Input().OpenMouse(it->GetActiveController().GetController(), mouse);
@@ -281,10 +281,9 @@ void CGameAgentManager::ProcessAgents(const PERIPHERALS::PeripheralVector& joyst
// Handle new and existing agents
for (const auto& joystick : joysticks)
{
- auto it =
- std::find_if(m_agents.begin(), m_agents.end(), [&joystick](const GameAgentPtr& agent) {
- return agent->GetPeripheralLocation() == joystick->Location();
- });
+ auto it = std::find_if(m_agents.begin(), m_agents.end(),
+ [&joystick](const GameAgentPtr& agent)
+ { return agent->GetPeripheralLocation() == joystick->Location(); });
if (it == m_agents.end())
{
@@ -322,9 +321,8 @@ void CGameAgentManager::ProcessAgents(const PERIPHERALS::PeripheralVector& joyst
for (const auto& agent : m_agents)
{
auto it = std::find_if(joysticks.begin(), joysticks.end(),
- [&agent](const PERIPHERALS::PeripheralPtr& joystick) {
- return agent->GetPeripheralLocation() == joystick->Location();
- });
+ [&agent](const PERIPHERALS::PeripheralPtr& joystick)
+ { return agent->GetPeripheralLocation() == joystick->Location(); });
if (it == joysticks.end())
expiredJoysticks.emplace_back(agent->GetPeripheralLocation());
@@ -332,9 +330,8 @@ void CGameAgentManager::ProcessAgents(const PERIPHERALS::PeripheralVector& joyst
for (const std::string& expiredJoystick : expiredJoysticks)
{
auto it = std::find_if(m_agents.begin(), m_agents.end(),
- [&expiredJoystick](const GameAgentPtr& agent) {
- return agent->GetPeripheralLocation() == expiredJoystick;
- });
+ [&expiredJoystick](const GameAgentPtr& agent)
+ { return agent->GetPeripheralLocation() == expiredJoystick; });
if (it != m_agents.end())
{
if (!inputHandlingLock)
@@ -364,7 +361,8 @@ void CGameAgentManager::UpdateExpiredJoysticks(const PERIPHERALS::PeripheralVect
// Search peripheral vector for input provider
auto it2 = std::find_if(joysticks.begin(), joysticks.end(),
- [inputProviderCopy](const PERIPHERALS::PeripheralPtr& joystick) {
+ [inputProviderCopy](const PERIPHERALS::PeripheralPtr& joystick)
+ {
// Upcast peripheral to input interface
JOYSTICK::IInputProvider* peripheralInput = joystick.get();
@@ -482,7 +480,8 @@ CGameAgentManager::PortMap CGameAgentManager::MapJoysticks(
// order.
PERIPHERALS::PeripheralVector availableJoysticks = peripheralJoysticks;
std::sort(availableJoysticks.begin(), availableJoysticks.end(),
- [](const PERIPHERALS::PeripheralPtr& lhs, const PERIPHERALS::PeripheralPtr& rhs) {
+ [](const PERIPHERALS::PeripheralPtr& lhs, const PERIPHERALS::PeripheralPtr& rhs)
+ {
if (lhs->LastActive().IsValid() && !rhs->LastActive().IsValid())
return true;
if (!lhs->LastActive().IsValid() && rhs->LastActive().IsValid())
@@ -515,9 +514,8 @@ CGameAgentManager::PortMap CGameAgentManager::MapJoysticks(
// Find peripheral with matching source location
itJoystick = std::find_if(availableJoysticks.begin(), availableJoysticks.end(),
- [&currentPeripheral](const PERIPHERALS::PeripheralPtr& joystick) {
- return joystick->Location() == currentPeripheral;
- });
+ [&currentPeripheral](const PERIPHERALS::PeripheralPtr& joystick)
+ { return joystick->Location() == currentPeripheral; });
}
if (itJoystick == availableJoysticks.end())
@@ -525,7 +523,8 @@ CGameAgentManager::PortMap CGameAgentManager::MapJoysticks(
// Get the next most recently active joystick that doesn't have a current port
itJoystick = std::find_if(
availableJoysticks.begin(), availableJoysticks.end(),
- [&currentPeripherals, &gameClientjoysticks](const PERIPHERALS::PeripheralPtr& joystick) {
+ [&currentPeripherals, &gameClientjoysticks](const PERIPHERALS::PeripheralPtr& joystick)
+ {
const PeripheralLocation& joystickLocation = joystick->Location();
// If joystick doesn't have a current port, use it
diff --git a/xbmc/games/controllers/dialogs/GUIDialogAxisDetection.cpp b/xbmc/games/controllers/dialogs/GUIDialogAxisDetection.cpp
index 2052a4cff7..ed83a4c6be 100644
--- a/xbmc/games/controllers/dialogs/GUIDialogAxisDetection.cpp
+++ b/xbmc/games/controllers/dialogs/GUIDialogAxisDetection.cpp
@@ -72,9 +72,8 @@ void CGUIDialogAxisDetection::OnLateAxis(const JOYSTICK::IButtonMap* buttonMap,
void CGUIDialogAxisDetection::AddAxis(const std::string& deviceLocation, unsigned int axisIndex)
{
auto it = std::find_if(m_detectedAxes.begin(), m_detectedAxes.end(),
- [&deviceLocation, axisIndex](const AxisEntry& axis) {
- return axis.first == deviceLocation && axis.second == axisIndex;
- });
+ [&deviceLocation, axisIndex](const AxisEntry& axis)
+ { return axis.first == deviceLocation && axis.second == axisIndex; });
if (it == m_detectedAxes.end())
{
diff --git a/xbmc/games/controllers/dialogs/GUIDialogIgnoreInput.cpp b/xbmc/games/controllers/dialogs/GUIDialogIgnoreInput.cpp
index b5f28d6138..f422763a85 100644
--- a/xbmc/games/controllers/dialogs/GUIDialogIgnoreInput.cpp
+++ b/xbmc/games/controllers/dialogs/GUIDialogIgnoreInput.cpp
@@ -44,9 +44,9 @@ std::string CGUIDialogIgnoreInput::GetDialogText()
std::vector<std::string> primitives;
std::transform(m_capturedPrimitives.begin(), m_capturedPrimitives.end(),
- std::back_inserter(primitives), [](const JOYSTICK::CDriverPrimitive& primitive) {
- return JOYSTICK::CJoystickTranslator::GetPrimitiveName(primitive);
- });
+ std::back_inserter(primitives),
+ [](const JOYSTICK::CDriverPrimitive& primitive)
+ { return JOYSTICK::CJoystickTranslator::GetPrimitiveName(primitive); });
return StringUtils::Format(dialogText, StringUtils::Join(primitives, " | "));
}
@@ -114,9 +114,8 @@ bool CGUIDialogIgnoreInput::AddPrimitive(const JOYSTICK::CDriverPrimitive& primi
if (primitive.Type() == JOYSTICK::PRIMITIVE_TYPE::BUTTON ||
primitive.Type() == JOYSTICK::PRIMITIVE_TYPE::SEMIAXIS)
{
- auto PrimitiveMatch = [&primitive](const JOYSTICK::CDriverPrimitive& other) {
- return primitive.Type() == other.Type() && primitive.Index() == other.Index();
- };
+ auto PrimitiveMatch = [&primitive](const JOYSTICK::CDriverPrimitive& other)
+ { return primitive.Type() == other.Type() && primitive.Index() == other.Index(); };
bValid = std::find_if(m_capturedPrimitives.begin(), m_capturedPrimitives.end(),
PrimitiveMatch) == m_capturedPrimitives.end();
diff --git a/xbmc/games/controllers/types/ControllerGrid.cpp b/xbmc/games/controllers/types/ControllerGrid.cpp
index f718d5a060..0caf54a7ab 100644
--- a/xbmc/games/controllers/types/ControllerGrid.cpp
+++ b/xbmc/games/controllers/types/ControllerGrid.cpp
@@ -48,17 +48,17 @@ unsigned int CControllerGrid::AddPorts(const PortVec& ports, ControllerGrid& gri
{
unsigned int height = 0;
- auto itKeyboard = std::find_if(ports.begin(), ports.end(), [](const CPortNode& port) {
- return port.GetPortType() == PORT_TYPE::KEYBOARD;
- });
+ auto itKeyboard =
+ std::find_if(ports.begin(), ports.end(),
+ [](const CPortNode& port) { return port.GetPortType() == PORT_TYPE::KEYBOARD; });
- auto itMouse = std::find_if(ports.begin(), ports.end(), [](const CPortNode& port) {
- return port.GetPortType() == PORT_TYPE::MOUSE;
- });
+ auto itMouse =
+ std::find_if(ports.begin(), ports.end(),
+ [](const CPortNode& port) { return port.GetPortType() == PORT_TYPE::MOUSE; });
- auto itController = std::find_if(ports.begin(), ports.end(), [](const CPortNode& port) {
- return port.GetPortType() == PORT_TYPE::CONTROLLER;
- });
+ auto itController = std::find_if(ports.begin(), ports.end(),
+ [](const CPortNode& port)
+ { return port.GetPortType() == PORT_TYPE::CONTROLLER; });
// Keyboard and mouse are not allowed to have ports because they might
// overlap with controllers
diff --git a/xbmc/games/controllers/types/ControllerHub.cpp b/xbmc/games/controllers/types/ControllerHub.cpp
index f3aa1e59b0..d39c6e218c 100644
--- a/xbmc/games/controllers/types/ControllerHub.cpp
+++ b/xbmc/games/controllers/types/ControllerHub.cpp
@@ -51,18 +51,17 @@ void CControllerHub::SetPorts(PortVec ports)
bool CControllerHub::IsControllerAccepted(const std::string& controllerId) const
{
- return std::any_of(m_ports.begin(), m_ports.end(), [controllerId](const CPortNode& port) {
- return port.IsControllerAccepted(controllerId);
- });
+ return std::any_of(m_ports.begin(), m_ports.end(),
+ [controllerId](const CPortNode& port)
+ { return port.IsControllerAccepted(controllerId); });
}
bool CControllerHub::IsControllerAccepted(const std::string& portAddress,
const std::string& controllerId) const
{
return std::any_of(m_ports.begin(), m_ports.end(),
- [portAddress, controllerId](const CPortNode& port) {
- return port.IsControllerAccepted(portAddress, controllerId);
- });
+ [portAddress, controllerId](const CPortNode& port)
+ { return port.IsControllerAccepted(portAddress, controllerId); });
}
ControllerVector CControllerHub::GetControllers() const
diff --git a/xbmc/games/controllers/types/ControllerNode.cpp b/xbmc/games/controllers/types/ControllerNode.cpp
index c371474465..d8e41009db 100644
--- a/xbmc/games/controllers/types/ControllerNode.cpp
+++ b/xbmc/games/controllers/types/ControllerNode.cpp
@@ -72,9 +72,8 @@ void CControllerNode::GetControllers(ControllerVector& controllers) const
const ControllerPtr& myController = m_controller;
auto it = std::find_if(controllers.begin(), controllers.end(),
- [&myController](const ControllerPtr& controller) {
- return myController->ID() == controller->ID();
- });
+ [&myController](const ControllerPtr& controller)
+ { return myController->ID() == controller->ID(); });
if (it == controllers.end())
controllers.emplace_back(m_controller);
diff --git a/xbmc/games/controllers/windows/GUIControllerList.cpp b/xbmc/games/controllers/windows/GUIControllerList.cpp
index bcb185d2ae..daa32ba1ae 100644
--- a/xbmc/games/controllers/windows/GUIControllerList.cpp
+++ b/xbmc/games/controllers/windows/GUIControllerList.cpp
@@ -188,9 +188,8 @@ bool CGUIControllerList::RefreshControllers(void)
if (!m_controllerId.empty())
{
newControllers.erase(std::remove_if(newControllers.begin(), newControllers.end(),
- [this](const ControllerPtr& controller) {
- return controller->ID() != m_controllerId;
- }),
+ [this](const ControllerPtr& controller)
+ { return controller->ID() != m_controllerId; }),
newControllers.end());
}
// Filter by current game add-on
@@ -198,9 +197,8 @@ bool CGUIControllerList::RefreshControllers(void)
{
const CControllerTree& controllers = m_gameClient->Input().GetDefaultControllerTree();
- auto ControllerNotAccepted = [&controllers](const ControllerPtr& controller) {
- return !controllers.IsControllerAccepted(controller->ID());
- };
+ auto ControllerNotAccepted = [&controllers](const ControllerPtr& controller)
+ { return !controllers.IsControllerAccepted(controller->ID()); };
if (!std::all_of(newControllers.begin(), newControllers.end(), ControllerNotAccepted))
newControllers.erase(
@@ -229,7 +227,8 @@ bool CGUIControllerList::RefreshControllers(void)
// Sort add-ons, with default controller first
std::sort(m_controllers.begin(), m_controllers.end(),
- [](const ControllerPtr& i, const ControllerPtr& j) {
+ [](const ControllerPtr& i, const ControllerPtr& j)
+ {
if (i->ID() == DEFAULT_CONTROLLER_ID && j->ID() != DEFAULT_CONTROLLER_ID)
return true;
if (i->ID() != DEFAULT_CONTROLLER_ID && j->ID() == DEFAULT_CONTROLLER_ID)
diff --git a/xbmc/games/ports/input/PortManager.cpp b/xbmc/games/ports/input/PortManager.cpp
index dc2ec76289..4bf9309c45 100644
--- a/xbmc/games/ports/input/PortManager.cpp
+++ b/xbmc/games/ports/input/PortManager.cpp
@@ -105,19 +105,21 @@ void CPortManager::SaveXMLAsync()
m_saveFutures.end());
// Save async
- std::future<void> task = std::async(std::launch::async, [this, ports = std::move(ports)]() {
- CXBMCTinyXML2 doc;
- auto* node = doc.NewElement(XML_ROOT_PORTS);
- if (node == nullptr)
- return;
+ std::future<void> task = std::async(std::launch::async,
+ [this, ports = std::move(ports)]()
+ {
+ CXBMCTinyXML2 doc;
+ auto* node = doc.NewElement(XML_ROOT_PORTS);
+ if (node == nullptr)
+ return;
- SerializePorts(*node, ports);
+ SerializePorts(*node, ports);
- doc.InsertEndChild(node);
+ doc.InsertEndChild(node);
- std::lock_guard<std::mutex> lock(m_saveMutex);
- doc.SaveFile(m_xmlPath);
- });
+ std::lock_guard<std::mutex> lock(m_saveMutex);
+ doc.SaveFile(m_xmlPath);
+ });
m_saveFutures.emplace_back(std::move(task));
}
@@ -249,9 +251,8 @@ void CPortManager::DeserializeControllers(const tinyxml2::XMLElement* pPort,
std::string controllerId = XMLUtils::GetAttribute(pController, XML_ATTR_CONTROLLER_ID);
auto it = std::find_if(controllers.begin(), controllers.end(),
- [&controllerId](const CControllerNode& controller) {
- return controller.GetController()->ID() == controllerId;
- });
+ [&controllerId](const CControllerNode& controller)
+ { return controller.GetController()->ID() == controllerId; });
if (it != controllers.end())
{
CControllerNode& controller = *it;
diff --git a/xbmc/games/ports/types/PortNode.cpp b/xbmc/games/ports/types/PortNode.cpp
index 8da98d4bc0..efb18fce83 100644
--- a/xbmc/games/ports/types/PortNode.cpp
+++ b/xbmc/games/ports/types/PortNode.cpp
@@ -111,9 +111,8 @@ bool CPortNode::IsControllerAccepted(const std::string& controllerId) const
// Visit nodes
return std::any_of(m_controllers.begin(), m_controllers.end(),
- [controllerId](const CControllerNode& node) {
- return node.IsControllerAccepted(controllerId);
- });
+ [controllerId](const CControllerNode& node)
+ { return node.IsControllerAccepted(controllerId); });
}
bool CPortNode::IsControllerAccepted(const std::string& portAddress,
@@ -133,9 +132,8 @@ bool CPortNode::IsControllerAccepted(const std::string& portAddress,
{
// Visit nodes
if (std::any_of(m_controllers.begin(), m_controllers.end(),
- [portAddress, controllerId](const CControllerNode& node) {
- return node.IsControllerAccepted(portAddress, controllerId);
- }))
+ [portAddress, controllerId](const CControllerNode& node)
+ { return node.IsControllerAccepted(portAddress, controllerId); }))
{
bAccepted = true;
}
diff --git a/xbmc/games/ports/windows/GUIPortList.cpp b/xbmc/games/ports/windows/GUIPortList.cpp
index dc686b1a3a..c0e46e0bac 100644
--- a/xbmc/games/ports/windows/GUIPortList.cpp
+++ b/xbmc/games/ports/windows/GUIPortList.cpp
@@ -268,9 +268,8 @@ void CGUIPortList::OnItemSelect(unsigned int itemIndex)
// Check if we should show a "disconnect" option
const bool showDisconnect = !port.IsForceConnected();
- auto callback = [this, port = std::move(port)](const ControllerPtr& controller) {
- OnControllerSelected(port, controller);
- };
+ auto callback = [this, port = std::move(port)](const ControllerPtr& controller)
+ { OnControllerSelected(port, controller); };
m_controllerSelectDialog.Initialize(std::move(controllers), std::move(controller),
showDisconnect, callback);