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:
parent
18030ebfb4
commit
c354dfcd2f
|
@ -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
|
||||
|
|
|
@ -80,8 +80,5 @@ u8* GetARAMPtr();
|
|||
|
||||
void UpdateAudioDMA();
|
||||
void UpdateDSPSlice(int cycles);
|
||||
u64 DMAInProgress();
|
||||
void EnableInstantDMA();
|
||||
void FlushInstantDMA(u32 address);
|
||||
|
||||
} // end of namespace DSP
|
||||
|
|
|
@ -336,14 +336,6 @@ void Interpreter::dcbi(UGeckoInstruction _inst)
|
|||
// should use icbi consistently, but games aren't portable.)
|
||||
u32 address = Helper_Get_EA_X(_inst);
|
||||
JitInterface::InvalidateICache(address & ~0x1f, 32, false);
|
||||
|
||||
// The following detects a situation where the game is writing to the dcache at the address being
|
||||
// DMA'd. As we do not
|
||||
// have dcache emulation, invalid data is being DMA'd causing audio glitches. The following code
|
||||
// detects this and
|
||||
// enables the DMA to complete instantly before the invalid data is written. Resident Evil 2 & 3
|
||||
// trigger this.
|
||||
DSP::FlushInstantDMA(address);
|
||||
}
|
||||
|
||||
void Interpreter::dcbst(UGeckoInstruction _inst)
|
||||
|
|
|
@ -315,23 +315,6 @@ void Jit64::dcbx(UGeckoInstruction inst)
|
|||
SwitchToNearCode();
|
||||
SetJumpTarget(c);
|
||||
|
||||
// dcbi
|
||||
if (inst.SUBOP10 == 470)
|
||||
{
|
||||
// Flush DSP DMA if DMAState bit is set
|
||||
TEST(16, M(&DSP::g_dspState), Imm16(1 << 9));
|
||||
c = J_CC(CC_NZ, true);
|
||||
SwitchToFarCode();
|
||||
SetJumpTarget(c);
|
||||
ABI_PushRegistersAndAdjustStack(registersInUse, 0);
|
||||
SHL(32, R(addr), Imm8(5));
|
||||
ABI_CallFunctionR(DSP::FlushInstantDMA, addr);
|
||||
ABI_PopRegistersAndAdjustStack(registersInUse, 0);
|
||||
c = J(true);
|
||||
SwitchToNearCode();
|
||||
SetJumpTarget(c);
|
||||
}
|
||||
|
||||
gpr.UnlockAllX();
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
|
|||
static std::thread g_save_thread;
|
||||
|
||||
// Don't forget to increase this after doing changes on the savestate system
|
||||
static const u32 STATE_VERSION = 56;
|
||||
static const u32 STATE_VERSION = 57;
|
||||
|
||||
// Maps savestate versions to Dolphin versions.
|
||||
// Versions after 42 don't need to be added to this list,
|
||||
|
|
Loading…
Reference in New Issue