Core: Move m_DMAUsed into PeripheralInterfaceHandler

This commit is contained in:
zilmar 2022-08-22 13:11:20 +09:30
parent f3a392489a
commit 9e1d69bcb5
4 changed files with 17 additions and 10 deletions

View File

@ -35,9 +35,11 @@ PeripheralInterfaceHandler::PeripheralInterfaceHandler(CN64System & System, CMip
m_Domain2Address2Handler(Domain2Address2Handler),
m_MMU(MMU),
m_Reg(Reg),
m_PC(Reg.m_PROGRAM_COUNTER)
m_PC(Reg.m_PROGRAM_COUNTER),
m_DMAUsed(false)
{
System.RegisterCallBack(CN64SystemCB_Reset, this, (CN64System::CallBackFunction)stSystemReset);
System.RegisterCallBack(CN64SystemCB_LoadedGameState, this, (CN64System::CallBackFunction)stLoadedGameState);
}
bool PeripheralInterfaceHandler::Read32(uint32_t Address, uint32_t & Value)
@ -166,10 +168,16 @@ bool PeripheralInterfaceHandler::Write32(uint32_t Address, uint32_t Value, uint3
return true;
}
void PeripheralInterfaceHandler::LoadedGameState(void)
{
m_DMAUsed = true;
}
void PeripheralInterfaceHandler::SystemReset(void)
{
PI_RD_LEN_REG = 0x0000007F;
PI_WR_LEN_REG = 0x0000007F;
m_DMAUsed = false;
}
void PeripheralInterfaceHandler::OnFirstDMA()
@ -282,9 +290,9 @@ void PeripheralInterfaceHandler::PI_DMA_READ()
}
PI_CART_ADDR_REG += 0x10000000;
if (!g_System->DmaUsed())
if (!m_DMAUsed)
{
g_System->SetDmaUsed(true);
m_DMAUsed = true;
OnFirstDMA();
}
if (g_Recompiler && g_System->bSMM_PIDMA())
@ -335,9 +343,9 @@ void PeripheralInterfaceHandler::PI_DMA_WRITE()
g_Debugger->PIDMAWriteStarted();
}
if (!g_System->DmaUsed())
if (!m_DMAUsed)
{
g_System->SetDmaUsed(true);
m_DMAUsed = true;
OnFirstDMA();
}

View File

@ -69,9 +69,11 @@ private:
PeripheralInterfaceHandler & operator=(const PeripheralInterfaceHandler &);
static void stSystemReset(PeripheralInterfaceHandler * _this) { _this->SystemReset(); }
static void stLoadedGameState(PeripheralInterfaceHandler * _this) { _this->LoadedGameState(); }
void PI_DMA_READ();
void PI_DMA_WRITE();
void LoadedGameState(void);
void SystemReset(void);
void OnFirstDMA();
void ReadBlock(uint32_t Address, uint8_t * Block, uint32_t BlockLen);
@ -80,4 +82,6 @@ private:
CMipsMemoryVM & m_MMU;
CRegisters & m_Reg;
uint32_t & m_PC;
bool m_DMAUsed;
};

View File

@ -39,7 +39,6 @@ CN64System::CN64System(CPlugins * Plugins, uint32_t randomizer_seed, bool SavesR
m_SystemTimer(*this),
m_bCleanFrameBox(true),
m_RspBroke(true),
m_DMAUsed(false),
m_TestTimer(false),
m_PipelineStage(PIPELINE_STAGE_NORMAL),
m_JumpToLocation(0),
@ -912,7 +911,6 @@ void CN64System::Reset(bool bInitReg, bool ClearMenory)
m_AlistCount = 0;
m_DlistCount = 0;
m_UnknownCount = 0;
m_DMAUsed = false;
m_RspBroke = true;
m_SyncCount = 0;

View File

@ -97,8 +97,6 @@ public:
void SyncSystem();
void SyncSystemPC();
bool DmaUsed() const { return m_DMAUsed; }
void SetDmaUsed(bool DMAUsed) { m_DMAUsed = DMAUsed; }
CPlugins * GetPlugins() { return m_Plugins; }
PIPELINE_STAGE PipelineStage() const { return m_PipelineStage; }
uint32_t JumpToLocation() const { return m_JumpToLocation; }
@ -174,7 +172,6 @@ private:
CSystemTimer m_SystemTimer;
bool m_bCleanFrameBox;
bool m_RspBroke;
bool m_DMAUsed;
uint32_t m_Buttons[4];
bool m_TestTimer;
PIPELINE_STAGE m_PipelineStage;