Merge pull request #876 from linkmauve/include-cleanups
Cleanup includes, mostly in common
This commit is contained in:
commit
867c28ae03
108 changed files with 380 additions and 408 deletions
|
@ -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
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "common/common_funcs.h"
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
|
||||
|
|
|
@ -26,16 +26,18 @@
|
|||
// - Zero backwards/forwards compatibility
|
||||
// - Serialization code for anything complex has to be manually written.
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/file_util.h"
|
||||
#include "common/logging/log.h"
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -5,15 +5,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "common_types.h"
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
#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]))
|
||||
|
||||
|
@ -43,8 +34,6 @@
|
|||
|
||||
#ifndef _MSC_VER
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
#define Crash() __asm__ __volatile__("int $3")
|
||||
#elif defined(_M_ARM)
|
||||
|
|
|
@ -24,9 +24,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifndef __func__
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/key_map.h"
|
||||
|
||||
#include "emu_window.h"
|
||||
#include "video_core/video_core.h"
|
||||
|
||||
|
|
|
@ -4,11 +4,17 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
#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
|
||||
|
|
|
@ -1,111 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
// a simple lockless thread-safe,
|
||||
// single reader, single writer queue
|
||||
|
||||
#include "common/atomic.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
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 <typename Arg>
|
||||
void Push(Arg&& t)
|
||||
{
|
||||
// create the element, add it to the queue
|
||||
m_write_ptr->current = new T(std::forward<Arg>(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;
|
||||
};
|
||||
|
||||
}
|
|
@ -17,6 +17,8 @@
|
|||
#include <direct.h> // getcwd
|
||||
#include <tchar.h>
|
||||
|
||||
#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 <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef __APPLE__
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#include <cctype>
|
||||
#include <cerrno>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <dirent.h>
|
||||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -6,13 +6,12 @@
|
|||
|
||||
#include <array>
|
||||
#include <fstream>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/string_util.h"
|
||||
|
||||
// User directory indices for GetUserPath
|
||||
enum {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
#include "common/logging/log.h"
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace Log {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
namespace Common {
|
||||
|
|
|
@ -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 <windows.h>
|
||||
#include <psapi.h>
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#include "common/common_funcs.h"
|
||||
#include "common/string_util.h"
|
||||
#else
|
||||
#include <cstdlib>
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
void* AllocateExecutableMemory(size_t size, bool low = true);
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "common/common_funcs.h"
|
||||
#include <cstddef>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <string.h>
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
#endif
|
||||
|
||||
// Neither Android nor OS X support TLS
|
||||
|
|
|
@ -24,66 +24,11 @@
|
|||
|
||||
#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)
|
||||
#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))))
|
||||
|
|
|
@ -2,13 +2,18 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
#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 <Windows.h> // For QueryPerformanceCounter/Frequency
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h> // For QueryPerformanceCounter/Frequency
|
||||
#endif
|
||||
|
||||
namespace Common {
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
#include <utility>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
#include "common/profiler.h"
|
||||
|
|
|
@ -2,9 +2,13 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <boost/range/algorithm.hpp>
|
||||
#include <cctype>
|
||||
#include <cerrno>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <boost/range/algorithm/transform.hpp>
|
||||
|
||||
#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 <Windows.h>
|
||||
#include <codecvt>
|
||||
#include "common/common_funcs.h"
|
||||
#else
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstddef>
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
|
|
@ -17,12 +17,16 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <byteswap.h>
|
||||
#if defined(_MSC_VER)
|
||||
#include <cstdlib>
|
||||
#elif defined(__linux__)
|
||||
#include <byteswap.h>
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <sys/endian.h>
|
||||
#include <sys/endian.h>
|
||||
#endif
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
// GCC 4.6+
|
||||
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <mutex>
|
||||
|
||||
namespace Common {
|
||||
|
|
|
@ -5,11 +5,20 @@
|
|||
#include "common/thread.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <mach/mach.h>
|
||||
#elif defined(BSD4_4) || defined(__OpenBSD__)
|
||||
#include <pthread_np.h>
|
||||
#include <mach/mach.h>
|
||||
#elif defined(_WIN32)
|
||||
#include <Windows.h>
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#if defined(BSD4_4) || defined(__OpenBSD__)
|
||||
#include <pthread_np.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
namespace Common
|
||||
|
|
|
@ -4,24 +4,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cstddef>
|
||||
#include <thread>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
|
||||
// This may not be defined outside _WIN32
|
||||
#ifndef _WIN32
|
||||
#ifndef INFINITE
|
||||
#define INFINITE 0xffffffff
|
||||
#endif
|
||||
|
||||
//for gettimeofday and struct time(spec|val)
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue