Starting to cleanup includes a bit. Still a mess.
This commit is contained in:
parent
f24b45a07c
commit
1d54342930
|
@ -265,7 +265,7 @@ uint64_t ResolveFunctionSymbol(void* raw_context, uint64_t symbol_info_ptr) {
|
||||||
|
|
||||||
// Overwrite the call site.
|
// Overwrite the call site.
|
||||||
// The return address points to ReloadRCX work after the call.
|
// The return address points to ReloadRCX work after the call.
|
||||||
#if XE_WIN32_LIKE
|
#if XE_LIKE_WIN32
|
||||||
uint64_t return_address = reinterpret_cast<uint64_t>(_ReturnAddress());
|
uint64_t return_address = reinterpret_cast<uint64_t>(_ReturnAddress());
|
||||||
#else
|
#else
|
||||||
uint64_t return_address =
|
uint64_t return_address =
|
||||||
|
|
|
@ -34,20 +34,6 @@ namespace x64 {
|
||||||
DFLUSH(); \
|
DFLUSH(); \
|
||||||
if (thread_state->thread_id() == TARGET_THREAD) printf
|
if (thread_state->thread_id() == TARGET_THREAD) printf
|
||||||
|
|
||||||
// TODO(benvanik): properly pull out values.
|
|
||||||
typedef union __declspec(align(16)) {
|
|
||||||
__m128 m128;
|
|
||||||
float m128_f32[4];
|
|
||||||
uint64_t m128_u64[2];
|
|
||||||
int8_t m128_i8[16];
|
|
||||||
int16_t m128_i16[8];
|
|
||||||
int32_t m128_i32[4];
|
|
||||||
int64_t m128_i64[2];
|
|
||||||
uint8_t m128_u8[16];
|
|
||||||
uint16_t m128_u16[8];
|
|
||||||
uint32_t m128_u32[4];
|
|
||||||
} __m128_x;
|
|
||||||
|
|
||||||
uint32_t GetTracingMode() {
|
uint32_t GetTracingMode() {
|
||||||
uint32_t mode = 0;
|
uint32_t mode = 0;
|
||||||
#if ITRACE
|
#if ITRACE
|
||||||
|
|
|
@ -136,7 +136,7 @@ void Value::SignExtend(TypeName target_type) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
XEASSERTUNHANDLEDCASE();
|
XEASSERTUNHANDLEDCASE(type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ static size_t GetTypeSize(TypeName type_name) {
|
||||||
return 16;
|
return 16;
|
||||||
default:
|
default:
|
||||||
XEASSERTUNHANDLEDCASE(type_name);
|
XEASSERTUNHANDLEDCASE(type_name);
|
||||||
break;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
#include <alloy/core.h>
|
#include <alloy/core.h>
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#define ALLOY_RUNTIME_ENTRY_TABLE_H_
|
#define ALLOY_RUNTIME_ENTRY_TABLE_H_
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
#include <alloy/core.h>
|
#include <alloy/core.h>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* Xenia : Xbox 360 Emulator Research Project *
|
||||||
|
******************************************************************************
|
||||||
|
* Copyright 2014 Ben Vanik. All rights reserved. *
|
||||||
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef POLY_CONFIG_H_
|
||||||
|
#define POLY_CONFIG_H_
|
||||||
|
|
||||||
|
#if defined(DEBUG) || defined(_DEBUG)
|
||||||
|
#define XE_DEBUG 1
|
||||||
|
#endif // DEBUG
|
||||||
|
|
||||||
|
#endif // POLY_CONFIG_H_
|
|
@ -10,6 +10,8 @@
|
||||||
#ifndef POLY_POLY_CXX_COMPAT_H_
|
#ifndef POLY_POLY_CXX_COMPAT_H_
|
||||||
#define POLY_POLY_CXX_COMPAT_H_
|
#define POLY_POLY_CXX_COMPAT_H_
|
||||||
|
|
||||||
|
#include <poly/config.h>
|
||||||
|
|
||||||
// C++11 thread local storage.
|
// C++11 thread local storage.
|
||||||
// http://en.cppreference.com/w/cpp/language/storage_duration
|
// http://en.cppreference.com/w/cpp/language/storage_duration
|
||||||
#if XE_COMPILER_MSVC
|
#if XE_COMPILER_MSVC
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#include <poly/config.h>
|
||||||
|
#include <poly/platform.h>
|
||||||
|
|
||||||
namespace poly {
|
namespace poly {
|
||||||
|
|
||||||
// lzcnt instruction, typed for integers of all sizes.
|
// lzcnt instruction, typed for integers of all sizes.
|
||||||
|
@ -22,48 +25,48 @@ namespace poly {
|
||||||
// return value is the size of the input operand (8, 16, 32, or 64). If the most
|
// return value is the size of the input operand (8, 16, 32, or 64). If the most
|
||||||
// significant bit of value is one, the return value is zero.
|
// significant bit of value is one, the return value is zero.
|
||||||
#if XE_COMPILER_MSVC
|
#if XE_COMPILER_MSVC
|
||||||
uint8_t lzcnt(uint8_t v) { return static_cast<uint8_t>(__lzcnt16(v) - 8); }
|
inline uint8_t lzcnt(uint8_t v) { return static_cast<uint8_t>(__lzcnt16(v) - 8); }
|
||||||
uint8_t lzcnt(uint16_t v) { return static_cast<uint8_t>(__lzcnt16(v)); }
|
inline uint8_t lzcnt(uint16_t v) { return static_cast<uint8_t>(__lzcnt16(v)); }
|
||||||
uint8_t lzcnt(uint32_t v) { return static_cast<uint8_t>(__lzcnt(v)); }
|
inline uint8_t lzcnt(uint32_t v) { return static_cast<uint8_t>(__lzcnt(v)); }
|
||||||
uint8_t lzcnt(uint64_t v) { return static_cast<uint8_t>(__lzcnt64(v)); }
|
inline uint8_t lzcnt(uint64_t v) { return static_cast<uint8_t>(__lzcnt64(v)); }
|
||||||
#else
|
#else
|
||||||
uint8_t lzcnt(uint8_t v) { return static_cast<uint8_t>(__builtin_clzs(v) - 8); }
|
inline uint8_t lzcnt(uint8_t v) { return static_cast<uint8_t>(__builtin_clzs(v) - 8); }
|
||||||
uint8_t lzcnt(uint16_t v) { return static_cast<uint8_t>(__builtin_clzs(v)); }
|
inline uint8_t lzcnt(uint16_t v) { return static_cast<uint8_t>(__builtin_clzs(v)); }
|
||||||
uint8_t lzcnt(uint32_t v) { return static_cast<uint8_t>(__builtin_clz(v)); }
|
inline uint8_t lzcnt(uint32_t v) { return static_cast<uint8_t>(__builtin_clz(v)); }
|
||||||
uint8_t lzcnt(uint64_t v) { return static_cast<uint8_t>(__builtin_clzll(v)); }
|
inline uint8_t lzcnt(uint64_t v) { return static_cast<uint8_t>(__builtin_clzll(v)); }
|
||||||
#endif // XE_COMPILER_MSVC
|
#endif // XE_COMPILER_MSVC
|
||||||
uint8_t lzcnt(int8_t v) { return lzcnt(static_cast<uint8_t>(v)); }
|
inline uint8_t lzcnt(int8_t v) { return lzcnt(static_cast<uint8_t>(v)); }
|
||||||
uint8_t lzcnt(int16_t v) { return lzcnt(static_cast<uint16_t>(v)); }
|
inline uint8_t lzcnt(int16_t v) { return lzcnt(static_cast<uint16_t>(v)); }
|
||||||
uint8_t lzcnt(int32_t v) { return lzcnt(static_cast<uint32_t>(v)); }
|
inline uint8_t lzcnt(int32_t v) { return lzcnt(static_cast<uint32_t>(v)); }
|
||||||
uint8_t lzcnt(int64_t v) { return lzcnt(static_cast<uint64_t>(v)); }
|
inline uint8_t lzcnt(int64_t v) { return lzcnt(static_cast<uint64_t>(v)); }
|
||||||
|
|
||||||
// BitScanForward (bsf).
|
// BitScanForward (bsf).
|
||||||
// Search the value from least significant bit (LSB) to the most significant bit
|
// Search the value from least significant bit (LSB) to the most significant bit
|
||||||
// (MSB) for a set bit (1).
|
// (MSB) for a set bit (1).
|
||||||
// Returns false if no bits are set and the output index is invalid.
|
// Returns false if no bits are set and the output index is invalid.
|
||||||
#if XE_COMPILER_MSVC
|
#if XE_COMPILER_MSVC
|
||||||
bool bit_scan_forward(uint32_t v, uint32_t* out_first_set_index) {
|
inline bool bit_scan_forward(uint32_t v, uint32_t* out_first_set_index) {
|
||||||
return _BitScanForward(out_first_set_index, v) != 0;
|
return _BitScanForward(reinterpret_cast<DWORD*>(out_first_set_index), v) != 0;
|
||||||
}
|
}
|
||||||
bool bit_scan_forward(uint64_t v, uint32_t* out_first_set_index) {
|
inline bool bit_scan_forward(uint64_t v, uint32_t* out_first_set_index) {
|
||||||
return _BitScanForward64(out_first_set_index, v) != 0;
|
return _BitScanForward64(reinterpret_cast<DWORD*>(out_first_set_index), v) != 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
bool bit_scan_forward(uint32_t v, uint32_t* out_first_set_index) {
|
inline bool bit_scan_forward(uint32_t v, uint32_t* out_first_set_index) {
|
||||||
int i = ffs(v);
|
int i = ffs(v);
|
||||||
*out_first_set_index = i;
|
*out_first_set_index = i;
|
||||||
return i != 0;
|
return i != 0;
|
||||||
}
|
}
|
||||||
bool bit_scan_forward(uint64_t v, uint32_t* out_first_set_index) {
|
inline bool bit_scan_forward(uint64_t v, uint32_t* out_first_set_index) {
|
||||||
int i = ffsll(v);
|
int i = ffsll(v);
|
||||||
*out_first_set_index = i;
|
*out_first_set_index = i;
|
||||||
return i != 0;
|
return i != 0;
|
||||||
}
|
}
|
||||||
#endif // XE_COMPILER_MSVC
|
#endif // XE_COMPILER_MSVC
|
||||||
bool bit_scan_forward(int32_t v, uint32_t* out_first_set_index) {
|
inline bool bit_scan_forward(int32_t v, uint32_t* out_first_set_index) {
|
||||||
return bit_scan_forward(static_cast<uint32_t>(v), out_first_set_index);
|
return bit_scan_forward(static_cast<uint32_t>(v), out_first_set_index);
|
||||||
}
|
}
|
||||||
bool bit_scan_forward(int64_t v, uint32_t* out_first_set_index) {
|
inline bool bit_scan_forward(int64_t v, uint32_t* out_first_set_index) {
|
||||||
return bit_scan_forward(static_cast<uint64_t>(v), out_first_set_index);
|
return bit_scan_forward(static_cast<uint64_t>(v), out_first_set_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,20 +87,28 @@ int32_t m128_i32(const __m128& v) {
|
||||||
return ret.i;
|
return ret.i;
|
||||||
}
|
}
|
||||||
template <int N>
|
template <int N>
|
||||||
double m128_f64(const __m128& v) {
|
double m128_f64(const __m128d& v) {
|
||||||
double ret;
|
double ret;
|
||||||
_mm_store_sd(&ret, _mm_shuffle_ps(v, v, _MM_SHUFFLE(N, N, N, N)));
|
_mm_store_sd(&ret, _mm_shuffle_pd(v, v, _MM_SHUFFLE2(N, N)));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
template <int N>
|
template <int N>
|
||||||
int64_t m128_i64(const __m128& v) {
|
double m128_f64(const __m128& v) {
|
||||||
|
return m128_f64<N>(_mm_castps_pd(v));
|
||||||
|
}
|
||||||
|
template <int N>
|
||||||
|
int64_t m128_i64(const __m128d& v) {
|
||||||
union {
|
union {
|
||||||
double f;
|
double f;
|
||||||
int64_t i;
|
int64_t i;
|
||||||
} ret;
|
} ret;
|
||||||
_mm_store_sd(&ret.f, _mm_shuffle_ps(v, v, _MM_SHUFFLE(N, N, N, N)));
|
_mm_store_sd(&ret.f, _mm_shuffle_pd(v, v, _MM_SHUFFLE2(N, N)));
|
||||||
return ret.i;
|
return ret.i;
|
||||||
}
|
}
|
||||||
|
template <int N>
|
||||||
|
int64_t m128_i64(const __m128& v) {
|
||||||
|
return m128_i64<N>(_mm_castps_pd(v));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace poly
|
} // namespace poly
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,163 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* Xenia : Xbox 360 Emulator Research Project *
|
||||||
|
******************************************************************************
|
||||||
|
* Copyright 2014 Ben Vanik. All rights reserved. *
|
||||||
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef POLY_PLATFORM_H_
|
||||||
|
#define POLY_PLATFORM_H_
|
||||||
|
|
||||||
|
// NOTE: ordering matters here as sometimes multiple flags are defined on
|
||||||
|
// certain platforms.
|
||||||
|
|
||||||
|
// Great resource on predefined macros: http://predef.sourceforge.net/preos.html
|
||||||
|
|
||||||
|
/*
|
||||||
|
XE_PLATFORM: IOS | OSX | XBOX360 | WINCE | WIN32 | ANDROID | NACL | UNIX
|
||||||
|
XE_LIKE: OSX | WIN32 | POSIX
|
||||||
|
XE_PROFILE: EMBEDDED | DESKTOP (+ _SIMULATOR)
|
||||||
|
XE_COMPILER: GNUC | MSVC | CLANG | INTEL | UNKNOWN
|
||||||
|
XE_CPU: 32BIT | 64BIT | BIGENDIAN | LITTLEENDIAN
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#include <TargetConditionals.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED ) || \
|
||||||
|
(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE ) || \
|
||||||
|
(defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)
|
||||||
|
|
||||||
|
#define XE_PLATFORM_IOS 1
|
||||||
|
#define XE_LIKE_OSX 1
|
||||||
|
#define XE_PROFILE_EMBEDDED 1
|
||||||
|
|
||||||
|
#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
|
||||||
|
// EMBEDDED *and* SIMULATOR
|
||||||
|
#define XE_PROFILE_SIMULATOR 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined(TARGET_OS_MAC) && TARGET_OS_MAC
|
||||||
|
|
||||||
|
#define XE_PLATFORM_OSX 1
|
||||||
|
#define XE_LIKE_OSX 1
|
||||||
|
#define XE_PROFILE_DESKTOP 1
|
||||||
|
|
||||||
|
#elif defined(_XBOX)
|
||||||
|
|
||||||
|
#define XE_PLATFORM_XBOX360 1
|
||||||
|
#define XE_LIKE_WIN32 1
|
||||||
|
#define XE_PROFILE_EMBEDDED 1
|
||||||
|
|
||||||
|
#elif defined(_WIN32_WCE)
|
||||||
|
|
||||||
|
#define XE_PLATFORM_WINCE 1
|
||||||
|
#define XE_LIKE_WIN32 1
|
||||||
|
#define XE_PROFILE_EMBEDDED 1
|
||||||
|
|
||||||
|
#elif defined(__CYGWIN__)
|
||||||
|
|
||||||
|
#define XE_PLATFORM_CYGWIN 1
|
||||||
|
#define XE_LIKE_POSIX 1
|
||||||
|
#define XE_PROFILE_DESKTOP 1
|
||||||
|
|
||||||
|
#elif defined(WIN32) || defined(_WIN32)
|
||||||
|
|
||||||
|
#define XE_PLATFORM_WIN32 1
|
||||||
|
#define XE_LIKE_WIN32 1
|
||||||
|
#define XE_PROFILE_DESKTOP 1
|
||||||
|
|
||||||
|
#elif defined(ANDROID)
|
||||||
|
|
||||||
|
#define XE_PLATFORM_ANDROID 1
|
||||||
|
#define XE_LIKE_POSIX 1
|
||||||
|
#define XE_PROFILE_EMBEDDED 1
|
||||||
|
|
||||||
|
#elif defined(__native_client__)
|
||||||
|
|
||||||
|
#define XE_PLATFORM_NACL 1
|
||||||
|
#define XE_LIKE_POSIX 1
|
||||||
|
#define XE_PROFILE_DESKTOP 1
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define XE_PLATFORM_UNIX 1
|
||||||
|
#define XE_LIKE_POSIX 1
|
||||||
|
#define XE_PROFILE_DESKTOP 1
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#define XE_COMPILER_CLANG 1
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#define XE_COMPILER_GNUC 1
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
#define XE_COMPILER_MSVC 1
|
||||||
|
#elif defined(__MINGW32)
|
||||||
|
#define XE_COMPILER_MINGW32 1
|
||||||
|
#elif defined(__INTEL_COMPILER)
|
||||||
|
#define XE_COMPILER_INTEL 1
|
||||||
|
#else
|
||||||
|
#define XE_COMPILER_UNKNOWN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__ia64__) || defined(_M_IA64) || \
|
||||||
|
defined(__ppc64__) || defined(__PPC64__) || \
|
||||||
|
defined(__arch64__) || \
|
||||||
|
defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || \
|
||||||
|
defined(__LP64__) || defined(__LLP64) || \
|
||||||
|
defined(_WIN64) || \
|
||||||
|
(__WORDSIZE == 64)
|
||||||
|
#define XE_CPU_64BIT 1
|
||||||
|
#else
|
||||||
|
#define XE_CPU_32BIT 1
|
||||||
|
#endif // [64bit flags]
|
||||||
|
|
||||||
|
#if defined(__ppc__) || defined(__PPC__) || defined(__powerpc__) || defined(__powerpc) || defined(__POWERPC__) || defined(_M_PPC) || defined(__PPC) || \
|
||||||
|
defined(__ppc64__) || defined(__PPC64__) || \
|
||||||
|
defined(__ARMEB__) || defined(__THUMBEB__) || \
|
||||||
|
defined(__AARCH64EB__) || \
|
||||||
|
defined(__BIG_ENDIAN) || defined(__BIG_ENDIAN__)
|
||||||
|
#define XE_CPU_BIGENDIAN 1
|
||||||
|
#else
|
||||||
|
#define XE_CPU_LITTLEENDIAN 1
|
||||||
|
#endif // [big endian flags]
|
||||||
|
|
||||||
|
#if XE_CPU_32BIT
|
||||||
|
#define XE_ALIGNMENT 8
|
||||||
|
#else
|
||||||
|
#define XE_ALIGNMENT 16
|
||||||
|
#endif // 32BIT
|
||||||
|
|
||||||
|
#if XE_PLATFORM_WINCE || XE_PLATFORM_WIN32
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
#include <SDKDDKVer.h>
|
||||||
|
#include <windows.h>
|
||||||
|
#include <ObjBase.h>
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
|
#undef Yield
|
||||||
|
#endif // WINCE || WIN32
|
||||||
|
|
||||||
|
#if XE_PLATFORM_XBOX360
|
||||||
|
#include <xtl.h>
|
||||||
|
#include <xboxmath.h>
|
||||||
|
#endif // XBOX360
|
||||||
|
|
||||||
|
#if XE_COMPILER_MSVC
|
||||||
|
// Disable warning C4068: unknown pragma
|
||||||
|
#pragma warning(disable : 4068)
|
||||||
|
#endif // MSVC
|
||||||
|
|
||||||
|
#if XE_COMPILER_MSVC
|
||||||
|
#include <intrin.h>
|
||||||
|
#else
|
||||||
|
#include <x86intrin.h>
|
||||||
|
#endif // MSVC
|
||||||
|
|
||||||
|
#endif // POLY_PLATFORM_H_
|
|
@ -10,8 +10,10 @@
|
||||||
#ifndef POLY_POLY_H_
|
#ifndef POLY_POLY_H_
|
||||||
#define POLY_POLY_H_
|
#define POLY_POLY_H_
|
||||||
|
|
||||||
|
#include <poly/config.h>
|
||||||
#include <poly/cxx_compat.h>
|
#include <poly/cxx_compat.h>
|
||||||
#include <poly/math.h>
|
#include <poly/math.h>
|
||||||
|
#include <poly/platform.h>
|
||||||
#include <poly/threading.h>
|
#include <poly/threading.h>
|
||||||
|
|
||||||
namespace poly {} // namespace poly
|
namespace poly {} // namespace poly
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Copyright 2014 Ben Vanik. All Rights Reserved.
|
# Copyright 2014 Ben Vanik. All Rights Reserved.
|
||||||
{
|
{
|
||||||
'sources': [
|
'sources': [
|
||||||
|
'config.h',
|
||||||
'cxx_compat.h',
|
'cxx_compat.h',
|
||||||
'math.h',
|
'math.h',
|
||||||
'poly-private.h',
|
'poly-private.h',
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include <poly/config.h>
|
||||||
|
|
||||||
namespace poly {
|
namespace poly {
|
||||||
namespace threading {
|
namespace threading {
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
#include <poly/threading.h>
|
#include <poly/threading.h>
|
||||||
|
|
||||||
|
#include <poly/platform.h>
|
||||||
|
|
||||||
namespace poly {
|
namespace poly {
|
||||||
namespace threading {
|
namespace threading {
|
||||||
|
|
||||||
|
@ -22,7 +24,7 @@ void Sleep(std::chrono::microseconds duration) {
|
||||||
if (duration.count() < 100) {
|
if (duration.count() < 100) {
|
||||||
SwitchToThread();
|
SwitchToThread();
|
||||||
} else {
|
} else {
|
||||||
Sleep(duration.count() / 1000);
|
::Sleep(static_cast<DWORD>(duration.count() / 1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include <xenia/assert.h>
|
#include <xenia/assert.h>
|
||||||
#include <xenia/config.h>
|
#include <xenia/config.h>
|
||||||
#include <xenia/platform.h>
|
#include <xenia/platform.h>
|
||||||
#include <xenia/platform_includes.h>
|
|
||||||
#include <xenia/string.h>
|
#include <xenia/string.h>
|
||||||
#include <xenia/types.h>
|
#include <xenia/types.h>
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,9 @@
|
||||||
#ifndef XENIA_ATOMIC_H_
|
#ifndef XENIA_ATOMIC_H_
|
||||||
#define XENIA_ATOMIC_H_
|
#define XENIA_ATOMIC_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#include <xenia/platform.h>
|
#include <xenia/platform.h>
|
||||||
#include <xenia/platform_includes.h>
|
|
||||||
|
|
||||||
|
|
||||||
// These functions are modeled off of the Apple OSAtomic routines
|
// These functions are modeled off of the Apple OSAtomic routines
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#ifndef XENIA_BYTE_ORDER_H_
|
#ifndef XENIA_BYTE_ORDER_H_
|
||||||
#define XENIA_BYTE_ORDER_H_
|
#define XENIA_BYTE_ORDER_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#include <xenia/platform.h>
|
#include <xenia/platform.h>
|
||||||
#include <xenia/types.h>
|
#include <xenia/types.h>
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include <xenia/logging.h>
|
#include <xenia/logging.h>
|
||||||
#include <xenia/malloc.h>
|
#include <xenia/malloc.h>
|
||||||
#include <xenia/platform.h>
|
#include <xenia/platform.h>
|
||||||
#include <xenia/platform_includes.h>
|
|
||||||
#include <xenia/profiling.h>
|
#include <xenia/profiling.h>
|
||||||
#include <xenia/string.h>
|
#include <xenia/string.h>
|
||||||
#include <xenia/types.h>
|
#include <xenia/types.h>
|
||||||
|
|
|
@ -9,9 +9,10 @@
|
||||||
|
|
||||||
#include <xenia/core/socket.h>
|
#include <xenia/core/socket.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <mstcpip.h>
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#include <mstcpip.h>
|
|
||||||
|
|
||||||
|
|
||||||
// TODO(benvanik): win32 calls
|
// TODO(benvanik): win32 calls
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#define XENIA_GPU_RESOURCE_CACHE_H_
|
#define XENIA_GPU_RESOURCE_CACHE_H_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
#include <xenia/core.h>
|
#include <xenia/core.h>
|
||||||
#include <xenia/gpu/buffer_resource.h>
|
#include <xenia/gpu/buffer_resource.h>
|
||||||
|
|
|
@ -10,11 +10,12 @@
|
||||||
#ifndef XENIA_KERNEL_FS_FILESYSTEM_H_
|
#ifndef XENIA_KERNEL_FS_FILESYSTEM_H_
|
||||||
#define XENIA_KERNEL_FS_FILESYSTEM_H_
|
#define XENIA_KERNEL_FS_FILESYSTEM_H_
|
||||||
|
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <xenia/common.h>
|
#include <xenia/common.h>
|
||||||
#include <xenia/core.h>
|
#include <xenia/core.h>
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <xenia/kernel/fs/entry.h>
|
#include <xenia/kernel/fs/entry.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,9 @@
|
||||||
#ifndef XENIA_LOGGING_H_
|
#ifndef XENIA_LOGGING_H_
|
||||||
#define XENIA_LOGGING_H_
|
#define XENIA_LOGGING_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#include <xenia/platform.h>
|
#include <xenia/platform.h>
|
||||||
#include <xenia/platform_includes.h>
|
|
||||||
#include <xenia/config.h>
|
#include <xenia/config.h>
|
||||||
#include <xenia/string.h>
|
#include <xenia/string.h>
|
||||||
|
|
||||||
|
|
|
@ -10,129 +10,7 @@
|
||||||
#ifndef XENIA_PLATFORM_H_
|
#ifndef XENIA_PLATFORM_H_
|
||||||
#define XENIA_PLATFORM_H_
|
#define XENIA_PLATFORM_H_
|
||||||
|
|
||||||
// NOTE: ordering matters here as sometimes multiple flags are defined on
|
#include <poly/platform.h>
|
||||||
// certain platforms.
|
|
||||||
|
|
||||||
// Great resource on predefined macros: http://predef.sourceforge.net/preos.html
|
|
||||||
|
|
||||||
/*
|
|
||||||
XE_PLATFORM: IOS | OSX | XBOX360 | WINCE | WIN32 | ANDROID | NACL | UNIX
|
|
||||||
XE_LIKE: OSX | WIN32 | POSIX
|
|
||||||
XE_PROFILE: EMBEDDED | DESKTOP (+ _SIMULATOR)
|
|
||||||
XE_COMPILER: GNUC | MSVC | INTEL | UNKNOWN
|
|
||||||
XE_CPU: 32BIT | 64BIT | BIGENDIAN | LITTLEENDIAN
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
#include <TargetConditionals.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED ) || \
|
|
||||||
(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE ) || \
|
|
||||||
(defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)
|
|
||||||
|
|
||||||
#define XE_PLATFORM_IOS 1
|
|
||||||
#define XE_LIKE_OSX 1
|
|
||||||
#define XE_PROFILE_EMBEDDED 1
|
|
||||||
|
|
||||||
#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
|
|
||||||
// EMBEDDED *and* SIMULATOR
|
|
||||||
#define XE_PROFILE_SIMULATOR 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(TARGET_OS_MAC) && TARGET_OS_MAC
|
|
||||||
|
|
||||||
#define XE_PLATFORM_OSX 1
|
|
||||||
#define XE_LIKE_OSX 1
|
|
||||||
#define XE_PROFILE_DESKTOP 1
|
|
||||||
|
|
||||||
#elif defined(_XBOX)
|
|
||||||
|
|
||||||
#define XE_PLATFORM_XBOX360 1
|
|
||||||
#define XE_LIKE_WIN32 1
|
|
||||||
#define XE_PROFILE_EMBEDDED 1
|
|
||||||
|
|
||||||
#elif defined(_WIN32_WCE)
|
|
||||||
|
|
||||||
#define XE_PLATFORM_WINCE 1
|
|
||||||
#define XE_LIKE_WIN32 1
|
|
||||||
#define XE_PROFILE_EMBEDDED 1
|
|
||||||
|
|
||||||
#elif defined(__CYGWIN__)
|
|
||||||
|
|
||||||
#define XE_PLATFORM_CYGWIN 1
|
|
||||||
#define XE_LIKE_POSIX 1
|
|
||||||
#define XE_PROFILE_DESKTOP 1
|
|
||||||
|
|
||||||
#elif defined(WIN32) || defined(_WIN32)
|
|
||||||
|
|
||||||
#define XE_PLATFORM_WIN32 1
|
|
||||||
#define XE_LIKE_WIN32 1
|
|
||||||
#define XE_PROFILE_DESKTOP 1
|
|
||||||
|
|
||||||
#elif defined(ANDROID)
|
|
||||||
|
|
||||||
#define XE_PLATFORM_ANDROID 1
|
|
||||||
#define XE_LIKE_POSIX 1
|
|
||||||
#define XE_PROFILE_EMBEDDED 1
|
|
||||||
|
|
||||||
#elif defined(__native_client__)
|
|
||||||
|
|
||||||
#define XE_PLATFORM_NACL 1
|
|
||||||
#define XE_LIKE_POSIX 1
|
|
||||||
#define XE_PROFILE_DESKTOP 1
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define XE_PLATFORM_UNIX 1
|
|
||||||
#define XE_LIKE_POSIX 1
|
|
||||||
#define XE_PROFILE_DESKTOP 1
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
#define XE_COMPILER_GNUC 1
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#define XE_COMPILER_MSVC 1
|
|
||||||
#elif defined(__MINGW32)
|
|
||||||
#define XE_COMPILER_MINGW32 1
|
|
||||||
#elif defined(__INTEL_COMPILER)
|
|
||||||
#define XE_COMPILER_INTEL 1
|
|
||||||
#else
|
|
||||||
#define XE_COMPILER_UNKNOWN 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__ia64__) || defined(_M_IA64) || \
|
|
||||||
defined(__ppc64__) || defined(__PPC64__) || \
|
|
||||||
defined(__arch64__) || \
|
|
||||||
defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || \
|
|
||||||
defined(__LP64__) || defined(__LLP64) || \
|
|
||||||
defined(_WIN64) || \
|
|
||||||
(__WORDSIZE == 64)
|
|
||||||
#define XE_CPU_64BIT 1
|
|
||||||
#else
|
|
||||||
#define XE_CPU_32BIT 1
|
|
||||||
#endif // [64bit flags]
|
|
||||||
|
|
||||||
#if defined(__ppc__) || defined(__PPC__) || defined(__powerpc__) || defined(__powerpc) || defined(__POWERPC__) || defined(_M_PPC) || defined(__PPC) || \
|
|
||||||
defined(__ppc64__) || defined(__PPC64__) || \
|
|
||||||
defined(__ARMEB__) || \
|
|
||||||
defined(__BIG_ENDIAN) || defined(__BIG_ENDIAN__)
|
|
||||||
#define XE_CPU_BIGENDIAN 1
|
|
||||||
#else
|
|
||||||
#define XE_CPU_LITTLEENDIAN 1
|
|
||||||
#endif // [big endian flags]
|
|
||||||
|
|
||||||
#if defined(DEBUG) || defined(_DEBUG)
|
|
||||||
#define XE_DEBUG 1
|
|
||||||
#endif // DEBUG
|
|
||||||
|
|
||||||
#if XE_CPU_32BIT
|
|
||||||
#define XE_ALIGNMENT 8
|
|
||||||
#else
|
|
||||||
#define XE_ALIGNMENT 16
|
|
||||||
#endif // 32BIT
|
|
||||||
|
|
||||||
bool xe_has_console();
|
bool xe_has_console();
|
||||||
#if XE_LIKE_WIN32 && defined(UNICODE) && UNICODE
|
#if XE_LIKE_WIN32 && defined(UNICODE) && UNICODE
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* Xenia : Xbox 360 Emulator Research Project *
|
|
||||||
******************************************************************************
|
|
||||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
|
||||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef XENIA_PLATFORM_INCLUDES_H_
|
|
||||||
#define XENIA_PLATFORM_INCLUDES_H_
|
|
||||||
|
|
||||||
#include <xenia/platform.h>
|
|
||||||
|
|
||||||
|
|
||||||
#if XE_PLATFORM_WINCE || XE_PLATFORM_WIN32
|
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
|
||||||
#include <SDKDDKVer.h>
|
|
||||||
#include <windows.h>
|
|
||||||
#include <ObjBase.h>
|
|
||||||
#undef min
|
|
||||||
#undef max
|
|
||||||
#endif // WINCE || WIN32
|
|
||||||
|
|
||||||
#if XE_PLATFORM_XBOX360
|
|
||||||
#include <xtl.h>
|
|
||||||
#include <xboxmath.h>
|
|
||||||
#endif // XBOX360
|
|
||||||
|
|
||||||
#if XE_COMPILER_MSVC
|
|
||||||
// Disable warning C4068: unknown pragma
|
|
||||||
#pragma warning(disable : 4068)
|
|
||||||
#endif // MSVC
|
|
||||||
|
|
||||||
#if XE_LIKE_POSIX
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <endian.h>
|
|
||||||
#endif // POSIX
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <float.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <locale.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <string>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <unordered_map>
|
|
||||||
|
|
||||||
|
|
||||||
#endif // XENIA_PLATFORM_INCLUDES_H_
|
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
#include <xenia/config.h>
|
#include <xenia/config.h>
|
||||||
#include <xenia/platform.h>
|
#include <xenia/platform.h>
|
||||||
#include <xenia/platform_includes.h>
|
|
||||||
#include <xenia/string.h>
|
#include <xenia/string.h>
|
||||||
#include <xenia/types.h>
|
#include <xenia/types.h>
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
'malloc.h',
|
'malloc.h',
|
||||||
'platform.cc',
|
'platform.cc',
|
||||||
'platform.h',
|
'platform.h',
|
||||||
'platform_includes.h',
|
|
||||||
'profiling.cc',
|
'profiling.cc',
|
||||||
'profiling.h',
|
'profiling.h',
|
||||||
'string.cc',
|
'string.cc',
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#define XENIA_STRING_H_
|
#define XENIA_STRING_H_
|
||||||
|
|
||||||
#include <xenia/platform.h>
|
#include <xenia/platform.h>
|
||||||
#include <xenia/platform_includes.h>
|
|
||||||
|
|
||||||
|
|
||||||
// NOTE: these differing implementations should behave pretty much the same.
|
// NOTE: these differing implementations should behave pretty much the same.
|
||||||
|
|
|
@ -10,14 +10,9 @@
|
||||||
#ifndef XENIA_TYPES_H_
|
#ifndef XENIA_TYPES_H_
|
||||||
#define XENIA_TYPES_H_
|
#define XENIA_TYPES_H_
|
||||||
|
|
||||||
#include <xenia/platform.h>
|
#include <cstdint>
|
||||||
#include <xenia/platform_includes.h>
|
|
||||||
|
|
||||||
namespace xe {
|
#include <xenia/platform.h>
|
||||||
// TODO(benvanik): support other compilers/etc
|
|
||||||
using std::auto_ptr;
|
|
||||||
using std::shared_ptr;
|
|
||||||
} // namespace xe
|
|
||||||
|
|
||||||
|
|
||||||
#define XE_EMPTY_MACRO do { } while(0)
|
#define XE_EMPTY_MACRO do { } while(0)
|
||||||
|
|
Loading…
Reference in New Issue