WIP fix block reads

Enough for libogc, but not enough for Channel...
This commit is contained in:
Pokechu22 2020-08-27 23:24:38 -07:00
parent b2c15e0fdb
commit 8db60f54e2

View File

@ -480,7 +480,7 @@ u8 CEXISD::ReadForBlockRead()
{
INFO_LOG_FMT(EXPANSIONINTERFACE, "SD read succeeded at {:#x}", address);
block_position = 0;
block_state = BlockState::Block;
block_state = BlockState::Token;
block_crc = Common::HashCrc16(block_buffer);
}
@ -491,9 +491,11 @@ u8 CEXISD::ReadForBlockRead()
// A bit awkward of a setup; a data error token is only read on an actual error.
// For now only use the generic error, not e.g. out of bounds
// (which can be handled in the main response... why are there 2 ways?)
state = State::ReadyForCommand;
block_state = BlockState::Nothing;
return DATA_ERROR_ERROR;
// state = State::ReadyForCommand;
// block_state = BlockState::Nothing;
// return DATA_ERROR_ERROR;
block_state = BlockState::Block;
return START_BLOCK;
case BlockState::Block:
{
u8 result = block_buffer[block_position++];
@ -527,7 +529,7 @@ u8 CEXISD::ReadForBlockRead()
{
INFO_LOG_FMT(EXPANSIONINTERFACE, "SD read succeeded at {:#x}", address);
block_position = 0;
block_state = BlockState::Block;
block_state = BlockState::Token;
block_crc = Common::HashCrc16(block_buffer);
}
}
@ -560,7 +562,9 @@ void CEXISD::WriteForBlockRead(u8 byte)
// Finish transmitting the current block and then stop
if (state == State::MultipleBlockRead)
{
INFO_LOG_FMT(EXPANSIONINTERFACE, "Assuming stop transmission; doing nothing currently");
INFO_LOG_FMT(EXPANSIONINTERFACE,
"Assuming stop transmission; changing to single block read to finish");
state = State::SingleBlockRead;
// JANK, but I think this will work right
response.push_back(0); // R1 - for later
}