mirror of https://github.com/PCSX2/pcsx2.git
Memcard: Fix terminator not properly flagging ejections
This commit is contained in:
parent
2611a93af2
commit
c3bafa2a40
|
@ -191,22 +191,27 @@ void MemoryCardProtocol::SetTerminator()
|
||||||
{
|
{
|
||||||
MC_LOG.WriteLn("%s", __FUNCTION__);
|
MC_LOG.WriteLn("%s", __FUNCTION__);
|
||||||
PS1_FAIL();
|
PS1_FAIL();
|
||||||
const u8 newTerminator = g_Sio2FifoIn.front();
|
mcd->term = g_Sio2FifoIn.front();
|
||||||
g_Sio2FifoIn.pop_front();
|
g_Sio2FifoIn.pop_front();
|
||||||
const u8 oldTerminator = mcd->term;
|
|
||||||
mcd->term = newTerminator;
|
|
||||||
g_Sio2FifoOut.push_back(0x00);
|
g_Sio2FifoOut.push_back(0x00);
|
||||||
g_Sio2FifoOut.push_back(0x2b);
|
g_Sio2FifoOut.push_back(0x2b);
|
||||||
g_Sio2FifoOut.push_back(oldTerminator);
|
g_Sio2FifoOut.push_back(mcd->term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This one is a bit unusual. Old and new versions of MCMAN seem to handle this differently.
|
||||||
|
// Some commands may check [4] for the terminator. Others may check [3]. Typically, older
|
||||||
|
// MCMAN revisions will exclusively check [4], and newer revisions will check both [3] and [4]
|
||||||
|
// for different values. In all cases, they expect to see a valid terminator value.
|
||||||
|
//
|
||||||
|
// Also worth noting old revisions of MCMAN will not set anything other than 0x55 for the terminator,
|
||||||
|
// while newer revisions will set the terminator to another value (most commonly 0x5a).
|
||||||
void MemoryCardProtocol::GetTerminator()
|
void MemoryCardProtocol::GetTerminator()
|
||||||
{
|
{
|
||||||
MC_LOG.WriteLn("%s", __FUNCTION__);
|
MC_LOG.WriteLn("%s", __FUNCTION__);
|
||||||
PS1_FAIL();
|
PS1_FAIL();
|
||||||
g_Sio2FifoOut.push_back(0x2b);
|
g_Sio2FifoOut.push_back(0x2b);
|
||||||
g_Sio2FifoOut.push_back(mcd->term);
|
g_Sio2FifoOut.push_back(mcd->term);
|
||||||
g_Sio2FifoOut.push_back(static_cast<u8>(Terminator::DEFAULT));
|
g_Sio2FifoOut.push_back(mcd->term);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryCardProtocol::WriteData()
|
void MemoryCardProtocol::WriteData()
|
||||||
|
@ -521,6 +526,7 @@ void MemoryCardProtocol::AuthF3()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
mcd->term = Terminator::READY;
|
||||||
The2bTerminator(5);
|
The2bTerminator(5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ void AutoEject::Set(size_t port, size_t slot)
|
||||||
if (mcds[port][slot].autoEjectTicks == 0)
|
if (mcds[port][slot].autoEjectTicks == 0)
|
||||||
{
|
{
|
||||||
mcds[port][slot].autoEjectTicks = 60; // 60 frames is enough.
|
mcds[port][slot].autoEjectTicks = 60; // 60 frames is enough.
|
||||||
mcds[port][slot].term = 0x55; // Reset terminator to default (0x55), forces the PS2 to recheck the memcard.
|
mcds[port][slot].term = Terminator::NOT_READY; // Reset terminator to NOT_READY (0x66), forces the PS2 to recheck the memcard.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -265,12 +265,12 @@ void Sio2::Memcard()
|
||||||
if (mcd->autoEjectTicks)
|
if (mcd->autoEjectTicks)
|
||||||
{
|
{
|
||||||
SetRecv1(Recv1::DISCONNECTED);
|
SetRecv1(Recv1::DISCONNECTED);
|
||||||
g_Sio2FifoOut.push_back(0x00); // Because Sio2::Write pops the first g_Sio2FifoIn member
|
g_Sio2FifoOut.push_back(0xff); // Because Sio2::Write pops the first g_Sio2FifoIn member
|
||||||
|
|
||||||
while (!g_Sio2FifoIn.empty())
|
while (!g_Sio2FifoIn.empty())
|
||||||
{
|
{
|
||||||
g_Sio2FifoIn.pop_front();
|
g_Sio2FifoIn.pop_front();
|
||||||
g_Sio2FifoOut.push_back(0x00);
|
g_Sio2FifoOut.push_back(0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -170,5 +170,6 @@ namespace Recv3
|
||||||
|
|
||||||
namespace Terminator
|
namespace Terminator
|
||||||
{
|
{
|
||||||
static constexpr u32 DEFAULT = 0x55;
|
static constexpr u32 NOT_READY = 0x66;
|
||||||
|
static constexpr u32 READY = 0x55;
|
||||||
} // namespace Terminator
|
} // namespace Terminator
|
||||||
|
|
Loading…
Reference in New Issue