Add libmmmagic lights support to linux. Mostly copy paste of windows driver.
This commit is contained in:
@@ -61,6 +61,7 @@ elseif(LINUX)
|
|||||||
# Builder beware: later versions of ffmpeg may break!
|
# Builder beware: later versions of ffmpeg may break!
|
||||||
option(WITH_SYSTEM_FFMPEG "Build with the system's FFMPEG, disabled build with bundled's FFMPEG" OFF)
|
option(WITH_SYSTEM_FFMPEG "Build with the system's FFMPEG, disabled build with bundled's FFMPEG" OFF)
|
||||||
option(WITH_CRYSTALHD_DISABLED "Build FFMPEG without Crystal HD support." OFF)
|
option(WITH_CRYSTALHD_DISABLED "Build FFMPEG without Crystal HD support." OFF)
|
||||||
|
option(WITH_MINIMAID "Build with Minimaid Lights Support." ON)
|
||||||
option(WITH_TTY "Build with Linux TTY Input Support." OFF)
|
option(WITH_TTY "Build with Linux TTY Input Support." OFF)
|
||||||
option(WITH_PROFILING "Build with Profiling Support." OFF)
|
option(WITH_PROFILING "Build with Profiling Support." OFF)
|
||||||
option(WITH_GLES2 "Build with OpenGL ES 2.0 Support." ON)
|
option(WITH_GLES2 "Build with OpenGL ES 2.0 Support." ON)
|
||||||
|
|||||||
Vendored
+3
@@ -14,6 +14,9 @@ endif()
|
|||||||
if (NOT SYSTEM_PCRE_FOUND)
|
if (NOT SYSTEM_PCRE_FOUND)
|
||||||
include(CMakeProject-pcre.cmake)
|
include(CMakeProject-pcre.cmake)
|
||||||
endif()
|
endif()
|
||||||
|
if (LINUX)
|
||||||
|
include(CMakeProject-mmmagic.cmake)
|
||||||
|
endif()
|
||||||
include(CMakeProject-tomcrypt.cmake)
|
include(CMakeProject-tomcrypt.cmake)
|
||||||
include(CMakeProject-tommath.cmake)
|
include(CMakeProject-tommath.cmake)
|
||||||
include(CMakeProject-png.cmake)
|
include(CMakeProject-png.cmake)
|
||||||
|
|||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -319,6 +319,14 @@ if(NOT APPLE)
|
|||||||
"arch/Lights/LightsDriver_LinuxParallel.h"
|
"arch/Lights/LightsDriver_LinuxParallel.h"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
if (WITH_MINIMAID)
|
||||||
|
list(APPEND SMDATA_ARCH_LIGHTS_SRC
|
||||||
|
"arch/Lights/LightsDriver_LinuxMinimaid.cpp"
|
||||||
|
)
|
||||||
|
list(APPEND SMDATA_ARCH_LIGHTS_HPP
|
||||||
|
"arch/Lights/LightsDriver_LinuxMinimaid.h"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
endif(NOT APPLE)
|
endif(NOT APPLE)
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ public:
|
|||||||
virtual void Set( const LightsState *ls ) = 0;
|
virtual void Set( const LightsState *ls ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define REGISTER_SOUND_DRIVER_CLASS2( name, x ) \
|
#define REGISTER_LIGHTS_DRIVER_CLASS2( name, x ) \
|
||||||
static RegisterRageDriver register_##x( &LightsDriver::m_pDriverList, #name, CreateClass<LightsDriver_##x, RageDriver> )
|
static RegisterRageDriver register_##x( &LightsDriver::m_pDriverList, #name, CreateClass<LightsDriver_##x, RageDriver> )
|
||||||
#define REGISTER_SOUND_DRIVER_CLASS( name ) REGISTER_SOUND_DRIVER_CLASS2( name, name )
|
#define REGISTER_LIGHTS_DRIVER_CLASS( name ) REGISTER_LIGHTS_DRIVER_CLASS2( name, name )
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "LightsDriver_Export.h"
|
#include "LightsDriver_Export.h"
|
||||||
|
|
||||||
REGISTER_SOUND_DRIVER_CLASS(Export);
|
REGISTER_LIGHTS_DRIVER_CLASS(Export);
|
||||||
|
|
||||||
RageMutex LightsDriver_Export::m_Lock( "LightsDriver_Export");
|
RageMutex LightsDriver_Export::m_Lock( "LightsDriver_Export");
|
||||||
LightsState LightsDriver_Export::m_State;
|
LightsState LightsDriver_Export::m_State;
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
// LightsDriver_Win32Minimaid - driver for lights on the Minimaid with libmmmagic
|
||||||
|
/* To use, StepMania must be run with root permissions, or udev rule for the
|
||||||
|
* device must be made something like this (but it's not quite right):
|
||||||
|
* echo SUBSYSTEM==\"usb\", ATTR{idVendor}==\"beef\", ATTR{idProduct}==\"5730\", MODE=\"0666\" > /etc/udev/rules.d/50-minimaid
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "global.h"
|
||||||
|
#include "LightsDriver_LinuxMinimaid.h"
|
||||||
|
|
||||||
|
REGISTER_LIGHTS_DRIVER_CLASS( LinuxMinimaid );
|
||||||
|
|
||||||
|
LightsDriver_LinuxMinimaid::LightsDriver_LinuxMinimaid()
|
||||||
|
{
|
||||||
|
_mmmagic_loaded= true;
|
||||||
|
mm_connect_minimaid();
|
||||||
|
mm_setKB(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
LightsDriver_LinuxMinimaid::~LightsDriver_LinuxMinimaid()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LightsDriver_LinuxMinimaid::Set(LightsState const* ls)
|
||||||
|
{
|
||||||
|
if(_mmmagic_loaded)
|
||||||
|
{
|
||||||
|
mm_setDDRAllOff();
|
||||||
|
|
||||||
|
// Set the cabinet light values
|
||||||
|
if(ls->m_bCabinetLights[LIGHT_MARQUEE_UP_LEFT])
|
||||||
|
{
|
||||||
|
mm_setDDRCabinetLight(DDR_DOUBLE_MARQUEE_UPPER_LEFT, 1);
|
||||||
|
}
|
||||||
|
if(ls->m_bCabinetLights[LIGHT_MARQUEE_UP_RIGHT])
|
||||||
|
{
|
||||||
|
mm_setDDRCabinetLight(DDR_DOUBLE_MARQUEE_UPPER_RIGHT, 1);
|
||||||
|
}
|
||||||
|
if(ls->m_bCabinetLights[LIGHT_MARQUEE_LR_LEFT])
|
||||||
|
{
|
||||||
|
mm_setDDRCabinetLight(DDR_DOUBLE_MARQUEE_LOWER_LEFT, 1);
|
||||||
|
}
|
||||||
|
if(ls->m_bCabinetLights[LIGHT_MARQUEE_LR_RIGHT])
|
||||||
|
{
|
||||||
|
mm_setDDRCabinetLight(DDR_DOUBLE_MARQUEE_LOWER_RIGHT, 1);
|
||||||
|
}
|
||||||
|
if(ls->m_bCabinetLights[LIGHT_BASS_LEFT] || ls->m_bCabinetLights[LIGHT_BASS_RIGHT])
|
||||||
|
{
|
||||||
|
mm_setDDRBassLight(DDR_DOUBLE_BASS_LIGHTS, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ls->m_bGameButtonLights[GameController_1][DANCE_BUTTON_LEFT])
|
||||||
|
{
|
||||||
|
mm_setDDRPad1Light(DDR_DOUBLE_PAD_LEFT, 1);
|
||||||
|
}
|
||||||
|
if(ls->m_bGameButtonLights[GameController_1][DANCE_BUTTON_RIGHT])
|
||||||
|
{
|
||||||
|
mm_setDDRPad1Light(DDR_DOUBLE_PAD_RIGHT, 1);
|
||||||
|
}
|
||||||
|
if(ls->m_bGameButtonLights[GameController_1][DANCE_BUTTON_UP])
|
||||||
|
{
|
||||||
|
mm_setDDRPad1Light(DDR_DOUBLE_PAD_UP, 1);
|
||||||
|
}
|
||||||
|
if(ls->m_bGameButtonLights[GameController_1][DANCE_BUTTON_DOWN])
|
||||||
|
{
|
||||||
|
mm_setDDRPad1Light(DDR_DOUBLE_PAD_DOWN, 1);
|
||||||
|
}
|
||||||
|
if(ls->m_bGameButtonLights[GameController_1][GAME_BUTTON_START])
|
||||||
|
{
|
||||||
|
mm_setDDRCabinetLight(DDR_DOUBLE_PLAYER1_PANEL, 1);
|
||||||
|
}
|
||||||
|
if(ls->m_bGameButtonLights[GameController_2][DANCE_BUTTON_LEFT])
|
||||||
|
{
|
||||||
|
mm_setDDRPad2Light(DDR_DOUBLE_PAD_LEFT, 1);
|
||||||
|
}
|
||||||
|
if(ls->m_bGameButtonLights[GameController_2][DANCE_BUTTON_RIGHT])
|
||||||
|
{
|
||||||
|
mm_setDDRPad2Light(DDR_DOUBLE_PAD_RIGHT, 1);
|
||||||
|
}
|
||||||
|
if(ls->m_bGameButtonLights[GameController_2][DANCE_BUTTON_UP])
|
||||||
|
{
|
||||||
|
mm_setDDRPad2Light(DDR_DOUBLE_PAD_UP, 1);
|
||||||
|
}
|
||||||
|
if(ls->m_bGameButtonLights[GameController_2][DANCE_BUTTON_DOWN])
|
||||||
|
{
|
||||||
|
mm_setDDRPad2Light(DDR_DOUBLE_PAD_DOWN, 1);
|
||||||
|
}
|
||||||
|
if(ls->m_bGameButtonLights[GameController_2][GAME_BUTTON_START])
|
||||||
|
{
|
||||||
|
mm_setDDRCabinetLight(DDR_DOUBLE_PLAYER2_PANEL, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output the information
|
||||||
|
mm_sendDDRMiniMaidUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/* LightsDriver_LinuxMinimaid - Minimaid based lights with libmmmagic */
|
||||||
|
|
||||||
|
#ifndef LightsDriver_LinuxMinimaid_H
|
||||||
|
#define LightsDriver_LinuxMinimaid_H
|
||||||
|
|
||||||
|
#include "LightsDriver.h"
|
||||||
|
|
||||||
|
#define DDR_DOUBLE_BASS_LIGHTS 0 //unknown but guessed
|
||||||
|
#define DDR_DOUBLE_PLAYER1_PANEL 2
|
||||||
|
#define DDR_DOUBLE_PLAYER2_PANEL 3
|
||||||
|
#define DDR_DOUBLE_MARQUEE_LOWER_RIGHT 4
|
||||||
|
#define DDR_DOUBLE_MARQUEE_UPPER_RIGHT 5
|
||||||
|
#define DDR_DOUBLE_MARQUEE_LOWER_LEFT 6
|
||||||
|
#define DDR_DOUBLE_MARQUEE_UPPER_LEFT 7
|
||||||
|
|
||||||
|
//PADX_LIGHTS
|
||||||
|
#define DDR_DOUBLE_PAD_UP 0
|
||||||
|
#define DDR_DOUBLE_PAD_DOWN 1
|
||||||
|
#define DDR_DOUBLE_PAD_LEFT 2
|
||||||
|
#define DDR_DOUBLE_PAD_RIGHT 3
|
||||||
|
#define DDR_DOUBLE_PAD_RESET 4
|
||||||
|
|
||||||
|
#define BIT(i) (1<<(i))
|
||||||
|
#define BIT_IS_SET(v,i) ((v&BIT(i))!=0)
|
||||||
|
|
||||||
|
static bool _mmmagic_loaded=false;
|
||||||
|
|
||||||
|
typedef bool (*__BITVALID)(int);
|
||||||
|
static __BITVALID __bitValid;
|
||||||
|
|
||||||
|
// minimaid prototypes
|
||||||
|
typedef void (*MM_SETDDRPAD1LIGHT)(int, int);
|
||||||
|
typedef void (*MM_SETDDRPAD2LIGHT)(int, int);
|
||||||
|
typedef void (*MM_SETCABINETLIGHT)(int, int);
|
||||||
|
typedef void (*MM_SETDDRBASSLIGHT)(int, int);
|
||||||
|
static MM_SETDDRPAD1LIGHT mm_setDDRPad1Light;
|
||||||
|
static MM_SETDDRPAD2LIGHT mm_setDDRPad2Light;
|
||||||
|
static MM_SETCABINETLIGHT mm_setDDRCabinetLight;
|
||||||
|
static MM_SETDDRBASSLIGHT mm_setDDRBassLight;
|
||||||
|
|
||||||
|
typedef bool (*MM_CONNECT_MINIMAID)();
|
||||||
|
typedef bool (*MM_SETKB)(bool val);
|
||||||
|
static MM_CONNECT_MINIMAID mm_connect_minimaid;
|
||||||
|
static MM_SETKB mm_setKB;
|
||||||
|
|
||||||
|
typedef void (*MM_SETDDRALLON)();
|
||||||
|
typedef void (*MM_SETDDRALLOFF)();
|
||||||
|
static MM_SETDDRALLON mm_setDDRAllOn;
|
||||||
|
static MM_SETDDRALLOFF mm_setDDRAllOff;
|
||||||
|
|
||||||
|
typedef void (*MM_SETBLUELED)(unsigned char);
|
||||||
|
typedef void (*MM_SETMMOUTPUTREPORTS)(unsigned char, unsigned char, unsigned char, unsigned char);
|
||||||
|
typedef bool (*MM_SENDDDRMINIMAIDUPDATE)();
|
||||||
|
static MM_SETBLUELED mm_setBlueLED;
|
||||||
|
static MM_SETMMOUTPUTREPORTS mm_setMMOutputReports;
|
||||||
|
static MM_SENDDDRMINIMAIDUPDATE mm_sendDDRMiniMaidUpdate;
|
||||||
|
|
||||||
|
typedef void (*MM_INIT)();
|
||||||
|
typedef void (*MM_TURNON)(unsigned char, int);
|
||||||
|
typedef bool (*MM_TURNOFF)(unsigned char, int);
|
||||||
|
static MM_INIT mm_init;
|
||||||
|
static MM_TURNON mm_turnON;
|
||||||
|
static MM_TURNOFF mm_turnOFF;
|
||||||
|
|
||||||
|
class LightsDriver_LinuxMinimaid : public LightsDriver
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LightsDriver_LinuxMinimaid();
|
||||||
|
|
||||||
|
virtual ~LightsDriver_LinuxMinimaid();
|
||||||
|
virtual void Set( const LightsState *ls );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
static const int PORT_ADDRESS = 0x378;
|
static const int PORT_ADDRESS = 0x378;
|
||||||
static const bool SCREEN_DEBUG = false;
|
static const bool SCREEN_DEBUG = false;
|
||||||
|
|
||||||
REGISTER_SOUND_DRIVER_CLASS(LinuxParallel);
|
REGISTER_LIGHTS_DRIVER_CLASS(LinuxParallel);
|
||||||
|
|
||||||
LightsDriver_LinuxParallel::LightsDriver_LinuxParallel()
|
LightsDriver_LinuxParallel::LightsDriver_LinuxParallel()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "LightsDriver_LinuxWeedTech.h"
|
#include "LightsDriver_LinuxWeedTech.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
|
|
||||||
REGISTER_SOUND_DRIVER_CLASS(LinuxWeedTech);
|
REGISTER_LIGHTS_DRIVER_CLASS(LinuxWeedTech);
|
||||||
|
|
||||||
// Begin serial driver
|
// Begin serial driver
|
||||||
static int fd = -1;
|
static int fd = -1;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
|
|
||||||
REGISTER_SOUND_DRIVER_CLASS2(PIUIO, Linux_PIUIO);
|
REGISTER_LIGHTS_DRIVER_CLASS2(PIUIO, Linux_PIUIO);
|
||||||
|
|
||||||
LightsDriver_Linux_PIUIO::LightsDriver_Linux_PIUIO()
|
LightsDriver_Linux_PIUIO::LightsDriver_Linux_PIUIO()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
|
|
||||||
REGISTER_SOUND_DRIVER_CLASS2(PIUIO_Leds, Linux_PIUIO_Leds);
|
REGISTER_LIGHTS_DRIVER_CLASS2(PIUIO_Leds, Linux_PIUIO_Leds);
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const char *cabinet_leds[NUM_CabinetLight] = {
|
const char *cabinet_leds[NUM_CabinetLight] = {
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ void LightsDriver_SextetStream::Set(const LightsState *ls)
|
|||||||
|
|
||||||
// LightsDriver_SextetStreamToFile implementation
|
// LightsDriver_SextetStreamToFile implementation
|
||||||
|
|
||||||
REGISTER_SOUND_DRIVER_CLASS(SextetStreamToFile);
|
REGISTER_LIGHTS_DRIVER_CLASS(SextetStreamToFile);
|
||||||
|
|
||||||
#if defined(_WINDOWS)
|
#if defined(_WINDOWS)
|
||||||
#define DEFAULT_OUTPUT_FILENAME "\\\\.\\pipe\\StepMania-Lights-SextetStream"
|
#define DEFAULT_OUTPUT_FILENAME "\\\\.\\pipe\\StepMania-Lights-SextetStream"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "InputMapper.h"
|
#include "InputMapper.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
|
|
||||||
REGISTER_SOUND_DRIVER_CLASS(SystemMessage);
|
REGISTER_LIGHTS_DRIVER_CLASS(SystemMessage);
|
||||||
|
|
||||||
LightsDriver_SystemMessage::LightsDriver_SystemMessage()
|
LightsDriver_SystemMessage::LightsDriver_SystemMessage()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include "LightsDriver_Win32Minimaid.h"
|
#include "LightsDriver_Win32Minimaid.h"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
|
||||||
REGISTER_SOUND_DRIVER_CLASS( Win32Minimaid );
|
REGISTER_LIGHTS_DRIVER_CLASS( Win32Minimaid );
|
||||||
|
|
||||||
HINSTANCE hMMMAGICDLL = NULL;
|
HINSTANCE hMMMAGICDLL = NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
|
|
||||||
REGISTER_SOUND_DRIVER_CLASS(Win32Parallel);
|
REGISTER_LIGHTS_DRIVER_CLASS(Win32Parallel);
|
||||||
|
|
||||||
HINSTANCE hDLL = NULL;
|
HINSTANCE hDLL = NULL;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user