registered lights drivers
This commit is contained in:
@@ -1,33 +1,33 @@
|
||||
#include "global.h"
|
||||
#include "LightsDriver.h"
|
||||
#include "RageLog.h"
|
||||
#include "Foreach.h"
|
||||
#include "arch/arch_default.h"
|
||||
|
||||
void LightsDriver::Create( const RString &driver, vector<LightsDriver *> &Add )
|
||||
DriverList LightsDriver::m_pDriverList;
|
||||
|
||||
void LightsDriver::Create( const RString &sDrivers, vector<LightsDriver *> &Add )
|
||||
{
|
||||
LOG->Trace( "Initializing lights driver: %s", driver.c_str() );
|
||||
LOG->Trace( "Initializing lights drivers: %s", sDrivers.c_str() );
|
||||
|
||||
LightsDriver *ret = NULL;
|
||||
vector<RString> asDriversToTry;
|
||||
split( sDrivers, ",", asDriversToTry, true );
|
||||
|
||||
FOREACH_CONST( RString, asDriversToTry, Driver )
|
||||
{
|
||||
RageDriver *pRet = m_pDriverList.Create( *Driver );
|
||||
if( pRet == NULL )
|
||||
{
|
||||
LOG->Trace( "Unknown lights driver: %s", Driver->c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef USE_LIGHTS_DRIVER_LINUX_PARALLEL
|
||||
if( !driver.CompareNoCase("LinuxParallel") ) ret = new LightsDriver_LinuxParallel;
|
||||
#endif
|
||||
#ifdef USE_LIGHTS_DRIVER_LINUX_WEEDTECH
|
||||
if( !driver.CompareNoCase("WeedTech") ) ret = new LightsDriver_LinuxWeedTech;
|
||||
#endif
|
||||
#ifdef USE_LIGHTS_DRIVER_WIN32_PARALLEL
|
||||
if( !driver.CompareNoCase("Parallel") ) ret = new LightsDriver_Win32Parallel;
|
||||
#endif
|
||||
#ifdef USE_LIGHTS_DRIVER_EXPORT
|
||||
if( !driver.CompareNoCase("Export") ) ret = new LightsDriver_Export;
|
||||
#endif
|
||||
LightsDriver *pDriver = dynamic_cast<LightsDriver *>( pRet );
|
||||
ASSERT( pDriver != NULL );
|
||||
|
||||
if( ret == NULL && driver.CompareNoCase("Null") )
|
||||
LOG->Trace( "Unknown lights driver name: %s", driver.c_str() );
|
||||
else if( ret != NULL )
|
||||
Add.push_back( ret );
|
||||
|
||||
Add.push_back( new LightsDriver_SystemMessage );
|
||||
LOG->Info( "Lights driver: %s", Driver->c_str() );
|
||||
Add.push_back( pDriver );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -4,13 +4,15 @@
|
||||
#define LightsDriver_H
|
||||
|
||||
#include "LightsManager.h"
|
||||
#include "arch/RageDriver.h"
|
||||
|
||||
struct LightsState;
|
||||
|
||||
class LightsDriver
|
||||
class LightsDriver: public RageDriver
|
||||
{
|
||||
public:
|
||||
static void Create( const RString &sDriver, vector<LightsDriver *> &apAdd );
|
||||
static DriverList m_pDriverList;
|
||||
|
||||
LightsDriver() {};
|
||||
virtual ~LightsDriver() {};
|
||||
@@ -18,6 +20,10 @@ public:
|
||||
virtual void Set( const LightsState *ls ) = 0;
|
||||
};
|
||||
|
||||
#define REGISTER_SOUND_DRIVER_CLASS2( name, x ) \
|
||||
static RegisterRageDriver register_##x( &LightsDriver::m_pDriverList, #name, CreateClass<LightsDriver_##x, RageDriver> )
|
||||
#define REGISTER_SOUND_DRIVER_CLASS( name ) REGISTER_SOUND_DRIVER_CLASS2( name, name )
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "LightsDriver_Export.h"
|
||||
|
||||
REGISTER_SOUND_DRIVER_CLASS(Export);
|
||||
|
||||
RageMutex LightsDriver_Export::m_Lock( "LightsDriver_Export");
|
||||
LightsState LightsDriver_Export::m_State;
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ private:
|
||||
static RageMutex m_Lock;
|
||||
static LightsState m_State;
|
||||
};
|
||||
#define USE_LIGHTS_DRIVER_EXPORT
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
static const int PORT_ADDRESS = 0x378;
|
||||
static const bool SCREEN_DEBUG = false;
|
||||
|
||||
REGISTER_SOUND_DRIVER_CLASS(LinuxParallel);
|
||||
|
||||
LightsDriver_LinuxParallel::LightsDriver_LinuxParallel()
|
||||
{
|
||||
// Give port's permissions and reset all bits to zero
|
||||
|
||||
@@ -13,7 +13,6 @@ public:
|
||||
virtual ~LightsDriver_LinuxParallel();
|
||||
virtual void Set( const LightsState *ls );
|
||||
};
|
||||
#define USE_LIGHTS_DRIVER_LINUX_PARALLEL
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "LightsDriver_LinuxWeedTech.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
REGISTER_SOUND_DRIVER_CLASS(LinuxWeedTech);
|
||||
|
||||
// Begin serial driver //
|
||||
static int fd = -1;
|
||||
static LightsState CurLights;
|
||||
|
||||
@@ -16,7 +16,6 @@ public:
|
||||
|
||||
virtual void Set( const LightsState *ls );
|
||||
};
|
||||
#define USE_LIGHTS_DRIVER_LINUX_WEEDTECH
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ public:
|
||||
|
||||
void Set( const LightsState *ls ) {};
|
||||
};
|
||||
#define USE_LIGHTS_DRIVER_NULL
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "InputMapper.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
REGISTER_SOUND_DRIVER_CLASS(SystemMessage);
|
||||
|
||||
LightsDriver_SystemMessage::LightsDriver_SystemMessage()
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@ public:
|
||||
|
||||
virtual void Set( const LightsState *ls );
|
||||
};
|
||||
#define USE_LIGHTS_DRIVER_SYSTEM_MESSAGE
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "windows.h"
|
||||
#include "RageUtil.h"
|
||||
|
||||
REGISTER_SOUND_DRIVER_CLASS(Win32Parallel);
|
||||
|
||||
HINSTANCE hDLL = NULL;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ public:
|
||||
|
||||
virtual void Set( const LightsState *ls );
|
||||
};
|
||||
#define USE_LIGHTS_DRIVER_WIN32_PARALLEL
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
/* Define the default driver sets. */
|
||||
#if defined(_WINDOWS)
|
||||
#include "ArchHooks/ArchHooks_Win32.h"
|
||||
#include "Lights/LightsDriver_Win32Parallel.h"
|
||||
#include "LoadingWindow/LoadingWindow_Win32.h"
|
||||
#include "LowLevelWindow/LowLevelWindow_Win32.h"
|
||||
#include "MemoryCard/MemoryCardDriverThreaded_Windows.h"
|
||||
@@ -38,12 +37,7 @@
|
||||
#include "LowLevelWindow/LowLevelWindow_X11.h"
|
||||
|
||||
#if defined(LINUX)
|
||||
#include "Lights/LightsDriver_LinuxWeedTech.h"
|
||||
#include "MemoryCard/MemoryCardDriverThreaded_Linux.h"
|
||||
|
||||
#ifndef __PPC__
|
||||
#include "Lights/LightsDriver_LinuxParallel.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GTK)
|
||||
@@ -61,9 +55,6 @@
|
||||
#endif
|
||||
|
||||
/* All use these. */
|
||||
#include "Lights/LightsDriver_Export.h"
|
||||
#include "Lights/LightsDriver_SystemMessage.h"
|
||||
#include "Lights/LightsDriver_Null.h"
|
||||
#include "LoadingWindow/LoadingWindow_Null.h"
|
||||
#include "MemoryCard/MemoryCardDriver_Null.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user