Add LinuxInputJoysticks parameter to Preferences.ini to ensure pad order consistency
This commit is contained in:
committed by
teejusb
parent
acf8be530d
commit
5753ecdc1c
@@ -12,6 +12,7 @@
|
||||
RageInput* INPUTMAN = nullptr; // global and accessible from anywhere in our program
|
||||
|
||||
Preference<RString> g_sInputDrivers( "InputDrivers", "" ); // "" == DEFAULT_INPUT_DRIVER_LIST
|
||||
Preference<RString> g_sInputLinuxJoysticks( "InputLinuxJoysticks", "" ); // "" == DEFAULT_LINUX_INPUT_JOYSTICK_LIST
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@@ -36,6 +36,7 @@ public:
|
||||
};
|
||||
|
||||
extern Preference<RString> g_sInputDrivers;
|
||||
extern Preference<RString> g_sInputLinuxJoysticks;
|
||||
|
||||
extern RageInput* INPUTMAN; // global and accessible from anywhere in our program
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
#include "InputHandler_Linux_Event.h"
|
||||
#include "InputHandler_Linux_Joystick.h"
|
||||
|
||||
#include "RageInput.h" // g_sInputDrivers
|
||||
#include "RageInput.h" // g_sInputDrivers g_sInputLinuxJoysticks
|
||||
#include "RageLog.h"
|
||||
|
||||
#include <string> // std::string::npos
|
||||
#include <vector>
|
||||
|
||||
#if defined(HAVE_DIRENT_H)
|
||||
#include <dirent.h>
|
||||
@@ -104,6 +105,11 @@ void LinuxInputManager::InitDriver(InputHandler_Linux_Event* driver)
|
||||
void LinuxInputManager::InitDriver(InputHandler_Linux_Joystick* driver)
|
||||
{
|
||||
m_JoystickDriver = driver;
|
||||
// Discard all the joystick devices if they were assigned manually via
|
||||
// LinuxInputJoysticks
|
||||
if( g_sInputLinuxJoysticks.Get() != "" ) {
|
||||
m_vsPendingJoystickDevices.clear();
|
||||
}
|
||||
|
||||
for (RString &dev : m_vsPendingJoystickDevices)
|
||||
{
|
||||
@@ -112,8 +118,15 @@ void LinuxInputManager::InitDriver(InputHandler_Linux_Joystick* driver)
|
||||
|
||||
driver->TryDevice(devFile);
|
||||
}
|
||||
|
||||
m_vsPendingJoystickDevices.clear();
|
||||
|
||||
// If any, add the manually specified devices via LinuxInputJoysticks
|
||||
std::vector<RString> fixedDevices;
|
||||
split( g_sInputLinuxJoysticks, ",", fixedDevices, true );
|
||||
|
||||
for (RString dev : fixedDevices) {
|
||||
RString devFile = dev;
|
||||
driver->TryDevice(devFile);
|
||||
}
|
||||
}
|
||||
|
||||
LinuxInputManager* LINUXINPUT = nullptr; // global and accessible anywhere in our program
|
||||
|
||||
Reference in New Issue
Block a user