From 5250911a4085ca112df5da11d2a7d01a20d103c5 Mon Sep 17 00:00:00 2001 From: AnnieL Date: Wed, 16 Mar 2016 19:48:02 +0000 Subject: [PATCH] Fixes #1584 When DirectX 12 is missing, the emulator thinks Vulkan = DirectX 12 because Vulkan takes DX12's place in the box (id=2), and therefore runs DX12 when Vulkan is selected, crashing the emulator with an unhandled exception. Fixes it by translating renderer string value to the respective enum class before sending the value to config.h instead of just relying on the box's selected id -> cbox_gs_render->GetSelection() Also changes the order of the renderers (for convinience, now DX12 is id=3) from Null, OpenGL, DirectX 12, Vulkan to Null, OpenGL, Vulkan, DirectX 12 --- rpcs3/Gui/SettingsDialog.cpp | 13 +++++++++++-- rpcs3/config.h | 12 ++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/rpcs3/Gui/SettingsDialog.cpp b/rpcs3/Gui/SettingsDialog.cpp index b191917fb6..f9dc6d7bfd 100644 --- a/rpcs3/Gui/SettingsDialog.cpp +++ b/rpcs3/Gui/SettingsDialog.cpp @@ -229,6 +229,7 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) cbox_gs_render->Append("Null"); cbox_gs_render->Append("OpenGL"); + cbox_gs_render->Append("Vulkan"); #ifdef _MSC_VER Microsoft::WRL::ComPtr dxgiFactory; @@ -251,7 +252,6 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) chbox_gs_overlay->Enable(false); } - cbox_gs_render->Append("Vulkan"); #endif for (int i = 1; i < WXSIZEOF(ResolutionTable); ++i) @@ -503,7 +503,16 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg) cfg->core.hook_st_func = chbox_core_hook_stfunc->GetValue(); cfg->core.load_liblv2 = chbox_core_load_liblv2->GetValue(); - cfg->rsx.renderer = cbox_gs_render->GetSelection(); + // Translates renderer string to enum class for config.h + if (cbox_gs_render->GetString(cbox_gs_render->GetSelection()) == "Null") + cfg->rsx.renderer = rsx_renderer_type::Null; + if (cbox_gs_render->GetString(cbox_gs_render->GetSelection()) == "OpenGL") + cfg->rsx.renderer = rsx_renderer_type::OpenGL; + if (cbox_gs_render->GetString(cbox_gs_render->GetSelection()) == "Vulkan") + cfg->rsx.renderer = rsx_renderer_type::Vulkan; + if (cbox_gs_render->GetString(cbox_gs_render->GetSelection()) == "DirectX 12") + cfg->rsx.renderer = rsx_renderer_type::DX12; + cfg->rsx.d3d12.adaptater = cbox_gs_d3d_adaptater->GetSelection(); cfg->rsx.resolution = ResolutionNumToId(cbox_gs_resolution->GetSelection() + 1); cfg->rsx.aspect_ratio = cbox_gs_aspect->GetSelection() + 1; diff --git a/rpcs3/config.h b/rpcs3/config.h index 0c565d9c32..6d1ecd87f0 100644 --- a/rpcs3/config.h +++ b/rpcs3/config.h @@ -50,8 +50,8 @@ enum class rsx_renderer_type { Null, OpenGL, - DX12, - Vulkan + Vulkan, + DX12 }; enum class rsx_aspect_ratio @@ -93,8 +93,8 @@ namespace convert { case rsx_renderer_type::Null: return "Null"; case rsx_renderer_type::OpenGL: return "OpenGL"; - case rsx_renderer_type::DX12: return "DX12"; case rsx_renderer_type::Vulkan: return "Vulkan"; + case rsx_renderer_type::DX12: return "DX12"; } return "Unknown"; @@ -112,12 +112,12 @@ namespace convert if (value == "OpenGL") return rsx_renderer_type::OpenGL; - if (value == "DX12") - return rsx_renderer_type::DX12; - if (value == "Vulkan") return rsx_renderer_type::Vulkan; + if (value == "DX12") + return rsx_renderer_type::DX12; + return rsx_renderer_type::Null; } };