DSP-LLE: calculate code CRC _before_ swapping endianness

- Makes DSP-LLE code checksums the same as those from DSP-HLE. I'm
  assuming DSP-HLE was doing it correctly, since there are numerous
  references to these pre-endian-swapped checksums (including in
  DSPHost.cpp itself).
- Fixes disassembly when dumping code from DSP-LLE, which was using the
  wrong endianness and giving totally bogus output.
- Reveals error messages of the format, "Bah! ReadAnnotatedAssembly
  couldn't find the file ../../docs/DSP/DSP_UC_AX_07F88145.txt," which
  seems to be intended behavior that was previously hidden.
This commit is contained in:
Michael Maltese 2017-05-14 21:00:08 -07:00
parent c67bae5491
commit 59c863329d
2 changed files with 6 additions and 6 deletions

View File

@ -7,6 +7,7 @@
#include "Common/CPUDetect.h"
#include "Common/CommonTypes.h"
#include "Common/Hash.h"
#include "Common/Intrinsics.h"
#include "Common/Logging/Log.h"
#include "Common/MemoryUtil.h"
@ -227,18 +228,19 @@ u16 gdsp_ifx_read(u16 addr)
static const u8* gdsp_idma_in(u16 dsp_addr, u32 addr, u32 size)
{
const u8* code = &g_dsp.cpu_ram[addr & 0x0fffffff];
g_dsp.iram_crc = HashEctor(code, size);
Common::UnWriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
u8* dst = ((u8*)g_dsp.iram);
for (u32 i = 0; i < size; i += 2)
{
*(u16*)&dst[dsp_addr + i] =
Common::swap16(*(const u16*)&g_dsp.cpu_ram[(addr + i) & 0x0fffffff]);
*(u16*)&dst[dsp_addr + i] = Common::swap16(*(const u16*)&code[i]);
}
Common::WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
Host::CodeLoaded((const u8*)g_dsp.iram + dsp_addr, size);
Host::CodeLoaded(code, size);
NOTICE_LOG(DSPLLE, "*** Copy new UCode from 0x%08x to 0x%04x (crc: %8x)", addr, dsp_addr,
g_dsp.iram_crc);

View File

@ -58,8 +58,6 @@ void InterruptRequest()
void CodeLoaded(const u8* ptr, int size)
{
g_dsp.iram_crc = HashEctor(ptr, size);
if (SConfig::GetInstance().m_DumpUCode)
{
DSP::DumpDSPCode(ptr, size, g_dsp.iram_crc);