diff --git a/libultraship/libultraship/InputEditor.cpp b/libultraship/libultraship/InputEditor.cpp index 6239e041a..e97aeee4d 100644 --- a/libultraship/libultraship/InputEditor.cpp +++ b/libultraship/libultraship/InputEditor.cpp @@ -93,10 +93,11 @@ namespace Ship { if (ImGui::BeginCombo("##ControllerEntries", ControllerName.c_str())) { for (uint8_t i = 0; i < controlDeck->GetNumPhysicalDevices(); i++) { - if (ControllerName != "Keyboard" && ControllerName != "Auto") { - ControllerName += "##"+std::to_string(i); + std::string DeviceName = controlDeck->GetPhysicalDevice(i)->GetControllerName(); + if (DeviceName != "Keyboard" && DeviceName != "Auto") { + DeviceName += "##"+std::to_string(i); } - if (ImGui::Selectable(ControllerName.c_str(), i == controlDeck->GetVirtualDevice(CurrentPort))) { + if (ImGui::Selectable(DeviceName.c_str(), i == controlDeck->GetVirtualDevice(CurrentPort))) { controlDeck->SetPhysicalDevice(CurrentPort, i); } } @@ -151,7 +152,7 @@ namespace Ship { #ifdef __WIIU__ ImGui::BeginChild("##MSInput", ImVec2(90 * 2, 50 * 2), false); #else - ImGui::BeginChild("##MSInput", ImVec2(90 , 50), false); + ImGui::BeginChild("##MSInput", ImVec2(90, 50), false); #endif ImGui::Text("Deadzone"); #ifdef __WIIU__ @@ -159,7 +160,12 @@ namespace Ship { #else ImGui::PushItemWidth(80); #endif - ImGui::InputFloat("##MDZone", &profile->AxisDeadzones[0] /* This is the SDL value for left stick X axis */, 1.0f, 0.0f, "%.0f"); + // The window has deadzone per stick, so we need to + // set the deadzone for both left stick axes here + // SDL_CONTROLLER_AXIS_LEFTX: 0 + // SDL_CONTROLLER_AXIS_LEFTY: 1 + ImGui::InputFloat("##MDZone", &profile->AxisDeadzones[0], 1.0f, 0.0f, "%.0f"); + profile->AxisDeadzones[1] = profile->AxisDeadzones[0]; ImGui::PopItemWidth(); ImGui::EndChild(); } else { @@ -198,7 +204,12 @@ namespace Ship { #else ImGui::PushItemWidth(80); #endif - ImGui::InputFloat("##MDZone", &profile->AxisDeadzones[2] /* This is the SDL value for right stick X axis */, 1.0f, 0.0f, "%.0f"); + // The window has deadzone per stick, so we need to + // set the deadzone for both right stick axes here + // SDL_CONTROLLER_AXIS_RIGHTX: 2 + // SDL_CONTROLLER_AXIS_RIGHTY: 3 + ImGui::InputFloat("##MDZone", &profile->AxisDeadzones[2], 1.0f, 0.0f, "%.0f"); + profile->AxisDeadzones[3] = profile->AxisDeadzones[2]; ImGui::PopItemWidth(); ImGui::Text("Sensitivity"); #ifdef __WIIU__ @@ -206,7 +217,11 @@ namespace Ship { #else ImGui::PushItemWidth(80); #endif - ImGui::InputFloat("##MSensitivity", &profile->AxisSensitivities[2] /* This is the SDL value for right stick X axis */, 1.0f, 0.0f, "%.0f"); + // The window has sensitivity per stick, so we need to + // set the sensitivity for both right stick axes here + // SDL_CONTROLLER_AXIS_RIGHTX: 2 + // SDL_CONTROLLER_AXIS_RIGHTY: 3 + ImGui::InputFloat("##MSensitivity", &profile->AxisSensitivities[2], 1.0f, 0.0f, "%.0f"); profile->AxisSensitivities[3] = profile->AxisSensitivities[2]; ImGui::PopItemWidth(); ImGui::EndChild(); diff --git a/libultraship/libultraship/SDLController.cpp b/libultraship/libultraship/SDLController.cpp index 85a9b6fb4..83f6424e1 100644 --- a/libultraship/libultraship/SDLController.cpp +++ b/libultraship/libultraship/SDLController.cpp @@ -21,6 +21,7 @@ namespace Ship { return false; } + supportsGyro = false; if (SDL_GameControllerHasSensor(NewCont, SDL_SENSOR_GYRO)) { SDL_GameControllerSetSensorEnabled(NewCont, SDL_SENSOR_GYRO, SDL_TRUE); supportsGyro = true;