DSP:
* LLE dspinit hax (demo disks, zelda collectors edition, ocarina of time working (again) with lle) * LLE interpreter "DSPonThread" working again git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7409 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
89798575c3
commit
bb90b7fcea
|
@ -40,6 +40,7 @@ SDSP g_dsp;
|
||||||
DSPBreakpoints dsp_breakpoints;
|
DSPBreakpoints dsp_breakpoints;
|
||||||
DSPCoreState core_state = DSPCORE_STOP;
|
DSPCoreState core_state = DSPCORE_STOP;
|
||||||
u16 cyclesLeft = 0;
|
u16 cyclesLeft = 0;
|
||||||
|
bool init_hax = false;
|
||||||
DSPEmitter *dspjit = NULL;
|
DSPEmitter *dspjit = NULL;
|
||||||
Common::Event step_event;
|
Common::Event step_event;
|
||||||
|
|
||||||
|
|
|
@ -266,6 +266,7 @@ extern SDSP g_dsp;
|
||||||
extern DSPBreakpoints dsp_breakpoints;
|
extern DSPBreakpoints dsp_breakpoints;
|
||||||
extern DSPEmitter *dspjit;
|
extern DSPEmitter *dspjit;
|
||||||
extern u16 cyclesLeft;
|
extern u16 cyclesLeft;
|
||||||
|
extern bool init_hax;
|
||||||
|
|
||||||
bool DSPCore_Init(const char *irom_filename, const char *coef_filename,
|
bool DSPCore_Init(const char *irom_filename, const char *coef_filename,
|
||||||
bool bUsingJIT);
|
bool bUsingJIT);
|
||||||
|
|
|
@ -81,6 +81,11 @@ void gdsp_mbox_write_l(u8 mbx, u16 val)
|
||||||
|
|
||||||
u16 gdsp_mbox_read_h(u8 mbx)
|
u16 gdsp_mbox_read_h(u8 mbx)
|
||||||
{
|
{
|
||||||
|
if (init_hax && mbx)
|
||||||
|
{
|
||||||
|
return 0x8054;
|
||||||
|
}
|
||||||
|
|
||||||
return (u16)(Common::AtomicLoad(g_dsp.mbox[mbx]) >> 16); // TODO: mask away the top bit?
|
return (u16)(Common::AtomicLoad(g_dsp.mbox[mbx]) >> 16); // TODO: mask away the top bit?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +94,13 @@ u16 gdsp_mbox_read_l(u8 mbx)
|
||||||
const u32 value = Common::AtomicLoadAcquire(g_dsp.mbox[mbx]);
|
const u32 value = Common::AtomicLoadAcquire(g_dsp.mbox[mbx]);
|
||||||
Common::AtomicStoreRelease(g_dsp.mbox[mbx], value & ~0x80000000);
|
Common::AtomicStoreRelease(g_dsp.mbox[mbx], value & ~0x80000000);
|
||||||
|
|
||||||
|
if (init_hax && mbx)
|
||||||
|
{
|
||||||
|
init_hax = false;
|
||||||
|
DSPCore_Reset();
|
||||||
|
return 0x4348;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||||
if (mbx == GDSP_MBOX_DSP)
|
if (mbx == GDSP_MBOX_DSP)
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,17 +42,17 @@ void WriteCR(u16 val)
|
||||||
// reset
|
// reset
|
||||||
if (val & 1)
|
if (val & 1)
|
||||||
{
|
{
|
||||||
|
INFO_LOG(DSPLLE,"DSP_CONTROL RESET");
|
||||||
DSPCore_Reset();
|
DSPCore_Reset();
|
||||||
val &= ~1;
|
val &= ~1;
|
||||||
}
|
}
|
||||||
// init - can reset and init be done at the same time?
|
// init
|
||||||
else if (val == 4)
|
else if (val == 4)
|
||||||
{
|
{
|
||||||
// this looks like a hack! OSInitAudioSystem ucode
|
// HAX!
|
||||||
// should send this mail - not dsp core itself
|
// OSInitAudioSystem ucode should send this mail - not dsp core itself
|
||||||
// this doesnt work anymore
|
INFO_LOG(DSPLLE,"DSP_CONTROL INIT");
|
||||||
//gdsp_mbox_write_h(GDSP_MBOX_DSP, 0x8054);
|
init_hax = true;
|
||||||
//gdsp_mbox_write_l(GDSP_MBOX_DSP, 0x4348);
|
|
||||||
val |= 0x800;
|
val |= 0x800;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,32 +103,25 @@ void Step()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used by thread mode.
|
// Used by thread mode.
|
||||||
//void Run()
|
int RunCyclesThread(int cycles)
|
||||||
//{
|
{
|
||||||
// int checkInterrupt = 0;
|
while (true)
|
||||||
// gdsp_running = true;
|
{
|
||||||
// while (!(g_dsp.cr & CR_HALT) && gdsp_running)
|
if (g_dsp.cr & CR_HALT)
|
||||||
// {
|
return 0;
|
||||||
// if (jit)
|
|
||||||
// jit->RunForCycles(1);
|
if (g_dsp.external_interrupt_waiting)
|
||||||
// else {
|
{
|
||||||
// // Automatically let the other threads work if we're idle skipping
|
DSPCore_CheckExternalInterrupt();
|
||||||
// if(DSPAnalyzer::code_flags[g_dsp.pc] & DSPAnalyzer::CODE_IDLE_SKIP)
|
DSPCore_SetExternalInterrupt(false);
|
||||||
// Common::YieldCPU();
|
}
|
||||||
//
|
|
||||||
// Step();
|
Step();
|
||||||
//
|
cycles--;
|
||||||
// // Turns out the less you check for external interrupts, the more
|
if (cycles < 0)
|
||||||
// // sound you hear, and it becomes slower
|
return 0;
|
||||||
// checkInterrupt++;
|
}
|
||||||
// if(checkInterrupt == 500) { // <-- Arbitrary number. TODO: tweak
|
}
|
||||||
// DSPCore_CheckExternalInterrupt();
|
|
||||||
// checkInterrupt = 0;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// gdsp_running = false;
|
|
||||||
//}
|
|
||||||
|
|
||||||
// This one has basic idle skipping, and checks breakpoints.
|
// This one has basic idle skipping, and checks breakpoints.
|
||||||
int RunCyclesDebug(int cycles)
|
int RunCyclesDebug(int cycles)
|
||||||
|
@ -149,14 +142,6 @@ int RunCyclesDebug(int cycles)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In thread mode, process external interrupts
|
|
||||||
if (g_dsp.external_interrupt_waiting)
|
|
||||||
{
|
|
||||||
DSPCore_CheckExternalInterrupt();
|
|
||||||
DSPCore_CheckExceptions();
|
|
||||||
DSPCore_SetExternalInterrupt(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// Next, let's run a few cycles with idle skipping, so that we can skip
|
// Next, let's run a few cycles with idle skipping, so that we can skip
|
||||||
|
@ -191,7 +176,6 @@ int RunCyclesDebug(int cycles)
|
||||||
cycles--;
|
cycles--;
|
||||||
if (cycles < 0)
|
if (cycles < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// We don't bother directly supporting pause - if the main emu pauses,
|
// We don't bother directly supporting pause - if the main emu pauses,
|
||||||
// it just won't call this function anymore.
|
// it just won't call this function anymore.
|
||||||
}
|
}
|
||||||
|
@ -213,14 +197,6 @@ int RunCycles(int cycles)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In thread mode, process external interrupts
|
|
||||||
if (g_dsp.external_interrupt_waiting)
|
|
||||||
{
|
|
||||||
DSPCore_CheckExternalInterrupt();
|
|
||||||
DSPCore_CheckExceptions();
|
|
||||||
DSPCore_SetExternalInterrupt(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// Next, let's run a few cycles with idle skipping, so that we can skip
|
// Next, let's run a few cycles with idle skipping, so that we can skip
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
namespace DSPInterpreter {
|
namespace DSPInterpreter {
|
||||||
|
|
||||||
void Step();
|
void Step();
|
||||||
void Run();
|
|
||||||
|
|
||||||
// See: DspIntBranch.cpp
|
// See: DspIntBranch.cpp
|
||||||
void HandleLoop();
|
void HandleLoop();
|
||||||
|
@ -33,6 +32,7 @@ void HandleLoop();
|
||||||
// If these simply return the same number of cycles as was passed into them,
|
// If these simply return the same number of cycles as was passed into them,
|
||||||
// chances are that the DSP is halted.
|
// chances are that the DSP is halted.
|
||||||
// The difference between them is that the debug one obeys breakpoints.
|
// The difference between them is that the debug one obeys breakpoints.
|
||||||
|
int RunCyclesThread(int cycles);
|
||||||
int RunCycles(int cycles);
|
int RunCycles(int cycles);
|
||||||
int RunCyclesDebug(int cycles);
|
int RunCyclesDebug(int cycles);
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ void DSPLLE::dsp_thread(DSPLLE *dsp_lle)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DSPInterpreter::RunCycles(cycles);
|
DSPInterpreter::RunCyclesThread(cycles);
|
||||||
}
|
}
|
||||||
Common::AtomicStore(dsp_lle->m_cycle_count, 0);
|
Common::AtomicStore(dsp_lle->m_cycle_count, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue