From 0aade9ad631f21b9d0e72c4896858c107f5a167a Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 20 Jun 2015 20:10:44 +0100 Subject: Common: Remove unused fifo_queue.h. --- src/common/CMakeLists.txt | 1 - src/common/fifo_queue.h | 111 ---------------------------------------------- 2 files changed, 112 deletions(-) delete mode 100644 src/common/fifo_queue.h (limited to 'src/common') diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index e78f4f144..f025e1186 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -31,7 +31,6 @@ set(HEADERS cpu_detect.h debug_interface.h emu_window.h - fifo_queue.h file_util.h key_map.h linear_disk_cache.h diff --git a/src/common/fifo_queue.h b/src/common/fifo_queue.h deleted file mode 100644 index b426e6596..000000000 --- a/src/common/fifo_queue.h +++ /dev/null @@ -1,111 +0,0 @@ -#pragma once - -// a simple lockless thread-safe, -// single reader, single writer queue - -#include "common/atomic.h" - -namespace Common -{ - -template -class FifoQueue -{ -public: - FifoQueue() : m_size(0) - { - m_write_ptr = m_read_ptr = new ElementPtr(); - } - - ~FifoQueue() - { - // this will empty out the whole queue - delete m_read_ptr; - } - - u32 Size() const - { - return m_size; - } - - bool Empty() const - { - //return (m_read_ptr == m_write_ptr); - return (0 == m_size); - } - - T& Front() const - { - return *m_read_ptr->current; - } - - template - void Push(Arg&& t) - { - // create the element, add it to the queue - m_write_ptr->current = new T(std::forward(t)); - // set the next pointer to a new element ptr - // then advance the write pointer - m_write_ptr = m_write_ptr->next = new ElementPtr(); - Common::AtomicIncrement(m_size); - } - - void Pop() - { - Common::AtomicDecrement(m_size); - ElementPtr *const tmpptr = m_read_ptr; - // advance the read pointer - m_read_ptr = m_read_ptr->next; - // set the next element to NULL to stop the recursive deletion - tmpptr->next = nullptr; - delete tmpptr; // this also deletes the element - } - - bool Pop(T& t) - { - if (Empty()) - return false; - - t = std::move(Front()); - Pop(); - - return true; - } - - // not thread-safe - void Clear() - { - m_size = 0; - delete m_read_ptr; - m_write_ptr = m_read_ptr = new ElementPtr(); - } - -private: - // stores a pointer to element - // and a pointer to the next ElementPtr - class ElementPtr - { - public: - ElementPtr() : current(nullptr), next(nullptr) {} - - ~ElementPtr() - { - if (current) - { - delete current; - // recusion ftw - if (next) - delete next; - } - } - - T *volatile current; - ElementPtr *volatile next; - }; - - ElementPtr *volatile m_write_ptr; - ElementPtr *volatile m_read_ptr; - volatile u32 m_size; -}; - -} -- cgit v1.2.3 From 82718c4a41d141b524026af4d70af167965e5a1c Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 20 Jun 2015 20:13:06 +0100 Subject: Common: Remove unused SSE version checking and a GCC macro. --- src/common/platform.h | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'src/common') diff --git a/src/common/platform.h b/src/common/platform.h index df780ac6f..bda3e7be7 100644 --- a/src/common/platform.h +++ b/src/common/platform.h @@ -62,28 +62,3 @@ #elif defined(__i386) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) #define EMU_ARCH_BITS 32 #endif - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Compiler-Specific Definitions - -#define GCC_VERSION_AVAILABLE(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || \ - (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))) -- cgit v1.2.3 From ce0cfd62d95cdc46f4517ad16a0396a5815cb595 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 20 Jun 2015 20:14:43 +0100 Subject: Common: Remove now-unused EMU_PLATFORM define, fixes issue #373. --- src/common/platform.h | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'src/common') diff --git a/src/common/platform.h b/src/common/platform.h index bda3e7be7..0a912dda3 100644 --- a/src/common/platform.h +++ b/src/common/platform.h @@ -24,39 +24,9 @@ #pragma once -#include "common/common_types.h" - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Platform definitions - -/// Enumeration for defining the supported platforms -#define PLATFORM_NULL 0 -#define PLATFORM_WINDOWS 1 -#define PLATFORM_MACOSX 2 -#define PLATFORM_LINUX 3 -#define PLATFORM_ANDROID 4 - //////////////////////////////////////////////////////////////////////////////////////////////////// // Platform detection -#ifndef EMU_PLATFORM - -#if defined( __WIN32__ ) || defined( _WIN32 ) -#define EMU_PLATFORM PLATFORM_WINDOWS - -#elif defined( __APPLE__ ) || defined( __APPLE_CC__ ) -#define EMU_PLATFORM PLATFORM_MACOSX - -#elif defined(__linux__) -#define EMU_PLATFORM PLATFORM_LINUX - -#else // Assume linux otherwise -#define EMU_PLATFORM PLATFORM_LINUX - -#endif - -#endif - #if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) #define EMU_ARCH_BITS 64 #elif defined(__i386) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) -- cgit v1.2.3 From 8cf9eb7f431e235a39f380118cfd081a604ea1c9 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 20 Jun 2015 22:24:01 +0100 Subject: Common: Fix FileUtil includes, and everything relying on those. --- src/common/chunk_file.h | 7 ++++--- src/common/file_util.cpp | 11 +++++++++-- src/common/file_util.h | 3 +-- 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'src/common') diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h index dcd80525e..ee9f3d7c0 100644 --- a/src/common/chunk_file.h +++ b/src/common/chunk_file.h @@ -26,13 +26,14 @@ // - Zero backwards/forwards compatibility // - Serialization code for anything complex has to be manually written. -#include -#include +#include #include -#include #include +#include #include +#include #include +#include #include "common/common_types.h" #include "common/file_util.h" diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 24648ea33..836b58d52 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -17,6 +17,8 @@ #include // getcwd #include + #include "common/string_util.h" + // 64 bit offsets for windows #define fseeko _fseeki64 #define ftello _ftelli64 @@ -25,8 +27,13 @@ #define fstat64 _fstat64 #define fileno _fileno #else - #include - #include + #ifdef __APPLE__ + #include + #endif + #include + #include + #include + #include #include #include #include diff --git a/src/common/file_util.h b/src/common/file_util.h index b65829291..8fe772aee 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h @@ -6,13 +6,12 @@ #include #include +#include #include -#include #include #include #include "common/common_types.h" -#include "common/string_util.h" // User directory indices for GetUserPath enum { -- cgit v1.2.3 From 13e6876463078ee0597b3677a26ccaa2a5ff8b35 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 20 Jun 2015 22:33:54 +0100 Subject: Common: Fix string_util includes. --- src/common/string_util.cpp | 9 +++++++-- src/common/string_util.h | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src/common') diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 7dc0ba7ba..2e80809ab 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -2,9 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include +#include +#include +#include +#include +#include +#include -#include "common/common_funcs.h" #include "common/common_paths.h" #include "common/logging/log.h" #include "common/string_util.h" @@ -12,6 +16,7 @@ #ifdef _MSC_VER #include #include + #include "common/common_funcs.h" #else #include #endif diff --git a/src/common/string_util.h b/src/common/string_util.h index fdc410499..c5c474c6f 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h @@ -5,9 +5,10 @@ #pragma once #include +#include #include -#include #include +#include #include #include "common/common_types.h" -- cgit v1.2.3 From 2a36edfd86cc15829b113466845ccab759731793 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 20 Jun 2015 22:45:15 +0100 Subject: Common: Cleanup thread includes. --- src/common/thread.cpp | 17 +++++++++++++---- src/common/thread.h | 16 ++-------------- 2 files changed, 15 insertions(+), 18 deletions(-) (limited to 'src/common') diff --git a/src/common/thread.cpp b/src/common/thread.cpp index 8bf005857..7bbf080bc 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp @@ -5,11 +5,20 @@ #include "common/thread.h" #ifdef __APPLE__ -#include -#elif defined(BSD4_4) || defined(__OpenBSD__) -#include + #include #elif defined(_WIN32) -#include + #include +#else + #if defined(BSD4_4) || defined(__OpenBSD__) + #include + #else + #include + #endif + #include +#endif + +#ifndef _WIN32 + #include #endif namespace Common diff --git a/src/common/thread.h b/src/common/thread.h index 7bc419497..8255ee6d3 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -4,24 +4,12 @@ #pragma once -#include "common/common_types.h" -#include -#include +#include #include #include #include -// This may not be defined outside _WIN32 -#ifndef _WIN32 -#ifndef INFINITE -#define INFINITE 0xffffffff -#endif - -//for gettimeofday and struct time(spec|val) -#include -#include -#include -#endif +#include "common/common_types.h" // Support for C++11's thread_local keyword was surprisingly spotty in compilers until very // recently. Fortunately, thread local variables have been well supported for compilers for a while, -- cgit v1.2.3 From 3a771a13dcfd1de061e886e081393fca1fd1e689 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 20 Jun 2015 23:36:19 +0100 Subject: Common: Cleanup profiler includes. --- src/common/assert.h | 1 - src/common/profiler.cpp | 11 ++++++++--- src/common/profiler_reporting.h | 4 +--- src/common/synchronized_wrapper.h | 1 + 4 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src/common') diff --git a/src/common/assert.h b/src/common/assert.h index 7b7d8bf28..6849778b7 100644 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -4,7 +4,6 @@ #pragma once -#include #include #include "common/common_funcs.h" diff --git a/src/common/profiler.cpp b/src/common/profiler.cpp index cf6b6b258..7792edd2f 100644 --- a/src/common/profiler.cpp +++ b/src/common/profiler.cpp @@ -2,13 +2,18 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include +#include +#include + +#include "common/assert.h" #include "common/profiler.h" #include "common/profiler_reporting.h" -#include "common/assert.h" +#include "common/synchronized_wrapper.h" #if defined(_MSC_VER) && _MSC_VER <= 1800 // MSVC 2013. -#define WIN32_LEAN_AND_MEAN -#include // For QueryPerformanceCounter/Frequency + #define WIN32_LEAN_AND_MEAN + #include // For QueryPerformanceCounter/Frequency #endif namespace Common { diff --git a/src/common/profiler_reporting.h b/src/common/profiler_reporting.h index 3abb73315..ab60cfb16 100644 --- a/src/common/profiler_reporting.h +++ b/src/common/profiler_reporting.h @@ -4,10 +4,8 @@ #pragma once -#include #include -#include -#include +#include #include #include "common/profiler.h" diff --git a/src/common/synchronized_wrapper.h b/src/common/synchronized_wrapper.h index 946252b8c..ae5e8b1ed 100644 --- a/src/common/synchronized_wrapper.h +++ b/src/common/synchronized_wrapper.h @@ -4,6 +4,7 @@ #pragma once +#include #include namespace Common { -- cgit v1.2.3 From 2d044a67c932403b81fdde6f81d461c6e7c11efe Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 21 Jun 2015 13:12:49 +0100 Subject: Common: Cleanup memory and misc includes. --- src/common/common_funcs.h | 4 ---- src/common/common_types.h | 2 -- src/common/logging/log.h | 4 ---- src/common/memory_util.cpp | 11 +++++++---- src/common/memory_util.h | 4 +--- src/common/misc.cpp | 5 +++-- src/common/swap.h | 10 +++++++--- 7 files changed, 18 insertions(+), 22 deletions(-) (limited to 'src/common') diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 91b74c6bc..cc74a228e 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -5,8 +5,6 @@ #pragma once #include "common_types.h" -#include - #define b2(x) ( (x) | ( (x) >> 1) ) #define b4(x) ( b2(x) | ( b2(x) >> 2) ) @@ -43,8 +41,6 @@ #ifndef _MSC_VER -#include - #if defined(__x86_64__) || defined(_M_X64) #define Crash() __asm__ __volatile__("int $3") #elif defined(_M_ARM) diff --git a/src/common/common_types.h b/src/common/common_types.h index f6de0adfc..ebfd7824a 100644 --- a/src/common/common_types.h +++ b/src/common/common_types.h @@ -24,9 +24,7 @@ #pragma once -#include #include -#include #ifdef _MSC_VER #ifndef __func__ diff --git a/src/common/logging/log.h b/src/common/logging/log.h index 5b3a731e9..e16dde7fc 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h @@ -4,10 +4,6 @@ #pragma once -#include -#include -#include - #include "common/common_types.h" namespace Log { diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp index 20b791a10..2b3ace528 100644 --- a/src/common/memory_util.cpp +++ b/src/common/memory_util.cpp @@ -3,14 +3,17 @@ // Refer to the license.txt file included. -#include "common/common_funcs.h" #include "common/logging/log.h" #include "common/memory_util.h" -#include "common/string_util.h" #ifdef _WIN32 -#include -#include + #include + #include + #include "common/common_funcs.h" + #include "common/string_util.h" +#else + #include + #include #endif #if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT) diff --git a/src/common/memory_util.h b/src/common/memory_util.h index 9fdbf1f12..9bf37c44f 100644 --- a/src/common/memory_util.h +++ b/src/common/memory_util.h @@ -4,9 +4,7 @@ #pragma once -#ifndef _WIN32 -#include -#endif +#include #include void* AllocateExecutableMemory(size_t size, bool low = true); diff --git a/src/common/misc.cpp b/src/common/misc.cpp index 53cacf37c..d2a049b63 100644 --- a/src/common/misc.cpp +++ b/src/common/misc.cpp @@ -2,12 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/common_funcs.h" +#include #ifdef _WIN32 #include #else -#include +#include +#include #endif // Neither Android nor OS X support TLS diff --git a/src/common/swap.h b/src/common/swap.h index 588cebc70..b92e5bfa4 100644 --- a/src/common/swap.h +++ b/src/common/swap.h @@ -17,12 +17,16 @@ #pragma once -#if defined(__linux__) -#include +#if defined(_MSC_VER) + #include +#elif defined(__linux__) + #include #elif defined(__FreeBSD__) -#include + #include #endif +#include "common/common_types.h" + // GCC 4.6+ #if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) -- cgit v1.2.3 From 596b7c4f63e38d275b6a056d6125c0027a1376e7 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 21 Jun 2015 13:40:28 +0100 Subject: Common: Cleanup key_map includes. --- src/common/bit_field.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/common') diff --git a/src/common/bit_field.h b/src/common/bit_field.h index 1f3ecf844..6595b5ba4 100644 --- a/src/common/bit_field.h +++ b/src/common/bit_field.h @@ -32,6 +32,7 @@ #pragma once +#include #include #include -- cgit v1.2.3 From 1775adc34c588c8c37ef8c07dc0c3ff2358d5a31 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 21 Jun 2015 13:52:08 +0100 Subject: Common: Remove unused ROUND_UP_POW2 macro. --- src/common/common_funcs.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/common') diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index cc74a228e..c4fb3d9cc 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -6,13 +6,6 @@ #include "common_types.h" -#define b2(x) ( (x) | ( (x) >> 1) ) -#define b4(x) ( b2(x) | ( b2(x) >> 2) ) -#define b8(x) ( b4(x) | ( b4(x) >> 4) ) -#define b16(x) ( b8(x) | ( b8(x) >> 8) ) -#define b32(x) (b16(x) | (b16(x) >>16) ) -#define ROUND_UP_POW2(x) (b32(x - 1) + 1) - #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) /// Textually concatenates two tokens. The double-expansion is required by the C preprocessor. -- cgit v1.2.3 From 22ae87530b11226895a6a3682b9e75c5f5b9045d Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 21 Jun 2015 14:02:11 +0100 Subject: Common: Cleanup emu_window includes. --- src/common/emu_window.cpp | 6 ++++++ src/common/emu_window.h | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src/common') diff --git a/src/common/emu_window.cpp b/src/common/emu_window.cpp index 43facb85c..b69b05cb9 100644 --- a/src/common/emu_window.cpp +++ b/src/common/emu_window.cpp @@ -2,6 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include +#include + +#include "common/assert.h" +#include "common/key_map.h" + #include "emu_window.h" #include "video_core/video_core.h" diff --git a/src/common/emu_window.h b/src/common/emu_window.h index 8eca6b5d5..a0ae4c9fa 100644 --- a/src/common/emu_window.h +++ b/src/common/emu_window.h @@ -4,11 +4,17 @@ #pragma once +#include +#include + #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" + +#include "core/hle/service/hid/hid.h" + +namespace KeyMap { +struct HostDeviceKey; +} /** * Abstraction class used to provide an interface between emulation code and the frontend -- cgit v1.2.3 From 45c4781544624c85a8178c6ee445cfe6a4751910 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 21 Jun 2015 14:58:59 +0100 Subject: CitraQt: Cleanup includes. --- src/common/logging/filter.h | 1 + src/common/profiler_reporting.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/logging/filter.h b/src/common/logging/filter.h index 0b71ea3b2..a2b4eca43 100644 --- a/src/common/logging/filter.h +++ b/src/common/logging/filter.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include #include "common/logging/log.h" diff --git a/src/common/profiler_reporting.h b/src/common/profiler_reporting.h index ab60cfb16..df98e05b7 100644 --- a/src/common/profiler_reporting.h +++ b/src/common/profiler_reporting.h @@ -4,7 +4,6 @@ #pragma once -#include #include #include -- cgit v1.2.3 From aea15f5c731b325be48ea4900ae3eca341ac03cd Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 21 Jun 2015 15:11:32 +0100 Subject: Core: Cleanup core includes. --- src/common/chunk_file.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h index ee9f3d7c0..8be0b1109 100644 --- a/src/common/chunk_file.h +++ b/src/common/chunk_file.h @@ -33,10 +33,11 @@ #include #include #include +#include #include +#include "common/assert.h" #include "common/common_types.h" -#include "common/file_util.h" #include "common/logging/log.h" template -- cgit v1.2.3 From e5fcabdd698b7c5e8fe8c0903ed2b3babcb75a17 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 21 Jun 2015 15:44:11 +0100 Subject: Core: Cleanup file_sys includes. --- src/common/make_unique.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/common') diff --git a/src/common/make_unique.h b/src/common/make_unique.h index 2a7b76412..f6e7f017c 100644 --- a/src/common/make_unique.h +++ b/src/common/make_unique.h @@ -4,6 +4,7 @@ #pragma once +#include #include namespace Common { -- cgit v1.2.3