Save state support

This commit is contained in:
Connor McLaughlin
2019-09-14 20:28:47 +10:00
parent 851ef67814
commit 2560efbebd
16 changed files with 256 additions and 56 deletions

View File

@ -1,6 +1,7 @@
#include "dma.h"
#include "YBaseLib/Log.h"
#include "bus.h"
#include "common/state_wrapper.h"
#include "gpu.h"
Log_SetChannel(DMA);
@ -22,6 +23,22 @@ void DMA::Reset()
m_DCIR = 0;
}
bool DMA::DoState(StateWrapper& sw)
{
for (u32 i = 0; i < NUM_CHANNELS; i++)
{
ChannelState& cs = m_state[i];
sw.Do(&cs.base_address);
sw.Do(&cs.block_control.bits);
sw.Do(&cs.channel_control.bits);
sw.Do(&cs.request);
}
sw.Do(&m_DPCR.bits);
sw.Do(&m_DCIR);
return !sw.HasError();
}
u32 DMA::ReadRegister(u32 offset)
{
const u32 channel_index = offset >> 4;