diff --git a/src/poly/assert.h b/src/poly/assert.h index 1063e84e5..5fbc77a9d 100644 --- a/src/poly/assert.h +++ b/src/poly/assert.h @@ -12,7 +12,6 @@ #include -#include "poly/config.h" #include "poly/platform.h" namespace poly { diff --git a/src/poly/atomic.h b/src/poly/atomic.h index ee6e19a50..9462a445a 100644 --- a/src/poly/atomic.h +++ b/src/poly/atomic.h @@ -12,19 +12,18 @@ #include -#include "poly/config.h" #include "poly/platform.h" -#if XE_LIKE_OSX +#if XE_PLATFORM_MAC #include -#endif // XE_LIKE_OSX +#endif // XE_PLATFORM_MAC namespace poly { // These functions are modeled off of the Apple OSAtomic routines // http://developer.apple.com/library/mac/#documentation/DriversKernelHardware/Reference/libkern_ref/OSAtomic_h/ -#if XE_LIKE_OSX +#if XE_PLATFORM_MAC inline int32_t atomic_inc(volatile int32_t* value) { return OSAtomicIncrement32Barrier(reinterpret_cast(value)); @@ -58,7 +57,7 @@ inline bool atomic_cas(int64_t old_value, int64_t new_value, old_value, new_value, reinterpret_cast(value)); } -#elif XE_LIKE_WIN32 +#elif XE_PLATFORM_WIN32 inline int32_t atomic_inc(volatile int32_t* value) { return InterlockedIncrement(reinterpret_cast(value)); @@ -96,7 +95,7 @@ inline bool atomic_cas(int64_t old_value, int64_t new_value, new_value, old_value) == old_value; } -#elif XE_LIKE_POSIX +#elif XE_PLATFORM_LINUX inline int32_t atomic_inc(volatile int32_t* value) { return __sync_add_and_fetch(value, 1); diff --git a/src/poly/byte_order.h b/src/poly/byte_order.h index 1a4d19352..cd7972e6e 100644 --- a/src/poly/byte_order.h +++ b/src/poly/byte_order.h @@ -12,12 +12,11 @@ #include -#include "poly/config.h" #include "poly/platform.h" -#if XE_LIKE_OSX +#if XE_PLATFORM_MAC #include -#endif // XE_LIKE_OSX +#endif // XE_PLATFORM_MAC namespace poly { @@ -25,7 +24,7 @@ namespace poly { #define POLY_BYTE_SWAP_16 _byteswap_ushort #define POLY_BYTE_SWAP_32 _byteswap_ulong #define POLY_BYTE_SWAP_64 _byteswap_uint64 -#elif XE_LIKE_OSX +#elif XE_PLATFORM_MAC #define POLY_BYTE_SWAP_16 OSSwapInt16 #define POLY_BYTE_SWAP_32 OSSwapInt32 #define POLY_BYTE_SWAP_64 OSSwapInt64 diff --git a/src/poly/config.h b/src/poly/config.h deleted file mode 100644 index bdba0f17b..000000000 --- a/src/poly/config.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - ****************************************************************************** - * 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_ diff --git a/src/poly/cxx_compat.h b/src/poly/cxx_compat.h index 74551bbe3..50f9b7a19 100644 --- a/src/poly/cxx_compat.h +++ b/src/poly/cxx_compat.h @@ -12,7 +12,6 @@ #include -#include "poly/config.h" // C++11 thread local storage. // http://en.cppreference.com/w/cpp/language/storage_duration @@ -20,7 +19,7 @@ // VC++2014 may have this. #define _ALLOW_KEYWORD_MACROS 1 #define thread_local __declspec(thread) -#elif XE_LIKE_OSX +#elif XE_PLATFORM_MAC // Clang supports it on OSX but the runtime doesn't. #define thread_local __thread #endif // XE_COMPILER_MSVC diff --git a/src/poly/debugging.h b/src/poly/debugging.h index 543c38f56..0c3c260dd 100644 --- a/src/poly/debugging.h +++ b/src/poly/debugging.h @@ -12,7 +12,6 @@ #include -#include "poly/config.h" namespace poly { namespace debugging { diff --git a/src/poly/fs.h b/src/poly/fs.h index 9d23637e9..0d1edea9e 100644 --- a/src/poly/fs.h +++ b/src/poly/fs.h @@ -12,7 +12,6 @@ #include -#include "poly/config.h" #include "poly/string.h" #include diff --git a/src/poly/logging.cc b/src/poly/logging.cc index a00ab61df..864766063 100644 --- a/src/poly/logging.cc +++ b/src/poly/logging.cc @@ -120,7 +120,7 @@ void handle_fatal(const char* file_path, const uint32_t line_number, log_lock.unlock(); } -#if XE_LIKE_WIN32 +#if XE_PLATFORM_WIN32 if (!poly::has_console_attached()) { MessageBoxA(NULL, buffer, "Xenia Error", MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND); diff --git a/src/poly/math.h b/src/poly/math.h index 601ab6420..6216985a5 100644 --- a/src/poly/math.h +++ b/src/poly/math.h @@ -17,7 +17,6 @@ #include #include -#include "poly/config.h" #include "poly/platform.h" namespace poly { @@ -120,11 +119,12 @@ inline uint8_t lzcnt(int64_t v) { return lzcnt(static_cast(v)); } // Returns false if no bits are set and the output index is invalid. #if XE_COMPILER_MSVC inline bool bit_scan_forward(uint32_t v, uint32_t* out_first_set_index) { - return _BitScanForward(reinterpret_cast(out_first_set_index), v) != 0; + return _BitScanForward(reinterpret_cast(out_first_set_index), + v) != 0; } inline bool bit_scan_forward(uint64_t v, uint32_t* out_first_set_index) { - return _BitScanForward64(reinterpret_cast(out_first_set_index), v) != - 0; + return _BitScanForward64( + reinterpret_cast(out_first_set_index), v) != 0; } #else inline bool bit_scan_forward(uint32_t v, uint32_t* out_first_set_index) { diff --git a/src/poly/memory.cc b/src/poly/memory.cc index 7514663d4..08e3f8901 100644 --- a/src/poly/memory.cc +++ b/src/poly/memory.cc @@ -11,22 +11,22 @@ #include -#if !XE_LIKE_WIN32 +#if !XE_PLATFORM_WIN32 #include -#endif // !XE_LIKE_WIN32 +#endif // !XE_PLATFORM_WIN32 namespace poly { size_t page_size() { static size_t value = 0; if (!value) { -#if XE_LIKE_WIN32 +#if XE_PLATFORM_WIN32 SYSTEM_INFO si; GetSystemInfo(&si); value = si.dwPageSize; #else value = getpagesize(); -#endif // XE_LIKE_WIN32 +#endif // XE_PLATFORM_WIN32 } return value; } diff --git a/src/poly/platform.h b/src/poly/platform.h index 9dc5de3ab..f039962a2 100644 --- a/src/poly/platform.h +++ b/src/poly/platform.h @@ -15,79 +15,16 @@ // 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 #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 - +#if defined(TARGET_OS_MAC) && TARGET_OS_MAC +#define XE_PLATFORM_MAC 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 - +#define XE_PLATFORM_LINUX 1 #endif #if defined(__clang__) @@ -104,26 +41,7 @@ XE_CPU: 32BIT | 64BIT | BIGENDIAN | LITTLEENDIAN #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_PLATFORM_WINCE || XE_PLATFORM_WIN32 +#if XE_PLATFORM_WIN32 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif @@ -132,19 +50,10 @@ XE_CPU: 32BIT | 64BIT | BIGENDIAN | LITTLEENDIAN #include #undef min #undef max -#undef Yield #define strdup _strdup -#endif // WINCE || WIN32 - -#if XE_PLATFORM_XBOX360 -#include -#include -#endif // XBOX360 - -#if XE_COMPILER_MSVC -// Disable warning C4068: unknown pragma -#pragma warning(disable : 4068) -#endif // XE_COMPILER_MSVC +#define strcasecmp _stricmp +#define strncasecmp _strnicmp +#endif // XE_PLATFORM_WIN32 #if XE_COMPILER_MSVC #include @@ -152,20 +61,15 @@ XE_CPU: 32BIT | 64BIT | BIGENDIAN | LITTLEENDIAN #include #endif // XE_COMPILER_MSVC -#if XE_LIKE_WIN32 -#define strcasecmp _stricmp -#define strncasecmp _strnicmp -#endif // XE_LIKE_WIN32 - namespace poly { -#if XE_LIKE_WIN32 +#if XE_PLATFORM_WIN32 const char path_separator = '\\'; const size_t max_path = _MAX_PATH; #else const char path_separator = '/'; const size_t max_path = 1024; // PATH_MAX -#endif // XE_LIKE_WIN32 +#endif // XE_PLATFORM_WIN32 } // namespace poly diff --git a/src/poly/poly.h b/src/poly/poly.h index a996ca06d..88dab551d 100644 --- a/src/poly/poly.h +++ b/src/poly/poly.h @@ -13,7 +13,6 @@ #include "poly/assert.h" #include "poly/atomic.h" #include "poly/byte_order.h" -#include "poly/config.h" #include "poly/cxx_compat.h" #include "poly/debugging.h" #include "poly/logging.h" diff --git a/src/poly/sources.gypi b/src/poly/sources.gypi index e41d21672..e92720344 100644 --- a/src/poly/sources.gypi +++ b/src/poly/sources.gypi @@ -8,7 +8,6 @@ 'byte_order.h', 'debugging.h', 'delegate.h', - 'config.h', 'cxx_compat.h', 'fs.h', 'fs.cc', diff --git a/src/poly/string.cc b/src/poly/string.cc index 6d214cde7..615e41973 100644 --- a/src/poly/string.cc +++ b/src/poly/string.cc @@ -41,7 +41,7 @@ std::string::size_type find_first_of_case(const std::string& target, } std::wstring to_absolute_path(const std::wstring& path) { -#if XE_LIKE_WIN32 +#if XE_PLATFORM_WIN32 wchar_t buffer[poly::max_path]; _wfullpath(buffer, path.c_str(), sizeof(buffer) / sizeof(wchar_t)); return buffer; @@ -49,7 +49,7 @@ std::wstring to_absolute_path(const std::wstring& path) { char buffer[poly::max_path]; realpath(poly::to_string(path).c_str(), buffer); return poly::to_wstring(buffer); -#endif // XE_LIKE_WIN32 +#endif // XE_PLATFORM_WIN32 } std::vector split_path(const std::string& path) { diff --git a/src/poly/threading.h b/src/poly/threading.h index 9d3c16efa..d78010c88 100644 --- a/src/poly/threading.h +++ b/src/poly/threading.h @@ -18,7 +18,6 @@ #include #include -#include "poly/config.h" namespace poly { namespace threading { diff --git a/src/xenia/cpu/backend/x64/x64_emitter.cc b/src/xenia/cpu/backend/x64/x64_emitter.cc index ff995b9b1..ea9a0c821 100644 --- a/src/xenia/cpu/backend/x64/x64_emitter.cc +++ b/src/xenia/cpu/backend/x64/x64_emitter.cc @@ -426,12 +426,12 @@ uint64_t ResolveFunctionSymbol(void* raw_context, uint64_t symbol_info_ptr) { // Overwrite the call site. // The return address points to ReloadRCX work after the call. -#if XE_LIKE_WIN32 +#if XE_PLATFORM_WIN32 uint64_t return_address = reinterpret_cast(_ReturnAddress()); #else uint64_t return_address = reinterpret_cast(__builtin_return_address(0)); -#endif // XE_LIKE_WIN32 +#endif // XE_PLATFORM_WIN32 #pragma pack(push, 1) struct Asm { uint16_t mov_rax; @@ -507,12 +507,12 @@ uint64_t ResolveFunctionAddress(void* raw_context, uint32_t target_address) { uint64_t addr = reinterpret_cast(x64_fn->machine_code()); // Add an IC slot, if there is room. -#if XE_LIKE_WIN32 +#if XE_PLATFORM_WIN32 uint64_t return_address = reinterpret_cast(_ReturnAddress()); #else uint64_t return_address = reinterpret_cast(__builtin_return_address(0)); -#endif // XE_LIKE_WIN32 +#endif // XE_PLATFORM_WIN32 #pragma pack(push, 1) struct Asm { uint16_t cmp_rdx; diff --git a/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.cc b/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.cc index 846667410..eef422601 100644 --- a/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.cc +++ b/src/xenia/cpu/frontend/test/xe-cpu-ppc-test.cc @@ -15,7 +15,7 @@ #include "poly/main.h" #include "poly/poly.h" -#if !XE_LIKE_WIN32 +#if !XE_PLATFORM_WIN32 #include #endif // !WIN32 #include @@ -319,7 +319,7 @@ class TestRunner { bool DiscoverTests(std::wstring& test_path, std::vector& test_files) { // TODO(benvanik): use PAL instead of this. -#if XE_LIKE_WIN32 +#if XE_PLATFORM_WIN32 std::wstring search_path = test_path; search_path.append(L"\\*.s"); WIN32_FIND_DATA ffd; diff --git a/src/xenia/cpu/test/xe-cpu-hir-test.cc b/src/xenia/cpu/test/xe-cpu-hir-test.cc index f204929d4..f812a5b40 100644 --- a/src/xenia/cpu/test/xe-cpu-hir-test.cc +++ b/src/xenia/cpu/test/xe-cpu-hir-test.cc @@ -29,12 +29,12 @@ int main(std::vector& args) { } int ret = Catch::Session().run(int(args.size()), narrow_argv); if (ret) { -#if XE_LIKE_WIN32 +#if XE_PLATFORM_WIN32 // Visual Studio kills the console on shutdown, so prevent that. if (poly::debugging::IsDebuggerAttached()) { poly::debugging::Break(); } -#endif // XE_LIKE_WIN32 +#endif // XE_PLATFORM_WIN32 } return ret; } diff --git a/src/xenia/kernel/objects/xthread.cc b/src/xenia/kernel/objects/xthread.cc index 9261db770..3181a0b7e 100644 --- a/src/xenia/kernel/objects/xthread.cc +++ b/src/xenia/kernel/objects/xthread.cc @@ -294,7 +294,7 @@ X_STATUS XThread::PlatformCreate() { int result_code; if (creation_params_.creation_flags & 0x1) { -#if XE_PLATFORM_OSX +#if XE_PLATFORM_MAC result_code = pthread_create_suspended_np( reinterpret_cast(&thread_handle_), &attr, &XThreadStartCallbackPthreads, this); diff --git a/src/xenia/profiling.h b/src/xenia/profiling.h index 6ec644c5c..07be0bb0d 100644 --- a/src/xenia/profiling.h +++ b/src/xenia/profiling.h @@ -15,9 +15,9 @@ #include "poly/string.h" #define XE_OPTION_PROFILING 1 -#if XE_LIKE_WIN32 +#if XE_PLATFORM_WIN32 #define XE_OPTION_PROFILING_UI 1 -#endif // XE_LIKE_WIN32 +#endif // XE_PLATFORM_WIN32 #if XE_OPTION_PROFILING // Pollutes the global namespace. Yuck. diff --git a/xenia.gyp b/xenia.gyp index 6d74b5c85..c5e1ba241 100644 --- a/xenia.gyp +++ b/xenia.gyp @@ -138,7 +138,7 @@ 'inherit_from': ['common_base',], 'defines': [ 'DEBUG', - 'ASMJIT_DEBUG=', + 'XE_DEBUG=1', ], 'msvs_configuration_attributes': { 'OutputDirectory': '<(DEPTH)\\build\\xenia\\Debug',