Adding DSP state values to state

because that allow the DSP state to be loaded
This commit is contained in:
John Peterson 2013-05-22 01:09:13 +02:00
parent 86b4a87fef
commit 5e801fd6ef
6 changed files with 20 additions and 16 deletions

View File

@ -137,6 +137,7 @@ bool DSPCore_Init(const char *irom_filename, const char *coef_filename,
{
g_dsp.step_counter = 0;
cyclesLeft = 0;
init_hax = false;
dspjit = NULL;
g_dsp.irom = (u16*)AllocateMemoryPages(DSP_IROM_BYTE_SIZE);

View File

@ -246,14 +246,9 @@ static void gdsp_idma_in(u16 dsp_addr, u32 addr, u32 size)
}
WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
g_dsp.iram_crc = DSPHost_CodeLoaded(g_dsp.cpu_ram + (addr & 0x0fffffff), size);
NOTICE_LOG(DSPLLE, "*** Copy new UCode from 0x%08x to 0x%04x (crc: %8x)", addr, dsp_addr, g_dsp.iram_crc);
DSPHost_CodeLoaded((const u8*)g_dsp.iram + dsp_addr, size);
if (dspjit)
dspjit->ClearIRAM();
DSPAnalyzer::Analyze();
NOTICE_LOG(DSPLLE, "*** Copy new UCode from 0x%08x to 0x%04x (crc: %8x)", addr, dsp_addr, g_dsp.iram_crc);
}
static void gdsp_idma_out(u16 dsp_addr, u32 addr, u32 size)

View File

@ -15,7 +15,7 @@ void DSPHost_WriteHostMemory(u8 value, u32 addr);
bool DSPHost_OnThread();
bool DSPHost_Wii();
void DSPHost_InterruptRequest();
u32 DSPHost_CodeLoaded(const u8 *ptr, int size);
void DSPHost_CodeLoaded(const u8 *ptr, int size);
void DSPHost_UpdateDebugger();
#endif

View File

@ -4,6 +4,8 @@
#include "Common.h"
#include "Hash.h"
#include "DSP/DSPAnalyzer.h"
#include "DSP/DSPCore.h"
#include "DSP/DSPHost.h"
#include "DSPSymbols.h"
#include "DSPLLETools.h"
@ -45,23 +47,23 @@ void DSPHost_InterruptRequest()
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
}
u32 DSPHost_CodeLoaded(const u8 *ptr, int size)
void DSPHost_CodeLoaded(const u8 *ptr, int size)
{
u32 ector_crc = HashEctor(ptr, size);
g_dsp.iram_crc = HashEctor(ptr, size);
#if defined(_DEBUG) || defined(DEBUGFAST)
DumpDSPCode(ptr, size, ector_crc);
DumpDSPCode(ptr, size, g_dsp.iram_crc);
#endif
DSPSymbols::Clear();
// Auto load text file - if none just disassemble.
NOTICE_LOG(DSPLLE, "ector_crc: %08x", ector_crc);
NOTICE_LOG(DSPLLE, "g_dsp.iram_crc: %08x", g_dsp.iram_crc);
DSPSymbols::Clear();
bool success = false;
switch (ector_crc)
switch (g_dsp.iram_crc)
{
case 0x86840740: success = DSPSymbols::ReadAnnotatedAssembly("../../docs/DSP/DSP_UC_Zelda.txt"); break;
case 0x42f64ac4: success = DSPSymbols::ReadAnnotatedAssembly("../../docs/DSP/DSP_UC_Luigi.txt"); break;
@ -86,7 +88,10 @@ u32 DSPHost_CodeLoaded(const u8 *ptr, int size)
DSPHost_UpdateDebugger();
return ector_crc;
if (dspjit)
dspjit->ClearIRAM();
DSPAnalyzer::Analyze();
}
void DSPHost_UpdateDebugger()

View File

@ -16,6 +16,7 @@
#include "Core.h"
#include "DSPLLEGlobals.h" // Local
#include "DSP/DSPHost.h"
#include "DSP/DSPInterpreter.h"
#include "DSP/DSPHWInterface.h"
#include "DSP/disassemble.h"
@ -67,7 +68,6 @@ void DSPLLE::DoState(PointerWrap &p)
p.Do(g_dsp.reg_stack[i]);
}
p.Do(g_dsp.iram_crc);
p.Do(g_dsp.step_counter);
p.Do(g_dsp.ifx_regs);
p.Do(g_dsp.mbox[0]);
@ -75,8 +75,11 @@ void DSPLLE::DoState(PointerWrap &p)
UnWriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
p.DoArray(g_dsp.iram, DSP_IRAM_SIZE);
WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
if (p.GetMode() == PointerWrap::MODE_READ)
DSPHost_CodeLoaded((const u8*)g_dsp.iram, DSP_IRAM_BYTE_SIZE);
p.DoArray(g_dsp.dram, DSP_DRAM_SIZE);
p.Do(cyclesLeft);
p.Do(init_hax);
p.Do(m_cycle_count);
bool prevInitMixer = m_InitMixer;

View File

@ -59,7 +59,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
static std::thread g_save_thread;
// Don't forget to increase this after doing changes on the savestate system
static const u32 STATE_VERSION = 17;
static const u32 STATE_VERSION = 18;
enum
{