summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/atomic_ops.h5
-rw-r--r--src/common/bit_field.h1
-rw-r--r--src/common/dynamic_library.cpp1
-rw-r--r--src/common/fs/file.cpp1
-rw-r--r--src/common/fs/file.h2
-rw-r--r--src/common/fs/fs_types.h1
-rw-r--r--src/common/fs/fs_util.h1
-rw-r--r--src/common/hex_util.h1
-rw-r--r--src/common/host_memory.cpp2
-rw-r--r--src/common/intrusive_red_black_tree.h1
-rw-r--r--src/common/logging/backend.cpp2
-rw-r--r--src/common/logging/backend.h1
-rw-r--r--src/common/logging/filter.cpp1
-rw-r--r--src/common/logging/filter.h1
-rw-r--r--src/common/logging/text_formatter.cpp2
-rw-r--r--src/common/logging/text_formatter.h1
-rw-r--r--src/common/logging/types.h1
-rw-r--r--src/common/math_util.h50
-rw-r--r--src/common/memory_detect.cpp2
-rw-r--r--src/common/nvidia_flags.cpp1
-rw-r--r--src/common/page_table.h1
-rw-r--r--src/common/parent_of_member.h1
-rw-r--r--src/common/ring_buffer.h1
-rw-r--r--src/common/string_util.cpp2
-rw-r--r--src/common/telemetry.cpp1
-rw-r--r--src/common/telemetry.h1
-rw-r--r--src/common/uint128.h2
-rw-r--r--src/common/uuid.h1
-rw-r--r--src/common/virtual_buffer.h1
-rw-r--r--src/common/wall_clock.cpp2
-rw-r--r--src/common/x64/cpu_detect.cpp1
-rw-r--r--src/common/x64/native_clock.cpp2
-rw-r--r--src/common/x64/native_clock.h2
33 files changed, 52 insertions, 44 deletions
diff --git a/src/common/atomic_ops.h b/src/common/atomic_ops.h
index 2b1f515e8..b94d73c7a 100644
--- a/src/common/atomic_ops.h
+++ b/src/common/atomic_ops.h
@@ -4,13 +4,12 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cstring>
8#include <memory>
9
10#include "common/common_types.h" 7#include "common/common_types.h"
11 8
12#if _MSC_VER 9#if _MSC_VER
13#include <intrin.h> 10#include <intrin.h>
11#else
12#include <cstring>
14#endif 13#endif
15 14
16namespace Common { 15namespace Common {
diff --git a/src/common/bit_field.h b/src/common/bit_field.h
index 0f0661172..7f8620e7d 100644
--- a/src/common/bit_field.h
+++ b/src/common/bit_field.h
@@ -33,7 +33,6 @@
33#include <cstddef> 33#include <cstddef>
34#include <limits> 34#include <limits>
35#include <type_traits> 35#include <type_traits>
36#include "common/common_funcs.h"
37#include "common/swap.h" 36#include "common/swap.h"
38 37
39/* 38/*
diff --git a/src/common/dynamic_library.cpp b/src/common/dynamic_library.cpp
index 7f0a10521..11003e1d6 100644
--- a/src/common/dynamic_library.cpp
+++ b/src/common/dynamic_library.cpp
@@ -2,7 +2,6 @@
2// Licensed under GPLv2+ 2// Licensed under GPLv2+
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cstring>
6#include <string> 5#include <string>
7#include <utility> 6#include <utility>
8 7
diff --git a/src/common/fs/file.cpp b/src/common/fs/file.cpp
index 274f57659..5d71275ef 100644
--- a/src/common/fs/file.cpp
+++ b/src/common/fs/file.cpp
@@ -4,7 +4,6 @@
4 4
5#include "common/fs/file.h" 5#include "common/fs/file.h"
6#include "common/fs/fs.h" 6#include "common/fs/fs.h"
7#include "common/fs/path_util.h"
8#include "common/logging/log.h" 7#include "common/logging/log.h"
9 8
10#ifdef _WIN32 9#ifdef _WIN32
diff --git a/src/common/fs/file.h b/src/common/fs/file.h
index a4f7944cd..8a2cab0af 100644
--- a/src/common/fs/file.h
+++ b/src/common/fs/file.h
@@ -6,10 +6,8 @@
6 6
7#include <cstdio> 7#include <cstdio>
8#include <filesystem> 8#include <filesystem>
9#include <fstream>
10#include <span> 9#include <span>
11#include <type_traits> 10#include <type_traits>
12#include <vector>
13 11
14#include "common/concepts.h" 12#include "common/concepts.h"
15#include "common/fs/fs_types.h" 13#include "common/fs/fs_types.h"
diff --git a/src/common/fs/fs_types.h b/src/common/fs/fs_types.h
index 089980aee..f5853f624 100644
--- a/src/common/fs/fs_types.h
+++ b/src/common/fs/fs_types.h
@@ -7,7 +7,6 @@
7#include <functional> 7#include <functional>
8 8
9#include "common/common_funcs.h" 9#include "common/common_funcs.h"
10#include "common/common_types.h"
11 10
12namespace Common::FS { 11namespace Common::FS {
13 12
diff --git a/src/common/fs/fs_util.h b/src/common/fs/fs_util.h
index 1620d38c9..392af89f7 100644
--- a/src/common/fs/fs_util.h
+++ b/src/common/fs/fs_util.h
@@ -8,7 +8,6 @@
8#include <filesystem> 8#include <filesystem>
9#include <span> 9#include <span>
10#include <string> 10#include <string>
11#include <string_view>
12 11
13#include "common/common_types.h" 12#include "common/common_types.h"
14 13
diff --git a/src/common/hex_util.h b/src/common/hex_util.h
index 5e9b6ef8b..323c8fb33 100644
--- a/src/common/hex_util.h
+++ b/src/common/hex_util.h
@@ -7,7 +7,6 @@
7#include <array> 7#include <array>
8#include <cstddef> 8#include <cstddef>
9#include <string> 9#include <string>
10#include <type_traits>
11#include <vector> 10#include <vector>
12#include <fmt/format.h> 11#include <fmt/format.h>
13#include "common/common_types.h" 12#include "common/common_types.h"
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp
index c465cfc14..e829af1ac 100644
--- a/src/common/host_memory.cpp
+++ b/src/common/host_memory.cpp
@@ -18,6 +18,7 @@
18#include <fcntl.h> 18#include <fcntl.h>
19#include <sys/mman.h> 19#include <sys/mman.h>
20#include <unistd.h> 20#include <unistd.h>
21#include "common/scope_exit.h"
21 22
22#endif // ^^^ Linux ^^^ 23#endif // ^^^ Linux ^^^
23 24
@@ -27,7 +28,6 @@
27#include "common/assert.h" 28#include "common/assert.h"
28#include "common/host_memory.h" 29#include "common/host_memory.h"
29#include "common/logging/log.h" 30#include "common/logging/log.h"
30#include "common/scope_exit.h"
31 31
32namespace Common { 32namespace Common {
33 33
diff --git a/src/common/intrusive_red_black_tree.h b/src/common/intrusive_red_black_tree.h
index b296b639e..eaf5675e3 100644
--- a/src/common/intrusive_red_black_tree.h
+++ b/src/common/intrusive_red_black_tree.h
@@ -4,7 +4,6 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "common/alignment.h"
8#include "common/common_funcs.h" 7#include "common/common_funcs.h"
9#include "common/parent_of_member.h" 8#include "common/parent_of_member.h"
10#include "common/tree.h" 9#include "common/tree.h"
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index 4a2462ec4..b3793106d 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -5,10 +5,8 @@
5#include <atomic> 5#include <atomic>
6#include <chrono> 6#include <chrono>
7#include <climits> 7#include <climits>
8#include <exception>
9#include <stop_token> 8#include <stop_token>
10#include <thread> 9#include <thread>
11#include <vector>
12 10
13#include <fmt/format.h> 11#include <fmt/format.h>
14 12
diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h
index bf785f402..a0e80fe3c 100644
--- a/src/common/logging/backend.h
+++ b/src/common/logging/backend.h
@@ -4,7 +4,6 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <filesystem>
8#include "common/logging/filter.h" 7#include "common/logging/filter.h"
9 8
10namespace Common::Log { 9namespace Common::Log {
diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp
index 4afc1369a..9120cc178 100644
--- a/src/common/logging/filter.cpp
+++ b/src/common/logging/filter.cpp
@@ -119,6 +119,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
119 SUB(Service, NPNS) \ 119 SUB(Service, NPNS) \
120 SUB(Service, NS) \ 120 SUB(Service, NS) \
121 SUB(Service, NVDRV) \ 121 SUB(Service, NVDRV) \
122 SUB(Service, NVFlinger) \
122 SUB(Service, OLSC) \ 123 SUB(Service, OLSC) \
123 SUB(Service, PCIE) \ 124 SUB(Service, PCIE) \
124 SUB(Service, PCTL) \ 125 SUB(Service, PCTL) \
diff --git a/src/common/logging/filter.h b/src/common/logging/filter.h
index 1a3074e04..29419f051 100644
--- a/src/common/logging/filter.h
+++ b/src/common/logging/filter.h
@@ -7,7 +7,6 @@
7#include <array> 7#include <array>
8#include <chrono> 8#include <chrono>
9#include <cstddef> 9#include <cstddef>
10#include <string_view>
11#include "common/logging/log.h" 10#include "common/logging/log.h"
12 11
13namespace Common::Log { 12namespace Common::Log {
diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp
index 10b2281db..b2cad58d8 100644
--- a/src/common/logging/text_formatter.cpp
+++ b/src/common/logging/text_formatter.cpp
@@ -10,12 +10,10 @@
10#endif 10#endif
11 11
12#include "common/assert.h" 12#include "common/assert.h"
13#include "common/common_funcs.h"
14#include "common/logging/filter.h" 13#include "common/logging/filter.h"
15#include "common/logging/log.h" 14#include "common/logging/log.h"
16#include "common/logging/log_entry.h" 15#include "common/logging/log_entry.h"
17#include "common/logging/text_formatter.h" 16#include "common/logging/text_formatter.h"
18#include "common/string_util.h"
19 17
20namespace Common::Log { 18namespace Common::Log {
21 19
diff --git a/src/common/logging/text_formatter.h b/src/common/logging/text_formatter.h
index 171e74cfe..92c0bf0c5 100644
--- a/src/common/logging/text_formatter.h
+++ b/src/common/logging/text_formatter.h
@@ -4,7 +4,6 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cstddef>
8#include <string> 7#include <string>
9 8
10namespace Common::Log { 9namespace Common::Log {
diff --git a/src/common/logging/types.h b/src/common/logging/types.h
index 2b6e4daa7..f803ab796 100644
--- a/src/common/logging/types.h
+++ b/src/common/logging/types.h
@@ -87,6 +87,7 @@ enum class Class : u8 {
87 Service_NPNS, ///< The NPNS service 87 Service_NPNS, ///< The NPNS service
88 Service_NS, ///< The NS services 88 Service_NS, ///< The NS services
89 Service_NVDRV, ///< The NVDRV (Nvidia driver) service 89 Service_NVDRV, ///< The NVDRV (Nvidia driver) service
90 Service_NVFlinger, ///< The NVFlinger service
90 Service_OLSC, ///< The OLSC service 91 Service_OLSC, ///< The OLSC service
91 Service_PCIE, ///< The PCIe service 92 Service_PCIE, ///< The PCIe service
92 Service_PCTL, ///< The PCTL (Parental control) service 93 Service_PCTL, ///< The PCTL (Parental control) service
diff --git a/src/common/math_util.h b/src/common/math_util.h
index 510c4e56d..54485bf53 100644
--- a/src/common/math_util.h
+++ b/src/common/math_util.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <algorithm>
7#include <cstdlib> 8#include <cstdlib>
8#include <type_traits> 9#include <type_traits>
9 10
@@ -20,10 +21,32 @@ struct Rectangle {
20 21
21 constexpr Rectangle() = default; 22 constexpr Rectangle() = default;
22 23
24 constexpr Rectangle(T width, T height) : right(width), bottom(height) {}
25
23 constexpr Rectangle(T left_, T top_, T right_, T bottom_) 26 constexpr Rectangle(T left_, T top_, T right_, T bottom_)
24 : left(left_), top(top_), right(right_), bottom(bottom_) {} 27 : left(left_), top(top_), right(right_), bottom(bottom_) {}
25 28
26 [[nodiscard]] T GetWidth() const { 29 [[nodiscard]] constexpr T Left() const {
30 return left;
31 }
32
33 [[nodiscard]] constexpr T Top() const {
34 return top;
35 }
36
37 [[nodiscard]] constexpr T Right() const {
38 return right;
39 }
40
41 [[nodiscard]] constexpr T Bottom() const {
42 return bottom;
43 }
44
45 [[nodiscard]] constexpr bool IsEmpty() const {
46 return (GetWidth() <= 0) || (GetHeight() <= 0);
47 }
48
49 [[nodiscard]] constexpr T GetWidth() const {
27 if constexpr (std::is_floating_point_v<T>) { 50 if constexpr (std::is_floating_point_v<T>) {
28 return std::abs(right - left); 51 return std::abs(right - left);
29 } else { 52 } else {
@@ -31,7 +54,7 @@ struct Rectangle {
31 } 54 }
32 } 55 }
33 56
34 [[nodiscard]] T GetHeight() const { 57 [[nodiscard]] constexpr T GetHeight() const {
35 if constexpr (std::is_floating_point_v<T>) { 58 if constexpr (std::is_floating_point_v<T>) {
36 return std::abs(bottom - top); 59 return std::abs(bottom - top);
37 } else { 60 } else {
@@ -39,18 +62,35 @@ struct Rectangle {
39 } 62 }
40 } 63 }
41 64
42 [[nodiscard]] Rectangle<T> TranslateX(const T x) const { 65 [[nodiscard]] constexpr Rectangle<T> TranslateX(const T x) const {
43 return Rectangle{left + x, top, right + x, bottom}; 66 return Rectangle{left + x, top, right + x, bottom};
44 } 67 }
45 68
46 [[nodiscard]] Rectangle<T> TranslateY(const T y) const { 69 [[nodiscard]] constexpr Rectangle<T> TranslateY(const T y) const {
47 return Rectangle{left, top + y, right, bottom + y}; 70 return Rectangle{left, top + y, right, bottom + y};
48 } 71 }
49 72
50 [[nodiscard]] Rectangle<T> Scale(const float s) const { 73 [[nodiscard]] constexpr Rectangle<T> Scale(const float s) const {
51 return Rectangle{left, top, static_cast<T>(static_cast<float>(left + GetWidth()) * s), 74 return Rectangle{left, top, static_cast<T>(static_cast<float>(left + GetWidth()) * s),
52 static_cast<T>(static_cast<float>(top + GetHeight()) * s)}; 75 static_cast<T>(static_cast<float>(top + GetHeight()) * s)};
53 } 76 }
77
78 [[nodiscard]] constexpr bool operator==(const Rectangle<T>& rhs) const {
79 return (left == rhs.left) && (top == rhs.top) && (right == rhs.right) &&
80 (bottom == rhs.bottom);
81 }
82
83 [[nodiscard]] constexpr bool operator!=(const Rectangle<T>& rhs) const {
84 return !operator==(rhs);
85 }
86
87 [[nodiscard]] constexpr bool Intersect(const Rectangle<T>& with, Rectangle<T>* result) const {
88 result->left = std::max(left, with.left);
89 result->top = std::max(top, with.top);
90 result->right = std::min(right, with.right);
91 result->bottom = std::min(bottom, with.bottom);
92 return !result->IsEmpty();
93 }
54}; 94};
55 95
56template <typename T> 96template <typename T>
diff --git a/src/common/memory_detect.cpp b/src/common/memory_detect.cpp
index 8cff6ec37..7a75a5ff4 100644
--- a/src/common/memory_detect.cpp
+++ b/src/common/memory_detect.cpp
@@ -70,4 +70,4 @@ const MemoryInfo& GetMemInfo() {
70 return mem_info; 70 return mem_info;
71} 71}
72 72
73} // namespace Common \ No newline at end of file 73} // namespace Common
diff --git a/src/common/nvidia_flags.cpp b/src/common/nvidia_flags.cpp
index d1afd1f1d..c732c233e 100644
--- a/src/common/nvidia_flags.cpp
+++ b/src/common/nvidia_flags.cpp
@@ -6,7 +6,6 @@
6 6
7#include <fmt/format.h> 7#include <fmt/format.h>
8 8
9#include "common/fs/file.h"
10#include "common/fs/fs.h" 9#include "common/fs/fs.h"
11#include "common/fs/path_util.h" 10#include "common/fs/path_util.h"
12#include "common/nvidia_flags.h" 11#include "common/nvidia_flags.h"
diff --git a/src/common/page_table.h b/src/common/page_table.h
index 82d91e9f3..13f4b44c0 100644
--- a/src/common/page_table.h
+++ b/src/common/page_table.h
@@ -5,7 +5,6 @@
5#pragma once 5#pragma once
6 6
7#include <atomic> 7#include <atomic>
8#include <tuple>
9 8
10#include "common/common_types.h" 9#include "common/common_types.h"
11#include "common/virtual_buffer.h" 10#include "common/virtual_buffer.h"
diff --git a/src/common/parent_of_member.h b/src/common/parent_of_member.h
index 58c70b0e7..ad075615b 100644
--- a/src/common/parent_of_member.h
+++ b/src/common/parent_of_member.h
@@ -7,7 +7,6 @@
7#include <type_traits> 7#include <type_traits>
8 8
9#include "common/assert.h" 9#include "common/assert.h"
10#include "common/common_types.h"
11 10
12namespace Common { 11namespace Common {
13namespace detail { 12namespace detail {
diff --git a/src/common/ring_buffer.h b/src/common/ring_buffer.h
index 4a8d09806..db6aa6b95 100644
--- a/src/common/ring_buffer.h
+++ b/src/common/ring_buffer.h
@@ -12,7 +12,6 @@
12#include <new> 12#include <new>
13#include <type_traits> 13#include <type_traits>
14#include <vector> 14#include <vector>
15#include "common/common_types.h"
16 15
17namespace Common { 16namespace Common {
18 17
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index 662171138..3695dae4d 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -5,11 +5,9 @@
5#include <algorithm> 5#include <algorithm>
6#include <cctype> 6#include <cctype>
7#include <codecvt> 7#include <codecvt>
8#include <cstdlib>
9#include <locale> 8#include <locale>
10#include <sstream> 9#include <sstream>
11 10
12#include "common/logging/log.h"
13#include "common/string_util.h" 11#include "common/string_util.h"
14 12
15#ifdef _WIN32 13#ifdef _WIN32
diff --git a/src/common/telemetry.cpp b/src/common/telemetry.cpp
index 98c82cd17..67261c55b 100644
--- a/src/common/telemetry.cpp
+++ b/src/common/telemetry.cpp
@@ -4,7 +4,6 @@
4 4
5#include <algorithm> 5#include <algorithm>
6#include <cstring> 6#include <cstring>
7#include "common/assert.h"
8#include "common/scm_rev.h" 7#include "common/scm_rev.h"
9#include "common/telemetry.h" 8#include "common/telemetry.h"
10 9
diff --git a/src/common/telemetry.h b/src/common/telemetry.h
index 3524c857e..f9a824a7d 100644
--- a/src/common/telemetry.h
+++ b/src/common/telemetry.h
@@ -8,7 +8,6 @@
8#include <map> 8#include <map>
9#include <memory> 9#include <memory>
10#include <string> 10#include <string>
11#include <string_view>
12#include "common/common_funcs.h" 11#include "common/common_funcs.h"
13#include "common/common_types.h" 12#include "common/common_types.h"
14 13
diff --git a/src/common/uint128.h b/src/common/uint128.h
index 4780b2f9d..ad1b90414 100644
--- a/src/common/uint128.h
+++ b/src/common/uint128.h
@@ -4,7 +4,6 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cstring>
8#include <utility> 7#include <utility>
9 8
10#ifdef _MSC_VER 9#ifdef _MSC_VER
@@ -13,6 +12,7 @@
13#pragma intrinsic(_umul128) 12#pragma intrinsic(_umul128)
14#pragma intrinsic(_udiv128) 13#pragma intrinsic(_udiv128)
15#else 14#else
15#include <cstring>
16#include <x86intrin.h> 16#include <x86intrin.h>
17#endif 17#endif
18 18
diff --git a/src/common/uuid.h b/src/common/uuid.h
index fe31e64e6..c450d9e20 100644
--- a/src/common/uuid.h
+++ b/src/common/uuid.h
@@ -7,7 +7,6 @@
7#include <array> 7#include <array>
8#include <functional> 8#include <functional>
9#include <string> 9#include <string>
10#include <string_view>
11 10
12#include "common/common_types.h" 11#include "common/common_types.h"
13 12
diff --git a/src/common/virtual_buffer.h b/src/common/virtual_buffer.h
index fb1a6f81f..cac4f4895 100644
--- a/src/common/virtual_buffer.h
+++ b/src/common/virtual_buffer.h
@@ -4,7 +4,6 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <type_traits>
8#include <utility> 7#include <utility>
9 8
10namespace Common { 9namespace Common {
diff --git a/src/common/wall_clock.cpp b/src/common/wall_clock.cpp
index 9acf7551e..f30d91692 100644
--- a/src/common/wall_clock.cpp
+++ b/src/common/wall_clock.cpp
@@ -2,8 +2,6 @@
2// Licensed under GPLv2 or any later version 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 <cstdint>
6
7#include "common/uint128.h" 5#include "common/uint128.h"
8#include "common/wall_clock.h" 6#include "common/wall_clock.h"
9 7
diff --git a/src/common/x64/cpu_detect.cpp b/src/common/x64/cpu_detect.cpp
index d81edb140..f5296b32a 100644
--- a/src/common/x64/cpu_detect.cpp
+++ b/src/common/x64/cpu_detect.cpp
@@ -4,7 +4,6 @@
4#include <array> 4#include <array>
5#include <cstring> 5#include <cstring>
6#include <iterator> 6#include <iterator>
7#include <span>
8#include <string_view> 7#include <string_view>
9#include "common/bit_util.h" 8#include "common/bit_util.h"
10#include "common/common_types.h" 9#include "common/common_types.h"
diff --git a/src/common/x64/native_clock.cpp b/src/common/x64/native_clock.cpp
index 91b842829..347e41efc 100644
--- a/src/common/x64/native_clock.cpp
+++ b/src/common/x64/native_clock.cpp
@@ -4,8 +4,6 @@
4 4
5#include <array> 5#include <array>
6#include <chrono> 6#include <chrono>
7#include <limits>
8#include <mutex>
9#include <thread> 7#include <thread>
10 8
11#include "common/atomic_ops.h" 9#include "common/atomic_ops.h"
diff --git a/src/common/x64/native_clock.h b/src/common/x64/native_clock.h
index 7cbd400d2..2c3082ea0 100644
--- a/src/common/x64/native_clock.h
+++ b/src/common/x64/native_clock.h
@@ -4,8 +4,6 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <optional>
8
9#include "common/wall_clock.h" 7#include "common/wall_clock.h"
10 8
11namespace Common { 9namespace Common {