summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/CMakeLists.txt1
-rw-r--r--src/common/alignment.h28
-rw-r--r--src/common/div_ceil.h8
-rw-r--r--src/common/fs/path_util.cpp27
-rw-r--r--src/common/host_memory.cpp2
-rw-r--r--src/common/intrusive_red_black_tree.h17
-rw-r--r--src/common/logging/backend.cpp3
-rw-r--r--src/common/logging/log.h6
-rw-r--r--src/common/logging/log_entry.h28
-rw-r--r--src/common/logging/text_formatter.cpp1
-rw-r--r--src/common/logging/types.h17
-rw-r--r--src/common/param_package.cpp1
-rw-r--r--src/common/settings.cpp2
-rw-r--r--src/common/settings.h7
-rw-r--r--src/common/string_util.cpp12
-rw-r--r--src/common/string_util.h2
-rw-r--r--src/common/uuid.h7
-rw-r--r--src/common/vector_math.h4
18 files changed, 105 insertions, 68 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index b18a2a2f5..cb5c0f326 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -79,6 +79,7 @@ add_library(common STATIC
79 logging/filter.cpp 79 logging/filter.cpp
80 logging/filter.h 80 logging/filter.h
81 logging/log.h 81 logging/log.h
82 logging/log_entry.h
82 logging/text_formatter.cpp 83 logging/text_formatter.cpp
83 logging/text_formatter.h 84 logging/text_formatter.h
84 logging/types.h 85 logging/types.h
diff --git a/src/common/alignment.h b/src/common/alignment.h
index 32d796ffa..8570c7d3c 100644
--- a/src/common/alignment.h
+++ b/src/common/alignment.h
@@ -9,41 +9,48 @@
9namespace Common { 9namespace Common {
10 10
11template <typename T> 11template <typename T>
12requires std::is_unsigned_v<T>[[nodiscard]] constexpr T AlignUp(T value, size_t size) { 12requires std::is_unsigned_v<T>
13[[nodiscard]] constexpr T AlignUp(T value, size_t size) {
13 auto mod{static_cast<T>(value % size)}; 14 auto mod{static_cast<T>(value % size)};
14 value -= mod; 15 value -= mod;
15 return static_cast<T>(mod == T{0} ? value : value + size); 16 return static_cast<T>(mod == T{0} ? value : value + size);
16} 17}
17 18
18template <typename T> 19template <typename T>
19requires std::is_unsigned_v<T>[[nodiscard]] constexpr T AlignUpLog2(T value, size_t align_log2) { 20requires std::is_unsigned_v<T>
21[[nodiscard]] constexpr T AlignUpLog2(T value, size_t align_log2) {
20 return static_cast<T>((value + ((1ULL << align_log2) - 1)) >> align_log2 << align_log2); 22 return static_cast<T>((value + ((1ULL << align_log2) - 1)) >> align_log2 << align_log2);
21} 23}
22 24
23template <typename T> 25template <typename T>
24requires std::is_unsigned_v<T>[[nodiscard]] constexpr T AlignDown(T value, size_t size) { 26requires std::is_unsigned_v<T>
27[[nodiscard]] constexpr T AlignDown(T value, size_t size) {
25 return static_cast<T>(value - value % size); 28 return static_cast<T>(value - value % size);
26} 29}
27 30
28template <typename T> 31template <typename T>
29requires std::is_unsigned_v<T>[[nodiscard]] constexpr bool Is4KBAligned(T value) { 32requires std::is_unsigned_v<T>
33[[nodiscard]] constexpr bool Is4KBAligned(T value) {
30 return (value & 0xFFF) == 0; 34 return (value & 0xFFF) == 0;
31} 35}
32 36
33template <typename T> 37template <typename T>
34requires std::is_unsigned_v<T>[[nodiscard]] constexpr bool IsWordAligned(T value) { 38requires std::is_unsigned_v<T>
39[[nodiscard]] constexpr bool IsWordAligned(T value) {
35 return (value & 0b11) == 0; 40 return (value & 0b11) == 0;
36} 41}
37 42
38template <typename T> 43template <typename T>
39requires std::is_integral_v<T>[[nodiscard]] constexpr bool IsAligned(T value, size_t alignment) { 44requires std::is_integral_v<T>
45[[nodiscard]] constexpr bool IsAligned(T value, size_t alignment) {
40 using U = typename std::make_unsigned_t<T>; 46 using U = typename std::make_unsigned_t<T>;
41 const U mask = static_cast<U>(alignment - 1); 47 const U mask = static_cast<U>(alignment - 1);
42 return (value & mask) == 0; 48 return (value & mask) == 0;
43} 49}
44 50
45template <typename T, typename U> 51template <typename T, typename U>
46requires std::is_integral_v<T>[[nodiscard]] constexpr T DivideUp(T x, U y) { 52requires std::is_integral_v<T>
53[[nodiscard]] constexpr T DivideUp(T x, U y) {
47 return (x + (y - 1)) / y; 54 return (x + (y - 1)) / y;
48} 55}
49 56
@@ -57,7 +64,7 @@ public:
57 using propagate_on_container_copy_assignment = std::true_type; 64 using propagate_on_container_copy_assignment = std::true_type;
58 using propagate_on_container_move_assignment = std::true_type; 65 using propagate_on_container_move_assignment = std::true_type;
59 using propagate_on_container_swap = std::true_type; 66 using propagate_on_container_swap = std::true_type;
60 using is_always_equal = std::true_type; 67 using is_always_equal = std::false_type;
61 68
62 constexpr AlignmentAllocator() noexcept = default; 69 constexpr AlignmentAllocator() noexcept = default;
63 70
@@ -76,6 +83,11 @@ public:
76 struct rebind { 83 struct rebind {
77 using other = AlignmentAllocator<T2, Align>; 84 using other = AlignmentAllocator<T2, Align>;
78 }; 85 };
86
87 template <typename T2, size_t Align2>
88 constexpr bool operator==(const AlignmentAllocator<T2, Align2>&) const noexcept {
89 return std::is_same_v<T, T2> && Align == Align2;
90 }
79}; 91};
80 92
81} // namespace Common 93} // namespace Common
diff --git a/src/common/div_ceil.h b/src/common/div_ceil.h
index 95e1489a9..e1db35464 100644
--- a/src/common/div_ceil.h
+++ b/src/common/div_ceil.h
@@ -11,15 +11,15 @@ namespace Common {
11 11
12/// Ceiled integer division. 12/// Ceiled integer division.
13template <typename N, typename D> 13template <typename N, typename D>
14requires std::is_integral_v<N>&& std::is_unsigned_v<D>[[nodiscard]] constexpr N DivCeil(N number, 14requires std::is_integral_v<N> && std::is_unsigned_v<D>
15 D divisor) { 15[[nodiscard]] constexpr N DivCeil(N number, D divisor) {
16 return static_cast<N>((static_cast<D>(number) + divisor - 1) / divisor); 16 return static_cast<N>((static_cast<D>(number) + divisor - 1) / divisor);
17} 17}
18 18
19/// Ceiled integer division with logarithmic divisor in base 2 19/// Ceiled integer division with logarithmic divisor in base 2
20template <typename N, typename D> 20template <typename N, typename D>
21requires std::is_integral_v<N>&& std::is_unsigned_v<D>[[nodiscard]] constexpr N DivCeilLog2( 21requires std::is_integral_v<N> && std::is_unsigned_v<D>
22 N value, D alignment_log2) { 22[[nodiscard]] constexpr N DivCeilLog2(N value, D alignment_log2) {
23 return static_cast<N>((static_cast<D>(value) + (D(1) << alignment_log2) - 1) >> alignment_log2); 23 return static_cast<N>((static_cast<D>(value) + (D(1) << alignment_log2) - 1) >> alignment_log2);
24} 24}
25 25
diff --git a/src/common/fs/path_util.cpp b/src/common/fs/path_util.cpp
index 43b79bd6d..1bcb897b5 100644
--- a/src/common/fs/path_util.cpp
+++ b/src/common/fs/path_util.cpp
@@ -82,32 +82,35 @@ public:
82 82
83private: 83private:
84 PathManagerImpl() { 84 PathManagerImpl() {
85 fs::path yuzu_path;
86 fs::path yuzu_path_cache;
87 fs::path yuzu_path_config;
88
85#ifdef _WIN32 89#ifdef _WIN32
86 auto yuzu_path = GetExeDirectory() / PORTABLE_DIR; 90 yuzu_path = GetExeDirectory() / PORTABLE_DIR;
87 91
88 if (!IsDir(yuzu_path)) { 92 if (!IsDir(yuzu_path)) {
89 yuzu_path = GetAppDataRoamingDirectory() / YUZU_DIR; 93 yuzu_path = GetAppDataRoamingDirectory() / YUZU_DIR;
90 } 94 }
91 95
92 GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path); 96 yuzu_path_cache = yuzu_path / CACHE_DIR;
93 GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path / CACHE_DIR); 97 yuzu_path_config = yuzu_path / CONFIG_DIR;
94 GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path / CONFIG_DIR);
95#else 98#else
96 auto yuzu_path = GetCurrentDir() / PORTABLE_DIR; 99 yuzu_path = GetCurrentDir() / PORTABLE_DIR;
97 100
98 if (Exists(yuzu_path) && IsDir(yuzu_path)) { 101 if (Exists(yuzu_path) && IsDir(yuzu_path)) {
99 GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path); 102 yuzu_path_cache = yuzu_path / CACHE_DIR;
100 GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path / CACHE_DIR); 103 yuzu_path_config = yuzu_path / CONFIG_DIR;
101 GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path / CONFIG_DIR);
102 } else { 104 } else {
103 yuzu_path = GetDataDirectory("XDG_DATA_HOME") / YUZU_DIR; 105 yuzu_path = GetDataDirectory("XDG_DATA_HOME") / YUZU_DIR;
104 106 yuzu_path_cache = GetDataDirectory("XDG_CACHE_HOME") / YUZU_DIR;
105 GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path); 107 yuzu_path_config = GetDataDirectory("XDG_CONFIG_HOME") / YUZU_DIR;
106 GenerateYuzuPath(YuzuPath::CacheDir, GetDataDirectory("XDG_CACHE_HOME") / YUZU_DIR);
107 GenerateYuzuPath(YuzuPath::ConfigDir, GetDataDirectory("XDG_CONFIG_HOME") / YUZU_DIR);
108 } 108 }
109#endif 109#endif
110 110
111 GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path);
112 GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path_cache);
113 GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path_config);
111 GenerateYuzuPath(YuzuPath::DumpDir, yuzu_path / DUMP_DIR); 114 GenerateYuzuPath(YuzuPath::DumpDir, yuzu_path / DUMP_DIR);
112 GenerateYuzuPath(YuzuPath::KeysDir, yuzu_path / KEYS_DIR); 115 GenerateYuzuPath(YuzuPath::KeysDir, yuzu_path / KEYS_DIR);
113 GenerateYuzuPath(YuzuPath::LoadDir, yuzu_path / LOAD_DIR); 116 GenerateYuzuPath(YuzuPath::LoadDir, yuzu_path / LOAD_DIR);
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp
index 6661244cf..b44a44949 100644
--- a/src/common/host_memory.cpp
+++ b/src/common/host_memory.cpp
@@ -314,8 +314,8 @@ private:
314 } 314 }
315 315
316 void UntrackPlaceholder(boost::icl::separate_interval_set<size_t>::iterator it) { 316 void UntrackPlaceholder(boost::icl::separate_interval_set<size_t>::iterator it) {
317 placeholders.erase(it);
318 placeholder_host_pointers.erase(it->lower()); 317 placeholder_host_pointers.erase(it->lower());
318 placeholders.erase(it);
319 } 319 }
320 320
321 /// Return true when a given memory region is a "nieche" and the placeholders don't have to be 321 /// Return true when a given memory region is a "nieche" and the placeholders don't have to be
diff --git a/src/common/intrusive_red_black_tree.h b/src/common/intrusive_red_black_tree.h
index 1f696fe80..3173cc449 100644
--- a/src/common/intrusive_red_black_tree.h
+++ b/src/common/intrusive_red_black_tree.h
@@ -235,20 +235,19 @@ public:
235 235
236template <typename T> 236template <typename T>
237concept HasLightCompareType = requires { 237concept HasLightCompareType = requires {
238 { std::is_same<typename T::LightCompareType, void>::value } 238 { std::is_same<typename T::LightCompareType, void>::value } -> std::convertible_to<bool>;
239 ->std::convertible_to<bool>;
240}; 239};
241 240
242namespace impl { 241namespace impl {
243 242
244template <typename T, typename Default> 243 template <typename T, typename Default>
245consteval auto* GetLightCompareType() { 244 consteval auto* GetLightCompareType() {
246 if constexpr (HasLightCompareType<T>) { 245 if constexpr (HasLightCompareType<T>) {
247 return static_cast<typename T::LightCompareType*>(nullptr); 246 return static_cast<typename T::LightCompareType*>(nullptr);
248 } else { 247 } else {
249 return static_cast<Default*>(nullptr); 248 return static_cast<Default*>(nullptr);
249 }
250 } 250 }
251}
252 251
253} // namespace impl 252} // namespace impl
254 253
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index e40d117d6..0e85a9c1d 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -9,6 +9,8 @@
9#include <thread> 9#include <thread>
10#include <vector> 10#include <vector>
11 11
12#include <fmt/format.h>
13
12#ifdef _WIN32 14#ifdef _WIN32
13#include <windows.h> // For OutputDebugStringW 15#include <windows.h> // For OutputDebugStringW
14#endif 16#endif
@@ -22,6 +24,7 @@
22 24
23#include "common/logging/backend.h" 25#include "common/logging/backend.h"
24#include "common/logging/log.h" 26#include "common/logging/log.h"
27#include "common/logging/log_entry.h"
25#include "common/logging/text_formatter.h" 28#include "common/logging/text_formatter.h"
26#include "common/settings.h" 29#include "common/settings.h"
27#ifdef _WIN32 30#ifdef _WIN32
diff --git a/src/common/logging/log.h b/src/common/logging/log.h
index 8d43eddc7..c186d55ef 100644
--- a/src/common/logging/log.h
+++ b/src/common/logging/log.h
@@ -4,7 +4,11 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <fmt/format.h> 7#include <algorithm>
8#include <string_view>
9
10#include <fmt/core.h>
11
8#include "common/logging/types.h" 12#include "common/logging/types.h"
9 13
10namespace Common::Log { 14namespace Common::Log {
diff --git a/src/common/logging/log_entry.h b/src/common/logging/log_entry.h
new file mode 100644
index 000000000..dd6f44841
--- /dev/null
+++ b/src/common/logging/log_entry.h
@@ -0,0 +1,28 @@
1// Copyright 2021 yuzu 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 <chrono>
8
9#include "common/logging/types.h"
10
11namespace Common::Log {
12
13/**
14 * A log entry. Log entries are store in a structured format to permit more varied output
15 * formatting on different frontends, as well as facilitating filtering and aggregation.
16 */
17struct Entry {
18 std::chrono::microseconds timestamp;
19 Class log_class{};
20 Level log_level{};
21 const char* filename = nullptr;
22 unsigned int line_num = 0;
23 std::string function;
24 std::string message;
25 bool final_entry = false;
26};
27
28} // namespace Common::Log
diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp
index cfc0d5846..10b2281db 100644
--- a/src/common/logging/text_formatter.cpp
+++ b/src/common/logging/text_formatter.cpp
@@ -13,6 +13,7 @@
13#include "common/common_funcs.h" 13#include "common/common_funcs.h"
14#include "common/logging/filter.h" 14#include "common/logging/filter.h"
15#include "common/logging/log.h" 15#include "common/logging/log.h"
16#include "common/logging/log_entry.h"
16#include "common/logging/text_formatter.h" 17#include "common/logging/text_formatter.h"
17#include "common/string_util.h" 18#include "common/string_util.h"
18 19
diff --git a/src/common/logging/types.h b/src/common/logging/types.h
index ddf9d27ca..2d21fc483 100644
--- a/src/common/logging/types.h
+++ b/src/common/logging/types.h
@@ -4,8 +4,6 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <chrono>
8
9#include "common/common_types.h" 7#include "common/common_types.h"
10 8
11namespace Common::Log { 9namespace Common::Log {
@@ -131,19 +129,4 @@ enum class Class : u8 {
131 Count ///< Total number of logging classes 129 Count ///< Total number of logging classes
132}; 130};
133 131
134/**
135 * A log entry. Log entries are store in a structured format to permit more varied output
136 * formatting on different frontends, as well as facilitating filtering and aggregation.
137 */
138struct Entry {
139 std::chrono::microseconds timestamp;
140 Class log_class{};
141 Level log_level{};
142 const char* filename = nullptr;
143 unsigned int line_num = 0;
144 std::string function;
145 std::string message;
146 bool final_entry = false;
147};
148
149} // namespace Common::Log 132} // namespace Common::Log
diff --git a/src/common/param_package.cpp b/src/common/param_package.cpp
index b916b4866..bbf20f5eb 100644
--- a/src/common/param_package.cpp
+++ b/src/common/param_package.cpp
@@ -3,6 +3,7 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <array> 5#include <array>
6#include <stdexcept>
6#include <utility> 7#include <utility>
7#include <vector> 8#include <vector>
8 9
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index 69f0bd8c0..9dd5e3efb 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -69,8 +69,6 @@ void LogSettings() {
69 log_path("DataStorage_NANDDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir)); 69 log_path("DataStorage_NANDDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir));
70 log_path("DataStorage_SDMCDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::SDMCDir)); 70 log_path("DataStorage_SDMCDir", Common::FS::GetYuzuPath(Common::FS::YuzuPath::SDMCDir));
71 log_setting("Debugging_ProgramArgs", values.program_args.GetValue()); 71 log_setting("Debugging_ProgramArgs", values.program_args.GetValue());
72 log_setting("Services_BCATBackend", values.bcat_backend.GetValue());
73 log_setting("Services_BCATBoxcatLocal", values.bcat_boxcat_local.GetValue());
74 log_setting("Input_EnableMotion", values.motion_enabled.GetValue()); 72 log_setting("Input_EnableMotion", values.motion_enabled.GetValue());
75 log_setting("Input_EnableVibration", values.vibration_enabled.GetValue()); 73 log_setting("Input_EnableVibration", values.vibration_enabled.GetValue());
76 log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue()); 74 log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue());
diff --git a/src/common/settings.h b/src/common/settings.h
index c53d5acc3..9ff4cf85d 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -7,7 +7,6 @@
7#include <algorithm> 7#include <algorithm>
8#include <array> 8#include <array>
9#include <atomic> 9#include <atomic>
10#include <chrono>
11#include <map> 10#include <map>
12#include <optional> 11#include <optional>
13#include <string> 12#include <string>
@@ -487,9 +486,9 @@ struct Values {
487 // System 486 // System
488 Setting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"}; 487 Setting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"};
489 // Measured in seconds since epoch 488 // Measured in seconds since epoch
490 std::optional<std::chrono::seconds> custom_rtc; 489 std::optional<s64> custom_rtc;
491 // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` 490 // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc`
492 std::chrono::seconds custom_rtc_differential; 491 s64 custom_rtc_differential;
493 492
494 BasicSetting<s32> current_user{0, "current_user"}; 493 BasicSetting<s32> current_user{0, "current_user"};
495 RangedSetting<s32> language_index{1, 0, 17, "language_index"}; 494 RangedSetting<s32> language_index{1, 0, 17, "language_index"};
@@ -568,8 +567,6 @@ struct Values {
568 BasicSetting<bool> use_dev_keys{false, "use_dev_keys"}; 567 BasicSetting<bool> use_dev_keys{false, "use_dev_keys"};
569 568
570 // Network 569 // Network
571 BasicSetting<std::string> bcat_backend{"none", "bcat_backend"};
572 BasicSetting<bool> bcat_boxcat_local{false, "bcat_boxcat_local"};
573 BasicSetting<std::string> network_interface{std::string(), "network_interface"}; 570 BasicSetting<std::string> network_interface{std::string(), "network_interface"};
574 571
575 // WebService 572 // WebService
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index e6344fd41..662171138 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -180,20 +180,20 @@ std::wstring UTF8ToUTF16W(const std::string& input) {
180 180
181#endif 181#endif
182 182
183std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, std::size_t max_len) { 183std::string StringFromFixedZeroTerminatedBuffer(std::string_view buffer, std::size_t max_len) {
184 std::size_t len = 0; 184 std::size_t len = 0;
185 while (len < max_len && buffer[len] != '\0') 185 while (len < buffer.length() && len < max_len && buffer[len] != '\0') {
186 ++len; 186 ++len;
187 187 }
188 return std::string(buffer, len); 188 return std::string(buffer.begin(), buffer.begin() + len);
189} 189}
190 190
191std::u16string UTF16StringFromFixedZeroTerminatedBuffer(std::u16string_view buffer, 191std::u16string UTF16StringFromFixedZeroTerminatedBuffer(std::u16string_view buffer,
192 std::size_t max_len) { 192 std::size_t max_len) {
193 std::size_t len = 0; 193 std::size_t len = 0;
194 while (len < max_len && buffer[len] != '\0') 194 while (len < buffer.length() && len < max_len && buffer[len] != '\0') {
195 ++len; 195 ++len;
196 196 }
197 return std::u16string(buffer.begin(), buffer.begin() + len); 197 return std::u16string(buffer.begin(), buffer.begin() + len);
198} 198}
199 199
diff --git a/src/common/string_util.h b/src/common/string_util.h
index 7e90a9ca5..f0dd632ee 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -63,7 +63,7 @@ template <typename InIt>
63 * Creates a std::string from a fixed-size NUL-terminated char buffer. If the buffer isn't 63 * Creates a std::string from a fixed-size NUL-terminated char buffer. If the buffer isn't
64 * NUL-terminated then the string ends at max_len characters. 64 * NUL-terminated then the string ends at max_len characters.
65 */ 65 */
66[[nodiscard]] std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, 66[[nodiscard]] std::string StringFromFixedZeroTerminatedBuffer(std::string_view buffer,
67 std::size_t max_len); 67 std::size_t max_len);
68 68
69/** 69/**
diff --git a/src/common/uuid.h b/src/common/uuid.h
index 2353179d8..8ea01f8da 100644
--- a/src/common/uuid.h
+++ b/src/common/uuid.h
@@ -58,6 +58,13 @@ struct UUID {
58 uuid = INVALID_UUID; 58 uuid = INVALID_UUID;
59 } 59 }
60 60
61 [[nodiscard]] constexpr bool IsInvalid() const {
62 return uuid == INVALID_UUID;
63 }
64 [[nodiscard]] constexpr bool IsValid() const {
65 return !IsInvalid();
66 }
67
61 // TODO(ogniK): Properly generate a Nintendo ID 68 // TODO(ogniK): Properly generate a Nintendo ID
62 [[nodiscard]] constexpr u64 GetNintendoID() const { 69 [[nodiscard]] constexpr u64 GetNintendoID() const {
63 return uuid[0]; 70 return uuid[0];
diff --git a/src/common/vector_math.h b/src/common/vector_math.h
index 22dba3c2d..ba7c363c1 100644
--- a/src/common/vector_math.h
+++ b/src/common/vector_math.h
@@ -667,8 +667,8 @@ template <typename T>
667 667
668// linear interpolation via float: 0.0=begin, 1.0=end 668// linear interpolation via float: 0.0=begin, 1.0=end
669template <typename X> 669template <typename X>
670[[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) Lerp(const X& begin, const X& end, 670[[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{})
671 const float t) { 671 Lerp(const X& begin, const X& end, const float t) {
672 return begin * (1.f - t) + end * t; 672 return begin * (1.f - t) + end * t;
673} 673}
674 674