From 2281bf5b0bd8cf5eb7bffb52145ce75cae3611e0 Mon Sep 17 00:00:00 2001 From: PabloMK7 Date: Mon, 22 May 2023 04:01:26 +0200 Subject: [PATCH] Add range check for renderer config (#6560) --- src/common/settings.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/settings.h b/src/common/settings.h index 0d980406f..da0b661ad 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -17,6 +17,7 @@ namespace Settings { +constexpr u32 GraphicsAPICount = 2; enum class GraphicsAPI { Software = 0, OpenGL = 1, @@ -425,7 +426,9 @@ struct Values { Setting allow_plugin_loader{true, "allow_plugin_loader"}; // Renderer - SwitchableSetting graphics_api{GraphicsAPI::OpenGL, "graphics_api"}; + SwitchableSetting graphics_api{ + GraphicsAPI::OpenGL, GraphicsAPI::Software, static_cast(GraphicsAPICount - 1), + "graphics_api"}; Setting use_gles{false, "use_gles"}; Setting renderer_debug{false, "renderer_debug"}; SwitchableSetting use_hw_shader{true, "use_hw_shader"};