mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 18:45:45 -04:00
Settings: Load Memory Cards From State -> Load Devices From State
Makes it apply to controllers too.
This commit is contained in:
@ -333,6 +333,7 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
|
||||
si.SetBoolValue("Main", "StartPaused", false);
|
||||
si.SetBoolValue("Main", "SaveStateOnExit", true);
|
||||
si.SetBoolValue("Main", "ConfirmPowerOff", true);
|
||||
si.SetBoolValue("Main", "LoadDevicesFromSaveStates", false);
|
||||
|
||||
si.SetStringValue("CPU", "ExecutionMode", Settings::GetCPUExecutionModeName(Settings::DEFAULT_CPU_EXECUTION_MODE));
|
||||
|
||||
@ -374,7 +375,6 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
|
||||
si.SetStringValue("Controller1", "Type", Settings::GetControllerTypeName(Settings::DEFAULT_CONTROLLER_1_TYPE));
|
||||
si.SetStringValue("Controller2", "Type", Settings::GetControllerTypeName(Settings::DEFAULT_CONTROLLER_2_TYPE));
|
||||
|
||||
si.SetBoolValue("MemoryCards", "LoadFromSaveStates", false);
|
||||
si.SetStringValue("MemoryCards", "Card1Type", Settings::GetMemoryCardTypeName(Settings::DEFAULT_MEMORY_CARD_1_TYPE));
|
||||
si.SetStringValue("MemoryCards", "Card1Path", "memcards/shared_card_1.mcd");
|
||||
si.SetStringValue("MemoryCards", "Card2Type", Settings::GetMemoryCardTypeName(Settings::DEFAULT_MEMORY_CARD_2_TYPE));
|
||||
|
@ -44,25 +44,48 @@ bool Pad::DoState(StateWrapper& sw)
|
||||
|
||||
if (controller_type != state_controller_type)
|
||||
{
|
||||
m_system->GetHostInterface()->AddFormattedOSDMessage(
|
||||
2.0f, "Save state contains controller type %s in port %u, but %s is used. Switching.",
|
||||
Settings::GetControllerTypeName(state_controller_type), i, Settings::GetControllerTypeName(controller_type));
|
||||
if (m_system->GetSettings().load_devices_from_save_states)
|
||||
{
|
||||
m_system->GetHostInterface()->AddFormattedOSDMessage(
|
||||
2.0f, "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(m_system, state_controller_type, i);
|
||||
m_controllers[i].reset();
|
||||
if (state_controller_type != ControllerType::None)
|
||||
m_controllers[i] = Controller::Create(m_system, state_controller_type, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_system->GetHostInterface()->AddFormattedOSDMessage(2.0f, "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<Controller> dummy_controller = Controller::Create(m_system, state_controller_type, i);
|
||||
if (dummy_controller)
|
||||
{
|
||||
if (!sw.DoMarker("Controller") || !dummy_controller->DoState(sw))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_controllers[i])
|
||||
else
|
||||
{
|
||||
if (!sw.DoMarker("Controller") || !m_controllers[i]->DoState(sw))
|
||||
return false;
|
||||
if (m_controllers[i])
|
||||
{
|
||||
if (!sw.DoMarker("Controller") || !m_controllers[i]->DoState(sw))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool card_present = static_cast<bool>(m_memory_cards[i]);
|
||||
sw.Do(&card_present);
|
||||
|
||||
if (sw.IsReading() && card_present && !m_system->GetSettings().load_memory_cards_from_save_states)
|
||||
if (sw.IsReading() && card_present && !m_system->GetSettings().load_devices_from_save_states)
|
||||
{
|
||||
Log_WarningPrintf("Skipping loading memory card %u from save state.", i + 1u);
|
||||
|
||||
|
@ -81,6 +81,7 @@ void Settings::Load(SettingsInterface& si)
|
||||
start_fullscreen = si.GetBoolValue("Main", "StartFullscreen", false);
|
||||
save_state_on_exit = si.GetBoolValue("Main", "SaveStateOnExit", true);
|
||||
confim_power_off = si.GetBoolValue("Main", "ConfirmPowerOff", true);
|
||||
load_devices_from_save_states = si.GetBoolValue("Main", "LoadDevicesFromSaveStates", false);
|
||||
|
||||
cpu_execution_mode =
|
||||
ParseCPUExecutionMode(
|
||||
@ -146,7 +147,6 @@ void Settings::Load(SettingsInterface& si)
|
||||
|
||||
// NOTE: The default value here if not present in the config is shared, but SetDefaultSettings() makes per-game.
|
||||
// This is so we don't break older builds which had the shared card by default.
|
||||
load_memory_cards_from_save_states = si.GetBoolValue("MemoryCards", "LoadFromSaveStates", false);
|
||||
memory_card_types[0] =
|
||||
ParseMemoryCardTypeName(
|
||||
si.GetStringValue("MemoryCards", "Card1Type", GetMemoryCardTypeName(DEFAULT_MEMORY_CARD_1_TYPE)).c_str())
|
||||
@ -187,6 +187,7 @@ void Settings::Save(SettingsInterface& si) const
|
||||
si.SetBoolValue("Main", "StartFullscreen", start_fullscreen);
|
||||
si.SetBoolValue("Main", "SaveStateOnExit", save_state_on_exit);
|
||||
si.SetBoolValue("Main", "ConfirmPowerOff", confim_power_off);
|
||||
si.SetBoolValue("Main", "LoadDevicesFromSaveStates", load_devices_from_save_states);
|
||||
|
||||
si.SetStringValue("CPU", "ExecutionMode", GetCPUExecutionModeName(cpu_execution_mode));
|
||||
|
||||
@ -239,7 +240,6 @@ void Settings::Save(SettingsInterface& si) const
|
||||
else
|
||||
si.DeleteValue("Controller2", "Type");
|
||||
|
||||
si.SetBoolValue("MemoryCards", "LoadFromSaveStates", load_memory_cards_from_save_states);
|
||||
si.SetStringValue("MemoryCards", "Card1Type", GetMemoryCardTypeName(memory_card_types[0]));
|
||||
si.SetStringValue("MemoryCards", "Card1Path", memory_card_paths[0].c_str());
|
||||
si.SetStringValue("MemoryCards", "Card2Type", GetMemoryCardTypeName(memory_card_types[1]));
|
||||
|
@ -77,7 +77,7 @@ struct Settings
|
||||
bool start_fullscreen = false;
|
||||
bool save_state_on_exit = true;
|
||||
bool confim_power_off = true;
|
||||
bool load_memory_cards_from_save_states = false;
|
||||
bool load_devices_from_save_states = false;
|
||||
|
||||
GPURenderer gpu_renderer = GPURenderer::Software;
|
||||
std::string gpu_adapter;
|
||||
|
Reference in New Issue
Block a user