Merge pull request #4836 from lioncash/enum
DSPCore: Convert the DSPCoreState enum into an enum class
This commit is contained in:
commit
2835cfde52
|
@ -28,7 +28,7 @@ namespace DSP
|
||||||
{
|
{
|
||||||
SDSP g_dsp;
|
SDSP g_dsp;
|
||||||
DSPBreakpoints g_dsp_breakpoints;
|
DSPBreakpoints g_dsp_breakpoints;
|
||||||
static DSPCoreState core_state = DSPCORE_STOP;
|
static State core_state = State::Stopped;
|
||||||
u16 g_cycles_left = 0;
|
u16 g_cycles_left = 0;
|
||||||
bool g_init_hax = false;
|
bool g_init_hax = false;
|
||||||
std::unique_ptr<JIT::x86::DSPEmitter> g_dsp_jit;
|
std::unique_ptr<JIT::x86::DSPEmitter> g_dsp_jit;
|
||||||
|
@ -154,16 +154,16 @@ bool DSPCore_Init(const DSPInitOptions& opts)
|
||||||
|
|
||||||
g_dsp_cap.reset(opts.capture_logger);
|
g_dsp_cap.reset(opts.capture_logger);
|
||||||
|
|
||||||
core_state = DSPCORE_RUNNING;
|
core_state = State::Running;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPCore_Shutdown()
|
void DSPCore_Shutdown()
|
||||||
{
|
{
|
||||||
if (core_state == DSPCORE_STOP)
|
if (core_state == State::Stopped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
core_state = DSPCORE_STOP;
|
core_state = State::Stopped;
|
||||||
|
|
||||||
g_dsp_jit.reset();
|
g_dsp_jit.reset();
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ int DSPCore_RunCycles(int cycles)
|
||||||
{
|
{
|
||||||
switch (core_state)
|
switch (core_state)
|
||||||
{
|
{
|
||||||
case DSPCORE_RUNNING:
|
case State::Running:
|
||||||
// Seems to slow things down
|
// Seems to slow things down
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||||
cycles = Interpreter::RunCyclesDebug(cycles);
|
cycles = Interpreter::RunCyclesDebug(cycles);
|
||||||
|
@ -261,9 +261,9 @@ int DSPCore_RunCycles(int cycles)
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DSPCORE_STEPPING:
|
case State::Stepping:
|
||||||
step_event.Wait();
|
step_event.Wait();
|
||||||
if (core_state != DSPCORE_STEPPING)
|
if (core_state != State::Stepping)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Interpreter::Step();
|
Interpreter::Step();
|
||||||
|
@ -271,32 +271,32 @@ int DSPCore_RunCycles(int cycles)
|
||||||
|
|
||||||
Host::UpdateDebugger();
|
Host::UpdateDebugger();
|
||||||
break;
|
break;
|
||||||
case DSPCORE_STOP:
|
case State::Stopped:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cycles;
|
return cycles;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPCore_SetState(DSPCoreState new_state)
|
void DSPCore_SetState(State new_state)
|
||||||
{
|
{
|
||||||
core_state = new_state;
|
core_state = new_state;
|
||||||
|
|
||||||
// kick the event, in case we are waiting
|
// kick the event, in case we are waiting
|
||||||
if (new_state == DSPCORE_RUNNING)
|
if (new_state == State::Running)
|
||||||
step_event.Set();
|
step_event.Set();
|
||||||
|
|
||||||
Host::UpdateDebugger();
|
Host::UpdateDebugger();
|
||||||
}
|
}
|
||||||
|
|
||||||
DSPCoreState DSPCore_GetState()
|
State DSPCore_GetState()
|
||||||
{
|
{
|
||||||
return core_state;
|
return core_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSPCore_Step()
|
void DSPCore_Step()
|
||||||
{
|
{
|
||||||
if (core_state == DSPCORE_STEPPING)
|
if (core_state == State::Stepping)
|
||||||
step_event.Set();
|
step_event.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -355,18 +355,18 @@ void DSPCore_SetExternalInterrupt(bool val);
|
||||||
// sets a flag in the pending exception register.
|
// sets a flag in the pending exception register.
|
||||||
void DSPCore_SetException(u8 level);
|
void DSPCore_SetException(u8 level);
|
||||||
|
|
||||||
enum DSPCoreState
|
enum class State
|
||||||
{
|
{
|
||||||
DSPCORE_STOP = 0,
|
Stopped,
|
||||||
DSPCORE_RUNNING,
|
Running,
|
||||||
DSPCORE_STEPPING,
|
Stepping,
|
||||||
};
|
};
|
||||||
|
|
||||||
int DSPCore_RunCycles(int cycles);
|
int DSPCore_RunCycles(int cycles);
|
||||||
|
|
||||||
// These are meant to be called from the UI thread.
|
// These are meant to be called from the UI thread.
|
||||||
void DSPCore_SetState(DSPCoreState new_state);
|
void DSPCore_SetState(State new_state);
|
||||||
DSPCoreState DSPCore_GetState();
|
State DSPCore_GetState();
|
||||||
|
|
||||||
void DSPCore_Step();
|
void DSPCore_Step();
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ int RunCyclesDebug(int cycles)
|
||||||
return 0;
|
return 0;
|
||||||
if (g_dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc))
|
if (g_dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc))
|
||||||
{
|
{
|
||||||
DSPCore_SetState(DSPCORE_STEPPING);
|
DSPCore_SetState(State::Stepping);
|
||||||
return cycles;
|
return cycles;
|
||||||
}
|
}
|
||||||
Step();
|
Step();
|
||||||
|
@ -153,7 +153,7 @@ int RunCyclesDebug(int cycles)
|
||||||
return 0;
|
return 0;
|
||||||
if (g_dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc))
|
if (g_dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc))
|
||||||
{
|
{
|
||||||
DSPCore_SetState(DSPCORE_STEPPING);
|
DSPCore_SetState(State::Stepping);
|
||||||
return cycles;
|
return cycles;
|
||||||
}
|
}
|
||||||
// Idle skipping.
|
// Idle skipping.
|
||||||
|
@ -170,7 +170,7 @@ int RunCyclesDebug(int cycles)
|
||||||
{
|
{
|
||||||
if (g_dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc))
|
if (g_dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc))
|
||||||
{
|
{
|
||||||
DSPCore_SetState(DSPCORE_STEPPING);
|
DSPCore_SetState(State::Stepping);
|
||||||
return cycles;
|
return cycles;
|
||||||
}
|
}
|
||||||
Step();
|
Step();
|
||||||
|
|
|
@ -24,7 +24,7 @@ std::string DSPDebugInterface::Disassemble(unsigned int address)
|
||||||
|
|
||||||
std::string DSPDebugInterface::GetRawMemoryString(int memory, unsigned int address)
|
std::string DSPDebugInterface::GetRawMemoryString(int memory, unsigned int address)
|
||||||
{
|
{
|
||||||
if (DSPCore_GetState() == DSPCORE_STOP)
|
if (DSPCore_GetState() == State::Stopped)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
switch (memory)
|
switch (memory)
|
||||||
|
|
|
@ -115,22 +115,22 @@ DSPDebuggerLLE::~DSPDebuggerLLE()
|
||||||
|
|
||||||
void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event)
|
void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
const DSP::DSPCoreState dsp_state = DSP::DSPCore_GetState();
|
const DSP::State dsp_state = DSP::DSPCore_GetState();
|
||||||
|
|
||||||
if (dsp_state == DSP::DSPCORE_STOP)
|
if (dsp_state == DSP::State::Stopped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (event.GetId())
|
switch (event.GetId())
|
||||||
{
|
{
|
||||||
case ID_RUNTOOL:
|
case ID_RUNTOOL:
|
||||||
if (dsp_state == DSP::DSPCORE_RUNNING)
|
if (dsp_state == DSP::State::Running)
|
||||||
DSP::DSPCore_SetState(DSP::DSPCORE_STEPPING);
|
DSP::DSPCore_SetState(DSP::State::Stepping);
|
||||||
else
|
else
|
||||||
DSP::DSPCore_SetState(DSP::DSPCORE_RUNNING);
|
DSP::DSPCore_SetState(DSP::State::Running);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_STEPTOOL:
|
case ID_STEPTOOL:
|
||||||
if (dsp_state == DSP::DSPCORE_STEPPING)
|
if (dsp_state == DSP::State::Stepping)
|
||||||
{
|
{
|
||||||
DSP::DSPCore_Step();
|
DSP::DSPCore_Step();
|
||||||
Repopulate();
|
Repopulate();
|
||||||
|
@ -175,7 +175,7 @@ void DSPDebuggerLLE::FocusOnPC()
|
||||||
|
|
||||||
void DSPDebuggerLLE::UpdateState()
|
void DSPDebuggerLLE::UpdateState()
|
||||||
{
|
{
|
||||||
if (DSP::DSPCore_GetState() == DSP::DSPCORE_RUNNING)
|
if (DSP::DSPCore_GetState() == DSP::State::Running)
|
||||||
{
|
{
|
||||||
m_Toolbar->SetToolLabel(ID_RUNTOOL, _("Pause"));
|
m_Toolbar->SetToolLabel(ID_RUNTOOL, _("Pause"));
|
||||||
m_Toolbar->SetToolBitmap(
|
m_Toolbar->SetToolBitmap(
|
||||||
|
|
Loading…
Reference in New Issue