Modify Joystick Instance stuff
This commit is contained in:
parent
1d41447940
commit
7965d74479
@ -1036,7 +1036,6 @@ void Initialize(int device_index)
|
||||
{
|
||||
SDL_Joystick* js = SDL_JoystickOpen(i);
|
||||
const char* name = SDL_JoystickName(js);
|
||||
joystick_index1 = SDL_JoystickInstanceID(js);
|
||||
guid = SDL_JoystickGetGUID(js);
|
||||
if (ForceShowDeviceGUIDMessageBox == 1)
|
||||
{
|
||||
@ -1057,6 +1056,7 @@ void Initialize(int device_index)
|
||||
{
|
||||
joystick1Index = i;
|
||||
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)
|
||||
|
@ -13,7 +13,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include "AfterburnerClimax.h"
|
||||
#include "SDL.h"
|
||||
|
||||
void AfterburnerClimax::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) {
|
||||
UINT8 ff = helpers->ReadByte(0x08347A5E, /* isRelativeOffset */ false);
|
||||
|
||||
|
@ -85,7 +85,6 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
@ -97,6 +96,7 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(GameController2);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
}
|
||||
|
@ -73,7 +73,6 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
@ -85,6 +84,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(GameController2);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
}
|
||||
|
@ -73,7 +73,6 @@ void ATVTrackInputsEnabled(Helpers* helpers)
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
@ -86,6 +85,7 @@ void ATVTrackInputsEnabled(Helpers* helpers)
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(GameController2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,6 @@ void FasterThanSpeedInputsEnabled(Helpers* helpers)
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
@ -81,6 +80,7 @@ void FasterThanSpeedInputsEnabled(Helpers* helpers)
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(GameController2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,6 @@ void InitialDInputsEnabled(Helpers* helpers)
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
@ -88,6 +87,7 @@ void InitialDInputsEnabled(Helpers* helpers)
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(GameController2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,6 @@ void MaximumSpeedInputsEnabled(Helpers* helpers)
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
@ -78,6 +77,7 @@ void MaximumSpeedInputsEnabled(Helpers* helpers)
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(GameController2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,6 @@ void NascarInputsEnabled(Helpers* helpers)
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
@ -90,6 +89,7 @@ void NascarInputsEnabled(Helpers* helpers)
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(GameController2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,6 @@ void SmashingDriveInputsEnabled(Helpers* helpers)
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
@ -82,6 +81,7 @@ void SmashingDriveInputsEnabled(Helpers* helpers)
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(GameController2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,6 @@ void GoldenGun::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrig
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
@ -95,6 +94,7 @@ void GoldenGun::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrig
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(GameController2);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
}
|
||||
|
@ -305,7 +305,6 @@ void HOTD4::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
@ -317,6 +316,7 @@ void HOTD4::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(GameController2);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
}
|
||||
|
@ -71,7 +71,6 @@ void LGI::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers*
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
@ -83,6 +82,7 @@ void LGI::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers*
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(GameController2);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
}
|
||||
|
@ -72,7 +72,6 @@ void LGI3D::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
@ -84,6 +83,7 @@ void LGI3D::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(GameController2);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
}
|
||||
|
@ -1565,7 +1565,6 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
@ -1577,6 +1576,7 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(GameController2);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
}
|
||||
@ -1603,7 +1603,6 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js3 = SDL_JoystickOpen(i);
|
||||
joystick_index3 = SDL_JoystickInstanceID(js3);
|
||||
SDL_JoystickGUID guid2 = SDL_JoystickGetGUID(js3);
|
||||
char guid_str2[1024];
|
||||
SDL_JoystickGetGUIDString(guid2, guid_str2, sizeof(guid_str2));
|
||||
@ -1615,6 +1614,7 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
|
||||
if (!memcmp(&guid2, &dev_guid2, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController3 = SDL_JoystickOpen(i);
|
||||
joystick_index3 = SDL_JoystickInstanceID(GameController3);
|
||||
ControllerHaptic3 = SDL_HapticOpenFromJoystick(GameController3);
|
||||
break;
|
||||
}
|
||||
|
@ -90,7 +90,6 @@ void Rambo::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers
|
||||
continue;
|
||||
}
|
||||
SDL_Joystick* js2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(js2);
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetGUID(js2);
|
||||
char guid_str[1024];
|
||||
SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
|
||||
@ -102,6 +101,7 @@ void Rambo::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers
|
||||
if (!memcmp(&guid, &dev_guid, sizeof(SDL_JoystickGUID)))
|
||||
{
|
||||
GameController2 = SDL_JoystickOpen(i);
|
||||
joystick_index2 = SDL_JoystickInstanceID(GameController2);
|
||||
ControllerHaptic2 = SDL_HapticOpenFromJoystick(GameController2);
|
||||
break;
|
||||
}
|
||||
|
@ -69,17 +69,17 @@ void StormRacerG::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTr
|
||||
|
||||
if (FFB & 0x01)
|
||||
{
|
||||
myTriggers->Rumble(percentForce, percentForce, 150);
|
||||
triggers->Rumble(percentForce, percentForce, 150);
|
||||
}
|
||||
|
||||
if (FFB & 0x02)
|
||||
{
|
||||
myTriggers->Rumble(percentForce, percentForce, 150);
|
||||
triggers->Rumble(percentForce, percentForce, 150);
|
||||
}
|
||||
|
||||
if (FFB & 0x08)
|
||||
{
|
||||
myTriggers->Rumble(percentForce, percentForce, 150);
|
||||
triggers->Rumble(percentForce, percentForce, 150);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user