DSPLLE: Use Memory functions isntead of directly using Memory::physical_base

Fixes bug 11980
This commit is contained in:
Pokechu22
2020-04-08 14:25:33 -07:00
parent 59dc7cfe7d
commit 1ca3710bd2
6 changed files with 39 additions and 80 deletions

View File

@ -16,6 +16,7 @@
#include "Core/DSP/Jit/x64/DSPEmitter.h"
#include "Core/HW/DSP.h"
#include "Core/HW/DSPLLE/DSPSymbols.h"
#include "Core/HW/Memmap.h"
#include "Core/Host.h"
#include "VideoCommon/OnScreenDisplay.h"
@ -36,6 +37,16 @@ void WriteHostMemory(u8 value, u32 addr)
DSP::WriteARAM(value, addr);
}
void DMAToDSP(u16* dst, u32 addr, u32 size)
{
Memory::CopyFromEmuSwapped(dst, addr, size);
}
void DMAFromDSP(const u16* src, u32 addr, u32 size)
{
Memory::CopyToEmuSwapped(addr, src, size);
}
void OSD_AddMessage(std::string str, u32 ms)
{
OSD::AddMessage(std::move(str), ms);
@ -57,8 +68,14 @@ void InterruptRequest()
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
}
void CodeLoaded(u32 addr, size_t size)
{
CodeLoaded(Memory::GetPointer(addr), size);
}
void CodeLoaded(const u8* ptr, size_t size)
{
g_dsp.iram_crc = Common::HashEctor(ptr, size);
if (SConfig::GetInstance().m_DumpUCode)
{
DSP::DumpDSPCode(ptr, size, g_dsp.iram_crc);

View File

@ -78,8 +78,10 @@ void DSPLLE::DoState(PointerWrap& p)
Common::UnWriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
p.DoArray(g_dsp.iram, DSP_IRAM_SIZE);
Common::WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
// TODO: This uses the wrong endianness (producing bad disassembly)
// and a bogus byte count (producing bad hashes)
if (p.GetMode() == PointerWrap::MODE_READ)
Host::CodeLoaded((const u8*)g_dsp.iram, DSP_IRAM_BYTE_SIZE);
Host::CodeLoaded(reinterpret_cast<const u8*>(g_dsp.iram), DSP_IRAM_BYTE_SIZE);
p.DoArray(g_dsp.dram, DSP_DRAM_SIZE);
p.Do(g_init_hax);
p.Do(m_cycle_count);
@ -186,10 +188,6 @@ bool DSPLLE::Initialize(bool wii, bool dsp_thread)
m_wii = wii;
m_is_dsp_on_thread = dsp_thread;
// DSPLLE directly accesses the fastmem arena.
// TODO: The fastmem arena is only supposed to be used by the JIT:
// among other issues, its size is only 1GB on 32-bit targets.
g_dsp.cpu_ram = Memory::physical_base;
DSPCore_Reset();
InitInstructionTable();