From 6449207e045645ee91519b64fb14f688ab6e0bac Mon Sep 17 00:00:00 2001 From: Jake Stine Date: Sun, 14 Feb 2021 11:01:06 -0800 Subject: [PATCH] pad: remove unreachable code block in DoState The block in question was introduced by changesets: 47f0720b936 125d104df4f --- src/core/pad.cpp | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/src/core/pad.cpp b/src/core/pad.cpp index 4b48e2231..d23bb7c3f 100644 --- a/src/core/pad.cpp +++ b/src/core/pad.cpp @@ -67,40 +67,19 @@ bool Pad::DoState(StateWrapper& sw) { if (controller_type != state_controller_type) { - if (g_settings.load_devices_from_save_states) - { - g_host_interface->AddFormattedOSDMessage( - 10.0f, - g_host_interface->TranslateString( - "OSDMessage", "Save state contains controller type %s in port %u, but %s is used. Switching."), - Settings::GetControllerTypeName(state_controller_type), i + 1u, - Settings::GetControllerTypeName(controller_type)); - - m_controllers[i].reset(); - if (state_controller_type != ControllerType::None) - { - m_controllers[i] = Controller::Create(state_controller_type, i); - if (!sw.DoMarker("Controller") || !m_controllers[i]->DoState(sw, false)) - return false; - } - } - else + g_host_interface->AddFormattedOSDMessage( + 10.0f, + g_host_interface->TranslateString( + "OSDMessage", "Save state contains controller type %s in port %u, but %s is used. Switching."), + Settings::GetControllerTypeName(state_controller_type), i + 1u, + Settings::GetControllerTypeName(controller_type)); + + m_controllers[i].reset(); + if (state_controller_type != ControllerType::None) { - g_host_interface->AddFormattedOSDMessage( - 10.0f, - g_host_interface->TranslateString("OSDMessage", "Ignoring mismatched controller type %s in port %u."), - Settings::GetControllerTypeName(state_controller_type), i + 1u); - - // we still need to read the save state controller state - if (state_controller_type != ControllerType::None) - { - std::unique_ptr dummy_controller = Controller::Create(state_controller_type, i); - if (dummy_controller) - { - if (!sw.DoMarker("Controller") || !dummy_controller->DoState(sw, true)) - return false; - } - } + m_controllers[i] = Controller::Create(state_controller_type, i); + if (!sw.DoMarker("Controller") || !m_controllers[i]->DoState(sw, false)) + return false; } } else