mirror of
https://github.com/libretro/Mesen.git
synced 2025-01-31 13:52:19 +00:00
DMC: Improve DMA timing after 4015 write
This commit is contained in:
parent
c1f841b6dd
commit
650dfb35f1
@ -209,15 +209,24 @@ void DeltaModulationChannel::SetEnabled(bool enabled)
|
||||
_needToRun = false;
|
||||
} else if(_bytesRemaining == 0) {
|
||||
InitSample();
|
||||
_needInit = true;
|
||||
|
||||
//Delay a number of cycles based on odd/even cycles
|
||||
//Allows behavior to match dmc_dma_start_test
|
||||
if((_console->GetCpu()->GetCycleCount() & 0x01) == 0) {
|
||||
_needInit = 2;
|
||||
} else {
|
||||
_needInit = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool DeltaModulationChannel::NeedToRun()
|
||||
{
|
||||
if(_needInit && (_console->GetCpu()->GetCycleCount() & 0x01) == 0) {
|
||||
StartDmcTransfer();
|
||||
_needInit = false;
|
||||
if(_needInit > 0) {
|
||||
_needInit--;
|
||||
if(_needInit == 0) {
|
||||
StartDmcTransfer();
|
||||
}
|
||||
}
|
||||
return _needToRun;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ private:
|
||||
uint8_t _bitsRemaining = 0;
|
||||
bool _silenceFlag = true;
|
||||
bool _needToRun = false;
|
||||
bool _needInit = false;
|
||||
uint8_t _needInit = 0;
|
||||
|
||||
uint8_t _lastValue4011 = 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user