From 886a8b1ac6d24c69980eecf14f0ef628466e3edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 5 Oct 2020 20:58:33 +0200 Subject: [PATCH 1/2] Remove Timer.cpp/h. Move various collections into Common/Data/Collections. --- CMakeLists.txt | 12 +- Common/Arm64Emitter.cpp | 2 +- Common/Common.vcxproj | 11 +- Common/Common.vcxproj.filters | 17 +- .../{ => Data/Collections}/FixedSizeQueue.h | 0 Common/{ => Data/Collections}/Hashmaps.h | 0 .../{ => Data/Collections}/ThreadSafeList.h | 0 Common/GPU/Vulkan/VulkanQueueRunner.h | 2 +- Common/LogManager.cpp | 4 +- Common/Math/math_util.h | 20 ++ Common/MathUtil.h | 30 --- Common/TimeUtil.cpp | 41 ++- Common/TimeUtil.h | 2 + Common/Timer.cpp | 252 ------------------ Common/Timer.h | 60 ----- Core/Core.vcxproj | 4 +- Core/Core.vcxproj.filters | 6 + Core/HLE/__sceAudio.cpp | 2 +- Core/HLE/sceAudio.cpp | 2 +- Core/HLE/sceGe.cpp | 2 +- Core/HW/StereoResampler.cpp | 2 +- {Common => Core}/ThreadPools.cpp | 0 {Common => Core}/ThreadPools.h | 0 GPU/Common/DrawEngineCommon.h | 2 +- GPU/Common/TextureScalerCommon.cpp | 2 +- GPU/Common/VertexDecoderCommon.h | 2 +- GPU/D3D11/DrawEngineD3D11.h | 2 +- GPU/D3D11/FramebufferManagerD3D11.cpp | 7 +- GPU/D3D11/TextureScalerD3D11.cpp | 2 +- GPU/Directx9/DrawEngineDX9.h | 2 +- GPU/Directx9/TextureScalerDX9.cpp | 2 +- GPU/GLES/DrawEngineGLES.h | 7 +- GPU/GLES/ShaderManagerGLES.h | 2 +- GPU/GLES/TextureScalerGLES.cpp | 2 +- GPU/Software/Rasterizer.cpp | 2 +- GPU/Vulkan/DrawEngineVulkan.h | 2 +- GPU/Vulkan/PipelineManagerVulkan.h | 2 +- GPU/Vulkan/ShaderManagerVulkan.h | 2 +- GPU/Vulkan/TextureCacheVulkan.h | 2 +- GPU/Vulkan/TextureScalerVulkan.cpp | 2 +- GPU/Vulkan/VulkanUtil.h | 2 +- UI/BackgroundAudio.cpp | 2 +- UWP/CommonUWP/CommonUWP.vcxproj | 34 ++- UWP/CommonUWP/CommonUWP.vcxproj.filters | 16 +- UWP/CoreUWP/CoreUWP.vcxproj | 2 + UWP/CoreUWP/CoreUWP.vcxproj.filters | 2 + Windows/XinputDevice.cpp | 14 +- android/jni/Android.mk | 3 +- libretro/Makefile.common | 5 +- 49 files changed, 151 insertions(+), 444 deletions(-) rename Common/{ => Data/Collections}/FixedSizeQueue.h (100%) rename Common/{ => Data/Collections}/Hashmaps.h (100%) rename Common/{ => Data/Collections}/ThreadSafeList.h (100%) delete mode 100644 Common/MathUtil.h delete mode 100644 Common/Timer.cpp delete mode 100644 Common/Timer.h rename {Common => Core}/ThreadPools.cpp (100%) rename {Common => Core}/ThreadPools.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index a62d384318f9..ce647f704097 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -439,7 +439,10 @@ add_library(Common STATIC Common/Crypto/sha256.cpp Common/Crypto/sha256.h Common/Data/Collections/ConstMap.h + Common/Data/Collections/FixedSizeQueue.h + Common/Data/Collections/Hashmaps.h Common/Data/Collections/TinySet.h + Common/Data/Collections/ThreadSafeList.h Common/Data/Color/RGBAUtil.cpp Common/Data/Color/RGBAUtil.h Common/Data/Convert/SmallDataConvert.cpp @@ -611,10 +614,8 @@ add_library(Common STATIC Common/ConsoleListener.h Common/DbgNew.h Common/FakeEmitter.h - Common/FixedSizeQueue.h Common/ExceptionHandlerSetup.cpp Common/ExceptionHandlerSetup.h - Common/Hashmaps.h Common/Log.h Common/Log.cpp Common/LogManager.cpp @@ -633,11 +634,6 @@ add_library(Common STATIC Common/StringUtils.h Common/SysError.h Common/SysError.cpp - Common/ThreadPools.cpp - Common/ThreadPools.h - Common/ThreadSafeList.h - Common/Timer.cpp - Common/Timer.h Common/TimeUtil.cpp Common/TimeUtil.h ) @@ -1775,6 +1771,8 @@ add_library(${CoreLibName} ${CoreLinkType} Core/System.h Core/TextureReplacer.cpp Core/TextureReplacer.h + Core/ThreadPools.cpp + Core/ThreadPools.h Core/Util/AudioFormat.cpp Core/Util/AudioFormat.h Core/Util/AudioFormatNEON.cpp diff --git a/Common/Arm64Emitter.cpp b/Common/Arm64Emitter.cpp index 7578dff4f739..467dd6d8eea6 100644 --- a/Common/Arm64Emitter.cpp +++ b/Common/Arm64Emitter.cpp @@ -13,7 +13,7 @@ #include #include "Common/Arm64Emitter.h" -#include "Common/MathUtil.h" +#include "Common/Math/math_util.h" #include "Common/CommonTypes.h" #include "Common/CommonWindows.h" #include "Common/CPUDetect.h" diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj index 7e5dc35f0a8c..0bb5e7ef50ec 100644 --- a/Common/Common.vcxproj +++ b/Common/Common.vcxproj @@ -384,6 +384,9 @@ + + + @@ -479,7 +482,6 @@ - true @@ -502,12 +504,10 @@ true - - @@ -519,14 +519,11 @@ - - - @@ -836,13 +833,11 @@ - - diff --git a/Common/Common.vcxproj.filters b/Common/Common.vcxproj.filters index 10c28d065c35..5cc115137535 100644 --- a/Common/Common.vcxproj.filters +++ b/Common/Common.vcxproj.filters @@ -7,18 +7,15 @@ - - - Crypto @@ -33,12 +30,10 @@ - - GL\GLInterface @@ -51,7 +46,6 @@ - @@ -372,6 +366,15 @@ Render\Text + + Data\Collections + + + Data\Collections + + + Data\Collections + @@ -381,12 +384,10 @@ - - Crypto diff --git a/Common/FixedSizeQueue.h b/Common/Data/Collections/FixedSizeQueue.h similarity index 100% rename from Common/FixedSizeQueue.h rename to Common/Data/Collections/FixedSizeQueue.h diff --git a/Common/Hashmaps.h b/Common/Data/Collections/Hashmaps.h similarity index 100% rename from Common/Hashmaps.h rename to Common/Data/Collections/Hashmaps.h diff --git a/Common/ThreadSafeList.h b/Common/Data/Collections/ThreadSafeList.h similarity index 100% rename from Common/ThreadSafeList.h rename to Common/Data/Collections/ThreadSafeList.h diff --git a/Common/GPU/Vulkan/VulkanQueueRunner.h b/Common/GPU/Vulkan/VulkanQueueRunner.h index 6c8f12cdc3c1..ada7cc49e214 100644 --- a/Common/GPU/Vulkan/VulkanQueueRunner.h +++ b/Common/GPU/Vulkan/VulkanQueueRunner.h @@ -2,7 +2,7 @@ #include -#include "Common/Hashmaps.h" +#include "Common/Data/Collections/Hashmaps.h" #include "Common/GPU/Vulkan/VulkanContext.h" #include "Common/Data/Convert/SmallDataConvert.h" #include "Common/Data/Collections/TinySet.h" diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp index 1ecea857e85a..d518df7a99ae 100644 --- a/Common/LogManager.cpp +++ b/Common/LogManager.cpp @@ -24,7 +24,7 @@ #include "Common/LogManager.h" #include "Common/ConsoleListener.h" -#include "Common/Timer.h" +#include "Common/TimeUtil.h" #include "Common/File/FileUtil.h" #include "Common/StringUtils.h" @@ -220,7 +220,7 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const } std::lock_guard lk(log_lock_); - Common::Timer::GetTimeFormatted(message.timestamp); + GetTimeFormatted(message.timestamp); if (hleCurrentThreadName) { snprintf(message.header, sizeof(message.header), "%-12.12s %c[%s]: %s:%d", diff --git a/Common/Math/math_util.h b/Common/Math/math_util.h index 0cf1101321b8..0807d47003b1 100644 --- a/Common/Math/math_util.h +++ b/Common/Math/math_util.h @@ -62,6 +62,26 @@ inline T clamp_value(T val, T floor, T cap) { return val; } +#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1)) +#define ROUND_DOWN(x, a) ((x) & ~((a) - 1)) + +template +inline void Clamp(T* val, const T& min, const T& max) +{ + if (*val < min) + *val = min; + else if (*val > max) + *val = max; +} + +template +inline T Clamp(const T val, const T& min, const T& max) +{ + T ret = val; + Clamp(&ret, min, max); + return ret; +} + union FP32 { uint32_t u; float f; diff --git a/Common/MathUtil.h b/Common/MathUtil.h deleted file mode 100644 index d56d5c19e56e..000000000000 --- a/Common/MathUtil.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2013 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -namespace MathUtil -{ - -#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1)) -#define ROUND_DOWN(x, a) ((x) & ~((a) - 1)) - -template -inline void Clamp(T* val, const T& min, const T& max) -{ - if (*val < min) - *val = min; - else if (*val > max) - *val = max; -} - -template -inline T Clamp(const T val, const T& min, const T& max) -{ - T ret = val; - Clamp(&ret, min, max); - return ret; -} - -} \ No newline at end of file diff --git a/Common/TimeUtil.cpp b/Common/TimeUtil.cpp index 106f761b742e..2cb375c9a05c 100644 --- a/Common/TimeUtil.cpp +++ b/Common/TimeUtil.cpp @@ -1,21 +1,24 @@ #include #include +#include + +#include "ppsspp_config.h" #include "Common/TimeUtil.h" +#ifdef HAVE_LIBNX +#include +#endif // HAVE_LIBNX + #ifdef _WIN32 -#include +#include "CommonWindows.h" +#include +#include #else #include #include #endif -#ifdef HAVE_LIBNX -#include -#endif // HAVE_LIBNX - -#include "Common/Log.h" - static double curtime = 0; #ifdef _WIN32 @@ -64,3 +67,27 @@ void sleep_ms(int ms) { usleep(ms * 1000); #endif } + +// Return the current time formatted as Minutes:Seconds:Milliseconds +// in the form 00:00:000. +void GetTimeFormatted(char formattedTime[13]) { + time_t sysTime; + struct tm * gmTime; + char tmp[13]; + + time(&sysTime); + gmTime = localtime(&sysTime); + + strftime(tmp, 6, "%M:%S", gmTime); + + // Now tack on the milliseconds +#ifdef _WIN32 + struct timeb tp; + (void)::ftime(&tp); + snprintf(formattedTime, 13, "%s:%03i", tmp, tp.millitm); +#else + struct timeval t; + (void)gettimeofday(&t, NULL); + snprintf(formattedTime, 13, "%s:%03d", tmp, (int)(t.tv_usec / 1000)); +#endif +} diff --git a/Common/TimeUtil.h b/Common/TimeUtil.h index c19e98f5ad79..8d7273c466e2 100644 --- a/Common/TimeUtil.h +++ b/Common/TimeUtil.h @@ -5,3 +5,5 @@ double time_now_d(); // Sleep. Does not necessarily have millisecond granularity, especially on Windows. void sleep_ms(int ms); + +void GetTimeFormatted(char formattedTime[13]); diff --git a/Common/Timer.cpp b/Common/Timer.cpp deleted file mode 100644 index 9c34ee151a35..000000000000 --- a/Common/Timer.cpp +++ /dev/null @@ -1,252 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0 or later versions. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#include - -#include "ppsspp_config.h" - -#ifdef _WIN32 -#include "CommonWindows.h" -#include -#include -#else -#include -#endif - -#include "Timer.h" -#include "StringUtils.h" - -namespace Common -{ - -u32 Timer::GetTimeMs() -{ -#if defined(_WIN32) -#if PPSSPP_PLATFORM(UWP) - return (u32)GetTickCount64(); -#else - return timeGetTime(); -#endif -#else - // REALTIME is probably not a good idea for measuring updates. - struct timeval t; - (void)gettimeofday(&t, NULL); - return ((u32)(t.tv_sec * 1000 + t.tv_usec / 1000)); -#endif -} - -// -------------------------------------------- -// Initiate, Start, Stop, and Update the time -// -------------------------------------------- - -// Set initial values for the class -Timer::Timer() - : m_LastTime(0), m_StartTime(0), m_Running(false) -{ - Update(); - -#ifdef _WIN32 - QueryPerformanceFrequency((LARGE_INTEGER*)&m_frequency); -#endif -} - -// Write the starting time -void Timer::Start() -{ - m_StartTime = GetTimeMs(); - m_Running = true; -} - -// Stop the timer -void Timer::Stop() -{ - // Write the final time - m_LastTime = GetTimeMs(); - m_Running = false; -} - -// Update the last time variable -void Timer::Update() -{ - m_LastTime = GetTimeMs(); - //TODO(ector) - QPF -} - -// ------------------------------------- -// Get time difference and elapsed time -// ------------------------------------- - -// Get the number of milliseconds since the last Update() -u64 Timer::GetTimeDifference() const -{ - return GetTimeMs() - m_LastTime; -} - -// Add the time difference since the last Update() to the starting time. -// This is used to compensate for a paused game. -void Timer::AddTimeDifference() -{ - m_StartTime += GetTimeDifference(); -} - -// Wind back the starting time to a custom time -void Timer::WindBackStartingTime(u64 WindBack) -{ - m_StartTime += WindBack; -} - -// Get the time elapsed since the Start() -u64 Timer::GetTimeElapsed() const -{ - // If we have not started yet, return 1 (because then I don't - // have to change the FPS calculation in CoreRerecording.cpp . - if (m_StartTime == 0) return 1; - - // Return the final timer time if the timer is stopped - if (!m_Running) return (m_LastTime - m_StartTime); - - return (GetTimeMs() - m_StartTime); -} - -// Get the formatted time elapsed since the Start() -std::string Timer::GetTimeElapsedFormatted() const -{ - // If we have not started yet, return zero - if (m_StartTime == 0) - return "00:00:00:000"; - - // The number of milliseconds since the start. - // Use a different value if the timer is stopped. - u64 Milliseconds; - if (m_Running) - Milliseconds = GetTimeMs() - m_StartTime; - else - Milliseconds = m_LastTime - m_StartTime; - // Seconds - u32 Seconds = (u32)(Milliseconds / 1000); - // Minutes - u32 Minutes = Seconds / 60; - // Hours - u32 Hours = Minutes / 60; - - std::string TmpStr = StringFromFormat("%02d:%02d:%02d:%03d", - Hours, Minutes % 60, Seconds % 60, Milliseconds % 1000); - return TmpStr; -} - -// Get current time -void Timer::IncreaseResolution() -{ -#if defined(USING_WIN_UI) - timeBeginPeriod(1); -#endif -} - -void Timer::RestoreResolution() -{ -#if defined(USING_WIN_UI) - timeEndPeriod(1); -#endif -} - -// Get the number of seconds since January 1 1970 -u64 Timer::GetTimeSinceJan1970() -{ - time_t ltime; - time(<ime); - return((u64)ltime); -} - -u64 Timer::GetLocalTimeSinceJan1970() -{ - time_t sysTime, tzDiff, tzDST; - struct tm * gmTime; - - time(&sysTime); - - // Account for DST where needed - gmTime = localtime(&sysTime); - if(gmTime->tm_isdst == 1) - tzDST = 3600; - else - tzDST = 0; - - // Lazy way to get local time in sec - gmTime = gmtime(&sysTime); - tzDiff = sysTime - mktime(gmTime); - - return (u64)(sysTime + tzDiff + tzDST); -} - -// Return the current time formatted as Minutes:Seconds:Milliseconds -// in the form 00:00:000. -void Timer::GetTimeFormatted(char formattedTime[13]) -{ - time_t sysTime; - struct tm * gmTime; - char tmp[13]; - - time(&sysTime); - gmTime = localtime(&sysTime); - - strftime(tmp, 6, "%M:%S", gmTime); - - // Now tack on the milliseconds -#ifdef _WIN32 - struct timeb tp; - (void)::ftime(&tp); - snprintf(formattedTime, 13, "%s:%03i", tmp, tp.millitm); -#else - struct timeval t; - (void)gettimeofday(&t, NULL); - snprintf(formattedTime, 13, "%s:%03d", tmp, (int)(t.tv_usec / 1000)); -#endif -} - -// Returns a timestamp with decimals for precise time comparisons -// ---------------- -double Timer::GetDoubleTime() -{ -#ifdef _WIN32 - struct timeb tp; - (void)::ftime(&tp); -#else - struct timeval t; - (void)gettimeofday(&t, NULL); -#endif - // Get continuous timestamp - u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970(); - - // Remove a few years. We only really want enough seconds to make - // sure that we are detecting actual actions, perhaps 60 seconds is - // enough really, but I leave a year of seconds anyway, in case the - // user's clock is incorrect or something like that. - TmpSeconds = TmpSeconds - (38 * 365 * 24 * 60 * 60); - - // Make a smaller integer that fits in the double - u32 Seconds = (u32)TmpSeconds; -#ifdef _WIN32 - double ms = tp.millitm / 1000.0 / 1000.0; -#else - double ms = t.tv_usec / 1000000.0; -#endif - double TmpTime = Seconds + ms; - - return TmpTime; -} - -} // Namespace Common diff --git a/Common/Timer.h b/Common/Timer.h deleted file mode 100644 index 8d775b842381..000000000000 --- a/Common/Timer.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0 or later versions. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#pragma once - -#include "Common.h" -#include - -namespace Common -{ -class Timer -{ -public: - Timer(); - - void Start(); - void Stop(); - void Update(); - - // The time difference is always returned in milliseconds, regardless of alternative internal representation - u64 GetTimeDifference() const; - void AddTimeDifference(); - void WindBackStartingTime(u64 WindBack); - - static void IncreaseResolution(); - static void RestoreResolution(); - static u64 GetTimeSinceJan1970(); - static u64 GetLocalTimeSinceJan1970(); - static double GetDoubleTime(); - - static void GetTimeFormatted(char formattedTime[13]); - std::string GetTimeElapsedFormatted() const; - u64 GetTimeElapsed() const; - - static u32 GetTimeMs(); - -private: - u64 m_LastTime; - u64 m_StartTime; -#ifdef _WIN32 - u64 m_frequency; -#endif - bool m_Running; -}; - -} // Namespace Common diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index e23beab5058f..e91c514383a6 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -898,6 +898,7 @@ + true @@ -1245,6 +1246,7 @@ + true @@ -1298,4 +1300,4 @@ - + \ No newline at end of file diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index f59875b48cd9..76fac1fe8871 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -962,6 +962,9 @@ Core + + Core + @@ -1643,6 +1646,9 @@ Core + + Core + diff --git a/Core/HLE/__sceAudio.cpp b/Core/HLE/__sceAudio.cpp index 57ef29281d18..1f722d11d1b6 100644 --- a/Core/HLE/__sceAudio.cpp +++ b/Core/HLE/__sceAudio.cpp @@ -21,7 +21,7 @@ #include "Common/CommonTypes.h" #include "Common/Serialize/Serializer.h" #include "Common/Serialize/SerializeFuncs.h" -#include "Common/FixedSizeQueue.h" +#include "Common/Data/Collections/FixedSizeQueue.h" #ifdef _M_SSE #include diff --git a/Core/HLE/sceAudio.cpp b/Core/HLE/sceAudio.cpp index 76f97e9a20c0..aa247385d491 100644 --- a/Core/HLE/sceAudio.cpp +++ b/Core/HLE/sceAudio.cpp @@ -17,7 +17,7 @@ #include "Common/Serialize/Serializer.h" #include "Common/Serialize/SerializeFuncs.h" -#include "Common/FixedSizeQueue.h" +#include "Common/Data/Collections/FixedSizeQueue.h" #include "Core/MIPS/MIPS.h" #include "Core/Host.h" #include "Core/CoreTiming.h" diff --git a/Core/HLE/sceGe.cpp b/Core/HLE/sceGe.cpp index 0cdae03b8a32..8c27ed16c62b 100644 --- a/Core/HLE/sceGe.cpp +++ b/Core/HLE/sceGe.cpp @@ -23,7 +23,7 @@ #include "Common/Serialize/SerializeFuncs.h" #include "Common/Serialize/SerializeList.h" #include "Common/Serialize/SerializeMap.h" -#include "Common/ThreadSafeList.h" +#include "Common/Data/Collections/ThreadSafeList.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MIPS/MIPS.h" diff --git a/Core/HW/StereoResampler.cpp b/Core/HW/StereoResampler.cpp index 898f21b48c8f..8e7f22833d45 100644 --- a/Core/HW/StereoResampler.cpp +++ b/Core/HW/StereoResampler.cpp @@ -36,7 +36,7 @@ #include #include "Common/System/System.h" -#include "Common/MathUtil.h" +#include "Common/Math/math_util.h" #include "Common/Serialize/Serializer.h" #include "Common/Log.h" #include "Common/TimeUtil.h" diff --git a/Common/ThreadPools.cpp b/Core/ThreadPools.cpp similarity index 100% rename from Common/ThreadPools.cpp rename to Core/ThreadPools.cpp diff --git a/Common/ThreadPools.h b/Core/ThreadPools.h similarity index 100% rename from Common/ThreadPools.h rename to Core/ThreadPools.h diff --git a/GPU/Common/DrawEngineCommon.h b/GPU/Common/DrawEngineCommon.h index bf2f3968e44b..f53b96f4877c 100644 --- a/GPU/Common/DrawEngineCommon.h +++ b/GPU/Common/DrawEngineCommon.h @@ -20,7 +20,7 @@ #include #include "Common/CommonTypes.h" -#include "Common/Hashmaps.h" +#include "Common/Data/Collections/Hashmaps.h" #include "GPU/GPUState.h" #include "GPU/Common/GPUDebugInterface.h" diff --git a/GPU/Common/TextureScalerCommon.cpp b/GPU/Common/TextureScalerCommon.cpp index 3214b42306fd..64a3d7dd9602 100644 --- a/GPU/Common/TextureScalerCommon.cpp +++ b/GPU/Common/TextureScalerCommon.cpp @@ -26,7 +26,7 @@ #include "Common/Common.h" #include "Common/Log.h" #include "Common/CommonFuncs.h" -#include "Common/ThreadPools.h" +#include "Core/ThreadPools.h" #include "Common/CPUDetect.h" #include "ext/xbrz/xbrz.h" diff --git a/GPU/Common/VertexDecoderCommon.h b/GPU/Common/VertexDecoderCommon.h index 0d451465b86d..6013b1a35617 100644 --- a/GPU/Common/VertexDecoderCommon.h +++ b/GPU/Common/VertexDecoderCommon.h @@ -22,7 +22,7 @@ #include "ppsspp_config.h" #include "Common/Common.h" -#include "Common/Hashmaps.h" +#include "Common/Data/Collections/Hashmaps.h" #include "Common/Log.h" #include "Core/Reporting.h" #include "GPU/ge_constants.h" diff --git a/GPU/D3D11/DrawEngineD3D11.h b/GPU/D3D11/DrawEngineD3D11.h index 88d27c6bc1cf..fbc94f2d7ac8 100644 --- a/GPU/D3D11/DrawEngineD3D11.h +++ b/GPU/D3D11/DrawEngineD3D11.h @@ -21,7 +21,7 @@ #include #include -#include "Common/Hashmaps.h" +#include "Common/Data/Collections/Hashmaps.h" #include "GPU/GPUState.h" #include "GPU/Common/GPUDebugInterface.h" #include "GPU/Common/IndexGenerator.h" diff --git a/GPU/D3D11/FramebufferManagerD3D11.cpp b/GPU/D3D11/FramebufferManagerD3D11.cpp index 792f11f79e2e..437fe4922c40 100644 --- a/GPU/D3D11/FramebufferManagerD3D11.cpp +++ b/GPU/D3D11/FramebufferManagerD3D11.cpp @@ -19,13 +19,13 @@ #include #include +#include "Common/Common.h" #include "Common/System/Display.h" #include "Common/Math/lin/matrix4x4.h" +#include "Common/Math/math_util.h" #include "Common/GPU/thin3d.h" - -#include "Common/Common.h" #include "Common/ColorConv.h" -#include "Common/MathUtil.h" + #include "Core/MemMap.h" #include "Core/Config.h" #include "Core/ConfigValues.h" @@ -34,7 +34,6 @@ #include "GPU/ge_constants.h" #include "GPU/GPUState.h" #include "GPU/Debugger/Stepping.h" - #include "GPU/Common/FramebufferManagerCommon.h" #include "GPU/Common/PresentationCommon.h" #include "GPU/Common/ShaderTranslation.h" diff --git a/GPU/D3D11/TextureScalerD3D11.cpp b/GPU/D3D11/TextureScalerD3D11.cpp index 32c06c45ee56..17dcfa3c25e4 100644 --- a/GPU/D3D11/TextureScalerD3D11.cpp +++ b/GPU/D3D11/TextureScalerD3D11.cpp @@ -19,7 +19,7 @@ #include #include "Common/ColorConv.h" -#include "Common/ThreadPools.h" +#include "Core/ThreadPools.h" #include "GPU/Common/TextureScalerCommon.h" #include "GPU/D3D11/TextureScalerD3D11.h" #include "GPU/D3D11/GPU_D3D11.h" diff --git a/GPU/Directx9/DrawEngineDX9.h b/GPU/Directx9/DrawEngineDX9.h index 22cb6a7a4e2e..3ddf99b79b29 100644 --- a/GPU/Directx9/DrawEngineDX9.h +++ b/GPU/Directx9/DrawEngineDX9.h @@ -19,7 +19,7 @@ #include -#include "Common/Hashmaps.h" +#include "Common/Data/Collections/Hashmaps.h" #include "GPU/GPUState.h" #include "GPU/Common/GPUDebugInterface.h" #include "GPU/Common/IndexGenerator.h" diff --git a/GPU/Directx9/TextureScalerDX9.cpp b/GPU/Directx9/TextureScalerDX9.cpp index bbf732a08d0e..4508358d7e90 100644 --- a/GPU/Directx9/TextureScalerDX9.cpp +++ b/GPU/Directx9/TextureScalerDX9.cpp @@ -19,7 +19,7 @@ #include "Common/Common.h" #include "Common/ColorConv.h" -#include "Common/ThreadPools.h" +#include "Core/ThreadPools.h" #include "GPU/Common/TextureScalerCommon.h" #include "GPU/Directx9/TextureScalerDX9.h" #include "GPU/Directx9/GPU_DX9.h" diff --git a/GPU/GLES/DrawEngineGLES.h b/GPU/GLES/DrawEngineGLES.h index 6c96072185ec..929154347853 100644 --- a/GPU/GLES/DrawEngineGLES.h +++ b/GPU/GLES/DrawEngineGLES.h @@ -17,8 +17,9 @@ #pragma once -#include -#include +#include "Common/Data/Collections/Hashmaps.h" +#include "Common/GPU/OpenGL/GLCommon.h" +#include "Common/GPU/OpenGL/GLRenderManager.h" #include "GPU/GPUState.h" #include "GPU/Common/GPUDebugInterface.h" @@ -27,8 +28,6 @@ #include "GPU/Common/DrawEngineCommon.h" #include "GPU/Common/GPUStateUtils.h" #include "GPU/GLES/FragmentShaderGeneratorGLES.h" -#include "Common/GPU/OpenGL/GLCommon.h" -#include "Common/GPU/OpenGL/GLRenderManager.h" class LinkedShader; class ShaderManagerGLES; diff --git a/GPU/GLES/ShaderManagerGLES.h b/GPU/GLES/ShaderManagerGLES.h index a084edff1c91..613fab8eaf79 100644 --- a/GPU/GLES/ShaderManagerGLES.h +++ b/GPU/GLES/ShaderManagerGLES.h @@ -19,7 +19,7 @@ #include -#include "Common/Hashmaps.h" +#include "Common/Data/Collections/Hashmaps.h" #include "Common/GPU/OpenGL/GLRenderManager.h" #include "GPU/Common/ShaderCommon.h" #include "GPU/Common/ShaderId.h" diff --git a/GPU/GLES/TextureScalerGLES.cpp b/GPU/GLES/TextureScalerGLES.cpp index d268fe92e152..2a22d8b17814 100644 --- a/GPU/GLES/TextureScalerGLES.cpp +++ b/GPU/GLES/TextureScalerGLES.cpp @@ -22,7 +22,7 @@ #include "GPU/GLES/TextureScalerGLES.h" #include "Common/ColorConv.h" #include "Common/Log.h" -#include "Common/ThreadPools.h" +#include "Core/ThreadPools.h" #include "Common/GPU/DataFormat.h" int TextureScalerGLES::BytesPerPixel(u32 format) { diff --git a/GPU/Software/Rasterizer.cpp b/GPU/Software/Rasterizer.cpp index 7bfc9b190f13..feaeca1e89de 100644 --- a/GPU/Software/Rasterizer.cpp +++ b/GPU/Software/Rasterizer.cpp @@ -20,7 +20,7 @@ #include "Common/Profiler/Profiler.h" -#include "Common/ThreadPools.h" +#include "Core/ThreadPools.h" #include "Common/ColorConv.h" #include "Core/Config.h" #include "Core/MemMap.h" diff --git a/GPU/Vulkan/DrawEngineVulkan.h b/GPU/Vulkan/DrawEngineVulkan.h index 4b807315d0e9..3f46a62186cf 100644 --- a/GPU/Vulkan/DrawEngineVulkan.h +++ b/GPU/Vulkan/DrawEngineVulkan.h @@ -31,7 +31,7 @@ // The format of the various uniform buffers may vary though - vertex shaders that don't skin // won't get any bone data, etc. -#include "Common/Hashmaps.h" +#include "Common/Data/Collections/Hashmaps.h" #include "GPU/Vulkan/VulkanUtil.h" diff --git a/GPU/Vulkan/PipelineManagerVulkan.h b/GPU/Vulkan/PipelineManagerVulkan.h index 0cdb4a855a64..d7d47fd0efff 100644 --- a/GPU/Vulkan/PipelineManagerVulkan.h +++ b/GPU/Vulkan/PipelineManagerVulkan.h @@ -18,7 +18,7 @@ #pragma once #include -#include "Common/Hashmaps.h" +#include "Common/Data/Collections/Hashmaps.h" #include "GPU/Common/VertexDecoderCommon.h" #include "GPU/Common/ShaderId.h" diff --git a/GPU/Vulkan/ShaderManagerVulkan.h b/GPU/Vulkan/ShaderManagerVulkan.h index 016de933c6fc..92a52594ff94 100644 --- a/GPU/Vulkan/ShaderManagerVulkan.h +++ b/GPU/Vulkan/ShaderManagerVulkan.h @@ -20,7 +20,7 @@ #include #include -#include "Common/Hashmaps.h" +#include "Common/Data/Collections/Hashmaps.h" #include "Common/GPU/Vulkan/VulkanMemory.h" #include "GPU/Common/ShaderCommon.h" #include "GPU/Common/ShaderId.h" diff --git a/GPU/Vulkan/TextureCacheVulkan.h b/GPU/Vulkan/TextureCacheVulkan.h index 7c6c8f8946e4..a61ba47d20fe 100644 --- a/GPU/Vulkan/TextureCacheVulkan.h +++ b/GPU/Vulkan/TextureCacheVulkan.h @@ -19,7 +19,7 @@ #include -#include "Common/Hashmaps.h" +#include "Common/Data/Collections/Hashmaps.h" #include "GPU/GPUInterface.h" #include "GPU/GPUState.h" #include "Common/GPU/Vulkan/VulkanContext.h" diff --git a/GPU/Vulkan/TextureScalerVulkan.cpp b/GPU/Vulkan/TextureScalerVulkan.cpp index 28e6d4bc60a7..66720c0f360f 100644 --- a/GPU/Vulkan/TextureScalerVulkan.cpp +++ b/GPU/Vulkan/TextureScalerVulkan.cpp @@ -21,7 +21,7 @@ #include "Common/GPU/Vulkan/VulkanContext.h" #include "Common/ColorConv.h" #include "Common/Log.h" -#include "Common/ThreadPools.h" +#include "Core/ThreadPools.h" #include "GPU/Common/TextureScalerCommon.h" #include "GPU/Vulkan/TextureScalerVulkan.h" diff --git a/GPU/Vulkan/VulkanUtil.h b/GPU/Vulkan/VulkanUtil.h index 752ea8d754c5..8e837df544e6 100644 --- a/GPU/Vulkan/VulkanUtil.h +++ b/GPU/Vulkan/VulkanUtil.h @@ -20,7 +20,7 @@ #include #include -#include "Common/Hashmaps.h" +#include "Common/Data/Collections/Hashmaps.h" #include "Common/GPU/Vulkan/VulkanContext.h" #include "Common/GPU/Vulkan/VulkanLoader.h" #include "Common/GPU/Vulkan/VulkanImage.h" diff --git a/UI/BackgroundAudio.cpp b/UI/BackgroundAudio.cpp index 272fb706dc65..ba03df8ca29f 100644 --- a/UI/BackgroundAudio.cpp +++ b/UI/BackgroundAudio.cpp @@ -9,7 +9,7 @@ #include "Common/Log.h" #include "Common/Serialize/SerializeFuncs.h" #include "Common/TimeUtil.h" -#include "Common/FixedSizeQueue.h" +#include "Common/Data/Collections/FixedSizeQueue.h" #include "Core/HW/SimpleAudioDec.h" #include "Core/HLE/__sceAudio.h" #include "GameInfoCache.h" diff --git a/UWP/CommonUWP/CommonUWP.vcxproj b/UWP/CommonUWP/CommonUWP.vcxproj index f1ad520e499b..e8d56b3ab6cf 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj +++ b/UWP/CommonUWP/CommonUWP.vcxproj @@ -204,7 +204,7 @@ true pch.h ../..;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - NOMINMAX;_UNICODE;UNICODE;%(PreprocessorDefinitions) + NOMINMAX;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) NotUsing @@ -218,7 +218,7 @@ false true ../..;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - NOMINMAX;_UNICODE;UNICODE;%(PreprocessorDefinitions) + NOMINMAX;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) pch.h NotUsing @@ -233,7 +233,7 @@ false true ../..;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - NOMINMAX;_UNICODE;UNICODE;%(PreprocessorDefinitions) + NOMINMAX;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) pch.h NotUsing @@ -249,7 +249,7 @@ true pch.h ../..;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - NOMINMAX;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + NOMINMAX;_CRT_SECURE_NO_WARNINGS;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) NotUsing @@ -264,7 +264,7 @@ true pch.h ../..;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - NOMINMAX;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + NOMINMAX;_CRT_SECURE_NO_WARNINGS;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) NotUsing @@ -278,7 +278,7 @@ false true ../..;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - NOMINMAX;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + NOMINMAX;_CRT_SECURE_NO_WARNINGS;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) pch.h NotUsing @@ -293,7 +293,7 @@ false true ../..;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - NOMINMAX;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + NOMINMAX;_CRT_SECURE_NO_WARNINGS;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) pch.h NotUsing @@ -308,7 +308,7 @@ false true ../..;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - NOMINMAX;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + NOMINMAX;_CRT_SECURE_NO_WARNINGS;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) pch.h NotUsing @@ -323,7 +323,7 @@ false true ../..;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - NOMINMAX;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + NOMINMAX;_CRT_SECURE_NO_WARNINGS;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) pch.h NotUsing @@ -339,7 +339,7 @@ true pch.h ../..;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - NOMINMAX;_UNICODE;UNICODE;%(PreprocessorDefinitions) + NOMINMAX;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) NotUsing @@ -353,7 +353,7 @@ false true ../..;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - NOMINMAX;_UNICODE;UNICODE;%(PreprocessorDefinitions) + NOMINMAX;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) pch.h NotUsing @@ -368,7 +368,7 @@ false true ../..;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - NOMINMAX;_UNICODE;UNICODE;%(PreprocessorDefinitions) + NOMINMAX;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) pch.h NotUsing @@ -387,6 +387,9 @@ + + + @@ -464,11 +467,9 @@ - - @@ -479,14 +480,11 @@ - - - @@ -586,13 +584,11 @@ - - diff --git a/UWP/CommonUWP/CommonUWP.vcxproj.filters b/UWP/CommonUWP/CommonUWP.vcxproj.filters index 071580a8711f..7576f5735fb9 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj.filters +++ b/UWP/CommonUWP/CommonUWP.vcxproj.filters @@ -109,9 +109,7 @@ - - @@ -386,11 +384,9 @@ - - @@ -398,10 +394,7 @@ - - - @@ -660,6 +653,15 @@ Render\Text + + Data\Collections + + + Data\Collections + + + Data\Collections + diff --git a/UWP/CoreUWP/CoreUWP.vcxproj b/UWP/CoreUWP/CoreUWP.vcxproj index 1ee0d6c4b8ab..2e46086a0b93 100644 --- a/UWP/CoreUWP/CoreUWP.vcxproj +++ b/UWP/CoreUWP/CoreUWP.vcxproj @@ -568,6 +568,7 @@ + @@ -820,6 +821,7 @@ + diff --git a/UWP/CoreUWP/CoreUWP.vcxproj.filters b/UWP/CoreUWP/CoreUWP.vcxproj.filters index 11ff8c7a08f9..ea66a385985a 100644 --- a/UWP/CoreUWP/CoreUWP.vcxproj.filters +++ b/UWP/CoreUWP/CoreUWP.vcxproj.filters @@ -911,6 +911,7 @@ Ext\libzip + @@ -1542,6 +1543,7 @@ Ext\libzip + diff --git a/Windows/XinputDevice.cpp b/Windows/XinputDevice.cpp index 4d12aa827c14..f3f0ef32ce7b 100644 --- a/Windows/XinputDevice.cpp +++ b/Windows/XinputDevice.cpp @@ -7,15 +7,15 @@ #include "Core/Config.h" #include "Common/CommonWindows.h" #include "Common/Log.h" +#include "Common/TimeUtil.h" #include "Common/Input/InputState.h" #include "Common/Input/KeyCodes.h" #include "XinputDevice.h" #include "Core/Core.h" #include "Core/KeyMap.h" #include "Core/HLE/sceCtrl.h" -#include "Common/Timer.h" -static int newVibrationTime = 0; +static double newVibrationTime = 0.0; // Utilities to dynamically load XInput. Adapted from SDL. @@ -24,8 +24,8 @@ static int newVibrationTime = 0; typedef DWORD (WINAPI *XInputGetState_t) (DWORD dwUserIndex, XINPUT_STATE* pState); typedef DWORD (WINAPI *XInputSetState_t) (DWORD dwUserIndex, XINPUT_VIBRATION* pVibration); -static XInputGetState_t PPSSPP_XInputGetState = NULL; -static XInputSetState_t PPSSPP_XInputSetState = NULL; +static XInputGetState_t PPSSPP_XInputGetState = nullptr; +static XInputSetState_t PPSSPP_XInputSetState = nullptr; static DWORD PPSSPP_XInputVersion = 0; static HMODULE s_pXInputDLL = 0; static int s_XInputDLLRefCount = 0; @@ -364,11 +364,11 @@ void XinputDevice::ApplyButtons(int pad, const XINPUT_STATE &state) { void XinputDevice::ApplyVibration(int pad, XINPUT_VIBRATION &vibration) { if (PSP_IsInited()) { - newVibrationTime = Common::Timer::GetTimeMs() >> 6; + newVibrationTime = time_now_d(); // We have to run PPSSPP_XInputSetState at time intervals // since it bugs otherwise with very high unthrottle speeds // and freezes at constant vibration or no vibration at all. - if (abs(newVibrationTime - prevVibrationTime) >= 1) { + if (newVibrationTime - prevVibrationTime >= 1.0 / 64.0) { if (GetUIState() == UISTATE_INGAME) { vibration.wLeftMotorSpeed = sceCtrlGetLeftVibration(); // use any value between 0-65535 here vibration.wRightMotorSpeed = sceCtrlGetRightVibration(); // use any value between 0-65535 here @@ -377,7 +377,7 @@ void XinputDevice::ApplyVibration(int pad, XINPUT_VIBRATION &vibration) { vibration.wRightMotorSpeed = 0; } - if ((prevVibration[pad].wLeftMotorSpeed != vibration.wLeftMotorSpeed || prevVibration[pad].wRightMotorSpeed != vibration.wRightMotorSpeed)) { + if (prevVibration[pad].wLeftMotorSpeed != vibration.wLeftMotorSpeed || prevVibration[pad].wRightMotorSpeed != vibration.wRightMotorSpeed) { PPSSPP_XInputSetState(pad, &vibration); prevVibration[pad] = vibration; } diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 8538ce1f5a6e..5772dbc8058e 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -300,8 +300,6 @@ EXEC_AND_LIB_FILES := \ $(SRC)/Common/MemoryUtil.cpp \ $(SRC)/Common/StringUtils.cpp \ $(SRC)/Common/SysError.cpp \ - $(SRC)/Common/ThreadPools.cpp \ - $(SRC)/Common/Timer.cpp \ $(SRC)/Common/TimeUtil.cpp \ $(SRC)/GPU/Math3D.cpp \ $(SRC)/GPU/GPU.cpp \ @@ -395,6 +393,7 @@ EXEC_AND_LIB_FILES := \ $(SRC)/Core/Screenshot.cpp \ $(SRC)/Core/System.cpp \ $(SRC)/Core/TextureReplacer.cpp \ + $(SRC)/Core/ThreadPools.cpp \ $(SRC)/Core/WebServer.cpp \ $(SRC)/Core/Debugger/Breakpoints.cpp \ $(SRC)/Core/Debugger/DisassemblyManager.cpp \ diff --git a/libretro/Makefile.common b/libretro/Makefile.common index 6f8ffebe6c08..010b7ee46a05 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -221,9 +221,7 @@ SOURCES_CXX += \ $(COMMONDIR)/MemoryUtil.cpp \ $(COMMONDIR)/SysError.cpp \ $(COMMONDIR)/StringUtils.cpp \ - $(COMMONDIR)/Timer.cpp \ - $(COMMONDIR)/TimeUtil.cpp \ - $(COMMONDIR)/ThreadPools.cpp + $(COMMONDIR)/TimeUtil.cpp SOURCES_CXX += \ @@ -501,6 +499,7 @@ SOURCES_CXX += \ $(COREDIR)/SaveState.cpp \ $(COREDIR)/Screenshot.cpp \ $(COREDIR)/System.cpp \ + $(COREDIR)/ThreadPools.cpp \ $(COREDIR)/Util/BlockAllocator.cpp \ $(COREDIR)/Util/PPGeDraw.cpp \ $(COREDIR)/Util/AudioFormat.cpp \ From f3a9d040da66f9bf583e3183998cb3a8525596bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 5 Oct 2020 21:04:50 +0200 Subject: [PATCH 2/2] Cap the global thread pool at 16 threads. --- Core/Config.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 0efc72f01437..95daf8a869d1 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -396,7 +396,9 @@ std::string CreateRandMAC() { } static int DefaultNumWorkers() { - return cpu_info.num_cores; + // Let's cap the global thread pool at 16 threads. Nothing we do really should have much + // use for more... + return std::min(16, cpu_info.num_cores); } static int DefaultCpuCore() {