From 69d4b9db3b552f762207d074f8d0845ca77d74f7 Mon Sep 17 00:00:00 2001 From: Mark Cannon Date: Wed, 13 Feb 2008 21:45:05 +0000 Subject: [PATCH] git-svn-id: https://openitg.svn.sourceforge.net/svnroot/openitg@23 83fadc84-e282-4d84-a09a-c4228d6ae7e5 --- src/StepMania.cpp | 16 ++++ src/arch/InputHandler/InputHandler_Linux_PIUIO.cpp | 86 +++++++++++++--------- src/io/PIUIO.cpp | 2 - src/io/USBDriver.cpp | 2 +- 4 files changed, 69 insertions(+), 37 deletions(-) diff --git a/src/StepMania.cpp b/src/StepMania.cpp index 9ce7e3e6..6651a5d3 100755 --- a/src/StepMania.cpp +++ b/src/StepMania.cpp @@ -1028,6 +1028,22 @@ int main(int argc, char* argv[]) } MountTreeOfZips( ZIPS_DIR ); + { + CStringArray dzips; + + GetDirListing( "/CryptPackages/d*.zip", dzips, false, true ); + + for( unsigned i = 0; i < dzips.size(); ++i ) + { + if( !IsAFile(dzips[i]) ) + continue; + + LOG->Trace( "VFS: found %s (crypt)", dzips[i].c_str() ); + FILEMAN->Mount( "kry", dzips[i], "/" ); + } + } + + /* One of the above filesystems might contain files that affect preferences, eg Data/Static.ini. * Re-read preferences. */ PREFSMAN->ReadGlobalPrefsFromDisk(); diff --git a/src/arch/InputHandler/InputHandler_Linux_PIUIO.cpp b/src/arch/InputHandler/InputHandler_Linux_PIUIO.cpp index ed695f36..00d372ce 100644 --- a/src/arch/InputHandler/InputHandler_Linux_PIUIO.cpp +++ b/src/arch/InputHandler/InputHandler_Linux_PIUIO.cpp @@ -2,9 +2,9 @@ #include "RageLog.h" #include "RageException.h" +#include "PrefsManager.h" #include "LightsManager.h" #include "arch/Lights/LightsDriver_External.h" // needed for g_LightsState -#include "PrefsManager.h" #include "InputHandler_Linux_PIUIO.h" LightsState g_LightsState; @@ -16,7 +16,7 @@ InputHandler_Linux_PIUIO::InputHandler_Linux_PIUIO() // device found and set if( IOBoard.Open() ) { - LOG->Trace( "Opened I/O board." ); + LOG->Trace( "Opened PIUIO board." ); m_bFoundDevice = true; InputThread.SetName( "PIUIO thread" ); @@ -24,7 +24,8 @@ InputHandler_Linux_PIUIO::InputHandler_Linux_PIUIO() } else { - sm_crash( "InputHandler_Linux_PIUIO: Failed to open PIU I/O board." ); + /* We can't accept input, so why bother? */ + sm_crash( "Failed to connect to PIUIO board." ); } } @@ -38,7 +39,7 @@ InputHandler_Linux_PIUIO::~InputHandler_Linux_PIUIO() LOG->Trace( "PIUIO thread shut down." ); } - // remember to delete device handler when finished + IOBoard.Close(); } void InputHandler_Linux_PIUIO::GetDevicesAndDescriptions( vector& vDevicesOut, vector& vDescriptionsOut ) @@ -61,49 +62,66 @@ void InputHandler_Linux_PIUIO::InputThreadMain() { while( !m_bShutdown ) { - /* For now, we just want to test lights updates. */ UpdateLights(); IOBoard.Write( m_iLightData ); } } +/* Requires "LightsDriver=ext" */ void InputHandler_Linux_PIUIO::UpdateLights() { - // XXX: need to check LightsDriver somehow - - static const int iCabinetData[NUM_CABINET_LIGHTS-1] = + static const int iCabinetBits[NUM_CABINET_LIGHTS-1] = { (1 << 22), (1 << 25), (1 << 24), (1 << 23), 0, 0, (1 << 10) }; + static const int iPlayerBits[2][4] = + { + { (1 << 19), (1 << 20), (1 << 17), (1 << 18) }, /* Player 1 */ + { (1 << 4), (1 << 5), (1 << 2), (1 << 3) } /* Player 2 */ + }; + // reset m_iLightData = 0; - // Just do cabinet lights for now and we'll figure the rest later. + // there's one trigger for both bass lights, but we can only add + // the value once - otherwise, it'll mess with our bits. Set left + // if right is true, so we can iterate to NUM_CABINET_LIGHTS-1 only. + + if( g_LightsState.m_bCabinetLights[LIGHT_BASS_RIGHT] ) + g_LightsState.m_bCabinetLights[LIGHT_BASS_LEFT] = true; + + // update marquee lights FOREACH_ENUM( CabinetLight, NUM_CABINET_LIGHTS-1, cl ) if( g_LightsState.m_bCabinetLights[cl] ) - m_iLightData += iCabinetData[cl]; -// for reference -#if 0 - // probably marquee lights - if( g_LightsState[0] ) m_iLightData += (1 << 22); - if( g_LightsState[1] ) m_iLightData += (1 << 25); - if( g_LightsState[2] ) m_iLightData += (1 << 24); - if( g_LightsState[3] ) m_iLightData += (1 << 23); - - // probably bass neons - if( g_LightsState[6] || g_LightsState[7] ) - m_iLightData += (1 << 10); - - // pad lighting P1 - if( g_LightsState[08] ) m_iLightData += (1 << 19); - if( g_LightsState[09] ) m_iLightData += (1 << 20); - if( g_LightsState[10] ) m_iLightData += (1 << 17); - if( g_LightsState[11] ) m_iLightData += (1 << 18); - - // pad lighting P2 - if( g_LightsState[28] ) m_iLightData += (1 << 4); - if( g_LightsState[29] ) m_iLightData += (1 << 5); - if( g_LightsState[30] ) m_iLightData += (1 << 2); - if( g_LightsState[31] ) m_iLightData += (1 << 3); -#endif + m_iLightData += iCabinetBits[cl]; + + // update the four pad lights on both game controllers + FOREACH_GameController( gc ) + FOREACH_ENUM( GameButton, 4, gb ) + if( g_LightsState.m_bGameButtonLights[gc][gb] ) + m_iLightData += iPlayerBits[gc][gb]; } +/* + * (c) 2008 BoXoRRoXoRs + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/src/io/PIUIO.cpp b/src/io/PIUIO.cpp index a87d8ff7..f7dea74d 100644 --- a/src/io/PIUIO.cpp +++ b/src/io/PIUIO.cpp @@ -8,8 +8,6 @@ bool PIUIO::Matches( int idVendor, int idProduct ) if( idVendor == 0x547 && idProduct == 0x1002 ) return true; - LOG->Trace( "Not a match. idVendor %u, idProduct %u", idVendor, idProduct ); - return false; } diff --git a/src/io/USBDriver.cpp b/src/io/USBDriver.cpp index 5c2475d1..d515a46e 100644 --- a/src/io/USBDriver.cpp +++ b/src/io/USBDriver.cpp @@ -84,7 +84,7 @@ bool USBDriver::Open() if( device == NULL ) { - LOG->Warn( "USBDriver: could not set usb_device" ); + LOG->Warn( "USBDriver: could not set usb_device." ); return false; } -- 2.11.0