diff --git a/common/AlignedMalloc.cpp b/common/AlignedMalloc.cpp
index eab02f15fe..570e056128 100644
--- a/common/AlignedMalloc.cpp
+++ b/common/AlignedMalloc.cpp
@@ -16,9 +16,10 @@
// This module contains implementations of _aligned_malloc for platforms that don't have
// it built into their CRT/libc.
-#ifndef _WIN32
+#if !defined(_WIN32)
#include "common/Assertions.h"
+#include "common/ScopedAlloc.h"
void *__fastcall _aligned_malloc(size_t size, size_t align)
{
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 3cbe3cdbae..8e4b934f6f 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -9,6 +9,7 @@ add_library(common)
# x86emitter sources
target_sources(common PRIVATE
+ AlignedMalloc.cpp
VirtualMemory.cpp
EventSource.inl
SafeArray.inl
@@ -45,9 +46,16 @@ target_sources(common PRIVATE
emitter/legacy_sse.cpp
emitter/movs.cpp
emitter/simd.cpp
+ emitter/LnxCpuDetect.cpp
emitter/WinCpuDetect.cpp
emitter/x86emitter.cpp
x86/MemcpyFast.cpp
+ Darwin/DarwinThreads.cpp
+ Darwin/DarwinMisc.cpp
+ Darwin/DarwinSemaphore.cpp
+ Linux/LnxHostSys.cpp
+ Linux/LnxThreads.cpp
+ Linux/LnxMisc.cpp
Windows/WinThreads.cpp
Windows/WinHostSys.cpp
Windows/WinMisc.cpp)
diff --git a/common/Darwin/DarwinMisc.cpp b/common/Darwin/DarwinMisc.cpp
index 4087a1364d..3c512b828d 100644
--- a/common/Darwin/DarwinMisc.cpp
+++ b/common/Darwin/DarwinMisc.cpp
@@ -13,15 +13,16 @@
* If not, see .
*/
-#include "../PrecompiledHeader.h"
+#if defined(__APPLE__)
#include
#include
-
#include
#include
-
#include
+#include
+
+#include "common/Pcsx2Types.h"
#define NELEM(x) \
((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x])))))
@@ -148,3 +149,4 @@ void ScreensaverAllow(bool allow)
{
// no-op
}
+#endif
diff --git a/common/Darwin/DarwinSemaphore.cpp b/common/Darwin/DarwinSemaphore.cpp
index dea234ca7d..1ba1f3db1a 100644
--- a/common/Darwin/DarwinSemaphore.cpp
+++ b/common/Darwin/DarwinSemaphore.cpp
@@ -13,26 +13,22 @@
* If not, see .
*/
+#if defined(__APPLE__)
+
#include
#include // assert
-
#include // pthread_setcancelstate()
-
#include // gettimeofday()
-
#include
#include // semaphore_create() and semaphore_destroy()
#include // semaphore_*()
#include // mach_error_string()
#include // mach_absolute_time()
-#include "PrecompiledHeader.h"
-
-#include "Threading.h"
-#include "ThreadingInternal.h"
-
-#include "wxBaseTools.h"
-#include "wxGuiTools.h"
+#include "common/Threading.h"
+#include "common/ThreadingInternal.h"
+#include "common/wxBaseTools.h"
+#include "common/wxGuiTools.h"
// --------------------------------------------------------------------------------------
// Semaphore Implementation for Darwin/OSX
@@ -242,3 +238,4 @@ int Threading::Semaphore::Count()
{
return __atomic_load_n(&m_counter, __ATOMIC_SEQ_CST);
}
+#endif
diff --git a/common/Darwin/DarwinThreads.cpp b/common/Darwin/DarwinThreads.cpp
index 803571da57..791f271094 100644
--- a/common/Darwin/DarwinThreads.cpp
+++ b/common/Darwin/DarwinThreads.cpp
@@ -13,19 +13,16 @@
* If not, see .
*/
-#include "../PrecompiledHeader.h"
-#include "PersistentThread.h"
+#if defined(__APPLE__)
#include
-
-#if !defined(__APPLE__)
-#error "DarwinThreads.cpp should only be compiled by projects or makefiles targeted at OSX."
-#else
-
#include
#include
#include
+#include "common/PrecompiledHeader.h"
+#include "common/PersistentThread.h"
+
// Note: assuming multicore is safer because it forces the interlocked routines to use
// the LOCK prefix. The prefix works on single core CPUs fine (but is slow), but not
// having the LOCK prefix is very bad indeed.
diff --git a/common/Exceptions.cpp b/common/Exceptions.cpp
index 018d3a181c..bc31ee4c6d 100644
--- a/common/Exceptions.cpp
+++ b/common/Exceptions.cpp
@@ -13,11 +13,14 @@
* If not, see .
*/
+#define WXINTL_NO_GETTEXT_MACRO
+
#include
#if defined(__UNIX__)
#include
#endif
+#include "common/Dependencies.h" // _ macro
#include "common/Threading.h"
#include "common/General.h"
diff --git a/common/Linux/LnxHostSys.cpp b/common/Linux/LnxHostSys.cpp
index 45ad567877..20d72a552a 100644
--- a/common/Linux/LnxHostSys.cpp
+++ b/common/Linux/LnxHostSys.cpp
@@ -13,7 +13,7 @@
* If not, see .
*/
-#ifndef _WIN32
+#if !defined(_WIN32)
#include
#include
#include
diff --git a/common/Linux/LnxMisc.cpp b/common/Linux/LnxMisc.cpp
index 60f00a3c86..f95aafab03 100644
--- a/common/Linux/LnxMisc.cpp
+++ b/common/Linux/LnxMisc.cpp
@@ -13,13 +13,15 @@
* If not, see .
*/
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__APPLE__)
#include
#include
#include
#include
#include
+#include "common/Pcsx2Types.h"
+
// Returns 0 on failure (not supported by the operating system).
u64 GetPhysicalMemory()
{
diff --git a/common/Linux/LnxThreads.cpp b/common/Linux/LnxThreads.cpp
index a547816e2f..c680f69d7f 100644
--- a/common/Linux/LnxThreads.cpp
+++ b/common/Linux/LnxThreads.cpp
@@ -13,7 +13,7 @@
* If not, see .
*/
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__APPLE__)
#include
#if defined(__linux__)
#include
diff --git a/common/MemcpyFast.h b/common/MemcpyFast.h
index 6e09f3075c..592b5df0a1 100644
--- a/common/MemcpyFast.h
+++ b/common/MemcpyFast.h
@@ -15,6 +15,7 @@
#pragma once
+#include // memset
#include "common/Pcsx2Types.h"
#include "common/Pcsx2Defs.h"
diff --git a/common/Perf.h b/common/Perf.h
index e087b59275..c3b96ef892 100644
--- a/common/Perf.h
+++ b/common/Perf.h
@@ -16,6 +16,7 @@
#pragma once
#include
+#include
#include "common/Pcsx2Types.h"
namespace Perf
diff --git a/common/SafeArray.inl b/common/SafeArray.inl
index dd41f85acd..5407a00ced 100644
--- a/common/SafeArray.inl
+++ b/common/SafeArray.inl
@@ -15,7 +15,8 @@
#pragma once
-#include "SafeArray.h"
+#include "common/SafeArray.h"
+#include "common/StringHelpers.h"
// Internal constructor for use by derived classes. This allows a derived class to
// use its own memory allocation (with an aligned memory, for example).
diff --git a/common/Semaphore.cpp b/common/Semaphore.cpp
index fad184a47f..fe86497934 100644
--- a/common/Semaphore.cpp
+++ b/common/Semaphore.cpp
@@ -13,6 +13,8 @@
* If not, see .
*/
+#if !defined(__APPLE__)
+
#include "common/Threading.h"
#include "common/wxBaseTools.h"
#include "common/wxGuiTools.h"
@@ -160,3 +162,4 @@ int Threading::Semaphore::Count()
sem_getvalue(&m_sema, &retval);
return retval;
}
+#endif
diff --git a/common/Windows/WinMisc.cpp b/common/Windows/WinMisc.cpp
index bfb04648f5..f7b6750940 100644
--- a/common/Windows/WinMisc.cpp
+++ b/common/Windows/WinMisc.cpp
@@ -13,6 +13,8 @@
* If not, see .
*/
+#if defined(_WIN32)
+
#include
#include "common/Pcsx2Defs.h"
#include "common/RedtapeWindows.h"
@@ -114,3 +116,4 @@ void ScreensaverAllow(bool allow)
flags |= ES_DISPLAY_REQUIRED;
SetThreadExecutionState(flags);
}
+#endif
diff --git a/common/pxTranslate.cpp b/common/pxTranslate.cpp
index 501c299551..f08a4c0870 100644
--- a/common/pxTranslate.cpp
+++ b/common/pxTranslate.cpp
@@ -14,6 +14,7 @@
*/
#include
+#include "common/Pcsx2Defs.h" // __fastcall
bool pxIsEnglish(int id)
{
diff --git a/linux_various/hex2h.pl b/linux_various/hex2h.pl
index 1370d4524e..2ba600b151 100755
--- a/linux_various/hex2h.pl
+++ b/linux_various/hex2h.pl
@@ -80,7 +80,7 @@ close(IN);
open(OUT,">$output");
### Print the header
print OUT "#pragma once\n\n";
-print OUT "#include \"Pcsx2Types.h\"\n";
+print OUT "#include \"common/Pcsx2Types.h\"\n";
print OUT "#include \n\n";
print OUT "class $wx_img_class\n{\n";
print OUT "public:\n";
diff --git a/pcsx2/PAD/Linux/Global.h b/pcsx2/PAD/Linux/Global.h
index 8e42121bcb..3c722c63b9 100644
--- a/pcsx2/PAD/Linux/Global.h
+++ b/pcsx2/PAD/Linux/Global.h
@@ -25,11 +25,11 @@
#include
#include
-#include "Pcsx2Defs.h"
+#include "common/Pcsx2Defs.h"
#include "bitwise.h"
-#include "Utilities/pxStreams.h"
-#include "Utilities/Console.h"
+#include "common/pxStreams.h"
+#include "common/Console.h"
#include "App.h"
#include "DebugTools/Debug.h"
diff --git a/pcsx2/PAD/Linux/PAD.h b/pcsx2/PAD/Linux/PAD.h
index 5465c7f4ac..81e7b6a83a 100644
--- a/pcsx2/PAD/Linux/PAD.h
+++ b/pcsx2/PAD/Linux/PAD.h
@@ -16,7 +16,7 @@
#pragma once
#include "Global.h"
-#include "Utilities/mt_queue.h"
+#include "common/mt_queue.h"
enum PadOptions
{
diff --git a/pcsx2/PAD/Linux/keyboard.cpp b/pcsx2/PAD/Linux/keyboard.cpp
index 1168215f23..25e4d30f2e 100644
--- a/pcsx2/PAD/Linux/keyboard.cpp
+++ b/pcsx2/PAD/Linux/keyboard.cpp
@@ -21,7 +21,7 @@
#include "Global.h"
#include "keyboard.h"
-#include "Utilities/mt_queue.h"
+#include "common/mt_queue.h"
extern keyEvent event;
extern MtQueue g_ev_fifo;
diff --git a/pcsx2/PAD/Linux/keyboard.h b/pcsx2/PAD/Linux/keyboard.h
index cfbdb753a0..26b94eae8b 100644
--- a/pcsx2/PAD/Linux/keyboard.h
+++ b/pcsx2/PAD/Linux/keyboard.h
@@ -15,7 +15,7 @@
#pragma once
-#include "Pcsx2Defs.h"
+#include "common/Pcsx2Defs.h"
#include "App.h"
#if defined(__unix__) || defined(__APPLE__)
diff --git a/pcsx2/PAD/Linux/wx_dialog/opPanel.h b/pcsx2/PAD/Linux/wx_dialog/opPanel.h
index ffc793bd05..3103153b14 100644
--- a/pcsx2/PAD/Linux/wx_dialog/opPanel.h
+++ b/pcsx2/PAD/Linux/wx_dialog/opPanel.h
@@ -17,7 +17,7 @@
#include
-#include "Utilities/EmbeddedImage.h"
+#include "common/EmbeddedImage.h"
enum gui_img
{
diff --git a/pcsx2/SPU2/Linux/ConfigDebug.cpp b/pcsx2/SPU2/Linux/ConfigDebug.cpp
index 9438162c0d..2d86db6f25 100644
--- a/pcsx2/SPU2/Linux/ConfigDebug.cpp
+++ b/pcsx2/SPU2/Linux/ConfigDebug.cpp
@@ -17,7 +17,7 @@
#include "SPU2/Global.h"
#include "Dialogs.h"
#include "Config.h"
-#include "Utilities/Path.h"
+#include "common/Path.h"
bool DebugEnabled = false;
bool _MsgToConsole = false;
diff --git a/pcsx2/USB/linux/config.cpp b/pcsx2/USB/linux/config.cpp
index bafd2e65c2..4ea1162639 100644
--- a/pcsx2/USB/linux/config.cpp
+++ b/pcsx2/USB/linux/config.cpp
@@ -19,7 +19,7 @@
#include "USB/deviceproxy.h"
#include "USB/usb-pad/padproxy.h"
#include "USB/usb-mic/audiodeviceproxy.h"
-#include "Utilities/Console.h"
+#include "common/Console.h"
void SysMessage_stderr(const char* fmt, ...)
{
diff --git a/pcsx2/USB/usb-eyetoy/cam-linux.cpp b/pcsx2/USB/usb-eyetoy/cam-linux.cpp
index 2b5e659f87..c502f880bf 100644
--- a/pcsx2/USB/usb-eyetoy/cam-linux.cpp
+++ b/pcsx2/USB/usb-eyetoy/cam-linux.cpp
@@ -19,7 +19,7 @@
#include "jpge.h"
#include "jo_mpeg.h"
#include "USB/gtk.h"
-#include "Utilities/Console.h"
+#include "common/Console.h"
#include
#include
diff --git a/pcsx2/USB/usb-hid/evdev/evdev.h b/pcsx2/USB/usb-hid/evdev/evdev.h
index bad0e15420..aa022d06fc 100644
--- a/pcsx2/USB/usb-hid/evdev/evdev.h
+++ b/pcsx2/USB/usb-hid/evdev/evdev.h
@@ -16,7 +16,7 @@
#pragma once
#include "USB/usb-hid/usb-hid.h"
#include "USB/linux/util.h"
-#include "Utilities/Console.h"
+#include "common/Console.h"
#include
#include
#include
diff --git a/pcsx2/USB/usb-msd/usb-msd-gtk.cpp b/pcsx2/USB/usb-msd/usb-msd-gtk.cpp
index 401f716ce1..171359db37 100644
--- a/pcsx2/USB/usb-msd/usb-msd-gtk.cpp
+++ b/pcsx2/USB/usb-msd/usb-msd-gtk.cpp
@@ -17,7 +17,7 @@
#include "USB/linux/ini.h"
#include "USB/configuration.h"
#include "USB/gtk.h"
-#include "Utilities/Console.h"
+#include "common/Console.h"
namespace usb_msd
{
diff --git a/pcsx2/USB/usb-pad/evdev/evdev.h b/pcsx2/USB/usb-pad/evdev/evdev.h
index efd54da4b3..8d267c7fd1 100644
--- a/pcsx2/USB/usb-pad/evdev/evdev.h
+++ b/pcsx2/USB/usb-pad/evdev/evdev.h
@@ -18,7 +18,7 @@
#include "shared.h"
#include "USB/linux/util.h"
#include "USB/readerwriterqueue/readerwriterqueue.h"
-#include "Utilities/Console.h"
+#include "common/Console.h"
//#include //gtk.h pulls in?
#include
#include
diff --git a/pcsx2/USB/usb-pad/evdev/shared-gtk.cpp b/pcsx2/USB/usb-pad/evdev/shared-gtk.cpp
index b10710a610..5bcc5b7d0a 100644
--- a/pcsx2/USB/usb-pad/evdev/shared-gtk.cpp
+++ b/pcsx2/USB/usb-pad/evdev/shared-gtk.cpp
@@ -15,7 +15,7 @@
#include "shared.h"
#include "USB/icon_buzz_24.h"
-#include "Utilities/Console.h"
+#include "common/Console.h"
#include
#include
diff --git a/pcsx2/USB/usb-pad/evdev/shared.h b/pcsx2/USB/usb-pad/evdev/shared.h
index 65309a235d..3f0fe1ba65 100644
--- a/pcsx2/USB/usb-pad/evdev/shared.h
+++ b/pcsx2/USB/usb-pad/evdev/shared.h
@@ -16,7 +16,7 @@
#pragma once
#include
#include
-#include "Pcsx2Types.h"
+#include "common/Pcsx2Types.h"
#include "USB/gtk.h"
#include "USB/usb-pad/padproxy.h"
#include "USB/configuration.h"