Permalink
Browse files

Qt/GameCubePane: Fix issues with changing memcard slots while game is…

… running

Selecting Dummy or Memory Card would pass wrong values to EXI::ChangeDevice and not work as expected
Changing path had no effect until device was changed as it didn't call EXI::ChangeDevice at all
  • Loading branch information...
Techjar committed Jun 17, 2018
1 parent 5860670 commit 7778859b55a04acf7b9f081cb3429cded0fe31ea
Showing with 32 additions and 3 deletions.
  1. +32 −3 Source/Core/DolphinQt2/Settings/GameCubePane.cpp
@@ -209,6 +209,21 @@ void GameCubePane::OnConfigPressed(int slot)
}
}
QString path_old;
if (memcard)
{
path_old =
QFileInfo(QString::fromStdString(slot == 0 ? SConfig::GetInstance().m_strMemoryCardA :
SConfig::GetInstance().m_strMemoryCardB))
.absoluteFilePath();
}
else
{
path_old = QFileInfo(QString::fromStdString(slot == 0 ? SConfig::GetInstance().m_strGbaCartA :
SConfig::GetInstance().m_strGbaCartB))
.absoluteFilePath();
}
if (memcard)
{
if (slot == SLOT_A_INDEX)
@@ -231,6 +246,17 @@ void GameCubePane::OnConfigPressed(int slot)
SConfig::GetInstance().m_strGbaCartB = path_abs.toStdString();
}
}
if (Core::IsRunning() && path_abs != path_old)
{
ExpansionInterface::ChangeDevice(
// SlotB is on channel 1, slotA and SP1 are on 0
slot,
// The device enum to change to
memcard ? ExpansionInterface::EXIDEVICE_MEMORYCARD : ExpansionInterface::EXIDEVICE_AGP,
// SP1 is device 2, slots are device 0
0);
}
}
void GameCubePane::LoadSettings()
@@ -350,9 +376,12 @@ void GameCubePane::SaveSettings()
if (Core::IsRunning() && SConfig::GetInstance().m_EXIDevice[i] != dev)
{
ExpansionInterface::ChangeDevice(
(index == 1) ? 1 : 0, // SlotB is on channel 1, slotA and SP1 are on 0
dev, // The device enum to change to
(index == 2) ? 2 : 0); // SP1 is device 2, slots are device 0
// SlotB is on channel 1, slotA and SP1 are on 0
(i == 1) ? 1 : 0,
// The device enum to change to
dev,
// SP1 is device 2, slots are device 0
(i == 2) ? 2 : 0);
}
SConfig::GetInstance().m_EXIDevice[i] = dev;

0 comments on commit 7778859

Please sign in to comment.