Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'john-peterson/state4'
  • Loading branch information
RachelBryk committed May 22, 2013
2 parents 10d1d19 + 5e801fd commit 1063098
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
1 change: 1 addition & 0 deletions Source/Core/Core/Src/DSP/DSPCore.cpp
Expand Up @@ -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);
Expand Down
9 changes: 2 additions & 7 deletions Source/Core/Core/Src/DSP/DSPHWInterface.cpp
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/DSPHost.h
Expand Up @@ -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
17 changes: 11 additions & 6 deletions Source/Core/Core/Src/HW/DSPLLE/DSPHost.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand All @@ -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()
Expand Down
5 changes: 4 additions & 1 deletion Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -67,16 +68,18 @@ 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]);
p.Do(g_dsp.mbox[1]);
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;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/State.cpp
Expand Up @@ -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
{
Expand Down

0 comments on commit 1063098

Please sign in to comment.