From c3c4da2d650a346a0c27a8051b31c39323aad681 Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Mon, 23 Sep 2013 15:43:16 -0400 Subject: [PATCH] PIUIO: fix lights mapping for five-panel input Based on info from bug 990. --- src/arch/Lights/LightsDriver_Linux_PIUIO.cpp | 36 +++++++++++++++----- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/src/arch/Lights/LightsDriver_Linux_PIUIO.cpp b/src/arch/Lights/LightsDriver_Linux_PIUIO.cpp index 5174da7fdc..e6f7049e4f 100644 --- a/src/arch/Lights/LightsDriver_Linux_PIUIO.cpp +++ b/src/arch/Lights/LightsDriver_Linux_PIUIO.cpp @@ -6,6 +6,8 @@ #include #include #include "LightsDriver_Linux_PIUIO.h" +#include "GameState.h" +#include "Game.h" #include "RageLog.h" REGISTER_SOUND_DRIVER_CLASS2(PIUIO, Linux_PIUIO); @@ -39,14 +41,30 @@ void LightsDriver_Linux_PIUIO::Set( const LightsState *ls ) if (ls->m_bCabinetLights[LIGHT_MARQUEE_LR_RIGHT]) buf[3] |= 0x01; if (ls->m_bCabinetLights[LIGHT_BASS_LEFT] || ls->m_bCabinetLights[LIGHT_BASS_RIGHT]) buf[1] |= 0x04; - if (ls->m_bGameButtonLights[GameController_1][DANCE_BUTTON_LEFT]) buf[2] |= 0x10; - if (ls->m_bGameButtonLights[GameController_1][DANCE_BUTTON_RIGHT]) buf[2] |= 0x20; - if (ls->m_bGameButtonLights[GameController_1][DANCE_BUTTON_UP]) buf[2] |= 0x04; - if (ls->m_bGameButtonLights[GameController_1][DANCE_BUTTON_DOWN]) buf[2] |= 0x08; - if (ls->m_bGameButtonLights[GameController_2][DANCE_BUTTON_LEFT]) buf[0] |= 0x10; - if (ls->m_bGameButtonLights[GameController_2][DANCE_BUTTON_RIGHT]) buf[0] |= 0x20; - if (ls->m_bGameButtonLights[GameController_2][DANCE_BUTTON_UP]) buf[0] |= 0x04; - if (ls->m_bGameButtonLights[GameController_2][DANCE_BUTTON_DOWN]) buf[0] |= 0x08; + RString sInput = GAMESTATE->GetCurrentGame()->m_InputScheme.m_szName; + if (sInput.EqualsNoCase("dance")) { + if (ls->m_bGameButtonLights[GameController_1][DANCE_BUTTON_UP]) buf[2] |= 0x04; + if (ls->m_bGameButtonLights[GameController_1][DANCE_BUTTON_DOWN]) buf[2] |= 0x08; + if (ls->m_bGameButtonLights[GameController_1][DANCE_BUTTON_LEFT]) buf[2] |= 0x10; + if (ls->m_bGameButtonLights[GameController_1][DANCE_BUTTON_RIGHT]) buf[2] |= 0x20; + + if (ls->m_bGameButtonLights[GameController_2][DANCE_BUTTON_UP]) buf[0] |= 0x04; + if (ls->m_bGameButtonLights[GameController_2][DANCE_BUTTON_DOWN]) buf[0] |= 0x08; + if (ls->m_bGameButtonLights[GameController_2][DANCE_BUTTON_LEFT]) buf[0] |= 0x10; + if (ls->m_bGameButtonLights[GameController_2][DANCE_BUTTON_RIGHT]) buf[0] |= 0x20; + } else if (sInput.EqualsNoCase("pump")) { + if (ls->m_bGameButtonLights[GameController_1][PUMP_BUTTON_UPLEFT]) buf[0] |= 0x04; + if (ls->m_bGameButtonLights[GameController_1][PUMP_BUTTON_UPRIGHT]) buf[0] |= 0x08; + if (ls->m_bGameButtonLights[GameController_1][PUMP_BUTTON_CENTER]) buf[0] |= 0x10; + if (ls->m_bGameButtonLights[GameController_1][PUMP_BUTTON_DOWNLEFT]) buf[0] |= 0x20; + if (ls->m_bGameButtonLights[GameController_1][PUMP_BUTTON_DOWNRIGHT]) buf[0] |= 0x40; + + if (ls->m_bGameButtonLights[GameController_2][PUMP_BUTTON_UPLEFT]) buf[2] |= 0x04; + if (ls->m_bGameButtonLights[GameController_2][PUMP_BUTTON_UPRIGHT]) buf[2] |= 0x08; + if (ls->m_bGameButtonLights[GameController_2][PUMP_BUTTON_CENTER]) buf[2] |= 0x10; + if (ls->m_bGameButtonLights[GameController_2][PUMP_BUTTON_DOWNLEFT]) buf[2] |= 0x20; + if (ls->m_bGameButtonLights[GameController_2][PUMP_BUTTON_DOWNRIGHT]) buf[2] |= 0x20; + } if (!memcmp(buf, oldbuf, 8)) return; memcpy(oldbuf, buf, 8); @@ -55,7 +73,7 @@ void LightsDriver_Linux_PIUIO::Set( const LightsState *ls ) } /* - * (c) 2012 Devin J. Pohly + * (c) 2012-2013 StepMania team * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a