diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 7c0987c077..418ea45f09 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -201,19 +201,18 @@ bool Init() return true; } - - + // Called from GUI thread or VI thread -void Stop() // - Hammertime! +void Stop() // - Hammertime! { Host_SetWaitCursor(true); - if (PowerPC::state == PowerPC::CPU_POWERDOWN) + if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) return; - // stop the CPU - PowerPC::state = PowerPC::CPU_POWERDOWN; - - CCPU::StepOpcode(); //kick it if it's waiting + // stop the CPU + PowerPC::Stop(); + + CCPU::StepOpcode(); //kick it if it's waiting // The quit is to get it out of its message loop // Should be moved inside the plugin. @@ -222,7 +221,7 @@ void Stop() // - Hammertime! #else CPluginManager::GetInstance().GetVideo()->Video_Stop(); #endif - + #ifdef _WIN32 /* I have to use this to avoid the hangings, it seems harmless and it works so I'm okay with it */ @@ -256,7 +255,7 @@ THREAD_RETURN CpuThread(void *pArg) if (_CoreParameter.bRunCompareServer) { CPUCompare::StartServer(); - PowerPC::state = PowerPC::CPU_RUNNING; + PowerPC::Start(); } else if (_CoreParameter.bRunCompareClient) { @@ -265,7 +264,7 @@ THREAD_RETURN CpuThread(void *pArg) } if (_CoreParameter.bLockThreads) - Common::Thread::SetCurrentThreadAffinity(1); //Force to first core + Common::Thread::SetCurrentThreadAffinity(1); // Force to first core if (_CoreParameter.bUseFastMem) { @@ -353,7 +352,7 @@ THREAD_RETURN EmuThread(void *pArg) dspInit.pDebuggerBreak = Callback_DebuggerBreak; dspInit.pGenerateDSPInterrupt = Callback_DSPInterrupt; dspInit.pGetAudioStreaming = AudioInterface::Callback_GetStreaming; - dspInit.pEmulatorState = (int *)&PowerPC::state; + dspInit.pEmulatorState = (int *)PowerPC::GetStatePtr(); dspInit.bWii = _CoreParameter.bWii; // Needed for Stop and Start #ifdef SETUP_FREE_PLUGIN_ON_BOOT @@ -436,9 +435,10 @@ THREAD_RETURN EmuThread(void *pArg) //Common::SetCurrentThreadName("Idle thread"); //TODO(ector) : investigate using GetMessage instead .. although //then we lose the powerdown check. ... unless powerdown sends a message :P - while (PowerPC::state != PowerPC::CPU_POWERDOWN) + while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN) { - if (Callback_PeekMessages) Callback_PeekMessages(); + if (Callback_PeekMessages) + Callback_PeekMessages(); Common::SleepCurrentThread(20); } #else diff --git a/Source/Core/Core/Src/HW/CPU.cpp b/Source/Core/Core/Src/HW/CPU.cpp index c5513df6a0..89596e04c5 100644 --- a/Source/Core/Core/Src/HW/CPU.cpp +++ b/Source/Core/Core/Src/HW/CPU.cpp @@ -26,8 +26,6 @@ #include "../Debugger/Debugger_BreakPoints.h" -using namespace PowerPC; - namespace { static bool g_Branch; @@ -56,19 +54,19 @@ void CCPU::Run() while (true) { reswitch: - switch (PowerPC::state) + switch (PowerPC::GetState()) { - case CPU_RUNNING: + case PowerPC::CPU_RUNNING: //1: enter a fast runloop PowerPC::RunLoop(); break; - case CPU_STEPPING: + case PowerPC::CPU_STEPPING: m_StepEvent.Wait(); //1: wait for step command.. - if (state == CPU_POWERDOWN) + if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) return; - if (state != CPU_STEPPING) + if (PowerPC::GetState() != PowerPC::CPU_STEPPING) goto reswitch; //2: check for cpu compare @@ -89,7 +87,7 @@ reswitch: Host_UpdateDisasmDialog(); break; - case CPU_POWERDOWN: + case PowerPC::CPU_POWERDOWN: //1: Exit loop!! return; } @@ -104,7 +102,7 @@ void CCPU::Stop() bool CCPU::IsStepping() { - return PowerPC::state == CPU_STEPPING; + return PowerPC::GetState() == PowerPC::CPU_STEPPING; } void CCPU::Reset() @@ -115,7 +113,7 @@ void CCPU::Reset() void CCPU::StepOpcode(Common::Event *event) { m_StepEvent.Set(); - if (PowerPC::state == CPU_STEPPING) + if (PowerPC::GetState() == PowerPC::CPU_STEPPING) { m_SyncEvent = event; } diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp index ed42aaf327..491c0e4cc1 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp @@ -130,10 +130,10 @@ void SingleStep() } } -// sFastRun - inspired by GCemu +// FastRun - inspired by GCemu (to imitate the JIT so that they can be compared). void Run() { - while (!PowerPC::state) + while (!PowerPC::GetState()) { //we have to check exceptions at branches apparently (or maybe just rfi?) if (Core::GetStartupParameter().bEnableDebugging) diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp b/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp index 32eb42b0ef..427874ad8e 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp @@ -154,7 +154,7 @@ void AsmRoutineManager::Generate() MOV(32, M(&PC), R(EAX)); SetJumpTarget(skipExceptions); - TEST(32, M((void*)&PowerPC::state), Imm32(0xFFFFFFFF)); + TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(0xFFFFFFFF)); J_CC(CC_Z, outerLoop, true); //Landing pad for drec space diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/Jit.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/Jit.cpp index 7ebe8ea619..1cca8e3998 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/Jit.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/Jit.cpp @@ -184,7 +184,11 @@ namespace CPUCompare jo.optimizeStack = true; jo.enableBlocklink = true; // Speed boost, but not 100% safe #ifdef _M_X64 +#ifdef JITTEST + jo.enableFastMem = false; +#else jo.enableFastMem = Core::GetStartupParameter().bUseFastMem; +#endif #else jo.enableFastMem = false; #endif @@ -275,8 +279,8 @@ namespace CPUCompare } } - static const bool ImHereDebug = false; - static const bool ImHereLog = false; + static const bool ImHereDebug = true; + static const bool ImHereLog = true; static std::map been_here; void ImHere() diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitAsm.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitAsm.cpp index 906f3db494..cdac7beaef 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitAsm.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitAsm.cpp @@ -65,7 +65,6 @@ AsmRoutineManager asm_routines; // dynarec buffer // At this offset - 4, there is an int specifying the block number. - void AsmRoutineManager::Generate() { enterCode = AlignCode16(); @@ -156,9 +155,8 @@ void AsmRoutineManager::Generate() MOV(32, M(&PC), R(EAX)); SetJumpTarget(skipExceptions); - TEST(32, M((void*)&PowerPC::state), Imm32(0xFFFFFFFF)); + TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(0xFFFFFFFF)); J_CC(CC_Z, outerLoop, true); - //Landing pad for drec space ABI_PopAllCalleeSavedRegsAndAdjustStack(); RET(); diff --git a/Source/Core/Core/Src/PowerPC/PowerPC.cpp b/Source/Core/Core/Src/PowerPC/PowerPC.cpp index 4df8980b88..a73f0c8ddb 100644 --- a/Source/Core/Core/Src/PowerPC/PowerPC.cpp +++ b/Source/Core/Core/Src/PowerPC/PowerPC.cpp @@ -176,23 +176,32 @@ void RunLoop() Host_UpdateDisasmDialog(); } +CPUState GetState() +{ + return state; +} + +volatile CPUState *GetStatePtr() +{ + return &state; +} + void Start() { - // Select running mode for CPU.cpp state = CPU_RUNNING; - Host_UpdateDisasmDialog(); + Host_UpdateDisasmDialog(); } void Pause() { state = CPU_STEPPING; - Host_UpdateDisasmDialog(); + Host_UpdateDisasmDialog(); } void Stop() { state = CPU_POWERDOWN; - Host_UpdateDisasmDialog(); + Host_UpdateDisasmDialog(); } void CheckExceptions() diff --git a/Source/Core/Core/Src/PowerPC/PowerPC.h b/Source/Core/Core/Src/PowerPC/PowerPC.h index 9eae9c0be4..dbb36a087a 100644 --- a/Source/Core/Core/Src/PowerPC/PowerPC.h +++ b/Source/Core/Core/Src/PowerPC/PowerPC.h @@ -72,7 +72,6 @@ enum CPUState }; extern PowerPCState ppcState; -extern volatile CPUState state; // Execution engines should poll this to know when to exit. void Init(); void Shutdown(); @@ -86,6 +85,8 @@ void RunLoop(); void Start(); void Pause(); void Stop(); +CPUState GetState(); +volatile CPUState *GetStatePtr(); // this oddity is here instead of an extern declaration to easily be able to find all direct accesses throughout the code. void CompactCR(); void ExpandCR(); diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index c238ef5174..4016d986ba 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -68,7 +68,7 @@ CCodeWindow* g_pCodeWindow = NULL; LONG WINAPI MyUnhandledExceptionFilter(LPEXCEPTION_POINTERS e) { //EnterCriticalSection(&g_uefcs); - FILE* file=NULL; + FILE* file = NULL; fopen_s(&file, "exceptioninfo.txt", "a"); fseek(file, 0, SEEK_END); etfprint(file, "\n"); diff --git a/Source/Core/InputCommon/Src/Configuration.cpp b/Source/Core/InputCommon/Src/Configuration.cpp index b368a79f87..31e766ff85 100644 --- a/Source/Core/InputCommon/Src/Configuration.cpp +++ b/Source/Core/InputCommon/Src/Configuration.cpp @@ -50,11 +50,11 @@ namespace InputCommon // ŻŻŻŻŻŻŻŻŻŻŻŻŻ float Deg2Rad(float Deg) { - return Deg * (M_PI / 180.0); + return Deg * ((float)M_PI / 180.0f); } float Rad2Deg(float Rad) { - return (Rad * 180.0) / M_PI; + return (Rad * 180.0f) / (float)M_PI; } ///////////////////////////////////////// @@ -70,7 +70,7 @@ float CoordinatesToRadius(int x, int y) bool IsDeadZone(float DeadZone, int x, int y) { // Get the distance from the center - float Distance = CoordinatesToRadius(x, y) / 32767.0; + float Distance = CoordinatesToRadius(x, y) / 32767.0f; //Console::Print("%f\n", Distance); @@ -159,7 +159,7 @@ std::vector Square2Circle(int _x, int _y, int _pad, std::string SDiagonal, // ----------- // Get the manually configured diagonal distance int Tmp = atoi (SDiagonal.substr(0, SDiagonal.length() - 1).c_str()); - float Diagonal = Tmp / 100.0; + float Diagonal = Tmp / 100.0f; // First make a perfect square in case we don't have one already float OrigDist = sqrt( pow((float)_y, 2) + pow((float)_x, 2) ); // Get current distance diff --git a/Source/Core/InputCommon/Src/SDL.cpp b/Source/Core/InputCommon/Src/SDL.cpp index 15b552a08d..b3f81fa2f7 100644 --- a/Source/Core/InputCommon/Src/SDL.cpp +++ b/Source/Core/InputCommon/Src/SDL.cpp @@ -123,7 +123,7 @@ bool SearchDevices(std::vector &_joyinfo, int &_NumPads, int &_ if (SDL_JoystickOpened(i)) SDL_JoystickClose(_joyinfo[i].joy); } - _NumPads = _joyinfo.size(); + _NumPads = (int)_joyinfo.size(); return true; } diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.cpp index 8cf5be08f5..c50dd0cd4b 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/PCHW/Mixer.cpp @@ -121,12 +121,16 @@ void Mixer_PushSamples(short *buffer, int num_stereo_samples, int sample_rate) static int PV1l=0,PV2l=0,PV3l=0,PV4l=0; static int PV1r=0,PV2r=0,PV3r=0,PV4r=0; static int acc=0; - + +#ifdef _WIN32 + if (GetAsyncKeyState(VK_TAB)) + return; +#endif + // Write Other Audio //bThrottling = g_Config.m_EnableThrottle; - if(g_Config.m_EnableThrottle) + if (g_Config.m_EnableThrottle) { - /* This is only needed for non-AX sound, currently directly streamed and DTK sound. For AX we call SoundStream::Update in AXTask() for example. */ diff --git a/Source/Plugins/Plugin_PadSimple/Plugin_PadSimple.vcproj b/Source/Plugins/Plugin_PadSimple/Plugin_PadSimple.vcproj index 09a88074df..30c56237eb 100644 --- a/Source/Plugins/Plugin_PadSimple/Plugin_PadSimple.vcproj +++ b/Source/Plugins/Plugin_PadSimple/Plugin_PadSimple.vcproj @@ -172,6 +172,7 @@ WarningLevel="3" WarnAsError="false" SuppressStartupBanner="true" + DebugInformationFormat="3" ForcedIncludeFiles="stdafx.h" />