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