Skip to content

Commit

Permalink
ARAM: further cleanup, use AddressSpace accessors
Browse files Browse the repository at this point in the history
  • Loading branch information
booto committed May 16, 2019
1 parent 0edf337 commit 94e6c9c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
26 changes: 15 additions & 11 deletions Source/Core/Core/HW/DSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "Core/ConfigManager.h"
#include "Core/CoreTiming.h"
#include "Core/DSPEmulator.h"

#include "Core/HW/AddressSpace.h"
#include "Core/HW/MMIO.h"
#include "Core/HW/Memmap.h"
#include "Core/HW/ProcessorInterface.h"
Expand Down Expand Up @@ -211,9 +211,9 @@ void Reinit(bool hle)
if (SConfig::GetInstance().bWii)
{
s_ARAM.wii_mode = true;
s_ARAM.size = Memory::EXRAM_SIZE;
s_ARAM.mask = Memory::EXRAM_MASK;
s_ARAM.ptr = Memory::m_pEXRAM;
s_ARAM.size = 0;
s_ARAM.mask = 0;
s_ARAM.ptr = nullptr;
}
else
{
Expand Down Expand Up @@ -620,22 +620,26 @@ static void Do_ARAM_DMA()

u8 ReadARAM(u32 address)
{
if (s_ARAM.wii_mode)
{
return Memory::Read_U8(address & 0x1fffffff);
}
return s_ARAM.ptr[address & s_ARAM.mask];
AddressSpace::Accessors* accessors = AddressSpace::GetAccessors(
s_ARAM.wii_mode ? AddressSpace::Type::Physical : AddressSpace::Type::Auxiliary);
return accessors->ReadU8(address);
}

void WriteARAM(u8 value, u32 address)
{
// TODO: verify this on Wii
s_ARAM.ptr[address & s_ARAM.mask] = value;
AddressSpace::Accessors* accessors = AddressSpace::GetAccessors(
s_ARAM.wii_mode ? AddressSpace::Type::Physical : AddressSpace::Type::Auxiliary);
accessors->WriteU8(address, value);
}

u8* GetARAMPtr()
{
return s_ARAM.ptr;
}

u32 GetARAMPhysicalSize()
{
return s_ARAM.size;
}

} // end of namespace DSP
3 changes: 2 additions & 1 deletion Source/Core/Core/HW/DSP.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ enum DSPInterruptType
enum
{
ARAM_SIZE = 0x01000000, // 16 MB
ARAM_MASK = 0x00FFFFFF,
// ARAM_SIZE is always a power-of-two, so (ARAM_SIZE-1) is the mask
ARAM_MASK = ARAM_SIZE - 1,
};

// UDSPControl
Expand Down

0 comments on commit 94e6c9c

Please sign in to comment.