Remove instant ARAM DMA mode.

Now that our timings are much more accurate it doesn't look like we
need it anymore. And the instant ARAM DMA mode + scheduling fixes
ctually breaks ATV: Quad Power Racing 2 (causing all sorts of werid
bugs).
This commit is contained in:
Scott Mansell
2016-04-09 18:07:23 +12:00
parent 18030ebfb4
commit c354dfcd2f
5 changed files with 1 additions and 81 deletions

View File

@ -137,9 +137,6 @@ struct ARAMInfo
static ARAMInfo g_ARAM;
static AudioDMA g_audioDMA;
static ARAM_DMA g_arDMA;
static u32 last_mmaddr;
static u32 last_aram_dma_count;
static bool instant_dma;
UDSPControl g_dspState;
union ARAM_Info {
@ -177,9 +174,6 @@ void DoState(PointerWrap& p)
p.Do(g_AR_MODE);
p.Do(g_AR_REFRESH);
p.Do(dsp_slice);
p.Do(last_mmaddr);
p.Do(last_aram_dma_count);
p.Do(instant_dma);
dsp_emulator->DoState(p);
}
@ -197,30 +191,6 @@ static void CompleteARAM(u64 userdata, s64 cyclesLate)
GenerateDSPInterrupt(INT_ARAM);
}
void EnableInstantDMA()
{
CoreTiming::RemoveEvent(et_CompleteARAM);
CompleteARAM(0, 0);
instant_dma = true;
ERROR_LOG(DSPINTERFACE, "Enabling Instant ARAM DMA hack");
}
void FlushInstantDMA(u32 address)
{
u64 dma_in_progress = DSP::DMAInProgress();
if (dma_in_progress != 0)
{
u32 start_addr = (dma_in_progress >> 32) & Memory::RAM_MASK;
u32 end_addr = (dma_in_progress & Memory::RAM_MASK) & 0xffffffff;
u32 invalidated_addr = (address & Memory::RAM_MASK) & ~0x1f;
if (invalidated_addr >= start_addr && invalidated_addr <= end_addr)
{
DSP::EnableInstantDMA();
}
}
}
DSPEmulator* GetDSPEmulator()
{
return dsp_emulator.get();
@ -257,11 +227,6 @@ void Init(bool hle)
g_AR_MODE = 1; // ARAM Controller has init'd
g_AR_REFRESH = 156; // 156MHz
instant_dma = false;
last_aram_dma_count = 0;
last_mmaddr = 0;
et_GenerateDSPInterrupt = CoreTiming::RegisterEvent("DSPint", GenerateDSPInterrupt);
et_CompleteARAM = CoreTiming::RegisterEvent("ARAMint", CompleteARAM);
}
@ -527,16 +492,8 @@ static void Do_ARAM_DMA()
// ARAM DMA transfer rate has been measured on real hw
int ticksToTransfer = (g_arDMA.Cnt.count / 32) * 246;
// This is a huge hack that appears to be here only to fix Resident Evil 2/3
if (instant_dma)
ticksToTransfer = std::min(ticksToTransfer, 100);
CoreTiming::ScheduleEvent(ticksToTransfer, et_CompleteARAM);
last_mmaddr = g_arDMA.MMAddr;
last_aram_dma_count = g_arDMA.Cnt.count;
// Real hardware DMAs in 32byte chunks, but we can get by with 8byte chunks
if (g_arDMA.Cnt.dir)
{
@ -667,13 +624,4 @@ u8* GetARAMPtr()
return g_ARAM.ptr;
}
u64 DMAInProgress()
{
if (g_dspState.DMAState == 1)
{
return ((u64)last_mmaddr << 32 | (last_mmaddr + last_aram_dma_count));
}
return 0;
}
} // end of namespace DSP