diff --git a/stepmania/src/RageInput.cpp b/stepmania/src/RageInput.cpp index 4d35f2bfc1..52ce38142c 100644 --- a/stepmania/src/RageInput.cpp +++ b/stepmania/src/RageInput.cpp @@ -3,8 +3,8 @@ #include "RageLog.h" #include "RageException.h" #include "arch/InputHandler/InputHandler.h" - #include "arch/arch.h" +#include "Foreach.h" RageInput* INPUTMAN = NULL; // globally accessable input device @@ -52,6 +52,22 @@ void RageInput::AddHandler( InputHandler *pHandler ) m_pDevices.push_back( pHandler ); } +CString RageInput::GetDeviceSpecificInputString( const DeviceInput &di ) +{ + FOREACH( InputHandler*, m_pDevices, i ) + { + vector vDevices; + vector vDescriptions; + (*i)->GetDevicesAndDescriptions( vDevices, vDescriptions ); + + bool bMatch = find(vDevices.begin(), vDevices.end(), di.device) != vDevices.end(); + if( bMatch ) + return (*i)->GetDeviceSpecificInputString(di); + } + + return di.toString(); +} + // lua start #include "LuaBinding.h" diff --git a/stepmania/src/RageInput.h b/stepmania/src/RageInput.h index 29d306d1b7..a7b3804282 100644 --- a/stepmania/src/RageInput.h +++ b/stepmania/src/RageInput.h @@ -18,6 +18,7 @@ public: void GetDevicesAndDescriptions( vector& vDevicesOut, vector& vsDescriptionsOut ); void WindowReset(); void AddHandler( InputHandler *pHandler ); + CString GetDeviceSpecificInputString( const DeviceInput &di ); // Lua void PushSelf( lua_State *L ); diff --git a/stepmania/src/ScreenDebugOverlay.cpp b/stepmania/src/ScreenDebugOverlay.cpp index 5b78e62701..becf1f4b59 100644 --- a/stepmania/src/ScreenDebugOverlay.cpp +++ b/stepmania/src/ScreenDebugOverlay.cpp @@ -17,6 +17,7 @@ #include "Bookkeeper.h" #include "ProfileManager.h" #include "CodeDetector.h" +#include "RageInput.h" static bool g_bIsDisplayed = false; static bool g_bIsSlow = false; @@ -90,12 +91,11 @@ static MapDebugToDI g_Mappings; static CString GetDebugButtonName( int i ) { - // TODO: Make arch appropriate. vector v; if( g_Mappings.debugButton[i].IsValid() ) - v.push_back( g_Mappings.debugButton[i].toString() ); + v.push_back( INPUTMAN->GetDeviceSpecificInputString(g_Mappings.debugButton[i]) ); if( g_Mappings.gameplayButton[i].IsValid() ) - v.push_back( g_Mappings.gameplayButton[i].toString()+" in gameplay" ); + v.push_back( INPUTMAN->GetDeviceSpecificInputString(g_Mappings.gameplayButton[i])+" in gameplay" ); return join( " or ", v ); } diff --git a/stepmania/src/ScreenTestInput.cpp b/stepmania/src/ScreenTestInput.cpp index 80c644c757..593588adb6 100644 --- a/stepmania/src/ScreenTestInput.cpp +++ b/stepmania/src/ScreenTestInput.cpp @@ -81,7 +81,7 @@ void ScreenTestInput::Update( float fDeltaTime ) continue; CString sTemp; - sTemp += di.toString(); + sTemp += INPUTMAN->GetDeviceSpecificInputString(di); GameInput gi; if( INPUTMAPPER->DeviceToGame(di,gi) )