aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/common
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner <yuriks@yuriks.net>2015-05-07 11:45:45 -0700
committerGravatar Yuri Kunde Schlesner <yuriks@yuriks.net>2015-05-07 11:45:45 -0700
commit4f4d230dac936f32cceb8be35fe09822d85bb2b6 (patch)
treea180a736708834708e0e5b95fd1720f37722b429 /src/common
parent337f1e1b96445b81c40c313b1bf680fe660f14f5 (diff)
parentc956e8a6869d0ee1edd68a6ab880efa6bf1fbe70 (diff)
Merge pull request #721 from yuriks/more-cleanups
More cleanups
Diffstat (limited to 'src/common')
-rw-r--r--src/common/CMakeLists.txt1
-rw-r--r--src/common/assert.h1
-rw-r--r--src/common/bit_field.h2
-rw-r--r--src/common/break_points.cpp1
-rw-r--r--src/common/break_points.h2
-rw-r--r--src/common/chunk_file.h3
-rw-r--r--src/common/common.h120
-rw-r--r--src/common/common_funcs.h82
-rw-r--r--src/common/common_paths.h3
-rw-r--r--src/common/common_types.h15
-rw-r--r--src/common/concurrent_ring_buffer.h2
-rw-r--r--src/common/emu_window.h6
-rw-r--r--src/common/file_util.cpp54
-rw-r--r--src/common/file_util.h2
-rw-r--r--src/common/hash.cpp3
-rw-r--r--src/common/hash.h2
-rw-r--r--src/common/linear_disk_cache.h2
-rw-r--r--src/common/logging/text_formatter.cpp1
-rw-r--r--src/common/math_util.cpp6
-rw-r--r--src/common/math_util.h2
-rw-r--r--src/common/mem_arena.cpp6
-rw-r--r--src/common/mem_arena.h2
-rw-r--r--src/common/memory_util.cpp3
-rw-r--r--src/common/misc.cpp4
-rw-r--r--src/common/platform.h57
-rw-r--r--src/common/profiler.cpp1
-rw-r--r--src/common/string_util.cpp4
-rw-r--r--src/common/string_util.h2
-rw-r--r--src/common/symbols.h4
-rw-r--r--src/common/thread.h1
-rw-r--r--src/common/thread_queue_list.h2
-rw-r--r--src/common/thunk.h2
-rw-r--r--src/common/timer.cpp4
-rw-r--r--src/common/timer.h2
34 files changed, 130 insertions, 274 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index daa2d59d..9a9f1a46 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -27,7 +27,6 @@ set(HEADERS
bit_field.h
break_points.h
chunk_file.h
- common.h
common_funcs.h
common_paths.h
common_types.h
diff --git a/src/common/assert.h b/src/common/assert.h
index 9ca7adb1..4f26c63e 100644
--- a/src/common/assert.h
+++ b/src/common/assert.h
@@ -4,6 +4,7 @@
#pragma once
+#include <cstdio>
#include <cstdlib>
#include "common/common_funcs.h"
diff --git a/src/common/bit_field.h b/src/common/bit_field.h
index 8eab054b..1f3ecf84 100644
--- a/src/common/bit_field.h
+++ b/src/common/bit_field.h
@@ -35,7 +35,7 @@
#include <limits>
#include <type_traits>
-#include "common/common.h"
+#include "common/common_funcs.h"
/*
* Abstract bitfield class
diff --git a/src/common/break_points.cpp b/src/common/break_points.cpp
index 15055bd4..023a485a 100644
--- a/src/common/break_points.cpp
+++ b/src/common/break_points.cpp
@@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include "common/common.h"
#include "common/debug_interface.h"
#include "common/break_points.h"
#include "common/logging/log.h"
diff --git a/src/common/break_points.h b/src/common/break_points.h
index 4b26cf90..f0a55e7b 100644
--- a/src/common/break_points.h
+++ b/src/common/break_points.h
@@ -7,7 +7,7 @@
#include <vector>
#include <string>
-#include "common/common.h"
+#include "common/common_types.h"
class DebugInterface;
diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h
index 3f97d56b..dcd80525 100644
--- a/src/common/chunk_file.h
+++ b/src/common/chunk_file.h
@@ -34,8 +34,9 @@
#include <set>
#include <type_traits>
-#include "common/common.h"
+#include "common/common_types.h"
#include "common/file_util.h"
+#include "common/logging/log.h"
template <class T>
struct LinkedListItem : public T
diff --git a/src/common/common.h b/src/common/common.h
deleted file mode 100644
index f7d0f55c..00000000
--- a/src/common/common.h
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-// DO NOT EVER INCLUDE <windows.h> directly _or indirectly_ from this file
-// since it slows down the build a lot.
-
-#include <cstdlib>
-#include <cstdio>
-#include <cstring>
-
-#define STACKALIGN
-
-// An inheritable class to disallow the copy constructor and operator= functions
-class NonCopyable
-{
-protected:
- NonCopyable() {}
- NonCopyable(const NonCopyable&&) {}
- void operator=(const NonCopyable&&) {}
-private:
- NonCopyable(NonCopyable&);
- NonCopyable& operator=(NonCopyable& other);
-};
-
-#include "common/assert.h"
-#include "common/logging/log.h"
-#include "common/common_types.h"
-#include "common/common_funcs.h"
-#include "common/common_paths.h"
-#include "common/platform.h"
-
-#ifdef __APPLE__
-// The Darwin ABI requires that stack frames be aligned to 16-byte boundaries.
-// This is only needed on i386 gcc - x86_64 already aligns to 16 bytes.
- #if defined __i386__ && defined __GNUC__
- #undef STACKALIGN
- #define STACKALIGN __attribute__((__force_align_arg_pointer__))
- #endif
-#elif defined _WIN32
-// Check MSC ver
- #if defined _MSC_VER && _MSC_VER <= 1000
- #error needs at least version 1000 of MSC
- #endif
-
- #ifndef NOMINMAX
- #define NOMINMAX
- #endif
-
-// Alignment
- #define MEMORY_ALIGNED16(x) __declspec(align(16)) x
- #define MEMORY_ALIGNED32(x) __declspec(align(32)) x
- #define MEMORY_ALIGNED64(x) __declspec(align(64)) x
- #define MEMORY_ALIGNED128(x) __declspec(align(128)) x
- #define MEMORY_ALIGNED16_DECL(x) __declspec(align(16)) x
- #define MEMORY_ALIGNED64_DECL(x) __declspec(align(64)) x
-#endif
-
-// Windows compatibility
-#ifndef _WIN32
- #ifdef _LP64
- #define _M_X64 1
- #else
- #define _M_IX86 1
- #endif
- #define __forceinline inline __attribute__((always_inline))
- #define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x
- #define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x
- #define MEMORY_ALIGNED64(x) __attribute__((aligned(64))) x
- #define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x
- #define MEMORY_ALIGNED16_DECL(x) __attribute__((aligned(16))) x
- #define MEMORY_ALIGNED64_DECL(x) __attribute__((aligned(64))) x
-#endif
-
-#ifdef _MSC_VER
- #define __strdup _strdup
- #define __getcwd _getcwd
- #define __chdir _chdir
-#else
- #define __strdup strdup
- #define __getcwd getcwd
- #define __chdir chdir
-#endif
-
-#if defined _M_GENERIC
-# define _M_SSE 0x0
-#elif defined __GNUC__
-# if defined __SSE4_2__
-# define _M_SSE 0x402
-# elif defined __SSE4_1__
-# define _M_SSE 0x401
-# elif defined __SSSE3__
-# define _M_SSE 0x301
-# elif defined __SSE3__
-# define _M_SSE 0x300
-# endif
-#elif (_MSC_VER >= 1500) || __INTEL_COMPILER // Visual Studio 2008
-# define _M_SSE 0x402
-#endif
-
-// Host communication.
-enum HOST_COMM
-{
- // Begin at 10 in case there is already messages with wParam = 0, 1, 2 and so on
- WM_USER_STOP = 10,
- WM_USER_CREATE,
- WM_USER_SETCURSOR,
-};
-
-// Used for notification on emulation state
-enum EMUSTATE_CHANGE
-{
- EMUSTATE_CHANGE_PLAY = 1,
- EMUSTATE_CHANGE_PAUSE,
- EMUSTATE_CHANGE_STOP
-};
-
-#include "swap.h"
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index e76cb7d6..4f9e514c 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -7,13 +7,6 @@
#include "common_types.h"
#include <cstdlib>
-#ifdef _WIN32
-#define SLEEP(x) Sleep(x)
-#else
-#include <unistd.h>
-#define SLEEP(x) usleep(x*1000)
-#endif
-
#define b2(x) ( (x) | ( (x) >> 1) )
#define b4(x) ( b2(x) | ( b2(x) >> 2) )
@@ -34,6 +27,27 @@
#define INSERT_PADDING_BYTES(num_bytes) u8 CONCAT2(pad, __LINE__)[(num_bytes)]
#define INSERT_PADDING_WORDS(num_words) u32 CONCAT2(pad, __LINE__)[(num_words)]
+#ifdef _WIN32
+ // Alignment
+ #define MEMORY_ALIGNED16(x) __declspec(align(16)) x
+ #define MEMORY_ALIGNED32(x) __declspec(align(32)) x
+ #define MEMORY_ALIGNED64(x) __declspec(align(64)) x
+ #define MEMORY_ALIGNED128(x) __declspec(align(128)) x
+#else
+ // Windows compatibility
+ #ifdef _LP64
+ #define _M_X64 1
+ #else
+ #define _M_IX86 1
+ #endif
+
+ #define __forceinline inline __attribute__((always_inline))
+ #define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x
+ #define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x
+ #define MEMORY_ALIGNED64(x) __attribute__((aligned(64))) x
+ #define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x
+#endif
+
#ifndef _MSC_VER
#include <errno.h>
@@ -73,61 +87,11 @@ inline u64 _rotr64(u64 x, unsigned int shift){
}
#else // _MSC_VER
-#include <locale.h>
-
-// Function Cross-Compatibility
- #define strcasecmp _stricmp
- #define strncasecmp _strnicmp
- #define unlink _unlink
+ // Function Cross-Compatibility
#define snprintf _snprintf
- #define vscprintf _vscprintf
-// Locale Cross-Compatibility
+ // Locale Cross-Compatibility
#define locale_t _locale_t
- #define freelocale _free_locale
- #define newlocale(mask, locale, base) _create_locale(mask, locale)
-
- #define LC_GLOBAL_LOCALE ((locale_t)-1)
- #define LC_ALL_MASK LC_ALL
- #define LC_COLLATE_MASK LC_COLLATE
- #define LC_CTYPE_MASK LC_CTYPE
- #define LC_MONETARY_MASK LC_MONETARY
- #define LC_NUMERIC_MASK LC_NUMERIC
- #define LC_TIME_MASK LC_TIME
-
- inline locale_t uselocale(locale_t new_locale)
- {
- // Retrieve the current per thread locale setting
- bool bIsPerThread = (_configthreadlocale(0) == _ENABLE_PER_THREAD_LOCALE);
-
- // Retrieve the current thread-specific locale
- locale_t old_locale = bIsPerThread ? _get_current_locale() : LC_GLOBAL_LOCALE;
-
- if(new_locale == LC_GLOBAL_LOCALE)
- {
- // Restore the global locale
- _configthreadlocale(_DISABLE_PER_THREAD_LOCALE);
- }
- else if(new_locale != nullptr)
- {
- // Configure the thread to set the locale only for this thread
- _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
-
- // Set all locale categories
- for(int i = LC_MIN; i <= LC_MAX; i++)
- setlocale(i, new_locale->locinfo->lc_category[i].locale);
- }
-
- return old_locale;
- }
-
-// 64 bit offsets for windows
- #define fseeko _fseeki64
- #define ftello _ftelli64
- #define atoll _atoi64
- #define stat64 _stat64
- #define fstat64 _fstat64
- #define fileno _fileno
extern "C" {
__declspec(dllimport) void __stdcall DebugBreak(void);
diff --git a/src/common/common_paths.h b/src/common/common_paths.h
index 440b0606..2903f2cf 100644
--- a/src/common/common_paths.h
+++ b/src/common/common_paths.h
@@ -4,9 +4,6 @@
#pragma once
-// Make sure we pick up USER_DIR if set in config.h
-#include "common/common.h"
-
// Directory separators, do we need this?
#define DIR_SEP "/"
#define DIR_SEP_CHR '/'
diff --git a/src/common/common_types.h b/src/common/common_types.h
index 1b453e7f..644709ba 100644
--- a/src/common/common_types.h
+++ b/src/common/common_types.h
@@ -47,6 +47,11 @@ typedef std::int64_t s64; ///< 64-bit signed int
typedef float f32; ///< 32-bit floating point
typedef double f64; ///< 64-bit floating point
+// TODO: It would be nice to eventually replace these with strong types that prevent accidental
+// conversion between each other.
+typedef u32 VAddr; ///< Represents a pointer in the userspace virtual address space.
+typedef u32 PAddr; ///< Represents a pointer in the ARM11 physical address space.
+
/// Union for fast 16-bit type casting
union t16 {
u8 _u8[2]; ///< 8-bit unsigned char(s)
@@ -73,6 +78,16 @@ union t64 {
u8 _u8[8]; ///< 8-bit unsigned char(s)
};
+// An inheritable class to disallow the copy constructor and operator= functions
+class NonCopyable {
+protected:
+ NonCopyable() = default;
+ ~NonCopyable() = default;
+
+ NonCopyable(NonCopyable&) = delete;
+ NonCopyable& operator=(NonCopyable&) = delete;
+};
+
namespace Common {
/// Rectangle data structure
class Rect {
diff --git a/src/common/concurrent_ring_buffer.h b/src/common/concurrent_ring_buffer.h
index fc18e6c8..c5889513 100644
--- a/src/common/concurrent_ring_buffer.h
+++ b/src/common/concurrent_ring_buffer.h
@@ -10,7 +10,7 @@
#include <mutex>
#include <thread>
-#include "common/common.h" // for NonCopyable
+#include "common/common_types.h" // for NonCopyable
namespace Common {
diff --git a/src/common/emu_window.h b/src/common/emu_window.h
index e0fc12a4..8eca6b5d 100644
--- a/src/common/emu_window.h
+++ b/src/common/emu_window.h
@@ -4,11 +4,11 @@
#pragma once
-#include "common/common.h"
-#include "common/scm_rev.h"
-#include "common/string_util.h"
+#include "common/common_types.h"
#include "common/key_map.h"
#include "common/math_util.h"
+#include "common/scm_rev.h"
+#include "common/string_util.h"
/**
* Abstraction class used to provide an interface between emulation code and the frontend
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 4ef4918d..7cdd1484 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -2,42 +2,52 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-
-#include "common/common.h"
+#include "common/assert.h"
+#include "common/common_funcs.h"
+#include "common/common_paths.h"
#include "common/file_util.h"
+#include "common/logging/log.h"
#ifdef _WIN32
-#include <windows.h>
-#include <shlobj.h> // for SHGetFolderPath
-#include <shellapi.h>
-#include <commdlg.h> // for GetSaveFileName
-#include <io.h>
-#include <direct.h> // getcwd
-#include <tchar.h>
+ #include <windows.h>
+ #include <shlobj.h> // for SHGetFolderPath
+ #include <shellapi.h>
+ #include <commdlg.h> // for GetSaveFileName
+ #include <io.h>
+ #include <direct.h> // getcwd
+ #include <tchar.h>
+
+ // 64 bit offsets for windows
+ #define fseeko _fseeki64
+ #define ftello _ftelli64
+ #define atoll _atoi64
+ #define stat64 _stat64
+ #define fstat64 _fstat64
+ #define fileno _fileno
#else
-#include <sys/param.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <pwd.h>
-#include <unistd.h>
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <dirent.h>
+ #include <pwd.h>
+ #include <unistd.h>
#endif
#if defined(__APPLE__)
-#include <CoreFoundation/CFString.h>
-#include <CoreFoundation/CFURL.h>
-#include <CoreFoundation/CFBundle.h>
+ #include <CoreFoundation/CFString.h>
+ #include <CoreFoundation/CFURL.h>
+ #include <CoreFoundation/CFBundle.h>
#endif
#include <algorithm>
#include <sys/stat.h>
#ifndef S_ISDIR
-#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
+ #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
#endif
#ifdef BSD4_4
-#define stat64 stat
-#define fstat64 fstat
+ #define stat64 stat
+ #define fstat64 fstat
#endif
// This namespace has various generic functions related to files and paths.
@@ -589,7 +599,7 @@ std::string GetCurrentDir()
{
char *dir;
// Get the current working directory (getcwd uses malloc)
- if (!(dir = __getcwd(nullptr, 0))) {
+ if (!(dir = getcwd(nullptr, 0))) {
LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: %s",
GetLastErrorMsg());
@@ -603,7 +613,7 @@ std::string GetCurrentDir()
// Sets the current directory to the given directory
bool SetCurrentDir(const std::string &directory)
{
- return __chdir(directory.c_str()) == 0;
+ return chdir(directory.c_str()) == 0;
}
#if defined(__APPLE__)
diff --git a/src/common/file_util.h b/src/common/file_util.h
index 86aab2e3..b6582929 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -11,7 +11,7 @@
#include <string>
#include <vector>
-#include "common/common.h"
+#include "common/common_types.h"
#include "common/string_util.h"
// User directory indices for GetUserPath
diff --git a/src/common/hash.cpp b/src/common/hash.cpp
index 0624dab8..b0b3613f 100644
--- a/src/common/hash.cpp
+++ b/src/common/hash.cpp
@@ -4,7 +4,10 @@
#include <algorithm>
+#include "common/common_funcs.h" // For rotl
#include "common/hash.h"
+#include "common/platform.h"
+
#if _M_SSE >= 0x402
#include "common/cpu_detect.h"
#include <nmmintrin.h>
diff --git a/src/common/hash.h b/src/common/hash.h
index 3ac42bc4..0afaf0e3 100644
--- a/src/common/hash.h
+++ b/src/common/hash.h
@@ -4,7 +4,7 @@
#pragma once
-#include "common/common.h"
+#include "common/common_types.h"
u32 HashFletcher(const u8* data_u8, size_t length); // FAST. Length & 1 == 0.
u32 HashAdler32(const u8* data, size_t len); // Fairly accurate, slightly slower
diff --git a/src/common/linear_disk_cache.h b/src/common/linear_disk_cache.h
index 74ce74ab..48529cf4 100644
--- a/src/common/linear_disk_cache.h
+++ b/src/common/linear_disk_cache.h
@@ -4,7 +4,7 @@
#pragma once
-#include "common/common.h"
+#include "common/common_types.h"
#include <fstream>
// defined in Version.cpp
diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp
index 36c91c4f..45be6d0a 100644
--- a/src/common/logging/text_formatter.cpp
+++ b/src/common/logging/text_formatter.cpp
@@ -14,6 +14,7 @@
#include "common/logging/log.h"
#include "common/logging/text_formatter.h"
+#include "common/common_funcs.h"
#include "common/string_util.h"
namespace Log {
diff --git a/src/common/math_util.cpp b/src/common/math_util.cpp
index a83592dd..bcb70cae 100644
--- a/src/common/math_util.cpp
+++ b/src/common/math_util.cpp
@@ -2,12 +2,12 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <cstring>
+#include <numeric> // Necessary on OS X, but not Linux
-#include "common/common.h"
+#include "common/common_types.h"
#include "common/math_util.h"
-#include <numeric> // Necessary on OS X, but not Linux
-
namespace MathUtil
{
diff --git a/src/common/math_util.h b/src/common/math_util.h
index 43b0e0dc..52f579cf 100644
--- a/src/common/math_util.h
+++ b/src/common/math_util.h
@@ -4,7 +4,7 @@
#pragma once
-#include "common/common.h"
+#include "common/common_types.h"
#include <algorithm>
#include <type_traits>
diff --git a/src/common/mem_arena.cpp b/src/common/mem_arena.cpp
index 76c70701..f233d4a3 100644
--- a/src/common/mem_arena.cpp
+++ b/src/common/mem_arena.cpp
@@ -17,12 +17,16 @@
#include <string>
-#include "common/memory_util.h"
+#include "common/logging/log.h"
#include "common/mem_arena.h"
+#include "common/memory_util.h"
#include "common/string_util.h"
#ifndef _WIN32
#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+
#ifdef ANDROID
#include <sys/ioctl.h>
#include <linux/ashmem.h>
diff --git a/src/common/mem_arena.h b/src/common/mem_arena.h
index 3379d252..d514fe58 100644
--- a/src/common/mem_arena.h
+++ b/src/common/mem_arena.h
@@ -21,7 +21,7 @@
#include <windows.h>
#endif
-#include "common/common.h"
+#include "common/common_types.h"
// This class lets you create a block of anonymous RAM, and then arbitrarily map views into it.
// Multiple views can mirror the same section of the block, which makes it very convient for emulating
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp
index 7e69d31c..2087a118 100644
--- a/src/common/memory_util.cpp
+++ b/src/common/memory_util.cpp
@@ -3,7 +3,8 @@
// Refer to the license.txt file included.
-#include "common/common.h"
+#include "common/common_funcs.h"
+#include "common/logging/log.h"
#include "common/memory_util.h"
#include "common/string_util.h"
diff --git a/src/common/misc.cpp b/src/common/misc.cpp
index e33055d1..53cacf37 100644
--- a/src/common/misc.cpp
+++ b/src/common/misc.cpp
@@ -2,10 +2,12 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include "common/common.h"
+#include "common/common_funcs.h"
#ifdef _WIN32
#include <windows.h>
+#else
+#include <string.h>
#endif
// Neither Android nor OS X support TLS
diff --git a/src/common/platform.h b/src/common/platform.h
index e27d6e31..1516dc88 100644
--- a/src/common/platform.h
+++ b/src/common/platform.h
@@ -64,47 +64,26 @@
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////
-// Compiler-Specific Definitions
-
-#if EMU_PLATFORM == PLATFORM_WINDOWS
-
-#include <time.h>
-
-#ifndef NOMINMAX
-#define NOMINMAX
+// Feature detection
+
+#if defined _M_GENERIC
+# define _M_SSE 0x0
+#elif defined __GNUC__
+# if defined __SSE4_2__
+# define _M_SSE 0x402
+# elif defined __SSE4_1__
+# define _M_SSE 0x401
+# elif defined __SSSE3__
+# define _M_SSE 0x301
+# elif defined __SSE3__
+# define _M_SSE 0x300
+# endif
+#elif (_MSC_VER >= 1500) || __INTEL_COMPILER // Visual Studio 2008
+# define _M_SSE 0x402
#endif
-#define EMU_FASTCALL __fastcall
-
-#ifdef _MSC_VER
-inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
- if (localtime_s(result, clock) == 0)
- return result;
- return nullptr;
-}
-#endif
-
-#else // EMU_PLATFORM != PLATFORM_WINDOWS
-
-#define EMU_FASTCALL __attribute__((fastcall))
-#define __stdcall
-#define __cdecl
-#define BOOL bool
-#define DWORD u32
-
-// TODO: Hacks..
-#include <limits.h>
-
-#include <strings.h>
-#define stricmp(str1, str2) strcasecmp(str1, str2)
-#define _stricmp(str1, str2) strcasecmp(str1, str2)
-#define _snprintf snprintf
-#define _getcwd getcwd
-#define _tzset tzset
-
-typedef void EXCEPTION_POINTERS;
-
-#endif
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Compiler-Specific Definitions
#define GCC_VERSION_AVAILABLE(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || \
(__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))))
diff --git a/src/common/profiler.cpp b/src/common/profiler.cpp
index 65c3df16..b8cde178 100644
--- a/src/common/profiler.cpp
+++ b/src/common/profiler.cpp
@@ -7,7 +7,6 @@
#include "common/assert.h"
#if defined(_MSC_VER) && _MSC_VER <= 1800 // MSVC 2013.
-#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#include <Windows.h> // For QueryPerformanceCounter/Frequency
#endif
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index 3264dd51..6563611f 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -4,7 +4,9 @@
#include <boost/range/algorithm.hpp>
-#include "common/common.h"
+#include "common/common_funcs.h"
+#include "common/common_paths.h"
+#include "common/logging/log.h"
#include "common/string_util.h"
#ifdef _MSC_VER
diff --git a/src/common/string_util.h b/src/common/string_util.h
index 74974263..a60a8469 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -10,7 +10,7 @@
#include <sstream>
#include <vector>
-#include "common/common.h"
+#include "common/common_types.h"
namespace Common {
diff --git a/src/common/symbols.h b/src/common/symbols.h
index f76cb6b1..6b62b011 100644
--- a/src/common/symbols.h
+++ b/src/common/symbols.h
@@ -5,8 +5,10 @@
#pragma once
#include <map>
+#include <string>
+#include <utility>
-#include "common/common.h"
+#include "common/common_types.h"
struct TSymbol
{
diff --git a/src/common/thread.h b/src/common/thread.h
index 5fdb6bae..7bc41949 100644
--- a/src/common/thread.h
+++ b/src/common/thread.h
@@ -4,7 +4,6 @@
#pragma once
-// Don't include common.h here as it will break LogManager
#include "common/common_types.h"
#include <cstdio>
#include <cstring>
diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h
index 4f27fc89..12455d7c 100644
--- a/src/common/thread_queue_list.h
+++ b/src/common/thread_queue_list.h
@@ -9,8 +9,6 @@
#include <boost/range/algorithm_ext/erase.hpp>
-#include "common/common.h"
-
namespace Common {
template<class T, unsigned int N>
diff --git a/src/common/thunk.h b/src/common/thunk.h
index 4fb7c98e..53348005 100644
--- a/src/common/thunk.h
+++ b/src/common/thunk.h
@@ -6,7 +6,7 @@
#include <map>
-#include "common/common.h"
+#include "common/common_types.h"
// This simple class creates a wrapper around a C/C++ function that saves all fp state
// before entering it, and restores it upon exit. This is required to be able to selectively
diff --git a/src/common/timer.cpp b/src/common/timer.cpp
index a6682ea1..b99835ac 100644
--- a/src/common/timer.cpp
+++ b/src/common/timer.cpp
@@ -12,9 +12,9 @@
#include <sys/time.h>
#endif
-#include "common/common.h"
-#include "common/timer.h"
+#include "common/common_types.h"
#include "common/string_util.h"
+#include "common/timer.h"
namespace Common
{
diff --git a/src/common/timer.h b/src/common/timer.h
index 4b44c33a..b5f0f258 100644
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -4,7 +4,7 @@
#pragma once
-#include "common/common.h"
+#include "common/common_types.h"
#include <string>
namespace Common