mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-25 23:29:55 -06:00
Slight polish to DMA (#1856)
* Slight polish to DMA - Default-initialize members explicitly - Mark some methods as const noexcept - Initialize DMA::MRAMBurstTable to DMATiming::MRAMDummy - Use the default destructor * Move DMA_Timings definitions to a source file - To ensure constant and unique addresses * Include some extra DMA members in the savestate * Simplify serializing the DMA table - Extend the dummy table to 256 bytes (same length as the real ones) * Revert the type change to DMA::DoSavestate * Keep the MRAMBurstTable inside the DMA class, instead of using a pointer - If we use a pointer to an external table, then we can't use it in savestates (else that external table gets overwritten)
This commit is contained in:

committed by
GitHub

parent
bf81b87a60
commit
8c4e5af737
47
src/DMA.h
47
src/DMA.h
@ -19,14 +19,16 @@
|
||||
#ifndef DMA_H
|
||||
#define DMA_H
|
||||
|
||||
#include <array>
|
||||
#include "types.h"
|
||||
#include "Savestate.h"
|
||||
#include "DMA_Timings.h"
|
||||
|
||||
class DMA
|
||||
{
|
||||
public:
|
||||
DMA(u32 cpu, u32 num);
|
||||
~DMA();
|
||||
~DMA() = default;
|
||||
|
||||
void Reset();
|
||||
|
||||
@ -48,12 +50,12 @@ public:
|
||||
template <int ConsoleType>
|
||||
void Run7();
|
||||
|
||||
bool IsInMode(u32 mode)
|
||||
bool IsInMode(u32 mode) const noexcept
|
||||
{
|
||||
return ((mode == StartMode) && (Cnt & 0x80000000));
|
||||
}
|
||||
|
||||
bool IsRunning() { return Running!=0; }
|
||||
bool IsRunning() const noexcept { return Running!=0; }
|
||||
|
||||
void StartIfNeeded(u32 mode)
|
||||
{
|
||||
@ -72,32 +74,33 @@ public:
|
||||
if (Executing) Stall = true;
|
||||
}
|
||||
|
||||
u32 SrcAddr;
|
||||
u32 DstAddr;
|
||||
u32 Cnt;
|
||||
u32 SrcAddr {};
|
||||
u32 DstAddr {};
|
||||
u32 Cnt {};
|
||||
|
||||
private:
|
||||
u32 CPU, Num;
|
||||
u32 CPU {};
|
||||
u32 Num {};
|
||||
|
||||
u32 StartMode;
|
||||
u32 CurSrcAddr;
|
||||
u32 CurDstAddr;
|
||||
u32 RemCount;
|
||||
u32 IterCount;
|
||||
s32 SrcAddrInc;
|
||||
s32 DstAddrInc;
|
||||
u32 CountMask;
|
||||
u32 StartMode {};
|
||||
u32 CurSrcAddr {};
|
||||
u32 CurDstAddr {};
|
||||
u32 RemCount {};
|
||||
u32 IterCount {};
|
||||
s32 SrcAddrInc {};
|
||||
s32 DstAddrInc {};
|
||||
u32 CountMask {};
|
||||
|
||||
u32 Running;
|
||||
bool InProgress;
|
||||
u32 Running {};
|
||||
bool InProgress {};
|
||||
|
||||
bool Executing;
|
||||
bool Stall;
|
||||
bool Executing {};
|
||||
bool Stall {};
|
||||
|
||||
bool IsGXFIFODMA;
|
||||
bool IsGXFIFODMA {};
|
||||
|
||||
u32 MRAMBurstCount;
|
||||
const u8* MRAMBurstTable;
|
||||
u32 MRAMBurstCount {};
|
||||
std::array<u8, 256> MRAMBurstTable;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user