summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_32.cpp35
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_32.h5
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_64.cpp42
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_64.h5
-rw-r--r--src/core/core.cpp2
-rw-r--r--src/core/hle/kernel/kernel.cpp6
-rw-r--r--src/core/hle/kernel/process_capability.cpp5
-rw-r--r--src/core/hle/kernel/process_capability.h2
-rw-r--r--src/core/hle/kernel/svc.cpp132
-rw-r--r--src/core/hle/service/acc/acc.cpp17
-rw-r--r--src/core/hle/service/acc/acc_su.cpp36
-rw-r--r--src/core/hle/service/acc/acc_u1.cpp28
-rw-r--r--src/core/hle/service/am/am.cpp39
-rw-r--r--src/core/hle/service/am/am.h1
-rw-r--r--src/core/hle/service/aoc/aoc_u.cpp2
-rw-r--r--src/core/hle/service/audio/hwopus.cpp4
-rw-r--r--src/core/hle/service/btdrv/btdrv.cpp19
-rw-r--r--src/core/hle/service/btm/btm.cpp1
-rw-r--r--src/core/hle/service/erpt/erpt.cpp7
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.cpp19
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.h2
-rw-r--r--src/core/hle/service/friend/friend.cpp23
-rw-r--r--src/core/hle/service/glue/bgtc.cpp27
-rw-r--r--src/core/hle/service/glue/bgtc.h8
-rw-r--r--src/core/hle/service/hid/controllers/gesture.cpp11
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp12
-rw-r--r--src/core/hle/service/hid/controllers/npad.h2
-rw-r--r--src/core/hle/service/hid/controllers/touchscreen.cpp5
-rw-r--r--src/core/hle/service/hid/hid.cpp106
-rw-r--r--src/core/hle/service/hid/hid.h1
-rw-r--r--src/core/hle/service/hid/xcd.cpp2
-rw-r--r--src/core/hle/service/nim/nim.cpp99
-rw-r--r--src/core/hle/service/npns/npns.cpp3
-rw-r--r--src/core/hle/service/ns/ns.cpp41
-rw-r--r--src/core/hle/service/nvdrv/devices/nvdevice.h20
-rw-r--r--src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp11
-rw-r--r--src/core/hle/service/nvdrv/devices/nvdisp_disp0.h12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp11
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.h12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp17
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_gpu.h12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp11
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec.h12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp17
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp11
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_vic.cpp12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_vic.h12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvmap.cpp12
-rw-r--r--src/core/hle/service/nvdrv/devices/nvmap.h12
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.cpp10
-rw-r--r--src/core/hle/service/service.cpp6
-rw-r--r--src/core/hle/service/vi/vi.cpp8
-rw-r--r--src/core/settings.h1
58 files changed, 771 insertions, 257 deletions
diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp
index 53d78de32..08d889135 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp
@@ -114,18 +114,17 @@ public:
114 static constexpr u64 minimum_run_cycles = 1000U; 114 static constexpr u64 minimum_run_cycles = 1000U;
115}; 115};
116 116
117std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable& page_table, 117std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable* page_table) const {
118 std::size_t address_space_bits) const {
119 Dynarmic::A32::UserConfig config; 118 Dynarmic::A32::UserConfig config;
120 config.callbacks = cb.get(); 119 config.callbacks = cb.get();
121 // TODO(bunnei): Implement page table for 32-bit
122 // config.page_table = &page_table.pointers;
123 config.coprocessors[15] = cp15; 120 config.coprocessors[15] = cp15;
124 config.define_unpredictable_behaviour = true; 121 config.define_unpredictable_behaviour = true;
125 static constexpr std::size_t PAGE_BITS = 12; 122 static constexpr std::size_t PAGE_BITS = 12;
126 static constexpr std::size_t NUM_PAGE_TABLE_ENTRIES = 1 << (32 - PAGE_BITS); 123 static constexpr std::size_t NUM_PAGE_TABLE_ENTRIES = 1 << (32 - PAGE_BITS);
127 config.page_table = reinterpret_cast<std::array<std::uint8_t*, NUM_PAGE_TABLE_ENTRIES>*>( 124 if (page_table) {
128 page_table.pointers.data()); 125 config.page_table = reinterpret_cast<std::array<std::uint8_t*, NUM_PAGE_TABLE_ENTRIES>*>(
126 page_table->pointers.data());
127 }
129 config.absolute_offset_page_table = true; 128 config.absolute_offset_page_table = true;
130 config.page_table_pointer_mask_bits = Common::PageTable::ATTRIBUTE_BITS; 129 config.page_table_pointer_mask_bits = Common::PageTable::ATTRIBUTE_BITS;
131 config.detect_misaligned_access_via_page_table = 16 | 32 | 64 | 128; 130 config.detect_misaligned_access_via_page_table = 16 | 32 | 64 | 128;
@@ -138,6 +137,10 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable&
138 // Timing 137 // Timing
139 config.wall_clock_cntpct = uses_wall_clock; 138 config.wall_clock_cntpct = uses_wall_clock;
140 139
140 // Code cache size
141 config.code_cache_size = 512 * 1024 * 1024;
142 config.far_code_offset = 256 * 1024 * 1024;
143
141 // Safe optimizations 144 // Safe optimizations
142 if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::DebugMode) { 145 if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::DebugMode) {
143 if (!Settings::values.cpuopt_page_tables) { 146 if (!Settings::values.cpuopt_page_tables) {
@@ -201,7 +204,8 @@ ARM_Dynarmic_32::ARM_Dynarmic_32(System& system, CPUInterrupts& interrupt_handle
201 : ARM_Interface{system, interrupt_handlers, uses_wall_clock}, 204 : ARM_Interface{system, interrupt_handlers, uses_wall_clock},
202 cb(std::make_unique<DynarmicCallbacks32>(*this)), 205 cb(std::make_unique<DynarmicCallbacks32>(*this)),
203 cp15(std::make_shared<DynarmicCP15>(*this)), core_index{core_index}, 206 cp15(std::make_shared<DynarmicCP15>(*this)), core_index{core_index},
204 exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor)} {} 207 exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor)},
208 jit(MakeJit(nullptr)) {}
205 209
206ARM_Dynarmic_32::~ARM_Dynarmic_32() = default; 210ARM_Dynarmic_32::~ARM_Dynarmic_32() = default;
207 211
@@ -256,9 +260,6 @@ void ARM_Dynarmic_32::ChangeProcessorID(std::size_t new_core_id) {
256} 260}
257 261
258void ARM_Dynarmic_32::SaveContext(ThreadContext32& ctx) { 262void ARM_Dynarmic_32::SaveContext(ThreadContext32& ctx) {
259 if (!jit) {
260 return;
261 }
262 Dynarmic::A32::Context context; 263 Dynarmic::A32::Context context;
263 jit->SaveContext(context); 264 jit->SaveContext(context);
264 ctx.cpu_registers = context.Regs(); 265 ctx.cpu_registers = context.Regs();
@@ -268,9 +269,6 @@ void ARM_Dynarmic_32::SaveContext(ThreadContext32& ctx) {
268} 269}
269 270
270void ARM_Dynarmic_32::LoadContext(const ThreadContext32& ctx) { 271void ARM_Dynarmic_32::LoadContext(const ThreadContext32& ctx) {
271 if (!jit) {
272 return;
273 }
274 Dynarmic::A32::Context context; 272 Dynarmic::A32::Context context;
275 context.Regs() = ctx.cpu_registers; 273 context.Regs() = ctx.cpu_registers;
276 context.ExtRegs() = ctx.extension_registers; 274 context.ExtRegs() = ctx.extension_registers;
@@ -284,23 +282,14 @@ void ARM_Dynarmic_32::PrepareReschedule() {
284} 282}
285 283
286void ARM_Dynarmic_32::ClearInstructionCache() { 284void ARM_Dynarmic_32::ClearInstructionCache() {
287 if (!jit) {
288 return;
289 }
290 jit->ClearCache(); 285 jit->ClearCache();
291} 286}
292 287
293void ARM_Dynarmic_32::InvalidateCacheRange(VAddr addr, std::size_t size) { 288void ARM_Dynarmic_32::InvalidateCacheRange(VAddr addr, std::size_t size) {
294 if (!jit) {
295 return;
296 }
297 jit->InvalidateCacheRange(static_cast<u32>(addr), size); 289 jit->InvalidateCacheRange(static_cast<u32>(addr), size);
298} 290}
299 291
300void ARM_Dynarmic_32::ClearExclusiveState() { 292void ARM_Dynarmic_32::ClearExclusiveState() {
301 if (!jit) {
302 return;
303 }
304 jit->ClearExclusiveState(); 293 jit->ClearExclusiveState();
305} 294}
306 295
@@ -316,7 +305,7 @@ void ARM_Dynarmic_32::PageTableChanged(Common::PageTable& page_table,
316 LoadContext(ctx); 305 LoadContext(ctx);
317 return; 306 return;
318 } 307 }
319 jit = MakeJit(page_table, new_address_space_size_in_bits); 308 jit = MakeJit(&page_table);
320 LoadContext(ctx); 309 LoadContext(ctx);
321 jit_cache.emplace(key, jit); 310 jit_cache.emplace(key, jit);
322} 311}
diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.h b/src/core/arm/dynarmic/arm_dynarmic_32.h
index f6c4d4db9..d40aef7a9 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_32.h
+++ b/src/core/arm/dynarmic/arm_dynarmic_32.h
@@ -68,8 +68,7 @@ public:
68 std::size_t new_address_space_size_in_bits) override; 68 std::size_t new_address_space_size_in_bits) override;
69 69
70private: 70private:
71 std::shared_ptr<Dynarmic::A32::Jit> MakeJit(Common::PageTable& page_table, 71 std::shared_ptr<Dynarmic::A32::Jit> MakeJit(Common::PageTable* page_table) const;
72 std::size_t address_space_bits) const;
73 72
74 using JitCacheKey = std::pair<Common::PageTable*, std::size_t>; 73 using JitCacheKey = std::pair<Common::PageTable*, std::size_t>;
75 using JitCacheType = 74 using JitCacheType =
@@ -80,10 +79,10 @@ private:
80 79
81 std::unique_ptr<DynarmicCallbacks32> cb; 80 std::unique_ptr<DynarmicCallbacks32> cb;
82 JitCacheType jit_cache; 81 JitCacheType jit_cache;
83 std::shared_ptr<Dynarmic::A32::Jit> jit;
84 std::shared_ptr<DynarmicCP15> cp15; 82 std::shared_ptr<DynarmicCP15> cp15;
85 std::size_t core_index; 83 std::size_t core_index;
86 DynarmicExclusiveMonitor& exclusive_monitor; 84 DynarmicExclusiveMonitor& exclusive_monitor;
85 std::shared_ptr<Dynarmic::A32::Jit> jit;
87}; 86};
88 87
89} // namespace Core 88} // namespace Core
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
index b36b7d918..e12e50658 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
@@ -142,7 +142,7 @@ public:
142 static constexpr u64 minimum_run_cycles = 1000U; 142 static constexpr u64 minimum_run_cycles = 1000U;
143}; 143};
144 144
145std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable& page_table, 145std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable* page_table,
146 std::size_t address_space_bits) const { 146 std::size_t address_space_bits) const {
147 Dynarmic::A64::UserConfig config; 147 Dynarmic::A64::UserConfig config;
148 148
@@ -150,13 +150,15 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable&
150 config.callbacks = cb.get(); 150 config.callbacks = cb.get();
151 151
152 // Memory 152 // Memory
153 config.page_table = reinterpret_cast<void**>(page_table.pointers.data()); 153 if (page_table) {
154 config.page_table_address_space_bits = address_space_bits; 154 config.page_table = reinterpret_cast<void**>(page_table->pointers.data());
155 config.page_table_pointer_mask_bits = Common::PageTable::ATTRIBUTE_BITS; 155 config.page_table_address_space_bits = address_space_bits;
156 config.silently_mirror_page_table = false; 156 config.page_table_pointer_mask_bits = Common::PageTable::ATTRIBUTE_BITS;
157 config.absolute_offset_page_table = true; 157 config.silently_mirror_page_table = false;
158 config.detect_misaligned_access_via_page_table = 16 | 32 | 64 | 128; 158 config.absolute_offset_page_table = true;
159 config.only_detect_misalignment_via_page_table_on_page_boundary = true; 159 config.detect_misaligned_access_via_page_table = 16 | 32 | 64 | 128;
160 config.only_detect_misalignment_via_page_table_on_page_boundary = true;
161 }
160 162
161 // Multi-process state 163 // Multi-process state
162 config.processor_id = core_index; 164 config.processor_id = core_index;
@@ -175,6 +177,10 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable&
175 // Timing 177 // Timing
176 config.wall_clock_cntpct = uses_wall_clock; 178 config.wall_clock_cntpct = uses_wall_clock;
177 179
180 // Code cache size
181 config.code_cache_size = 512 * 1024 * 1024;
182 config.far_code_offset = 256 * 1024 * 1024;
183
178 // Safe optimizations 184 // Safe optimizations
179 if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::DebugMode) { 185 if (Settings::values.cpu_accuracy == Settings::CPUAccuracy::DebugMode) {
180 if (!Settings::values.cpuopt_page_tables) { 186 if (!Settings::values.cpuopt_page_tables) {
@@ -237,7 +243,8 @@ ARM_Dynarmic_64::ARM_Dynarmic_64(System& system, CPUInterrupts& interrupt_handle
237 std::size_t core_index) 243 std::size_t core_index)
238 : ARM_Interface{system, interrupt_handlers, uses_wall_clock}, 244 : ARM_Interface{system, interrupt_handlers, uses_wall_clock},
239 cb(std::make_unique<DynarmicCallbacks64>(*this)), core_index{core_index}, 245 cb(std::make_unique<DynarmicCallbacks64>(*this)), core_index{core_index},
240 exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor)} {} 246 exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor)},
247 jit(MakeJit(nullptr, 48)) {}
241 248
242ARM_Dynarmic_64::~ARM_Dynarmic_64() = default; 249ARM_Dynarmic_64::~ARM_Dynarmic_64() = default;
243 250
@@ -294,9 +301,6 @@ void ARM_Dynarmic_64::ChangeProcessorID(std::size_t new_core_id) {
294} 301}
295 302
296void ARM_Dynarmic_64::SaveContext(ThreadContext64& ctx) { 303void ARM_Dynarmic_64::SaveContext(ThreadContext64& ctx) {
297 if (!jit) {
298 return;
299 }
300 ctx.cpu_registers = jit->GetRegisters(); 304 ctx.cpu_registers = jit->GetRegisters();
301 ctx.sp = jit->GetSP(); 305 ctx.sp = jit->GetSP();
302 ctx.pc = jit->GetPC(); 306 ctx.pc = jit->GetPC();
@@ -308,9 +312,6 @@ void ARM_Dynarmic_64::SaveContext(ThreadContext64& ctx) {
308} 312}
309 313
310void ARM_Dynarmic_64::LoadContext(const ThreadContext64& ctx) { 314void ARM_Dynarmic_64::LoadContext(const ThreadContext64& ctx) {
311 if (!jit) {
312 return;
313 }
314 jit->SetRegisters(ctx.cpu_registers); 315 jit->SetRegisters(ctx.cpu_registers);
315 jit->SetSP(ctx.sp); 316 jit->SetSP(ctx.sp);
316 jit->SetPC(ctx.pc); 317 jit->SetPC(ctx.pc);
@@ -326,23 +327,14 @@ void ARM_Dynarmic_64::PrepareReschedule() {
326} 327}
327 328
328void ARM_Dynarmic_64::ClearInstructionCache() { 329void ARM_Dynarmic_64::ClearInstructionCache() {
329 if (!jit) {
330 return;
331 }
332 jit->ClearCache(); 330 jit->ClearCache();
333} 331}
334 332
335void ARM_Dynarmic_64::InvalidateCacheRange(VAddr addr, std::size_t size) { 333void ARM_Dynarmic_64::InvalidateCacheRange(VAddr addr, std::size_t size) {
336 if (!jit) {
337 return;
338 }
339 jit->InvalidateCacheRange(addr, size); 334 jit->InvalidateCacheRange(addr, size);
340} 335}
341 336
342void ARM_Dynarmic_64::ClearExclusiveState() { 337void ARM_Dynarmic_64::ClearExclusiveState() {
343 if (!jit) {
344 return;
345 }
346 jit->ClearExclusiveState(); 338 jit->ClearExclusiveState();
347} 339}
348 340
@@ -358,7 +350,7 @@ void ARM_Dynarmic_64::PageTableChanged(Common::PageTable& page_table,
358 LoadContext(ctx); 350 LoadContext(ctx);
359 return; 351 return;
360 } 352 }
361 jit = MakeJit(page_table, new_address_space_size_in_bits); 353 jit = MakeJit(&page_table, new_address_space_size_in_bits);
362 LoadContext(ctx); 354 LoadContext(ctx);
363 jit_cache.emplace(key, jit); 355 jit_cache.emplace(key, jit);
364} 356}
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.h b/src/core/arm/dynarmic/arm_dynarmic_64.h
index 329b59a32..edef04376 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_64.h
+++ b/src/core/arm/dynarmic/arm_dynarmic_64.h
@@ -61,7 +61,7 @@ public:
61 std::size_t new_address_space_size_in_bits) override; 61 std::size_t new_address_space_size_in_bits) override;
62 62
63private: 63private:
64 std::shared_ptr<Dynarmic::A64::Jit> MakeJit(Common::PageTable& page_table, 64 std::shared_ptr<Dynarmic::A64::Jit> MakeJit(Common::PageTable* page_table,
65 std::size_t address_space_bits) const; 65 std::size_t address_space_bits) const;
66 66
67 using JitCacheKey = std::pair<Common::PageTable*, std::size_t>; 67 using JitCacheKey = std::pair<Common::PageTable*, std::size_t>;
@@ -71,10 +71,11 @@ private:
71 friend class DynarmicCallbacks64; 71 friend class DynarmicCallbacks64;
72 std::unique_ptr<DynarmicCallbacks64> cb; 72 std::unique_ptr<DynarmicCallbacks64> cb;
73 JitCacheType jit_cache; 73 JitCacheType jit_cache;
74 std::shared_ptr<Dynarmic::A64::Jit> jit;
75 74
76 std::size_t core_index; 75 std::size_t core_index;
77 DynarmicExclusiveMonitor& exclusive_monitor; 76 DynarmicExclusiveMonitor& exclusive_monitor;
77
78 std::shared_ptr<Dynarmic::A64::Jit> jit;
78}; 79};
79 80
80} // namespace Core 81} // namespace Core
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 305f56ff1..56b47e671 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -296,7 +296,7 @@ struct System::Impl {
296 exit_lock = false; 296 exit_lock = false;
297 297
298 if (gpu_core) { 298 if (gpu_core) {
299 gpu_core->WaitIdle(); 299 gpu_core->ShutDown();
300 } 300 }
301 301
302 services.reset(); 302 services.reset();
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 780008b08..a1520e147 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -68,9 +68,9 @@ struct KernelCore::Impl {
68 InitializePhysicalCores(); 68 InitializePhysicalCores();
69 InitializeSystemResourceLimit(kernel, system); 69 InitializeSystemResourceLimit(kernel, system);
70 InitializeMemoryLayout(); 70 InitializeMemoryLayout();
71 InitializePreemption(kernel);
72 InitializeSchedulers(); 71 InitializeSchedulers();
73 InitializeSuspendThreads(); 72 InitializeSuspendThreads();
73 InitializePreemption(kernel);
74 } 74 }
75 75
76 void InitializeCores() { 76 void InitializeCores() {
@@ -143,10 +143,10 @@ struct KernelCore::Impl {
143 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::PhysicalMemory, 0x100000000) 143 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::PhysicalMemory, 0x100000000)
144 .IsSuccess()); 144 .IsSuccess());
145 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Threads, 800).IsSuccess()); 145 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Threads, 800).IsSuccess());
146 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Events, 700).IsSuccess()); 146 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Events, 900).IsSuccess());
147 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::TransferMemory, 200) 147 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::TransferMemory, 200)
148 .IsSuccess()); 148 .IsSuccess());
149 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Sessions, 933).IsSuccess()); 149 ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Sessions, 1133).IsSuccess());
150 150
151 // Derived from recent software updates. The kernel reserves 27MB 151 // Derived from recent software updates. The kernel reserves 27MB
152 constexpr u64 kernel_size{0x1b00000}; 152 constexpr u64 kernel_size{0x1b00000};
diff --git a/src/core/hle/kernel/process_capability.cpp b/src/core/hle/kernel/process_capability.cpp
index 3fc326eab..1006ee50c 100644
--- a/src/core/hle/kernel/process_capability.cpp
+++ b/src/core/hle/kernel/process_capability.cpp
@@ -281,11 +281,6 @@ ResultCode ProcessCapabilities::HandleSyscallFlags(u32& set_svc_bits, u32 flags)
281 continue; 281 continue;
282 } 282 }
283 283
284 if (svc_number >= svc_capabilities.size()) {
285 LOG_ERROR(Kernel, "Process svc capability is out of range! svc_number={}", svc_number);
286 return ResultOutOfRange;
287 }
288
289 svc_capabilities[svc_number] = true; 284 svc_capabilities[svc_number] = true;
290 } 285 }
291 286
diff --git a/src/core/hle/kernel/process_capability.h b/src/core/hle/kernel/process_capability.h
index 73ad197fa..b7a9b2e45 100644
--- a/src/core/hle/kernel/process_capability.h
+++ b/src/core/hle/kernel/process_capability.h
@@ -68,7 +68,7 @@ enum class ProgramType {
68class ProcessCapabilities { 68class ProcessCapabilities {
69public: 69public:
70 using InterruptCapabilities = std::bitset<1024>; 70 using InterruptCapabilities = std::bitset<1024>;
71 using SyscallCapabilities = std::bitset<128>; 71 using SyscallCapabilities = std::bitset<192>;
72 72
73 ProcessCapabilities() = default; 73 ProcessCapabilities() = default;
74 ProcessCapabilities(const ProcessCapabilities&) = delete; 74 ProcessCapabilities(const ProcessCapabilities&) = delete;
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 326d3b9ec..fcffc746d 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -2455,6 +2455,74 @@ static const FunctionDef SVC_Table_32[] = {
2455 {0x79, nullptr, "Unknown"}, 2455 {0x79, nullptr, "Unknown"},
2456 {0x7A, nullptr, "Unknown"}, 2456 {0x7A, nullptr, "Unknown"},
2457 {0x7B, nullptr, "TerminateProcess32"}, 2457 {0x7B, nullptr, "TerminateProcess32"},
2458 {0x7C, nullptr, "GetProcessInfo32"},
2459 {0x7D, nullptr, "CreateResourceLimit32"},
2460 {0x7E, nullptr, "SetResourceLimitLimitValue32"},
2461 {0x7F, nullptr, "CallSecureMonitor32"},
2462 {0x80, nullptr, "Unknown"},
2463 {0x81, nullptr, "Unknown"},
2464 {0x82, nullptr, "Unknown"},
2465 {0x83, nullptr, "Unknown"},
2466 {0x84, nullptr, "Unknown"},
2467 {0x85, nullptr, "Unknown"},
2468 {0x86, nullptr, "Unknown"},
2469 {0x87, nullptr, "Unknown"},
2470 {0x88, nullptr, "Unknown"},
2471 {0x89, nullptr, "Unknown"},
2472 {0x8A, nullptr, "Unknown"},
2473 {0x8B, nullptr, "Unknown"},
2474 {0x8C, nullptr, "Unknown"},
2475 {0x8D, nullptr, "Unknown"},
2476 {0x8E, nullptr, "Unknown"},
2477 {0x8F, nullptr, "Unknown"},
2478 {0x90, nullptr, "Unknown"},
2479 {0x91, nullptr, "Unknown"},
2480 {0x92, nullptr, "Unknown"},
2481 {0x93, nullptr, "Unknown"},
2482 {0x94, nullptr, "Unknown"},
2483 {0x95, nullptr, "Unknown"},
2484 {0x96, nullptr, "Unknown"},
2485 {0x97, nullptr, "Unknown"},
2486 {0x98, nullptr, "Unknown"},
2487 {0x99, nullptr, "Unknown"},
2488 {0x9A, nullptr, "Unknown"},
2489 {0x9B, nullptr, "Unknown"},
2490 {0x9C, nullptr, "Unknown"},
2491 {0x9D, nullptr, "Unknown"},
2492 {0x9E, nullptr, "Unknown"},
2493 {0x9F, nullptr, "Unknown"},
2494 {0xA0, nullptr, "Unknown"},
2495 {0xA1, nullptr, "Unknown"},
2496 {0xA2, nullptr, "Unknown"},
2497 {0xA3, nullptr, "Unknown"},
2498 {0xA4, nullptr, "Unknown"},
2499 {0xA5, nullptr, "Unknown"},
2500 {0xA6, nullptr, "Unknown"},
2501 {0xA7, nullptr, "Unknown"},
2502 {0xA8, nullptr, "Unknown"},
2503 {0xA9, nullptr, "Unknown"},
2504 {0xAA, nullptr, "Unknown"},
2505 {0xAB, nullptr, "Unknown"},
2506 {0xAC, nullptr, "Unknown"},
2507 {0xAD, nullptr, "Unknown"},
2508 {0xAE, nullptr, "Unknown"},
2509 {0xAF, nullptr, "Unknown"},
2510 {0xB0, nullptr, "Unknown"},
2511 {0xB1, nullptr, "Unknown"},
2512 {0xB2, nullptr, "Unknown"},
2513 {0xB3, nullptr, "Unknown"},
2514 {0xB4, nullptr, "Unknown"},
2515 {0xB5, nullptr, "Unknown"},
2516 {0xB6, nullptr, "Unknown"},
2517 {0xB7, nullptr, "Unknown"},
2518 {0xB8, nullptr, "Unknown"},
2519 {0xB9, nullptr, "Unknown"},
2520 {0xBA, nullptr, "Unknown"},
2521 {0xBB, nullptr, "Unknown"},
2522 {0xBC, nullptr, "Unknown"},
2523 {0xBD, nullptr, "Unknown"},
2524 {0xBE, nullptr, "Unknown"},
2525 {0xBF, nullptr, "Unknown"},
2458}; 2526};
2459 2527
2460static const FunctionDef SVC_Table_64[] = { 2528static const FunctionDef SVC_Table_64[] = {
@@ -2586,6 +2654,70 @@ static const FunctionDef SVC_Table_64[] = {
2586 {0x7D, SvcWrap64<CreateResourceLimit>, "CreateResourceLimit"}, 2654 {0x7D, SvcWrap64<CreateResourceLimit>, "CreateResourceLimit"},
2587 {0x7E, SvcWrap64<SetResourceLimitLimitValue>, "SetResourceLimitLimitValue"}, 2655 {0x7E, SvcWrap64<SetResourceLimitLimitValue>, "SetResourceLimitLimitValue"},
2588 {0x7F, nullptr, "CallSecureMonitor"}, 2656 {0x7F, nullptr, "CallSecureMonitor"},
2657 {0x80, nullptr, "Unknown"},
2658 {0x81, nullptr, "Unknown"},
2659 {0x82, nullptr, "Unknown"},
2660 {0x83, nullptr, "Unknown"},
2661 {0x84, nullptr, "Unknown"},
2662 {0x85, nullptr, "Unknown"},
2663 {0x86, nullptr, "Unknown"},
2664 {0x87, nullptr, "Unknown"},
2665 {0x88, nullptr, "Unknown"},
2666 {0x89, nullptr, "Unknown"},
2667 {0x8A, nullptr, "Unknown"},
2668 {0x8B, nullptr, "Unknown"},
2669 {0x8C, nullptr, "Unknown"},
2670 {0x8D, nullptr, "Unknown"},
2671 {0x8E, nullptr, "Unknown"},
2672 {0x8F, nullptr, "Unknown"},
2673 {0x90, nullptr, "Unknown"},
2674 {0x91, nullptr, "Unknown"},
2675 {0x92, nullptr, "Unknown"},
2676 {0x93, nullptr, "Unknown"},
2677 {0x94, nullptr, "Unknown"},
2678 {0x95, nullptr, "Unknown"},
2679 {0x96, nullptr, "Unknown"},
2680 {0x97, nullptr, "Unknown"},
2681 {0x98, nullptr, "Unknown"},
2682 {0x99, nullptr, "Unknown"},
2683 {0x9A, nullptr, "Unknown"},
2684 {0x9B, nullptr, "Unknown"},
2685 {0x9C, nullptr, "Unknown"},
2686 {0x9D, nullptr, "Unknown"},
2687 {0x9E, nullptr, "Unknown"},
2688 {0x9F, nullptr, "Unknown"},
2689 {0xA0, nullptr, "Unknown"},
2690 {0xA1, nullptr, "Unknown"},
2691 {0xA2, nullptr, "Unknown"},
2692 {0xA3, nullptr, "Unknown"},
2693 {0xA4, nullptr, "Unknown"},
2694 {0xA5, nullptr, "Unknown"},
2695 {0xA6, nullptr, "Unknown"},
2696 {0xA7, nullptr, "Unknown"},
2697 {0xA8, nullptr, "Unknown"},
2698 {0xA9, nullptr, "Unknown"},
2699 {0xAA, nullptr, "Unknown"},
2700 {0xAB, nullptr, "Unknown"},
2701 {0xAC, nullptr, "Unknown"},
2702 {0xAD, nullptr, "Unknown"},
2703 {0xAE, nullptr, "Unknown"},
2704 {0xAF, nullptr, "Unknown"},
2705 {0xB0, nullptr, "Unknown"},
2706 {0xB1, nullptr, "Unknown"},
2707 {0xB2, nullptr, "Unknown"},
2708 {0xB3, nullptr, "Unknown"},
2709 {0xB4, nullptr, "Unknown"},
2710 {0xB5, nullptr, "Unknown"},
2711 {0xB6, nullptr, "Unknown"},
2712 {0xB7, nullptr, "Unknown"},
2713 {0xB8, nullptr, "Unknown"},
2714 {0xB9, nullptr, "Unknown"},
2715 {0xBA, nullptr, "Unknown"},
2716 {0xBB, nullptr, "Unknown"},
2717 {0xBC, nullptr, "Unknown"},
2718 {0xBD, nullptr, "Unknown"},
2719 {0xBE, nullptr, "Unknown"},
2720 {0xBF, nullptr, "Unknown"},
2589}; 2721};
2590 2722
2591static const FunctionDef* GetSVCInfo32(u32 func_num) { 2723static const FunctionDef* GetSVCInfo32(u32 func_num) {
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index 615e20a54..52535ecc0 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -610,12 +610,17 @@ public:
610 explicit DAUTH_O(Core::System& system_, Common::UUID) : ServiceFramework{system_, "dauth:o"} { 610 explicit DAUTH_O(Core::System& system_, Common::UUID) : ServiceFramework{system_, "dauth:o"} {
611 // clang-format off 611 // clang-format off
612 static const FunctionInfo functions[] = { 612 static const FunctionInfo functions[] = {
613 {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, // [5.0.0-5.1.0] GeneratePostData 613 {0, nullptr, "EnsureAuthenticationTokenCacheAsync"},
614 {1, nullptr, "LoadAuthenticationTokenCache"}, // 6.0.0+ 614 {1, nullptr, "LoadAuthenticationTokenCache"},
615 {2, nullptr, "InvalidateAuthenticationTokenCache"}, // 6.0.0+ 615 {2, nullptr, "InvalidateAuthenticationTokenCache"},
616 {10, nullptr, "EnsureEdgeTokenCacheAsync"}, // 6.0.0+ 616 {10, nullptr, "EnsureEdgeTokenCacheAsync"},
617 {11, nullptr, "LoadEdgeTokenCache"}, // 6.0.0+ 617 {11, nullptr, "LoadEdgeTokenCache"},
618 {12, nullptr, "InvalidateEdgeTokenCache"}, // 6.0.0+ 618 {12, nullptr, "InvalidateEdgeTokenCache"},
619 {20, nullptr, "EnsureApplicationAuthenticationCacheAsync"},
620 {21, nullptr, "LoadApplicationAuthenticationTokenCache"},
621 {22, nullptr, "LoadApplicationNetworkServiceClientConfigCache"},
622 {23, nullptr, "IsApplicationAuthenticationCacheAvailable"},
623 {24, nullptr, "InvalidateApplicationAuthenticationCache"},
619 }; 624 };
620 // clang-format on 625 // clang-format on
621 626
diff --git a/src/core/hle/service/acc/acc_su.cpp b/src/core/hle/service/acc/acc_su.cpp
index 49b22583e..bb6118abf 100644
--- a/src/core/hle/service/acc/acc_su.cpp
+++ b/src/core/hle/service/acc/acc_su.cpp
@@ -17,28 +17,30 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
17 {3, &ACC_SU::ListOpenUsers, "ListOpenUsers"}, 17 {3, &ACC_SU::ListOpenUsers, "ListOpenUsers"},
18 {4, &ACC_SU::GetLastOpenedUser, "GetLastOpenedUser"}, 18 {4, &ACC_SU::GetLastOpenedUser, "GetLastOpenedUser"},
19 {5, &ACC_SU::GetProfile, "GetProfile"}, 19 {5, &ACC_SU::GetProfile, "GetProfile"},
20 {6, nullptr, "GetProfileDigest"}, // 3.0.0+ 20 {6, nullptr, "GetProfileDigest"},
21 {50, &ACC_SU::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, 21 {50, &ACC_SU::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"},
22 {51, &ACC_SU::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, 22 {51, &ACC_SU::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"},
23 {60, &ACC_SU::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 23 {60, &ACC_SU::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"},
24 {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+ 24 {99, nullptr, "DebugActivateOpenContextRetention"},
25 {100, nullptr, "GetUserRegistrationNotifier"}, 25 {100, nullptr, "GetUserRegistrationNotifier"},
26 {101, nullptr, "GetUserStateChangeNotifier"}, 26 {101, nullptr, "GetUserStateChangeNotifier"},
27 {102, nullptr, "GetBaasAccountManagerForSystemService"}, 27 {102, nullptr, "GetBaasAccountManagerForSystemService"},
28 {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, 28 {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"},
29 {104, nullptr, "GetProfileUpdateNotifier"}, 29 {104, nullptr, "GetProfileUpdateNotifier"},
30 {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+ 30 {105, nullptr, "CheckNetworkServiceAvailabilityAsync"},
31 {106, nullptr, "GetProfileSyncNotifier"}, // 9.0.0+ 31 {106, nullptr, "GetProfileSyncNotifier"},
32 {110, &ACC_SU::StoreSaveDataThumbnailSystem, "StoreSaveDataThumbnail"}, 32 {110, &ACC_SU::StoreSaveDataThumbnailSystem, "StoreSaveDataThumbnail"},
33 {111, nullptr, "ClearSaveDataThumbnail"}, 33 {111, nullptr, "ClearSaveDataThumbnail"},
34 {112, nullptr, "LoadSaveDataThumbnail"}, 34 {112, nullptr, "LoadSaveDataThumbnail"},
35 {113, nullptr, "GetSaveDataThumbnailExistence"}, // 5.0.0+ 35 {113, nullptr, "GetSaveDataThumbnailExistence"},
36 {120, nullptr, "ListOpenUsersInApplication"}, // 10.0.0+ 36 {120, nullptr, "ListOpenUsersInApplication"},
37 {130, nullptr, "ActivateOpenContextRetention"}, // 6.0.0+ 37 {130, nullptr, "ActivateOpenContextRetention"},
38 {140, &ACC_SU::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+ 38 {140, &ACC_SU::ListQualifiedUsers, "ListQualifiedUsers"},
39 {150, nullptr, "AuthenticateApplicationAsync"}, // 10.0.0+ 39 {150, nullptr, "AuthenticateApplicationAsync"},
40 {190, nullptr, "GetUserLastOpenedApplication"}, // 1.0.0 - 9.2.0 40 {151, nullptr, "Unknown151"},
41 {191, nullptr, "ActivateOpenContextHolder"}, // 7.0.0+ 41 {152, nullptr, "Unknown152"},
42 {190, nullptr, "GetUserLastOpenedApplication"},
43 {191, nullptr, "ActivateOpenContextHolder"},
42 {200, nullptr, "BeginUserRegistration"}, 44 {200, nullptr, "BeginUserRegistration"},
43 {201, nullptr, "CompleteUserRegistration"}, 45 {201, nullptr, "CompleteUserRegistration"},
44 {202, nullptr, "CancelUserRegistration"}, 46 {202, nullptr, "CancelUserRegistration"},
@@ -46,15 +48,15 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
46 {204, nullptr, "SetUserPosition"}, 48 {204, nullptr, "SetUserPosition"},
47 {205, &ACC_SU::GetProfileEditor, "GetProfileEditor"}, 49 {205, &ACC_SU::GetProfileEditor, "GetProfileEditor"},
48 {206, nullptr, "CompleteUserRegistrationForcibly"}, 50 {206, nullptr, "CompleteUserRegistrationForcibly"},
49 {210, nullptr, "CreateFloatingRegistrationRequest"}, // 3.0.0+ 51 {210, nullptr, "CreateFloatingRegistrationRequest"},
50 {211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"}, // 8.0.0+ 52 {211, nullptr, "CreateProcedureToRegisterUserWithNintendoAccount"},
51 {212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"}, // 8.0.0+ 53 {212, nullptr, "ResumeProcedureToRegisterUserWithNintendoAccount"},
52 {230, nullptr, "AuthenticateServiceAsync"}, 54 {230, nullptr, "AuthenticateServiceAsync"},
53 {250, nullptr, "GetBaasAccountAdministrator"}, 55 {250, nullptr, "GetBaasAccountAdministrator"},
54 {290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"}, 56 {290, nullptr, "ProxyProcedureForGuestLoginWithNintendoAccount"},
55 {291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"}, // 3.0.0+ 57 {291, nullptr, "ProxyProcedureForFloatingRegistrationWithNintendoAccount"},
56 {299, nullptr, "SuspendBackgroundDaemon"}, 58 {299, nullptr, "SuspendBackgroundDaemon"},
57 {997, nullptr, "DebugInvalidateTokenCacheForUser"}, // 3.0.0+ 59 {997, nullptr, "DebugInvalidateTokenCacheForUser"},
58 {998, nullptr, "DebugSetUserStateClose"}, 60 {998, nullptr, "DebugSetUserStateClose"},
59 {999, nullptr, "DebugSetUserStateOpen"}, 61 {999, nullptr, "DebugSetUserStateOpen"},
60 }; 62 };
diff --git a/src/core/hle/service/acc/acc_u1.cpp b/src/core/hle/service/acc/acc_u1.cpp
index 951081cd0..71982ad5a 100644
--- a/src/core/hle/service/acc/acc_u1.cpp
+++ b/src/core/hle/service/acc/acc_u1.cpp
@@ -17,29 +17,31 @@ ACC_U1::ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
17 {3, &ACC_U1::ListOpenUsers, "ListOpenUsers"}, 17 {3, &ACC_U1::ListOpenUsers, "ListOpenUsers"},
18 {4, &ACC_U1::GetLastOpenedUser, "GetLastOpenedUser"}, 18 {4, &ACC_U1::GetLastOpenedUser, "GetLastOpenedUser"},
19 {5, &ACC_U1::GetProfile, "GetProfile"}, 19 {5, &ACC_U1::GetProfile, "GetProfile"},
20 {6, nullptr, "GetProfileDigest"}, // 3.0.0+ 20 {6, nullptr, "GetProfileDigest"},
21 {50, &ACC_U1::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"}, 21 {50, &ACC_U1::IsUserRegistrationRequestPermitted, "IsUserRegistrationRequestPermitted"},
22 {51, &ACC_U1::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, 22 {51, &ACC_U1::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"},
23 {60, &ACC_U1::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"}, // 5.0.0 - 5.1.0 23 {60, &ACC_U1::ListOpenContextStoredUsers, "ListOpenContextStoredUsers"},
24 {99, nullptr, "DebugActivateOpenContextRetention"}, // 6.0.0+ 24 {99, nullptr, "DebugActivateOpenContextRetention"},
25 {100, nullptr, "GetUserRegistrationNotifier"}, 25 {100, nullptr, "GetUserRegistrationNotifier"},
26 {101, nullptr, "GetUserStateChangeNotifier"}, 26 {101, nullptr, "GetUserStateChangeNotifier"},
27 {102, nullptr, "GetBaasAccountManagerForSystemService"}, 27 {102, nullptr, "GetBaasAccountManagerForSystemService"},
28 {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"}, 28 {103, nullptr, "GetBaasUserAvailabilityChangeNotifier"},
29 {104, nullptr, "GetProfileUpdateNotifier"}, 29 {104, nullptr, "GetProfileUpdateNotifier"},
30 {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+ 30 {105, nullptr, "CheckNetworkServiceAvailabilityAsync"},
31 {106, nullptr, "GetProfileSyncNotifier"}, // 9.0.0+ 31 {106, nullptr, "GetProfileSyncNotifier"},
32 {110, &ACC_U1::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"}, 32 {110, &ACC_U1::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"},
33 {111, nullptr, "ClearSaveDataThumbnail"}, 33 {111, nullptr, "ClearSaveDataThumbnail"},
34 {112, nullptr, "LoadSaveDataThumbnail"}, 34 {112, nullptr, "LoadSaveDataThumbnail"},
35 {113, nullptr, "GetSaveDataThumbnailExistence"}, // 5.0.0+ 35 {113, nullptr, "GetSaveDataThumbnailExistence"},
36 {120, nullptr, "ListOpenUsersInApplication"}, // 10.0.0+ 36 {120, nullptr, "ListOpenUsersInApplication"},
37 {130, nullptr, "ActivateOpenContextRetention"}, // 6.0.0+ 37 {130, nullptr, "ActivateOpenContextRetention"},
38 {140, &ACC_U1::ListQualifiedUsers, "ListQualifiedUsers"}, // 6.0.0+ 38 {140, &ACC_U1::ListQualifiedUsers, "ListQualifiedUsers"},
39 {150, nullptr, "AuthenticateApplicationAsync"}, // 10.0.0+ 39 {150, nullptr, "AuthenticateApplicationAsync"},
40 {190, nullptr, "GetUserLastOpenedApplication"}, // 1.0.0 - 9.2.0 40 {151, nullptr, "Unknown151"},
41 {191, nullptr, "ActivateOpenContextHolder"}, // 7.0.0+ 41 {152, nullptr, "Unknown152"},
42 {997, nullptr, "DebugInvalidateTokenCacheForUser"}, // 3.0.0+ 42 {190, nullptr, "GetUserLastOpenedApplication"},
43 {191, nullptr, "ActivateOpenContextHolder"},
44 {997, nullptr, "DebugInvalidateTokenCacheForUser"},
43 {998, nullptr, "DebugSetUserStateClose"}, 45 {998, nullptr, "DebugSetUserStateClose"},
44 {999, nullptr, "DebugSetUserStateOpen"}, 46 {999, nullptr, "DebugSetUserStateOpen"},
45 }; 47 };
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 8e1fe9438..4374487a3 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -231,6 +231,7 @@ IDebugFunctions::IDebugFunctions(Core::System& system_)
231 {10, nullptr, "PerformSystemButtonPressing"}, 231 {10, nullptr, "PerformSystemButtonPressing"},
232 {20, nullptr, "InvalidateTransitionLayer"}, 232 {20, nullptr, "InvalidateTransitionLayer"},
233 {30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"}, 233 {30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"},
234 {31, nullptr, "RequestLaunchApplicationByApplicationLaunchInfoForDebug"},
234 {40, nullptr, "GetAppletResourceUsageInfo"}, 235 {40, nullptr, "GetAppletResourceUsageInfo"},
235 {100, nullptr, "SetCpuBoostModeForApplet"}, 236 {100, nullptr, "SetCpuBoostModeForApplet"},
236 {101, nullptr, "CancelCpuBoostModeForApplet"}, 237 {101, nullptr, "CancelCpuBoostModeForApplet"},
@@ -242,6 +243,7 @@ IDebugFunctions::IDebugFunctions(Core::System& system_)
242 {130, nullptr, "FriendInvitationSetApplicationParameter"}, 243 {130, nullptr, "FriendInvitationSetApplicationParameter"},
243 {131, nullptr, "FriendInvitationClearApplicationParameter"}, 244 {131, nullptr, "FriendInvitationClearApplicationParameter"},
244 {132, nullptr, "FriendInvitationPushApplicationParameter"}, 245 {132, nullptr, "FriendInvitationPushApplicationParameter"},
246 {900, nullptr, "GetGrcProcessLaunchedSystemEvent"},
245 }; 247 };
246 // clang-format on 248 // clang-format on
247 249
@@ -295,8 +297,9 @@ ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nv
295 {80, nullptr, "SetWirelessPriorityMode"}, 297 {80, nullptr, "SetWirelessPriorityMode"},
296 {90, &ISelfController::GetAccumulatedSuspendedTickValue, "GetAccumulatedSuspendedTickValue"}, 298 {90, &ISelfController::GetAccumulatedSuspendedTickValue, "GetAccumulatedSuspendedTickValue"},
297 {91, &ISelfController::GetAccumulatedSuspendedTickChangedEvent, "GetAccumulatedSuspendedTickChangedEvent"}, 299 {91, &ISelfController::GetAccumulatedSuspendedTickChangedEvent, "GetAccumulatedSuspendedTickChangedEvent"},
298 {100, nullptr, "SetAlbumImageTakenNotificationEnabled"}, 300 {100, &ISelfController::SetAlbumImageTakenNotificationEnabled, "SetAlbumImageTakenNotificationEnabled"},
299 {110, nullptr, "SetApplicationAlbumUserData"}, 301 {110, nullptr, "SetApplicationAlbumUserData"},
302 {120, nullptr, "SaveCurrentScreenshot"},
300 {1000, nullptr, "GetDebugStorageChannel"}, 303 {1000, nullptr, "GetDebugStorageChannel"},
301 }; 304 };
302 // clang-format on 305 // clang-format on
@@ -560,6 +563,21 @@ void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequest
560 rb.PushCopyObjects(accumulated_suspended_tick_changed_event->GetReadableEvent()); 563 rb.PushCopyObjects(accumulated_suspended_tick_changed_event->GetReadableEvent());
561} 564}
562 565
566void ISelfController::SetAlbumImageTakenNotificationEnabled(Kernel::HLERequestContext& ctx) {
567 IPC::RequestParser rp{ctx};
568
569 // This service call sets an internal flag whether a notification is shown when an image is
570 // captured. Currently we do not support capturing images via the capture button, so this can be
571 // stubbed for now.
572 const bool album_image_taken_notification_enabled = rp.Pop<bool>();
573
574 LOG_WARNING(Service_AM, "(STUBBED) called. album_image_taken_notification_enabled={}",
575 album_image_taken_notification_enabled);
576
577 IPC::ResponseBuilder rb{ctx, 2};
578 rb.Push(RESULT_SUCCESS);
579}
580
563AppletMessageQueue::AppletMessageQueue(Kernel::KernelCore& kernel) { 581AppletMessageQueue::AppletMessageQueue(Kernel::KernelCore& kernel) {
564 on_new_message = Kernel::KEvent::Create(kernel, "AMMessageQueue:OnMessageReceived"); 582 on_new_message = Kernel::KEvent::Create(kernel, "AMMessageQueue:OnMessageReceived");
565 on_new_message->Initialize(); 583 on_new_message->Initialize();
@@ -630,6 +648,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_,
630 {11, nullptr, "ReleaseSleepLock"}, 648 {11, nullptr, "ReleaseSleepLock"},
631 {12, nullptr, "ReleaseSleepLockTransiently"}, 649 {12, nullptr, "ReleaseSleepLockTransiently"},
632 {13, nullptr, "GetAcquiredSleepLockEvent"}, 650 {13, nullptr, "GetAcquiredSleepLockEvent"},
651 {14, nullptr, "GetWakeupCount"},
633 {20, nullptr, "PushToGeneralChannel"}, 652 {20, nullptr, "PushToGeneralChannel"},
634 {30, nullptr, "GetHomeButtonReaderLockAccessor"}, 653 {30, nullptr, "GetHomeButtonReaderLockAccessor"},
635 {31, nullptr, "GetReaderLockAccessorEx"}, 654 {31, nullptr, "GetReaderLockAccessorEx"},
@@ -641,6 +660,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_,
641 {53, &ICommonStateGetter::BeginVrModeEx, "BeginVrModeEx"}, 660 {53, &ICommonStateGetter::BeginVrModeEx, "BeginVrModeEx"},
642 {54, &ICommonStateGetter::EndVrModeEx, "EndVrModeEx"}, 661 {54, &ICommonStateGetter::EndVrModeEx, "EndVrModeEx"},
643 {55, nullptr, "IsInControllerFirmwareUpdateSection"}, 662 {55, nullptr, "IsInControllerFirmwareUpdateSection"},
663 {59, nullptr, "SetVrPositionForDebug"},
644 {60, &ICommonStateGetter::GetDefaultDisplayResolution, "GetDefaultDisplayResolution"}, 664 {60, &ICommonStateGetter::GetDefaultDisplayResolution, "GetDefaultDisplayResolution"},
645 {61, &ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent, "GetDefaultDisplayResolutionChangeEvent"}, 665 {61, &ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent, "GetDefaultDisplayResolutionChangeEvent"},
646 {62, nullptr, "GetHdcpAuthenticationState"}, 666 {62, nullptr, "GetHdcpAuthenticationState"},
@@ -649,14 +669,21 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_,
649 {65, nullptr, "GetApplicationIdByContentActionName"}, 669 {65, nullptr, "GetApplicationIdByContentActionName"},
650 {66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"}, 670 {66, &ICommonStateGetter::SetCpuBoostMode, "SetCpuBoostMode"},
651 {67, nullptr, "CancelCpuBoostMode"}, 671 {67, nullptr, "CancelCpuBoostMode"},
672 {68, nullptr, "GetBuiltInDisplayType"},
652 {80, nullptr, "PerformSystemButtonPressingIfInFocus"}, 673 {80, nullptr, "PerformSystemButtonPressingIfInFocus"},
653 {90, nullptr, "SetPerformanceConfigurationChangedNotification"}, 674 {90, nullptr, "SetPerformanceConfigurationChangedNotification"},
654 {91, nullptr, "GetCurrentPerformanceConfiguration"}, 675 {91, nullptr, "GetCurrentPerformanceConfiguration"},
655 {100, nullptr, "SetHandlingHomeButtonShortPressedEnabled"}, 676 {100, nullptr, "SetHandlingHomeButtonShortPressedEnabled"},
677 {110, nullptr, "OpenMyGpuErrorHandler"},
656 {200, nullptr, "GetOperationModeSystemInfo"}, 678 {200, nullptr, "GetOperationModeSystemInfo"},
657 {300, nullptr, "GetSettingsPlatformRegion"}, 679 {300, nullptr, "GetSettingsPlatformRegion"},
658 {400, nullptr, "ActivateMigrationService"}, 680 {400, nullptr, "ActivateMigrationService"},
659 {401, nullptr, "DeactivateMigrationService"}, 681 {401, nullptr, "DeactivateMigrationService"},
682 {500, nullptr, "DisableSleepTillShutdown"},
683 {501, nullptr, "SuppressDisablingSleepTemporarily"},
684 {502, nullptr, "IsSleepEnabled"},
685 {503, nullptr, "IsDisablingSleepSuppressed"},
686 {900, nullptr, "SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled"},
660 }; 687 };
661 // clang-format on 688 // clang-format on
662 689
@@ -1188,11 +1215,14 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_)
1188 {25, &IApplicationFunctions::ExtendSaveData, "ExtendSaveData"}, 1215 {25, &IApplicationFunctions::ExtendSaveData, "ExtendSaveData"},
1189 {26, &IApplicationFunctions::GetSaveDataSize, "GetSaveDataSize"}, 1216 {26, &IApplicationFunctions::GetSaveDataSize, "GetSaveDataSize"},
1190 {27, nullptr, "CreateCacheStorage"}, 1217 {27, nullptr, "CreateCacheStorage"},
1218 {28, nullptr, "GetSaveDataSizeMax"},
1219 {29, nullptr, "GetCacheStorageMax"},
1191 {30, &IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed, "BeginBlockingHomeButtonShortAndLongPressed"}, 1220 {30, &IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed, "BeginBlockingHomeButtonShortAndLongPressed"},
1192 {31, &IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed, "EndBlockingHomeButtonShortAndLongPressed"}, 1221 {31, &IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed, "EndBlockingHomeButtonShortAndLongPressed"},
1193 {32, &IApplicationFunctions::BeginBlockingHomeButton, "BeginBlockingHomeButton"}, 1222 {32, &IApplicationFunctions::BeginBlockingHomeButton, "BeginBlockingHomeButton"},
1194 {33, &IApplicationFunctions::EndBlockingHomeButton, "EndBlockingHomeButton"}, 1223 {33, &IApplicationFunctions::EndBlockingHomeButton, "EndBlockingHomeButton"},
1195 {34, nullptr, "SelectApplicationLicense"}, 1224 {34, nullptr, "SelectApplicationLicense"},
1225 {35, nullptr, "GetDeviceSaveDataSizeMax"},
1196 {40, &IApplicationFunctions::NotifyRunning, "NotifyRunning"}, 1226 {40, &IApplicationFunctions::NotifyRunning, "NotifyRunning"},
1197 {50, &IApplicationFunctions::GetPseudoDeviceId, "GetPseudoDeviceId"}, 1227 {50, &IApplicationFunctions::GetPseudoDeviceId, "GetPseudoDeviceId"},
1198 {60, nullptr, "SetMediaPlaybackStateForApplication"}, 1228 {60, nullptr, "SetMediaPlaybackStateForApplication"},
@@ -1216,6 +1246,7 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_)
1216 {123, &IApplicationFunctions::GetPreviousProgramIndex, "GetPreviousProgramIndex"}, 1246 {123, &IApplicationFunctions::GetPreviousProgramIndex, "GetPreviousProgramIndex"},
1217 {124, nullptr, "EnableApplicationAllThreadDumpOnCrash"}, 1247 {124, nullptr, "EnableApplicationAllThreadDumpOnCrash"},
1218 {130, &IApplicationFunctions::GetGpuErrorDetectedSystemEvent, "GetGpuErrorDetectedSystemEvent"}, 1248 {130, &IApplicationFunctions::GetGpuErrorDetectedSystemEvent, "GetGpuErrorDetectedSystemEvent"},
1249 {131, nullptr, "SetDelayTimeToAbortOnGpuError"},
1219 {140, &IApplicationFunctions::GetFriendInvitationStorageChannelEvent, "GetFriendInvitationStorageChannelEvent"}, 1250 {140, &IApplicationFunctions::GetFriendInvitationStorageChannelEvent, "GetFriendInvitationStorageChannelEvent"},
1220 {141, &IApplicationFunctions::TryPopFromFriendInvitationStorageChannel, "TryPopFromFriendInvitationStorageChannel"}, 1251 {141, &IApplicationFunctions::TryPopFromFriendInvitationStorageChannel, "TryPopFromFriendInvitationStorageChannel"},
1221 {150, nullptr, "GetNotificationStorageChannelEvent"}, 1252 {150, nullptr, "GetNotificationStorageChannelEvent"},
@@ -1224,6 +1255,8 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_)
1224 {170, nullptr, "SetHdcpAuthenticationActivated"}, 1255 {170, nullptr, "SetHdcpAuthenticationActivated"},
1225 {180, nullptr, "GetLaunchRequiredVersion"}, 1256 {180, nullptr, "GetLaunchRequiredVersion"},
1226 {181, nullptr, "UpgradeLaunchRequiredVersion"}, 1257 {181, nullptr, "UpgradeLaunchRequiredVersion"},
1258 {190, nullptr, "SendServerMaintenanceOverlayNotification"},
1259 {200, nullptr, "GetLastApplicationExitReason"},
1227 {500, nullptr, "StartContinuousRecordingFlushForDebug"}, 1260 {500, nullptr, "StartContinuousRecordingFlushForDebug"},
1228 {1000, nullptr, "CreateMovieMaker"}, 1261 {1000, nullptr, "CreateMovieMaker"},
1229 {1001, nullptr, "PrepareForJit"}, 1262 {1001, nullptr, "PrepareForJit"},
@@ -1690,9 +1723,12 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_)
1690 {21, &IHomeMenuFunctions::GetPopFromGeneralChannelEvent, "GetPopFromGeneralChannelEvent"}, 1723 {21, &IHomeMenuFunctions::GetPopFromGeneralChannelEvent, "GetPopFromGeneralChannelEvent"},
1691 {30, nullptr, "GetHomeButtonWriterLockAccessor"}, 1724 {30, nullptr, "GetHomeButtonWriterLockAccessor"},
1692 {31, nullptr, "GetWriterLockAccessorEx"}, 1725 {31, nullptr, "GetWriterLockAccessorEx"},
1726 {40, nullptr, "IsSleepEnabled"},
1727 {41, nullptr, "IsRebootEnabled"},
1693 {100, nullptr, "PopRequestLaunchApplicationForDebug"}, 1728 {100, nullptr, "PopRequestLaunchApplicationForDebug"},
1694 {110, nullptr, "IsForceTerminateApplicationDisabledForDebug"}, 1729 {110, nullptr, "IsForceTerminateApplicationDisabledForDebug"},
1695 {200, nullptr, "LaunchDevMenu"}, 1730 {200, nullptr, "LaunchDevMenu"},
1731 {1000, nullptr, "SetLastApplicationExitReason"},
1696 }; 1732 };
1697 // clang-format on 1733 // clang-format on
1698 1734
@@ -1736,6 +1772,7 @@ IGlobalStateController::IGlobalStateController(Core::System& system_)
1736 {13, nullptr, "UpdateDefaultDisplayResolution"}, 1772 {13, nullptr, "UpdateDefaultDisplayResolution"},
1737 {14, nullptr, "ShouldSleepOnBoot"}, 1773 {14, nullptr, "ShouldSleepOnBoot"},
1738 {15, nullptr, "GetHdcpAuthenticationFailedEvent"}, 1774 {15, nullptr, "GetHdcpAuthenticationFailedEvent"},
1775 {30, nullptr, "OpenCradleFirmwareUpdater"},
1739 }; 1776 };
1740 // clang-format on 1777 // clang-format on
1741 1778
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h
index 6911f0d6e..f6a453ab7 100644
--- a/src/core/hle/service/am/am.h
+++ b/src/core/hle/service/am/am.h
@@ -146,6 +146,7 @@ private:
146 void IsAutoSleepDisabled(Kernel::HLERequestContext& ctx); 146 void IsAutoSleepDisabled(Kernel::HLERequestContext& ctx);
147 void GetAccumulatedSuspendedTickValue(Kernel::HLERequestContext& ctx); 147 void GetAccumulatedSuspendedTickValue(Kernel::HLERequestContext& ctx);
148 void GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx); 148 void GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx);
149 void SetAlbumImageTakenNotificationEnabled(Kernel::HLERequestContext& ctx);
149 150
150 enum class ScreenshotPermission : u32 { 151 enum class ScreenshotPermission : u32 {
151 Inherit = 0, 152 Inherit = 0,
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp
index 8d657c0bf..0f51e5871 100644
--- a/src/core/hle/service/aoc/aoc_u.cpp
+++ b/src/core/hle/service/aoc/aoc_u.cpp
@@ -118,8 +118,10 @@ AOC_U::AOC_U(Core::System& system_)
118 {7, &AOC_U::PrepareAddOnContent, "PrepareAddOnContent"}, 118 {7, &AOC_U::PrepareAddOnContent, "PrepareAddOnContent"},
119 {8, &AOC_U::GetAddOnContentListChangedEvent, "GetAddOnContentListChangedEvent"}, 119 {8, &AOC_U::GetAddOnContentListChangedEvent, "GetAddOnContentListChangedEvent"},
120 {9, nullptr, "GetAddOnContentLostErrorCode"}, 120 {9, nullptr, "GetAddOnContentLostErrorCode"},
121 {10, nullptr, "GetAddOnContentListChangedEventWithProcessId"},
121 {100, &AOC_U::CreateEcPurchasedEventManager, "CreateEcPurchasedEventManager"}, 122 {100, &AOC_U::CreateEcPurchasedEventManager, "CreateEcPurchasedEventManager"},
122 {101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"}, 123 {101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"},
124 {110, nullptr, "CreateContentsServiceManager"},
123 }; 125 };
124 // clang-format on 126 // clang-format on
125 127
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp
index ea3414fd2..19c578b3a 100644
--- a/src/core/hle/service/audio/hwopus.cpp
+++ b/src/core/hle/service/audio/hwopus.cpp
@@ -297,6 +297,10 @@ HwOpus::HwOpus(Core::System& system_) : ServiceFramework{system_, "hwopus"} {
297 {1, &HwOpus::GetWorkBufferSize, "GetWorkBufferSize"}, 297 {1, &HwOpus::GetWorkBufferSize, "GetWorkBufferSize"},
298 {2, nullptr, "OpenOpusDecoderForMultiStream"}, 298 {2, nullptr, "OpenOpusDecoderForMultiStream"},
299 {3, nullptr, "GetWorkBufferSizeForMultiStream"}, 299 {3, nullptr, "GetWorkBufferSizeForMultiStream"},
300 {4, nullptr, "OpenHardwareOpusDecoderEx"},
301 {5, nullptr, "GetWorkBufferSizeEx"},
302 {6, nullptr, "OpenHardwareOpusDecoderForMultiStreamEx"},
303 {7, nullptr, "GetWorkBufferSizeForMultiStreamEx"},
300 }; 304 };
301 RegisterHandlers(functions); 305 RegisterHandlers(functions);
302} 306}
diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp
index 17a2ac899..af3a5842d 100644
--- a/src/core/hle/service/btdrv/btdrv.cpp
+++ b/src/core/hle/service/btdrv/btdrv.cpp
@@ -156,6 +156,25 @@ public:
156 {97, nullptr, "RegisterBleHidEvent"}, 156 {97, nullptr, "RegisterBleHidEvent"},
157 {98, nullptr, "SetBleScanParameter"}, 157 {98, nullptr, "SetBleScanParameter"},
158 {99, nullptr, "MoveToSecondaryPiconet"}, 158 {99, nullptr, "MoveToSecondaryPiconet"},
159 {100, nullptr, "IsBluetoothEnabled"},
160 {128, nullptr, "AcquireAudioEvent"},
161 {129, nullptr, "GetAudioEventInfo"},
162 {130, nullptr, "OpenAudioConnection"},
163 {131, nullptr, "CloseAudioConnection"},
164 {132, nullptr, "OpenAudioOut"},
165 {133, nullptr, "CloseAudioOut"},
166 {134, nullptr, "AcquireAudioOutStateChangedEvent"},
167 {135, nullptr, "StartAudioOut"},
168 {136, nullptr, "StopAudioOut"},
169 {137, nullptr, "GetAudioOutState"},
170 {138, nullptr, "GetAudioOutFeedingCodec"},
171 {139, nullptr, "GetAudioOutFeedingParameter"},
172 {140, nullptr, "AcquireAudioOutBufferAvailableEvent"},
173 {141, nullptr, "SendAudioData"},
174 {142, nullptr, "AcquireAudioControlInputStateChangedEvent"},
175 {143, nullptr, "GetAudioControlInputState"},
176 {144, nullptr, "AcquireAudioConnectionStateChangedEvent"},
177 {145, nullptr, "GetConnectedAudioDevice"},
159 {256, nullptr, "IsManufacturingMode"}, 178 {256, nullptr, "IsManufacturingMode"},
160 {257, nullptr, "EmulateBluetoothCrash"}, 179 {257, nullptr, "EmulateBluetoothCrash"},
161 {258, nullptr, "GetBleChannelMap"}, 180 {258, nullptr, "GetBleChannelMap"},
diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp
index 9cf2ee92a..d1ebc2388 100644
--- a/src/core/hle/service/btm/btm.cpp
+++ b/src/core/hle/service/btm/btm.cpp
@@ -223,6 +223,7 @@ public:
223 {10, nullptr, "GetGattClientDisconnectionReason"}, 223 {10, nullptr, "GetGattClientDisconnectionReason"},
224 {11, nullptr, "GetBleConnectionParameter"}, 224 {11, nullptr, "GetBleConnectionParameter"},
225 {12, nullptr, "GetBleConnectionParameterRequest"}, 225 {12, nullptr, "GetBleConnectionParameterRequest"},
226 {13, nullptr, "Unknown13"},
226 }; 227 };
227 // clang-format on 228 // clang-format on
228 229
diff --git a/src/core/hle/service/erpt/erpt.cpp b/src/core/hle/service/erpt/erpt.cpp
index 4924c61c3..c767926a4 100644
--- a/src/core/hle/service/erpt/erpt.cpp
+++ b/src/core/hle/service/erpt/erpt.cpp
@@ -16,7 +16,7 @@ public:
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, nullptr, "SubmitContext"}, 18 {0, nullptr, "SubmitContext"},
19 {1, nullptr, "CreateReport"}, 19 {1, nullptr, "CreateReportV0"},
20 {2, nullptr, "SetInitialLaunchSettingsCompletionTime"}, 20 {2, nullptr, "SetInitialLaunchSettingsCompletionTime"},
21 {3, nullptr, "ClearInitialLaunchSettingsCompletionTime"}, 21 {3, nullptr, "ClearInitialLaunchSettingsCompletionTime"},
22 {4, nullptr, "UpdatePowerOnTime"}, 22 {4, nullptr, "UpdatePowerOnTime"},
@@ -26,6 +26,11 @@ public:
26 {8, nullptr, "ClearApplicationLaunchTime"}, 26 {8, nullptr, "ClearApplicationLaunchTime"},
27 {9, nullptr, "SubmitAttachment"}, 27 {9, nullptr, "SubmitAttachment"},
28 {10, nullptr, "CreateReportWithAttachments"}, 28 {10, nullptr, "CreateReportWithAttachments"},
29 {11, nullptr, "CreateReport"},
30 {20, nullptr, "RegisterRunningApplet"},
31 {21, nullptr, "UnregisterRunningApplet"},
32 {22, nullptr, "UpdateAppletSuspendedDuration"},
33 {30, nullptr, "InvalidateForcedShutdownDetection"},
29 }; 34 };
30 // clang-format on 35 // clang-format on
31 36
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index 9cc260515..a0215c4d7 100644
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -118,9 +118,13 @@ public:
118 explicit IFile(Core::System& system_, FileSys::VirtualFile backend_) 118 explicit IFile(Core::System& system_, FileSys::VirtualFile backend_)
119 : ServiceFramework{system_, "IFile"}, backend(std::move(backend_)) { 119 : ServiceFramework{system_, "IFile"}, backend(std::move(backend_)) {
120 static const FunctionInfo functions[] = { 120 static const FunctionInfo functions[] = {
121 {0, &IFile::Read, "Read"}, {1, &IFile::Write, "Write"}, 121 {0, &IFile::Read, "Read"},
122 {2, &IFile::Flush, "Flush"}, {3, &IFile::SetSize, "SetSize"}, 122 {1, &IFile::Write, "Write"},
123 {4, &IFile::GetSize, "GetSize"}, {5, nullptr, "OperateRange"}, 123 {2, &IFile::Flush, "Flush"},
124 {3, &IFile::SetSize, "SetSize"},
125 {4, &IFile::GetSize, "GetSize"},
126 {5, nullptr, "OperateRange"},
127 {6, nullptr, "OperateRangeWithBuffer"},
124 }; 128 };
125 RegisterHandlers(functions); 129 RegisterHandlers(functions);
126 } 130 }
@@ -708,7 +712,10 @@ FSP_SRV::FSP_SRV(Core::System& system_)
708 {84, nullptr, "ListApplicationAccessibleSaveDataOwnerId"}, 712 {84, nullptr, "ListApplicationAccessibleSaveDataOwnerId"},
709 {85, nullptr, "OpenSaveDataTransferManagerForSaveDataRepair"}, 713 {85, nullptr, "OpenSaveDataTransferManagerForSaveDataRepair"},
710 {86, nullptr, "OpenSaveDataMover"}, 714 {86, nullptr, "OpenSaveDataMover"},
715 {87, nullptr, "OpenSaveDataTransferManagerForRepair"},
711 {100, nullptr, "OpenImageDirectoryFileSystem"}, 716 {100, nullptr, "OpenImageDirectoryFileSystem"},
717 {101, nullptr, "OpenBaseFileSystem"},
718 {102, nullptr, "FormatBaseFileSystem"},
712 {110, nullptr, "OpenContentStorageFileSystem"}, 719 {110, nullptr, "OpenContentStorageFileSystem"},
713 {120, nullptr, "OpenCloudBackupWorkStorageFileSystem"}, 720 {120, nullptr, "OpenCloudBackupWorkStorageFileSystem"},
714 {130, nullptr, "OpenCustomStorageFileSystem"}, 721 {130, nullptr, "OpenCustomStorageFileSystem"},
@@ -764,10 +771,12 @@ FSP_SRV::FSP_SRV(Core::System& system_)
764 {1008, nullptr, "OpenRegisteredUpdatePartition"}, 771 {1008, nullptr, "OpenRegisteredUpdatePartition"},
765 {1009, nullptr, "GetAndClearMemoryReportInfo"}, 772 {1009, nullptr, "GetAndClearMemoryReportInfo"},
766 {1010, nullptr, "SetDataStorageRedirectTarget"}, 773 {1010, nullptr, "SetDataStorageRedirectTarget"},
767 {1011, &FSP_SRV::GetAccessLogVersionInfo, "GetAccessLogVersionInfo"}, 774 {1011, &FSP_SRV::GetProgramIndexForAccessLog, "GetProgramIndexForAccessLog"},
768 {1012, nullptr, "GetFsStackUsage"}, 775 {1012, nullptr, "GetFsStackUsage"},
769 {1013, nullptr, "UnsetSaveDataRootPath"}, 776 {1013, nullptr, "UnsetSaveDataRootPath"},
770 {1014, nullptr, "OutputMultiProgramTagAccessLog"}, 777 {1014, nullptr, "OutputMultiProgramTagAccessLog"},
778 {1016, nullptr, "FlushAccessLogOnSdCard"},
779 {1017, nullptr, "OutputApplicationInfoAccessLog"},
771 {1100, nullptr, "OverrideSaveDataTransferTokenSignVerificationKey"}, 780 {1100, nullptr, "OverrideSaveDataTransferTokenSignVerificationKey"},
772 {1110, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId2"}, 781 {1110, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId2"},
773 {1200, &FSP_SRV::OpenMultiCommitManager, "OpenMultiCommitManager"}, 782 {1200, &FSP_SRV::OpenMultiCommitManager, "OpenMultiCommitManager"},
@@ -1051,7 +1060,7 @@ void FSP_SRV::OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx) {
1051 rb.Push(RESULT_SUCCESS); 1060 rb.Push(RESULT_SUCCESS);
1052} 1061}
1053 1062
1054void FSP_SRV::GetAccessLogVersionInfo(Kernel::HLERequestContext& ctx) { 1063void FSP_SRV::GetProgramIndexForAccessLog(Kernel::HLERequestContext& ctx) {
1055 LOG_DEBUG(Service_FS, "called"); 1064 LOG_DEBUG(Service_FS, "called");
1056 1065
1057 IPC::ResponseBuilder rb{ctx, 4}; 1066 IPC::ResponseBuilder rb{ctx, 4};
diff --git a/src/core/hle/service/filesystem/fsp_srv.h b/src/core/hle/service/filesystem/fsp_srv.h
index 8ed933279..b01b924eb 100644
--- a/src/core/hle/service/filesystem/fsp_srv.h
+++ b/src/core/hle/service/filesystem/fsp_srv.h
@@ -53,7 +53,7 @@ private:
53 void SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx); 53 void SetGlobalAccessLogMode(Kernel::HLERequestContext& ctx);
54 void GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx); 54 void GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx);
55 void OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx); 55 void OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx);
56 void GetAccessLogVersionInfo(Kernel::HLERequestContext& ctx); 56 void GetProgramIndexForAccessLog(Kernel::HLERequestContext& ctx);
57 void OpenMultiCommitManager(Kernel::HLERequestContext& ctx); 57 void OpenMultiCommitManager(Kernel::HLERequestContext& ctx);
58 58
59 FileSystemController& fsc; 59 FileSystemController& fsc;
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp
index 5a9c6d008..a35979053 100644
--- a/src/core/hle/service/friend/friend.cpp
+++ b/src/core/hle/service/friend/friend.cpp
@@ -133,7 +133,7 @@ private:
133 void GetBlockedUserListIds(Kernel::HLERequestContext& ctx) { 133 void GetBlockedUserListIds(Kernel::HLERequestContext& ctx) {
134 // This is safe to stub, as there should be no adverse consequences from reporting no 134 // This is safe to stub, as there should be no adverse consequences from reporting no
135 // blocked users. 135 // blocked users.
136 LOG_WARNING(Service_ACC, "(STUBBED) called"); 136 LOG_WARNING(Service_Friend, "(STUBBED) called");
137 IPC::ResponseBuilder rb{ctx, 3}; 137 IPC::ResponseBuilder rb{ctx, 3};
138 rb.Push(RESULT_SUCCESS); 138 rb.Push(RESULT_SUCCESS);
139 rb.Push<u32>(0); // Indicates there are no blocked users 139 rb.Push<u32>(0); // Indicates there are no blocked users
@@ -141,14 +141,14 @@ private:
141 141
142 void DeclareCloseOnlinePlaySession(Kernel::HLERequestContext& ctx) { 142 void DeclareCloseOnlinePlaySession(Kernel::HLERequestContext& ctx) {
143 // Stub used by Splatoon 2 143 // Stub used by Splatoon 2
144 LOG_WARNING(Service_ACC, "(STUBBED) called"); 144 LOG_WARNING(Service_Friend, "(STUBBED) called");
145 IPC::ResponseBuilder rb{ctx, 2}; 145 IPC::ResponseBuilder rb{ctx, 2};
146 rb.Push(RESULT_SUCCESS); 146 rb.Push(RESULT_SUCCESS);
147 } 147 }
148 148
149 void UpdateUserPresence(Kernel::HLERequestContext& ctx) { 149 void UpdateUserPresence(Kernel::HLERequestContext& ctx) {
150 // Stub used by Retro City Rampage 150 // Stub used by Retro City Rampage
151 LOG_WARNING(Service_ACC, "(STUBBED) called"); 151 LOG_WARNING(Service_Friend, "(STUBBED) called");
152 IPC::ResponseBuilder rb{ctx, 2}; 152 IPC::ResponseBuilder rb{ctx, 2};
153 rb.Push(RESULT_SUCCESS); 153 rb.Push(RESULT_SUCCESS);
154 } 154 }
@@ -171,7 +171,7 @@ private:
171 const auto uuid = rp.PopRaw<Common::UUID>(); 171 const auto uuid = rp.PopRaw<Common::UUID>();
172 [[maybe_unused]] const auto filter = rp.PopRaw<SizedFriendFilter>(); 172 [[maybe_unused]] const auto filter = rp.PopRaw<SizedFriendFilter>();
173 const auto pid = rp.Pop<u64>(); 173 const auto pid = rp.Pop<u64>();
174 LOG_WARNING(Service_ACC, "(STUBBED) called, offset={}, uuid={}, pid={}", friend_offset, 174 LOG_WARNING(Service_Friend, "(STUBBED) called, offset={}, uuid={}, pid={}", friend_offset,
175 uuid.Format(), pid); 175 uuid.Format(), pid);
176 176
177 IPC::ResponseBuilder rb{ctx, 3}; 177 IPC::ResponseBuilder rb{ctx, 3};
@@ -203,7 +203,7 @@ public:
203 203
204private: 204private:
205 void GetEvent(Kernel::HLERequestContext& ctx) { 205 void GetEvent(Kernel::HLERequestContext& ctx) {
206 LOG_DEBUG(Service_ACC, "called"); 206 LOG_DEBUG(Service_Friend, "called");
207 207
208 IPC::ResponseBuilder rb{ctx, 2, 1}; 208 IPC::ResponseBuilder rb{ctx, 2, 1};
209 rb.Push(RESULT_SUCCESS); 209 rb.Push(RESULT_SUCCESS);
@@ -211,7 +211,7 @@ private:
211 } 211 }
212 212
213 void Clear(Kernel::HLERequestContext& ctx) { 213 void Clear(Kernel::HLERequestContext& ctx) {
214 LOG_DEBUG(Service_ACC, "called"); 214 LOG_DEBUG(Service_Friend, "called");
215 while (!notifications.empty()) { 215 while (!notifications.empty()) {
216 notifications.pop(); 216 notifications.pop();
217 } 217 }
@@ -222,10 +222,10 @@ private:
222 } 222 }
223 223
224 void Pop(Kernel::HLERequestContext& ctx) { 224 void Pop(Kernel::HLERequestContext& ctx) {
225 LOG_DEBUG(Service_ACC, "called"); 225 LOG_DEBUG(Service_Friend, "called");
226 226
227 if (notifications.empty()) { 227 if (notifications.empty()) {
228 LOG_ERROR(Service_ACC, "No notifications in queue!"); 228 LOG_ERROR(Service_Friend, "No notifications in queue!");
229 IPC::ResponseBuilder rb{ctx, 2}; 229 IPC::ResponseBuilder rb{ctx, 2};
230 rb.Push(ERR_NO_NOTIFICATIONS); 230 rb.Push(ERR_NO_NOTIFICATIONS);
231 return; 231 return;
@@ -243,7 +243,8 @@ private:
243 break; 243 break;
244 default: 244 default:
245 // HOS seems not have an error case for an unknown notification 245 // HOS seems not have an error case for an unknown notification
246 LOG_WARNING(Service_ACC, "Unknown notification {:08X}", notification.notification_type); 246 LOG_WARNING(Service_Friend, "Unknown notification {:08X}",
247 notification.notification_type);
247 break; 248 break;
248 } 249 }
249 250
@@ -281,14 +282,14 @@ void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) {
281 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 282 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
282 rb.Push(RESULT_SUCCESS); 283 rb.Push(RESULT_SUCCESS);
283 rb.PushIpcInterface<IFriendService>(system); 284 rb.PushIpcInterface<IFriendService>(system);
284 LOG_DEBUG(Service_ACC, "called"); 285 LOG_DEBUG(Service_Friend, "called");
285} 286}
286 287
287void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx) { 288void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx) {
288 IPC::RequestParser rp{ctx}; 289 IPC::RequestParser rp{ctx};
289 auto uuid = rp.PopRaw<Common::UUID>(); 290 auto uuid = rp.PopRaw<Common::UUID>();
290 291
291 LOG_DEBUG(Service_ACC, "called, uuid={}", uuid.Format()); 292 LOG_DEBUG(Service_Friend, "called, uuid={}", uuid.Format());
292 293
293 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 294 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
294 rb.Push(RESULT_SUCCESS); 295 rb.Push(RESULT_SUCCESS);
diff --git a/src/core/hle/service/glue/bgtc.cpp b/src/core/hle/service/glue/bgtc.cpp
index a478b68e1..daecfff15 100644
--- a/src/core/hle/service/glue/bgtc.cpp
+++ b/src/core/hle/service/glue/bgtc.cpp
@@ -2,6 +2,9 @@
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 "common/logging/log.h"
6#include "core/core.h"
7#include "core/hle/ipc_helpers.h"
5#include "core/hle/service/glue/bgtc.h" 8#include "core/hle/service/glue/bgtc.h"
6 9
7namespace Service::Glue { 10namespace Service::Glue {
@@ -9,6 +12,26 @@ namespace Service::Glue {
9BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} { 12BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} {
10 // clang-format off 13 // clang-format off
11 static const FunctionInfo functions[] = { 14 static const FunctionInfo functions[] = {
15 {100, &BGTC_T::OpenTaskService, "OpenTaskService"},
16 };
17 // clang-format on
18
19 RegisterHandlers(functions);
20}
21
22BGTC_T::~BGTC_T() = default;
23
24void BGTC_T::OpenTaskService(Kernel::HLERequestContext& ctx) {
25 LOG_DEBUG(Service_BGTC, "called");
26
27 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
28 rb.Push(RESULT_SUCCESS);
29 rb.PushIpcInterface<ITaskService>(system);
30}
31
32ITaskService::ITaskService(Core::System& system_) : ServiceFramework{system_, "ITaskService"} {
33 // clang-format off
34 static const FunctionInfo functions[] = {
12 {1, nullptr, "NotifyTaskStarting"}, 35 {1, nullptr, "NotifyTaskStarting"},
13 {2, nullptr, "NotifyTaskFinished"}, 36 {2, nullptr, "NotifyTaskFinished"},
14 {3, nullptr, "GetTriggerEvent"}, 37 {3, nullptr, "GetTriggerEvent"},
@@ -20,16 +43,18 @@ BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} {
20 {13, nullptr, "UnscheduleTask"}, 43 {13, nullptr, "UnscheduleTask"},
21 {14, nullptr, "GetScheduleEvent"}, 44 {14, nullptr, "GetScheduleEvent"},
22 {15, nullptr, "SchedulePeriodicTask"}, 45 {15, nullptr, "SchedulePeriodicTask"},
46 {16, nullptr, "Unknown16"},
23 {101, nullptr, "GetOperationMode"}, 47 {101, nullptr, "GetOperationMode"},
24 {102, nullptr, "WillDisconnectNetworkWhenEnteringSleep"}, 48 {102, nullptr, "WillDisconnectNetworkWhenEnteringSleep"},
25 {103, nullptr, "WillStayHalfAwakeInsteadSleep"}, 49 {103, nullptr, "WillStayHalfAwakeInsteadSleep"},
50 {200, nullptr, "Unknown200"},
26 }; 51 };
27 // clang-format on 52 // clang-format on
28 53
29 RegisterHandlers(functions); 54 RegisterHandlers(functions);
30} 55}
31 56
32BGTC_T::~BGTC_T() = default; 57ITaskService::~ITaskService() = default;
33 58
34BGTC_SC::BGTC_SC(Core::System& system_) : ServiceFramework{system_, "bgtc:sc"} { 59BGTC_SC::BGTC_SC(Core::System& system_) : ServiceFramework{system_, "bgtc:sc"} {
35 // clang-format off 60 // clang-format off
diff --git a/src/core/hle/service/glue/bgtc.h b/src/core/hle/service/glue/bgtc.h
index 906116ba6..4c0142fd5 100644
--- a/src/core/hle/service/glue/bgtc.h
+++ b/src/core/hle/service/glue/bgtc.h
@@ -16,6 +16,14 @@ class BGTC_T final : public ServiceFramework<BGTC_T> {
16public: 16public:
17 explicit BGTC_T(Core::System& system_); 17 explicit BGTC_T(Core::System& system_);
18 ~BGTC_T() override; 18 ~BGTC_T() override;
19
20 void OpenTaskService(Kernel::HLERequestContext& ctx);
21};
22
23class ITaskService final : public ServiceFramework<ITaskService> {
24public:
25 explicit ITaskService(Core::System& system_);
26 ~ITaskService() override;
19}; 27};
20 28
21class BGTC_SC final : public ServiceFramework<BGTC_SC> { 29class BGTC_SC final : public ServiceFramework<BGTC_SC> {
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp
index e7063f8ef..93c43a203 100644
--- a/src/core/hle/service/hid/controllers/gesture.cpp
+++ b/src/core/hle/service/hid/controllers/gesture.cpp
@@ -4,6 +4,7 @@
4 4
5#include <cstring> 5#include <cstring>
6#include "common/common_types.h" 6#include "common/common_types.h"
7#include "common/logging/log.h"
7#include "core/core_timing.h" 8#include "core/core_timing.h"
8#include "core/frontend/emu_window.h" 9#include "core/frontend/emu_window.h"
9#include "core/hle/service/hid/controllers/gesture.h" 10#include "core/hle/service/hid/controllers/gesture.h"
@@ -19,9 +20,9 @@ Controller_Gesture::~Controller_Gesture() = default;
19 20
20void Controller_Gesture::OnInit() { 21void Controller_Gesture::OnInit() {
21 for (std::size_t id = 0; id < MAX_FINGERS; ++id) { 22 for (std::size_t id = 0; id < MAX_FINGERS; ++id) {
22 mouse_finger_id[id] = MAX_FINGERS; 23 mouse_finger_id[id] = MAX_POINTS;
23 keyboard_finger_id[id] = MAX_FINGERS; 24 keyboard_finger_id[id] = MAX_POINTS;
24 udp_finger_id[id] = MAX_FINGERS; 25 udp_finger_id[id] = MAX_POINTS;
25 } 26 }
26} 27}
27 28
@@ -142,6 +143,10 @@ std::optional<std::size_t> Controller_Gesture::GetUnusedFingerID() const {
142std::size_t Controller_Gesture::UpdateTouchInputEvent( 143std::size_t Controller_Gesture::UpdateTouchInputEvent(
143 const std::tuple<float, float, bool>& touch_input, std::size_t finger_id) { 144 const std::tuple<float, float, bool>& touch_input, std::size_t finger_id) {
144 const auto& [x, y, pressed] = touch_input; 145 const auto& [x, y, pressed] = touch_input;
146 if (finger_id > MAX_POINTS) {
147 LOG_ERROR(Service_HID, "Invalid finger id {}", finger_id);
148 return MAX_POINTS;
149 }
145 if (pressed) { 150 if (pressed) {
146 if (finger_id == MAX_POINTS) { 151 if (finger_id == MAX_POINTS) {
147 const auto first_free_id = GetUnusedFingerID(); 152 const auto first_free_id = GetUnusedFingerID();
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 70b9f3824..673db68c7 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -413,12 +413,16 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) {
413 lstick_entry.y = static_cast<s32>(stick_l_y_f * HID_JOYSTICK_MAX); 413 lstick_entry.y = static_cast<s32>(stick_l_y_f * HID_JOYSTICK_MAX);
414 } 414 }
415 415
416 if (controller_type == NPadControllerType::JoyLeft || 416 if (controller_type == NPadControllerType::JoyLeft) {
417 controller_type == NPadControllerType::JoyRight) {
418 pad_state.left_sl.Assign(button_state[SL - BUTTON_HID_BEGIN]->GetStatus()); 417 pad_state.left_sl.Assign(button_state[SL - BUTTON_HID_BEGIN]->GetStatus());
419 pad_state.left_sr.Assign(button_state[SR - BUTTON_HID_BEGIN]->GetStatus()); 418 pad_state.left_sr.Assign(button_state[SR - BUTTON_HID_BEGIN]->GetStatus());
420 } 419 }
421 420
421 if (controller_type == NPadControllerType::JoyRight) {
422 pad_state.right_sl.Assign(button_state[SL - BUTTON_HID_BEGIN]->GetStatus());
423 pad_state.right_sr.Assign(button_state[SR - BUTTON_HID_BEGIN]->GetStatus());
424 }
425
422 if (controller_type == NPadControllerType::GameCube) { 426 if (controller_type == NPadControllerType::GameCube) {
423 trigger_entry.l_analog = static_cast<s32>( 427 trigger_entry.l_analog = static_cast<s32>(
424 button_state[ZL - BUTTON_HID_BEGIN]->GetStatus() ? HID_TRIGGER_MAX : 0); 428 button_state[ZL - BUTTON_HID_BEGIN]->GetStatus() ? HID_TRIGGER_MAX : 0);
@@ -1134,6 +1138,10 @@ void Controller_NPad::SetUnintendedHomeButtonInputProtectionEnabled(bool is_prot
1134 unintended_home_button_input_protection[NPadIdToIndex(npad_id)] = is_protection_enabled; 1138 unintended_home_button_input_protection[NPadIdToIndex(npad_id)] = is_protection_enabled;
1135} 1139}
1136 1140
1141void Controller_NPad::SetAnalogStickUseCenterClamp(bool use_center_clamp) {
1142 analog_stick_use_center_clamp = use_center_clamp;
1143}
1144
1137void Controller_NPad::ClearAllConnectedControllers() { 1145void Controller_NPad::ClearAllConnectedControllers() {
1138 for (auto& controller : connected_controllers) { 1146 for (auto& controller : connected_controllers) {
1139 if (controller.is_connected && controller.type != NPadControllerType::None) { 1147 if (controller.is_connected && controller.type != NPadControllerType::None) {
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index bc2e6779d..873a0a1e2 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -219,6 +219,7 @@ public:
219 LedPattern GetLedPattern(u32 npad_id); 219 LedPattern GetLedPattern(u32 npad_id);
220 bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const; 220 bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const;
221 void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id); 221 void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id);
222 void SetAnalogStickUseCenterClamp(bool use_center_clamp);
222 void ClearAllConnectedControllers(); 223 void ClearAllConnectedControllers();
223 void DisconnectAllConnectedControllers(); 224 void DisconnectAllConnectedControllers();
224 void ConnectAllDisconnectedControllers(); 225 void ConnectAllDisconnectedControllers();
@@ -577,6 +578,7 @@ private:
577 std::array<std::array<bool, 2>, 10> vibration_devices_mounted{}; 578 std::array<std::array<bool, 2>, 10> vibration_devices_mounted{};
578 std::array<ControllerHolder, 10> connected_controllers{}; 579 std::array<ControllerHolder, 10> connected_controllers{};
579 std::array<bool, 10> unintended_home_button_input_protection{}; 580 std::array<bool, 10> unintended_home_button_input_protection{};
581 bool analog_stick_use_center_clamp{};
580 GyroscopeZeroDriftMode gyroscope_zero_drift_mode{GyroscopeZeroDriftMode::Standard}; 582 GyroscopeZeroDriftMode gyroscope_zero_drift_mode{GyroscopeZeroDriftMode::Standard};
581 bool sixaxis_sensors_enabled{true}; 583 bool sixaxis_sensors_enabled{true};
582 f32 sixaxis_fusion_parameter1{}; 584 f32 sixaxis_fusion_parameter1{};
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp
index 5219f2dad..be60492a4 100644
--- a/src/core/hle/service/hid/controllers/touchscreen.cpp
+++ b/src/core/hle/service/hid/controllers/touchscreen.cpp
@@ -5,6 +5,7 @@
5#include <algorithm> 5#include <algorithm>
6#include <cstring> 6#include <cstring>
7#include "common/common_types.h" 7#include "common/common_types.h"
8#include "common/logging/log.h"
8#include "core/core_timing.h" 9#include "core/core_timing.h"
9#include "core/frontend/emu_window.h" 10#include "core/frontend/emu_window.h"
10#include "core/frontend/input.h" 11#include "core/frontend/input.h"
@@ -118,6 +119,10 @@ std::optional<std::size_t> Controller_Touchscreen::GetUnusedFingerID() const {
118std::size_t Controller_Touchscreen::UpdateTouchInputEvent( 119std::size_t Controller_Touchscreen::UpdateTouchInputEvent(
119 const std::tuple<float, float, bool>& touch_input, std::size_t finger_id) { 120 const std::tuple<float, float, bool>& touch_input, std::size_t finger_id) {
120 const auto& [x, y, pressed] = touch_input; 121 const auto& [x, y, pressed] = touch_input;
122 if (finger_id > MAX_FINGERS) {
123 LOG_ERROR(Service_HID, "Invalid finger id {}", finger_id);
124 return MAX_FINGERS;
125 }
121 if (pressed) { 126 if (pressed) {
122 Attributes attribute{}; 127 Attributes attribute{};
123 if (finger_id == MAX_FINGERS) { 128 if (finger_id == MAX_FINGERS) {
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index ba27bbb05..a1a779cc0 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -263,7 +263,7 @@ Hid::Hid(Core::System& system_) : ServiceFramework{system_, "hid"} {
263 {131, &Hid::IsUnintendedHomeButtonInputProtectionEnabled, "IsUnintendedHomeButtonInputProtectionEnabled"}, 263 {131, &Hid::IsUnintendedHomeButtonInputProtectionEnabled, "IsUnintendedHomeButtonInputProtectionEnabled"},
264 {132, &Hid::EnableUnintendedHomeButtonInputProtection, "EnableUnintendedHomeButtonInputProtection"}, 264 {132, &Hid::EnableUnintendedHomeButtonInputProtection, "EnableUnintendedHomeButtonInputProtection"},
265 {133, nullptr, "SetNpadJoyAssignmentModeSingleWithDestination"}, 265 {133, nullptr, "SetNpadJoyAssignmentModeSingleWithDestination"},
266 {134, nullptr, "SetNpadAnalogStickUseCenterClamp"}, 266 {134, &Hid::SetNpadAnalogStickUseCenterClamp, "SetNpadAnalogStickUseCenterClamp"},
267 {135, nullptr, "SetNpadCaptureButtonAssignment"}, 267 {135, nullptr, "SetNpadCaptureButtonAssignment"},
268 {136, nullptr, "ClearNpadCaptureButtonAssignment"}, 268 {136, nullptr, "ClearNpadCaptureButtonAssignment"},
269 {200, &Hid::GetVibrationDeviceInfo, "GetVibrationDeviceInfo"}, 269 {200, &Hid::GetVibrationDeviceInfo, "GetVibrationDeviceInfo"},
@@ -278,6 +278,7 @@ Hid::Hid(Core::System& system_) : ServiceFramework{system_, "hid"} {
278 {209, &Hid::BeginPermitVibrationSession, "BeginPermitVibrationSession"}, 278 {209, &Hid::BeginPermitVibrationSession, "BeginPermitVibrationSession"},
279 {210, &Hid::EndPermitVibrationSession, "EndPermitVibrationSession"}, 279 {210, &Hid::EndPermitVibrationSession, "EndPermitVibrationSession"},
280 {211, &Hid::IsVibrationDeviceMounted, "IsVibrationDeviceMounted"}, 280 {211, &Hid::IsVibrationDeviceMounted, "IsVibrationDeviceMounted"},
281 {212, nullptr, "SendVibrationValueInBool"},
281 {300, &Hid::ActivateConsoleSixAxisSensor, "ActivateConsoleSixAxisSensor"}, 282 {300, &Hid::ActivateConsoleSixAxisSensor, "ActivateConsoleSixAxisSensor"},
282 {301, &Hid::StartConsoleSixAxisSensor, "StartConsoleSixAxisSensor"}, 283 {301, &Hid::StartConsoleSixAxisSensor, "StartConsoleSixAxisSensor"},
283 {302, &Hid::StopConsoleSixAxisSensor, "StopConsoleSixAxisSensor"}, 284 {302, &Hid::StopConsoleSixAxisSensor, "StopConsoleSixAxisSensor"},
@@ -1087,6 +1088,27 @@ void Hid::EnableUnintendedHomeButtonInputProtection(Kernel::HLERequestContext& c
1087 rb.Push(RESULT_SUCCESS); 1088 rb.Push(RESULT_SUCCESS);
1088} 1089}
1089 1090
1091void Hid::SetNpadAnalogStickUseCenterClamp(Kernel::HLERequestContext& ctx) {
1092 IPC::RequestParser rp{ctx};
1093 struct Parameters {
1094 bool analog_stick_use_center_clamp;
1095 u64 applet_resource_user_id;
1096 };
1097 static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
1098
1099 const auto parameters{rp.PopRaw<Parameters>()};
1100
1101 applet_resource->GetController<Controller_NPad>(HidController::NPad)
1102 .SetAnalogStickUseCenterClamp(parameters.analog_stick_use_center_clamp);
1103
1104 LOG_WARNING(Service_HID,
1105 "(STUBBED) called, analog_stick_use_center_clamp={}, applet_resource_user_id={}",
1106 parameters.analog_stick_use_center_clamp, parameters.applet_resource_user_id);
1107
1108 IPC::ResponseBuilder rb{ctx, 2};
1109 rb.Push(RESULT_SUCCESS);
1110}
1111
1090void Hid::GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) { 1112void Hid::GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) {
1091 IPC::RequestParser rp{ctx}; 1113 IPC::RequestParser rp{ctx};
1092 const auto vibration_device_handle{rp.PopRaw<Controller_NPad::DeviceHandle>()}; 1114 const auto vibration_device_handle{rp.PopRaw<Controller_NPad::DeviceHandle>()};
@@ -1553,6 +1575,7 @@ public:
1553 {11, nullptr, "SetTouchScreenAutoPilotState"}, 1575 {11, nullptr, "SetTouchScreenAutoPilotState"},
1554 {12, nullptr, "UnsetTouchScreenAutoPilotState"}, 1576 {12, nullptr, "UnsetTouchScreenAutoPilotState"},
1555 {13, nullptr, "GetTouchScreenConfiguration"}, 1577 {13, nullptr, "GetTouchScreenConfiguration"},
1578 {14, nullptr, "ProcessTouchScreenAutoTune"},
1556 {20, nullptr, "DeactivateMouse"}, 1579 {20, nullptr, "DeactivateMouse"},
1557 {21, nullptr, "SetMouseAutoPilotState"}, 1580 {21, nullptr, "SetMouseAutoPilotState"},
1558 {22, nullptr, "UnsetMouseAutoPilotState"}, 1581 {22, nullptr, "UnsetMouseAutoPilotState"},
@@ -1562,6 +1585,7 @@ public:
1562 {50, nullptr, "DeactivateXpad"}, 1585 {50, nullptr, "DeactivateXpad"},
1563 {51, nullptr, "SetXpadAutoPilotState"}, 1586 {51, nullptr, "SetXpadAutoPilotState"},
1564 {52, nullptr, "UnsetXpadAutoPilotState"}, 1587 {52, nullptr, "UnsetXpadAutoPilotState"},
1588 {53, nullptr, "DeactivateJoyXpad"},
1565 {60, nullptr, "ClearNpadSystemCommonPolicy"}, 1589 {60, nullptr, "ClearNpadSystemCommonPolicy"},
1566 {61, nullptr, "DeactivateNpad"}, 1590 {61, nullptr, "DeactivateNpad"},
1567 {62, nullptr, "ForceDisconnectNpad"}, 1591 {62, nullptr, "ForceDisconnectNpad"},
@@ -1632,6 +1656,11 @@ public:
1632 {244, nullptr, "RequestKuinaFirmwareVersion"}, 1656 {244, nullptr, "RequestKuinaFirmwareVersion"},
1633 {245, nullptr, "GetKuinaFirmwareVersion"}, 1657 {245, nullptr, "GetKuinaFirmwareVersion"},
1634 {246, nullptr, "GetVidPid"}, 1658 {246, nullptr, "GetVidPid"},
1659 {247, nullptr, "GetAnalogStickCalibrationValue"},
1660 {248, nullptr, "GetUniquePadIdsFull"},
1661 {249, nullptr, "ConnectUniquePad"},
1662 {250, nullptr, "IsVirtual"},
1663 {251, nullptr, "GetAnalogStickModuleParam"},
1635 {301, nullptr, "GetAbstractedPadHandles"}, 1664 {301, nullptr, "GetAbstractedPadHandles"},
1636 {302, nullptr, "GetAbstractedPadState"}, 1665 {302, nullptr, "GetAbstractedPadState"},
1637 {303, nullptr, "GetAbstractedPadsState"}, 1666 {303, nullptr, "GetAbstractedPadsState"},
@@ -1652,12 +1681,16 @@ public:
1652 {401, nullptr, "DisableRailDeviceFiltering"}, 1681 {401, nullptr, "DisableRailDeviceFiltering"},
1653 {402, nullptr, "EnableWiredPairing"}, 1682 {402, nullptr, "EnableWiredPairing"},
1654 {403, nullptr, "EnableShipmentModeAutoClear"}, 1683 {403, nullptr, "EnableShipmentModeAutoClear"},
1684 {404, nullptr, "SetRailEnabled"},
1655 {500, nullptr, "SetFactoryInt"}, 1685 {500, nullptr, "SetFactoryInt"},
1656 {501, nullptr, "IsFactoryBootEnabled"}, 1686 {501, nullptr, "IsFactoryBootEnabled"},
1657 {550, nullptr, "SetAnalogStickModelDataTemporarily"}, 1687 {550, nullptr, "SetAnalogStickModelDataTemporarily"},
1658 {551, nullptr, "GetAnalogStickModelData"}, 1688 {551, nullptr, "GetAnalogStickModelData"},
1659 {552, nullptr, "ResetAnalogStickModelData"}, 1689 {552, nullptr, "ResetAnalogStickModelData"},
1660 {600, nullptr, "ConvertPadState"}, 1690 {600, nullptr, "ConvertPadState"},
1691 {650, nullptr, "AddButtonPlayData"},
1692 {651, nullptr, "StartButtonPlayData"},
1693 {652, nullptr, "StopButtonPlayData"},
1661 {2000, nullptr, "DeactivateDigitizer"}, 1694 {2000, nullptr, "DeactivateDigitizer"},
1662 {2001, nullptr, "SetDigitizerAutoPilotState"}, 1695 {2001, nullptr, "SetDigitizerAutoPilotState"},
1663 {2002, nullptr, "UnsetDigitizerAutoPilotState"}, 1696 {2002, nullptr, "UnsetDigitizerAutoPilotState"},
@@ -1689,6 +1722,8 @@ public:
1689 {215, nullptr, "IsNfcActivated"}, 1722 {215, nullptr, "IsNfcActivated"},
1690 {230, nullptr, "AcquireIrSensorEventHandle"}, 1723 {230, nullptr, "AcquireIrSensorEventHandle"},
1691 {231, nullptr, "ActivateIrSensor"}, 1724 {231, nullptr, "ActivateIrSensor"},
1725 {232, nullptr, "GetIrSensorState"},
1726 {233, nullptr, "GetXcdHandleForNpadWithIrSensor"},
1692 {301, nullptr, "ActivateNpadSystem"}, 1727 {301, nullptr, "ActivateNpadSystem"},
1693 {303, nullptr, "ApplyNpadSystemCommonPolicy"}, 1728 {303, nullptr, "ApplyNpadSystemCommonPolicy"},
1694 {304, nullptr, "EnableAssigningSingleOnSlSrPress"}, 1729 {304, nullptr, "EnableAssigningSingleOnSlSrPress"},
@@ -1703,9 +1738,16 @@ public:
1703 {313, nullptr, "GetNpadCaptureButtonAssignment"}, 1738 {313, nullptr, "GetNpadCaptureButtonAssignment"},
1704 {314, nullptr, "GetAppletFooterUiType"}, 1739 {314, nullptr, "GetAppletFooterUiType"},
1705 {315, nullptr, "GetAppletDetailedUiType"}, 1740 {315, nullptr, "GetAppletDetailedUiType"},
1741 {316, nullptr, "GetNpadInterfaceType"},
1742 {317, nullptr, "GetNpadLeftRightInterfaceType"},
1743 {318, nullptr, "HasBattery"},
1744 {319, nullptr, "HasLeftRightBattery"},
1706 {321, nullptr, "GetUniquePadsFromNpad"}, 1745 {321, nullptr, "GetUniquePadsFromNpad"},
1707 {322, nullptr, "GetIrSensorState"}, 1746 {322, nullptr, "GetIrSensorState"},
1708 {323, nullptr, "GetXcdHandleForNpadWithIrSensor"}, 1747 {323, nullptr, "GetXcdHandleForNpadWithIrSensor"},
1748 {324, nullptr, "GetUniquePadButtonSet"},
1749 {325, nullptr, "GetUniquePadColor"},
1750 {326, nullptr, "GetUniquePadAppletDetailedUiType"},
1709 {500, nullptr, "SetAppletResourceUserId"}, 1751 {500, nullptr, "SetAppletResourceUserId"},
1710 {501, nullptr, "RegisterAppletResourceUserId"}, 1752 {501, nullptr, "RegisterAppletResourceUserId"},
1711 {502, nullptr, "UnregisterAppletResourceUserId"}, 1753 {502, nullptr, "UnregisterAppletResourceUserId"},
@@ -1716,10 +1758,13 @@ public:
1716 {511, nullptr, "GetVibrationMasterVolume"}, 1758 {511, nullptr, "GetVibrationMasterVolume"},
1717 {512, nullptr, "BeginPermitVibrationSession"}, 1759 {512, nullptr, "BeginPermitVibrationSession"},
1718 {513, nullptr, "EndPermitVibrationSession"}, 1760 {513, nullptr, "EndPermitVibrationSession"},
1761 {514, nullptr, "Unknown514"},
1719 {520, nullptr, "EnableHandheldHids"}, 1762 {520, nullptr, "EnableHandheldHids"},
1720 {521, nullptr, "DisableHandheldHids"}, 1763 {521, nullptr, "DisableHandheldHids"},
1721 {522, nullptr, "SetJoyConRailEnabled"}, 1764 {522, nullptr, "SetJoyConRailEnabled"},
1722 {523, nullptr, "IsJoyConRailEnabled"}, 1765 {523, nullptr, "IsJoyConRailEnabled"},
1766 {524, nullptr, "IsHandheldHidsEnabled"},
1767 {525, nullptr, "IsJoyConAttachedOnAllRail"},
1723 {540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"}, 1768 {540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"},
1724 {541, nullptr, "GetPlayReportControllerUsages"}, 1769 {541, nullptr, "GetPlayReportControllerUsages"},
1725 {542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"}, 1770 {542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"},
@@ -1795,6 +1840,65 @@ public:
1795 {1154, nullptr, "IsFirmwareAvailableForNotification"}, 1840 {1154, nullptr, "IsFirmwareAvailableForNotification"},
1796 {1155, nullptr, "SetForceHandheldStyleVibration"}, 1841 {1155, nullptr, "SetForceHandheldStyleVibration"},
1797 {1156, nullptr, "SendConnectionTriggerWithoutTimeoutEvent"}, 1842 {1156, nullptr, "SendConnectionTriggerWithoutTimeoutEvent"},
1843 {1157, nullptr, "CancelConnectionTrigger"},
1844 {1200, nullptr, "IsButtonConfigSupported"},
1845 {1201, nullptr, "IsButtonConfigEmbeddedSupported"},
1846 {1202, nullptr, "DeleteButtonConfig"},
1847 {1203, nullptr, "DeleteButtonConfigEmbedded"},
1848 {1204, nullptr, "SetButtonConfigEnabled"},
1849 {1205, nullptr, "SetButtonConfigEmbeddedEnabled"},
1850 {1206, nullptr, "IsButtonConfigEnabled"},
1851 {1207, nullptr, "IsButtonConfigEmbeddedEnabled"},
1852 {1208, nullptr, "SetButtonConfigEmbedded"},
1853 {1209, nullptr, "SetButtonConfigFull"},
1854 {1210, nullptr, "SetButtonConfigLeft"},
1855 {1211, nullptr, "SetButtonConfigRight"},
1856 {1212, nullptr, "GetButtonConfigEmbedded"},
1857 {1213, nullptr, "GetButtonConfigFull"},
1858 {1214, nullptr, "GetButtonConfigLeft"},
1859 {1215, nullptr, "GetButtonConfigRight"},
1860 {1250, nullptr, "IsCustomButtonConfigSupported"},
1861 {1251, nullptr, "IsDefaultButtonConfigEmbedded"},
1862 {1252, nullptr, "IsDefaultButtonConfigFull"},
1863 {1253, nullptr, "IsDefaultButtonConfigLeft"},
1864 {1254, nullptr, "IsDefaultButtonConfigRight"},
1865 {1255, nullptr, "IsButtonConfigStorageEmbeddedEmpty"},
1866 {1256, nullptr, "IsButtonConfigStorageFullEmpty"},
1867 {1257, nullptr, "IsButtonConfigStorageLeftEmpty"},
1868 {1258, nullptr, "IsButtonConfigStorageRightEmpty"},
1869 {1259, nullptr, "GetButtonConfigStorageEmbeddedDeprecated"},
1870 {1260, nullptr, "GetButtonConfigStorageFullDeprecated"},
1871 {1261, nullptr, "GetButtonConfigStorageLeftDeprecated"},
1872 {1262, nullptr, "GetButtonConfigStorageRightDeprecated"},
1873 {1263, nullptr, "SetButtonConfigStorageEmbeddedDeprecated"},
1874 {1264, nullptr, "SetButtonConfigStorageFullDeprecated"},
1875 {1265, nullptr, "SetButtonConfigStorageLeftDeprecated"},
1876 {1266, nullptr, "SetButtonConfigStorageRightDeprecated"},
1877 {1267, nullptr, "DeleteButtonConfigStorageEmbedded"},
1878 {1268, nullptr, "DeleteButtonConfigStorageFull"},
1879 {1269, nullptr, "DeleteButtonConfigStorageLeft"},
1880 {1270, nullptr, "DeleteButtonConfigStorageRight"},
1881 {1271, nullptr, "IsUsingCustomButtonConfig"},
1882 {1272, nullptr, "IsAnyCustomButtonConfigEnabled"},
1883 {1273, nullptr, "SetAllCustomButtonConfigEnabled"},
1884 {1274, nullptr, "SetDefaultButtonConfig"},
1885 {1275, nullptr, "SetAllDefaultButtonConfig"},
1886 {1276, nullptr, "SetHidButtonConfigEmbedded"},
1887 {1277, nullptr, "SetHidButtonConfigFull"},
1888 {1278, nullptr, "SetHidButtonConfigLeft"},
1889 {1279, nullptr, "SetHidButtonConfigRight"},
1890 {1280, nullptr, "GetHidButtonConfigEmbedded"},
1891 {1281, nullptr, "GetHidButtonConfigFull"},
1892 {1282, nullptr, "GetHidButtonConfigLeft"},
1893 {1283, nullptr, "GetHidButtonConfigRight"},
1894 {1284, nullptr, "GetButtonConfigStorageEmbedded"},
1895 {1285, nullptr, "GetButtonConfigStorageFull"},
1896 {1286, nullptr, "GetButtonConfigStorageLeft"},
1897 {1287, nullptr, "GetButtonConfigStorageRight"},
1898 {1288, nullptr, "SetButtonConfigStorageEmbedded"},
1899 {1289, nullptr, "SetButtonConfigStorageFull"},
1900 {1290, nullptr, "DeleteButtonConfigStorageRight"},
1901 {1291, nullptr, "DeleteButtonConfigStorageRight"},
1798 }; 1902 };
1799 // clang-format on 1903 // clang-format on
1800 1904
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index 36ed228c8..c2bdd39a3 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -129,6 +129,7 @@ private:
129 void SwapNpadAssignment(Kernel::HLERequestContext& ctx); 129 void SwapNpadAssignment(Kernel::HLERequestContext& ctx);
130 void IsUnintendedHomeButtonInputProtectionEnabled(Kernel::HLERequestContext& ctx); 130 void IsUnintendedHomeButtonInputProtectionEnabled(Kernel::HLERequestContext& ctx);
131 void EnableUnintendedHomeButtonInputProtection(Kernel::HLERequestContext& ctx); 131 void EnableUnintendedHomeButtonInputProtection(Kernel::HLERequestContext& ctx);
132 void SetNpadAnalogStickUseCenterClamp(Kernel::HLERequestContext& ctx);
132 void GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx); 133 void GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx);
133 void SendVibrationValue(Kernel::HLERequestContext& ctx); 134 void SendVibrationValue(Kernel::HLERequestContext& ctx);
134 void GetActualVibrationValue(Kernel::HLERequestContext& ctx); 135 void GetActualVibrationValue(Kernel::HLERequestContext& ctx);
diff --git a/src/core/hle/service/hid/xcd.cpp b/src/core/hle/service/hid/xcd.cpp
index 43a8840d0..b1efa3d05 100644
--- a/src/core/hle/service/hid/xcd.cpp
+++ b/src/core/hle/service/hid/xcd.cpp
@@ -28,6 +28,8 @@ XCD_SYS::XCD_SYS(Core::System& system_) : ServiceFramework{system_, "xcd:sys"} {
28 {20, nullptr, "StartMifareWrite"}, 28 {20, nullptr, "StartMifareWrite"},
29 {101, nullptr, "GetAwakeTriggerReasonForLeftRail"}, 29 {101, nullptr, "GetAwakeTriggerReasonForLeftRail"},
30 {102, nullptr, "GetAwakeTriggerReasonForRightRail"}, 30 {102, nullptr, "GetAwakeTriggerReasonForRightRail"},
31 {103, nullptr, "GetAwakeTriggerBatteryLevelTransitionForLeftRail"},
32 {104, nullptr, "GetAwakeTriggerBatteryLevelTransitionForRightRail"},
31 }; 33 };
32 // clang-format on 34 // clang-format on
33 35
diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp
index f3be0b878..fee360ab9 100644
--- a/src/core/hle/service/nim/nim.cpp
+++ b/src/core/hle/service/nim/nim.cpp
@@ -125,51 +125,51 @@ public:
125 {39, nullptr, "PrepareShutdown"}, 125 {39, nullptr, "PrepareShutdown"},
126 {40, nullptr, "ListApplyDeltaTask"}, 126 {40, nullptr, "ListApplyDeltaTask"},
127 {41, nullptr, "ClearNotEnoughSpaceStateOfApplyDeltaTask"}, 127 {41, nullptr, "ClearNotEnoughSpaceStateOfApplyDeltaTask"},
128 {42, nullptr, "Unknown42"}, 128 {42, nullptr, "CreateApplyDeltaTaskFromDownloadTask"},
129 {43, nullptr, "Unknown43"}, 129 {43, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"},
130 {44, nullptr, "Unknown44"}, 130 {44, nullptr, "GetApplyDeltaTaskRequiredStorage"},
131 {45, nullptr, "Unknown45"}, 131 {45, nullptr, "CalculateNetworkInstallTaskContentsSize"},
132 {46, nullptr, "Unknown46"}, 132 {46, nullptr, "PrepareShutdownForSystemUpdate"},
133 {47, nullptr, "Unknown47"}, 133 {47, nullptr, "FindMaxRequiredApplicationVersionOfTask"},
134 {48, nullptr, "Unknown48"}, 134 {48, nullptr, "CommitNetworkInstallTaskPartially"},
135 {49, nullptr, "Unknown49"}, 135 {49, nullptr, "ListNetworkInstallTaskCommittedContentMeta"},
136 {50, nullptr, "Unknown50"}, 136 {50, nullptr, "ListNetworkInstallTaskNotCommittedContentMeta"},
137 {51, nullptr, "Unknown51"}, 137 {51, nullptr, "FindMaxRequiredSystemVersionOfTask"},
138 {52, nullptr, "Unknown52"}, 138 {52, nullptr, "GetNetworkInstallTaskErrorContext"},
139 {53, nullptr, "Unknown53"}, 139 {53, nullptr, "CreateLocalCommunicationReceiveApplicationTask"},
140 {54, nullptr, "Unknown54"}, 140 {54, nullptr, "DestroyLocalCommunicationReceiveApplicationTask"},
141 {55, nullptr, "Unknown55"}, 141 {55, nullptr, "ListLocalCommunicationReceiveApplicationTask"},
142 {56, nullptr, "Unknown56"}, 142 {56, nullptr, "RequestLocalCommunicationReceiveApplicationTaskRun"},
143 {57, nullptr, "Unknown57"}, 143 {57, nullptr, "GetLocalCommunicationReceiveApplicationTaskInfo"},
144 {58, nullptr, "Unknown58"}, 144 {58, nullptr, "CommitLocalCommunicationReceiveApplicationTask"},
145 {59, nullptr, "Unknown59"}, 145 {59, nullptr, "ListLocalCommunicationReceiveApplicationTaskContentMeta"},
146 {60, nullptr, "Unknown60"}, 146 {60, nullptr, "CreateLocalCommunicationSendApplicationTask"},
147 {61, nullptr, "Unknown61"}, 147 {61, nullptr, "RequestLocalCommunicationSendApplicationTaskRun"},
148 {62, nullptr, "Unknown62"}, 148 {62, nullptr, "GetLocalCommunicationReceiveApplicationTaskErrorContext"},
149 {63, nullptr, "Unknown63"}, 149 {63, nullptr, "GetLocalCommunicationSendApplicationTaskInfo"},
150 {64, nullptr, "Unknown64"}, 150 {64, nullptr, "DestroyLocalCommunicationSendApplicationTask"},
151 {65, nullptr, "Unknown65"}, 151 {65, nullptr, "GetLocalCommunicationSendApplicationTaskErrorContext"},
152 {66, nullptr, "Unknown66"}, 152 {66, nullptr, "CalculateLocalCommunicationReceiveApplicationTaskRequiredSize"},
153 {67, nullptr, "Unknown67"}, 153 {67, nullptr, "ListApplicationLocalCommunicationReceiveApplicationTask"},
154 {68, nullptr, "Unknown68"}, 154 {68, nullptr, "ListApplicationLocalCommunicationSendApplicationTask"},
155 {69, nullptr, "Unknown69"}, 155 {69, nullptr, "CreateLocalCommunicationReceiveSystemUpdateTask"},
156 {70, nullptr, "Unknown70"}, 156 {70, nullptr, "DestroyLocalCommunicationReceiveSystemUpdateTask"},
157 {71, nullptr, "Unknown71"}, 157 {71, nullptr, "ListLocalCommunicationReceiveSystemUpdateTask"},
158 {72, nullptr, "Unknown72"}, 158 {72, nullptr, "RequestLocalCommunicationReceiveSystemUpdateTaskRun"},
159 {73, nullptr, "Unknown73"}, 159 {73, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskInfo"},
160 {74, nullptr, "Unknown74"}, 160 {74, nullptr, "CommitLocalCommunicationReceiveSystemUpdateTask"},
161 {75, nullptr, "Unknown75"}, 161 {75, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskErrorContext"},
162 {76, nullptr, "Unknown76"}, 162 {76, nullptr, "CreateLocalCommunicationSendSystemUpdateTask"},
163 {77, nullptr, "Unknown77"}, 163 {77, nullptr, "RequestLocalCommunicationSendSystemUpdateTaskRun"},
164 {78, nullptr, "Unknown78"}, 164 {78, nullptr, "GetLocalCommunicationSendSystemUpdateTaskInfo"},
165 {79, nullptr, "Unknown79"}, 165 {79, nullptr, "DestroyLocalCommunicationSendSystemUpdateTask"},
166 {80, nullptr, "Unknown80"}, 166 {80, nullptr, "GetLocalCommunicationSendSystemUpdateTaskErrorContext"},
167 {81, nullptr, "Unknown81"}, 167 {81, nullptr, "ListLocalCommunicationSendSystemUpdateTask"},
168 {82, nullptr, "Unknown82"}, 168 {82, nullptr, "GetReceivedSystemDataPath"},
169 {83, nullptr, "Unknown83"}, 169 {83, nullptr, "CalculateApplyDeltaTaskOccupiedSize"},
170 {84, nullptr, "Unknown84"}, 170 {84, nullptr, "Unknown84"},
171 {85, nullptr, "Unknown85"}, 171 {85, nullptr, "ListNetworkInstallTaskContentMetaFromInstallMeta"},
172 {86, nullptr, "Unknown86"}, 172 {86, nullptr, "ListNetworkInstallTaskOccupiedSize"},
173 {87, nullptr, "Unknown87"}, 173 {87, nullptr, "Unknown87"},
174 {88, nullptr, "Unknown88"}, 174 {88, nullptr, "Unknown88"},
175 {89, nullptr, "Unknown89"}, 175 {89, nullptr, "Unknown89"},
@@ -202,6 +202,17 @@ public:
202 {116, nullptr, "Unknown116"}, 202 {116, nullptr, "Unknown116"},
203 {117, nullptr, "Unknown117"}, 203 {117, nullptr, "Unknown117"},
204 {118, nullptr, "Unknown118"}, 204 {118, nullptr, "Unknown118"},
205 {119, nullptr, "Unknown119"},
206 {120, nullptr, "Unknown120"},
207 {121, nullptr, "Unknown121"},
208 {122, nullptr, "Unknown122"},
209 {123, nullptr, "Unknown123"},
210 {124, nullptr, "Unknown124"},
211 {125, nullptr, "Unknown125"},
212 {126, nullptr, "Unknown126"},
213 {127, nullptr, "Unknown127"},
214 {128, nullptr, "Unknown128"},
215 {129, nullptr, "Unknown129"},
205 }; 216 };
206 // clang-format on 217 // clang-format on
207 218
diff --git a/src/core/hle/service/npns/npns.cpp b/src/core/hle/service/npns/npns.cpp
index f7a58f659..e4c703da4 100644
--- a/src/core/hle/service/npns/npns.cpp
+++ b/src/core/hle/service/npns/npns.cpp
@@ -49,6 +49,8 @@ public:
49 {151, nullptr, "GetStateWithHandover"}, 49 {151, nullptr, "GetStateWithHandover"},
50 {152, nullptr, "GetStateChangeEventWithHandover"}, 50 {152, nullptr, "GetStateChangeEventWithHandover"},
51 {153, nullptr, "GetDropEventWithHandover"}, 51 {153, nullptr, "GetDropEventWithHandover"},
52 {154, nullptr, "CreateTokenAsync"},
53 {155, nullptr, "CreateTokenAsyncWithApplicationId"},
52 {161, nullptr, "GetRequestChangeStateCancelEvent"}, 54 {161, nullptr, "GetRequestChangeStateCancelEvent"},
53 {162, nullptr, "RequestChangeStateForceTimedWithCancelEvent"}, 55 {162, nullptr, "RequestChangeStateForceTimedWithCancelEvent"},
54 {201, nullptr, "RequestChangeStateForceTimed"}, 56 {201, nullptr, "RequestChangeStateForceTimed"},
@@ -84,6 +86,7 @@ public:
84 {151, nullptr, "GetStateWithHandover"}, 86 {151, nullptr, "GetStateWithHandover"},
85 {152, nullptr, "GetStateChangeEventWithHandover"}, 87 {152, nullptr, "GetStateChangeEventWithHandover"},
86 {153, nullptr, "GetDropEventWithHandover"}, 88 {153, nullptr, "GetDropEventWithHandover"},
89 {154, nullptr, "CreateTokenAsync"},
87 }; 90 };
88 // clang-format on 91 // clang-format on
89 92
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp
index 6ccf8995c..5fe7a9189 100644
--- a/src/core/hle/service/ns/ns.cpp
+++ b/src/core/hle/service/ns/ns.cpp
@@ -55,6 +55,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
55 {26, nullptr, "BeginInstallApplication"}, 55 {26, nullptr, "BeginInstallApplication"},
56 {27, nullptr, "DeleteApplicationRecord"}, 56 {27, nullptr, "DeleteApplicationRecord"},
57 {30, nullptr, "RequestApplicationUpdateInfo"}, 57 {30, nullptr, "RequestApplicationUpdateInfo"},
58 {31, nullptr, "Unknown31"},
58 {32, nullptr, "CancelApplicationDownload"}, 59 {32, nullptr, "CancelApplicationDownload"},
59 {33, nullptr, "ResumeApplicationDownload"}, 60 {33, nullptr, "ResumeApplicationDownload"},
60 {35, nullptr, "UpdateVersionList"}, 61 {35, nullptr, "UpdateVersionList"},
@@ -182,6 +183,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
182 {913, nullptr, "ListAllApplicationRecord"}, 183 {913, nullptr, "ListAllApplicationRecord"},
183 {914, nullptr, "HideApplicationRecord"}, 184 {914, nullptr, "HideApplicationRecord"},
184 {915, nullptr, "ShowApplicationRecord"}, 185 {915, nullptr, "ShowApplicationRecord"},
186 {916, nullptr, "IsApplicationAutoDeleteDisabled"},
185 {1000, nullptr, "RequestVerifyApplicationDeprecated"}, 187 {1000, nullptr, "RequestVerifyApplicationDeprecated"},
186 {1001, nullptr, "CorruptApplicationForDebug"}, 188 {1001, nullptr, "CorruptApplicationForDebug"},
187 {1002, nullptr, "RequestVerifyAddOnContentsRights"}, 189 {1002, nullptr, "RequestVerifyAddOnContentsRights"},
@@ -201,6 +203,8 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
201 {1310, nullptr, "RequestMoveApplicationEntity"}, 203 {1310, nullptr, "RequestMoveApplicationEntity"},
202 {1311, nullptr, "EstimateSizeToMove"}, 204 {1311, nullptr, "EstimateSizeToMove"},
203 {1312, nullptr, "HasMovableEntity"}, 205 {1312, nullptr, "HasMovableEntity"},
206 {1313, nullptr, "CleanupOrphanContents"},
207 {1314, nullptr, "CheckPreconditionSatisfiedToMove"},
204 {1400, nullptr, "PrepareShutdown"}, 208 {1400, nullptr, "PrepareShutdown"},
205 {1500, nullptr, "FormatSdCard"}, 209 {1500, nullptr, "FormatSdCard"},
206 {1501, nullptr, "NeedsSystemUpdateToFormatSdCard"}, 210 {1501, nullptr, "NeedsSystemUpdateToFormatSdCard"},
@@ -215,6 +219,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
215 {1702, nullptr, "GetApplicationDownloadTaskStatus"}, 219 {1702, nullptr, "GetApplicationDownloadTaskStatus"},
216 {1703, nullptr, "GetApplicationViewDownloadErrorContext"}, 220 {1703, nullptr, "GetApplicationViewDownloadErrorContext"},
217 {1704, nullptr, "GetApplicationViewWithPromotionInfo"}, 221 {1704, nullptr, "GetApplicationViewWithPromotionInfo"},
222 {1705, nullptr, "IsPatchAutoDeletableApplication"},
218 {1800, nullptr, "IsNotificationSetupCompleted"}, 223 {1800, nullptr, "IsNotificationSetupCompleted"},
219 {1801, nullptr, "GetLastNotificationInfoCount"}, 224 {1801, nullptr, "GetLastNotificationInfoCount"},
220 {1802, nullptr, "ListLastNotificationInfo"}, 225 {1802, nullptr, "ListLastNotificationInfo"},
@@ -269,6 +274,9 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
269 {2351, nullptr, "RequestNoDownloadRightsErrorResolution"}, 274 {2351, nullptr, "RequestNoDownloadRightsErrorResolution"},
270 {2352, nullptr, "RequestResolveNoDownloadRightsError"}, 275 {2352, nullptr, "RequestResolveNoDownloadRightsError"},
271 {2353, nullptr, "GetApplicationDownloadTaskInfo"}, 276 {2353, nullptr, "GetApplicationDownloadTaskInfo"},
277 {2354, nullptr, "PrioritizeApplicationBackgroundTask"},
278 {2355, nullptr, "Unknown2355"},
279 {2356, nullptr, "Unknown2356"},
272 {2400, nullptr, "GetPromotionInfo"}, 280 {2400, nullptr, "GetPromotionInfo"},
273 {2401, nullptr, "CountPromotionInfo"}, 281 {2401, nullptr, "CountPromotionInfo"},
274 {2402, nullptr, "ListPromotionInfo"}, 282 {2402, nullptr, "ListPromotionInfo"},
@@ -282,6 +290,21 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_
282 {2515, nullptr, "CleanupAllPlaceHolderAndFragmentsIfNoTask"}, 290 {2515, nullptr, "CleanupAllPlaceHolderAndFragmentsIfNoTask"},
283 {2516, nullptr, "EnsureApplicationCertificate"}, 291 {2516, nullptr, "EnsureApplicationCertificate"},
284 {2800, nullptr, "GetApplicationIdOfPreomia"}, 292 {2800, nullptr, "GetApplicationIdOfPreomia"},
293 {3000, nullptr, "RegisterDeviceLockKey"},
294 {3001, nullptr, "UnregisterDeviceLockKey"},
295 {3002, nullptr, "VerifyDeviceLockKey"},
296 {3003, nullptr, "HideApplicationIcon"},
297 {3004, nullptr, "ShowApplicationIcon"},
298 {3005, nullptr, "HideApplicationTitle"},
299 {3006, nullptr, "ShowApplicationTitle"},
300 {3007, nullptr, "EnableGameCard"},
301 {3008, nullptr, "DisableGameCard"},
302 {3009, nullptr, "EnableLocalContentShare"},
303 {3010, nullptr, "DisableLocalContentShare"},
304 {3011, nullptr, "IsApplicationIconHidden"},
305 {3012, nullptr, "IsApplicationTitleHidden"},
306 {3013, nullptr, "IsGameCardEnabled"},
307 {3014, nullptr, "IsLocalContentShareEnabled"},
285 {9999, nullptr, "GetApplicationCertificate"}, 308 {9999, nullptr, "GetApplicationCertificate"},
286 }; 309 };
287 // clang-format on 310 // clang-format on
@@ -441,7 +464,11 @@ IApplicationVersionInterface::IApplicationVersionInterface(Core::System& system_
441 {800, nullptr, "RequestVersionList"}, 464 {800, nullptr, "RequestVersionList"},
442 {801, nullptr, "ListVersionList"}, 465 {801, nullptr, "ListVersionList"},
443 {802, nullptr, "RequestVersionListData"}, 466 {802, nullptr, "RequestVersionListData"},
467 {900, nullptr, "ImportAutoUpdatePolicyJsonForDebug"},
468 {901, nullptr, "ListDefaultAutoUpdatePolicy"},
469 {902, nullptr, "ListAutoUpdatePolicyForSpecificApplication"},
444 {1000, nullptr, "PerformAutoUpdate"}, 470 {1000, nullptr, "PerformAutoUpdate"},
471 {1001, nullptr, "ListAutoUpdateSchedule"},
445 }; 472 };
446 // clang-format on 473 // clang-format on
447 474
@@ -547,6 +574,9 @@ IFactoryResetInterface::~IFactoryResetInterface() = default;
547NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name} { 574NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name} {
548 // clang-format off 575 // clang-format off
549 static const FunctionInfo functions[] = { 576 static const FunctionInfo functions[] = {
577 {7988, nullptr, "GetDynamicRightsInterface"},
578 {7989, nullptr, "GetReadOnlyApplicationControlDataInterface"},
579 {7991, nullptr, "GetReadOnlyApplicationRecordInterface"},
550 {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"}, 580 {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"},
551 {7993, &NS::PushInterface<IApplicationVersionInterface>, "GetApplicationVersionInterface"}, 581 {7993, &NS::PushInterface<IApplicationVersionInterface>, "GetApplicationVersionInterface"},
552 {7994, &NS::PushInterface<IFactoryResetInterface>, "GetFactoryResetInterface"}, 582 {7994, &NS::PushInterface<IFactoryResetInterface>, "GetFactoryResetInterface"},
@@ -575,18 +605,22 @@ public:
575 {0, nullptr, "LaunchProgram"}, 605 {0, nullptr, "LaunchProgram"},
576 {1, nullptr, "TerminateProcess"}, 606 {1, nullptr, "TerminateProcess"},
577 {2, nullptr, "TerminateProgram"}, 607 {2, nullptr, "TerminateProgram"},
578 {4, nullptr, "GetShellEventHandle"}, 608 {4, nullptr, "GetShellEvent"},
579 {5, nullptr, "GetShellEventInfo"}, 609 {5, nullptr, "GetShellEventInfo"},
580 {6, nullptr, "TerminateApplication"}, 610 {6, nullptr, "TerminateApplication"},
581 {7, nullptr, "PrepareLaunchProgramFromHost"}, 611 {7, nullptr, "PrepareLaunchProgramFromHost"},
582 {8, nullptr, "LaunchApplication"}, 612 {8, nullptr, "LaunchApplicationFromHost"},
583 {9, nullptr, "LaunchApplicationWithStorageIdForDevelop"}, 613 {9, nullptr, "LaunchApplicationWithStorageIdForDevelop"},
584 {10, nullptr, "IsSystemMemoryResourceLimitBoosted"}, 614 {10, nullptr, "IsSystemMemoryResourceLimitBoosted"},
585 {11, nullptr, "GetRunningApplicationProcessIdForDevelop"}, 615 {11, nullptr, "GetRunningApplicationProcessIdForDevelop"},
586 {12, nullptr, "SetCurrentApplicationRightsEnvironmentCanBeActive"}, 616 {12, nullptr, "SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop"},
587 {13, nullptr, "CreateApplicationResourceForDevelop"}, 617 {13, nullptr, "CreateApplicationResourceForDevelop"},
588 {14, nullptr, "IsPreomiaForDevelop"}, 618 {14, nullptr, "IsPreomiaForDevelop"},
589 {15, nullptr, "GetApplicationProgramIdFromHost"}, 619 {15, nullptr, "GetApplicationProgramIdFromHost"},
620 {16, nullptr, "RefreshCachedDebugValues"},
621 {17, nullptr, "PrepareLaunchApplicationFromHost"},
622 {18, nullptr, "GetLaunchEvent"},
623 {19, nullptr, "GetLaunchResult"},
590 }; 624 };
591 // clang-format on 625 // clang-format on
592 626
@@ -699,6 +733,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system
699 std::make_shared<NS>("ns:rid", system)->InstallAsService(service_manager); 733 std::make_shared<NS>("ns:rid", system)->InstallAsService(service_manager);
700 std::make_shared<NS>("ns:rt", system)->InstallAsService(service_manager); 734 std::make_shared<NS>("ns:rt", system)->InstallAsService(service_manager);
701 std::make_shared<NS>("ns:web", system)->InstallAsService(service_manager); 735 std::make_shared<NS>("ns:web", system)->InstallAsService(service_manager);
736 std::make_shared<NS>("ns:ro", system)->InstallAsService(service_manager);
702 737
703 std::make_shared<NS_DEV>(system)->InstallAsService(service_manager); 738 std::make_shared<NS_DEV>(system)->InstallAsService(service_manager);
704 std::make_shared<NS_SU>(system)->InstallAsService(service_manager); 739 std::make_shared<NS_SU>(system)->InstallAsService(service_manager);
diff --git a/src/core/hle/service/nvdrv/devices/nvdevice.h b/src/core/hle/service/nvdrv/devices/nvdevice.h
index 5681599ba..b37f023df 100644
--- a/src/core/hle/service/nvdrv/devices/nvdevice.h
+++ b/src/core/hle/service/nvdrv/devices/nvdevice.h
@@ -31,7 +31,7 @@ public:
31 * @param output A buffer where the output data will be written to. 31 * @param output A buffer where the output data will be written to.
32 * @returns The result code of the ioctl. 32 * @returns The result code of the ioctl.
33 */ 33 */
34 virtual NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, 34 virtual NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
35 std::vector<u8>& output) = 0; 35 std::vector<u8>& output) = 0;
36 36
37 /** 37 /**
@@ -42,7 +42,7 @@ public:
42 * @param output A buffer where the output data will be written to. 42 * @param output A buffer where the output data will be written to.
43 * @returns The result code of the ioctl. 43 * @returns The result code of the ioctl.
44 */ 44 */
45 virtual NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, 45 virtual NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
46 const std::vector<u8>& inline_input, std::vector<u8>& output) = 0; 46 const std::vector<u8>& inline_input, std::vector<u8>& output) = 0;
47 47
48 /** 48 /**
@@ -53,8 +53,20 @@ public:
53 * @param inline_output A buffer where the inlined output data will be written to. 53 * @param inline_output A buffer where the inlined output data will be written to.
54 * @returns The result code of the ioctl. 54 * @returns The result code of the ioctl.
55 */ 55 */
56 virtual NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 56 virtual NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
57 std::vector<u8>& inline_output) = 0; 57 std::vector<u8>& output, std::vector<u8>& inline_output) = 0;
58
59 /**
60 * Called once a device is openned
61 * @param fd The device fd
62 */
63 virtual void OnOpen(DeviceFD fd) = 0;
64
65 /**
66 * Called once a device is closed
67 * @param fd The device fd
68 */
69 virtual void OnClose(DeviceFD fd) = 0;
58 70
59protected: 71protected:
60 Core::System& system; 72 Core::System& system;
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
index ce615c758..5ab7e39b0 100644
--- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
@@ -18,24 +18,27 @@ nvdisp_disp0::nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_de
18 : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} 18 : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {}
19nvdisp_disp0 ::~nvdisp_disp0() = default; 19nvdisp_disp0 ::~nvdisp_disp0() = default;
20 20
21NvResult nvdisp_disp0::Ioctl1(Ioctl command, const std::vector<u8>& input, 21NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
22 std::vector<u8>& output) { 22 std::vector<u8>& output) {
23 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 23 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
24 return NvResult::NotImplemented; 24 return NvResult::NotImplemented;
25} 25}
26 26
27NvResult nvdisp_disp0::Ioctl2(Ioctl command, const std::vector<u8>& input, 27NvResult nvdisp_disp0::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
28 const std::vector<u8>& inline_input, std::vector<u8>& output) { 28 const std::vector<u8>& inline_input, std::vector<u8>& output) {
29 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 29 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
30 return NvResult::NotImplemented; 30 return NvResult::NotImplemented;
31} 31}
32 32
33NvResult nvdisp_disp0::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 33NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
34 std::vector<u8>& inline_output) { 34 std::vector<u8>& output, std::vector<u8>& inline_output) {
35 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 35 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
36 return NvResult::NotImplemented; 36 return NvResult::NotImplemented;
37} 37}
38 38
39void nvdisp_disp0::OnOpen(DeviceFD fd) {}
40void nvdisp_disp0::OnClose(DeviceFD fd) {}
41
39void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, 42void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height,
40 u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform, 43 u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform,
41 const Common::Rectangle<int>& crop_rect) { 44 const Common::Rectangle<int>& crop_rect) {
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
index 55a33b7e4..59c9b6101 100644
--- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
+++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
@@ -20,11 +20,15 @@ public:
20 explicit nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_dev); 20 explicit nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_dev);
21 ~nvdisp_disp0() override; 21 ~nvdisp_disp0() override;
22 22
23 NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; 23 NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
24 NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, 24 std::vector<u8>& output) override;
25 NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
25 const std::vector<u8>& inline_input, std::vector<u8>& output) override; 26 const std::vector<u8>& inline_input, std::vector<u8>& output) override;
26 NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 27 NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
27 std::vector<u8>& inline_output) override; 28 std::vector<u8>& output, std::vector<u8>& inline_output) override;
29
30 void OnOpen(DeviceFD fd) override;
31 void OnClose(DeviceFD fd) override;
28 32
29 /// Performs a screen flip, drawing the buffer pointed to by the handle. 33 /// Performs a screen flip, drawing the buffer pointed to by the handle.
30 void flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, u32 stride, 34 void flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, u32 stride,
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
index 485ac5f50..f7b3dc317 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
@@ -21,7 +21,7 @@ nvhost_as_gpu::nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_
21 : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {} 21 : nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {}
22nvhost_as_gpu::~nvhost_as_gpu() = default; 22nvhost_as_gpu::~nvhost_as_gpu() = default;
23 23
24NvResult nvhost_as_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, 24NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
25 std::vector<u8>& output) { 25 std::vector<u8>& output) {
26 switch (command.group) { 26 switch (command.group) {
27 case 'A': 27 case 'A':
@@ -54,14 +54,14 @@ NvResult nvhost_as_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input,
54 return NvResult::NotImplemented; 54 return NvResult::NotImplemented;
55} 55}
56 56
57NvResult nvhost_as_gpu::Ioctl2(Ioctl command, const std::vector<u8>& input, 57NvResult nvhost_as_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
58 const std::vector<u8>& inline_input, std::vector<u8>& output) { 58 const std::vector<u8>& inline_input, std::vector<u8>& output) {
59 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 59 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
60 return NvResult::NotImplemented; 60 return NvResult::NotImplemented;
61} 61}
62 62
63NvResult nvhost_as_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 63NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
64 std::vector<u8>& inline_output) { 64 std::vector<u8>& output, std::vector<u8>& inline_output) {
65 switch (command.group) { 65 switch (command.group) {
66 case 'A': 66 case 'A':
67 switch (command.cmd) { 67 switch (command.cmd) {
@@ -78,6 +78,9 @@ NvResult nvhost_as_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input, std:
78 return NvResult::NotImplemented; 78 return NvResult::NotImplemented;
79} 79}
80 80
81void nvhost_as_gpu::OnOpen(DeviceFD fd) {}
82void nvhost_as_gpu::OnClose(DeviceFD fd) {}
83
81NvResult nvhost_as_gpu::AllocAsEx(const std::vector<u8>& input, std::vector<u8>& output) { 84NvResult nvhost_as_gpu::AllocAsEx(const std::vector<u8>& input, std::vector<u8>& output) {
82 IoctlAllocAsEx params{}; 85 IoctlAllocAsEx params{};
83 std::memcpy(&params, input.data(), input.size()); 86 std::memcpy(&params, input.data(), input.size());
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
index 9ee60e060..d86a9cab6 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
@@ -33,11 +33,15 @@ public:
33 explicit nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev); 33 explicit nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev);
34 ~nvhost_as_gpu() override; 34 ~nvhost_as_gpu() override;
35 35
36 NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; 36 NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
37 NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, 37 std::vector<u8>& output) override;
38 NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
38 const std::vector<u8>& inline_input, std::vector<u8>& output) override; 39 const std::vector<u8>& inline_input, std::vector<u8>& output) override;
39 NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 40 NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
40 std::vector<u8>& inline_output) override; 41 std::vector<u8>& output, std::vector<u8>& inline_output) override;
42
43 void OnOpen(DeviceFD fd) override;
44 void OnClose(DeviceFD fd) override;
41 45
42private: 46private:
43 class BufferMap final { 47 class BufferMap final {
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
index f6129ef10..9f00d5cb0 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
@@ -20,7 +20,8 @@ nvhost_ctrl::nvhost_ctrl(Core::System& system, EventInterface& events_interface,
20 : nvdevice(system), events_interface{events_interface}, syncpoint_manager{syncpoint_manager} {} 20 : nvdevice(system), events_interface{events_interface}, syncpoint_manager{syncpoint_manager} {}
21nvhost_ctrl::~nvhost_ctrl() = default; 21nvhost_ctrl::~nvhost_ctrl() = default;
22 22
23NvResult nvhost_ctrl::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { 23NvResult nvhost_ctrl::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
24 std::vector<u8>& output) {
24 switch (command.group) { 25 switch (command.group) {
25 case 0x0: 26 case 0x0:
26 switch (command.cmd) { 27 switch (command.cmd) {
@@ -46,18 +47,21 @@ NvResult nvhost_ctrl::Ioctl1(Ioctl command, const std::vector<u8>& input, std::v
46 return NvResult::NotImplemented; 47 return NvResult::NotImplemented;
47} 48}
48 49
49NvResult nvhost_ctrl::Ioctl2(Ioctl command, const std::vector<u8>& input, 50NvResult nvhost_ctrl::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
50 const std::vector<u8>& inline_input, std::vector<u8>& output) { 51 const std::vector<u8>& inline_input, std::vector<u8>& output) {
51 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 52 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
52 return NvResult::NotImplemented; 53 return NvResult::NotImplemented;
53} 54}
54 55
55NvResult nvhost_ctrl::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 56NvResult nvhost_ctrl::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
56 std::vector<u8>& inline_outpu) { 57 std::vector<u8>& output, std::vector<u8>& inline_outpu) {
57 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 58 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
58 return NvResult::NotImplemented; 59 return NvResult::NotImplemented;
59} 60}
60 61
62void nvhost_ctrl::OnOpen(DeviceFD fd) {}
63void nvhost_ctrl::OnClose(DeviceFD fd) {}
64
61NvResult nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) { 65NvResult nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) {
62 IocGetConfigParams params{}; 66 IocGetConfigParams params{};
63 std::memcpy(&params, input.data(), sizeof(params)); 67 std::memcpy(&params, input.data(), sizeof(params));
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h
index c5aa1362a..9178789c3 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h
@@ -18,11 +18,15 @@ public:
18 SyncpointManager& syncpoint_manager); 18 SyncpointManager& syncpoint_manager);
19 ~nvhost_ctrl() override; 19 ~nvhost_ctrl() override;
20 20
21 NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; 21 NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
22 NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, 22 std::vector<u8>& output) override;
23 NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
23 const std::vector<u8>& inline_input, std::vector<u8>& output) override; 24 const std::vector<u8>& inline_input, std::vector<u8>& output) override;
24 NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 25 NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
25 std::vector<u8>& inline_output) override; 26 std::vector<u8>& output, std::vector<u8>& inline_output) override;
27
28 void OnOpen(DeviceFD fd) override;
29 void OnClose(DeviceFD fd) override;
26 30
27private: 31private:
28 struct IocSyncptReadParams { 32 struct IocSyncptReadParams {
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp
index 0320d3ae2..2edd803f3 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp
@@ -15,7 +15,7 @@ namespace Service::Nvidia::Devices {
15nvhost_ctrl_gpu::nvhost_ctrl_gpu(Core::System& system) : nvdevice(system) {} 15nvhost_ctrl_gpu::nvhost_ctrl_gpu(Core::System& system) : nvdevice(system) {}
16nvhost_ctrl_gpu::~nvhost_ctrl_gpu() = default; 16nvhost_ctrl_gpu::~nvhost_ctrl_gpu() = default;
17 17
18NvResult nvhost_ctrl_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, 18NvResult nvhost_ctrl_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
19 std::vector<u8>& output) { 19 std::vector<u8>& output) {
20 switch (command.group) { 20 switch (command.group) {
21 case 'G': 21 case 'G':
@@ -47,13 +47,13 @@ NvResult nvhost_ctrl_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input,
47 return NvResult::NotImplemented; 47 return NvResult::NotImplemented;
48} 48}
49 49
50NvResult nvhost_ctrl_gpu::Ioctl2(Ioctl command, const std::vector<u8>& input, 50NvResult nvhost_ctrl_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
51 const std::vector<u8>& inline_input, std::vector<u8>& output) { 51 const std::vector<u8>& inline_input, std::vector<u8>& output) {
52 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 52 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
53 return NvResult::NotImplemented; 53 return NvResult::NotImplemented;
54} 54}
55 55
56NvResult nvhost_ctrl_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input, 56NvResult nvhost_ctrl_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
57 std::vector<u8>& output, std::vector<u8>& inline_output) { 57 std::vector<u8>& output, std::vector<u8>& inline_output) {
58 switch (command.group) { 58 switch (command.group) {
59 case 'G': 59 case 'G':
@@ -73,6 +73,9 @@ NvResult nvhost_ctrl_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input,
73 return NvResult::NotImplemented; 73 return NvResult::NotImplemented;
74} 74}
75 75
76void nvhost_ctrl_gpu::OnOpen(DeviceFD fd) {}
77void nvhost_ctrl_gpu::OnClose(DeviceFD fd) {}
78
76NvResult nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, 79NvResult nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input,
77 std::vector<u8>& output) { 80 std::vector<u8>& output) {
78 LOG_DEBUG(Service_NVDRV, "called"); 81 LOG_DEBUG(Service_NVDRV, "called");
@@ -245,7 +248,13 @@ NvResult nvhost_ctrl_gpu::ZBCSetTable(const std::vector<u8>& input, std::vector<
245 IoctlZbcSetTable params{}; 248 IoctlZbcSetTable params{};
246 std::memcpy(&params, input.data(), input.size()); 249 std::memcpy(&params, input.data(), input.size());
247 // TODO(ogniK): What does this even actually do? 250 // TODO(ogniK): What does this even actually do?
248 std::memcpy(output.data(), &params, output.size()); 251
252 // Prevent null pointer being passed as arg 1
253 if (output.empty()) {
254 LOG_WARNING(Service_NVDRV, "Avoiding passing null pointer to memcpy");
255 } else {
256 std::memcpy(output.data(), &params, output.size());
257 }
249 return NvResult::Success; 258 return NvResult::Success;
250} 259}
251 260
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h
index 137b88238..f98aa841a 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h
@@ -16,11 +16,15 @@ public:
16 explicit nvhost_ctrl_gpu(Core::System& system); 16 explicit nvhost_ctrl_gpu(Core::System& system);
17 ~nvhost_ctrl_gpu() override; 17 ~nvhost_ctrl_gpu() override;
18 18
19 NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; 19 NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
20 NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, 20 std::vector<u8>& output) override;
21 NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
21 const std::vector<u8>& inline_input, std::vector<u8>& output) override; 22 const std::vector<u8>& inline_input, std::vector<u8>& output) override;
22 NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 23 NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
23 std::vector<u8>& inline_output) override; 24 std::vector<u8>& output, std::vector<u8>& inline_output) override;
25
26 void OnOpen(DeviceFD fd) override;
27 void OnClose(DeviceFD fd) override;
24 28
25private: 29private:
26 struct IoctlGpuCharacteristics { 30 struct IoctlGpuCharacteristics {
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
index af8b3d9f1..e83aaa798 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
@@ -23,7 +23,8 @@ nvhost_gpu::nvhost_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev,
23 23
24nvhost_gpu::~nvhost_gpu() = default; 24nvhost_gpu::~nvhost_gpu() = default;
25 25
26NvResult nvhost_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { 26NvResult nvhost_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
27 std::vector<u8>& output) {
27 switch (command.group) { 28 switch (command.group) {
28 case 0x0: 29 case 0x0:
29 switch (command.cmd) { 30 switch (command.cmd) {
@@ -74,7 +75,7 @@ NvResult nvhost_gpu::Ioctl1(Ioctl command, const std::vector<u8>& input, std::ve
74 return NvResult::NotImplemented; 75 return NvResult::NotImplemented;
75}; 76};
76 77
77NvResult nvhost_gpu::Ioctl2(Ioctl command, const std::vector<u8>& input, 78NvResult nvhost_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
78 const std::vector<u8>& inline_input, std::vector<u8>& output) { 79 const std::vector<u8>& inline_input, std::vector<u8>& output) {
79 switch (command.group) { 80 switch (command.group) {
80 case 'H': 81 case 'H':
@@ -88,12 +89,15 @@ NvResult nvhost_gpu::Ioctl2(Ioctl command, const std::vector<u8>& input,
88 return NvResult::NotImplemented; 89 return NvResult::NotImplemented;
89} 90}
90 91
91NvResult nvhost_gpu::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 92NvResult nvhost_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
92 std::vector<u8>& inline_output) { 93 std::vector<u8>& output, std::vector<u8>& inline_output) {
93 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 94 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
94 return NvResult::NotImplemented; 95 return NvResult::NotImplemented;
95} 96}
96 97
98void nvhost_gpu::OnOpen(DeviceFD fd) {}
99void nvhost_gpu::OnClose(DeviceFD fd) {}
100
97NvResult nvhost_gpu::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { 101NvResult nvhost_gpu::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) {
98 IoctlSetNvmapFD params{}; 102 IoctlSetNvmapFD params{};
99 std::memcpy(&params, input.data(), input.size()); 103 std::memcpy(&params, input.data(), input.size());
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
index e0298b4fe..12a1a1133 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
@@ -26,11 +26,15 @@ public:
26 SyncpointManager& syncpoint_manager); 26 SyncpointManager& syncpoint_manager);
27 ~nvhost_gpu() override; 27 ~nvhost_gpu() override;
28 28
29 NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; 29 NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
30 NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, 30 std::vector<u8>& output) override;
31 NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
31 const std::vector<u8>& inline_input, std::vector<u8>& output) override; 32 const std::vector<u8>& inline_input, std::vector<u8>& output) override;
32 NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 33 NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
33 std::vector<u8>& inline_output) override; 34 std::vector<u8>& output, std::vector<u8>& inline_output) override;
35
36 void OnOpen(DeviceFD fd) override;
37 void OnClose(DeviceFD fd) override;
34 38
35private: 39private:
36 enum class CtxObjects : u32_le { 40 enum class CtxObjects : u32_le {
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
index ecba1dba1..c8031970b 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp
@@ -16,7 +16,7 @@ nvhost_nvdec::nvhost_nvdec(Core::System& system, std::shared_ptr<nvmap> nvmap_de
16 : nvhost_nvdec_common(system, std::move(nvmap_dev), syncpoint_manager) {} 16 : nvhost_nvdec_common(system, std::move(nvmap_dev), syncpoint_manager) {}
17nvhost_nvdec::~nvhost_nvdec() = default; 17nvhost_nvdec::~nvhost_nvdec() = default;
18 18
19NvResult nvhost_nvdec::Ioctl1(Ioctl command, const std::vector<u8>& input, 19NvResult nvhost_nvdec::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
20 std::vector<u8>& output) { 20 std::vector<u8>& output) {
21 switch (command.group) { 21 switch (command.group) {
22 case 0x0: 22 case 0x0:
@@ -57,16 +57,19 @@ NvResult nvhost_nvdec::Ioctl1(Ioctl command, const std::vector<u8>& input,
57 return NvResult::NotImplemented; 57 return NvResult::NotImplemented;
58} 58}
59 59
60NvResult nvhost_nvdec::Ioctl2(Ioctl command, const std::vector<u8>& input, 60NvResult nvhost_nvdec::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
61 const std::vector<u8>& inline_input, std::vector<u8>& output) { 61 const std::vector<u8>& inline_input, std::vector<u8>& output) {
62 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 62 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
63 return NvResult::NotImplemented; 63 return NvResult::NotImplemented;
64} 64}
65 65
66NvResult nvhost_nvdec::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 66NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
67 std::vector<u8>& inline_output) { 67 std::vector<u8>& output, std::vector<u8>& inline_output) {
68 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 68 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
69 return NvResult::NotImplemented; 69 return NvResult::NotImplemented;
70} 70}
71 71
72void nvhost_nvdec::OnOpen(DeviceFD fd) {}
73void nvhost_nvdec::OnClose(DeviceFD fd) {}
74
72} // namespace Service::Nvidia::Devices 75} // namespace Service::Nvidia::Devices
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h
index 77ef53cdd..6c38a8c24 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h
@@ -15,11 +15,15 @@ public:
15 SyncpointManager& syncpoint_manager); 15 SyncpointManager& syncpoint_manager);
16 ~nvhost_nvdec() override; 16 ~nvhost_nvdec() override;
17 17
18 NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; 18 NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
19 NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, 19 std::vector<u8>& output) override;
20 NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
20 const std::vector<u8>& inline_input, std::vector<u8>& output) override; 21 const std::vector<u8>& inline_input, std::vector<u8>& output) override;
21 NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 22 NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
22 std::vector<u8>& inline_output) override; 23 std::vector<u8>& output, std::vector<u8>& inline_output) override;
24
25 void OnOpen(DeviceFD fd) override;
26 void OnClose(DeviceFD fd) override;
23}; 27};
24 28
25} // namespace Service::Nvidia::Devices 29} // namespace Service::Nvidia::Devices
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
index 4898dc27a..c2f152190 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
@@ -23,17 +23,22 @@ namespace {
23template <typename T> 23template <typename T>
24std::size_t SpliceVectors(const std::vector<u8>& input, std::vector<T>& dst, std::size_t count, 24std::size_t SpliceVectors(const std::vector<u8>& input, std::vector<T>& dst, std::size_t count,
25 std::size_t offset) { 25 std::size_t offset) {
26 std::memcpy(dst.data(), input.data() + offset, count * sizeof(T)); 26 if (!dst.empty()) {
27 offset += count * sizeof(T); 27 std::memcpy(dst.data(), input.data() + offset, count * sizeof(T));
28 return offset; 28 }
29 return 0;
29} 30}
30 31
31// Write vectors will write data to the output buffer 32// Write vectors will write data to the output buffer
32template <typename T> 33template <typename T>
33std::size_t WriteVectors(std::vector<u8>& dst, const std::vector<T>& src, std::size_t offset) { 34std::size_t WriteVectors(std::vector<u8>& dst, const std::vector<T>& src, std::size_t offset) {
34 std::memcpy(dst.data() + offset, src.data(), src.size() * sizeof(T)); 35 if (src.empty()) {
35 offset += src.size() * sizeof(T); 36 return 0;
36 return offset; 37 } else {
38 std::memcpy(dst.data() + offset, src.data(), src.size() * sizeof(T));
39 offset += src.size() * sizeof(T);
40 return offset;
41 }
37} 42}
38} // Anonymous namespace 43} // Anonymous namespace
39 44
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp
index 2d06955c0..0a9c35c01 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp
@@ -13,7 +13,7 @@ namespace Service::Nvidia::Devices {
13nvhost_nvjpg::nvhost_nvjpg(Core::System& system) : nvdevice(system) {} 13nvhost_nvjpg::nvhost_nvjpg(Core::System& system) : nvdevice(system) {}
14nvhost_nvjpg::~nvhost_nvjpg() = default; 14nvhost_nvjpg::~nvhost_nvjpg() = default;
15 15
16NvResult nvhost_nvjpg::Ioctl1(Ioctl command, const std::vector<u8>& input, 16NvResult nvhost_nvjpg::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
17 std::vector<u8>& output) { 17 std::vector<u8>& output) {
18 switch (command.group) { 18 switch (command.group) {
19 case 'H': 19 case 'H':
@@ -32,18 +32,21 @@ NvResult nvhost_nvjpg::Ioctl1(Ioctl command, const std::vector<u8>& input,
32 return NvResult::NotImplemented; 32 return NvResult::NotImplemented;
33} 33}
34 34
35NvResult nvhost_nvjpg::Ioctl2(Ioctl command, const std::vector<u8>& input, 35NvResult nvhost_nvjpg::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
36 const std::vector<u8>& inline_input, std::vector<u8>& output) { 36 const std::vector<u8>& inline_input, std::vector<u8>& output) {
37 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 37 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
38 return NvResult::NotImplemented; 38 return NvResult::NotImplemented;
39} 39}
40 40
41NvResult nvhost_nvjpg::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 41NvResult nvhost_nvjpg::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
42 std::vector<u8>& inline_output) { 42 std::vector<u8>& output, std::vector<u8>& inline_output) {
43 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 43 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
44 return NvResult::NotImplemented; 44 return NvResult::NotImplemented;
45} 45}
46 46
47void nvhost_nvjpg::OnOpen(DeviceFD fd) {}
48void nvhost_nvjpg::OnClose(DeviceFD fd) {}
49
47NvResult nvhost_nvjpg::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { 50NvResult nvhost_nvjpg::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) {
48 IoctlSetNvmapFD params{}; 51 IoctlSetNvmapFD params{};
49 std::memcpy(&params, input.data(), input.size()); 52 std::memcpy(&params, input.data(), input.size());
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h
index 43948d18d..1f97b642f 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h
@@ -16,11 +16,15 @@ public:
16 explicit nvhost_nvjpg(Core::System& system); 16 explicit nvhost_nvjpg(Core::System& system);
17 ~nvhost_nvjpg() override; 17 ~nvhost_nvjpg() override;
18 18
19 NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; 19 NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
20 NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, 20 std::vector<u8>& output) override;
21 NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
21 const std::vector<u8>& inline_input, std::vector<u8>& output) override; 22 const std::vector<u8>& inline_input, std::vector<u8>& output) override;
22 NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 23 NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
23 std::vector<u8>& inline_output) override; 24 std::vector<u8>& output, std::vector<u8>& inline_output) override;
25
26 void OnOpen(DeviceFD fd) override;
27 void OnClose(DeviceFD fd) override;
24 28
25private: 29private:
26 struct IoctlSetNvmapFD { 30 struct IoctlSetNvmapFD {
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp
index 70849a9bd..0421fb956 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp
@@ -16,7 +16,8 @@ nvhost_vic::nvhost_vic(Core::System& system, std::shared_ptr<nvmap> nvmap_dev,
16 16
17nvhost_vic::~nvhost_vic() = default; 17nvhost_vic::~nvhost_vic() = default;
18 18
19NvResult nvhost_vic::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { 19NvResult nvhost_vic::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
20 std::vector<u8>& output) {
20 switch (command.group) { 21 switch (command.group) {
21 case 0x0: 22 case 0x0:
22 switch (command.cmd) { 23 switch (command.cmd) {
@@ -55,16 +56,19 @@ NvResult nvhost_vic::Ioctl1(Ioctl command, const std::vector<u8>& input, std::ve
55 return NvResult::NotImplemented; 56 return NvResult::NotImplemented;
56} 57}
57 58
58NvResult nvhost_vic::Ioctl2(Ioctl command, const std::vector<u8>& input, 59NvResult nvhost_vic::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
59 const std::vector<u8>& inline_input, std::vector<u8>& output) { 60 const std::vector<u8>& inline_input, std::vector<u8>& output) {
60 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 61 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
61 return NvResult::NotImplemented; 62 return NvResult::NotImplemented;
62} 63}
63 64
64NvResult nvhost_vic::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 65NvResult nvhost_vic::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
65 std::vector<u8>& inline_output) { 66 std::vector<u8>& output, std::vector<u8>& inline_output) {
66 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 67 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
67 return NvResult::NotImplemented; 68 return NvResult::NotImplemented;
68} 69}
69 70
71void nvhost_vic::OnOpen(DeviceFD fd) {}
72void nvhost_vic::OnClose(DeviceFD fd) {}
73
70} // namespace Service::Nvidia::Devices 74} // namespace Service::Nvidia::Devices
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.h b/src/core/hle/service/nvdrv/devices/nvhost_vic.h
index f401c61fa..cebefad71 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_vic.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.h
@@ -14,10 +14,14 @@ public:
14 SyncpointManager& syncpoint_manager); 14 SyncpointManager& syncpoint_manager);
15 ~nvhost_vic(); 15 ~nvhost_vic();
16 16
17 NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; 17 NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
18 NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, 18 std::vector<u8>& output) override;
19 NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
19 const std::vector<u8>& inline_input, std::vector<u8>& output) override; 20 const std::vector<u8>& inline_input, std::vector<u8>& output) override;
20 NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 21 NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
21 std::vector<u8>& inline_output) override; 22 std::vector<u8>& output, std::vector<u8>& inline_output) override;
23
24 void OnOpen(DeviceFD fd) override;
25 void OnClose(DeviceFD fd) override;
22}; 26};
23} // namespace Service::Nvidia::Devices 27} // namespace Service::Nvidia::Devices
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp
index 4015a2740..dd1355522 100644
--- a/src/core/hle/service/nvdrv/devices/nvmap.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp
@@ -19,7 +19,8 @@ nvmap::nvmap(Core::System& system) : nvdevice(system) {
19 19
20nvmap::~nvmap() = default; 20nvmap::~nvmap() = default;
21 21
22NvResult nvmap::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { 22NvResult nvmap::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
23 std::vector<u8>& output) {
23 switch (command.group) { 24 switch (command.group) {
24 case 0x1: 25 case 0x1:
25 switch (command.cmd) { 26 switch (command.cmd) {
@@ -47,18 +48,21 @@ NvResult nvmap::Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<
47 return NvResult::NotImplemented; 48 return NvResult::NotImplemented;
48} 49}
49 50
50NvResult nvmap::Ioctl2(Ioctl command, const std::vector<u8>& input, 51NvResult nvmap::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
51 const std::vector<u8>& inline_input, std::vector<u8>& output) { 52 const std::vector<u8>& inline_input, std::vector<u8>& output) {
52 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 53 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
53 return NvResult::NotImplemented; 54 return NvResult::NotImplemented;
54} 55}
55 56
56NvResult nvmap::Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 57NvResult nvmap::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
57 std::vector<u8>& inline_output) { 58 std::vector<u8>& output, std::vector<u8>& inline_output) {
58 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); 59 UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
59 return NvResult::NotImplemented; 60 return NvResult::NotImplemented;
60} 61}
61 62
63void nvmap::OnOpen(DeviceFD fd) {}
64void nvmap::OnClose(DeviceFD fd) {}
65
62VAddr nvmap::GetObjectAddress(u32 handle) const { 66VAddr nvmap::GetObjectAddress(u32 handle) const {
63 auto object = GetObject(handle); 67 auto object = GetObject(handle);
64 ASSERT(object); 68 ASSERT(object);
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.h b/src/core/hle/service/nvdrv/devices/nvmap.h
index 4484bd79f..208875845 100644
--- a/src/core/hle/service/nvdrv/devices/nvmap.h
+++ b/src/core/hle/service/nvdrv/devices/nvmap.h
@@ -19,11 +19,15 @@ public:
19 explicit nvmap(Core::System& system); 19 explicit nvmap(Core::System& system);
20 ~nvmap() override; 20 ~nvmap() override;
21 21
22 NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; 22 NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
23 NvResult Ioctl2(Ioctl command, const std::vector<u8>& input, 23 std::vector<u8>& output) override;
24 NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
24 const std::vector<u8>& inline_input, std::vector<u8>& output) override; 25 const std::vector<u8>& inline_input, std::vector<u8>& output) override;
25 NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output, 26 NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
26 std::vector<u8>& inline_output) override; 27 std::vector<u8>& output, std::vector<u8>& inline_output) override;
28
29 void OnOpen(DeviceFD fd) override;
30 void OnClose(DeviceFD fd) override;
27 31
28 /// Returns the allocated address of an nvmap object given its handle. 32 /// Returns the allocated address of an nvmap object given its handle.
29 VAddr GetObjectAddress(u32 handle) const; 33 VAddr GetObjectAddress(u32 handle) const;
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp
index abba80112..ede77858a 100644
--- a/src/core/hle/service/nvdrv/nvdrv.cpp
+++ b/src/core/hle/service/nvdrv/nvdrv.cpp
@@ -89,6 +89,8 @@ DeviceFD Module::Open(const std::string& device_name) {
89 auto device = devices[device_name]; 89 auto device = devices[device_name];
90 const DeviceFD fd = next_fd++; 90 const DeviceFD fd = next_fd++;
91 91
92 device->OnOpen(fd);
93
92 open_files[fd] = std::move(device); 94 open_files[fd] = std::move(device);
93 95
94 return fd; 96 return fd;
@@ -108,7 +110,7 @@ NvResult Module::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input
108 return NvResult::NotImplemented; 110 return NvResult::NotImplemented;
109 } 111 }
110 112
111 return itr->second->Ioctl1(command, input, output); 113 return itr->second->Ioctl1(fd, command, input, output);
112} 114}
113 115
114NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, 116NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
@@ -125,7 +127,7 @@ NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input
125 return NvResult::NotImplemented; 127 return NvResult::NotImplemented;
126 } 128 }
127 129
128 return itr->second->Ioctl2(command, input, inline_input, output); 130 return itr->second->Ioctl2(fd, command, input, inline_input, output);
129} 131}
130 132
131NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, 133NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
@@ -142,7 +144,7 @@ NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input
142 return NvResult::NotImplemented; 144 return NvResult::NotImplemented;
143 } 145 }
144 146
145 return itr->second->Ioctl3(command, input, output, inline_output); 147 return itr->second->Ioctl3(fd, command, input, output, inline_output);
146} 148}
147 149
148NvResult Module::Close(DeviceFD fd) { 150NvResult Module::Close(DeviceFD fd) {
@@ -158,6 +160,8 @@ NvResult Module::Close(DeviceFD fd) {
158 return NvResult::NotImplemented; 160 return NvResult::NotImplemented;
159 } 161 }
160 162
163 itr->second->OnClose(fd);
164
161 open_files.erase(itr); 165 open_files.erase(itr);
162 166
163 return NvResult::Success; 167 return NvResult::Success;
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 1da56bc27..aec399076 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -70,6 +70,7 @@
70#include "core/hle/service/vi/vi.h" 70#include "core/hle/service/vi/vi.h"
71#include "core/hle/service/wlan/wlan.h" 71#include "core/hle/service/wlan/wlan.h"
72#include "core/reporter.h" 72#include "core/reporter.h"
73#include "core/settings.h"
73 74
74namespace Service { 75namespace Service {
75 76
@@ -146,6 +147,11 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(Kernel::HLERequestContext
146 system.GetReporter().SaveUnimplementedFunctionReport(ctx, ctx.GetCommand(), function_name, 147 system.GetReporter().SaveUnimplementedFunctionReport(ctx, ctx.GetCommand(), function_name,
147 service_name); 148 service_name);
148 UNIMPLEMENTED_MSG("Unknown / unimplemented {}", fmt::to_string(buf)); 149 UNIMPLEMENTED_MSG("Unknown / unimplemented {}", fmt::to_string(buf));
150 if (Settings::values.use_auto_stub) {
151 LOG_WARNING(Service, "Using auto stub fallback!");
152 IPC::ResponseBuilder rb{ctx, 2};
153 rb.Push(RESULT_SUCCESS);
154 }
149} 155}
150 156
151void ServiceFrameworkBase::InvokeRequest(Kernel::HLERequestContext& ctx) { 157void ServiceFrameworkBase::InvokeRequest(Kernel::HLERequestContext& ctx) {
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 7423287ea..a1a7ac987 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -695,6 +695,7 @@ public:
695 {2205, &ISystemDisplayService::SetLayerZ, "SetLayerZ"}, 695 {2205, &ISystemDisplayService::SetLayerZ, "SetLayerZ"},
696 {2207, &ISystemDisplayService::SetLayerVisibility, "SetLayerVisibility"}, 696 {2207, &ISystemDisplayService::SetLayerVisibility, "SetLayerVisibility"},
697 {2209, nullptr, "SetLayerAlpha"}, 697 {2209, nullptr, "SetLayerAlpha"},
698 {2210, nullptr, "SetLayerPositionAndSize"},
698 {2312, nullptr, "CreateStrayLayer"}, 699 {2312, nullptr, "CreateStrayLayer"},
699 {2400, nullptr, "OpenIndirectLayer"}, 700 {2400, nullptr, "OpenIndirectLayer"},
700 {2401, nullptr, "CloseIndirectLayer"}, 701 {2401, nullptr, "CloseIndirectLayer"},
@@ -718,6 +719,7 @@ public:
718 {3215, nullptr, "SetDisplayGamma"}, 719 {3215, nullptr, "SetDisplayGamma"},
719 {3216, nullptr, "GetDisplayCmuLuma"}, 720 {3216, nullptr, "GetDisplayCmuLuma"},
720 {3217, nullptr, "SetDisplayCmuLuma"}, 721 {3217, nullptr, "SetDisplayCmuLuma"},
722 {3218, nullptr, "SetDisplayCrcMode"},
721 {6013, nullptr, "GetLayerPresentationSubmissionTimestamps"}, 723 {6013, nullptr, "GetLayerPresentationSubmissionTimestamps"},
722 {8225, nullptr, "GetSharedBufferMemoryHandleId"}, 724 {8225, nullptr, "GetSharedBufferMemoryHandleId"},
723 {8250, nullptr, "OpenSharedLayer"}, 725 {8250, nullptr, "OpenSharedLayer"},
@@ -729,6 +731,7 @@ public:
729 {8256, nullptr, "GetSharedFrameBufferAcquirableEvent"}, 731 {8256, nullptr, "GetSharedFrameBufferAcquirableEvent"},
730 {8257, nullptr, "FillSharedFrameBufferColor"}, 732 {8257, nullptr, "FillSharedFrameBufferColor"},
731 {8258, nullptr, "CancelSharedFrameBuffer"}, 733 {8258, nullptr, "CancelSharedFrameBuffer"},
734 {9000, nullptr, "GetDp2hdmiController"},
732 }; 735 };
733 RegisterHandlers(functions); 736 RegisterHandlers(functions);
734 } 737 }
@@ -808,10 +811,15 @@ public:
808 {2402, nullptr, "GetDisplayHotplugState"}, 811 {2402, nullptr, "GetDisplayHotplugState"},
809 {2501, nullptr, "GetCompositorErrorInfo"}, 812 {2501, nullptr, "GetCompositorErrorInfo"},
810 {2601, nullptr, "GetDisplayErrorEvent"}, 813 {2601, nullptr, "GetDisplayErrorEvent"},
814 {2701, nullptr, "GetDisplayFatalErrorEvent"},
811 {4201, nullptr, "SetDisplayAlpha"}, 815 {4201, nullptr, "SetDisplayAlpha"},
812 {4203, nullptr, "SetDisplayLayerStack"}, 816 {4203, nullptr, "SetDisplayLayerStack"},
813 {4205, nullptr, "SetDisplayPowerState"}, 817 {4205, nullptr, "SetDisplayPowerState"},
814 {4206, nullptr, "SetDefaultDisplay"}, 818 {4206, nullptr, "SetDefaultDisplay"},
819 {4207, nullptr, "ResetDisplayPanel"},
820 {4208, nullptr, "SetDisplayFatalErrorEnabled"},
821 {4209, nullptr, "IsDisplayPanelOn"},
822 {4300, nullptr, "GetInternalPanelId"},
815 {6000, &IManagerDisplayService::AddToLayerStack, "AddToLayerStack"}, 823 {6000, &IManagerDisplayService::AddToLayerStack, "AddToLayerStack"},
816 {6001, nullptr, "RemoveFromLayerStack"}, 824 {6001, nullptr, "RemoveFromLayerStack"},
817 {6002, &IManagerDisplayService::SetLayerVisibility, "SetLayerVisibility"}, 825 {6002, &IManagerDisplayService::SetLayerVisibility, "SetLayerVisibility"},
diff --git a/src/core/settings.h b/src/core/settings.h
index d849dded3..a81016b23 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -222,6 +222,7 @@ struct Values {
222 bool quest_flag; 222 bool quest_flag;
223 bool disable_macro_jit; 223 bool disable_macro_jit;
224 bool extended_logging; 224 bool extended_logging;
225 bool use_auto_stub;
225 226
226 // Miscellaneous 227 // Miscellaneous
227 std::string log_filter; 228 std::string log_filter;