cleanup loop (#784)

This commit is contained in:
Logan McNaughton 2026-04-20 02:34:27 -06:00 committed by GitHub
parent 9e337295ca
commit b8c3556df6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -223,17 +223,11 @@ fn controller_window(
let controller_changed = slint::VecModel::default();
let selected_controllers = slint::VecModel::default();
for selected in config.input.controller_assignment.iter() {
let mut found = false;
for (i, path) in controller_paths.iter().enumerate() {
if selected == path {
selected_controllers.push(i as i32);
found = true;
continue;
}
}
if !found {
selected_controllers.push(0);
}
let selected_index = controller_paths
.iter()
.position(|path| selected == path)
.unwrap_or(0) as i32;
selected_controllers.push(selected_index);
controller_changed.push(false);
}
app.set_selected_controller(slint::ModelRc::from(std::rc::Rc::new(selected_controllers)));