multiplayer disconnected controller fixes (#725)

* wip fixes

* remove commented out stuff

* clang format
This commit is contained in:
briaguya
2024-12-01 13:16:25 -05:00
committed by GitHub
parent 09aec10779
commit 5e34a4eb47
2 changed files with 7 additions and 10 deletions
@@ -139,15 +139,10 @@ void ControllerDisconnectedWindow::DrawElement() {
return;
}
ImGui::OpenPopup("Controller Disconnected");
if (ImGui::BeginPopupModal("Controller Disconnected", NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
// todo: don't use UINT8_MAX-1 to mean we don't know what controller was disconnected
if (mPortIndexOfDisconnectedController == UINT8_MAX - 1) {
DrawUnknownOrMultipleControllersDisconnected();
} else {
DrawKnownControllerDisconnected();
}
ImGui::EndPopup();
if (mPortIndexOfDisconnectedController == UINT8_MAX - 1) {
DrawUnknownOrMultipleControllersDisconnected();
} else {
DrawKnownControllerDisconnected();
}
}
@@ -409,6 +409,8 @@ void ShipDeviceIndexMappingManager::HandlePhysicalDeviceDisconnectSinglePlayer(i
}
void ShipDeviceIndexMappingManager::HandlePhysicalDeviceDisconnectMultiplayer(int32_t sdlJoystickInstanceId) {
auto portIndexOfPhysicalDeviceThatHasBeenDisconnected =
GetPortIndexOfDisconnectedPhysicalDevice(sdlJoystickInstanceId);
auto lusIndexOfPhysicalDeviceThatHasBeenDisconnected =
GetShipDeviceIndexOfDisconnectedPhysicalDevice(sdlJoystickInstanceId);
@@ -439,7 +441,7 @@ void ShipDeviceIndexMappingManager::HandlePhysicalDeviceDisconnectMultiplayer(in
Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Controller Disconnected"));
if (controllerDisconnectedWindow != nullptr) {
controllerDisconnectedWindow->SetPortIndexOfDisconnectedController(
GetPortIndexOfDisconnectedPhysicalDevice(sdlJoystickInstanceId));
portIndexOfPhysicalDeviceThatHasBeenDisconnected);
controllerDisconnectedWindow->Show();
}
continue;