From 7ccbfb9610cabb3943524e0029d7d4e3e50d3e5d Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Thu, 29 Nov 2012 10:48:41 +1300 Subject: [input] use fallback windows for translating 'joystick' or gamepad buttons into actions --- xbmc/input/ButtonTranslator.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xbmc/input/ButtonTranslator.cpp b/xbmc/input/ButtonTranslator.cpp index 275f9284ed..788641eda3 100644 --- a/xbmc/input/ButtonTranslator.cpp +++ b/xbmc/input/ButtonTranslator.cpp @@ -814,9 +814,16 @@ bool CButtonTranslator::TranslateJoystickString(int window, const char* szDevice // try to get the action from the current window action = GetActionCode(window, id, wmap, strAction, fullrange); - // if it's invalid, try to get it from the global map + // if it's invalid, try to get it from a fallback window or the global map if (action == 0) - action = GetActionCode(-1, id, wmap, strAction, fullrange); + { + int fallbackWindow = GetFallbackWindow(window); + if (fallbackWindow > -1) + action = GetActionCode(fallbackWindow, id, wmap, strAction, fullrange); + // still no valid action? use global map + if (action == 0) + action = GetActionCode(-1, id, wmap, strAction, fullrange); + } return (action > 0); } -- cgit v1.2.3