mirror of
https://github.com/izzy2lost/libultraship.git
synced 2026-06-19 01:16:13 -07:00
multiplayer disconnected controller fixes (#725)
* wip fixes * remove commented out stuff * clang format
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user