|
|
|
@ -100,13 +100,37 @@ bool Pad::DoState(StateWrapper& sw)
|
|
|
|
|
{
|
|
|
|
|
Log_WarningPrintf("Skipping loading memory card %u from save state.", i + 1u);
|
|
|
|
|
|
|
|
|
|
MemoryCard dummy_card;
|
|
|
|
|
if (!sw.DoMarker("MemoryCard") || !dummy_card.DoState(sw))
|
|
|
|
|
std::unique_ptr<MemoryCard> card_from_state = std::make_unique<MemoryCard>();
|
|
|
|
|
if (!sw.DoMarker("MemoryCard") || !card_from_state->DoState(sw))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// we do need to reset the existing card though, in case it was in the middle of a write
|
|
|
|
|
// does the content of the memory card match?
|
|
|
|
|
if (m_memory_cards[i])
|
|
|
|
|
m_memory_cards[i]->Reset();
|
|
|
|
|
{
|
|
|
|
|
if (m_memory_cards[i]->GetData() == card_from_state->GetData())
|
|
|
|
|
{
|
|
|
|
|
Log_DevPrintf("Using memory card %u state from save state", i);
|
|
|
|
|
m_memory_cards[i] = std::move(card_from_state);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
g_host_interface->AddFormattedOSDMessage(
|
|
|
|
|
20.0f,
|
|
|
|
|
g_host_interface->TranslateString(
|
|
|
|
|
"OSDMessage", "Memory card %u from save state does match current card data. Simulating replugging."),
|
|
|
|
|
i + 1u);
|
|
|
|
|
|
|
|
|
|
m_memory_cards[i]->Reset();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
g_host_interface->AddFormattedOSDMessage(
|
|
|
|
|
20.0f,
|
|
|
|
|
g_host_interface->TranslateString("OSDMessage",
|
|
|
|
|
"Memory card %u present in save state but not in system. Ignoring card."),
|
|
|
|
|
i + 1u);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -114,13 +138,19 @@ bool Pad::DoState(StateWrapper& sw)
|
|
|
|
|
if (card_present && !m_memory_cards[i])
|
|
|
|
|
{
|
|
|
|
|
g_host_interface->AddFormattedOSDMessage(
|
|
|
|
|
2.0f, "Memory card %u present in save state but not in system. Creating temporary card.", i + 1u);
|
|
|
|
|
20.0f,
|
|
|
|
|
g_host_interface->TranslateString(
|
|
|
|
|
"OSDMessage", "Memory card %u present in save state but not in system. Creating temporary card."),
|
|
|
|
|
i + 1u);
|
|
|
|
|
m_memory_cards[i] = MemoryCard::Create();
|
|
|
|
|
}
|
|
|
|
|
else if (!card_present && m_memory_cards[i])
|
|
|
|
|
{
|
|
|
|
|
g_host_interface->AddFormattedOSDMessage(
|
|
|
|
|
2.0f, "Memory card %u present in system but not in save state. Removing card.", i + 1u);
|
|
|
|
|
20.0f,
|
|
|
|
|
g_host_interface->TranslateString("OSDMessage",
|
|
|
|
|
"Memory card %u present in system but not in save state. Removing card."),
|
|
|
|
|
i + 1u);
|
|
|
|
|
m_memory_cards[i].reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|