diff options
Diffstat (limited to 'src/common')
48 files changed, 135 insertions, 88 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 15989708d..3c3419bbc 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -49,6 +49,7 @@ set(HEADERS | |||
| 49 | logging/filter.h | 49 | logging/filter.h |
| 50 | logging/log.h | 50 | logging/log.h |
| 51 | logging/backend.h | 51 | logging/backend.h |
| 52 | make_unique.h | ||
| 52 | math_util.h | 53 | math_util.h |
| 53 | mem_arena.h | 54 | mem_arena.h |
| 54 | memory_util.h | 55 | memory_util.h |
diff --git a/src/common/bit_field.h b/src/common/bit_field.h index 9e02210f9..8eab054b8 100644 --- a/src/common/bit_field.h +++ b/src/common/bit_field.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // Licensed under GPLv2 | 1 | // Licensed under GPLv2 or any later version |
| 2 | // Refer to the license.txt file included. | 2 | // Refer to the license.txt file included. |
| 3 | 3 | ||
| 4 | 4 | ||
| @@ -142,7 +142,7 @@ public: | |||
| 142 | 142 | ||
| 143 | __forceinline BitField& operator=(T val) | 143 | __forceinline BitField& operator=(T val) |
| 144 | { | 144 | { |
| 145 | storage = (storage & ~GetMask()) | (((StorageType)val << position) & GetMask()); | 145 | Assign(val); |
| 146 | return *this; | 146 | return *this; |
| 147 | } | 147 | } |
| 148 | 148 | ||
| @@ -151,6 +151,10 @@ public: | |||
| 151 | return Value(); | 151 | return Value(); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | __forceinline void Assign(const T& value) { | ||
| 155 | storage = (storage & ~GetMask()) | (((StorageType)value << position) & GetMask()); | ||
| 156 | } | ||
| 157 | |||
| 154 | __forceinline T Value() const | 158 | __forceinline T Value() const |
| 155 | { | 159 | { |
| 156 | if (std::numeric_limits<T>::is_signed) | 160 | if (std::numeric_limits<T>::is_signed) |
| @@ -164,6 +168,12 @@ public: | |||
| 164 | } | 168 | } |
| 165 | } | 169 | } |
| 166 | 170 | ||
| 171 | // TODO: we may want to change this to explicit operator bool() if it's bug-free in VS2015 | ||
| 172 | __forceinline bool ToBool() const | ||
| 173 | { | ||
| 174 | return Value() != 0; | ||
| 175 | } | ||
| 176 | |||
| 167 | private: | 177 | private: |
| 168 | // StorageType is T for non-enum types and the underlying type of T if | 178 | // StorageType is T for non-enum types and the underlying type of T if |
| 169 | // T is an enumeration. Note that T is wrapped within an enable_if in the | 179 | // T is an enumeration. Note that T is wrapped within an enable_if in the |
diff --git a/src/common/break_points.cpp b/src/common/break_points.cpp index 587dbf40a..6696935fa 100644 --- a/src/common/break_points.cpp +++ b/src/common/break_points.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/common.h" | 5 | #include "common/common.h" |
diff --git a/src/common/break_points.h b/src/common/break_points.h index cf3884fbc..5557cd50e 100644 --- a/src/common/break_points.h +++ b/src/common/break_points.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/common.h b/src/common/common.h index 9f3016d34..66f0ccd0c 100644 --- a/src/common/common.h +++ b/src/common/common.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 67b3679b0..ca7abbea6 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/common_paths.h b/src/common/common_paths.h index 42e1a29c1..9d62a8368 100644 --- a/src/common/common_paths.h +++ b/src/common/common_paths.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| @@ -40,7 +40,9 @@ | |||
| 40 | #define MAPS_DIR "maps" | 40 | #define MAPS_DIR "maps" |
| 41 | #define CACHE_DIR "cache" | 41 | #define CACHE_DIR "cache" |
| 42 | #define SDMC_DIR "sdmc" | 42 | #define SDMC_DIR "sdmc" |
| 43 | #define SAVEDATA_DIR "savedata" | ||
| 43 | #define SYSDATA_DIR "sysdata" | 44 | #define SYSDATA_DIR "sysdata" |
| 45 | #define SYSSAVEDATA_DIR "syssavedata" | ||
| 44 | #define SHADERCACHE_DIR "shader_cache" | 46 | #define SHADERCACHE_DIR "shader_cache" |
| 45 | #define STATESAVES_DIR "state_saves" | 47 | #define STATESAVES_DIR "state_saves" |
| 46 | #define SCREENSHOTS_DIR "screenShots" | 48 | #define SCREENSHOTS_DIR "screenShots" |
diff --git a/src/common/concurrent_ring_buffer.h b/src/common/concurrent_ring_buffer.h index 2951d93db..311bb01f4 100644 --- a/src/common/concurrent_ring_buffer.h +++ b/src/common/concurrent_ring_buffer.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2+ | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/cpu_detect.h b/src/common/cpu_detect.h index def6afdee..b585f9608 100644 --- a/src/common/cpu_detect.h +++ b/src/common/cpu_detect.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | 5 | ||
diff --git a/src/common/emu_window.cpp b/src/common/emu_window.cpp index 7a2c50ac8..4ec7b263a 100644 --- a/src/common/emu_window.cpp +++ b/src/common/emu_window.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "emu_window.h" | 5 | #include "emu_window.h" |
diff --git a/src/common/emu_window.h b/src/common/emu_window.h index 4cb94fed1..1ad4b82a3 100644 --- a/src/common/emu_window.h +++ b/src/common/emu_window.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/file_search.cpp b/src/common/file_search.cpp index bfb54ce72..b3a0a84fb 100644 --- a/src/common/file_search.cpp +++ b/src/common/file_search.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | 5 | ||
diff --git a/src/common/file_search.h b/src/common/file_search.h index f966a008d..55ca02638 100644 --- a/src/common/file_search.h +++ b/src/common/file_search.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 88c46c117..bba830c70 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | 5 | ||
| @@ -676,7 +676,9 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new | |||
| 676 | paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP; | 676 | paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP; |
| 677 | paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; | 677 | paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; |
| 678 | paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; | 678 | paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; |
| 679 | paths[D_SAVEDATA_IDX] = paths[D_USER_IDX] + SAVEDATA_DIR DIR_SEP; | ||
| 679 | paths[D_SYSDATA_IDX] = paths[D_USER_IDX] + SYSDATA_DIR DIR_SEP; | 680 | paths[D_SYSDATA_IDX] = paths[D_USER_IDX] + SYSDATA_DIR DIR_SEP; |
| 681 | paths[D_SYSSAVEDATA_IDX] = paths[D_USER_IDX] + SYSSAVEDATA_DIR DIR_SEP; | ||
| 680 | paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP; | 682 | paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP; |
| 681 | paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP; | 683 | paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP; |
| 682 | paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP; | 684 | paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP; |
| @@ -718,6 +720,8 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new | |||
| 718 | paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP; | 720 | paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP; |
| 719 | paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; | 721 | paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; |
| 720 | paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; | 722 | paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; |
| 723 | paths[D_SAVEDATA_IDX] = paths[D_USER_IDX] + SAVEDATA_DIR DIR_SEP; | ||
| 724 | paths[D_SYSSAVEDATA_IDX] = paths[D_USER_IDX] + SYSSAVEDATA_DIR DIR_SEP; | ||
| 721 | paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP; | 725 | paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP; |
| 722 | paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP; | 726 | paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP; |
| 723 | paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP; | 727 | paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP; |
diff --git a/src/common/file_util.h b/src/common/file_util.h index a9d48cfe8..293c30941 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| @@ -27,7 +27,9 @@ enum { | |||
| 27 | D_STATESAVES_IDX, | 27 | D_STATESAVES_IDX, |
| 28 | D_SCREENSHOTS_IDX, | 28 | D_SCREENSHOTS_IDX, |
| 29 | D_SDMC_IDX, | 29 | D_SDMC_IDX, |
| 30 | D_SAVEDATA_IDX, | ||
| 30 | D_SYSDATA_IDX, | 31 | D_SYSDATA_IDX, |
| 32 | D_SYSSAVEDATA_IDX, | ||
| 31 | D_HIRESTEXTURES_IDX, | 33 | D_HIRESTEXTURES_IDX, |
| 32 | D_DUMP_IDX, | 34 | D_DUMP_IDX, |
| 33 | D_DUMPFRAMES_IDX, | 35 | D_DUMPFRAMES_IDX, |
diff --git a/src/common/hash.cpp b/src/common/hash.cpp index 2ddcfe6b7..fe2c9e636 100644 --- a/src/common/hash.cpp +++ b/src/common/hash.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | 5 | ||
diff --git a/src/common/hash.h b/src/common/hash.h index 29f699d7f..3ac42bc44 100644 --- a/src/common/hash.h +++ b/src/common/hash.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/key_map.cpp b/src/common/key_map.cpp index 309caab98..d8945bb13 100644 --- a/src/common/key_map.cpp +++ b/src/common/key_map.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "key_map.h" | 5 | #include "key_map.h" |
diff --git a/src/common/key_map.h b/src/common/key_map.h index bf72362c0..8d949b852 100644 --- a/src/common/key_map.h +++ b/src/common/key_map.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/linear_disk_cache.h b/src/common/linear_disk_cache.h index bb1b5174f..74ce74aba 100644 --- a/src/common/linear_disk_cache.h +++ b/src/common/linear_disk_cache.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/log.h b/src/common/log.h index 663eda9ad..96d97249f 100644 --- a/src/common/log.h +++ b/src/common/log.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index e79b84604..816d1bb55 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2+ | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h index ae270efe8..1c44c929e 100644 --- a/src/common/logging/backend.h +++ b/src/common/logging/backend.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2+ | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp index 0cf9b05e7..50f2e13f4 100644 --- a/src/common/logging/filter.cpp +++ b/src/common/logging/filter.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2+ | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
diff --git a/src/common/logging/filter.h b/src/common/logging/filter.h index 32b14b159..c3da9989f 100644 --- a/src/common/logging/filter.h +++ b/src/common/logging/filter.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2+ | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <array> | 5 | #include <array> |
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index 1eec34fbb..d1c391862 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2+ | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp index 3fe435346..ef5739d84 100644 --- a/src/common/logging/text_formatter.cpp +++ b/src/common/logging/text_formatter.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2+ | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <array> | 5 | #include <array> |
| @@ -54,12 +54,22 @@ void FormatLogMessage(const Entry& entry, char* out_text, size_t text_len) { | |||
| 54 | TrimSourcePath(entry.location.c_str()), entry.message.c_str()); | 54 | TrimSourcePath(entry.location.c_str()), entry.message.c_str()); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | static void ChangeConsoleColor(Level level) { | 57 | void PrintMessage(const Entry& entry) { |
| 58 | std::array<char, 4 * 1024> format_buffer; | ||
| 59 | FormatLogMessage(entry, format_buffer.data(), format_buffer.size()); | ||
| 60 | fputs(format_buffer.data(), stderr); | ||
| 61 | fputc('\n', stderr); | ||
| 62 | } | ||
| 63 | |||
| 64 | void PrintColoredMessage(const Entry& entry) { | ||
| 58 | #ifdef _WIN32 | 65 | #ifdef _WIN32 |
| 59 | static HANDLE console_handle = GetStdHandle(STD_ERROR_HANDLE); | 66 | static HANDLE console_handle = GetStdHandle(STD_ERROR_HANDLE); |
| 60 | 67 | ||
| 68 | CONSOLE_SCREEN_BUFFER_INFO original_info = {0}; | ||
| 69 | GetConsoleScreenBufferInfo(console_handle, &original_info); | ||
| 70 | |||
| 61 | WORD color = 0; | 71 | WORD color = 0; |
| 62 | switch (level) { | 72 | switch (entry.log_level) { |
| 63 | case Level::Trace: // Grey | 73 | case Level::Trace: // Grey |
| 64 | color = FOREGROUND_INTENSITY; break; | 74 | color = FOREGROUND_INTENSITY; break; |
| 65 | case Level::Debug: // Cyan | 75 | case Level::Debug: // Cyan |
| @@ -76,9 +86,9 @@ static void ChangeConsoleColor(Level level) { | |||
| 76 | 86 | ||
| 77 | SetConsoleTextAttribute(console_handle, color); | 87 | SetConsoleTextAttribute(console_handle, color); |
| 78 | #else | 88 | #else |
| 79 | #define ESC "\x1b" | 89 | # define ESC "\x1b" |
| 80 | const char* color = ""; | 90 | const char* color = ""; |
| 81 | switch (level) { | 91 | switch (entry.log_level) { |
| 82 | case Level::Trace: // Grey | 92 | case Level::Trace: // Grey |
| 83 | color = ESC "[1;30m"; break; | 93 | color = ESC "[1;30m"; break; |
| 84 | case Level::Debug: // Cyan | 94 | case Level::Debug: // Cyan |
| @@ -92,18 +102,18 @@ static void ChangeConsoleColor(Level level) { | |||
| 92 | case Level::Critical: // Bright magenta | 102 | case Level::Critical: // Bright magenta |
| 93 | color = ESC "[1;35m"; break; | 103 | color = ESC "[1;35m"; break; |
| 94 | } | 104 | } |
| 95 | #undef ESC | ||
| 96 | 105 | ||
| 97 | fputs(color, stderr); | 106 | fputs(color, stderr); |
| 98 | #endif | 107 | #endif |
| 99 | } | ||
| 100 | 108 | ||
| 101 | void PrintMessage(const Entry& entry) { | 109 | PrintMessage(entry); |
| 102 | ChangeConsoleColor(entry.log_level); | 110 | |
| 103 | std::array<char, 4 * 1024> format_buffer; | 111 | #ifdef _WIN32 |
| 104 | FormatLogMessage(entry, format_buffer.data(), format_buffer.size()); | 112 | SetConsoleTextAttribute(console_handle, original_info.wAttributes); |
| 105 | fputs(format_buffer.data(), stderr); | 113 | #else |
| 106 | fputc('\n', stderr); | 114 | fputs(ESC "[0m", stderr); |
| 115 | # undef ESC | ||
| 116 | #endif | ||
| 107 | } | 117 | } |
| 108 | 118 | ||
| 109 | void TextLoggingLoop(std::shared_ptr<Logger> logger, const Filter* filter) { | 119 | void TextLoggingLoop(std::shared_ptr<Logger> logger, const Filter* filter) { |
| @@ -117,7 +127,7 @@ void TextLoggingLoop(std::shared_ptr<Logger> logger, const Filter* filter) { | |||
| 117 | for (size_t i = 0; i < num_entries; ++i) { | 127 | for (size_t i = 0; i < num_entries; ++i) { |
| 118 | const Entry& entry = entry_buffer[i]; | 128 | const Entry& entry = entry_buffer[i]; |
| 119 | if (filter->CheckMessage(entry.log_class, entry.log_level)) { | 129 | if (filter->CheckMessage(entry.log_class, entry.log_level)) { |
| 120 | PrintMessage(entry); | 130 | PrintColoredMessage(entry); |
| 121 | } | 131 | } |
| 122 | } | 132 | } |
| 123 | } | 133 | } |
diff --git a/src/common/logging/text_formatter.h b/src/common/logging/text_formatter.h index d7e298e28..2f05794f0 100644 --- a/src/common/logging/text_formatter.h +++ b/src/common/logging/text_formatter.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2+ | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| @@ -29,6 +29,8 @@ const char* TrimSourcePath(const char* path, const char* root = "src"); | |||
| 29 | void FormatLogMessage(const Entry& entry, char* out_text, size_t text_len); | 29 | void FormatLogMessage(const Entry& entry, char* out_text, size_t text_len); |
| 30 | /// Formats and prints a log entry to stderr. | 30 | /// Formats and prints a log entry to stderr. |
| 31 | void PrintMessage(const Entry& entry); | 31 | void PrintMessage(const Entry& entry); |
| 32 | /// Prints the same message as `PrintMessage`, but colored acoording to the severity level. | ||
| 33 | void PrintColoredMessage(const Entry& entry); | ||
| 32 | 34 | ||
| 33 | /** | 35 | /** |
| 34 | * Logging loop that repeatedly reads messages from the provided logger and prints them to the | 36 | * Logging loop that repeatedly reads messages from the provided logger and prints them to the |
diff --git a/src/common/make_unique.h b/src/common/make_unique.h new file mode 100644 index 000000000..2a7b76412 --- /dev/null +++ b/src/common/make_unique.h | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <memory> | ||
| 8 | |||
| 9 | namespace Common { | ||
| 10 | |||
| 11 | template <typename T, typename... Args> | ||
| 12 | std::unique_ptr<T> make_unique(Args&&... args) { | ||
| 13 | return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); | ||
| 14 | } | ||
| 15 | |||
| 16 | } // namespace | ||
diff --git a/src/common/math_util.cpp b/src/common/math_util.cpp index 3613e82a6..a83592dd2 100644 --- a/src/common/math_util.cpp +++ b/src/common/math_util.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | 5 | ||
diff --git a/src/common/math_util.h b/src/common/math_util.h index b10a25c13..43b0e0dc3 100644 --- a/src/common/math_util.h +++ b/src/common/math_util.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp index ca8a2a9e4..8f982da89 100644 --- a/src/common/memory_util.cpp +++ b/src/common/memory_util.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | 5 | ||
diff --git a/src/common/memory_util.h b/src/common/memory_util.h index 922bd44b2..9fdbf1f12 100644 --- a/src/common/memory_util.h +++ b/src/common/memory_util.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/misc.cpp b/src/common/misc.cpp index bc9d26188..e33055d10 100644 --- a/src/common/misc.cpp +++ b/src/common/misc.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/common.h" | 5 | #include "common/common.h" |
diff --git a/src/common/msg_handler.cpp b/src/common/msg_handler.cpp index 7ffedc45a..4a47b518e 100644 --- a/src/common/msg_handler.cpp +++ b/src/common/msg_handler.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <cstdio> | 5 | #include <cstdio> |
diff --git a/src/common/msg_handler.h b/src/common/msg_handler.h index 9bfdf950e..7bb216e98 100644 --- a/src/common/msg_handler.h +++ b/src/common/msg_handler.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/scm_rev.h b/src/common/scm_rev.h index d34664614..0ef190afa 100644 --- a/src/common/scm_rev.h +++ b/src/common/scm_rev.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h index 1d3e59319..263beaf0e 100644 --- a/src/common/scope_exit.h +++ b/src/common/scope_exit.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2+ | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 6d9612fb5..d919b7a4c 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <boost/range/algorithm.hpp> | 5 | #include <boost/range/algorithm.hpp> |
diff --git a/src/common/string_util.h b/src/common/string_util.h index 7d75691b1..74974263f 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/symbols.cpp b/src/common/symbols.cpp index 63ad6218b..9e4dccfb3 100644 --- a/src/common/symbols.cpp +++ b/src/common/symbols.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/symbols.h" | 5 | #include "common/symbols.h" |
diff --git a/src/common/symbols.h b/src/common/symbols.h index 4560f5240..f76cb6b1e 100644 --- a/src/common/symbols.h +++ b/src/common/symbols.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | 1 | // Copyright 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/thread.cpp b/src/common/thread.cpp index dc153ba71..8c83d67b5 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/thread.h" | 5 | #include "common/thread.h" |
diff --git a/src/common/thread.h b/src/common/thread.h index 8c36d3f07..eaf1ba00c 100644 --- a/src/common/thread.h +++ b/src/common/thread.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h index 7e3b620c7..4e1c0a215 100644 --- a/src/common/thread_queue_list.h +++ b/src/common/thread_queue_list.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project / PPSSPP Project | 1 | // Copyright 2014 Citra Emulator Project / PPSSPP Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/thunk.h b/src/common/thunk.h index 90c8be888..4fb7c98e1 100644 --- a/src/common/thunk.h +++ b/src/common/thunk.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
diff --git a/src/common/timer.cpp b/src/common/timer.cpp index 4a797f751..a6682ea19 100644 --- a/src/common/timer.cpp +++ b/src/common/timer.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <time.h> | 5 | #include <time.h> |
diff --git a/src/common/timer.h b/src/common/timer.h index 86418e7a7..4b44c33a0 100644 --- a/src/common/timer.h +++ b/src/common/timer.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project | 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project |
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |