GCMemcard: Remove manual std::vector handling in DoState

This commit is contained in:
Pokechu22 2022-10-06 11:25:20 -07:00
parent e8221d7948
commit 4d33f6af7c
3 changed files with 3 additions and 15 deletions

View File

@ -90,13 +90,7 @@ void GCIFile::DoState(PointerWrap& p)
p.Do(m_gci_header); p.Do(m_gci_header);
p.Do(m_dirty); p.Do(m_dirty);
p.Do(m_filename); p.Do(m_filename);
int num_blocks = (int)m_save_data.size(); p.Do(m_save_data);
p.Do(num_blocks);
m_save_data.resize(num_blocks);
for (auto itr = m_save_data.begin(); itr != m_save_data.end(); ++itr)
{
p.Do(*itr);
}
p.Do(m_used_blocks); p.Do(m_used_blocks);
} }
} // namespace Memcard } // namespace Memcard

View File

@ -701,13 +701,7 @@ void GCMemcardDirectory::DoState(PointerWrap& p)
p.Do(m_dir2); p.Do(m_dir2);
p.Do(m_bat1); p.Do(m_bat1);
p.Do(m_bat2); p.Do(m_bat2);
int num_saves = (int)m_saves.size(); p.DoEachElement(m_saves, [](PointerWrap& p, Memcard::GCIFile& save) { save.DoState(p); });
p.Do(num_saves);
m_saves.resize(num_saves);
for (Memcard::GCIFile& save : m_saves)
{
save.DoState(p);
}
} }
void MigrateFromMemcardFile(const std::string& directory_name, ExpansionInterface::Slot card_slot, void MigrateFromMemcardFile(const std::string& directory_name, ExpansionInterface::Slot card_slot,

View File

@ -94,7 +94,7 @@ static size_t s_state_writes_in_queue;
static std::condition_variable s_state_write_queue_is_empty; static std::condition_variable s_state_write_queue_is_empty;
// Don't forget to increase this after doing changes on the savestate system // Don't forget to increase this after doing changes on the savestate system
constexpr u32 STATE_VERSION = 149; // Last changed in PR 10781 constexpr u32 STATE_VERSION = 150; // Last changed in PR 11124
// Maps savestate versions to Dolphin versions. // Maps savestate versions to Dolphin versions.
// Versions after 42 don't need to be added to this list, // Versions after 42 don't need to be added to this list,