diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/common/common_paths.h | 1 | ||||
| -rw-r--r-- | src/common/concepts.h | 32 | ||||
| -rw-r--r-- | src/common/file_util.cpp | 1 | ||||
| -rw-r--r-- | src/common/file_util.h | 1 |
5 files changed, 36 insertions, 0 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index d120c8d3d..78c3bfb3b 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -110,6 +110,7 @@ add_library(common STATIC | |||
| 110 | common_funcs.h | 110 | common_funcs.h |
| 111 | common_paths.h | 111 | common_paths.h |
| 112 | common_types.h | 112 | common_types.h |
| 113 | concepts.h | ||
| 113 | dynamic_library.cpp | 114 | dynamic_library.cpp |
| 114 | dynamic_library.h | 115 | dynamic_library.h |
| 115 | fiber.cpp | 116 | fiber.cpp |
diff --git a/src/common/common_paths.h b/src/common/common_paths.h index 076752d3b..3c593d5f6 100644 --- a/src/common/common_paths.h +++ b/src/common/common_paths.h | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #define KEYS_DIR "keys" | 35 | #define KEYS_DIR "keys" |
| 36 | #define LOAD_DIR "load" | 36 | #define LOAD_DIR "load" |
| 37 | #define DUMP_DIR "dump" | 37 | #define DUMP_DIR "dump" |
| 38 | #define SCREENSHOTS_DIR "screenshots" | ||
| 38 | #define SHADER_DIR "shader" | 39 | #define SHADER_DIR "shader" |
| 39 | #define LOG_DIR "log" | 40 | #define LOG_DIR "log" |
| 40 | 41 | ||
diff --git a/src/common/concepts.h b/src/common/concepts.h new file mode 100644 index 000000000..db5fb373d --- /dev/null +++ b/src/common/concepts.h | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | // Copyright 2020 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | namespace Common { | ||
| 8 | |||
| 9 | #include <type_traits> | ||
| 10 | |||
| 11 | // Check if type is like an STL container | ||
| 12 | template <typename T> | ||
| 13 | concept IsSTLContainer = requires(T t) { | ||
| 14 | typename T::value_type; | ||
| 15 | typename T::iterator; | ||
| 16 | typename T::const_iterator; | ||
| 17 | // TODO(ogniK): Replace below is std::same_as<void> when MSVC supports it. | ||
| 18 | t.begin(); | ||
| 19 | t.end(); | ||
| 20 | t.cbegin(); | ||
| 21 | t.cend(); | ||
| 22 | t.data(); | ||
| 23 | t.size(); | ||
| 24 | }; | ||
| 25 | |||
| 26 | // Check if type T is derived from T2 | ||
| 27 | template <typename T, typename T2> | ||
| 28 | concept IsBaseOf = requires { | ||
| 29 | std::is_base_of_v<T, T2>; | ||
| 30 | }; | ||
| 31 | |||
| 32 | } // namespace Common | ||
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 45b750e1e..4ede9f72c 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp | |||
| @@ -695,6 +695,7 @@ const std::string& GetUserPath(UserPath path, const std::string& new_path) { | |||
| 695 | paths.emplace(UserPath::NANDDir, user_path + NAND_DIR DIR_SEP); | 695 | paths.emplace(UserPath::NANDDir, user_path + NAND_DIR DIR_SEP); |
| 696 | paths.emplace(UserPath::LoadDir, user_path + LOAD_DIR DIR_SEP); | 696 | paths.emplace(UserPath::LoadDir, user_path + LOAD_DIR DIR_SEP); |
| 697 | paths.emplace(UserPath::DumpDir, user_path + DUMP_DIR DIR_SEP); | 697 | paths.emplace(UserPath::DumpDir, user_path + DUMP_DIR DIR_SEP); |
| 698 | paths.emplace(UserPath::ScreenshotsDir, user_path + SCREENSHOTS_DIR DIR_SEP); | ||
| 698 | paths.emplace(UserPath::ShaderDir, user_path + SHADER_DIR DIR_SEP); | 699 | paths.emplace(UserPath::ShaderDir, user_path + SHADER_DIR DIR_SEP); |
| 699 | paths.emplace(UserPath::SysDataDir, user_path + SYSDATA_DIR DIR_SEP); | 700 | paths.emplace(UserPath::SysDataDir, user_path + SYSDATA_DIR DIR_SEP); |
| 700 | paths.emplace(UserPath::KeysDir, user_path + KEYS_DIR DIR_SEP); | 701 | paths.emplace(UserPath::KeysDir, user_path + KEYS_DIR DIR_SEP); |
diff --git a/src/common/file_util.h b/src/common/file_util.h index f7a0c33fa..187b93161 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h | |||
| @@ -32,6 +32,7 @@ enum class UserPath { | |||
| 32 | SDMCDir, | 32 | SDMCDir, |
| 33 | LoadDir, | 33 | LoadDir, |
| 34 | DumpDir, | 34 | DumpDir, |
| 35 | ScreenshotsDir, | ||
| 35 | ShaderDir, | 36 | ShaderDir, |
| 36 | SysDataDir, | 37 | SysDataDir, |
| 37 | UserDir, | 38 | UserDir, |