Settings: Load Memory Cards From State -> Load Devices From State
Makes it apply to controllers too.
This commit is contained in:
parent
6834f2ca42
commit
b471d1043a
|
@ -333,6 +333,7 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
|
||||||
si.SetBoolValue("Main", "StartPaused", false);
|
si.SetBoolValue("Main", "StartPaused", false);
|
||||||
si.SetBoolValue("Main", "SaveStateOnExit", true);
|
si.SetBoolValue("Main", "SaveStateOnExit", true);
|
||||||
si.SetBoolValue("Main", "ConfirmPowerOff", true);
|
si.SetBoolValue("Main", "ConfirmPowerOff", true);
|
||||||
|
si.SetBoolValue("Main", "LoadDevicesFromSaveStates", false);
|
||||||
|
|
||||||
si.SetStringValue("CPU", "ExecutionMode", Settings::GetCPUExecutionModeName(Settings::DEFAULT_CPU_EXECUTION_MODE));
|
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("Controller1", "Type", Settings::GetControllerTypeName(Settings::DEFAULT_CONTROLLER_1_TYPE));
|
||||||
si.SetStringValue("Controller2", "Type", Settings::GetControllerTypeName(Settings::DEFAULT_CONTROLLER_2_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", "Card1Type", Settings::GetMemoryCardTypeName(Settings::DEFAULT_MEMORY_CARD_1_TYPE));
|
||||||
si.SetStringValue("MemoryCards", "Card1Path", "memcards/shared_card_1.mcd");
|
si.SetStringValue("MemoryCards", "Card1Path", "memcards/shared_card_1.mcd");
|
||||||
si.SetStringValue("MemoryCards", "Card2Type", Settings::GetMemoryCardTypeName(Settings::DEFAULT_MEMORY_CARD_2_TYPE));
|
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)
|
if (controller_type != state_controller_type)
|
||||||
{
|
{
|
||||||
m_system->GetHostInterface()->AddFormattedOSDMessage(
|
if (m_system->GetSettings().load_devices_from_save_states)
|
||||||
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));
|
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();
|
m_controllers[i].reset();
|
||||||
if (state_controller_type != ControllerType::None)
|
if (state_controller_type != ControllerType::None)
|
||||||
m_controllers[i] = Controller::Create(m_system, state_controller_type, i);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (m_controllers[i])
|
|
||||||
{
|
{
|
||||||
if (!sw.DoMarker("Controller") || !m_controllers[i]->DoState(sw))
|
if (m_controllers[i])
|
||||||
return false;
|
{
|
||||||
|
if (!sw.DoMarker("Controller") || !m_controllers[i]->DoState(sw))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool card_present = static_cast<bool>(m_memory_cards[i]);
|
bool card_present = static_cast<bool>(m_memory_cards[i]);
|
||||||
sw.Do(&card_present);
|
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);
|
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);
|
start_fullscreen = si.GetBoolValue("Main", "StartFullscreen", false);
|
||||||
save_state_on_exit = si.GetBoolValue("Main", "SaveStateOnExit", true);
|
save_state_on_exit = si.GetBoolValue("Main", "SaveStateOnExit", true);
|
||||||
confim_power_off = si.GetBoolValue("Main", "ConfirmPowerOff", true);
|
confim_power_off = si.GetBoolValue("Main", "ConfirmPowerOff", true);
|
||||||
|
load_devices_from_save_states = si.GetBoolValue("Main", "LoadDevicesFromSaveStates", false);
|
||||||
|
|
||||||
cpu_execution_mode =
|
cpu_execution_mode =
|
||||||
ParseCPUExecutionMode(
|
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.
|
// 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.
|
// 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] =
|
memory_card_types[0] =
|
||||||
ParseMemoryCardTypeName(
|
ParseMemoryCardTypeName(
|
||||||
si.GetStringValue("MemoryCards", "Card1Type", GetMemoryCardTypeName(DEFAULT_MEMORY_CARD_1_TYPE)).c_str())
|
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", "StartFullscreen", start_fullscreen);
|
||||||
si.SetBoolValue("Main", "SaveStateOnExit", save_state_on_exit);
|
si.SetBoolValue("Main", "SaveStateOnExit", save_state_on_exit);
|
||||||
si.SetBoolValue("Main", "ConfirmPowerOff", confim_power_off);
|
si.SetBoolValue("Main", "ConfirmPowerOff", confim_power_off);
|
||||||
|
si.SetBoolValue("Main", "LoadDevicesFromSaveStates", load_devices_from_save_states);
|
||||||
|
|
||||||
si.SetStringValue("CPU", "ExecutionMode", GetCPUExecutionModeName(cpu_execution_mode));
|
si.SetStringValue("CPU", "ExecutionMode", GetCPUExecutionModeName(cpu_execution_mode));
|
||||||
|
|
||||||
|
@ -239,7 +240,6 @@ void Settings::Save(SettingsInterface& si) const
|
||||||
else
|
else
|
||||||
si.DeleteValue("Controller2", "Type");
|
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", "Card1Type", GetMemoryCardTypeName(memory_card_types[0]));
|
||||||
si.SetStringValue("MemoryCards", "Card1Path", memory_card_paths[0].c_str());
|
si.SetStringValue("MemoryCards", "Card1Path", memory_card_paths[0].c_str());
|
||||||
si.SetStringValue("MemoryCards", "Card2Type", GetMemoryCardTypeName(memory_card_types[1]));
|
si.SetStringValue("MemoryCards", "Card2Type", GetMemoryCardTypeName(memory_card_types[1]));
|
||||||
|
|
|
@ -77,7 +77,7 @@ struct Settings
|
||||||
bool start_fullscreen = false;
|
bool start_fullscreen = false;
|
||||||
bool save_state_on_exit = true;
|
bool save_state_on_exit = true;
|
||||||
bool confim_power_off = 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;
|
GPURenderer gpu_renderer = GPURenderer::Software;
|
||||||
std::string gpu_adapter;
|
std::string gpu_adapter;
|
||||||
|
|
|
@ -12,8 +12,8 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.renderToMain, "Main/RenderToMainWindow");
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.renderToMain, "Main/RenderToMainWindow");
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.saveStateOnExit, "Main/SaveStateOnExit");
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.saveStateOnExit, "Main/SaveStateOnExit");
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.confirmPowerOff, "Main/ConfirmPowerOff");
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.confirmPowerOff, "Main/ConfirmPowerOff");
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.loadMemoryCardsFromSaveStates,
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.loadDevicesFromSaveStates,
|
||||||
"MemoryCards/LoadFromSaveStates");
|
"Main/LoadDevicesFromSaveStates");
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showOSDMessages, "Display/ShowOSDMessages");
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showOSDMessages, "Display/ShowOSDMessages");
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showFPS, "Display/ShowFPS");
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showFPS, "Display/ShowFPS");
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showVPS, "Display/ShowVPS");
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showVPS, "Display/ShowVPS");
|
||||||
|
@ -46,9 +46,10 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
|
||||||
dialog->registerWidgetHelp(m_ui.pauseOnStart, "Pause On Start", "Unchecked",
|
dialog->registerWidgetHelp(m_ui.pauseOnStart, "Pause On Start", "Unchecked",
|
||||||
"Pauses the emulator when a game is started.");
|
"Pauses the emulator when a game is started.");
|
||||||
dialog->registerWidgetHelp(
|
dialog->registerWidgetHelp(
|
||||||
m_ui.loadMemoryCardsFromSaveStates, "Load Memory Cards From Save States", "Unchecked",
|
m_ui.loadDevicesFromSaveStates, "Load Devices From Save States", "Unchecked",
|
||||||
"When enabled, memory cards will be overwritten when save states are loaded. This can "
|
"When enabled, memory cards and controllers will be overwritten when save states are loaded. This can "
|
||||||
"result in lost saves. For deterministic save states, enable this option, otherwise leave disabled.");
|
"result in lost saves, and controller type mismatches. For deterministic save states, enable this option, "
|
||||||
|
"otherwise leave disabled.");
|
||||||
dialog->registerWidgetHelp(m_ui.enableSpeedLimiter, "Enable Speed Limiter", "Checked",
|
dialog->registerWidgetHelp(m_ui.enableSpeedLimiter, "Enable Speed Limiter", "Checked",
|
||||||
"Throttles the emulation speed to the chosen speed above. If unchecked, the emulator will "
|
"Throttles the emulation speed to the chosen speed above. If unchecked, the emulator will "
|
||||||
"run as fast as possible, which may not be playable.");
|
"run as fast as possible, which may not be playable.");
|
||||||
|
|
|
@ -54,9 +54,9 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QCheckBox" name="loadMemoryCardsFromSaveStates">
|
<widget class="QCheckBox" name="loadDevicesFromSaveStates">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Load Memory Cards From Save States</string>
|
<string>Load Devices From Save States</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -1086,7 +1086,7 @@ void SDLHostInterface::DrawSettingsWindow()
|
||||||
settings_changed |= ImGui::Checkbox("Start Fullscreen", &m_settings_copy.start_fullscreen);
|
settings_changed |= ImGui::Checkbox("Start Fullscreen", &m_settings_copy.start_fullscreen);
|
||||||
settings_changed |= ImGui::Checkbox("Save State On Exit", &m_settings_copy.save_state_on_exit);
|
settings_changed |= ImGui::Checkbox("Save State On Exit", &m_settings_copy.save_state_on_exit);
|
||||||
settings_changed |=
|
settings_changed |=
|
||||||
ImGui::Checkbox("Load Memory Cards From Save States", &m_settings_copy.load_memory_cards_from_save_states);
|
ImGui::Checkbox("Load Devices From Save States", &m_settings_copy.load_devices_from_save_states);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
|
|
Loading…
Reference in New Issue