mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 14:25:37 +00:00
DMA: Clear state on shutdown
Fix a rare crash where the GPU starting after a second boot accesses uninitalized DMA fields.
This commit is contained in:
parent
2ec26e54b7
commit
c9ef3ec1a3
|
@ -36,10 +36,17 @@ void DMA::Initialize()
|
||||||
|
|
||||||
void DMA::Shutdown()
|
void DMA::Shutdown()
|
||||||
{
|
{
|
||||||
|
ClearState();
|
||||||
m_unhalt_event.reset();
|
m_unhalt_event.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DMA::Reset()
|
void DMA::Reset()
|
||||||
|
{
|
||||||
|
ClearState();
|
||||||
|
m_unhalt_event->Deactivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DMA::ClearState()
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < NUM_CHANNELS; i++)
|
for (u32 i = 0; i < NUM_CHANNELS; i++)
|
||||||
{
|
{
|
||||||
|
@ -54,7 +61,6 @@ void DMA::Reset()
|
||||||
m_DICR.bits = 0;
|
m_DICR.bits = 0;
|
||||||
|
|
||||||
m_halt_ticks_remaining = 0;
|
m_halt_ticks_remaining = 0;
|
||||||
m_unhalt_event->Deactivate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DMA::DoState(StateWrapper& sw)
|
bool DMA::DoState(StateWrapper& sw)
|
||||||
|
|
|
@ -60,6 +60,8 @@ private:
|
||||||
Reserved = 3
|
Reserved = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void ClearState();
|
||||||
|
|
||||||
// is everything enabled for a channel to operate?
|
// is everything enabled for a channel to operate?
|
||||||
bool CanTransferChannel(Channel channel) const;
|
bool CanTransferChannel(Channel channel) const;
|
||||||
bool IsTransferHalted() const;
|
bool IsTransferHalted() const;
|
||||||
|
|
Loading…
Reference in a new issue