diff options
| author | lizzie <lizzie@eden-emu.dev> | 2026-06-14 20:48:24 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-06-14 20:48:24 +0200 |
| commit | 60e10327715e420f652ed148e72e22ce8ded55a3 (patch) | |
| tree | 8ab3722ac19e31d61e85e7134ebfe4232b1bc540 /src/yuzu | |
| parent | 10713532917591445080bee19159447b683b548a (diff) | |
[qt] fix various crashes due to invalid/corrupted/outdated settings (#4070)
lots of "out of index" errors :)
Signed-off-by: lizzie <lizzie@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4070
Reviewed-by: crueter <crueter@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Diffstat (limited to 'src/yuzu')
| -rw-r--r-- | src/yuzu/configuration/configure_motion_touch.cpp | 7 | ||||
| -rw-r--r-- | src/yuzu/game/game_list.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu/main_window.cpp | 14 |
3 files changed, 12 insertions, 17 deletions
diff --git a/src/yuzu/configuration/configure_motion_touch.cpp b/src/yuzu/configuration/configure_motion_touch.cpp index d1bcac12aa..2083315c03 100644 --- a/src/yuzu/configuration/configure_motion_touch.cpp +++ b/src/yuzu/configuration/configure_motion_touch.cpp @@ -94,11 +94,10 @@ void ConfigureMotionTouch::SetConfiguration() { const Common::ParamPackage touch_param(Settings::values.touch_device.GetValue()); touch_from_button_maps = Settings::values.touch_from_button_maps; - for (const auto& touch_map : touch_from_button_maps) { + for (const auto& touch_map : touch_from_button_maps) ui->touch_from_button_map->addItem(QString::fromStdString(touch_map.name)); - } - ui->touch_from_button_map->setCurrentIndex( - Settings::values.touch_from_button_map_index.GetValue()); + if (auto const index = Settings::values.touch_from_button_map_index.GetValue(); int(index) < ui->touch_from_button_map->count()) + ui->touch_from_button_map->setCurrentIndex(index); min_x = touch_param.Get("min_x", 100); min_y = touch_param.Get("min_y", 50); diff --git a/src/yuzu/game/game_list.cpp b/src/yuzu/game/game_list.cpp index 63267ddec6..521c5607f5 100644 --- a/src/yuzu/game/game_list.cpp +++ b/src/yuzu/game/game_list.cpp @@ -183,7 +183,7 @@ void GameList::ResetViewMode() { tree_view->setVisible(false); break; default: - break; + UNREACHABLE(); } auto view = m_currentView->viewport(); @@ -196,10 +196,8 @@ void GameList::ResetViewMode() { auto scroller = QScroller::scroller(view); QScrollerProperties props; - props.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, - QScrollerProperties::OvershootAlwaysOff); - props.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, - QScrollerProperties::OvershootAlwaysOff); + props.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff); + props.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff); scroller->setScrollerProperties(props); if (m_isTreeMode != newTreeMode) { diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp index 4c53ef1221..0160b74e24 100644 --- a/src/yuzu/main_window.cpp +++ b/src/yuzu/main_window.cpp @@ -1088,10 +1088,9 @@ void MainWindow::InitializeWidgets() { aa_status_button->setFocusPolicy(Qt::NoFocus); connect(aa_status_button, &QPushButton::clicked, [&] { auto aa_mode = Settings::values.anti_aliasing.GetValue(); - aa_mode = static_cast<Settings::AntiAliasing>(static_cast<u32>(aa_mode) + 1); - if (aa_mode == Settings::AntiAliasing::MaxEnum) { - aa_mode = Settings::AntiAliasing::None; - } + aa_mode = Settings::AntiAliasing(u32(aa_mode) + 1); + if (u32(aa_mode) > u32(Settings::EnumMetadata<Settings::AntiAliasing>::GetLast())) + aa_mode = Settings::EnumMetadata<Settings::AntiAliasing>::GetFirst(); Settings::values.anti_aliasing.SetValue(aa_mode); aa_status_button->setChecked(true); UpdateAAText(); @@ -3623,10 +3622,9 @@ void MainWindow::OnIncreaseVolume() { void MainWindow::OnToggleAdaptingFilter() { auto filter = Settings::values.scaling_filter.GetValue(); - filter = static_cast<Settings::ScalingFilter>(static_cast<u32>(filter) + 1); - if (filter == Settings::ScalingFilter::MaxEnum) { - filter = Settings::ScalingFilter::NearestNeighbor; - } + filter = Settings::ScalingFilter(u32(filter) + 1); + if (u32(filter) > u32(Settings::EnumMetadata<Settings::ScalingFilter>::GetLast())) + filter = Settings::EnumMetadata<Settings::ScalingFilter>::GetFirst(); Settings::values.scaling_filter.SetValue(filter); filter_status_button->setChecked(true); UpdateFilterText(); |
