From 80ec025588bcf8a8b0657636517fbd1c4ed2c285 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Wed, 31 Aug 2011 12:38:10 -0500 Subject: [PATCH] more pedantic cleanup of extraneous tabs, and add a description to LightsDriver_SystemMessage. --- src/arch/Lights/LightsDriver.h | 2 +- src/arch/Lights/LightsDriver_Export.h | 2 +- src/arch/Lights/LightsDriver_LinuxParallel.cpp | 15 ++++++--------- src/arch/Lights/LightsDriver_SystemMessage.cpp | 2 +- src/arch/Lights/LightsDriver_SystemMessage.h | 3 ++- src/arch/Lights/LightsDriver_Win32Parallel.cpp | 5 +++-- src/arch/Lights/LightsDriver_Win32Parallel.h | 8 +++----- 7 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/arch/Lights/LightsDriver.h b/src/arch/Lights/LightsDriver.h index 56e5f41236..5420f25cf5 100644 --- a/src/arch/Lights/LightsDriver.h +++ b/src/arch/Lights/LightsDriver.h @@ -14,7 +14,7 @@ public: LightsDriver() {}; virtual ~LightsDriver() {}; - + virtual void Set( const LightsState *ls ) = 0; }; diff --git a/src/arch/Lights/LightsDriver_Export.h b/src/arch/Lights/LightsDriver_Export.h index 49f0ed7668..555a4e132a 100644 --- a/src/arch/Lights/LightsDriver_Export.h +++ b/src/arch/Lights/LightsDriver_Export.h @@ -12,7 +12,7 @@ public: LightsDriver_Export(); 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. static LightsState GetState(); private: diff --git a/src/arch/Lights/LightsDriver_LinuxParallel.cpp b/src/arch/Lights/LightsDriver_LinuxParallel.cpp index 270585480c..6a54e61cc4 100644 --- a/src/arch/Lights/LightsDriver_LinuxParallel.cpp +++ b/src/arch/Lights/LightsDriver_LinuxParallel.cpp @@ -1,9 +1,6 @@ -// -// LightsDriver_LinuxParallel - Parallel Port Based Lights Driver for Linux -// -// This requires root permissions to work! (run as root or suid) -// This code was written using SystemMessage Driver as template. -// +/* LightsDriver_LinuxParallel - Parallel Port Based Lights Driver for Linux + * This requires root permissions to work! (run as root or suid) + * This code was written using SystemMessage Driver as template. */ #include "global.h" #include @@ -12,6 +9,7 @@ #include "InputMapper.h" #include "Game.h" +// xxx: don't hardcode the port address. -aj static const int PORT_ADDRESS = 0x378; static const bool SCREEN_DEBUG = false; @@ -19,7 +17,7 @@ REGISTER_SOUND_DRIVER_CLASS(LinuxParallel); LightsDriver_LinuxParallel::LightsDriver_LinuxParallel() { - // Give port's permissions and reset all bits to zero + // Give ports permissions and reset all bits to zero ioperm( PORT_ADDRESS, 1, 1 ); outb( 0, PORT_ADDRESS ); } @@ -36,7 +34,7 @@ void LightsDriver_LinuxParallel::Set( const LightsState *ls ) // Set LightState to port RString s; - // Prepare Screen Output too for debugging + // Prepare screen output too for debugging s += "LinuxParallel Lights Driver Debug\n"; s += "Lights Mode: " + LightsModeToString(LIGHTSMAN->GetLightsMode()) + "\n"; @@ -75,7 +73,6 @@ void LightsDriver_LinuxParallel::Set( const LightsState *ls ) /* * (c) 2004 Hugo Hromic M. - * * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a diff --git a/src/arch/Lights/LightsDriver_SystemMessage.cpp b/src/arch/Lights/LightsDriver_SystemMessage.cpp index e9335b7617..b405a6e10f 100644 --- a/src/arch/Lights/LightsDriver_SystemMessage.cpp +++ b/src/arch/Lights/LightsDriver_SystemMessage.cpp @@ -20,7 +20,7 @@ void LightsDriver_SystemMessage::Set( const LightsState *ls ) return; RString s; - + s += LightsModeToString(LIGHTSMAN->GetLightsMode()) + "\n"; s += "Cabinet: "; diff --git a/src/arch/Lights/LightsDriver_SystemMessage.h b/src/arch/Lights/LightsDriver_SystemMessage.h index bc2a807346..aea0cb7a23 100644 --- a/src/arch/Lights/LightsDriver_SystemMessage.h +++ b/src/arch/Lights/LightsDriver_SystemMessage.h @@ -1,3 +1,4 @@ +/* LightsDriver_SystemMessage: Outputs light state as a system message. */ #ifndef LightsDriver_SystemMessage_H #define LightsDriver_SystemMessage_H @@ -8,7 +9,7 @@ class LightsDriver_SystemMessage : public LightsDriver public: LightsDriver_SystemMessage(); virtual ~LightsDriver_SystemMessage(); - + virtual void Set( const LightsState *ls ); }; diff --git a/src/arch/Lights/LightsDriver_Win32Parallel.cpp b/src/arch/Lights/LightsDriver_Win32Parallel.cpp index 69f2bf09f7..85913a89c1 100644 --- a/src/arch/Lights/LightsDriver_Win32Parallel.cpp +++ b/src/arch/Lights/LightsDriver_Win32Parallel.cpp @@ -13,6 +13,7 @@ typedef short int (WINAPI ISDRIVERINSTALLED)(); ISDRIVERINSTALLED* IsDriverInstalled = NULL; const int LIGHTS_PER_PARALLEL_PORT = 8; +// xxx: don't hardcode the port addresses. -aj const int MAX_PARALLEL_PORTS = 3; short LPT_ADDRESS[MAX_PARALLEL_PORTS] = { @@ -48,7 +49,7 @@ LightsDriver_Win32Parallel::LightsDriver_Win32Parallel() MessageBox(NULL, "Could not LoadLibrary( parallel_lights_io.dll ).", "ERROR", MB_OK ); return; } - + //Get the function pointers PortOut = (PORTOUT*) GetProcAddress(hDLL, "PortOut"); IsDriverInstalled = (ISDRIVERINSTALLED*) GetProcAddress(hDLL, "IsDriverInstalled"); @@ -83,7 +84,7 @@ void LightsDriver_Win32Parallel::Set( const LightsState *ls ) data[lpt] &= ~mask; } } - + FOREACH_ENUM( GameController, gc ) { FOREACH_ENUM( GameButton, gb ) diff --git a/src/arch/Lights/LightsDriver_Win32Parallel.h b/src/arch/Lights/LightsDriver_Win32Parallel.h index 474ac5d8c0..7a9c7caa66 100644 --- a/src/arch/Lights/LightsDriver_Win32Parallel.h +++ b/src/arch/Lights/LightsDriver_Win32Parallel.h @@ -1,7 +1,5 @@ -/* - * LightsDriver_Win32Parallel - Control lights with Kit 74: - * http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=kit+74+relay - */ +/* LightsDriver_Win32Parallel - Control lights with Kit 74: + * http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=kit+74+relay */ #ifndef LightsDriver_Win32Parallel_H #define LightsDriver_Win32Parallel_H @@ -13,7 +11,7 @@ class LightsDriver_Win32Parallel : public LightsDriver public: LightsDriver_Win32Parallel(); virtual ~LightsDriver_Win32Parallel(); - + virtual void Set( const LightsState *ls ); };