Merge remote-tracking branch 'john-peterson/state4'

This commit is contained in:
Rachel Bryk 2013-05-21 20:14:15 -04:00
commit 10630989a4
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; g_dsp.step_counter = 0;
cyclesLeft = 0; cyclesLeft = 0;
init_hax = false;
dspjit = NULL; dspjit = NULL;
g_dsp.irom = (u16*)AllocateMemoryPages(DSP_IROM_BYTE_SIZE); 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); WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
g_dsp.iram_crc = DSPHost_CodeLoaded(g_dsp.cpu_ram + (addr & 0x0fffffff), size); DSPHost_CodeLoaded((const u8*)g_dsp.iram + dsp_addr, size);
NOTICE_LOG(DSPLLE, "*** Copy new UCode from 0x%08x to 0x%04x (crc: %8x)", addr, dsp_addr, g_dsp.iram_crc); NOTICE_LOG(DSPLLE, "*** Copy new UCode from 0x%08x to 0x%04x (crc: %8x)", addr, dsp_addr, g_dsp.iram_crc);
if (dspjit)
dspjit->ClearIRAM();
DSPAnalyzer::Analyze();
} }
static void gdsp_idma_out(u16 dsp_addr, u32 addr, u32 size) 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_OnThread();
bool DSPHost_Wii(); bool DSPHost_Wii();
void DSPHost_InterruptRequest(); void DSPHost_InterruptRequest();
u32 DSPHost_CodeLoaded(const u8 *ptr, int size); void DSPHost_CodeLoaded(const u8 *ptr, int size);
void DSPHost_UpdateDebugger(); void DSPHost_UpdateDebugger();
#endif #endif

View File

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

View File

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

View File

@ -59,7 +59,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
static std::thread g_save_thread; static std::thread g_save_thread;
// Don't forget to increase this after doing changes on the savestate system // 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 enum
{ {