diff options
| author | 2015-02-18 22:46:21 -0800 | |
|---|---|---|
| committer | 2015-02-19 22:26:25 -0800 | |
| commit | 4fb75d220aeaa66d3e907cc2311acf6c29433800 (patch) | |
| tree | 8fa12b7d7dd3fde83ce126c0ffe3c8011d839f4f /src/common/common.h | |
| parent | Remove duplication of INSERT_PADDING_WORDS between pica.h and gpu.h (diff) | |
| download | yuzu-4fb75d220aeaa66d3e907cc2311acf6c29433800.tar.gz yuzu-4fb75d220aeaa66d3e907cc2311acf6c29433800.tar.xz yuzu-4fb75d220aeaa66d3e907cc2311acf6c29433800.zip | |
Misc cleanup of common and related functions
Diffstat (limited to 'src/common/common.h')
| -rw-r--r-- | src/common/common.h | 72 |
1 files changed, 22 insertions, 50 deletions
diff --git a/src/common/common.h b/src/common/common.h index f5f2f8c34..948dc536a 100644 --- a/src/common/common.h +++ b/src/common/common.h | |||
| @@ -35,13 +35,11 @@ private: | |||
| 35 | #ifdef __APPLE__ | 35 | #ifdef __APPLE__ |
| 36 | // The Darwin ABI requires that stack frames be aligned to 16-byte boundaries. | 36 | // The Darwin ABI requires that stack frames be aligned to 16-byte boundaries. |
| 37 | // This is only needed on i386 gcc - x86_64 already aligns to 16 bytes. | 37 | // This is only needed on i386 gcc - x86_64 already aligns to 16 bytes. |
| 38 | #if defined __i386__ && defined __GNUC__ | 38 | #if defined __i386__ && defined __GNUC__ |
| 39 | #undef STACKALIGN | 39 | #undef STACKALIGN |
| 40 | #define STACKALIGN __attribute__((__force_align_arg_pointer__)) | 40 | #define STACKALIGN __attribute__((__force_align_arg_pointer__)) |
| 41 | #endif | 41 | #endif |
| 42 | |||
| 43 | #elif defined _WIN32 | 42 | #elif defined _WIN32 |
| 44 | |||
| 45 | // Check MSC ver | 43 | // Check MSC ver |
| 46 | #if defined _MSC_VER && _MSC_VER <= 1000 | 44 | #if defined _MSC_VER && _MSC_VER <= 1000 |
| 47 | #error needs at least version 1000 of MSC | 45 | #error needs at least version 1000 of MSC |
| @@ -51,9 +49,6 @@ private: | |||
| 51 | #define NOMINMAX | 49 | #define NOMINMAX |
| 52 | #endif | 50 | #endif |
| 53 | 51 | ||
| 54 | // Memory leak checks | ||
| 55 | #define CHECK_HEAP_INTEGRITY() | ||
| 56 | |||
| 57 | // Alignment | 52 | // Alignment |
| 58 | #define MEMORY_ALIGNED16(x) __declspec(align(16)) x | 53 | #define MEMORY_ALIGNED16(x) __declspec(align(16)) x |
| 59 | #define MEMORY_ALIGNED32(x) __declspec(align(32)) x | 54 | #define MEMORY_ALIGNED32(x) __declspec(align(32)) x |
| @@ -61,57 +56,34 @@ private: | |||
| 61 | #define MEMORY_ALIGNED128(x) __declspec(align(128)) x | 56 | #define MEMORY_ALIGNED128(x) __declspec(align(128)) x |
| 62 | #define MEMORY_ALIGNED16_DECL(x) __declspec(align(16)) x | 57 | #define MEMORY_ALIGNED16_DECL(x) __declspec(align(16)) x |
| 63 | #define MEMORY_ALIGNED64_DECL(x) __declspec(align(64)) x | 58 | #define MEMORY_ALIGNED64_DECL(x) __declspec(align(64)) x |
| 64 | |||
| 65 | // Since they are always around on windows | ||
| 66 | #define HAVE_WX 1 | ||
| 67 | #define HAVE_OPENAL 1 | ||
| 68 | |||
| 69 | #define HAVE_PORTAUDIO 1 | ||
| 70 | |||
| 71 | // Debug definitions | ||
| 72 | #if defined(_DEBUG) | ||
| 73 | #include <crtdbg.h> | ||
| 74 | #undef CHECK_HEAP_INTEGRITY | ||
| 75 | #define CHECK_HEAP_INTEGRITY() {if (!_CrtCheckMemory()) PanicAlert("memory corruption detected. see log.");} | ||
| 76 | // If you want to see how much a pain in the ass singletons are, for example: | ||
| 77 | // {614} normal block at 0x030C5310, 188 bytes long. | ||
| 78 | // Data: <Master Log > 4D 61 73 74 65 72 20 4C 6F 67 00 00 00 00 00 00 | ||
| 79 | struct CrtDebugBreak { CrtDebugBreak(int spot) { _CrtSetBreakAlloc(spot); } }; | ||
| 80 | //CrtDebugBreak breakAt(614); | ||
| 81 | #endif // end DEBUG/FAST | ||
| 82 | |||
| 83 | #endif | 59 | #endif |
| 84 | 60 | ||
| 85 | // Windows compatibility | 61 | // Windows compatibility |
| 86 | #ifndef _WIN32 | 62 | #ifndef _WIN32 |
| 87 | #ifdef _LP64 | 63 | #ifdef _LP64 |
| 88 | #define _M_X64 1 | 64 | #define _M_X64 1 |
| 89 | #else | 65 | #else |
| 90 | #define _M_IX86 1 | 66 | #define _M_IX86 1 |
| 91 | #endif | 67 | #endif |
| 92 | #define __forceinline inline __attribute__((always_inline)) | 68 | #define __forceinline inline __attribute__((always_inline)) |
| 93 | #define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x | 69 | #define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x |
| 94 | #define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x | 70 | #define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x |
| 95 | #define MEMORY_ALIGNED64(x) __attribute__((aligned(64))) x | 71 | #define MEMORY_ALIGNED64(x) __attribute__((aligned(64))) x |
| 96 | #define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x | 72 | #define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x |
| 97 | #define MEMORY_ALIGNED16_DECL(x) __attribute__((aligned(16))) x | 73 | #define MEMORY_ALIGNED16_DECL(x) __attribute__((aligned(16))) x |
| 98 | #define MEMORY_ALIGNED64_DECL(x) __attribute__((aligned(64))) x | 74 | #define MEMORY_ALIGNED64_DECL(x) __attribute__((aligned(64))) x |
| 99 | #endif | 75 | #endif |
| 100 | 76 | ||
| 101 | #ifdef _MSC_VER | 77 | #ifdef _MSC_VER |
| 102 | #define __strdup _strdup | 78 | #define __strdup _strdup |
| 103 | #define __getcwd _getcwd | 79 | #define __getcwd _getcwd |
| 104 | #define __chdir _chdir | 80 | #define __chdir _chdir |
| 105 | #else | 81 | #else |
| 106 | #define __strdup strdup | 82 | #define __strdup strdup |
| 107 | #define __getcwd getcwd | 83 | #define __getcwd getcwd |
| 108 | #define __chdir chdir | 84 | #define __chdir chdir |
| 109 | #endif | 85 | #endif |
| 110 | 86 | ||
| 111 | // Dummy macro for marking translatable strings that can not be immediately translated. | ||
| 112 | // wxWidgets does not have a true dummy macro for this. | ||
| 113 | #define _trans(a) a | ||
| 114 | |||
| 115 | #if defined _M_GENERIC | 87 | #if defined _M_GENERIC |
| 116 | # define _M_SSE 0x0 | 88 | # define _M_SSE 0x0 |
| 117 | #elif defined __GNUC__ | 89 | #elif defined __GNUC__ |