@@ -21,16 +21,6 @@ std::shared_ptr<ControllerGyroMapping> GyroMappingFactory::CreateGyroMappingFrom
21
21
}
22
22
23
23
if (mappingClass == " SDLGyroMapping" ) {
24
- int32_t shipDeviceIndex =
25
- CVarGetInteger (StringHelper::Sprintf (" %s.ShipDeviceIndex" , mappingCvarKey.c_str ()).c_str (), -1 );
26
-
27
- if (shipDeviceIndex < 0 ) {
28
- // something about this mapping is invalid
29
- CVarClear (mappingCvarKey.c_str ());
30
- CVarSave ();
31
- return nullptr ;
32
- }
33
-
34
24
float neutralPitch =
35
25
CVarGetFloat (StringHelper::Sprintf (" %s.NeutralPitch" , mappingCvarKey.c_str ()).c_str (), 0 .0f );
36
26
float neutralYaw = CVarGetFloat (StringHelper::Sprintf (" %s.NeutralYaw" , mappingCvarKey.c_str ()).c_str (), 0 .0f );
@@ -45,15 +35,15 @@ std::shared_ptr<ControllerGyroMapping> GyroMappingFactory::CreateGyroMappingFrom
45
35
std::shared_ptr<ControllerGyroMapping> GyroMappingFactory::CreateGyroMappingFromSDLInput (uint8_t portIndex) {
46
36
std::shared_ptr<ControllerGyroMapping> mapping = nullptr ;
47
37
48
- for (auto [lusIndex, controller ] :
38
+ for (auto [instanceId, gamepad ] :
49
39
Context::GetInstance ()->GetControlDeck ()->GetConnectedPhysicalDeviceManager ()->GetConnectedSDLGamepadsForPort (
50
40
portIndex)) {
51
- if (!SDL_GameControllerHasSensor (controller , SDL_SENSOR_GYRO)) {
41
+ if (!SDL_GameControllerHasSensor (gamepad , SDL_SENSOR_GYRO)) {
52
42
continue ;
53
43
}
54
44
55
45
for (int32_t button = SDL_CONTROLLER_BUTTON_A; button < SDL_CONTROLLER_BUTTON_MAX; button++) {
56
- if (SDL_GameControllerGetButton (controller , static_cast <SDL_GameControllerButton>(button))) {
46
+ if (SDL_GameControllerGetButton (gamepad , static_cast <SDL_GameControllerButton>(button))) {
57
47
mapping = std::make_shared<SDLGyroMapping>(portIndex, 1 .0f , 0 .0f , 0 .0f , 0 .0f );
58
48
mapping->Recalibrate ();
59
49
break ;
@@ -66,7 +56,7 @@ std::shared_ptr<ControllerGyroMapping> GyroMappingFactory::CreateGyroMappingFrom
66
56
67
57
for (int32_t i = SDL_CONTROLLER_AXIS_LEFTX; i < SDL_CONTROLLER_AXIS_MAX; i++) {
68
58
const auto axis = static_cast <SDL_GameControllerAxis>(i);
69
- const auto axisValue = SDL_GameControllerGetAxis (controller , axis) / 32767 .0f ;
59
+ const auto axisValue = SDL_GameControllerGetAxis (gamepad , axis) / 32767 .0f ;
70
60
int32_t axisDirection = 0 ;
71
61
if (axisValue < -0 .7f ) {
72
62
axisDirection = NEGATIVE;
0 commit comments