enum CPUState: rename CPU_* to STATE_*

This commit is contained in:
Tillmann Karras 2014-06-13 20:27:05 +02:00
parent ee100cf827
commit 20a16beabd
13 changed files with 34 additions and 33 deletions

View File

@ -113,7 +113,7 @@ unsigned int CMixer::Mix(short* samples, unsigned int num_samples, bool consider
memset(samples, 0, num_samples * 2 * sizeof(short)); memset(samples, 0, num_samples * 2 * sizeof(short));
if (PowerPC::GetState() != PowerPC::CPU_RUNNING) if (PowerPC::GetState() != PowerPC::STATE_RUNNING)
{ {
// Silence // Silence
return num_samples; return num_samples;
@ -138,7 +138,7 @@ void CMixer::MixerFifo::PushSamples(const short *samples, unsigned int num_sampl
// The auto throttle function. This loop will put a ceiling on the CPU MHz. // The auto throttle function. This loop will put a ceiling on the CPU MHz.
while (num_samples * 2 + ((indexW - Common::AtomicLoad(m_indexR)) & INDEX_MASK) >= MAX_SAMPLES * 2) while (num_samples * 2 + ((indexW - Common::AtomicLoad(m_indexR)) & INDEX_MASK) >= MAX_SAMPLES * 2)
{ {
if (*PowerPC::GetStatePtr() != PowerPC::CPU_RUNNING || soundStream->IsMuted()) if (*PowerPC::GetStatePtr() != PowerPC::STATE_RUNNING || soundStream->IsMuted())
break; break;
// Shortcut key for Throttle Skipping // Shortcut key for Throttle Skipping
if (Core::GetIsFramelimiterTempDisabled()) if (Core::GetIsFramelimiterTempDisabled())

View File

@ -226,7 +226,7 @@ bool Init()
// Called from GUI thread // Called from GUI thread
void Stop() // - Hammertime! void Stop() // - Hammertime!
{ {
if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) if (PowerPC::GetState() == PowerPC::STATE_POWERDOWN)
{ {
if (g_EmuThread.joinable()) if (g_EmuThread.joinable())
g_EmuThread.join(); g_EmuThread.join();
@ -471,7 +471,7 @@ void EmuThread()
// Spawn the CPU+GPU thread // Spawn the CPU+GPU thread
g_cpu_thread = std::thread(cpuThreadFunc); g_cpu_thread = std::thread(cpuThreadFunc);
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN) while (PowerPC::GetState() != PowerPC::STATE_POWERDOWN)
{ {
g_video_backend->PeekMessages(); g_video_backend->PeekMessages();
Common::SleepCurrentThread(20); Common::SleepCurrentThread(20);

View File

@ -18,7 +18,8 @@
void PPCDebugInterface::Disassemble(unsigned int address, char *dest, int max_size) void PPCDebugInterface::Disassemble(unsigned int address, char *dest, int max_size)
{ {
// Memory::ReadUnchecked_U32 seemed to crash on shutdown // Memory::ReadUnchecked_U32 seemed to crash on shutdown
if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) return; if (PowerPC::GetState() == PowerPC::STATE_POWERDOWN)
return;
if (Core::GetState() != Core::CORE_UNINITIALIZED) if (Core::GetState() != Core::CORE_UNINITIALIZED)
{ {

View File

@ -64,9 +64,9 @@ bool FifoPlayer::Play()
LoadMemory(); LoadMemory();
// This loop replaces the CPU loop that occurs when a game is run // This loop replaces the CPU loop that occurs when a game is run
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN) while (PowerPC::GetState() != PowerPC::STATE_POWERDOWN)
{ {
if (PowerPC::GetState() == PowerPC::CPU_RUNNING) if (PowerPC::GetState() == PowerPC::STATE_RUNNING)
{ {
if (m_CurrentFrame >= m_FrameRangeEnd) if (m_CurrentFrame >= m_FrameRangeEnd)
{ {

View File

@ -47,21 +47,21 @@ void CCPU::Run()
reswitch: reswitch:
switch (PowerPC::GetState()) switch (PowerPC::GetState())
{ {
case PowerPC::CPU_RUNNING: case PowerPC::STATE_RUNNING:
//1: enter a fast runloop //1: enter a fast runloop
PowerPC::RunLoop(); PowerPC::RunLoop();
break; break;
case PowerPC::CPU_STEPPING: case PowerPC::STATE_STEPPING:
m_csCpuOccupied.unlock(); m_csCpuOccupied.unlock();
//1: wait for step command.. //1: wait for step command..
m_StepEvent.Wait(); m_StepEvent.Wait();
m_csCpuOccupied.lock(); m_csCpuOccupied.lock();
if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) if (PowerPC::GetState() == PowerPC::STATE_POWERDOWN)
return; return;
if (PowerPC::GetState() != PowerPC::CPU_STEPPING) if (PowerPC::GetState() != PowerPC::STATE_STEPPING)
goto reswitch; goto reswitch;
//3: do a step //3: do a step
@ -76,7 +76,7 @@ reswitch:
Host_UpdateDisasmDialog(); Host_UpdateDisasmDialog();
break; break;
case PowerPC::CPU_POWERDOWN: case PowerPC::STATE_POWERDOWN:
//1: Exit loop!! //1: Exit loop!!
return; return;
} }
@ -91,7 +91,7 @@ void CCPU::Stop()
bool CCPU::IsStepping() bool CCPU::IsStepping()
{ {
return PowerPC::GetState() == PowerPC::CPU_STEPPING; return PowerPC::GetState() == PowerPC::STATE_STEPPING;
} }
void CCPU::Reset() void CCPU::Reset()
@ -102,7 +102,7 @@ void CCPU::Reset()
void CCPU::StepOpcode(Common::Event *event) void CCPU::StepOpcode(Common::Event *event)
{ {
m_StepEvent.Set(); m_StepEvent.Set();
if (PowerPC::GetState() == PowerPC::CPU_STEPPING) if (PowerPC::GetState() == PowerPC::STATE_STEPPING)
{ {
m_SyncEvent = event; m_SyncEvent = event;
} }

View File

@ -143,9 +143,9 @@ void FrameUpdate()
} }
// ("framestop") the only purpose of this is to cause interpreter/jit Run() to return temporarily. // ("framestop") the only purpose of this is to cause interpreter/jit Run() to return temporarily.
// after that we set it back to CPU_RUNNING and continue as normal. // after that we set it back to STATE_RUNNING and continue as normal.
if (g_bFrameStop) if (g_bFrameStop)
*PowerPC::GetStatePtr() = PowerPC::CPU_STEPPING; *PowerPC::GetStatePtr() = PowerPC::STATE_STEPPING;
if (g_framesToSkip) if (g_framesToSkip)
FrameSkipping(); FrameSkipping();

View File

@ -409,7 +409,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
// Comment out the following to disable breakpoints (speed-up) // Comment out the following to disable breakpoints (speed-up)
if (!Profiler::g_ProfileBlocks) if (!Profiler::g_ProfileBlocks)
{ {
if (GetState() == CPU_STEPPING) if (GetState() == STATE_STEPPING)
blockSize = 1; blockSize = 1;
Trace(); Trace();
} }
@ -583,7 +583,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
SetJumpTarget(clearInt); SetJumpTarget(clearInt);
} }
if (Core::g_CoreStartupParameter.bEnableDebugging && breakpoints.IsAddressBreakPoint(ops[i].address) && GetState() != CPU_STEPPING) if (Core::g_CoreStartupParameter.bEnableDebugging && breakpoints.IsAddressBreakPoint(ops[i].address) && GetState() != STATE_STEPPING)
{ {
gpr.Flush(); gpr.Flush();
fpr.Flush(); fpr.Flush();

View File

@ -54,7 +54,7 @@ void Jit64AsmRoutineManager::Generate()
if (Core::g_CoreStartupParameter.bEnableDebugging) if (Core::g_CoreStartupParameter.bEnableDebugging)
{ {
TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(PowerPC::CPU_STEPPING)); TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(PowerPC::STATE_STEPPING));
FixupBranch notStepping = J_CC(CC_Z); FixupBranch notStepping = J_CC(CC_Z);
ABI_CallFunction(reinterpret_cast<void *>(&PowerPC::CheckBreakPoints)); ABI_CallFunction(reinterpret_cast<void *>(&PowerPC::CheckBreakPoints));
TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(0xFFFFFFFF)); TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(0xFFFFFFFF));

View File

@ -508,7 +508,7 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
// Comment out the following to disable breakpoints (speed-up) // Comment out the following to disable breakpoints (speed-up)
if (!Profiler::g_ProfileBlocks) if (!Profiler::g_ProfileBlocks)
{ {
if (GetState() == CPU_STEPPING) if (GetState() == STATE_STEPPING)
blockSize = 1; blockSize = 1;
Trace(); Trace();
} }
@ -642,7 +642,7 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
ibuild.EmitExtExceptionCheck(ibuild.EmitIntConst(ops[i].address)); ibuild.EmitExtExceptionCheck(ibuild.EmitIntConst(ops[i].address));
} }
if (Core::g_CoreStartupParameter.bEnableDebugging && breakpoints.IsAddressBreakPoint(ops[i].address) && GetState() != CPU_STEPPING) if (Core::g_CoreStartupParameter.bEnableDebugging && breakpoints.IsAddressBreakPoint(ops[i].address) && GetState() != STATE_STEPPING)
{ {
ibuild.EmitBreakPointCheck(ibuild.EmitIntConst(ops[i].address)); ibuild.EmitBreakPointCheck(ibuild.EmitIntConst(ops[i].address));
} }

View File

@ -30,7 +30,7 @@ namespace PowerPC
// STATE_TO_SAVE // STATE_TO_SAVE
PowerPCState GC_ALIGNED16(ppcState); PowerPCState GC_ALIGNED16(ppcState);
volatile CPUState state = CPU_STEPPING; volatile CPUState state = STATE_STEPPING;
Interpreter * const interpreter = Interpreter::getInstance(); Interpreter * const interpreter = Interpreter::getInstance();
CoreMode mode; CoreMode mode;
@ -158,7 +158,7 @@ void Init(int cpu_core)
{ {
mode = MODE_INTERPRETER; mode = MODE_INTERPRETER;
} }
state = CPU_STEPPING; state = STATE_STEPPING;
ppcState.iCache.Init(); ppcState.iCache.Init();
} }
@ -168,7 +168,7 @@ void Shutdown()
JitInterface::Shutdown(); JitInterface::Shutdown();
interpreter->Shutdown(); interpreter->Shutdown();
cpu_core_base = nullptr; cpu_core_base = nullptr;
state = CPU_POWERDOWN; state = STATE_POWERDOWN;
} }
CoreMode GetMode() CoreMode GetMode()
@ -205,7 +205,7 @@ void SingleStep()
void RunLoop() void RunLoop()
{ {
state = CPU_RUNNING; state = STATE_RUNNING;
cpu_core_base->Run(); cpu_core_base->Run();
Host_UpdateDisasmDialog(); Host_UpdateDisasmDialog();
} }
@ -222,19 +222,19 @@ volatile CPUState *GetStatePtr()
void Start() void Start()
{ {
state = CPU_RUNNING; state = STATE_RUNNING;
Host_UpdateDisasmDialog(); Host_UpdateDisasmDialog();
} }
void Pause() void Pause()
{ {
state = CPU_STEPPING; state = STATE_STEPPING;
Host_UpdateDisasmDialog(); Host_UpdateDisasmDialog();
} }
void Stop() void Stop()
{ {
state = CPU_POWERDOWN; state = STATE_POWERDOWN;
Host_UpdateDisasmDialog(); Host_UpdateDisasmDialog();
} }

View File

@ -75,9 +75,9 @@ struct GC_ALIGNED64(PowerPCState)
enum CPUState enum CPUState
{ {
CPU_RUNNING = 0, STATE_RUNNING = 0,
CPU_STEPPING = 2, STATE_STEPPING = 2,
CPU_POWERDOWN = 3, STATE_POWERDOWN = 3,
}; };
extern PowerPCState ppcState; extern PowerPCState ppcState;

View File

@ -370,7 +370,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *
// No use running the loop when booting fails // No use running the loop when booting fails
if ( BootManager::BootCore( g_filename.c_str() ) ) if ( BootManager::BootCore( g_filename.c_str() ) )
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN) while (PowerPC::GetState() != PowerPC::STATE_POWERDOWN)
updateMainFrameEvent.Wait(); updateMainFrameEvent.Wait();
WiimoteReal::Shutdown(); WiimoteReal::Shutdown();

View File

@ -380,7 +380,7 @@ int main(int argc, char* argv[])
[event release]; [event release];
[pool release]; [pool release];
#else #else
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN) while (PowerPC::GetState() != PowerPC::STATE_POWERDOWN)
updateMainFrameEvent.Wait(); updateMainFrameEvent.Wait();
#endif #endif
} }