From b6301e1a43a4066617cdebf84398203437f25123 Mon Sep 17 00:00:00 2001 From: Albert Liu <45282415+ggrtk@users.noreply.github.com> Date: Fri, 26 Feb 2021 09:37:53 -0800 Subject: [PATCH] Settings: Always save controller type to settings interface Fixes Controller1 defaulting to DigitalController type on startup in FullscreenUI when user had previously shut down the program with Controller1 set to None. --- src/core/settings.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 92cbf7d3d..a79b347f6 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -387,15 +387,11 @@ void Settings::Save(SettingsInterface& si) const si.SetBoolValue("BIOS", "PatchTTYEnable", bios_patch_tty_enable); si.SetBoolValue("BIOS", "PatchFastBoot", bios_patch_fast_boot); - if (controller_types[0] != ControllerType::None) - si.SetStringValue("Controller1", "Type", GetControllerTypeName(controller_types[0])); - else - si.DeleteValue("Controller1", "Type"); - - if (controller_types[1] != ControllerType::None) - si.SetStringValue("Controller2", "Type", GetControllerTypeName(controller_types[1])); - else - si.DeleteValue("Controller2", "Type"); + for (u32 i = 0; i < NUM_CONTROLLER_AND_CARD_PORTS; i++) + { + si.SetStringValue(TinyString::FromFormat("Controller%u", i + 1u), "Type", + GetControllerTypeName(controller_types[i])); + } si.SetStringValue("MemoryCards", "Card1Type", GetMemoryCardTypeName(memory_card_types[0])); si.SetStringValue("MemoryCards", "Card1Path", memory_card_paths[0].c_str());