mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-06-06 01:13:45 -04:00
[qt] fix crashes due to invalid configs
Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
5ba3ae32dc
commit
28e8713a24
5 changed files with 12 additions and 15 deletions
|
|
@ -336,7 +336,7 @@ struct Values {
|
|||
RendererBackend::Vulkan,
|
||||
#endif
|
||||
"backend", Category::Renderer};
|
||||
SwitchableSetting<int> vulkan_device{linkage, 0, "vulkan_device", Category::Renderer, Specialization::RuntimeList};
|
||||
SwitchableSetting<u32> vulkan_device{linkage, 0, "vulkan_device", Category::Renderer, Specialization::RuntimeList};
|
||||
|
||||
// Graphics Settings
|
||||
ResolutionScalingInfo resolution_info{};
|
||||
|
|
@ -661,8 +661,8 @@ struct Values {
|
|||
false, true, &custom_rtc_enabled};
|
||||
SwitchableSetting<s64, true> custom_rtc_offset{linkage,
|
||||
0,
|
||||
(std::numeric_limits<int>::min)(),
|
||||
(std::numeric_limits<int>::max)(),
|
||||
(std::numeric_limits<s64>::min)(),
|
||||
(std::numeric_limits<s64>::max)(),
|
||||
"custom_rtc_offset",
|
||||
Category::System,
|
||||
Specialization::Countable,
|
||||
|
|
@ -751,7 +751,7 @@ struct Values {
|
|||
|
||||
Setting<std::string> touch_device{linkage, "min_x:100,min_y:50,max_x:1800,max_y:850",
|
||||
"touch_device", Category::Controls};
|
||||
Setting<int> touch_from_button_map_index{linkage, 0, "touch_from_button_map",
|
||||
Setting<u32> touch_from_button_map_index{linkage, 0, "touch_from_button_map",
|
||||
Category::Controls};
|
||||
std::vector<TouchFromButtonMap> touch_from_button_maps;
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ protected:
|
|||
} else if constexpr (std::is_floating_point_v<Type>) {
|
||||
return fmt::format("{:f}", value_);
|
||||
} else if constexpr (std::is_enum_v<Type>) {
|
||||
return std::to_string(u32(value_));
|
||||
return std::to_string(std::underlying_type_t<Type>(value_));
|
||||
} else {
|
||||
return std::to_string(value_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -263,8 +263,7 @@ void Config::ReadMotionTouchValues() {
|
|||
}
|
||||
EndArray(); // touch_from_button_maps
|
||||
|
||||
Settings::values.touch_from_button_map_index = std::clamp(
|
||||
Settings::values.touch_from_button_map_index.GetValue(), 0, num_touch_from_button_maps - 1);
|
||||
Settings::values.touch_from_button_map_index = (std::min)(Settings::values.touch_from_button_map_index.GetValue(), u32(num_touch_from_button_maps - 1));
|
||||
}
|
||||
|
||||
void Config::ReadCoreValues() {
|
||||
|
|
|
|||
|
|
@ -89,11 +89,10 @@ std::string BuildCommaSeparatedExtensions(
|
|||
|
||||
} // Anonymous namespace
|
||||
|
||||
Device CreateDevice(const vk::Instance& instance, const vk::InstanceDispatch& dld,
|
||||
VkSurfaceKHR surface) {
|
||||
Device CreateDevice(const vk::Instance& instance, const vk::InstanceDispatch& dld, VkSurfaceKHR surface) {
|
||||
const std::vector<VkPhysicalDevice> devices = instance.EnumeratePhysicalDevices();
|
||||
const s32 device_index = Settings::values.vulkan_device.GetValue();
|
||||
if (device_index < 0 || device_index >= static_cast<s32>(devices.size())) {
|
||||
const u32 device_index = Settings::values.vulkan_device.GetValue();
|
||||
if (device_index >= u32(devices.size())) {
|
||||
LOG_ERROR(Render_Vulkan, "Invalid device index {}!", device_index);
|
||||
throw vk::Exception(VK_ERROR_INITIALIZATION_FAILED);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue