mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-29 19:15:38 +00:00
CPU: Support stalling CPU for bus activity such as DMA
This commit is contained in:
parent
0324ae2fd7
commit
9d5f3c1306
|
@ -35,6 +35,11 @@ public:
|
||||||
|
|
||||||
TickCount GetPendingTicks() const { return m_pending_ticks; }
|
TickCount GetPendingTicks() const { return m_pending_ticks; }
|
||||||
void ResetPendingTicks() { m_pending_ticks = 0; }
|
void ResetPendingTicks() { m_pending_ticks = 0; }
|
||||||
|
void AddPendingTicks(TickCount ticks)
|
||||||
|
{
|
||||||
|
m_pending_ticks += ticks;
|
||||||
|
m_downcount -= ticks;
|
||||||
|
}
|
||||||
|
|
||||||
void SetDowncount(TickCount downcount) { m_downcount = (downcount < m_downcount) ? downcount : m_downcount; }
|
void SetDowncount(TickCount downcount) { m_downcount = (downcount < m_downcount) ? downcount : m_downcount; }
|
||||||
void ResetDowncount() { m_downcount = MAX_SLICE_SIZE; }
|
void ResetDowncount() { m_downcount = MAX_SLICE_SIZE; }
|
||||||
|
|
|
@ -296,6 +296,11 @@ void System::SetDowncount(TickCount downcount)
|
||||||
m_cpu->SetDowncount(downcount);
|
m_cpu->SetDowncount(downcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void System::StallCPU(TickCount ticks)
|
||||||
|
{
|
||||||
|
m_cpu->AddPendingTicks(ticks);
|
||||||
|
}
|
||||||
|
|
||||||
void System::SetController(u32 slot, std::shared_ptr<PadDevice> dev)
|
void System::SetController(u32 slot, std::shared_ptr<PadDevice> dev)
|
||||||
{
|
{
|
||||||
m_pad->SetController(slot, std::move(dev));
|
m_pad->SetController(slot, std::move(dev));
|
||||||
|
|
|
@ -58,6 +58,9 @@ public:
|
||||||
void SetDowncount(TickCount downcount);
|
void SetDowncount(TickCount downcount);
|
||||||
void Synchronize();
|
void Synchronize();
|
||||||
|
|
||||||
|
// Adds ticks to the global tick counter, simulating the CPU being stalled.
|
||||||
|
void StallCPU(TickCount ticks);
|
||||||
|
|
||||||
void SetController(u32 slot, std::shared_ptr<PadDevice> dev);
|
void SetController(u32 slot, std::shared_ptr<PadDevice> dev);
|
||||||
void SetMemoryCard(u32 slot, std::shared_ptr<PadDevice> dev);
|
void SetMemoryCard(u32 slot, std::shared_ptr<PadDevice> dev);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue