HDMA: Added missing condition for indirect HDMA glitch
Fixes Touge Densetsu color corruption in bike configuration screen
This commit is contained in:
parent
8d43594d7c
commit
01dd319c9a
2 changed files with 12 additions and 1 deletions
|
@ -271,7 +271,7 @@ bool DmaController::ProcessHdmaChannels()
|
||||||
|
|
||||||
//"b. If Addressing Mode is Indirect, read two bytes from Address into Indirect Address(and increment Address by two bytes)."
|
//"b. If Addressing Mode is Indirect, read two bytes from Address into Indirect Address(and increment Address by two bytes)."
|
||||||
if(ch.HdmaIndirectAddressing) {
|
if(ch.HdmaIndirectAddressing) {
|
||||||
if(ch.HdmaLineCounterAndRepeat == 0) {
|
if(ch.HdmaLineCounterAndRepeat == 0 && IsLastActiveHdmaChannel(i)) {
|
||||||
//"One oddity: if $43xA is 0 and this is the last active HDMA channel for this scanline, only load one byte for Address,
|
//"One oddity: if $43xA is 0 and this is the last active HDMA channel for this scanline, only load one byte for Address,
|
||||||
//and use the $00 for the low byte.So Address ends up incremented one less than otherwise expected, and one less CPU Cycle is used."
|
//and use the $00 for the low byte.So Address ends up incremented one less than otherwise expected, and one less CPU Cycle is used."
|
||||||
uint8_t msb = _memoryManager->ReadDma((ch.SrcBank << 16) | ch.HdmaTableAddress++, true);
|
uint8_t msb = _memoryManager->ReadDma((ch.SrcBank << 16) | ch.HdmaTableAddress++, true);
|
||||||
|
@ -310,6 +310,16 @@ bool DmaController::ProcessHdmaChannels()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DmaController::IsLastActiveHdmaChannel(uint8_t channel)
|
||||||
|
{
|
||||||
|
for(int i = channel + 1; i < 8; i++) {
|
||||||
|
if((_hdmaChannels & (1 << i)) && !_channel[i].HdmaFinished) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void DmaController::UpdateNeedToProcessFlag()
|
void DmaController::UpdateNeedToProcessFlag()
|
||||||
{
|
{
|
||||||
//Slightly faster execution time by doing this rather than processing all 4 flags on each cycle
|
//Slightly faster execution time by doing this rather than processing all 4 flags on each cycle
|
||||||
|
|
|
@ -30,6 +30,7 @@ private:
|
||||||
|
|
||||||
void RunHdmaTransfer(DmaChannelConfig &channel);
|
void RunHdmaTransfer(DmaChannelConfig &channel);
|
||||||
bool ProcessHdmaChannels();
|
bool ProcessHdmaChannels();
|
||||||
|
bool IsLastActiveHdmaChannel(uint8_t channel);
|
||||||
bool InitHdmaChannels();
|
bool InitHdmaChannels();
|
||||||
|
|
||||||
void SyncStartDma();
|
void SyncStartDma();
|
||||||
|
|
Loading…
Add table
Reference in a new issue