Update and add option to ignore first matching guid
This commit is contained in:
parent
076cfe8e0b
commit
64fa37808a
@ -60,6 +60,8 @@ EnableFFBStrengthPersistence=0
|
|||||||
EnableFFBStrengthTextToSpeech=0
|
EnableFFBStrengthTextToSpeech=0
|
||||||
; Set to 1 to make gui have scrollbars
|
; Set to 1 to make gui have scrollbars
|
||||||
AutoScrollGUI=0
|
AutoScrollGUI=0
|
||||||
|
; Set to 1 to ignore first matching GUID when multiple identical GUID used
|
||||||
|
IgnoreFirstMatchingGUID=0
|
||||||
|
|
||||||
; ***********************************************************************************************************************************
|
; ***********************************************************************************************************************************
|
||||||
; ************************************************ Game overrides are specified below ***********************************************
|
; ************************************************ Game overrides are specified below ***********************************************
|
||||||
|
Binary file not shown.
Binary file not shown.
43
DllMain.cpp
43
DllMain.cpp
@ -947,6 +947,7 @@ int StepFFBStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("StepFFBStreng
|
|||||||
int EnableFFBStrengthPersistence = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableFFBStrengthPersistence"), 0, settingsFilename);
|
int EnableFFBStrengthPersistence = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableFFBStrengthPersistence"), 0, settingsFilename);
|
||||||
int EnableFFBStrengthTextToSpeech = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableFFBStrengthTextToSpeech"), 0, settingsFilename);
|
int EnableFFBStrengthTextToSpeech = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableFFBStrengthTextToSpeech"), 0, settingsFilename);
|
||||||
int InputDeviceWheelEnable = GetPrivateProfileInt(TEXT("Settings"), TEXT("InputDeviceWheelEnable"), 0, settingsFilename);
|
int InputDeviceWheelEnable = GetPrivateProfileInt(TEXT("Settings"), TEXT("InputDeviceWheelEnable"), 0, settingsFilename);
|
||||||
|
int IgnoreFirstMatchingGUID = GetPrivateProfileInt(TEXT("Settings"), TEXT("IgnoreFirstMatchingGUID"), 0, settingsFilename);
|
||||||
|
|
||||||
extern void DefaultConfigValues();
|
extern void DefaultConfigValues();
|
||||||
extern void CustomFFBStrengthSetup();
|
extern void CustomFFBStrengthSetup();
|
||||||
@ -1037,7 +1038,9 @@ void Initialize(int device_index)
|
|||||||
{
|
{
|
||||||
hlp.log("in initialize");
|
hlp.log("in initialize");
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, "0");
|
SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, "0");
|
||||||
SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC | SDL_INIT_SENSOR);
|
SDL_Init(SDL_INIT_HAPTIC | SDL_INIT_SENSOR);
|
||||||
|
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0);
|
||||||
|
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) < 0);
|
||||||
SDL_JoystickEventState(SDL_ENABLE);
|
SDL_JoystickEventState(SDL_ENABLE);
|
||||||
SDL_JoystickUpdate();
|
SDL_JoystickUpdate();
|
||||||
char joystick_guid[256];
|
char joystick_guid[256];
|
||||||
@ -1071,27 +1074,31 @@ void Initialize(int device_index)
|
|||||||
SDL_JoystickClose(js);
|
SDL_JoystickClose(js);
|
||||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||||
{
|
{
|
||||||
joystick1Index = i;
|
if (!IgnoreFirstMatchingGUID)
|
||||||
GameController = SDL_JoystickOpen(i);
|
|
||||||
joystick_index1 = SDL_JoystickInstanceID(GameController);
|
|
||||||
ControllerHaptic = SDL_HapticOpenFromJoystick(GameController);
|
|
||||||
// We save the first controller matching the guid to select this one if no haptic controller with the same guid is found.
|
|
||||||
if (FirstGameController == NULL)
|
|
||||||
{
|
{
|
||||||
sprintf(firstJoystickSelectedText, "No haptic joystick found, selecting first joystick matching the GUID: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
joystick1Index = i;
|
||||||
FirstGameController = GameController;
|
GameController = SDL_JoystickOpen(i);
|
||||||
}
|
joystick_index1 = SDL_JoystickInstanceID(GameController);
|
||||||
// We select the first haptic controller matching the guid.
|
ControllerHaptic = SDL_HapticOpenFromJoystick(GameController);
|
||||||
if (ControllerHaptic != NULL)
|
|
||||||
{
|
if (FirstGameController == NULL)
|
||||||
sprintf(text, "Haptic joystick found: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
{
|
||||||
hlp.log(text);
|
sprintf(firstJoystickSelectedText, "No haptic joystick found, selecting first joystick matching the GUID: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
||||||
break;
|
FirstGameController = GameController;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ControllerHaptic != NULL)
|
||||||
|
{
|
||||||
|
sprintf(text, "Haptic joystick found: %d / Name: %s / GUID: %s\n", i, name, guid_str);
|
||||||
|
hlp.log(text);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
IgnoreFirstMatchingGUID = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If no haptic controller has been found, we select the first controller matching the guid.
|
|
||||||
if (ControllerHaptic == NULL && FirstGameController != NULL)
|
if (ControllerHaptic == NULL && FirstGameController != NULL) // If no haptic controller has been found, we select the first controller matching the guid.
|
||||||
{
|
{
|
||||||
GameController = FirstGameController;
|
GameController = FirstGameController;
|
||||||
hlp.log(firstJoystickSelectedText);
|
hlp.log(firstJoystickSelectedText);
|
||||||
|
@ -1 +1 @@
|
|||||||
v2.0.0.10
|
v2.0.0.11
|
Loading…
x
Reference in New Issue
Block a user