Turn lights out on exit (#1646)
* Add LightsDriver::reset Function will reset all lights to off Function needs to be called by each of the driver implementations as needed during destruction * Reset lights to off on exit
This commit is contained in:
committed by
Colby Klein
parent
bdaabb3525
commit
1369c1fb39
@@ -30,6 +30,15 @@ void LightsDriver::Create( const RString &sDrivers, vector<LightsDriver *> &Add
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LightsDriver::reset()
|
||||||
|
{
|
||||||
|
LightsState state;
|
||||||
|
ZERO( state.m_bCabinetLights );
|
||||||
|
ZERO( state.m_bGameButtonLights );
|
||||||
|
ZERO( state.m_bCoinCounter );
|
||||||
|
Set( &state );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2002-2005 Glenn Maynard
|
* (c) 2002-2005 Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ public:
|
|||||||
virtual ~LightsDriver() {};
|
virtual ~LightsDriver() {};
|
||||||
|
|
||||||
virtual void Set( const LightsState *ls ) = 0;
|
virtual void Set( const LightsState *ls ) = 0;
|
||||||
|
|
||||||
|
// Reset all lights to off
|
||||||
|
void reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
#define REGISTER_LIGHTS_DRIVER_CLASS2( name, x ) \
|
#define REGISTER_LIGHTS_DRIVER_CLASS2( name, x ) \
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ LightsDriver_Export::LightsDriver_Export()
|
|||||||
memset( &m_State, 0, sizeof(m_State) );
|
memset( &m_State, 0, sizeof(m_State) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LightsDriver_Export::~LightsDriver_Export()
|
||||||
|
{
|
||||||
|
LightsDriver::reset();
|
||||||
|
}
|
||||||
|
|
||||||
void LightsDriver_Export::Set( const LightsState *ls )
|
void LightsDriver_Export::Set( const LightsState *ls )
|
||||||
{
|
{
|
||||||
m_Lock.Lock();
|
m_Lock.Lock();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class LightsDriver_Export: public LightsDriver
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LightsDriver_Export();
|
LightsDriver_Export();
|
||||||
|
virtual ~LightsDriver_Export();
|
||||||
virtual void Set( const LightsState *ls );
|
virtual void Set( const LightsState *ls );
|
||||||
|
|
||||||
// Get the current lights state. This can be called from a thread.
|
// Get the current lights state. This can be called from a thread.
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ LightsDriver_LinuxParallel::LightsDriver_LinuxParallel()
|
|||||||
|
|
||||||
LightsDriver_LinuxParallel::~LightsDriver_LinuxParallel()
|
LightsDriver_LinuxParallel::~LightsDriver_LinuxParallel()
|
||||||
{
|
{
|
||||||
|
LightsDriver::reset();
|
||||||
// Reset all bits to zero and free the port's permissions
|
// Reset all bits to zero and free the port's permissions
|
||||||
outb( 0, PORT_ADDRESS );
|
outb( 0, PORT_ADDRESS );
|
||||||
ioperm( PORT_ADDRESS, 1, 0 );
|
ioperm( PORT_ADDRESS, 1, 0 );
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ LightsDriver_Linux_PIUIO::LightsDriver_Linux_PIUIO()
|
|||||||
|
|
||||||
LightsDriver_Linux_PIUIO::~LightsDriver_Linux_PIUIO()
|
LightsDriver_Linux_PIUIO::~LightsDriver_Linux_PIUIO()
|
||||||
{
|
{
|
||||||
|
LightsDriver::reset();
|
||||||
if( fd >= 0 )
|
if( fd >= 0 )
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,6 +210,7 @@ LightsDriver_SextetStream::LightsDriver_SextetStream()
|
|||||||
|
|
||||||
LightsDriver_SextetStream::~LightsDriver_SextetStream()
|
LightsDriver_SextetStream::~LightsDriver_SextetStream()
|
||||||
{
|
{
|
||||||
|
LightsDriver::reset();
|
||||||
if(IMPL != NULL)
|
if(IMPL != NULL)
|
||||||
{
|
{
|
||||||
delete IMPL;
|
delete IMPL;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ LightsDriver_SystemMessage::LightsDriver_SystemMessage()
|
|||||||
|
|
||||||
LightsDriver_SystemMessage::~LightsDriver_SystemMessage()
|
LightsDriver_SystemMessage::~LightsDriver_SystemMessage()
|
||||||
{
|
{
|
||||||
|
LightsDriver::reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightsDriver_SystemMessage::Set( const LightsState *ls )
|
void LightsDriver_SystemMessage::Set( const LightsState *ls )
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ LightsDriver_Win32Parallel::LightsDriver_Win32Parallel()
|
|||||||
|
|
||||||
LightsDriver_Win32Parallel::~LightsDriver_Win32Parallel()
|
LightsDriver_Win32Parallel::~LightsDriver_Win32Parallel()
|
||||||
{
|
{
|
||||||
|
LightsDriver::reset();
|
||||||
FreeLibrary( hDLL );
|
FreeLibrary( hDLL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user