add an option to not eject/reinsert memcards on save/load state

when off certain games like ZTP ZWW maybe other cannot save to a different memory card after loading from a savestate, but for TAS the game will no longer think that the card was ejected
to use add 
ReloadMemcardOnState = false
to dolphin.ini

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7323 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2011-03-10 00:16:40 +00:00
parent 610df4ab78
commit 83209b4afc
4 changed files with 15 additions and 4 deletions

View File

@ -209,6 +209,7 @@ void SConfig::SaveSettings()
ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
ini.Set("Core", "MemcardA", m_strMemoryCardA);
ini.Set("Core", "MemcardB", m_strMemoryCardB);
ini.Set("Core", "ReloadMemcardOnState", b_reloadMCOnState);
ini.Set("Core", "SlotA", m_EXIDevice[0]);
ini.Set("Core", "SlotB", m_EXIDevice[1]);
ini.Set("Core", "SerialPort1", m_EXIDevice[2]);
@ -333,6 +334,7 @@ void SConfig::LoadSettings()
ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0);
ini.Get("Core", "MemcardA", &m_strMemoryCardA);
ini.Get("Core", "MemcardB", &m_strMemoryCardB);
ini.Get("Core", "ReloadMemcardOnState", &b_reloadMCOnState, true);
ini.Get("Core", "SlotA", (int*)&m_EXIDevice[0], EXIDEVICE_MEMORYCARD_A);
ini.Get("Core", "SlotB", (int*)&m_EXIDevice[1], EXIDEVICE_NONE);
ini.Get("Core", "SerialPort1", (int*)&m_EXIDevice[2], EXIDEVICE_NONE);

View File

@ -46,6 +46,10 @@ struct SConfig : NonCopyable
std::string m_strMemoryCardA;
std::string m_strMemoryCardB;
// eject and reload the memory card on state
// in ZTP and other games if the save file has been deleted from the memory card
//this is necessary to save after loading a savestate
bool b_reloadMCOnState;
TEXIDevices m_EXIDevice[3];
TSIDevices m_SIDevice[4];
std::string m_bba_mac;

View File

@ -50,6 +50,7 @@ CEXIMemoryCard::CEXIMemoryCard(const std::string& _rName, const std::string& _rF
{
cards[_card_index] = this;
et_this_card = CoreTiming::RegisterEvent(_rName.c_str(), FlushCallback);
reloadOnState = SConfig::GetInstance().b_reloadMCOnState;
interruptSwitch = 0;
m_bInterruptSet = 0;
@ -432,8 +433,11 @@ void CEXIMemoryCard::TransferByte(u8 &byte)
void CEXIMemoryCard::DoState(PointerWrap &p)
{
int slot = 0;
if (GetFileName() == SConfig::GetInstance().m_strMemoryCardA)
slot = 1;
ExpansionInterface::ChangeDevice(slot, slot ? EXIDEVICE_MEMORYCARD_B : EXIDEVICE_MEMORYCARD_A, 0);
if (reloadOnState)
{
int slot = 0;
if (GetFileName() == SConfig::GetInstance().m_strMemoryCardA)
slot = 1;
ExpansionInterface::ChangeDevice(slot, slot ? EXIDEVICE_MEMORYCARD_B : EXIDEVICE_MEMORYCARD_A, 0);
}
}

View File

@ -72,6 +72,7 @@ private:
std::string m_strFilename;
int card_index;
int et_this_card;
bool reloadOnState;
//! memory card state
// STATE_TO_SAVE