summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------externals/dynarmic0
-rw-r--r--src/core/CMakeLists.txt44
-rw-r--r--src/core/core_timing.cpp53
-rw-r--r--src/core/core_timing.h53
-rw-r--r--src/core/core_timing_util.cpp63
-rw-r--r--src/core/core_timing_util.h64
-rw-r--r--src/core/hle/ipc_helpers.h8
-rw-r--r--src/core/hle/kernel/svc.cpp15
-rw-r--r--src/core/hle/kernel/thread.cpp1
-rw-r--r--src/core/hle/kernel/timer.cpp1
-rw-r--r--src/core/hle/service/audio/audout_u.cpp1
-rw-r--r--src/core/hle/service/audio/audren_u.cpp1
-rw-r--r--src/core/hle/service/erpt/erpt.cpp51
-rw-r--r--src/core/hle/service/erpt/erpt.h16
-rw-r--r--src/core/hle/service/es/es.cpp57
-rw-r--r--src/core/hle/service/es/es.h16
-rw-r--r--src/core/hle/service/eupld/eupld.cpp52
-rw-r--r--src/core/hle/service/eupld/eupld.h16
-rw-r--r--src/core/hle/service/friend/friend.cpp10
-rw-r--r--src/core/hle/service/friend/friend_u.cpp18
-rw-r--r--src/core/hle/service/friend/friend_u.h16
-rw-r--r--src/core/hle/service/friend/interface.cpp (renamed from src/core/hle/service/friend/friend_a.cpp)9
-rw-r--r--src/core/hle/service/friend/interface.h (renamed from src/core/hle/service/friend/friend_a.h)4
-rw-r--r--src/core/hle/service/hid/hid.cpp1
-rw-r--r--src/core/hle/service/ldr/ldr.cpp81
-rw-r--r--src/core/hle/service/ldr/ldr.h16
-rw-r--r--src/core/hle/service/lm/lm.cpp60
-rw-r--r--src/core/hle/service/lm/lm.h15
-rw-r--r--src/core/hle/service/nifm/nifm.cpp47
-rw-r--r--src/core/hle/service/nifm/nifm.h19
-rw-r--r--src/core/hle/service/nifm/nifm_a.cpp17
-rw-r--r--src/core/hle/service/nifm/nifm_a.h16
-rw-r--r--src/core/hle/service/nifm/nifm_s.cpp17
-rw-r--r--src/core/hle/service/nifm/nifm_s.h16
-rw-r--r--src/core/hle/service/nifm/nifm_u.cpp17
-rw-r--r--src/core/hle/service/nifm/nifm_u.h16
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp10
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h2
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp1
-rw-r--r--src/core/hle/service/pm/pm.cpp70
-rw-r--r--src/core/hle/service/pm/pm.h16
-rw-r--r--src/core/hle/service/service.cpp10
-rw-r--r--src/core/hle/service/set/set_sys.cpp19
-rw-r--r--src/core/hle/service/set/set_sys.h11
-rw-r--r--src/core/hle/service/time/interface.cpp (renamed from src/core/hle/service/time/time_s.cpp)15
-rw-r--r--src/core/hle/service/time/interface.h (renamed from src/core/hle/service/time/time_s.h)4
-rw-r--r--src/core/hle/service/time/time.cpp9
-rw-r--r--src/core/hle/service/time/time_u.cpp31
-rw-r--r--src/core/hle/service/time/time_u.h16
-rw-r--r--src/core/loader/deconstructed_rom_directory.cpp29
-rw-r--r--src/video_core/engines/maxwell_3d.cpp8
-rw-r--r--src/video_core/gpu.h8
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp19
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h10
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp41
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h116
-rw-r--r--src/video_core/textures/decoders.cpp9
-rw-r--r--src/yuzu/debugger/wait_tree.cpp7
58 files changed, 881 insertions, 487 deletions
diff --git a/externals/dynarmic b/externals/dynarmic
Subproject fc6b73bd855d0b87b6d78ba859732a4616e5a85 Subproject 98e23801297167db1fd266696484a49096e734c
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 6b6efbc00..2e2de59b1 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -10,6 +10,8 @@ add_library(core STATIC
10 core_cpu.h 10 core_cpu.h
11 core_timing.cpp 11 core_timing.cpp
12 core_timing.h 12 core_timing.h
13 core_timing_util.cpp
14 core_timing_util.h
13 file_sys/content_archive.cpp 15 file_sys/content_archive.cpp
14 file_sys/content_archive.h 16 file_sys/content_archive.h
15 file_sys/control_metadata.cpp 17 file_sys/control_metadata.cpp
@@ -114,26 +116,32 @@ add_library(core STATIC
114 hle/service/apm/apm.h 116 hle/service/apm/apm.h
115 hle/service/apm/interface.cpp 117 hle/service/apm/interface.cpp
116 hle/service/apm/interface.h 118 hle/service/apm/interface.h
117 hle/service/audio/audio.cpp
118 hle/service/audio/audio.h
119 hle/service/audio/audin_u.cpp 119 hle/service/audio/audin_u.cpp
120 hle/service/audio/audin_u.h 120 hle/service/audio/audin_u.h
121 hle/service/audio/audio.cpp
122 hle/service/audio/audio.h
121 hle/service/audio/audout_u.cpp 123 hle/service/audio/audout_u.cpp
122 hle/service/audio/audout_u.h 124 hle/service/audio/audout_u.h
123 hle/service/audio/audrec_u.cpp 125 hle/service/audio/audrec_u.cpp
124 hle/service/audio/audrec_u.h 126 hle/service/audio/audrec_u.h
125 hle/service/audio/audren_u.cpp 127 hle/service/audio/audren_u.cpp
126 hle/service/audio/audren_u.h
127 hle/service/audio/audren_u.cpp 128 hle/service/audio/audren_u.cpp
128 hle/service/audio/audren_u.h 129 hle/service/audio/audren_u.h
130 hle/service/audio/audren_u.h
129 hle/service/audio/codecctl.cpp 131 hle/service/audio/codecctl.cpp
130 hle/service/audio/codecctl.h 132 hle/service/audio/codecctl.h
131 hle/service/audio/hwopus.cpp 133 hle/service/audio/hwopus.cpp
132 hle/service/audio/hwopus.h 134 hle/service/audio/hwopus.h
133 hle/service/bcat/module.cpp
134 hle/service/bcat/module.h
135 hle/service/bcat/bcat.cpp 135 hle/service/bcat/bcat.cpp
136 hle/service/bcat/bcat.h 136 hle/service/bcat/bcat.h
137 hle/service/bcat/module.cpp
138 hle/service/bcat/module.h
139 hle/service/erpt/erpt.cpp
140 hle/service/erpt/erpt.h
141 hle/service/es/es.cpp
142 hle/service/es/es.h
143 hle/service/eupld/eupld.cpp
144 hle/service/eupld/eupld.h
137 hle/service/fatal/fatal.cpp 145 hle/service/fatal/fatal.cpp
138 hle/service/fatal/fatal.h 146 hle/service/fatal/fatal.h
139 hle/service/fatal/fatal_p.cpp 147 hle/service/fatal/fatal_p.cpp
@@ -146,28 +154,22 @@ add_library(core STATIC
146 hle/service/filesystem/fsp_srv.h 154 hle/service/filesystem/fsp_srv.h
147 hle/service/friend/friend.cpp 155 hle/service/friend/friend.cpp
148 hle/service/friend/friend.h 156 hle/service/friend/friend.h
149 hle/service/friend/friend_a.cpp 157 hle/service/friend/interface.cpp
150 hle/service/friend/friend_a.h 158 hle/service/friend/interface.h
151 hle/service/friend/friend_u.cpp
152 hle/service/friend/friend_u.h
153 hle/service/hid/hid.cpp 159 hle/service/hid/hid.cpp
154 hle/service/hid/hid.h 160 hle/service/hid/hid.h
161 hle/service/ldr/ldr.cpp
162 hle/service/ldr/ldr.h
155 hle/service/lm/lm.cpp 163 hle/service/lm/lm.cpp
156 hle/service/lm/lm.h 164 hle/service/lm/lm.h
157 hle/service/mm/mm_u.cpp 165 hle/service/mm/mm_u.cpp
158 hle/service/mm/mm_u.h 166 hle/service/mm/mm_u.h
159 hle/service/nifm/nifm.cpp
160 hle/service/nifm/nifm.h
161 hle/service/nifm/nifm_a.cpp
162 hle/service/nifm/nifm_a.h
163 hle/service/nifm/nifm_s.cpp
164 hle/service/nifm/nifm_s.h
165 hle/service/nifm/nifm_u.cpp
166 hle/service/nifm/nifm_u.h
167 hle/service/nfp/nfp.cpp 167 hle/service/nfp/nfp.cpp
168 hle/service/nfp/nfp.h 168 hle/service/nfp/nfp.h
169 hle/service/nfp/nfp_user.cpp 169 hle/service/nfp/nfp_user.cpp
170 hle/service/nfp/nfp_user.h 170 hle/service/nfp/nfp_user.h
171 hle/service/nifm/nifm.cpp
172 hle/service/nifm/nifm.h
171 hle/service/ns/ns.cpp 173 hle/service/ns/ns.cpp
172 hle/service/ns/ns.h 174 hle/service/ns/ns.h
173 hle/service/ns/pl_u.cpp 175 hle/service/ns/pl_u.cpp
@@ -201,6 +203,8 @@ add_library(core STATIC
201 hle/service/pctl/module.h 203 hle/service/pctl/module.h
202 hle/service/pctl/pctl.cpp 204 hle/service/pctl/pctl.cpp
203 hle/service/pctl/pctl.h 205 hle/service/pctl/pctl.h
206 hle/service/pm/pm.cpp
207 hle/service/pm/pm.h
204 hle/service/prepo/prepo.cpp 208 hle/service/prepo/prepo.cpp
205 hle/service/prepo/prepo.h 209 hle/service/prepo/prepo.h
206 hle/service/service.cpp 210 hle/service/service.cpp
@@ -235,12 +239,10 @@ add_library(core STATIC
235 hle/service/spl/spl.h 239 hle/service/spl/spl.h
236 hle/service/ssl/ssl.cpp 240 hle/service/ssl/ssl.cpp
237 hle/service/ssl/ssl.h 241 hle/service/ssl/ssl.h
242 hle/service/time/interface.cpp
243 hle/service/time/interface.h
238 hle/service/time/time.cpp 244 hle/service/time/time.cpp
239 hle/service/time/time.h 245 hle/service/time/time.h
240 hle/service/time/time_s.cpp
241 hle/service/time/time_s.h
242 hle/service/time/time_u.cpp
243 hle/service/time/time_u.h
244 hle/service/vi/vi.cpp 246 hle/service/vi/vi.cpp
245 hle/service/vi/vi.h 247 hle/service/vi/vi.h
246 hle/service/vi/vi_m.cpp 248 hle/service/vi/vi_m.cpp
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 50d1e3fc9..a1b6f96f1 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -5,17 +5,15 @@
5#include "core/core_timing.h" 5#include "core/core_timing.h"
6 6
7#include <algorithm> 7#include <algorithm>
8#include <cinttypes>
9#include <limits>
10#include <mutex> 8#include <mutex>
11#include <string> 9#include <string>
12#include <tuple> 10#include <tuple>
13#include <unordered_map> 11#include <unordered_map>
14#include <vector> 12#include <vector>
15#include "common/assert.h" 13#include "common/assert.h"
16#include "common/logging/log.h"
17#include "common/thread.h" 14#include "common/thread.h"
18#include "common/threadsafe_queue.h" 15#include "common/threadsafe_queue.h"
16#include "core/core_timing_util.h"
19 17
20namespace CoreTiming { 18namespace CoreTiming {
21 19
@@ -59,7 +57,6 @@ static u64 event_fifo_id;
59static Common::MPSCQueue<Event, false> ts_queue; 57static Common::MPSCQueue<Event, false> ts_queue;
60 58
61constexpr int MAX_SLICE_LENGTH = 20000; 59constexpr int MAX_SLICE_LENGTH = 20000;
62constexpr u64 MAX_VALUE_TO_MULTIPLY = std::numeric_limits<s64>::max() / BASE_CLOCK_RATE;
63 60
64static s64 idled_cycles; 61static s64 idled_cycles;
65 62
@@ -72,54 +69,6 @@ static EventType* ev_lost = nullptr;
72 69
73static void EmptyTimedCallback(u64 userdata, s64 cyclesLate) {} 70static void EmptyTimedCallback(u64 userdata, s64 cyclesLate) {}
74 71
75s64 usToCycles(s64 us) {
76 if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
77 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
78 return std::numeric_limits<s64>::max();
79 }
80 if (us > MAX_VALUE_TO_MULTIPLY) {
81 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
82 return BASE_CLOCK_RATE * (us / 1000000);
83 }
84 return (BASE_CLOCK_RATE * us) / 1000000;
85}
86
87s64 usToCycles(u64 us) {
88 if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
89 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
90 return std::numeric_limits<s64>::max();
91 }
92 if (us > MAX_VALUE_TO_MULTIPLY) {
93 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
94 return BASE_CLOCK_RATE * static_cast<s64>(us / 1000000);
95 }
96 return (BASE_CLOCK_RATE * static_cast<s64>(us)) / 1000000;
97}
98
99s64 nsToCycles(s64 ns) {
100 if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
101 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
102 return std::numeric_limits<s64>::max();
103 }
104 if (ns > MAX_VALUE_TO_MULTIPLY) {
105 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
106 return BASE_CLOCK_RATE * (ns / 1000000000);
107 }
108 return (BASE_CLOCK_RATE * ns) / 1000000000;
109}
110
111s64 nsToCycles(u64 ns) {
112 if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
113 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
114 return std::numeric_limits<s64>::max();
115 }
116 if (ns > MAX_VALUE_TO_MULTIPLY) {
117 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
118 return BASE_CLOCK_RATE * (static_cast<s64>(ns) / 1000000000);
119 }
120 return (BASE_CLOCK_RATE * static_cast<s64>(ns)) / 1000000000;
121}
122
123EventType* RegisterEvent(const std::string& name, TimedCallback callback) { 72EventType* RegisterEvent(const std::string& name, TimedCallback callback) {
124 // check for existing type with same name. 73 // check for existing type with same name.
125 // we want event type names to remain unique so that we can use them for serialization. 74 // we want event type names to remain unique so that we can use them for serialization.
diff --git a/src/core/core_timing.h b/src/core/core_timing.h
index dc31124a8..7fe6380ad 100644
--- a/src/core/core_timing.h
+++ b/src/core/core_timing.h
@@ -23,59 +23,6 @@
23 23
24namespace CoreTiming { 24namespace CoreTiming {
25 25
26// The below clock rate is based on Switch's clockspeed being widely known as 1.020GHz
27// The exact value used is of course unverified.
28constexpr u64 BASE_CLOCK_RATE = 1019215872; // Switch clock speed is 1020MHz un/docked
29
30inline s64 msToCycles(int ms) {
31 // since ms is int there is no way to overflow
32 return BASE_CLOCK_RATE * static_cast<s64>(ms) / 1000;
33}
34
35inline s64 msToCycles(float ms) {
36 return static_cast<s64>(BASE_CLOCK_RATE * (0.001f) * ms);
37}
38
39inline s64 msToCycles(double ms) {
40 return static_cast<s64>(BASE_CLOCK_RATE * (0.001) * ms);
41}
42
43inline s64 usToCycles(float us) {
44 return static_cast<s64>(BASE_CLOCK_RATE * (0.000001f) * us);
45}
46
47inline s64 usToCycles(int us) {
48 return (BASE_CLOCK_RATE * static_cast<s64>(us) / 1000000);
49}
50
51s64 usToCycles(s64 us);
52
53s64 usToCycles(u64 us);
54
55inline s64 nsToCycles(float ns) {
56 return static_cast<s64>(BASE_CLOCK_RATE * (0.000000001f) * ns);
57}
58
59inline s64 nsToCycles(int ns) {
60 return BASE_CLOCK_RATE * static_cast<s64>(ns) / 1000000000;
61}
62
63s64 nsToCycles(s64 ns);
64
65s64 nsToCycles(u64 ns);
66
67inline u64 cyclesToNs(s64 cycles) {
68 return cycles * 1000000000 / BASE_CLOCK_RATE;
69}
70
71inline s64 cyclesToUs(s64 cycles) {
72 return cycles * 1000000 / BASE_CLOCK_RATE;
73}
74
75inline u64 cyclesToMs(s64 cycles) {
76 return cycles * 1000 / BASE_CLOCK_RATE;
77}
78
79/** 26/**
80 * CoreTiming begins at the boundary of timing slice -1. An initial call to Advance() is 27 * CoreTiming begins at the boundary of timing slice -1. An initial call to Advance() is
81 * required to end slice -1 and start slice 0 before the first cycle of code is executed. 28 * required to end slice -1 and start slice 0 before the first cycle of code is executed.
diff --git a/src/core/core_timing_util.cpp b/src/core/core_timing_util.cpp
new file mode 100644
index 000000000..73dea4edb
--- /dev/null
+++ b/src/core/core_timing_util.cpp
@@ -0,0 +1,63 @@
1// Copyright 2008 Dolphin Emulator Project / 2017 Citra Emulator Project
2// Licensed under GPLv2+
3// Refer to the license.txt file included.
4
5#include "core/core_timing_util.h"
6
7#include <cinttypes>
8#include <limits>
9#include "common/logging/log.h"
10
11namespace CoreTiming {
12
13constexpr u64 MAX_VALUE_TO_MULTIPLY = std::numeric_limits<s64>::max() / BASE_CLOCK_RATE;
14
15s64 usToCycles(s64 us) {
16 if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
17 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
18 return std::numeric_limits<s64>::max();
19 }
20 if (us > MAX_VALUE_TO_MULTIPLY) {
21 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
22 return BASE_CLOCK_RATE * (us / 1000000);
23 }
24 return (BASE_CLOCK_RATE * us) / 1000000;
25}
26
27s64 usToCycles(u64 us) {
28 if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
29 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
30 return std::numeric_limits<s64>::max();
31 }
32 if (us > MAX_VALUE_TO_MULTIPLY) {
33 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
34 return BASE_CLOCK_RATE * static_cast<s64>(us / 1000000);
35 }
36 return (BASE_CLOCK_RATE * static_cast<s64>(us)) / 1000000;
37}
38
39s64 nsToCycles(s64 ns) {
40 if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
41 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
42 return std::numeric_limits<s64>::max();
43 }
44 if (ns > MAX_VALUE_TO_MULTIPLY) {
45 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
46 return BASE_CLOCK_RATE * (ns / 1000000000);
47 }
48 return (BASE_CLOCK_RATE * ns) / 1000000000;
49}
50
51s64 nsToCycles(u64 ns) {
52 if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
53 LOG_ERROR(Core_Timing, "Integer overflow, use max value");
54 return std::numeric_limits<s64>::max();
55 }
56 if (ns > MAX_VALUE_TO_MULTIPLY) {
57 LOG_DEBUG(Core_Timing, "Time very big, do rounding");
58 return BASE_CLOCK_RATE * (static_cast<s64>(ns) / 1000000000);
59 }
60 return (BASE_CLOCK_RATE * static_cast<s64>(ns)) / 1000000000;
61}
62
63} // namespace CoreTiming
diff --git a/src/core/core_timing_util.h b/src/core/core_timing_util.h
new file mode 100644
index 000000000..5c3718782
--- /dev/null
+++ b/src/core/core_timing_util.h
@@ -0,0 +1,64 @@
1// Copyright 2008 Dolphin Emulator Project / 2017 Citra Emulator Project
2// Licensed under GPLv2+
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "common/common_types.h"
8
9namespace CoreTiming {
10
11// The below clock rate is based on Switch's clockspeed being widely known as 1.020GHz
12// The exact value used is of course unverified.
13constexpr u64 BASE_CLOCK_RATE = 1019215872; // Switch clock speed is 1020MHz un/docked
14
15inline s64 msToCycles(int ms) {
16 // since ms is int there is no way to overflow
17 return BASE_CLOCK_RATE * static_cast<s64>(ms) / 1000;
18}
19
20inline s64 msToCycles(float ms) {
21 return static_cast<s64>(BASE_CLOCK_RATE * (0.001f) * ms);
22}
23
24inline s64 msToCycles(double ms) {
25 return static_cast<s64>(BASE_CLOCK_RATE * (0.001) * ms);
26}
27
28inline s64 usToCycles(float us) {
29 return static_cast<s64>(BASE_CLOCK_RATE * (0.000001f) * us);
30}
31
32inline s64 usToCycles(int us) {
33 return (BASE_CLOCK_RATE * static_cast<s64>(us) / 1000000);
34}
35
36s64 usToCycles(s64 us);
37
38s64 usToCycles(u64 us);
39
40inline s64 nsToCycles(float ns) {
41 return static_cast<s64>(BASE_CLOCK_RATE * (0.000000001f) * ns);
42}
43
44inline s64 nsToCycles(int ns) {
45 return BASE_CLOCK_RATE * static_cast<s64>(ns) / 1000000000;
46}
47
48s64 nsToCycles(s64 ns);
49
50s64 nsToCycles(u64 ns);
51
52inline u64 cyclesToNs(s64 cycles) {
53 return cycles * 1000000000 / BASE_CLOCK_RATE;
54}
55
56inline s64 cyclesToUs(s64 cycles) {
57 return cycles * 1000000 / BASE_CLOCK_RATE;
58}
59
60inline u64 cyclesToMs(s64 cycles) {
61 return cycles * 1000 / BASE_CLOCK_RATE;
62}
63
64} // namespace CoreTiming
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index f5bd27a75..7fb0da408 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -300,6 +300,14 @@ public:
300 template <typename First, typename... Other> 300 template <typename First, typename... Other>
301 void Pop(First& first_value, Other&... other_values); 301 void Pop(First& first_value, Other&... other_values);
302 302
303 template <typename T>
304 T PopEnum() {
305 static_assert(std::is_enum_v<T>, "T must be an enum type within a PopEnum call.");
306 static_assert(!std::is_convertible_v<T, int>,
307 "enum type in PopEnum must be a strongly typed enum.");
308 return static_cast<T>(Pop<std::underlying_type_t<T>>());
309 }
310
303 /** 311 /**
304 * @brief Reads the next normal parameters as a struct, by copying it 312 * @brief Reads the next normal parameters as a struct, by copying it
305 * @note: The output class must be correctly packed/padded to fit hardware layout. 313 * @note: The output class must be correctly packed/padded to fit hardware layout.
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 7b41c9cfd..0b439401a 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -40,7 +40,9 @@ static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) {
40} 40}
41 41
42static ResultCode SetMemoryAttribute(VAddr addr, u64 size, u32 state0, u32 state1) { 42static ResultCode SetMemoryAttribute(VAddr addr, u64 size, u32 state0, u32 state1) {
43 LOG_WARNING(Kernel_SVC, "(STUBBED) called, addr=0x{:X}", addr); 43 LOG_WARNING(Kernel_SVC,
44 "(STUBBED) called, addr=0x{:X}, size=0x{:X}, state0=0x{:X}, state1=0x{:X}", addr,
45 size, state0, state1);
44 return RESULT_SUCCESS; 46 return RESULT_SUCCESS;
45} 47}
46 48
@@ -165,11 +167,14 @@ static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64
165 using ObjectPtr = SharedPtr<WaitObject>; 167 using ObjectPtr = SharedPtr<WaitObject>;
166 std::vector<ObjectPtr> objects(handle_count); 168 std::vector<ObjectPtr> objects(handle_count);
167 169
168 for (int i = 0; i < handle_count; ++i) { 170 for (u64 i = 0; i < handle_count; ++i) {
169 Handle handle = Memory::Read32(handles_address + i * sizeof(Handle)); 171 const Handle handle = Memory::Read32(handles_address + i * sizeof(Handle));
170 auto object = g_handle_table.Get<WaitObject>(handle); 172 const auto object = g_handle_table.Get<WaitObject>(handle);
171 if (object == nullptr) 173
174 if (object == nullptr) {
172 return ERR_INVALID_HANDLE; 175 return ERR_INVALID_HANDLE;
176 }
177
173 objects[i] = object; 178 objects[i] = object;
174 } 179 }
175 180
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index cd85c4b7c..94735c86e 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -14,6 +14,7 @@
14#include "core/arm/arm_interface.h" 14#include "core/arm/arm_interface.h"
15#include "core/core.h" 15#include "core/core.h"
16#include "core/core_timing.h" 16#include "core/core_timing.h"
17#include "core/core_timing_util.h"
17#include "core/hle/kernel/errors.h" 18#include "core/hle/kernel/errors.h"
18#include "core/hle/kernel/handle_table.h" 19#include "core/hle/kernel/handle_table.h"
19#include "core/hle/kernel/kernel.h" 20#include "core/hle/kernel/kernel.h"
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp
index 0141125e4..904a3d0a5 100644
--- a/src/core/hle/kernel/timer.cpp
+++ b/src/core/hle/kernel/timer.cpp
@@ -6,6 +6,7 @@
6#include "common/assert.h" 6#include "common/assert.h"
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "core/core_timing.h" 8#include "core/core_timing.h"
9#include "core/core_timing_util.h"
9#include "core/hle/kernel/handle_table.h" 10#include "core/hle/kernel/handle_table.h"
10#include "core/hle/kernel/kernel.h" 11#include "core/hle/kernel/kernel.h"
11#include "core/hle/kernel/thread.h" 12#include "core/hle/kernel/thread.h"
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp
index 154bc12da..1dcd84d98 100644
--- a/src/core/hle/service/audio/audout_u.cpp
+++ b/src/core/hle/service/audio/audout_u.cpp
@@ -6,6 +6,7 @@
6#include <vector> 6#include <vector>
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "core/core_timing.h" 8#include "core/core_timing.h"
9#include "core/core_timing_util.h"
9#include "core/hle/ipc_helpers.h" 10#include "core/hle/ipc_helpers.h"
10#include "core/hle/kernel/event.h" 11#include "core/hle/kernel/event.h"
11#include "core/hle/kernel/hle_ipc.h" 12#include "core/hle/kernel/hle_ipc.h"
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index e623f4f8e..6aed9e2fa 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -7,6 +7,7 @@
7#include "common/alignment.h" 7#include "common/alignment.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "core/core_timing.h" 9#include "core/core_timing.h"
10#include "core/core_timing_util.h"
10#include "core/hle/ipc_helpers.h" 11#include "core/hle/ipc_helpers.h"
11#include "core/hle/kernel/event.h" 12#include "core/hle/kernel/event.h"
12#include "core/hle/kernel/hle_ipc.h" 13#include "core/hle/kernel/hle_ipc.h"
diff --git a/src/core/hle/service/erpt/erpt.cpp b/src/core/hle/service/erpt/erpt.cpp
new file mode 100644
index 000000000..ee11cd78e
--- /dev/null
+++ b/src/core/hle/service/erpt/erpt.cpp
@@ -0,0 +1,51 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <memory>
6
7#include "core/hle/service/erpt/erpt.h"
8#include "core/hle/service/service.h"
9#include "core/hle/service/sm/sm.h"
10
11namespace Service::ERPT {
12
13class ErrorReportContext final : public ServiceFramework<ErrorReportContext> {
14public:
15 explicit ErrorReportContext() : ServiceFramework{"erpt:c"} {
16 // clang-format off
17 static const FunctionInfo functions[] = {
18 {0, nullptr, "SubmitContext"},
19 {1, nullptr, "CreateReport"},
20 {2, nullptr, "Unknown1"},
21 {3, nullptr, "Unknown2"},
22 {4, nullptr, "Unknown3"},
23 {5, nullptr, "Unknown4"},
24 {6, nullptr, "Unknown5"},
25 };
26 // clang-format on
27
28 RegisterHandlers(functions);
29 }
30};
31
32class ErrorReportSession final : public ServiceFramework<ErrorReportSession> {
33public:
34 explicit ErrorReportSession() : ServiceFramework{"erpt:r"} {
35 // clang-format off
36 static const FunctionInfo functions[] = {
37 {0, nullptr, "OpenReport"},
38 {1, nullptr, "OpenManager"},
39 };
40 // clang-format on
41
42 RegisterHandlers(functions);
43 }
44};
45
46void InstallInterfaces(SM::ServiceManager& sm) {
47 std::make_shared<ErrorReportContext>()->InstallAsService(sm);
48 std::make_shared<ErrorReportSession>()->InstallAsService(sm);
49}
50
51} // namespace Service::ERPT
diff --git a/src/core/hle/service/erpt/erpt.h b/src/core/hle/service/erpt/erpt.h
new file mode 100644
index 000000000..de439ab6d
--- /dev/null
+++ b/src/core/hle/service/erpt/erpt.h
@@ -0,0 +1,16 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7namespace Service::SM {
8class ServiceManager;
9}
10
11namespace Service::ERPT {
12
13/// Registers all ERPT services with the specified service manager.
14void InstallInterfaces(SM::ServiceManager& sm);
15
16} // namespace Service::ERPT
diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp
new file mode 100644
index 000000000..d40f18565
--- /dev/null
+++ b/src/core/hle/service/es/es.cpp
@@ -0,0 +1,57 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/hle/service/service.h"
6
7namespace Service::ES {
8
9class ETicket final : public ServiceFramework<ETicket> {
10public:
11 explicit ETicket() : ServiceFramework{"es"} {
12 static const FunctionInfo functions[] = {
13 {1, nullptr, "ImportTicket"},
14 {2, nullptr, "ImportTicketCertificateSet"},
15 {3, nullptr, "DeleteTicket"},
16 {4, nullptr, "DeletePersonalizedTicket"},
17 {5, nullptr, "DeleteAllCommonTicket"},
18 {6, nullptr, "DeleteAllPersonalizedTicket"},
19 {7, nullptr, "DeleteAllPersonalizedTicketEx"},
20 {8, nullptr, "GetTitleKey"},
21 {9, nullptr, "CountCommonTicket"},
22 {10, nullptr, "CountPersonalizedTicket"},
23 {11, nullptr, "ListCommonTicket"},
24 {12, nullptr, "ListPersonalizedTicket"},
25 {13, nullptr, "ListMissingPersonalizedTicket"},
26 {14, nullptr, "GetCommonTicketSize"},
27 {15, nullptr, "GetPersonalizedTicketSize"},
28 {16, nullptr, "GetCommonTicketData"},
29 {17, nullptr, "GetPersonalizedTicketData"},
30 {18, nullptr, "OwnTicket"},
31 {19, nullptr, "GetTicketInfo"},
32 {20, nullptr, "ListLightTicketInfo"},
33 {21, nullptr, "SignData"},
34 {22, nullptr, "GetCommonTicketAndCertificateSize"},
35 {23, nullptr, "GetCommonTicketAndCertificateData"},
36 {24, nullptr, "ImportPrepurchaseRecord"},
37 {25, nullptr, "DeletePrepurchaseRecord"},
38 {26, nullptr, "DeleteAllPrepurchaseRecord"},
39 {27, nullptr, "CountPrepurchaseRecord"},
40 {28, nullptr, "ListPrepurchaseRecord"},
41 {29, nullptr, "ListPrepurchaseRecordInfo"},
42 {30, nullptr, "Unknown1"},
43 {31, nullptr, "Unknown2"},
44 {32, nullptr, "Unknown3"},
45 {33, nullptr, "Unknown4"},
46 {34, nullptr, "Unknown5"},
47 {35, nullptr, "Unknown6"},
48 };
49 RegisterHandlers(functions);
50 }
51};
52
53void InstallInterfaces(SM::ServiceManager& service_manager) {
54 std::make_shared<ETicket>()->InstallAsService(service_manager);
55}
56
57} // namespace Service::ES
diff --git a/src/core/hle/service/es/es.h b/src/core/hle/service/es/es.h
new file mode 100644
index 000000000..afe70465b
--- /dev/null
+++ b/src/core/hle/service/es/es.h
@@ -0,0 +1,16 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7namespace Service::SM {
8class ServiceManager;
9}
10
11namespace Service::ES {
12
13/// Registers all ES services with the specified service manager.
14void InstallInterfaces(SM::ServiceManager& service_manager);
15
16} // namespace Service::ES
diff --git a/src/core/hle/service/eupld/eupld.cpp b/src/core/hle/service/eupld/eupld.cpp
new file mode 100644
index 000000000..2df30acee
--- /dev/null
+++ b/src/core/hle/service/eupld/eupld.cpp
@@ -0,0 +1,52 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <memory>
6
7#include "core/hle/service/eupld/eupld.h"
8#include "core/hle/service/service.h"
9#include "core/hle/service/sm/sm.h"
10
11namespace Service::EUPLD {
12
13class ErrorUploadContext final : public ServiceFramework<ErrorUploadContext> {
14public:
15 explicit ErrorUploadContext() : ServiceFramework{"eupld:c"} {
16 // clang-format off
17 static const FunctionInfo functions[] = {
18 {0, nullptr, "SetUrl"},
19 {1, nullptr, "ImportCrt"},
20 {2, nullptr, "ImportPki"},
21 {3, nullptr, "SetAutoUpload"},
22 };
23 // clang-format on
24
25 RegisterHandlers(functions);
26 }
27};
28
29class ErrorUploadRequest final : public ServiceFramework<ErrorUploadRequest> {
30public:
31 explicit ErrorUploadRequest() : ServiceFramework{"eupld:r"} {
32 // clang-format off
33 static const FunctionInfo functions[] = {
34 {0, nullptr, "Initialize"},
35 {1, nullptr, "UploadAll"},
36 {2, nullptr, "UploadSelected"},
37 {3, nullptr, "GetUploadStatus"},
38 {4, nullptr, "CancelUpload"},
39 {5, nullptr, "GetResult"},
40 };
41 // clang-format on
42
43 RegisterHandlers(functions);
44 }
45};
46
47void InstallInterfaces(SM::ServiceManager& sm) {
48 std::make_shared<ErrorUploadContext>()->InstallAsService(sm);
49 std::make_shared<ErrorUploadRequest>()->InstallAsService(sm);
50}
51
52} // namespace Service::EUPLD
diff --git a/src/core/hle/service/eupld/eupld.h b/src/core/hle/service/eupld/eupld.h
new file mode 100644
index 000000000..6eef2c15f
--- /dev/null
+++ b/src/core/hle/service/eupld/eupld.h
@@ -0,0 +1,16 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7namespace Service::SM {
8class ServiceManager;
9}
10
11namespace Service::EUPLD {
12
13/// Registers all EUPLD services with the specified service manager.
14void InstallInterfaces(SM::ServiceManager& sm);
15
16} // namespace Service::EUPLD
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp
index c98a46e05..fb4d89068 100644
--- a/src/core/hle/service/friend/friend.cpp
+++ b/src/core/hle/service/friend/friend.cpp
@@ -5,8 +5,7 @@
5#include "common/logging/log.h" 5#include "common/logging/log.h"
6#include "core/hle/ipc_helpers.h" 6#include "core/hle/ipc_helpers.h"
7#include "core/hle/service/friend/friend.h" 7#include "core/hle/service/friend/friend.h"
8#include "core/hle/service/friend/friend_a.h" 8#include "core/hle/service/friend/interface.h"
9#include "core/hle/service/friend/friend_u.h"
10 9
11namespace Service::Friend { 10namespace Service::Friend {
12 11
@@ -21,8 +20,11 @@ Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
21 20
22void InstallInterfaces(SM::ServiceManager& service_manager) { 21void InstallInterfaces(SM::ServiceManager& service_manager) {
23 auto module = std::make_shared<Module>(); 22 auto module = std::make_shared<Module>();
24 std::make_shared<Friend_A>(module)->InstallAsService(service_manager); 23 std::make_shared<Friend>(module, "friend:a")->InstallAsService(service_manager);
25 std::make_shared<Friend_U>(module)->InstallAsService(service_manager); 24 std::make_shared<Friend>(module, "friend:m")->InstallAsService(service_manager);
25 std::make_shared<Friend>(module, "friend:s")->InstallAsService(service_manager);
26 std::make_shared<Friend>(module, "friend:u")->InstallAsService(service_manager);
27 std::make_shared<Friend>(module, "friend:v")->InstallAsService(service_manager);
26} 28}
27 29
28} // namespace Service::Friend 30} // namespace Service::Friend
diff --git a/src/core/hle/service/friend/friend_u.cpp b/src/core/hle/service/friend/friend_u.cpp
deleted file mode 100644
index 90b30883f..000000000
--- a/src/core/hle/service/friend/friend_u.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/hle/service/friend/friend_u.h"
6
7namespace Service::Friend {
8
9Friend_U::Friend_U(std::shared_ptr<Module> module)
10 : Module::Interface(std::move(module), "friend:u") {
11 static const FunctionInfo functions[] = {
12 {0, &Friend_U::CreateFriendService, "CreateFriendService"},
13 {1, nullptr, "CreateNotificationService"},
14 };
15 RegisterHandlers(functions);
16}
17
18} // namespace Service::Friend
diff --git a/src/core/hle/service/friend/friend_u.h b/src/core/hle/service/friend/friend_u.h
deleted file mode 100644
index 0d953d807..000000000
--- a/src/core/hle/service/friend/friend_u.h
+++ /dev/null
@@ -1,16 +0,0 @@
1// Copyright 2018 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#include "core/hle/service/friend/friend.h"
8
9namespace Service::Friend {
10
11class Friend_U final : public Module::Interface {
12public:
13 explicit Friend_U(std::shared_ptr<Module> module);
14};
15
16} // namespace Service::Friend
diff --git a/src/core/hle/service/friend/friend_a.cpp b/src/core/hle/service/friend/interface.cpp
index a2cc81926..27c6a09e2 100644
--- a/src/core/hle/service/friend/friend_a.cpp
+++ b/src/core/hle/service/friend/interface.cpp
@@ -2,15 +2,16 @@
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 "core/hle/service/friend/friend_a.h" 5#include "core/hle/service/friend/interface.h"
6 6
7namespace Service::Friend { 7namespace Service::Friend {
8 8
9Friend_A::Friend_A(std::shared_ptr<Module> module) 9Friend::Friend(std::shared_ptr<Module> module, const char* name)
10 : Module::Interface(std::move(module), "friend:a") { 10 : Interface(std::move(module), name) {
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {0, &Friend_A::CreateFriendService, "CreateFriendService"}, 12 {0, &Friend::CreateFriendService, "CreateFriendService"},
13 {1, nullptr, "CreateNotificationService"}, 13 {1, nullptr, "CreateNotificationService"},
14 {2, nullptr, "CreateDaemonSuspendSessionService"},
14 }; 15 };
15 RegisterHandlers(functions); 16 RegisterHandlers(functions);
16} 17}
diff --git a/src/core/hle/service/friend/friend_a.h b/src/core/hle/service/friend/interface.h
index 81257583b..89dae8471 100644
--- a/src/core/hle/service/friend/friend_a.h
+++ b/src/core/hle/service/friend/interface.h
@@ -8,9 +8,9 @@
8 8
9namespace Service::Friend { 9namespace Service::Friend {
10 10
11class Friend_A final : public Module::Interface { 11class Friend final : public Module::Interface {
12public: 12public:
13 explicit Friend_A(std::shared_ptr<Module> module); 13 explicit Friend(std::shared_ptr<Module> module, const char* name);
14}; 14};
15 15
16} // namespace Service::Friend 16} // namespace Service::Friend
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 475a0a5cf..9a02ba686 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -5,6 +5,7 @@
5#include <atomic> 5#include <atomic>
6#include "common/logging/log.h" 6#include "common/logging/log.h"
7#include "core/core_timing.h" 7#include "core/core_timing.h"
8#include "core/core_timing_util.h"
8#include "core/frontend/emu_window.h" 9#include "core/frontend/emu_window.h"
9#include "core/frontend/input.h" 10#include "core/frontend/input.h"
10#include "core/hle/ipc_helpers.h" 11#include "core/hle/ipc_helpers.h"
diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp
new file mode 100644
index 000000000..ec32faf15
--- /dev/null
+++ b/src/core/hle/service/ldr/ldr.cpp
@@ -0,0 +1,81 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <memory>
6
7#include "core/hle/service/ldr/ldr.h"
8#include "core/hle/service/service.h"
9
10namespace Service::LDR {
11
12class DebugMonitor final : public ServiceFramework<DebugMonitor> {
13public:
14 explicit DebugMonitor() : ServiceFramework{"ldr:dmnt"} {
15 // clang-format off
16 static const FunctionInfo functions[] = {
17 {0, nullptr, "AddProcessToDebugLaunchQueue"},
18 {1, nullptr, "ClearDebugLaunchQueue"},
19 {2, nullptr, "GetNsoInfos"},
20 };
21 // clang-format on
22
23 RegisterHandlers(functions);
24 }
25};
26
27class ProcessManager final : public ServiceFramework<ProcessManager> {
28public:
29 explicit ProcessManager() : ServiceFramework{"ldr:pm"} {
30 // clang-format off
31 static const FunctionInfo functions[] = {
32 {0, nullptr, "CreateProcess"},
33 {1, nullptr, "GetProgramInfo"},
34 {2, nullptr, "RegisterTitle"},
35 {3, nullptr, "UnregisterTitle"},
36 };
37 // clang-format on
38
39 RegisterHandlers(functions);
40 }
41};
42
43class Shell final : public ServiceFramework<Shell> {
44public:
45 explicit Shell() : ServiceFramework{"ldr:shel"} {
46 // clang-format off
47 static const FunctionInfo functions[] = {
48 {0, nullptr, "AddProcessToLaunchQueue"},
49 {1, nullptr, "ClearLaunchQueue"},
50 };
51 // clang-format on
52
53 RegisterHandlers(functions);
54 }
55};
56
57class RelocatableObject final : public ServiceFramework<RelocatableObject> {
58public:
59 explicit RelocatableObject() : ServiceFramework{"ldr:ro"} {
60 // clang-format off
61 static const FunctionInfo functions[] = {
62 {0, nullptr, "LoadNro"},
63 {1, nullptr, "UnloadNro"},
64 {2, nullptr, "LoadNrr"},
65 {3, nullptr, "UnloadNrr"},
66 {4, nullptr, "Initialize"},
67 };
68 // clang-format on
69
70 RegisterHandlers(functions);
71 }
72};
73
74void InstallInterfaces(SM::ServiceManager& sm) {
75 std::make_shared<DebugMonitor>()->InstallAsService(sm);
76 std::make_shared<ProcessManager>()->InstallAsService(sm);
77 std::make_shared<Shell>()->InstallAsService(sm);
78 std::make_shared<RelocatableObject>()->InstallAsService(sm);
79}
80
81} // namespace Service::LDR
diff --git a/src/core/hle/service/ldr/ldr.h b/src/core/hle/service/ldr/ldr.h
new file mode 100644
index 000000000..412410c4f
--- /dev/null
+++ b/src/core/hle/service/ldr/ldr.h
@@ -0,0 +1,16 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7namespace Service::SM {
8class ServiceManager;
9}
10
11namespace Service::LDR {
12
13/// Registers all LDR services with the specified service manager.
14void InstallInterfaces(SM::ServiceManager& sm);
15
16} // namespace Service::LDR
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp
index e85a8bdb9..b497376d7 100644
--- a/src/core/hle/service/lm/lm.cpp
+++ b/src/core/hle/service/lm/lm.cpp
@@ -4,10 +4,12 @@
4 4
5#include <sstream> 5#include <sstream>
6#include <string> 6#include <string>
7
7#include "common/logging/log.h" 8#include "common/logging/log.h"
8#include "core/hle/ipc_helpers.h" 9#include "core/hle/ipc_helpers.h"
9#include "core/hle/kernel/client_session.h"
10#include "core/hle/service/lm/lm.h" 10#include "core/hle/service/lm/lm.h"
11#include "core/hle/service/service.h"
12#include "core/memory.h"
11 13
12namespace Service::LM { 14namespace Service::LM {
13 15
@@ -15,13 +17,12 @@ class Logger final : public ServiceFramework<Logger> {
15public: 17public:
16 Logger() : ServiceFramework("Logger") { 18 Logger() : ServiceFramework("Logger") {
17 static const FunctionInfo functions[] = { 19 static const FunctionInfo functions[] = {
18 {0x00000000, &Logger::Log, "Log"}, 20 {0x00000000, &Logger::Initialize, "Initialize"},
21 {0x00000001, nullptr, "SetDestination"},
19 }; 22 };
20 RegisterHandlers(functions); 23 RegisterHandlers(functions);
21 } 24 }
22 25
23 ~Logger() = default;
24
25private: 26private:
26 struct MessageHeader { 27 struct MessageHeader {
27 enum Flags : u32_le { 28 enum Flags : u32_le {
@@ -66,13 +67,13 @@ private:
66 }; 67 };
67 68
68 /** 69 /**
69 * LM::Log service function 70 * ILogger::Initialize service function
70 * Inputs: 71 * Inputs:
71 * 0: 0x00000000 72 * 0: 0x00000000
72 * Outputs: 73 * Outputs:
73 * 0: ResultCode 74 * 0: ResultCode
74 */ 75 */
75 void Log(Kernel::HLERequestContext& ctx) { 76 void Initialize(Kernel::HLERequestContext& ctx) {
76 // This function only succeeds - Get that out of the way 77 // This function only succeeds - Get that out of the way
77 IPC::ResponseBuilder rb{ctx, 2}; 78 IPC::ResponseBuilder rb{ctx, 2};
78 rb.Push(RESULT_SUCCESS); 79 rb.Push(RESULT_SUCCESS);
@@ -162,30 +163,33 @@ private:
162 std::ostringstream log_stream; 163 std::ostringstream log_stream;
163}; 164};
164 165
165void InstallInterfaces(SM::ServiceManager& service_manager) { 166class LM final : public ServiceFramework<LM> {
166 std::make_shared<LM>()->InstallAsService(service_manager); 167public:
167} 168 explicit LM() : ServiceFramework{"lm"} {
169 static const FunctionInfo functions[] = {
170 {0x00000000, &LM::OpenLogger, "OpenLogger"},
171 };
172 RegisterHandlers(functions);
173 }
168 174
169/** 175 /**
170 * LM::Initialize service function 176 * LM::OpenLogger service function
171 * Inputs: 177 * Inputs:
172 * 0: 0x00000000 178 * 0: 0x00000000
173 * Outputs: 179 * Outputs:
174 * 0: ResultCode 180 * 0: ResultCode
175 */ 181 */
176void LM::Initialize(Kernel::HLERequestContext& ctx) { 182 void OpenLogger(Kernel::HLERequestContext& ctx) {
177 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 183 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
178 rb.Push(RESULT_SUCCESS); 184 rb.Push(RESULT_SUCCESS);
179 rb.PushIpcInterface<Logger>(); 185 rb.PushIpcInterface<Logger>();
180
181 LOG_DEBUG(Service_LM, "called");
182}
183 186
184LM::LM() : ServiceFramework("lm") { 187 LOG_DEBUG(Service_LM, "called");
185 static const FunctionInfo functions[] = { 188 }
186 {0x00000000, &LM::Initialize, "Initialize"}, 189};
187 }; 190
188 RegisterHandlers(functions); 191void InstallInterfaces(SM::ServiceManager& service_manager) {
192 std::make_shared<LM>()->InstallAsService(service_manager);
189} 193}
190 194
191} // namespace Service::LM 195} // namespace Service::LM
diff --git a/src/core/hle/service/lm/lm.h b/src/core/hle/service/lm/lm.h
index 63d6506fe..7806ae27b 100644
--- a/src/core/hle/service/lm/lm.h
+++ b/src/core/hle/service/lm/lm.h
@@ -4,21 +4,12 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <vector> 7namespace Service::SM {
8#include "core/hle/kernel/kernel.h" 8class ServiceManager;
9#include "core/hle/service/service.h" 9}
10 10
11namespace Service::LM { 11namespace Service::LM {
12 12
13class LM final : public ServiceFramework<LM> {
14public:
15 LM();
16 ~LM() = default;
17
18private:
19 void Initialize(Kernel::HLERequestContext& ctx);
20};
21
22/// Registers all LM services with the specified service manager. 13/// Registers all LM services with the specified service manager.
23void InstallInterfaces(SM::ServiceManager& service_manager); 14void InstallInterfaces(SM::ServiceManager& service_manager);
24 15
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp
index 0d951084b..cfe8d9178 100644
--- a/src/core/hle/service/nifm/nifm.cpp
+++ b/src/core/hle/service/nifm/nifm.cpp
@@ -5,9 +5,7 @@
5#include "core/hle/ipc_helpers.h" 5#include "core/hle/ipc_helpers.h"
6#include "core/hle/kernel/event.h" 6#include "core/hle/kernel/event.h"
7#include "core/hle/service/nifm/nifm.h" 7#include "core/hle/service/nifm/nifm.h"
8#include "core/hle/service/nifm/nifm_a.h" 8#include "core/hle/service/service.h"
9#include "core/hle/service/nifm/nifm_s.h"
10#include "core/hle/service/nifm/nifm_u.h"
11 9
12namespace Service::NIFM { 10namespace Service::NIFM {
13 11
@@ -210,28 +208,35 @@ IGeneralService::IGeneralService() : ServiceFramework("IGeneralService") {
210 RegisterHandlers(functions); 208 RegisterHandlers(functions);
211} 209}
212 210
213void Module::Interface::CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) { 211class NetworkInterface final : public ServiceFramework<NetworkInterface> {
214 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 212public:
215 rb.Push(RESULT_SUCCESS); 213 explicit NetworkInterface(const char* name) : ServiceFramework{name} {
216 rb.PushIpcInterface<IGeneralService>(); 214 static const FunctionInfo functions[] = {
217 LOG_DEBUG(Service_NIFM, "called"); 215 {4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"},
218} 216 {5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"},
217 };
218 RegisterHandlers(functions);
219 }
219 220
220void Module::Interface::CreateGeneralService(Kernel::HLERequestContext& ctx) { 221 void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) {
221 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 222 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
222 rb.Push(RESULT_SUCCESS); 223 rb.Push(RESULT_SUCCESS);
223 rb.PushIpcInterface<IGeneralService>(); 224 rb.PushIpcInterface<IGeneralService>();
224 LOG_DEBUG(Service_NIFM, "called"); 225 LOG_DEBUG(Service_NIFM, "called");
225} 226 }
226 227
227Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) 228 void CreateGeneralService(Kernel::HLERequestContext& ctx) {
228 : ServiceFramework(name), module(std::move(module)) {} 229 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
230 rb.Push(RESULT_SUCCESS);
231 rb.PushIpcInterface<IGeneralService>();
232 LOG_DEBUG(Service_NIFM, "called");
233 }
234};
229 235
230void InstallInterfaces(SM::ServiceManager& service_manager) { 236void InstallInterfaces(SM::ServiceManager& service_manager) {
231 auto module = std::make_shared<Module>(); 237 std::make_shared<NetworkInterface>("nifm:a")->InstallAsService(service_manager);
232 std::make_shared<NIFM_A>(module)->InstallAsService(service_manager); 238 std::make_shared<NetworkInterface>("nifm:s")->InstallAsService(service_manager);
233 std::make_shared<NIFM_S>(module)->InstallAsService(service_manager); 239 std::make_shared<NetworkInterface>("nifm:u")->InstallAsService(service_manager);
234 std::make_shared<NIFM_U>(module)->InstallAsService(service_manager);
235} 240}
236 241
237} // namespace Service::NIFM 242} // namespace Service::NIFM
diff --git a/src/core/hle/service/nifm/nifm.h b/src/core/hle/service/nifm/nifm.h
index 11f1b5831..4616b3b48 100644
--- a/src/core/hle/service/nifm/nifm.h
+++ b/src/core/hle/service/nifm/nifm.h
@@ -4,24 +4,13 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "core/hle/service/service.h" 7namespace Service::SM {
8class ServiceManager;
9}
8 10
9namespace Service::NIFM { 11namespace Service::NIFM {
10 12
11class Module final { 13/// Registers all NIFM services with the specified service manager.
12public:
13 class Interface : public ServiceFramework<Interface> {
14 public:
15 explicit Interface(std::shared_ptr<Module> module, const char* name);
16
17 void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx);
18 void CreateGeneralService(Kernel::HLERequestContext& ctx);
19
20 protected:
21 std::shared_ptr<Module> module;
22 };
23};
24
25void InstallInterfaces(SM::ServiceManager& service_manager); 14void InstallInterfaces(SM::ServiceManager& service_manager);
26 15
27} // namespace Service::NIFM 16} // namespace Service::NIFM
diff --git a/src/core/hle/service/nifm/nifm_a.cpp b/src/core/hle/service/nifm/nifm_a.cpp
deleted file mode 100644
index b7f296a20..000000000
--- a/src/core/hle/service/nifm/nifm_a.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/hle/service/nifm/nifm_a.h"
6
7namespace Service::NIFM {
8
9NIFM_A::NIFM_A(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "nifm:a") {
10 static const FunctionInfo functions[] = {
11 {4, &NIFM_A::CreateGeneralServiceOld, "CreateGeneralServiceOld"},
12 {5, &NIFM_A::CreateGeneralService, "CreateGeneralService"},
13 };
14 RegisterHandlers(functions);
15}
16
17} // namespace Service::NIFM
diff --git a/src/core/hle/service/nifm/nifm_a.h b/src/core/hle/service/nifm/nifm_a.h
deleted file mode 100644
index c3ba33110..000000000
--- a/src/core/hle/service/nifm/nifm_a.h
+++ /dev/null
@@ -1,16 +0,0 @@
1// Copyright 2018 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#include "core/hle/service/nifm/nifm.h"
8
9namespace Service::NIFM {
10
11class NIFM_A final : public Module::Interface {
12public:
13 explicit NIFM_A(std::shared_ptr<Module> module);
14};
15
16} // namespace Service::NIFM
diff --git a/src/core/hle/service/nifm/nifm_s.cpp b/src/core/hle/service/nifm/nifm_s.cpp
deleted file mode 100644
index 96e3c0cee..000000000
--- a/src/core/hle/service/nifm/nifm_s.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/hle/service/nifm/nifm_s.h"
6
7namespace Service::NIFM {
8
9NIFM_S::NIFM_S(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "nifm:s") {
10 static const FunctionInfo functions[] = {
11 {4, &NIFM_S::CreateGeneralServiceOld, "CreateGeneralServiceOld"},
12 {5, &NIFM_S::CreateGeneralService, "CreateGeneralService"},
13 };
14 RegisterHandlers(functions);
15}
16
17} // namespace Service::NIFM
diff --git a/src/core/hle/service/nifm/nifm_s.h b/src/core/hle/service/nifm/nifm_s.h
deleted file mode 100644
index 8d1635a5d..000000000
--- a/src/core/hle/service/nifm/nifm_s.h
+++ /dev/null
@@ -1,16 +0,0 @@
1// Copyright 2018 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#include "core/hle/service/nifm/nifm.h"
8
9namespace Service::NIFM {
10
11class NIFM_S final : public Module::Interface {
12public:
13 explicit NIFM_S(std::shared_ptr<Module> module);
14};
15
16} // namespace Service::NIFM
diff --git a/src/core/hle/service/nifm/nifm_u.cpp b/src/core/hle/service/nifm/nifm_u.cpp
deleted file mode 100644
index 8cb75b903..000000000
--- a/src/core/hle/service/nifm/nifm_u.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/hle/service/nifm/nifm_u.h"
6
7namespace Service::NIFM {
8
9NIFM_U::NIFM_U(std::shared_ptr<Module> module) : Module::Interface(std::move(module), "nifm:u") {
10 static const FunctionInfo functions[] = {
11 {4, &NIFM_U::CreateGeneralServiceOld, "CreateGeneralServiceOld"},
12 {5, &NIFM_U::CreateGeneralService, "CreateGeneralService"},
13 };
14 RegisterHandlers(functions);
15}
16
17} // namespace Service::NIFM
diff --git a/src/core/hle/service/nifm/nifm_u.h b/src/core/hle/service/nifm/nifm_u.h
deleted file mode 100644
index def9726b1..000000000
--- a/src/core/hle/service/nifm/nifm_u.h
+++ /dev/null
@@ -1,16 +0,0 @@
1// Copyright 2018 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#include "core/hle/service/nifm/nifm.h"
8
9namespace Service::NIFM {
10
11class NIFM_U final : public Module::Interface {
12public:
13 explicit NIFM_U(std::shared_ptr<Module> module);
14};
15
16} // namespace Service::NIFM
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index cc5cfe34e..1555ea806 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -2,6 +2,8 @@
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 <utility>
6
5#include "core/hle/ipc_helpers.h" 7#include "core/hle/ipc_helpers.h"
6#include "core/hle/service/nvdrv/devices/nvdevice.h" 8#include "core/hle/service/nvdrv/devices/nvdevice.h"
7#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h" 9#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h"
@@ -40,14 +42,14 @@ Module::Module() {
40 devices["/dev/nvhost-nvdec"] = std::make_shared<Devices::nvhost_nvdec>(); 42 devices["/dev/nvhost-nvdec"] = std::make_shared<Devices::nvhost_nvdec>();
41} 43}
42 44
43u32 Module::Open(std::string device_name) { 45u32 Module::Open(const std::string& device_name) {
44 ASSERT_MSG(devices.find(device_name) != devices.end(), "Trying to open unknown device {}", 46 ASSERT_MSG(devices.find(device_name) != devices.end(), "Trying to open unknown device {}",
45 device_name); 47 device_name);
46 48
47 auto device = devices[device_name]; 49 auto device = devices[device_name];
48 u32 fd = next_fd++; 50 const u32 fd = next_fd++;
49 51
50 open_files[fd] = device; 52 open_files[fd] = std::move(device);
51 53
52 return fd; 54 return fd;
53} 55}
@@ -56,7 +58,7 @@ u32 Module::Ioctl(u32 fd, u32_le command, const std::vector<u8>& input, std::vec
56 auto itr = open_files.find(fd); 58 auto itr = open_files.find(fd);
57 ASSERT_MSG(itr != open_files.end(), "Tried to talk to an invalid device"); 59 ASSERT_MSG(itr != open_files.end(), "Tried to talk to an invalid device");
58 60
59 auto device = itr->second; 61 auto& device = itr->second;
60 return device->ioctl({command}, input, output); 62 return device->ioctl({command}, input, output);
61} 63}
62 64
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index 35b2c65fc..184f3c9fc 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -38,7 +38,7 @@ public:
38 } 38 }
39 39
40 /// Opens a device node and returns a file descriptor to it. 40 /// Opens a device node and returns a file descriptor to it.
41 u32 Open(std::string device_name); 41 u32 Open(const std::string& device_name);
42 /// Sends an ioctl command to the specified file descriptor. 42 /// Sends an ioctl command to the specified file descriptor.
43 u32 Ioctl(u32 fd, u32 command, const std::vector<u8>& input, std::vector<u8>& output); 43 u32 Ioctl(u32 fd, u32 command, const std::vector<u8>& input, std::vector<u8>& output);
44 /// Closes a device file descriptor and returns operation success. 44 /// Closes a device file descriptor and returns operation success.
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index 1fca1743d..5344441e1 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -9,6 +9,7 @@
9#include "common/scope_exit.h" 9#include "common/scope_exit.h"
10#include "core/core.h" 10#include "core/core.h"
11#include "core/core_timing.h" 11#include "core/core_timing.h"
12#include "core/core_timing_util.h"
12#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h" 13#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h"
13#include "core/hle/service/nvdrv/nvdrv.h" 14#include "core/hle/service/nvdrv/nvdrv.h"
14#include "core/hle/service/nvflinger/buffer_queue.h" 15#include "core/hle/service/nvflinger/buffer_queue.h"
diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp
new file mode 100644
index 000000000..e20a25689
--- /dev/null
+++ b/src/core/hle/service/pm/pm.cpp
@@ -0,0 +1,70 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/hle/service/service.h"
6
7namespace Service::PM {
8
9class BootMode final : public ServiceFramework<BootMode> {
10public:
11 explicit BootMode() : ServiceFramework{"pm:bm"} {
12 static const FunctionInfo functions[] = {
13 {0, nullptr, "GetBootMode"},
14 {1, nullptr, "SetMaintenanceBoot"},
15 };
16 RegisterHandlers(functions);
17 }
18};
19
20class DebugMonitor final : public ServiceFramework<DebugMonitor> {
21public:
22 explicit DebugMonitor() : ServiceFramework{"pm:dmnt"} {
23 static const FunctionInfo functions[] = {
24 {0, nullptr, "IsDebugMode"},
25 {1, nullptr, "GetDebugProcesses"},
26 {2, nullptr, "StartDebugProcess"},
27 {3, nullptr, "GetTitlePid"},
28 {4, nullptr, "EnableDebugForTitleId"},
29 {5, nullptr, "GetApplicationPid"},
30 {6, nullptr, "EnableDebugForApplication"},
31 };
32 RegisterHandlers(functions);
33 }
34};
35
36class Info final : public ServiceFramework<Info> {
37public:
38 explicit Info() : ServiceFramework{"pm:info"} {
39 static const FunctionInfo functions[] = {
40 {0, nullptr, "GetTitleId"},
41 };
42 RegisterHandlers(functions);
43 }
44};
45
46class Shell final : public ServiceFramework<Shell> {
47public:
48 explicit Shell() : ServiceFramework{"pm:shell"} {
49 static const FunctionInfo functions[] = {
50 {0, nullptr, "LaunchProcess"},
51 {1, nullptr, "TerminateProcessByPid"},
52 {2, nullptr, "TerminateProcessByTitleId"},
53 {3, nullptr, "GetProcessEventWaiter"},
54 {4, nullptr, "GetProcessEventType"},
55 {5, nullptr, "NotifyBootFinished"},
56 {6, nullptr, "GetApplicationPid"},
57 {7, nullptr, "BoostSystemMemoryResourceLimit"},
58 };
59 RegisterHandlers(functions);
60 }
61};
62
63void InstallInterfaces(SM::ServiceManager& sm) {
64 std::make_shared<BootMode>()->InstallAsService(sm);
65 std::make_shared<DebugMonitor>()->InstallAsService(sm);
66 std::make_shared<Info>()->InstallAsService(sm);
67 std::make_shared<Shell>()->InstallAsService(sm);
68}
69
70} // namespace Service::PM
diff --git a/src/core/hle/service/pm/pm.h b/src/core/hle/service/pm/pm.h
new file mode 100644
index 000000000..9fc19fed6
--- /dev/null
+++ b/src/core/hle/service/pm/pm.h
@@ -0,0 +1,16 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7namespace Service::SM {
8class ServiceManager;
9}
10
11namespace Service::PM {
12
13/// Registers all PM services with the specified service manager.
14void InstallInterfaces(SM::ServiceManager& service_manager);
15
16} // namespace Service::PM
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 0d036bfaa..482989ea7 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -21,10 +21,14 @@
21#include "core/hle/service/apm/apm.h" 21#include "core/hle/service/apm/apm.h"
22#include "core/hle/service/audio/audio.h" 22#include "core/hle/service/audio/audio.h"
23#include "core/hle/service/bcat/bcat.h" 23#include "core/hle/service/bcat/bcat.h"
24#include "core/hle/service/erpt/erpt.h"
25#include "core/hle/service/es/es.h"
26#include "core/hle/service/eupld/eupld.h"
24#include "core/hle/service/fatal/fatal.h" 27#include "core/hle/service/fatal/fatal.h"
25#include "core/hle/service/filesystem/filesystem.h" 28#include "core/hle/service/filesystem/filesystem.h"
26#include "core/hle/service/friend/friend.h" 29#include "core/hle/service/friend/friend.h"
27#include "core/hle/service/hid/hid.h" 30#include "core/hle/service/hid/hid.h"
31#include "core/hle/service/ldr/ldr.h"
28#include "core/hle/service/lm/lm.h" 32#include "core/hle/service/lm/lm.h"
29#include "core/hle/service/mm/mm_u.h" 33#include "core/hle/service/mm/mm_u.h"
30#include "core/hle/service/nfp/nfp.h" 34#include "core/hle/service/nfp/nfp.h"
@@ -32,6 +36,7 @@
32#include "core/hle/service/ns/ns.h" 36#include "core/hle/service/ns/ns.h"
33#include "core/hle/service/nvdrv/nvdrv.h" 37#include "core/hle/service/nvdrv/nvdrv.h"
34#include "core/hle/service/pctl/pctl.h" 38#include "core/hle/service/pctl/pctl.h"
39#include "core/hle/service/pm/pm.h"
35#include "core/hle/service/prepo/prepo.h" 40#include "core/hle/service/prepo/prepo.h"
36#include "core/hle/service/service.h" 41#include "core/hle/service/service.h"
37#include "core/hle/service/set/settings.h" 42#include "core/hle/service/set/settings.h"
@@ -187,10 +192,14 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) {
187 APM::InstallInterfaces(*sm); 192 APM::InstallInterfaces(*sm);
188 BCAT::InstallInterfaces(*sm); 193 BCAT::InstallInterfaces(*sm);
189 Audio::InstallInterfaces(*sm); 194 Audio::InstallInterfaces(*sm);
195 ERPT::InstallInterfaces(*sm);
196 ES::InstallInterfaces(*sm);
197 EUPLD::InstallInterfaces(*sm);
190 Fatal::InstallInterfaces(*sm); 198 Fatal::InstallInterfaces(*sm);
191 FileSystem::InstallInterfaces(*sm); 199 FileSystem::InstallInterfaces(*sm);
192 Friend::InstallInterfaces(*sm); 200 Friend::InstallInterfaces(*sm);
193 HID::InstallInterfaces(*sm); 201 HID::InstallInterfaces(*sm);
202 LDR::InstallInterfaces(*sm);
194 LM::InstallInterfaces(*sm); 203 LM::InstallInterfaces(*sm);
195 MM::InstallInterfaces(*sm); 204 MM::InstallInterfaces(*sm);
196 NFP::InstallInterfaces(*sm); 205 NFP::InstallInterfaces(*sm);
@@ -199,6 +208,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) {
199 Nvidia::InstallInterfaces(*sm); 208 Nvidia::InstallInterfaces(*sm);
200 PCTL::InstallInterfaces(*sm); 209 PCTL::InstallInterfaces(*sm);
201 PlayReport::InstallInterfaces(*sm); 210 PlayReport::InstallInterfaces(*sm);
211 PM::InstallInterfaces(*sm);
202 Sockets::InstallInterfaces(*sm); 212 Sockets::InstallInterfaces(*sm);
203 SPL::InstallInterfaces(*sm); 213 SPL::InstallInterfaces(*sm);
204 SSL::InstallInterfaces(*sm); 214 SSL::InstallInterfaces(*sm);
diff --git a/src/core/hle/service/set/set_sys.cpp b/src/core/hle/service/set/set_sys.cpp
index fa85277fe..41efca31c 100644
--- a/src/core/hle/service/set/set_sys.cpp
+++ b/src/core/hle/service/set/set_sys.cpp
@@ -10,13 +10,22 @@
10namespace Service::Set { 10namespace Service::Set {
11 11
12void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) { 12void SET_SYS::GetColorSetId(Kernel::HLERequestContext& ctx) {
13
14 IPC::ResponseBuilder rb{ctx, 3}; 13 IPC::ResponseBuilder rb{ctx, 3};
15 14
16 rb.Push(RESULT_SUCCESS); 15 rb.Push(RESULT_SUCCESS);
17 rb.Push<u32>(0); 16 rb.PushEnum(color_set);
18 17
19 LOG_WARNING(Service_SET, "(STUBBED) called"); 18 LOG_DEBUG(Service_SET, "called");
19}
20
21void SET_SYS::SetColorSetId(Kernel::HLERequestContext& ctx) {
22 IPC::RequestParser rp{ctx};
23 color_set = rp.PopEnum<ColorSet>();
24
25 IPC::ResponseBuilder rb{ctx, 2};
26 rb.Push(RESULT_SUCCESS);
27
28 LOG_DEBUG(Service_SET, "called");
20} 29}
21 30
22SET_SYS::SET_SYS() : ServiceFramework("set:sys") { 31SET_SYS::SET_SYS() : ServiceFramework("set:sys") {
@@ -44,7 +53,7 @@ SET_SYS::SET_SYS() : ServiceFramework("set:sys") {
44 {21, nullptr, "GetEulaVersions"}, 53 {21, nullptr, "GetEulaVersions"},
45 {22, nullptr, "SetEulaVersions"}, 54 {22, nullptr, "SetEulaVersions"},
46 {23, &SET_SYS::GetColorSetId, "GetColorSetId"}, 55 {23, &SET_SYS::GetColorSetId, "GetColorSetId"},
47 {24, nullptr, "SetColorSetId"}, 56 {24, &SET_SYS::SetColorSetId, "SetColorSetId"},
48 {25, nullptr, "GetConsoleInformationUploadFlag"}, 57 {25, nullptr, "GetConsoleInformationUploadFlag"},
49 {26, nullptr, "SetConsoleInformationUploadFlag"}, 58 {26, nullptr, "SetConsoleInformationUploadFlag"},
50 {27, nullptr, "GetAutomaticApplicationDownloadFlag"}, 59 {27, nullptr, "GetAutomaticApplicationDownloadFlag"},
@@ -172,4 +181,6 @@ SET_SYS::SET_SYS() : ServiceFramework("set:sys") {
172 RegisterHandlers(functions); 181 RegisterHandlers(functions);
173} 182}
174 183
184SET_SYS::~SET_SYS() = default;
185
175} // namespace Service::Set 186} // namespace Service::Set
diff --git a/src/core/hle/service/set/set_sys.h b/src/core/hle/service/set/set_sys.h
index b77a97cde..f602f3c77 100644
--- a/src/core/hle/service/set/set_sys.h
+++ b/src/core/hle/service/set/set_sys.h
@@ -11,10 +11,19 @@ namespace Service::Set {
11class SET_SYS final : public ServiceFramework<SET_SYS> { 11class SET_SYS final : public ServiceFramework<SET_SYS> {
12public: 12public:
13 explicit SET_SYS(); 13 explicit SET_SYS();
14 ~SET_SYS() = default; 14 ~SET_SYS() override;
15 15
16private: 16private:
17 /// Indicates the current theme set by the system settings
18 enum class ColorSet : u32 {
19 BasicWhite = 0,
20 BasicBlack = 1,
21 };
22
17 void GetColorSetId(Kernel::HLERequestContext& ctx); 23 void GetColorSetId(Kernel::HLERequestContext& ctx);
24 void SetColorSetId(Kernel::HLERequestContext& ctx);
25
26 ColorSet color_set = ColorSet::BasicWhite;
18}; 27};
19 28
20} // namespace Service::Set 29} // namespace Service::Set
diff --git a/src/core/hle/service/time/time_s.cpp b/src/core/hle/service/time/interface.cpp
index 0b599ea00..048d5b077 100644
--- a/src/core/hle/service/time/time_s.cpp
+++ b/src/core/hle/service/time/interface.cpp
@@ -2,17 +2,18 @@
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 "core/hle/service/time/time_s.h" 5#include "core/hle/service/time/interface.h"
6 6
7namespace Service::Time { 7namespace Service::Time {
8 8
9TIME_S::TIME_S(std::shared_ptr<Module> time) : Module::Interface(std::move(time), "time:s") { 9Time::Time(std::shared_ptr<Module> time, const char* name)
10 : Module::Interface(std::move(time), name) {
10 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
11 {0, &TIME_S::GetStandardUserSystemClock, "GetStandardUserSystemClock"}, 12 {0, &Time::GetStandardUserSystemClock, "GetStandardUserSystemClock"},
12 {1, &TIME_S::GetStandardNetworkSystemClock, "GetStandardNetworkSystemClock"}, 13 {1, &Time::GetStandardNetworkSystemClock, "GetStandardNetworkSystemClock"},
13 {2, &TIME_S::GetStandardSteadyClock, "GetStandardSteadyClock"}, 14 {2, &Time::GetStandardSteadyClock, "GetStandardSteadyClock"},
14 {3, &TIME_S::GetTimeZoneService, "GetTimeZoneService"}, 15 {3, &Time::GetTimeZoneService, "GetTimeZoneService"},
15 {4, &TIME_S::GetStandardLocalSystemClock, "GetStandardLocalSystemClock"}, 16 {4, &Time::GetStandardLocalSystemClock, "GetStandardLocalSystemClock"},
16 {5, nullptr, "GetEphemeralNetworkSystemClock"}, 17 {5, nullptr, "GetEphemeralNetworkSystemClock"},
17 {50, nullptr, "SetStandardSteadyClockInternalOffset"}, 18 {50, nullptr, "SetStandardSteadyClockInternalOffset"},
18 {100, nullptr, "IsStandardUserSystemClockAutomaticCorrectionEnabled"}, 19 {100, nullptr, "IsStandardUserSystemClockAutomaticCorrectionEnabled"},
diff --git a/src/core/hle/service/time/time_s.h b/src/core/hle/service/time/interface.h
index 4a2daa513..183a53db1 100644
--- a/src/core/hle/service/time/time_s.h
+++ b/src/core/hle/service/time/interface.h
@@ -8,9 +8,9 @@
8 8
9namespace Service::Time { 9namespace Service::Time {
10 10
11class TIME_S final : public Module::Interface { 11class Time final : public Module::Interface {
12public: 12public:
13 explicit TIME_S(std::shared_ptr<Module> time); 13 explicit Time(std::shared_ptr<Module> time, const char* name);
14}; 14};
15 15
16} // namespace Service::Time 16} // namespace Service::Time
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp
index 507ae95f4..37b58bb77 100644
--- a/src/core/hle/service/time/time.cpp
+++ b/src/core/hle/service/time/time.cpp
@@ -6,12 +6,12 @@
6#include <ctime> 6#include <ctime>
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "core/core_timing.h" 8#include "core/core_timing.h"
9#include "core/core_timing_util.h"
9#include "core/hle/ipc_helpers.h" 10#include "core/hle/ipc_helpers.h"
10#include "core/hle/kernel/client_port.h" 11#include "core/hle/kernel/client_port.h"
11#include "core/hle/kernel/client_session.h" 12#include "core/hle/kernel/client_session.h"
13#include "core/hle/service/time/interface.h"
12#include "core/hle/service/time/time.h" 14#include "core/hle/service/time/time.h"
13#include "core/hle/service/time/time_s.h"
14#include "core/hle/service/time/time_u.h"
15 15
16namespace Service::Time { 16namespace Service::Time {
17 17
@@ -212,8 +212,9 @@ Module::Interface::Interface(std::shared_ptr<Module> time, const char* name)
212 212
213void InstallInterfaces(SM::ServiceManager& service_manager) { 213void InstallInterfaces(SM::ServiceManager& service_manager) {
214 auto time = std::make_shared<Module>(); 214 auto time = std::make_shared<Module>();
215 std::make_shared<TIME_S>(time)->InstallAsService(service_manager); 215 std::make_shared<Time>(time, "time:a")->InstallAsService(service_manager);
216 std::make_shared<TIME_U>(time)->InstallAsService(service_manager); 216 std::make_shared<Time>(time, "time:s")->InstallAsService(service_manager);
217 std::make_shared<Time>(time, "time:u")->InstallAsService(service_manager);
217} 218}
218 219
219} // namespace Service::Time 220} // namespace Service::Time
diff --git a/src/core/hle/service/time/time_u.cpp b/src/core/hle/service/time/time_u.cpp
deleted file mode 100644
index 1ed42c419..000000000
--- a/src/core/hle/service/time/time_u.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/hle/service/time/time_u.h"
6
7namespace Service::Time {
8
9TIME_U::TIME_U(std::shared_ptr<Module> time) : Module::Interface(std::move(time), "time:u") {
10 static const FunctionInfo functions[] = {
11 {0, &TIME_U::GetStandardUserSystemClock, "GetStandardUserSystemClock"},
12 {1, &TIME_U::GetStandardNetworkSystemClock, "GetStandardNetworkSystemClock"},
13 {2, &TIME_U::GetStandardSteadyClock, "GetStandardSteadyClock"},
14 {3, &TIME_U::GetTimeZoneService, "GetTimeZoneService"},
15 {4, &TIME_U::GetStandardLocalSystemClock, "GetStandardLocalSystemClock"},
16 {5, nullptr, "GetEphemeralNetworkSystemClock"},
17 {50, nullptr, "SetStandardSteadyClockInternalOffset"},
18 {100, nullptr, "IsStandardUserSystemClockAutomaticCorrectionEnabled"},
19 {101, nullptr, "SetStandardUserSystemClockAutomaticCorrectionEnabled"},
20 {102, nullptr, "GetStandardUserSystemClockInitialYear"},
21 {200, nullptr, "IsStandardNetworkSystemClockAccuracySufficient"},
22 {300, nullptr, "CalculateMonotonicSystemClockBaseTimePoint"},
23 {400, nullptr, "GetClockSnapshot"},
24 {401, nullptr, "GetClockSnapshotFromSystemClockContext"},
25 {500, nullptr, "CalculateStandardUserSystemClockDifferenceByUser"},
26 {501, nullptr, "CalculateSpanBetween"},
27 };
28 RegisterHandlers(functions);
29}
30
31} // namespace Service::Time
diff --git a/src/core/hle/service/time/time_u.h b/src/core/hle/service/time/time_u.h
deleted file mode 100644
index 3724bcdc7..000000000
--- a/src/core/hle/service/time/time_u.h
+++ /dev/null
@@ -1,16 +0,0 @@
1// Copyright 2018 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#include "core/hle/service/time/time.h"
8
9namespace Service::Time {
10
11class TIME_U final : public Module::Interface {
12public:
13 explicit TIME_U(std::shared_ptr<Module> time);
14};
15
16} // namespace Service::Time
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp
index 18bd62a08..b0277a875 100644
--- a/src/core/loader/deconstructed_rom_directory.cpp
+++ b/src/core/loader/deconstructed_rom_directory.cpp
@@ -6,7 +6,6 @@
6#include "common/common_funcs.h" 6#include "common/common_funcs.h"
7#include "common/file_util.h" 7#include "common/file_util.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "common/string_util.h"
10#include "core/file_sys/content_archive.h" 9#include "core/file_sys/content_archive.h"
11#include "core/gdbstub/gdbstub.h" 10#include "core/gdbstub/gdbstub.h"
12#include "core/hle/kernel/process.h" 11#include "core/hle/kernel/process.h"
@@ -18,34 +17,6 @@
18 17
19namespace Loader { 18namespace Loader {
20 19
21static std::string FindRomFS(const std::string& directory) {
22 std::string filepath_romfs;
23 const auto callback = [&filepath_romfs](u64*, const std::string& directory,
24 const std::string& virtual_name) -> bool {
25 const std::string physical_name = directory + virtual_name;
26 if (FileUtil::IsDirectory(physical_name)) {
27 // Skip directories
28 return true;
29 }
30
31 // Verify extension
32 const std::string extension = physical_name.substr(physical_name.find_last_of(".") + 1);
33 if (Common::ToLower(extension) != "romfs") {
34 return true;
35 }
36
37 // Found it - we are done
38 filepath_romfs = std::move(physical_name);
39 return false;
40 };
41
42 // Search the specified directory recursively, looking for the first .romfs file, which will
43 // be used for the RomFS
44 FileUtil::ForeachDirectoryEntry(nullptr, directory, callback);
45
46 return filepath_romfs;
47}
48
49AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file) 20AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file)
50 : AppLoader(std::move(file)) {} 21 : AppLoader(std::move(file)) {}
51 22
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index d7328ff39..0e205ed72 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -75,14 +75,6 @@ void Maxwell3D::WriteReg(u32 method, u32 value, u32 remaining_params) {
75 ProcessMacroUpload(value); 75 ProcessMacroUpload(value);
76 break; 76 break;
77 } 77 }
78 case MAXWELL3D_REG_INDEX(code_address.code_address_high):
79 case MAXWELL3D_REG_INDEX(code_address.code_address_low): {
80 // Note: For some reason games (like Puyo Puyo Tetris) seem to write 0 to the CODE_ADDRESS
81 // register, we do not currently know if that's intended or a bug, so we assert it lest
82 // stuff breaks in other places (like the shader address calculation).
83 ASSERT_MSG(regs.code_address.CodeAddress() == 0, "Unexpected CODE_ADDRESS register value.");
84 break;
85 }
86 case MAXWELL3D_REG_INDEX(const_buffer.cb_data[0]): 78 case MAXWELL3D_REG_INDEX(const_buffer.cb_data[0]):
87 case MAXWELL3D_REG_INDEX(const_buffer.cb_data[1]): 79 case MAXWELL3D_REG_INDEX(const_buffer.cb_data[1]):
88 case MAXWELL3D_REG_INDEX(const_buffer.cb_data[2]): 80 case MAXWELL3D_REG_INDEX(const_buffer.cb_data[2]):
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index 58501ca8b..c464fc6d1 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -23,7 +23,14 @@ enum class RenderTargetFormat : u32 {
23 RGB10_A2_UNORM = 0xD1, 23 RGB10_A2_UNORM = 0xD1,
24 RGBA8_UNORM = 0xD5, 24 RGBA8_UNORM = 0xD5,
25 RGBA8_SRGB = 0xD6, 25 RGBA8_SRGB = 0xD6,
26 RG16_UNORM = 0xDA,
27 RG16_SNORM = 0xDB,
28 RG16_SINT = 0xDC,
29 RG16_UINT = 0xDD,
30 RG16_FLOAT = 0xDE,
26 R11G11B10_FLOAT = 0xE0, 31 R11G11B10_FLOAT = 0xE0,
32 R16_FLOAT = 0xF2,
33 R8_UNORM = 0xF3,
27}; 34};
28 35
29enum class DepthFormat : u32 { 36enum class DepthFormat : u32 {
@@ -33,6 +40,7 @@ enum class DepthFormat : u32 {
33 Z24_X8_UNORM = 0x15, 40 Z24_X8_UNORM = 0x15,
34 Z24_S8_UNORM = 0x16, 41 Z24_S8_UNORM = 0x16,
35 Z24_C8_UNORM = 0x18, 42 Z24_C8_UNORM = 0x18,
43 Z32_S8_X24_FLOAT = 0x19,
36}; 44};
37 45
38/// Returns the number of bytes per pixel of each rendertarget format. 46/// Returns the number of bytes per pixel of each rendertarget format.
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 5d5ad84b7..a1c47bae9 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -5,6 +5,7 @@
5#include <algorithm> 5#include <algorithm>
6#include <memory> 6#include <memory>
7#include <string> 7#include <string>
8#include <string_view>
8#include <tuple> 9#include <tuple>
9#include <utility> 10#include <utility>
10#include <glad/glad.h> 11#include <glad/glad.h>
@@ -37,11 +38,6 @@ MICROPROFILE_DEFINE(OpenGL_Blits, "OpenGL", "Blits", MP_RGB(100, 100, 255));
37MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100)); 38MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100));
38 39
39RasterizerOpenGL::RasterizerOpenGL() { 40RasterizerOpenGL::RasterizerOpenGL() {
40 has_ARB_buffer_storage = false;
41 has_ARB_direct_state_access = false;
42 has_ARB_separate_shader_objects = false;
43 has_ARB_vertex_attrib_binding = false;
44
45 // Create sampler objects 41 // Create sampler objects
46 for (size_t i = 0; i < texture_samplers.size(); ++i) { 42 for (size_t i = 0; i < texture_samplers.size(); ++i) {
47 texture_samplers[i].Create(); 43 texture_samplers[i].Create();
@@ -59,7 +55,8 @@ RasterizerOpenGL::RasterizerOpenGL() {
59 GLint ext_num; 55 GLint ext_num;
60 glGetIntegerv(GL_NUM_EXTENSIONS, &ext_num); 56 glGetIntegerv(GL_NUM_EXTENSIONS, &ext_num);
61 for (GLint i = 0; i < ext_num; i++) { 57 for (GLint i = 0; i < ext_num; i++) {
62 std::string extension{reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i))}; 58 const std::string_view extension{
59 reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i))};
63 60
64 if (extension == "GL_ARB_buffer_storage") { 61 if (extension == "GL_ARB_buffer_storage") {
65 has_ARB_buffer_storage = true; 62 has_ARB_buffer_storage = true;
@@ -110,8 +107,6 @@ RasterizerOpenGL::RasterizerOpenGL() {
110 glBindBufferBase(GL_UNIFORM_BUFFER, index, buffer.handle); 107 glBindBufferBase(GL_UNIFORM_BUFFER, index, buffer.handle);
111 } 108 }
112 109
113 accelerate_draw = AccelDraw::Disabled;
114
115 glEnable(GL_BLEND); 110 glEnable(GL_BLEND);
116 111
117 LOG_CRITICAL(Render_OpenGL, "Sync fixed function OpenGL state here!"); 112 LOG_CRITICAL(Render_OpenGL, "Sync fixed function OpenGL state here!");
@@ -694,10 +689,12 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr
694 glBindBuffer(GL_UNIFORM_BUFFER, 0); 689 glBindBuffer(GL_UNIFORM_BUFFER, 0);
695 690
696 // Now configure the bindpoint of the buffer inside the shader 691 // Now configure the bindpoint of the buffer inside the shader
697 std::string buffer_name = used_buffer.GetName(); 692 const std::string buffer_name = used_buffer.GetName();
698 GLuint index = glGetProgramResourceIndex(program, GL_UNIFORM_BLOCK, buffer_name.c_str()); 693 const GLuint index =
699 if (index != -1) 694 glGetProgramResourceIndex(program, GL_UNIFORM_BLOCK, buffer_name.c_str());
695 if (index != GL_INVALID_INDEX) {
700 glUniformBlockBinding(program, index, buffer_draw_state.bindpoint); 696 glUniformBlockBinding(program, index, buffer_draw_state.bindpoint);
697 }
701 } 698 }
702 699
703 state.Apply(); 700 state.Apply();
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index ab06e2d95..e150be58f 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -135,10 +135,10 @@ private:
135 /// Syncs the blend state to match the guest state 135 /// Syncs the blend state to match the guest state
136 void SyncBlendState(); 136 void SyncBlendState();
137 137
138 bool has_ARB_buffer_storage; 138 bool has_ARB_buffer_storage = false;
139 bool has_ARB_direct_state_access; 139 bool has_ARB_direct_state_access = false;
140 bool has_ARB_separate_shader_objects; 140 bool has_ARB_separate_shader_objects = false;
141 bool has_ARB_vertex_attrib_binding; 141 bool has_ARB_vertex_attrib_binding = false;
142 142
143 OpenGLState state; 143 OpenGLState state;
144 144
@@ -167,5 +167,5 @@ private:
167 void SetupShaders(u8* buffer_ptr, GLintptr buffer_offset); 167 void SetupShaders(u8* buffer_ptr, GLintptr buffer_offset);
168 168
169 enum class AccelDraw { Disabled, Arrays, Indexed }; 169 enum class AccelDraw { Disabled, Arrays, Indexed };
170 AccelDraw accelerate_draw; 170 AccelDraw accelerate_draw = AccelDraw::Disabled;
171}; 171};
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 1d3aff97b..a4d9707cb 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -104,13 +104,21 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
104 true}, // DXT45 104 true}, // DXT45
105 {GL_COMPRESSED_RED_RGTC1, GL_RED, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, true}, // DXN1 105 {GL_COMPRESSED_RED_RGTC1, GL_RED, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, true}, // DXN1
106 {GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, 106 {GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
107 true}, // BC7U 107 true}, // BC7U
108 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 108 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4
109 {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8 109 {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8
110 {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8 110 {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8
111 {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F 111 {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F
112 {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F 112 {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F
113 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F 113 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F
114 {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F
115 {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM
116 {GL_RG16, GL_RG, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // RG16
117 {GL_RG16F, GL_RG, GL_HALF_FLOAT, ComponentType::Float, false}, // RG16F
118 {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // RG16UI
119 {GL_RG16I, GL_RG_INTEGER, GL_SHORT, ComponentType::SInt, false}, // RG16I
120 {GL_RG16_SNORM, GL_RG, GL_SHORT, ComponentType::SNorm, false}, // RG16S
121 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8
114 122
115 // DepthStencil formats 123 // DepthStencil formats
116 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, 124 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
@@ -120,6 +128,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
120 {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F 128 {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F
121 {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, ComponentType::UNorm, 129 {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, ComponentType::UNorm,
122 false}, // Z16 130 false}, // Z16
131 {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
132 ComponentType::Float, false}, // Z32FS8
123}}; 133}};
124 134
125static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) { 135static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) {
@@ -204,9 +214,13 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
204 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, 214 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
205 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, 215 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
206 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, 216 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
207 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::Z24S8>, 217 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>,
218 MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::RG16>,
219 MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>,
220 MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>,
221 MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::Z24S8>,
208 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, 222 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
209 MortonCopy<true, PixelFormat::Z16>, 223 MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>,
210}; 224};
211 225
212static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), 226static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
@@ -232,10 +246,19 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
232 MortonCopy<false, PixelFormat::RGBA32F>, 246 MortonCopy<false, PixelFormat::RGBA32F>,
233 MortonCopy<false, PixelFormat::RG32F>, 247 MortonCopy<false, PixelFormat::RG32F>,
234 MortonCopy<false, PixelFormat::R32F>, 248 MortonCopy<false, PixelFormat::R32F>,
249 MortonCopy<false, PixelFormat::R16F>,
250 MortonCopy<false, PixelFormat::R16UNORM>,
251 MortonCopy<false, PixelFormat::RG16>,
252 MortonCopy<false, PixelFormat::RG16F>,
253 MortonCopy<false, PixelFormat::RG16UI>,
254 MortonCopy<false, PixelFormat::RG16I>,
255 MortonCopy<false, PixelFormat::RG16S>,
256 MortonCopy<false, PixelFormat::SRGBA8>,
235 MortonCopy<false, PixelFormat::Z24S8>, 257 MortonCopy<false, PixelFormat::Z24S8>,
236 MortonCopy<false, PixelFormat::S8Z24>, 258 MortonCopy<false, PixelFormat::S8Z24>,
237 MortonCopy<false, PixelFormat::Z32F>, 259 MortonCopy<false, PixelFormat::Z32F>,
238 MortonCopy<false, PixelFormat::Z16>, 260 MortonCopy<false, PixelFormat::Z16>,
261 MortonCopy<false, PixelFormat::Z32FS8>,
239}; 262};
240 263
241// Allocate an uninitialized texture of appropriate size and format for the surface 264// Allocate an uninitialized texture of appropriate size and format for the surface
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 800d239d9..bf0458b94 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -41,14 +41,23 @@ struct SurfaceParams {
41 RGBA32F = 16, 41 RGBA32F = 16,
42 RG32F = 17, 42 RG32F = 17,
43 R32F = 18, 43 R32F = 18,
44 R16F = 19,
45 R16UNORM = 20,
46 RG16 = 21,
47 RG16F = 22,
48 RG16UI = 23,
49 RG16I = 24,
50 RG16S = 25,
51 SRGBA8 = 26,
44 52
45 MaxColorFormat, 53 MaxColorFormat,
46 54
47 // DepthStencil formats 55 // DepthStencil formats
48 Z24S8 = 19, 56 Z24S8 = 27,
49 S8Z24 = 20, 57 S8Z24 = 28,
50 Z32F = 21, 58 Z32F = 29,
51 Z16 = 22, 59 Z16 = 30,
60 Z32FS8 = 31,
52 61
53 MaxDepthStencilFormat, 62 MaxDepthStencilFormat,
54 63
@@ -105,10 +114,19 @@ struct SurfaceParams {
105 1, // RGBA32F 114 1, // RGBA32F
106 1, // RG32F 115 1, // RG32F
107 1, // R32F 116 1, // R32F
117 1, // R16F
118 1, // R16UNORM
119 1, // RG16
120 1, // RG16F
121 1, // RG16UI
122 1, // RG16I
123 1, // RG16S
124 1, // SRGBA8
108 1, // Z24S8 125 1, // Z24S8
109 1, // S8Z24 126 1, // S8Z24
110 1, // Z32F 127 1, // Z32F
111 1, // Z16 128 1, // Z16
129 1, // Z32FS8
112 }}; 130 }};
113 131
114 ASSERT(static_cast<size_t>(format) < compression_factor_table.size()); 132 ASSERT(static_cast<size_t>(format) < compression_factor_table.size());
@@ -139,10 +157,19 @@ struct SurfaceParams {
139 128, // RGBA32F 157 128, // RGBA32F
140 64, // RG32F 158 64, // RG32F
141 32, // R32F 159 32, // R32F
160 16, // R16F
161 16, // R16UNORM
162 32, // RG16
163 32, // RG16F
164 32, // RG16UI
165 32, // RG16I
166 32, // RG16S
167 32, // SRGBA8
142 32, // Z24S8 168 32, // Z24S8
143 32, // S8Z24 169 32, // S8Z24
144 32, // Z32F 170 32, // Z32F
145 16, // Z16 171 16, // Z16
172 64, // Z32FS8
146 }}; 173 }};
147 174
148 ASSERT(static_cast<size_t>(format) < bpp_table.size()); 175 ASSERT(static_cast<size_t>(format) < bpp_table.size());
@@ -163,6 +190,8 @@ struct SurfaceParams {
163 return PixelFormat::Z32F; 190 return PixelFormat::Z32F;
164 case Tegra::DepthFormat::Z16_UNORM: 191 case Tegra::DepthFormat::Z16_UNORM:
165 return PixelFormat::Z16; 192 return PixelFormat::Z16;
193 case Tegra::DepthFormat::Z32_S8_X24_FLOAT:
194 return PixelFormat::Z32FS8;
166 default: 195 default:
167 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 196 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
168 UNREACHABLE(); 197 UNREACHABLE();
@@ -171,8 +200,9 @@ struct SurfaceParams {
171 200
172 static PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) { 201 static PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) {
173 switch (format) { 202 switch (format) {
174 case Tegra::RenderTargetFormat::RGBA8_UNORM:
175 case Tegra::RenderTargetFormat::RGBA8_SRGB: 203 case Tegra::RenderTargetFormat::RGBA8_SRGB:
204 return PixelFormat::SRGBA8;
205 case Tegra::RenderTargetFormat::RGBA8_UNORM:
176 return PixelFormat::ABGR8; 206 return PixelFormat::ABGR8;
177 case Tegra::RenderTargetFormat::BGRA8_UNORM: 207 case Tegra::RenderTargetFormat::BGRA8_UNORM:
178 return PixelFormat::BGRA8; 208 return PixelFormat::BGRA8;
@@ -188,6 +218,20 @@ struct SurfaceParams {
188 return PixelFormat::R11FG11FB10F; 218 return PixelFormat::R11FG11FB10F;
189 case Tegra::RenderTargetFormat::RGBA32_UINT: 219 case Tegra::RenderTargetFormat::RGBA32_UINT:
190 return PixelFormat::RGBA32UI; 220 return PixelFormat::RGBA32UI;
221 case Tegra::RenderTargetFormat::R8_UNORM:
222 return PixelFormat::R8;
223 case Tegra::RenderTargetFormat::RG16_FLOAT:
224 return PixelFormat::RG16F;
225 case Tegra::RenderTargetFormat::RG16_UINT:
226 return PixelFormat::RG16UI;
227 case Tegra::RenderTargetFormat::RG16_SINT:
228 return PixelFormat::RG16I;
229 case Tegra::RenderTargetFormat::RG16_UNORM:
230 return PixelFormat::RG16;
231 case Tegra::RenderTargetFormat::RG16_SNORM:
232 return PixelFormat::RG16S;
233 case Tegra::RenderTargetFormat::R16_FLOAT:
234 return PixelFormat::R16F;
191 default: 235 default:
192 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 236 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
193 UNREACHABLE(); 237 UNREACHABLE();
@@ -226,8 +270,22 @@ struct SurfaceParams {
226 UNREACHABLE(); 270 UNREACHABLE();
227 case Tegra::Texture::TextureFormat::R32_G32: 271 case Tegra::Texture::TextureFormat::R32_G32:
228 return PixelFormat::RG32F; 272 return PixelFormat::RG32F;
273 case Tegra::Texture::TextureFormat::R16:
274 switch (component_type) {
275 case Tegra::Texture::ComponentType::FLOAT:
276 return PixelFormat::R16F;
277 case Tegra::Texture::ComponentType::UNORM:
278 return PixelFormat::R16UNORM;
279 }
280 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
281 static_cast<u32>(component_type));
282 UNREACHABLE();
229 case Tegra::Texture::TextureFormat::R32: 283 case Tegra::Texture::TextureFormat::R32:
230 return PixelFormat::R32F; 284 return PixelFormat::R32F;
285 case Tegra::Texture::TextureFormat::ZF32:
286 return PixelFormat::Z32F;
287 case Tegra::Texture::TextureFormat::Z24S8:
288 return PixelFormat::Z24S8;
231 case Tegra::Texture::TextureFormat::DXT1: 289 case Tegra::Texture::TextureFormat::DXT1:
232 return PixelFormat::DXT1; 290 return PixelFormat::DXT1;
233 case Tegra::Texture::TextureFormat::DXT23: 291 case Tegra::Texture::TextureFormat::DXT23:
@@ -240,6 +298,22 @@ struct SurfaceParams {
240 return PixelFormat::BC7U; 298 return PixelFormat::BC7U;
241 case Tegra::Texture::TextureFormat::ASTC_2D_4X4: 299 case Tegra::Texture::TextureFormat::ASTC_2D_4X4:
242 return PixelFormat::ASTC_2D_4X4; 300 return PixelFormat::ASTC_2D_4X4;
301 case Tegra::Texture::TextureFormat::R16_G16:
302 switch (component_type) {
303 case Tegra::Texture::ComponentType::FLOAT:
304 return PixelFormat::RG16F;
305 case Tegra::Texture::ComponentType::UNORM:
306 return PixelFormat::RG16;
307 case Tegra::Texture::ComponentType::SNORM:
308 return PixelFormat::RG16S;
309 case Tegra::Texture::ComponentType::UINT:
310 return PixelFormat::RG16UI;
311 case Tegra::Texture::ComponentType::SINT:
312 return PixelFormat::RG16I;
313 }
314 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
315 static_cast<u32>(component_type));
316 UNREACHABLE();
243 default: 317 default:
244 LOG_CRITICAL(HW_GPU, "Unimplemented format={}, component_type={}", 318 LOG_CRITICAL(HW_GPU, "Unimplemented format={}, component_type={}",
245 static_cast<u32>(format), static_cast<u32>(component_type)); 319 static_cast<u32>(format), static_cast<u32>(component_type));
@@ -251,6 +325,7 @@ struct SurfaceParams {
251 // TODO(Subv): Properly implement this 325 // TODO(Subv): Properly implement this
252 switch (format) { 326 switch (format) {
253 case PixelFormat::ABGR8: 327 case PixelFormat::ABGR8:
328 case PixelFormat::SRGBA8:
254 return Tegra::Texture::TextureFormat::A8R8G8B8; 329 return Tegra::Texture::TextureFormat::A8R8G8B8;
255 case PixelFormat::B5G6R5: 330 case PixelFormat::B5G6R5:
256 return Tegra::Texture::TextureFormat::B5G6R5; 331 return Tegra::Texture::TextureFormat::B5G6R5;
@@ -290,6 +365,19 @@ struct SurfaceParams {
290 return Tegra::Texture::TextureFormat::R32_G32; 365 return Tegra::Texture::TextureFormat::R32_G32;
291 case PixelFormat::R32F: 366 case PixelFormat::R32F:
292 return Tegra::Texture::TextureFormat::R32; 367 return Tegra::Texture::TextureFormat::R32;
368 case PixelFormat::R16F:
369 case PixelFormat::R16UNORM:
370 return Tegra::Texture::TextureFormat::R16;
371 case PixelFormat::Z32F:
372 return Tegra::Texture::TextureFormat::ZF32;
373 case PixelFormat::Z24S8:
374 return Tegra::Texture::TextureFormat::Z24S8;
375 case PixelFormat::RG16F:
376 case PixelFormat::RG16:
377 case PixelFormat::RG16UI:
378 case PixelFormat::RG16I:
379 case PixelFormat::RG16S:
380 return Tegra::Texture::TextureFormat::R16_G16;
293 default: 381 default:
294 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 382 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
295 UNREACHABLE(); 383 UNREACHABLE();
@@ -306,6 +394,8 @@ struct SurfaceParams {
306 return Tegra::DepthFormat::Z32_FLOAT; 394 return Tegra::DepthFormat::Z32_FLOAT;
307 case PixelFormat::Z16: 395 case PixelFormat::Z16:
308 return Tegra::DepthFormat::Z16_UNORM; 396 return Tegra::DepthFormat::Z16_UNORM;
397 case PixelFormat::Z32FS8:
398 return Tegra::DepthFormat::Z32_S8_X24_FLOAT;
309 default: 399 default:
310 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 400 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
311 UNREACHABLE(); 401 UNREACHABLE();
@@ -319,6 +409,12 @@ struct SurfaceParams {
319 return ComponentType::UNorm; 409 return ComponentType::UNorm;
320 case Tegra::Texture::ComponentType::FLOAT: 410 case Tegra::Texture::ComponentType::FLOAT:
321 return ComponentType::Float; 411 return ComponentType::Float;
412 case Tegra::Texture::ComponentType::SNORM:
413 return ComponentType::SNorm;
414 case Tegra::Texture::ComponentType::UINT:
415 return ComponentType::UInt;
416 case Tegra::Texture::ComponentType::SINT:
417 return ComponentType::SInt;
322 default: 418 default:
323 LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type)); 419 LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type));
324 UNREACHABLE(); 420 UNREACHABLE();
@@ -332,14 +428,23 @@ struct SurfaceParams {
332 case Tegra::RenderTargetFormat::RGBA8_SRGB: 428 case Tegra::RenderTargetFormat::RGBA8_SRGB:
333 case Tegra::RenderTargetFormat::BGRA8_UNORM: 429 case Tegra::RenderTargetFormat::BGRA8_UNORM:
334 case Tegra::RenderTargetFormat::RGB10_A2_UNORM: 430 case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
431 case Tegra::RenderTargetFormat::R8_UNORM:
432 case Tegra::RenderTargetFormat::RG16_UNORM:
335 return ComponentType::UNorm; 433 return ComponentType::UNorm;
434 case Tegra::RenderTargetFormat::RG16_SNORM:
435 return ComponentType::SNorm;
336 case Tegra::RenderTargetFormat::RGBA16_FLOAT: 436 case Tegra::RenderTargetFormat::RGBA16_FLOAT:
337 case Tegra::RenderTargetFormat::R11G11B10_FLOAT: 437 case Tegra::RenderTargetFormat::R11G11B10_FLOAT:
338 case Tegra::RenderTargetFormat::RGBA32_FLOAT: 438 case Tegra::RenderTargetFormat::RGBA32_FLOAT:
339 case Tegra::RenderTargetFormat::RG32_FLOAT: 439 case Tegra::RenderTargetFormat::RG32_FLOAT:
440 case Tegra::RenderTargetFormat::RG16_FLOAT:
441 case Tegra::RenderTargetFormat::R16_FLOAT:
340 return ComponentType::Float; 442 return ComponentType::Float;
341 case Tegra::RenderTargetFormat::RGBA32_UINT: 443 case Tegra::RenderTargetFormat::RGBA32_UINT:
444 case Tegra::RenderTargetFormat::RG16_UINT:
342 return ComponentType::UInt; 445 return ComponentType::UInt;
446 case Tegra::RenderTargetFormat::RG16_SINT:
447 return ComponentType::SInt;
343 default: 448 default:
344 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 449 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
345 UNREACHABLE(); 450 UNREACHABLE();
@@ -363,6 +468,7 @@ struct SurfaceParams {
363 case Tegra::DepthFormat::Z24_S8_UNORM: 468 case Tegra::DepthFormat::Z24_S8_UNORM:
364 return ComponentType::UNorm; 469 return ComponentType::UNorm;
365 case Tegra::DepthFormat::Z32_FLOAT: 470 case Tegra::DepthFormat::Z32_FLOAT:
471 case Tegra::DepthFormat::Z32_S8_X24_FLOAT:
366 return ComponentType::Float; 472 return ComponentType::Float;
367 default: 473 default:
368 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 474 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index cda2646ad..d794f8402 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -62,10 +62,12 @@ u32 BytesPerPixel(TextureFormat format) {
62 case TextureFormat::A2B10G10R10: 62 case TextureFormat::A2B10G10R10:
63 case TextureFormat::BF10GF11RF11: 63 case TextureFormat::BF10GF11RF11:
64 case TextureFormat::R32: 64 case TextureFormat::R32:
65 case TextureFormat::R16_G16:
65 return 4; 66 return 4;
66 case TextureFormat::A1B5G5R5: 67 case TextureFormat::A1B5G5R5:
67 case TextureFormat::B5G6R5: 68 case TextureFormat::B5G6R5:
68 case TextureFormat::G8R8: 69 case TextureFormat::G8R8:
70 case TextureFormat::R16:
69 return 2; 71 return 2;
70 case TextureFormat::R8: 72 case TextureFormat::R8:
71 return 1; 73 return 1;
@@ -89,6 +91,8 @@ static u32 DepthBytesPerPixel(DepthFormat format) {
89 case DepthFormat::Z24_S8_UNORM: 91 case DepthFormat::Z24_S8_UNORM:
90 case DepthFormat::Z32_FLOAT: 92 case DepthFormat::Z32_FLOAT:
91 return 4; 93 return 4;
94 case DepthFormat::Z32_S8_X24_FLOAT:
95 return 8;
92 default: 96 default:
93 UNIMPLEMENTED_MSG("Format not implemented"); 97 UNIMPLEMENTED_MSG("Format not implemented");
94 break; 98 break;
@@ -123,6 +127,8 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
123 case TextureFormat::R32_G32_B32_A32: 127 case TextureFormat::R32_G32_B32_A32:
124 case TextureFormat::R32_G32: 128 case TextureFormat::R32_G32:
125 case TextureFormat::R32: 129 case TextureFormat::R32:
130 case TextureFormat::R16:
131 case TextureFormat::R16_G16:
126 case TextureFormat::BF10GF11RF11: 132 case TextureFormat::BF10GF11RF11:
127 case TextureFormat::ASTC_2D_4X4: 133 case TextureFormat::ASTC_2D_4X4:
128 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, 134 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
@@ -148,6 +154,7 @@ std::vector<u8> UnswizzleDepthTexture(VAddr address, DepthFormat format, u32 wid
148 case DepthFormat::S8_Z24_UNORM: 154 case DepthFormat::S8_Z24_UNORM:
149 case DepthFormat::Z24_S8_UNORM: 155 case DepthFormat::Z24_S8_UNORM:
150 case DepthFormat::Z32_FLOAT: 156 case DepthFormat::Z32_FLOAT:
157 case DepthFormat::Z32_S8_X24_FLOAT:
151 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, 158 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
152 unswizzled_data.data(), true, block_height); 159 unswizzled_data.data(), true, block_height);
153 break; 160 break;
@@ -181,6 +188,8 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
181 case TextureFormat::R32_G32_B32_A32: 188 case TextureFormat::R32_G32_B32_A32:
182 case TextureFormat::R32_G32: 189 case TextureFormat::R32_G32:
183 case TextureFormat::R32: 190 case TextureFormat::R32:
191 case TextureFormat::R16:
192 case TextureFormat::R16_G16:
184 // TODO(Subv): For the time being just forward the same data without any decoding. 193 // TODO(Subv): For the time being just forward the same data without any decoding.
185 rgba_data = texture_data; 194 rgba_data = texture_data;
186 break; 195 break;
diff --git a/src/yuzu/debugger/wait_tree.cpp b/src/yuzu/debugger/wait_tree.cpp
index 8f24586ce..2b45b8573 100644
--- a/src/yuzu/debugger/wait_tree.cpp
+++ b/src/yuzu/debugger/wait_tree.cpp
@@ -5,6 +5,7 @@
5#include "yuzu/debugger/wait_tree.h" 5#include "yuzu/debugger/wait_tree.h"
6#include "yuzu/util/util.h" 6#include "yuzu/util/util.h"
7 7
8#include "common/assert.h"
8#include "core/core.h" 9#include "core/core.h"
9#include "core/hle/kernel/event.h" 10#include "core/hle/kernel/event.h"
10#include "core/hle/kernel/handle_table.h" 11#include "core/hle/kernel/handle_table.h"
@@ -169,6 +170,8 @@ QString WaitTreeWaitObject::GetResetTypeQString(Kernel::ResetType reset_type) {
169 case Kernel::ResetType::Pulse: 170 case Kernel::ResetType::Pulse:
170 return tr("pulse"); 171 return tr("pulse");
171 } 172 }
173 UNREACHABLE();
174 return {};
172} 175}
173 176
174WaitTreeObjectList::WaitTreeObjectList( 177WaitTreeObjectList::WaitTreeObjectList(
@@ -206,6 +209,9 @@ QString WaitTreeThread::GetText() const {
206 case ThreadStatus::WaitSleep: 209 case ThreadStatus::WaitSleep:
207 status = tr("sleeping"); 210 status = tr("sleeping");
208 break; 211 break;
212 case ThreadStatus::WaitIPC:
213 status = tr("waiting for IPC reply");
214 break;
209 case ThreadStatus::WaitSynchAll: 215 case ThreadStatus::WaitSynchAll:
210 case ThreadStatus::WaitSynchAny: 216 case ThreadStatus::WaitSynchAny:
211 status = tr("waiting for objects"); 217 status = tr("waiting for objects");
@@ -237,6 +243,7 @@ QColor WaitTreeThread::GetColor() const {
237 case ThreadStatus::Ready: 243 case ThreadStatus::Ready:
238 return QColor(Qt::GlobalColor::darkBlue); 244 return QColor(Qt::GlobalColor::darkBlue);
239 case ThreadStatus::WaitHLEEvent: 245 case ThreadStatus::WaitHLEEvent:
246 case ThreadStatus::WaitIPC:
240 return QColor(Qt::GlobalColor::darkRed); 247 return QColor(Qt::GlobalColor::darkRed);
241 case ThreadStatus::WaitSleep: 248 case ThreadStatus::WaitSleep:
242 return QColor(Qt::GlobalColor::darkYellow); 249 return QColor(Qt::GlobalColor::darkYellow);