MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / SetSector

Method SetSector

pcsx2/SIO/Memcard/MemoryCardProtocol.cpp:103–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103void MemoryCardProtocol::SetSector()
104{
105 MC_LOG.WriteLn("%s", __FUNCTION__);
106 PS1_FAIL();
107 const u8 sectorLSB = g_Sio2FifoIn.front();
108 g_Sio2FifoIn.pop_front();
109 const u8 sector2nd = g_Sio2FifoIn.front();
110 g_Sio2FifoIn.pop_front();
111 const u8 sector3rd = g_Sio2FifoIn.front();
112 g_Sio2FifoIn.pop_front();
113 const u8 sectorMSB = g_Sio2FifoIn.front();
114 g_Sio2FifoIn.pop_front();
115 const u8 expectedChecksum = g_Sio2FifoIn.front();
116 g_Sio2FifoIn.pop_front();
117
118 u8 computedChecksum = sectorLSB ^ sector2nd ^ sector3rd ^ sectorMSB;
119 mcd->goodSector = (computedChecksum == expectedChecksum);
120
121 if (!mcd->goodSector)
122 {
123 Console.Warning("%s() Warning! Memcard sector checksum failed! (Expected %02X != Actual %02X) Please report to the PCSX2 team!", __FUNCTION__, expectedChecksum, computedChecksum);
124 }
125
126 u32 newSector = sectorLSB | (sector2nd << 8) | (sector3rd << 16) | (sectorMSB << 24);
127 mcd->sectorAddr = newSector;
128
129 McdSizeInfo info;
130 mcd->GetSizeInfo(info);
131 mcd->transferAddr = (info.SectorSize + 16) * mcd->sectorAddr;
132
133 The2bTerminator(9);
134}
135
136void MemoryCardProtocol::GetSpecs()
137{

Callers 1

MemcardMethod · 0.80

Calls 5

WriteLnMethod · 0.45
frontMethod · 0.45
pop_frontMethod · 0.45
WarningMethod · 0.45
GetSizeInfoMethod · 0.45

Tested by

no test coverage detected