diff --git a/Source/Core/Common/x64ABI.cpp b/Source/Core/Common/x64ABI.cpp index f51b760ced..2815ab8495 100644 --- a/Source/Core/Common/x64ABI.cpp +++ b/Source/Core/Common/x64ABI.cpp @@ -100,89 +100,34 @@ void XEmitter::ABI_CallFunction(const void *func) void XEmitter::ABI_CallFunctionC16(const void *func, u16 param1) { MOV(32, R(ABI_PARAM1), Imm32((u32)param1)); - u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL && - distance < 0xFFFFFFFF80000000ULL) - { - // Far call - MOV(64, R(RAX), Imm64((u64)func)); - CALLptr(R(RAX)); - } - else - { - CALL(func); - } + ABI_CallFunction(func); } void XEmitter::ABI_CallFunctionCC16(const void *func, u32 param1, u16 param2) { MOV(32, R(ABI_PARAM1), Imm32(param1)); MOV(32, R(ABI_PARAM2), Imm32((u32)param2)); - u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL && - distance < 0xFFFFFFFF80000000ULL) - { - // Far call - MOV(64, R(RAX), Imm64((u64)func)); - CALLptr(R(RAX)); - } - else - { - CALL(func); - } + ABI_CallFunction(func); } void XEmitter::ABI_CallFunctionC(const void *func, u32 param1) { MOV(32, R(ABI_PARAM1), Imm32(param1)); - u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL && - distance < 0xFFFFFFFF80000000ULL) - { - // Far call - MOV(64, R(RAX), Imm64((u64)func)); - CALLptr(R(RAX)); - } - else - { - CALL(func); - } + ABI_CallFunction(func); } void XEmitter::ABI_CallFunctionCC(const void *func, u32 param1, u32 param2) { MOV(32, R(ABI_PARAM1), Imm32(param1)); MOV(32, R(ABI_PARAM2), Imm32(param2)); - u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL && - distance < 0xFFFFFFFF80000000ULL) - { - // Far call - MOV(64, R(RAX), Imm64((u64)func)); - CALLptr(R(RAX)); - } - else - { - CALL(func); - } + ABI_CallFunction(func); } void XEmitter::ABI_CallFunctionCP(const void *func, u32 param1, void *param2) { MOV(32, R(ABI_PARAM1), Imm32(param1)); MOV(64, R(ABI_PARAM2), Imm64((u64)param2)); - u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL && - distance < 0xFFFFFFFF80000000ULL) - { - // Far call - MOV(64, R(RAX), Imm64((u64)func)); - CALLptr(R(RAX)); - } - else - { - CALL(func); - } + ABI_CallFunction(func); } void XEmitter::ABI_CallFunctionCCC(const void *func, u32 param1, u32 param2, u32 param3) @@ -190,18 +135,7 @@ void XEmitter::ABI_CallFunctionCCC(const void *func, u32 param1, u32 param2, u32 MOV(32, R(ABI_PARAM1), Imm32(param1)); MOV(32, R(ABI_PARAM2), Imm32(param2)); MOV(32, R(ABI_PARAM3), Imm32(param3)); - u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL && - distance < 0xFFFFFFFF80000000ULL) - { - // Far call - MOV(64, R(RAX), Imm64((u64)func)); - CALLptr(R(RAX)); - } - else - { - CALL(func); - } + ABI_CallFunction(func); } void XEmitter::ABI_CallFunctionCCP(const void *func, u32 param1, u32 param2, void *param3) @@ -209,18 +143,7 @@ void XEmitter::ABI_CallFunctionCCP(const void *func, u32 param1, u32 param2, voi MOV(32, R(ABI_PARAM1), Imm32(param1)); MOV(32, R(ABI_PARAM2), Imm32(param2)); MOV(64, R(ABI_PARAM3), Imm64((u64)param3)); - u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL && - distance < 0xFFFFFFFF80000000ULL) - { - // Far call - MOV(64, R(RAX), Imm64((u64)func)); - CALLptr(R(RAX)); - } - else - { - CALL(func); - } + ABI_CallFunction(func); } void XEmitter::ABI_CallFunctionCCCP(const void *func, u32 param1, u32 param2, u32 param3, void *param4) @@ -229,36 +152,14 @@ void XEmitter::ABI_CallFunctionCCCP(const void *func, u32 param1, u32 param2, u3 MOV(32, R(ABI_PARAM2), Imm32(param2)); MOV(32, R(ABI_PARAM3), Imm32(param3)); MOV(64, R(ABI_PARAM4), Imm64((u64)param4)); - u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL && - distance < 0xFFFFFFFF80000000ULL) - { - // Far call - MOV(64, R(RAX), Imm64((u64)func)); - CALLptr(R(RAX)); - } - else - { - CALL(func); - } + ABI_CallFunction(func); } void XEmitter::ABI_CallFunctionPC(const void *func, void *param1, u32 param2) { MOV(64, R(ABI_PARAM1), Imm64((u64)param1)); MOV(32, R(ABI_PARAM2), Imm32(param2)); - u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL && - distance < 0xFFFFFFFF80000000ULL) - { - // Far call - MOV(64, R(RAX), Imm64((u64)func)); - CALLptr(R(RAX)); - } - else - { - CALL(func); - } + ABI_CallFunction(func); } void XEmitter::ABI_CallFunctionPPC(const void *func, void *param1, void *param2, u32 param3) @@ -266,18 +167,7 @@ void XEmitter::ABI_CallFunctionPPC(const void *func, void *param1, void *param2, MOV(64, R(ABI_PARAM1), Imm64((u64)param1)); MOV(64, R(ABI_PARAM2), Imm64((u64)param2)); MOV(32, R(ABI_PARAM3), Imm32(param3)); - u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL && - distance < 0xFFFFFFFF80000000ULL) - { - // Far call - MOV(64, R(RAX), Imm64((u64)func)); - CALLptr(R(RAX)); - } - else - { - CALL(func); - } + ABI_CallFunction(func); } // Pass a register as a parameter. @@ -285,36 +175,14 @@ void XEmitter::ABI_CallFunctionR(const void *func, X64Reg reg1) { if (reg1 != ABI_PARAM1) MOV(32, R(ABI_PARAM1), R(reg1)); - u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL && - distance < 0xFFFFFFFF80000000ULL) - { - // Far call - MOV(64, R(RAX), Imm64((u64)func)); - CALLptr(R(RAX)); - } - else - { - CALL(func); - } + ABI_CallFunction(func); } // Pass two registers as parameters. void XEmitter::ABI_CallFunctionRR(const void *func, X64Reg reg1, X64Reg reg2) { MOVTwo(64, ABI_PARAM1, reg1, ABI_PARAM2, reg2); - u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL && - distance < 0xFFFFFFFF80000000ULL) - { - // Far call - MOV(64, R(RAX), Imm64((u64)func)); - CALLptr(R(RAX)); - } - else - { - CALL(func); - } + ABI_CallFunction(func); } void XEmitter::MOVTwo(int bits, Gen::X64Reg dst1, Gen::X64Reg src1, Gen::X64Reg dst2, Gen::X64Reg src2) @@ -344,35 +212,13 @@ void XEmitter::ABI_CallFunctionAC(const void *func, const Gen::OpArg &arg1, u32 if (!arg1.IsSimpleReg(ABI_PARAM1)) MOV(32, R(ABI_PARAM1), arg1); MOV(32, R(ABI_PARAM2), Imm32(param2)); - u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL && - distance < 0xFFFFFFFF80000000ULL) - { - // Far call - MOV(64, R(RAX), Imm64((u64)func)); - CALLptr(R(RAX)); - } - else - { - CALL(func); - } + ABI_CallFunction(func); } void XEmitter::ABI_CallFunctionA(const void *func, const Gen::OpArg &arg1) { if (!arg1.IsSimpleReg(ABI_PARAM1)) MOV(32, R(ABI_PARAM1), arg1); - u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL && - distance < 0xFFFFFFFF80000000ULL) - { - // Far call - MOV(64, R(RAX), Imm64((u64)func)); - CALLptr(R(RAX)); - } - else - { - CALL(func); - } + ABI_CallFunction(func); } diff --git a/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp b/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp index 7adb93d3b1..6e3799e387 100644 --- a/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp +++ b/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp @@ -83,7 +83,6 @@ void Jit64AsmRoutineManager::Generate() dispatcherNoCheck = GetCodePtr(); MOV(32, R(RSCRATCH), PPCSTATE(pc)); - dispatcherPcInRSCRATCH = GetCodePtr(); u32 mask = 0; FixupBranch no_mem; diff --git a/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.h b/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.h index c3f6a69b5c..d13859ff1f 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.h +++ b/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.h @@ -20,9 +20,7 @@ public: const u8 *dispatcherMispredictedBLR; const u8 *dispatcher; const u8 *dispatcherNoCheck; - const u8 *dispatcherPcInRSCRATCH; - const u8 *dispatchPcInRSCRATCH; const u8 *doTiming; const u8 *frsqrte; diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp index 69e7e1d381..1cfc9f0e27 100644 --- a/Source/Core/DolphinWX/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/MainNoGUI.cpp @@ -55,10 +55,10 @@ void Host_Message(int Id) } } -void* windowHandle; +static void* s_window_handle; void* Host_GetRenderHandle() { - return windowHandle; + return s_window_handle; } void Host_UpdateTitle(const std::string& title) @@ -157,7 +157,7 @@ class PlatformX11 : public Platform XSetWMProtocols(dpy, win, wmProtocols, 1); XMapRaised(dpy, win); XFlush(dpy); - windowHandle = (void *) win; + s_window_handle = (void*) win; if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver) X11Utils::InhibitScreensaver(dpy, win, true); diff --git a/Source/Core/VideoCommon/AVIDump.cpp b/Source/Core/VideoCommon/AVIDump.cpp index b0fc0da331..3a291c9353 100644 --- a/Source/Core/VideoCommon/AVIDump.cpp +++ b/Source/Core/VideoCommon/AVIDump.cpp @@ -51,7 +51,7 @@ static BITMAPINFOHEADER s_bitmap; // so we have to save a frame and always be behind static void* s_stored_frame = nullptr; static u64 s_stored_frame_size = 0; -bool b_start_dumping = false; +static bool s_start_dumping = false; bool AVIDump::Start(HWND hWnd, int w, int h) { @@ -171,7 +171,7 @@ void AVIDump::Stop() // store one copy of the last video frame, CFR case if (s_stream_compressed) AVIStreamWrite(s_stream_compressed, s_frame_count++, 1, GetFrame(), s_bitmap.biSizeImage, AVIIF_KEYFRAME, nullptr, &s_byte_buffer); - b_start_dumping = false; + s_start_dumping = false; CloseFile(); s_file_count = 0; NOTICE_LOG(VIDEO, "Stop"); @@ -228,10 +228,10 @@ void AVIDump::AddFrame(const u8* data, int w, int h) u64 one_cfr = SystemTimers::GetTicksPerSecond() / VideoInterface::TargetRefreshRate; int nplay = 0; s64 delta; - if (!b_start_dumping && s_last_frame <= SystemTimers::GetTicksPerSecond()) + if (!s_start_dumping && s_last_frame <= SystemTimers::GetTicksPerSecond()) { delta = CoreTiming::GetTicks(); - b_start_dumping = true; + s_start_dumping = true; } else { @@ -334,7 +334,7 @@ static int s_width; static int s_height; static int s_size; static u64 s_last_frame; -bool b_start_dumping = false; +static bool s_start_dumping = false; static u64 s_last_pts; static void InitAVCodec() @@ -446,11 +446,11 @@ void AVIDump::AddFrame(const u8* data, int width, int height) int error = 0; u64 delta; s64 last_pts; - if (!b_start_dumping && s_last_frame <= SystemTimers::GetTicksPerSecond()) + if (!s_start_dumping && s_last_frame <= SystemTimers::GetTicksPerSecond()) { delta = CoreTiming::GetTicks(); last_pts = AV_NOPTS_VALUE; - b_start_dumping = true; + s_start_dumping = true; } else {