aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpineappleEA <pineaea@gmail.com>2024-02-19 04:18:11 +0100
committerpineappleEA <pineaea@gmail.com>2024-02-19 04:18:11 +0100
commit1feed0e5080b1a2e4dfcb847b9c1b26af31b76a4 (patch)
tree1a07d8cbdf404120ddc3e6f2a96530f99ab5238b
parentbe0bf24d0e2506ed18932bc6099e46c9dfaa5551 (diff)
early-access version 4150EA-4150
-rwxr-xr-xREADME.md2
-rwxr-xr-xsrc/common/settings.h6
-rwxr-xr-xsrc/common/settings_enums.h2
-rwxr-xr-xsrc/core/CMakeLists.txt10
-rwxr-xr-xsrc/core/hle/service/am/library_applet_storage.cpp4
-rwxr-xr-xsrc/core/hle/service/btm/btm.cpp272
-rwxr-xr-xsrc/core/hle/service/btm/btm.h4
-rwxr-xr-xsrc/core/hle/service/btm/btm_debug.cpp33
-rwxr-xr-xsrc/core/hle/service/btm/btm_debug.h21
-rwxr-xr-xsrc/core/hle/service/btm/btm_system.cpp31
-rwxr-xr-xsrc/core/hle/service/btm/btm_system.h25
-rwxr-xr-xsrc/core/hle/service/btm/btm_system_core.cpp127
-rwxr-xr-xsrc/core/hle/service/btm/btm_system_core.h60
-rwxr-xr-xsrc/core/hle/service/btm/btm_user.cpp30
-rwxr-xr-xsrc/core/hle/service/btm/btm_user.h25
-rwxr-xr-xsrc/core/hle/service/btm/btm_user_core.cpp103
-rwxr-xr-xsrc/core/hle/service/btm/btm_user_core.h47
-rwxr-xr-xsrc/core/hle/service/ns/application_manager_interface.cpp13
-rwxr-xr-xsrc/core/hle/service/ns/ns_types.h41
-rwxr-xr-xsrc/core/hle/service/ns/read_only_application_control_data_interface.cpp6
-rwxr-xr-xsrc/video_core/vulkan_common/vulkan_device.cpp14
-rwxr-xr-xsrc/yuzu/configuration/shared_translation.cpp10
22 files changed, 586 insertions, 300 deletions
diff --git a/README.md b/README.md
index 3d7e2e09c..ca67f7720 100755
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
1yuzu emulator early access 1yuzu emulator early access
2============= 2=============
3 3
4This is the source code for early-access 4149. 4This is the source code for early-access 4150.
5 5
6## Legal Notice 6## Legal Notice
7 7
diff --git a/src/common/settings.h b/src/common/settings.h
index 9ff40d118..a344d1e22 100755
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -384,6 +384,12 @@ struct Values {
384 AstcRecompression::Bc3, 384 AstcRecompression::Bc3,
385 "astc_recompression", 385 "astc_recompression",
386 Category::RendererAdvanced}; 386 Category::RendererAdvanced};
387 SwitchableSetting<VramUsageMode, true> vram_usage_mode{linkage,
388 VramUsageMode::Conservative,
389 VramUsageMode::Conservative,
390 VramUsageMode::Aggressive,
391 "vram_usage_mode",
392 Category::RendererAdvanced};
387 SwitchableSetting<bool> async_presentation{linkage, 393 SwitchableSetting<bool> async_presentation{linkage,
388#ifdef ANDROID 394#ifdef ANDROID
389 true, 395 true,
diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h
index f42367e67..6e247e930 100755
--- a/src/common/settings_enums.h
+++ b/src/common/settings_enums.h
@@ -122,6 +122,8 @@ ENUM(AstcRecompression, Uncompressed, Bc1, Bc3);
122 122
123ENUM(VSyncMode, Immediate, Mailbox, Fifo, FifoRelaxed); 123ENUM(VSyncMode, Immediate, Mailbox, Fifo, FifoRelaxed);
124 124
125ENUM(VramUsageMode, Conservative, Aggressive);
126
125ENUM(RendererBackend, OpenGL, Vulkan, Null); 127ENUM(RendererBackend, OpenGL, Vulkan, Null);
126 128
127ENUM(ShaderBackend, Glsl, Glasm, SpirV); 129ENUM(ShaderBackend, Glsl, Glasm, SpirV);
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 560583980..a78b00adf 100755
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -543,6 +543,16 @@ add_library(core STATIC
543 hle/service/btdrv/btdrv.h 543 hle/service/btdrv/btdrv.h
544 hle/service/btm/btm.cpp 544 hle/service/btm/btm.cpp
545 hle/service/btm/btm.h 545 hle/service/btm/btm.h
546 hle/service/btm/btm_debug.cpp
547 hle/service/btm/btm_debug.h
548 hle/service/btm/btm_system.cpp
549 hle/service/btm/btm_system.h
550 hle/service/btm/btm_system_core.cpp
551 hle/service/btm/btm_system_core.h
552 hle/service/btm/btm_user.cpp
553 hle/service/btm/btm_user.h
554 hle/service/btm/btm_user_core.cpp
555 hle/service/btm/btm_user_core.h
546 hle/service/caps/caps.cpp 556 hle/service/caps/caps.cpp
547 hle/service/caps/caps.h 557 hle/service/caps/caps.h
548 hle/service/caps/caps_a.cpp 558 hle/service/caps/caps_a.cpp
diff --git a/src/core/hle/service/am/library_applet_storage.cpp b/src/core/hle/service/am/library_applet_storage.cpp
index 46e6c0111..0412c215d 100755
--- a/src/core/hle/service/am/library_applet_storage.cpp
+++ b/src/core/hle/service/am/library_applet_storage.cpp
@@ -70,7 +70,7 @@ public:
70 Result Read(s64 offset, void* buffer, size_t size) override { 70 Result Read(s64 offset, void* buffer, size_t size) override {
71 R_TRY(ValidateOffset(offset, size, m_size)); 71 R_TRY(ValidateOffset(offset, size, m_size));
72 72
73 m_memory.ReadBlock(m_trmem->GetSourceAddress(), buffer, size); 73 m_memory.ReadBlock(m_trmem->GetSourceAddress() + offset, buffer, size);
74 74
75 R_SUCCEED(); 75 R_SUCCEED();
76 } 76 }
@@ -79,7 +79,7 @@ public:
79 R_UNLESS(m_is_writable, ResultUnknown); 79 R_UNLESS(m_is_writable, ResultUnknown);
80 R_TRY(ValidateOffset(offset, size, m_size)); 80 R_TRY(ValidateOffset(offset, size, m_size));
81 81
82 m_memory.WriteBlock(m_trmem->GetSourceAddress(), buffer, size); 82 m_memory.WriteBlock(m_trmem->GetSourceAddress() + offset, buffer, size);
83 83
84 R_SUCCEED(); 84 R_SUCCEED();
85 } 85 }
diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp
index ebebedeb5..989ac0d46 100755
--- a/src/core/hle/service/btm/btm.cpp
+++ b/src/core/hle/service/btm/btm.cpp
@@ -3,141 +3,18 @@
3 3
4#include <memory> 4#include <memory>
5 5
6#include "common/logging/log.h"
7#include "core/core.h"
8#include "core/hle/kernel/k_event.h"
9#include "core/hle/service/btm/btm.h" 6#include "core/hle/service/btm/btm.h"
10#include "core/hle/service/ipc_helpers.h" 7#include "core/hle/service/btm/btm_debug.h"
11#include "core/hle/service/kernel_helpers.h" 8#include "core/hle/service/btm/btm_system.h"
9#include "core/hle/service/btm/btm_user.h"
12#include "core/hle/service/server_manager.h" 10#include "core/hle/service/server_manager.h"
13#include "core/hle/service/service.h" 11#include "core/hle/service/service.h"
14 12
15namespace Service::BTM { 13namespace Service::BTM {
16 14
17class IBtmUserCore final : public ServiceFramework<IBtmUserCore> { 15class IBtm final : public ServiceFramework<IBtm> {
18public: 16public:
19 explicit IBtmUserCore(Core::System& system_) 17 explicit IBtm(Core::System& system_) : ServiceFramework{system_, "btm"} {
20 : ServiceFramework{system_, "IBtmUserCore"}, service_context{system_, "IBtmUserCore"} {
21 // clang-format off
22 static const FunctionInfo functions[] = {
23 {0, &IBtmUserCore::AcquireBleScanEvent, "AcquireBleScanEvent"},
24 {1, nullptr, "GetBleScanFilterParameter"},
25 {2, nullptr, "GetBleScanFilterParameter2"},
26 {3, nullptr, "StartBleScanForGeneral"},
27 {4, nullptr, "StopBleScanForGeneral"},
28 {5, nullptr, "GetBleScanResultsForGeneral"},
29 {6, nullptr, "StartBleScanForPaired"},
30 {7, nullptr, "StopBleScanForPaired"},
31 {8, nullptr, "StartBleScanForSmartDevice"},
32 {9, nullptr, "StopBleScanForSmartDevice"},
33 {10, nullptr, "GetBleScanResultsForSmartDevice"},
34 {17, &IBtmUserCore::AcquireBleConnectionEvent, "AcquireBleConnectionEvent"},
35 {18, nullptr, "BleConnect"},
36 {19, nullptr, "BleDisconnect"},
37 {20, nullptr, "BleGetConnectionState"},
38 {21, nullptr, "AcquireBlePairingEvent"},
39 {22, nullptr, "BlePairDevice"},
40 {23, nullptr, "BleUnPairDevice"},
41 {24, nullptr, "BleUnPairDevice2"},
42 {25, nullptr, "BleGetPairedDevices"},
43 {26, &IBtmUserCore::AcquireBleServiceDiscoveryEvent, "AcquireBleServiceDiscoveryEvent"},
44 {27, nullptr, "GetGattServices"},
45 {28, nullptr, "GetGattService"},
46 {29, nullptr, "GetGattIncludedServices"},
47 {30, nullptr, "GetBelongingGattService"},
48 {31, nullptr, "GetGattCharacteristics"},
49 {32, nullptr, "GetGattDescriptors"},
50 {33, &IBtmUserCore::AcquireBleMtuConfigEvent, "AcquireBleMtuConfigEvent"},
51 {34, nullptr, "ConfigureBleMtu"},
52 {35, nullptr, "GetBleMtu"},
53 {36, nullptr, "RegisterBleGattDataPath"},
54 {37, nullptr, "UnregisterBleGattDataPath"},
55 };
56 // clang-format on
57 RegisterHandlers(functions);
58
59 scan_event = service_context.CreateEvent("IBtmUserCore:ScanEvent");
60 connection_event = service_context.CreateEvent("IBtmUserCore:ConnectionEvent");
61 service_discovery_event = service_context.CreateEvent("IBtmUserCore:DiscoveryEvent");
62 config_event = service_context.CreateEvent("IBtmUserCore:ConfigEvent");
63 }
64
65 ~IBtmUserCore() override {
66 service_context.CloseEvent(scan_event);
67 service_context.CloseEvent(connection_event);
68 service_context.CloseEvent(service_discovery_event);
69 service_context.CloseEvent(config_event);
70 }
71
72private:
73 void AcquireBleScanEvent(HLERequestContext& ctx) {
74 LOG_WARNING(Service_BTM, "(STUBBED) called");
75
76 IPC::ResponseBuilder rb{ctx, 3, 1};
77 rb.Push(ResultSuccess);
78 rb.Push(true);
79 rb.PushCopyObjects(scan_event->GetReadableEvent());
80 }
81
82 void AcquireBleConnectionEvent(HLERequestContext& ctx) {
83 LOG_WARNING(Service_BTM, "(STUBBED) called");
84
85 IPC::ResponseBuilder rb{ctx, 3, 1};
86 rb.Push(ResultSuccess);
87 rb.Push(true);
88 rb.PushCopyObjects(connection_event->GetReadableEvent());
89 }
90
91 void AcquireBleServiceDiscoveryEvent(HLERequestContext& ctx) {
92 LOG_WARNING(Service_BTM, "(STUBBED) called");
93
94 IPC::ResponseBuilder rb{ctx, 3, 1};
95 rb.Push(ResultSuccess);
96 rb.Push(true);
97 rb.PushCopyObjects(service_discovery_event->GetReadableEvent());
98 }
99
100 void AcquireBleMtuConfigEvent(HLERequestContext& ctx) {
101 LOG_WARNING(Service_BTM, "(STUBBED) called");
102
103 IPC::ResponseBuilder rb{ctx, 3, 1};
104 rb.Push(ResultSuccess);
105 rb.Push(true);
106 rb.PushCopyObjects(config_event->GetReadableEvent());
107 }
108
109 KernelHelpers::ServiceContext service_context;
110
111 Kernel::KEvent* scan_event;
112 Kernel::KEvent* connection_event;
113 Kernel::KEvent* service_discovery_event;
114 Kernel::KEvent* config_event;
115};
116
117class BTM_USR final : public ServiceFramework<BTM_USR> {
118public:
119 explicit BTM_USR(Core::System& system_) : ServiceFramework{system_, "btm:u"} {
120 // clang-format off
121 static const FunctionInfo functions[] = {
122 {0, &BTM_USR::GetCore, "GetCore"},
123 };
124 // clang-format on
125 RegisterHandlers(functions);
126 }
127
128private:
129 void GetCore(HLERequestContext& ctx) {
130 LOG_WARNING(Service_BTM, "called");
131
132 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
133 rb.Push(ResultSuccess);
134 rb.PushIpcInterface<IBtmUserCore>(system);
135 }
136};
137
138class BTM final : public ServiceFramework<BTM> {
139public:
140 explicit BTM(Core::System& system_) : ServiceFramework{system_, "btm"} {
141 // clang-format off 18 // clang-format off
142 static const FunctionInfo functions[] = { 19 static const FunctionInfo functions[] = {
143 {0, nullptr, "GetState"}, 20 {0, nullptr, "GetState"},
@@ -232,144 +109,13 @@ public:
232 } 109 }
233}; 110};
234 111
235class BTM_DBG final : public ServiceFramework<BTM_DBG> {
236public:
237 explicit BTM_DBG(Core::System& system_) : ServiceFramework{system_, "btm:dbg"} {
238 // clang-format off
239 static const FunctionInfo functions[] = {
240 {0, nullptr, "AcquireDiscoveryEvent"},
241 {1, nullptr, "StartDiscovery"},
242 {2, nullptr, "CancelDiscovery"},
243 {3, nullptr, "GetDeviceProperty"},
244 {4, nullptr, "CreateBond"},
245 {5, nullptr, "CancelBond"},
246 {6, nullptr, "SetTsiMode"},
247 {7, nullptr, "GeneralTest"},
248 {8, nullptr, "HidConnect"},
249 {9, nullptr, "GeneralGet"},
250 {10, nullptr, "GetGattClientDisconnectionReason"},
251 {11, nullptr, "GetBleConnectionParameter"},
252 {12, nullptr, "GetBleConnectionParameterRequest"},
253 {13, nullptr, "Unknown13"},
254 };
255 // clang-format on
256
257 RegisterHandlers(functions);
258 }
259};
260
261class IBtmSystemCore final : public ServiceFramework<IBtmSystemCore> {
262public:
263 explicit IBtmSystemCore(Core::System& system_) : ServiceFramework{system_, "IBtmSystemCore"} {
264 // clang-format off
265 static const FunctionInfo functions[] = {
266 {0, &IBtmSystemCore::StartGamepadPairing, "StartGamepadPairing"},
267 {1, &IBtmSystemCore::CancelGamepadPairing, "CancelGamepadPairing"},
268 {2, nullptr, "ClearGamepadPairingDatabase"},
269 {3, nullptr, "GetPairedGamepadCount"},
270 {4, nullptr, "EnableRadio"},
271 {5, nullptr, "DisableRadio"},
272 {6, &IBtmSystemCore::IsRadioEnabled, "IsRadioEnabled"},
273 {7, nullptr, "AcquireRadioEvent"},
274 {8, nullptr, "AcquireGamepadPairingEvent"},
275 {9, nullptr, "IsGamepadPairingStarted"},
276 {10, nullptr, "StartAudioDeviceDiscovery"},
277 {11, nullptr, "StopAudioDeviceDiscovery"},
278 {12, nullptr, "IsDiscoveryingAudioDevice"},
279 {13, nullptr, "GetDiscoveredAudioDevice"},
280 {14, nullptr, "AcquireAudioDeviceConnectionEvent"},
281 {15, nullptr, "ConnectAudioDevice"},
282 {16, nullptr, "IsConnectingAudioDevice"},
283 {17, &IBtmSystemCore::GetConnectedAudioDevices, "GetConnectedAudioDevices"},
284 {18, nullptr, "DisconnectAudioDevice"},
285 {19, nullptr, "AcquirePairedAudioDeviceInfoChangedEvent"},
286 {20, &IBtmSystemCore::GetPairedAudioDevices, "GetPairedAudioDevices"},
287 {21, nullptr, "RemoveAudioDevicePairing"},
288 {22, &IBtmSystemCore::RequestAudioDeviceConnectionRejection, "RequestAudioDeviceConnectionRejection"},
289 {23, &IBtmSystemCore::CancelAudioDeviceConnectionRejection, "CancelAudioDeviceConnectionRejection"}
290 };
291 // clang-format on
292
293 RegisterHandlers(functions);
294 }
295
296private:
297 void IsRadioEnabled(HLERequestContext& ctx) {
298 LOG_DEBUG(Service_BTM, "(STUBBED) called"); // Spams a lot when controller applet is running
299
300 IPC::ResponseBuilder rb{ctx, 3};
301 rb.Push(ResultSuccess);
302 rb.Push(true);
303 }
304
305 void StartGamepadPairing(HLERequestContext& ctx) {
306 LOG_WARNING(Service_BTM, "(STUBBED) called");
307 IPC::ResponseBuilder rb{ctx, 2};
308 rb.Push(ResultSuccess);
309 }
310
311 void CancelGamepadPairing(HLERequestContext& ctx) {
312 LOG_WARNING(Service_BTM, "(STUBBED) called");
313 IPC::ResponseBuilder rb{ctx, 2};
314 rb.Push(ResultSuccess);
315 }
316
317 void CancelAudioDeviceConnectionRejection(HLERequestContext& ctx) {
318 LOG_WARNING(Service_BTM, "(STUBBED) called");
319 IPC::ResponseBuilder rb{ctx, 2};
320 rb.Push(ResultSuccess);
321 }
322
323 void GetConnectedAudioDevices(HLERequestContext& ctx) {
324 LOG_WARNING(Service_BTM, "(STUBBED) called");
325 IPC::ResponseBuilder rb{ctx, 3};
326 rb.Push(ResultSuccess);
327 rb.Push<u32>(0);
328 }
329
330 void GetPairedAudioDevices(HLERequestContext& ctx) {
331 LOG_WARNING(Service_BTM, "(STUBBED) called");
332 IPC::ResponseBuilder rb{ctx, 3};
333 rb.Push(ResultSuccess);
334 rb.Push<u32>(0);
335 }
336
337 void RequestAudioDeviceConnectionRejection(HLERequestContext& ctx) {
338 LOG_WARNING(Service_BTM, "(STUBBED) called");
339 IPC::ResponseBuilder rb{ctx, 2};
340 rb.Push(ResultSuccess);
341 }
342};
343
344class BTM_SYS final : public ServiceFramework<BTM_SYS> {
345public:
346 explicit BTM_SYS(Core::System& system_) : ServiceFramework{system_, "btm:sys"} {
347 // clang-format off
348 static const FunctionInfo functions[] = {
349 {0, &BTM_SYS::GetCore, "GetCore"},
350 };
351 // clang-format on
352
353 RegisterHandlers(functions);
354 }
355
356private:
357 void GetCore(HLERequestContext& ctx) {
358 LOG_WARNING(Service_BTM, "called");
359
360 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
361 rb.Push(ResultSuccess);
362 rb.PushIpcInterface<IBtmSystemCore>(system);
363 }
364};
365
366void LoopProcess(Core::System& system) { 112void LoopProcess(Core::System& system) {
367 auto server_manager = std::make_unique<ServerManager>(system); 113 auto server_manager = std::make_unique<ServerManager>(system);
368 114
369 server_manager->RegisterNamedService("btm", std::make_shared<BTM>(system)); 115 server_manager->RegisterNamedService("btm", std::make_shared<IBtm>(system));
370 server_manager->RegisterNamedService("btm:dbg", std::make_shared<BTM_DBG>(system)); 116 server_manager->RegisterNamedService("btm:dbg", std::make_shared<IBtmDebug>(system));
371 server_manager->RegisterNamedService("btm:sys", std::make_shared<BTM_SYS>(system)); 117 server_manager->RegisterNamedService("btm:sys", std::make_shared<IBtmSystem>(system));
372 server_manager->RegisterNamedService("btm:u", std::make_shared<BTM_USR>(system)); 118 server_manager->RegisterNamedService("btm:u", std::make_shared<IBtmUser>(system));
373 ServerManager::RunServer(std::move(server_manager)); 119 ServerManager::RunServer(std::move(server_manager));
374} 120}
375 121
diff --git a/src/core/hle/service/btm/btm.h b/src/core/hle/service/btm/btm.h
index 59b717bf1..7946ade13 100755
--- a/src/core/hle/service/btm/btm.h
+++ b/src/core/hle/service/btm/btm.h
@@ -3,10 +3,6 @@
3 3
4#pragma once 4#pragma once
5 5
6namespace Service::SM {
7class ServiceManager;
8}
9
10namespace Core { 6namespace Core {
11class System; 7class System;
12}; 8};
diff --git a/src/core/hle/service/btm/btm_debug.cpp b/src/core/hle/service/btm/btm_debug.cpp
new file mode 100755
index 000000000..4d61d2641
--- /dev/null
+++ b/src/core/hle/service/btm/btm_debug.cpp
@@ -0,0 +1,33 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#include "core/hle/service/btm/btm_debug.h"
5
6namespace Service::BTM {
7
8IBtmDebug::IBtmDebug(Core::System& system_) : ServiceFramework{system_, "btm:dbg"} {
9 // clang-format off
10 static const FunctionInfo functions[] = {
11 {0, nullptr, "AcquireDiscoveryEvent"},
12 {1, nullptr, "StartDiscovery"},
13 {2, nullptr, "CancelDiscovery"},
14 {3, nullptr, "GetDeviceProperty"},
15 {4, nullptr, "CreateBond"},
16 {5, nullptr, "CancelBond"},
17 {6, nullptr, "SetTsiMode"},
18 {7, nullptr, "GeneralTest"},
19 {8, nullptr, "HidConnect"},
20 {9, nullptr, "GeneralGet"},
21 {10, nullptr, "GetGattClientDisconnectionReason"},
22 {11, nullptr, "GetBleConnectionParameter"},
23 {12, nullptr, "GetBleConnectionParameterRequest"},
24 {13, nullptr, "Unknown13"},
25 };
26 // clang-format on
27
28 RegisterHandlers(functions);
29}
30
31IBtmDebug::~IBtmDebug() = default;
32
33} // namespace Service::BTM
diff --git a/src/core/hle/service/btm/btm_debug.h b/src/core/hle/service/btm/btm_debug.h
new file mode 100755
index 000000000..bf4f7e14f
--- /dev/null
+++ b/src/core/hle/service/btm/btm_debug.h
@@ -0,0 +1,21 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#pragma once
5
6#include "core/hle/service/cmif_types.h"
7#include "core/hle/service/service.h"
8
9namespace Core {
10class System;
11}
12
13namespace Service::BTM {
14
15class IBtmDebug final : public ServiceFramework<IBtmDebug> {
16public:
17 explicit IBtmDebug(Core::System& system_);
18 ~IBtmDebug() override;
19};
20
21} // namespace Service::BTM
diff --git a/src/core/hle/service/btm/btm_system.cpp b/src/core/hle/service/btm/btm_system.cpp
new file mode 100755
index 000000000..99718a7b0
--- /dev/null
+++ b/src/core/hle/service/btm/btm_system.cpp
@@ -0,0 +1,31 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#include "common/logging/log.h"
5#include "core/hle/service/btm/btm_system.h"
6#include "core/hle/service/btm/btm_system_core.h"
7#include "core/hle/service/cmif_serialization.h"
8#include "core/hle/service/service.h"
9
10namespace Service::BTM {
11
12IBtmSystem::IBtmSystem(Core::System& system_) : ServiceFramework{system_, "btm:sys"} {
13 // clang-format off
14 static const FunctionInfo functions[] = {
15 {0, C<&IBtmSystem::GetCore>, "GetCore"},
16 };
17 // clang-format on
18
19 RegisterHandlers(functions);
20}
21
22IBtmSystem::~IBtmSystem() = default;
23
24Result IBtmSystem::GetCore(OutInterface<IBtmSystemCore> out_interface) {
25 LOG_WARNING(Service_BTM, "called");
26
27 *out_interface = std::make_shared<IBtmSystemCore>(system);
28 R_SUCCEED();
29}
30
31} // namespace Service::BTM
diff --git a/src/core/hle/service/btm/btm_system.h b/src/core/hle/service/btm/btm_system.h
new file mode 100755
index 000000000..fe1c6dbd7
--- /dev/null
+++ b/src/core/hle/service/btm/btm_system.h
@@ -0,0 +1,25 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#pragma once
5
6#include "core/hle/service/cmif_types.h"
7#include "core/hle/service/service.h"
8
9namespace Core {
10class System;
11}
12
13namespace Service::BTM {
14class IBtmSystemCore;
15
16class IBtmSystem final : public ServiceFramework<IBtmSystem> {
17public:
18 explicit IBtmSystem(Core::System& system_);
19 ~IBtmSystem() override;
20
21private:
22 Result GetCore(OutInterface<IBtmSystemCore> out_interface);
23};
24
25} // namespace Service::BTM
diff --git a/src/core/hle/service/btm/btm_system_core.cpp b/src/core/hle/service/btm/btm_system_core.cpp
new file mode 100755
index 000000000..4bc8a9e8b
--- /dev/null
+++ b/src/core/hle/service/btm/btm_system_core.cpp
@@ -0,0 +1,127 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#include "common/logging/log.h"
5#include "core/hle/service/btm/btm_system_core.h"
6#include "core/hle/service/cmif_serialization.h"
7#include "core/hle/service/set/system_settings_server.h"
8#include "core/hle/service/sm/sm.h"
9
10namespace Service::BTM {
11
12IBtmSystemCore::IBtmSystemCore(Core::System& system_)
13 : ServiceFramework{system_, "IBtmSystemCore"}, service_context{system_, "IBtmSystemCore"} {
14 // clang-format off
15 static const FunctionInfo functions[] = {
16 {0, C<&IBtmSystemCore::StartGamepadPairing>, "StartGamepadPairing"},
17 {1, C<&IBtmSystemCore::CancelGamepadPairing>, "CancelGamepadPairing"},
18 {2, nullptr, "ClearGamepadPairingDatabase"},
19 {3, nullptr, "GetPairedGamepadCount"},
20 {4, C<&IBtmSystemCore::EnableRadio>, "EnableRadio"},
21 {5, C<&IBtmSystemCore::DisableRadio>, "DisableRadio"},
22 {6, C<&IBtmSystemCore::IsRadioEnabled>, "IsRadioEnabled"},
23 {7, C<&IBtmSystemCore::AcquireRadioEvent>, "AcquireRadioEvent"},
24 {8, nullptr, "AcquireGamepadPairingEvent"},
25 {9, nullptr, "IsGamepadPairingStarted"},
26 {10, nullptr, "StartAudioDeviceDiscovery"},
27 {11, nullptr, "StopAudioDeviceDiscovery"},
28 {12, nullptr, "IsDiscoveryingAudioDevice"},
29 {13, nullptr, "GetDiscoveredAudioDevice"},
30 {14, C<&IBtmSystemCore::AcquireAudioDeviceConnectionEvent>, "AcquireAudioDeviceConnectionEvent"},
31 {15, nullptr, "ConnectAudioDevice"},
32 {16, nullptr, "IsConnectingAudioDevice"},
33 {17, C<&IBtmSystemCore::GetConnectedAudioDevices>, "GetConnectedAudioDevices"},
34 {18, nullptr, "DisconnectAudioDevice"},
35 {19, nullptr, "AcquirePairedAudioDeviceInfoChangedEvent"},
36 {20, C<&IBtmSystemCore::GetPairedAudioDevices>, "GetPairedAudioDevices"},
37 {21, nullptr, "RemoveAudioDevicePairing"},
38 {22, C<&IBtmSystemCore::RequestAudioDeviceConnectionRejection>, "RequestAudioDeviceConnectionRejection"},
39 {23, C<&IBtmSystemCore::CancelAudioDeviceConnectionRejection>, "CancelAudioDeviceConnectionRejection"}
40 };
41 // clang-format on
42
43 RegisterHandlers(functions);
44 radio_event = service_context.CreateEvent("IBtmSystemCore::RadioEvent");
45 audio_device_connection_event =
46 service_context.CreateEvent("IBtmSystemCore::AudioDeviceConnectionEvent");
47
48 m_set_sys =
49 system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys", true);
50}
51
52IBtmSystemCore::~IBtmSystemCore() {
53 service_context.CloseEvent(radio_event);
54 service_context.CloseEvent(audio_device_connection_event);
55}
56
57Result IBtmSystemCore::StartGamepadPairing() {
58 LOG_WARNING(Service_BTM, "(STUBBED) called");
59 R_SUCCEED();
60}
61
62Result IBtmSystemCore::CancelGamepadPairing() {
63 LOG_WARNING(Service_BTM, "(STUBBED) called");
64 R_SUCCEED();
65}
66
67Result IBtmSystemCore::EnableRadio() {
68 LOG_DEBUG(Service_BTM, "called");
69
70 R_RETURN(m_set_sys->SetBluetoothEnableFlag(true));
71}
72Result IBtmSystemCore::DisableRadio() {
73 LOG_DEBUG(Service_BTM, "called");
74
75 R_RETURN(m_set_sys->SetBluetoothEnableFlag(false));
76}
77
78Result IBtmSystemCore::IsRadioEnabled(Out<bool> out_is_enabled) {
79 LOG_DEBUG(Service_BTM, "called");
80
81 R_RETURN(m_set_sys->GetBluetoothEnableFlag(out_is_enabled));
82}
83
84Result IBtmSystemCore::AcquireRadioEvent(Out<bool> out_is_valid,
85 OutCopyHandle<Kernel::KReadableEvent> out_event) {
86 LOG_WARNING(Service_BTM, "(STUBBED) called");
87
88 *out_is_valid = true;
89 *out_event = &radio_event->GetReadableEvent();
90 R_SUCCEED();
91}
92
93Result IBtmSystemCore::AcquireAudioDeviceConnectionEvent(
94 OutCopyHandle<Kernel::KReadableEvent> out_event) {
95 LOG_WARNING(Service_BTM, "(STUBBED) called");
96
97 *out_event = &audio_device_connection_event->GetReadableEvent();
98 R_SUCCEED();
99}
100
101Result IBtmSystemCore::GetConnectedAudioDevices(
102 Out<s32> out_count, OutArray<std::array<u8, 0xFF>, BufferAttr_HipcPointer> out_audio_devices) {
103 LOG_WARNING(Service_BTM, "(STUBBED) called");
104
105 *out_count = 0;
106 R_SUCCEED();
107}
108
109Result IBtmSystemCore::GetPairedAudioDevices(
110 Out<s32> out_count, OutArray<std::array<u8, 0xFF>, BufferAttr_HipcPointer> out_audio_devices) {
111 LOG_WARNING(Service_BTM, "(STUBBED) called");
112
113 *out_count = 0;
114 R_SUCCEED();
115}
116
117Result IBtmSystemCore::RequestAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid) {
118 LOG_WARNING(Service_BTM, "(STUBBED) called, applet_resource_user_id={}", aruid.pid);
119 R_SUCCEED();
120}
121
122Result IBtmSystemCore::CancelAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid) {
123 LOG_WARNING(Service_BTM, "(STUBBED) called, applet_resource_user_id={}", aruid.pid);
124 R_SUCCEED();
125}
126
127} // namespace Service::BTM
diff --git a/src/core/hle/service/btm/btm_system_core.h b/src/core/hle/service/btm/btm_system_core.h
new file mode 100755
index 000000000..06498b21e
--- /dev/null
+++ b/src/core/hle/service/btm/btm_system_core.h
@@ -0,0 +1,60 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#pragma once
5
6#include "core/hle/service/cmif_types.h"
7#include "core/hle/service/kernel_helpers.h"
8#include "core/hle/service/service.h"
9
10namespace Kernel {
11class KEvent;
12class KReadableEvent;
13} // namespace Kernel
14
15namespace Core {
16class System;
17}
18
19namespace Service::Set {
20class ISystemSettingsServer;
21}
22
23namespace Service::BTM {
24
25class IBtmSystemCore final : public ServiceFramework<IBtmSystemCore> {
26public:
27 explicit IBtmSystemCore(Core::System& system_);
28 ~IBtmSystemCore() override;
29
30private:
31 Result StartGamepadPairing();
32 Result CancelGamepadPairing();
33 Result EnableRadio();
34 Result DisableRadio();
35 Result IsRadioEnabled(Out<bool> out_is_enabled);
36
37 Result AcquireRadioEvent(Out<bool> out_is_valid,
38 OutCopyHandle<Kernel::KReadableEvent> out_event);
39
40 Result AcquireAudioDeviceConnectionEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
41
42 Result GetConnectedAudioDevices(
43 Out<s32> out_count,
44 OutArray<std::array<u8, 0xFF>, BufferAttr_HipcPointer> out_audio_devices);
45
46 Result GetPairedAudioDevices(
47 Out<s32> out_count,
48 OutArray<std::array<u8, 0xFF>, BufferAttr_HipcPointer> out_audio_devices);
49
50 Result RequestAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid);
51 Result CancelAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid);
52
53 KernelHelpers::ServiceContext service_context;
54
55 Kernel::KEvent* radio_event;
56 Kernel::KEvent* audio_device_connection_event;
57 std::shared_ptr<Service::Set::ISystemSettingsServer> m_set_sys;
58};
59
60} // namespace Service::BTM
diff --git a/src/core/hle/service/btm/btm_user.cpp b/src/core/hle/service/btm/btm_user.cpp
new file mode 100755
index 000000000..d2e228f8d
--- /dev/null
+++ b/src/core/hle/service/btm/btm_user.cpp
@@ -0,0 +1,30 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#include "common/logging/log.h"
5#include "core/hle/service/btm/btm_user.h"
6#include "core/hle/service/btm/btm_user_core.h"
7#include "core/hle/service/cmif_serialization.h"
8
9namespace Service::BTM {
10
11IBtmUser::IBtmUser(Core::System& system_) : ServiceFramework{system_, "btm:u"} {
12 // clang-format off
13 static const FunctionInfo functions[] = {
14 {0, C<&IBtmUser::GetCore>, "GetCore"},
15 };
16 // clang-format on
17
18 RegisterHandlers(functions);
19}
20
21IBtmUser::~IBtmUser() = default;
22
23Result IBtmUser::GetCore(OutInterface<IBtmUserCore> out_interface) {
24 LOG_WARNING(Service_BTM, "called");
25
26 *out_interface = std::make_shared<IBtmUserCore>(system);
27 R_SUCCEED();
28}
29
30} // namespace Service::BTM
diff --git a/src/core/hle/service/btm/btm_user.h b/src/core/hle/service/btm/btm_user.h
new file mode 100755
index 000000000..d9ee5db45
--- /dev/null
+++ b/src/core/hle/service/btm/btm_user.h
@@ -0,0 +1,25 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#pragma once
5
6#include "core/hle/service/cmif_types.h"
7#include "core/hle/service/service.h"
8
9namespace Core {
10class System;
11}
12
13namespace Service::BTM {
14class IBtmUserCore;
15
16class IBtmUser final : public ServiceFramework<IBtmUser> {
17public:
18 explicit IBtmUser(Core::System& system_);
19 ~IBtmUser() override;
20
21private:
22 Result GetCore(OutInterface<IBtmUserCore> out_interface);
23};
24
25} // namespace Service::BTM
diff --git a/src/core/hle/service/btm/btm_user_core.cpp b/src/core/hle/service/btm/btm_user_core.cpp
new file mode 100755
index 000000000..6f9fa589b
--- /dev/null
+++ b/src/core/hle/service/btm/btm_user_core.cpp
@@ -0,0 +1,103 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#include <memory>
5
6#include "common/logging/log.h"
7#include "core/core.h"
8#include "core/hle/kernel/k_event.h"
9#include "core/hle/service/btm/btm_user_core.h"
10#include "core/hle/service/cmif_serialization.h"
11
12namespace Service::BTM {
13
14IBtmUserCore::IBtmUserCore(Core::System& system_)
15 : ServiceFramework{system_, "IBtmUserCore"}, service_context{system_, "IBtmUserCore"} {
16 // clang-format off
17 static const FunctionInfo functions[] = {
18 {0, C<&IBtmUserCore::AcquireBleScanEvent>, "AcquireBleScanEvent"},
19 {1, nullptr, "GetBleScanFilterParameter"},
20 {2, nullptr, "GetBleScanFilterParameter2"},
21 {3, nullptr, "StartBleScanForGeneral"},
22 {4, nullptr, "StopBleScanForGeneral"},
23 {5, nullptr, "GetBleScanResultsForGeneral"},
24 {6, nullptr, "StartBleScanForPaired"},
25 {7, nullptr, "StopBleScanForPaired"},
26 {8, nullptr, "StartBleScanForSmartDevice"},
27 {9, nullptr, "StopBleScanForSmartDevice"},
28 {10, nullptr, "GetBleScanResultsForSmartDevice"},
29 {17, C<&IBtmUserCore::AcquireBleConnectionEvent>, "AcquireBleConnectionEvent"},
30 {18, nullptr, "BleConnect"},
31 {19, nullptr, "BleDisconnect"},
32 {20, nullptr, "BleGetConnectionState"},
33 {21, nullptr, "AcquireBlePairingEvent"},
34 {22, nullptr, "BlePairDevice"},
35 {23, nullptr, "BleUnPairDevice"},
36 {24, nullptr, "BleUnPairDevice2"},
37 {25, nullptr, "BleGetPairedDevices"},
38 {26, C<&IBtmUserCore::AcquireBleServiceDiscoveryEvent>, "AcquireBleServiceDiscoveryEvent"},
39 {27, nullptr, "GetGattServices"},
40 {28, nullptr, "GetGattService"},
41 {29, nullptr, "GetGattIncludedServices"},
42 {30, nullptr, "GetBelongingGattService"},
43 {31, nullptr, "GetGattCharacteristics"},
44 {32, nullptr, "GetGattDescriptors"},
45 {33, C<&IBtmUserCore::AcquireBleMtuConfigEvent>, "AcquireBleMtuConfigEvent"},
46 {34, nullptr, "ConfigureBleMtu"},
47 {35, nullptr, "GetBleMtu"},
48 {36, nullptr, "RegisterBleGattDataPath"},
49 {37, nullptr, "UnregisterBleGattDataPath"},
50 };
51 // clang-format on
52 RegisterHandlers(functions);
53
54 scan_event = service_context.CreateEvent("IBtmUserCore:ScanEvent");
55 connection_event = service_context.CreateEvent("IBtmUserCore:ConnectionEvent");
56 service_discovery_event = service_context.CreateEvent("IBtmUserCore:DiscoveryEvent");
57 config_event = service_context.CreateEvent("IBtmUserCore:ConfigEvent");
58}
59
60IBtmUserCore::~IBtmUserCore() {
61 service_context.CloseEvent(scan_event);
62 service_context.CloseEvent(connection_event);
63 service_context.CloseEvent(service_discovery_event);
64 service_context.CloseEvent(config_event);
65}
66
67Result IBtmUserCore::AcquireBleScanEvent(Out<bool> out_is_valid,
68 OutCopyHandle<Kernel::KReadableEvent> out_event) {
69 LOG_WARNING(Service_BTM, "(STUBBED) called");
70
71 *out_is_valid = true;
72 *out_event = &scan_event->GetReadableEvent();
73 R_SUCCEED();
74}
75
76Result IBtmUserCore::AcquireBleConnectionEvent(Out<bool> out_is_valid,
77 OutCopyHandle<Kernel::KReadableEvent> out_event) {
78 LOG_WARNING(Service_BTM, "(STUBBED) called");
79
80 *out_is_valid = true;
81 *out_event = &connection_event->GetReadableEvent();
82 R_SUCCEED();
83}
84
85Result IBtmUserCore::AcquireBleServiceDiscoveryEvent(
86 Out<bool> out_is_valid, OutCopyHandle<Kernel::KReadableEvent> out_event) {
87 LOG_WARNING(Service_BTM, "(STUBBED) called");
88
89 *out_is_valid = true;
90 *out_event = &service_discovery_event->GetReadableEvent();
91 R_SUCCEED();
92}
93
94Result IBtmUserCore::AcquireBleMtuConfigEvent(Out<bool> out_is_valid,
95 OutCopyHandle<Kernel::KReadableEvent> out_event) {
96 LOG_WARNING(Service_BTM, "(STUBBED) called");
97
98 *out_is_valid = true;
99 *out_event = &config_event->GetReadableEvent();
100 R_SUCCEED();
101}
102
103} // namespace Service::BTM
diff --git a/src/core/hle/service/btm/btm_user_core.h b/src/core/hle/service/btm/btm_user_core.h
new file mode 100755
index 000000000..dc0a22e81
--- /dev/null
+++ b/src/core/hle/service/btm/btm_user_core.h
@@ -0,0 +1,47 @@
1// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#pragma once
5
6#include "core/hle/service/cmif_types.h"
7#include "core/hle/service/kernel_helpers.h"
8#include "core/hle/service/service.h"
9
10namespace Kernel {
11class KEvent;
12class KReadableEvent;
13} // namespace Kernel
14
15namespace Core {
16class System;
17}
18
19namespace Service::BTM {
20
21class IBtmUserCore final : public ServiceFramework<IBtmUserCore> {
22public:
23 explicit IBtmUserCore(Core::System& system_);
24 ~IBtmUserCore() override;
25
26private:
27 Result AcquireBleScanEvent(Out<bool> out_is_valid,
28 OutCopyHandle<Kernel::KReadableEvent> out_event);
29
30 Result AcquireBleConnectionEvent(Out<bool> out_is_valid,
31 OutCopyHandle<Kernel::KReadableEvent> out_event);
32
33 Result AcquireBleServiceDiscoveryEvent(Out<bool> out_is_valid,
34 OutCopyHandle<Kernel::KReadableEvent> out_event);
35
36 Result AcquireBleMtuConfigEvent(Out<bool> out_is_valid,
37 OutCopyHandle<Kernel::KReadableEvent> out_event);
38
39 KernelHelpers::ServiceContext service_context;
40
41 Kernel::KEvent* scan_event;
42 Kernel::KEvent* connection_event;
43 Kernel::KEvent* service_discovery_event;
44 Kernel::KEvent* config_event;
45};
46
47} // namespace Service::BTM
diff --git a/src/core/hle/service/ns/application_manager_interface.cpp b/src/core/hle/service/ns/application_manager_interface.cpp
index 9c7975b77..2e3a44c0d 100755
--- a/src/core/hle/service/ns/application_manager_interface.cpp
+++ b/src/core/hle/service/ns/application_manager_interface.cpp
@@ -441,12 +441,13 @@ Result IApplicationManagerInterface::GetApplicationRightsOnClient(
441 flags, application_id, account_id.FormattedString()); 441 flags, application_id, account_id.FormattedString());
442 442
443 if (!out_rights.empty()) { 443 if (!out_rights.empty()) {
444 out_rights[0] = { 444 ApplicationRightsOnClient rights{};
445 .application_id = application_id, 445 rights.application_id = application_id;
446 .uid = account_id, 446 rights.uid = account_id;
447 .flags = 0, 447 rights.flags = 0;
448 .flags2 = 0, 448 rights.flags2 = 0;
449 }; 449
450 out_rights[0] = rights;
450 *out_count = 1; 451 *out_count = 1;
451 } else { 452 } else {
452 *out_count = 0; 453 *out_count = 0;
diff --git a/src/core/hle/service/ns/ns_types.h b/src/core/hle/service/ns/ns_types.h
index 37ff078bd..38421b0f4 100755
--- a/src/core/hle/service/ns/ns_types.h
+++ b/src/core/hle/service/ns/ns_types.h
@@ -13,8 +13,8 @@ enum class ApplicationRecordType : u8 {
13 Installing = 2, 13 Installing = 2,
14 Installed = 3, 14 Installed = 3,
15 GameCardNotInserted = 5, 15 GameCardNotInserted = 5,
16 Archived = 0xB, 16 Archived = 11,
17 GameCard = 0x10, 17 GameCard = 16,
18}; 18};
19 19
20enum class ApplicationControlSource : u8 { 20enum class ApplicationControlSource : u8 {
@@ -37,31 +37,34 @@ struct ApplicationRecord {
37 u8 unknown2; 37 u8 unknown2;
38 INSERT_PADDING_BYTES_NOINIT(0x7); 38 INSERT_PADDING_BYTES_NOINIT(0x7);
39}; 39};
40static_assert(sizeof(ApplicationRecord) == 0x18, "ApplicationRecord is an invalid size"); 40static_assert(sizeof(ApplicationRecord) == 0x18, "ApplicationRecord has incorrect size.");
41 41
42/// ApplicationView 42/// ApplicationView
43struct ApplicationView { 43struct ApplicationView {
44 u64 application_id; ///< ApplicationId. 44 u64 application_id; ///< ApplicationId.
45 u32 unk; ///< Unknown. 45 u32 unk; ///< Unknown.
46 u32 flags; ///< Flags. 46 u32 flags; ///< Flags.
47 u8 unk_x10[0x10]; ///< Unknown. 47 std::array<u8, 0x10> unk_x10; ///< Unknown.
48 u32 unk_x20; ///< Unknown. 48 u32 unk_x20; ///< Unknown.
49 u16 unk_x24; ///< Unknown. 49 u16 unk_x24; ///< Unknown.
50 u8 unk_x26[0x2]; ///< Unknown. 50 std::array<u8, 0x2> unk_x26; ///< Unknown.
51 u8 unk_x28[0x8]; ///< Unknown. 51 std::array<u8, 0x8> unk_x28; ///< Unknown.
52 u8 unk_x30[0x10]; ///< Unknown. 52 std::array<u8, 0x10> unk_x30; ///< Unknown.
53 u32 unk_x40; ///< Unknown. 53 u32 unk_x40; ///< Unknown.
54 u8 unk_x44; ///< Unknown. 54 u8 unk_x44; ///< Unknown.
55 u8 unk_x45[0xb]; ///< Unknown. 55 std::array<u8, 0xb> unk_x45; ///< Unknown.
56}; 56};
57static_assert(sizeof(ApplicationView) == 0x50, "ApplicationView has incorrect size.");
57 58
58struct ApplicationRightsOnClient { 59struct ApplicationRightsOnClient {
59 u64 application_id; 60 u64 application_id;
60 Common::UUID uid; 61 Common::UUID uid;
61 u8 flags; 62 u8 flags;
62 u8 flags2; 63 u8 flags2;
63 INSERT_PADDING_BYTES(0x6); 64 INSERT_PADDING_BYTES_NOINIT(0x6);
64}; 65};
66static_assert(sizeof(ApplicationRightsOnClient) == 0x20,
67 "ApplicationRightsOnClient has incorrect size.");
65 68
66/// NsPromotionInfo 69/// NsPromotionInfo
67struct PromotionInfo { 70struct PromotionInfo {
@@ -74,12 +77,15 @@ struct PromotionInfo {
74 ///< remaining_time is set. 77 ///< remaining_time is set.
75 INSERT_PADDING_BYTES_NOINIT(0x3); 78 INSERT_PADDING_BYTES_NOINIT(0x3);
76}; 79};
80static_assert(sizeof(PromotionInfo) == 0x20, "PromotionInfo has incorrect size.");
77 81
78/// NsApplicationViewWithPromotionInfo 82/// NsApplicationViewWithPromotionInfo
79struct ApplicationViewWithPromotionInfo { 83struct ApplicationViewWithPromotionInfo {
80 ApplicationView view; ///< \ref NsApplicationView 84 ApplicationView view; ///< \ref NsApplicationView
81 PromotionInfo promotion; ///< \ref NsPromotionInfo 85 PromotionInfo promotion; ///< \ref NsPromotionInfo
82}; 86};
87static_assert(sizeof(ApplicationViewWithPromotionInfo) == 0x70,
88 "ApplicationViewWithPromotionInfo has incorrect size.");
83 89
84struct ApplicationOccupiedSizeEntity { 90struct ApplicationOccupiedSizeEntity {
85 FileSys::StorageId storage_id; 91 FileSys::StorageId storage_id;
@@ -93,10 +99,13 @@ static_assert(sizeof(ApplicationOccupiedSizeEntity) == 0x20,
93struct ApplicationOccupiedSize { 99struct ApplicationOccupiedSize {
94 std::array<ApplicationOccupiedSizeEntity, 4> entities; 100 std::array<ApplicationOccupiedSizeEntity, 4> entities;
95}; 101};
102static_assert(sizeof(ApplicationOccupiedSize) == 0x80,
103 "ApplicationOccupiedSize has incorrect size.");
96 104
97struct ContentPath { 105struct ContentPath {
98 u8 file_system_proxy_type; 106 u8 file_system_proxy_type;
99 u64 program_id; 107 u64 program_id;
100}; 108};
109static_assert(sizeof(ContentPath) == 0x10, "ContentPath has incorrect size.");
101 110
102} // namespace Service::NS 111} // namespace Service::NS
diff --git a/src/core/hle/service/ns/read_only_application_control_data_interface.cpp b/src/core/hle/service/ns/read_only_application_control_data_interface.cpp
index 1587aed44..9b2ca94a4 100755
--- a/src/core/hle/service/ns/read_only_application_control_data_interface.cpp
+++ b/src/core/hle/service/ns/read_only_application_control_data_interface.cpp
@@ -43,7 +43,7 @@ Result IReadOnlyApplicationControlDataInterface::GetApplicationControlData(
43 const auto size = out_buffer.size(); 43 const auto size = out_buffer.size();
44 44
45 const auto icon_size = control.second ? control.second->GetSize() : 0; 45 const auto icon_size = control.second ? control.second->GetSize() : 0;
46 const auto total_size = 0x4000 + icon_size; 46 const auto total_size = sizeof(FileSys::RawNACP) + icon_size;
47 47
48 if (size < total_size) { 48 if (size < total_size) {
49 LOG_ERROR(Service_NS, "output buffer is too small! (actual={:016X}, expected_min=0x4000)", 49 LOG_ERROR(Service_NS, "output buffer is too small! (actual={:016X}, expected_min=0x4000)",
@@ -57,11 +57,11 @@ Result IReadOnlyApplicationControlDataInterface::GetApplicationControlData(
57 } else { 57 } else {
58 LOG_WARNING(Service_NS, "missing NACP data for application_id={:016X}, defaulting to zero", 58 LOG_WARNING(Service_NS, "missing NACP data for application_id={:016X}, defaulting to zero",
59 application_id); 59 application_id);
60 std::memset(out_buffer.data(), 0, 0x4000); 60 std::memset(out_buffer.data(), 0, sizeof(FileSys::RawNACP));
61 } 61 }
62 62
63 if (control.second != nullptr) { 63 if (control.second != nullptr) {
64 control.second->Read(out_buffer.data() + 0x4000, icon_size); 64 control.second->Read(out_buffer.data() + sizeof(FileSys::RawNACP), icon_size);
65 } else { 65 } else {
66 LOG_WARNING(Service_NS, "missing icon data for application_id={:016X}", application_id); 66 LOG_WARNING(Service_NS, "missing icon data for application_id={:016X}", application_id);
67 } 67 }
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index bd77057b0..7f183bacc 100755
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -1290,10 +1290,6 @@ u64 Device::GetDeviceMemoryUsage() const {
1290} 1290}
1291 1291
1292void Device::CollectPhysicalMemoryInfo() { 1292void Device::CollectPhysicalMemoryInfo() {
1293 // Account for resolution scaling in memory limits
1294 const size_t normal_memory = 6_GiB;
1295 const size_t scaler_memory = 1_GiB * Settings::values.resolution_info.ScaleUp(1);
1296
1297 // Calculate limits using memory budget 1293 // Calculate limits using memory budget
1298 VkPhysicalDeviceMemoryBudgetPropertiesEXT budget{}; 1294 VkPhysicalDeviceMemoryBudgetPropertiesEXT budget{};
1299 budget.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT; 1295 budget.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT;
@@ -1324,7 +1320,15 @@ void Device::CollectPhysicalMemoryInfo() {
1324 if (!is_integrated) { 1320 if (!is_integrated) {
1325 const u64 reserve_memory = std::min<u64>(device_access_memory / 8, 1_GiB); 1321 const u64 reserve_memory = std::min<u64>(device_access_memory / 8, 1_GiB);
1326 device_access_memory -= reserve_memory; 1322 device_access_memory -= reserve_memory;
1327 device_access_memory = std::min<u64>(device_access_memory, normal_memory + scaler_memory); 1323
1324 if (Settings::values.vram_usage_mode.GetValue() != Settings::VramUsageMode::Aggressive) {
1325 // Account for resolution scaling in memory limits
1326 const size_t normal_memory = 6_GiB;
1327 const size_t scaler_memory = 1_GiB * Settings::values.resolution_info.ScaleUp(1);
1328 device_access_memory =
1329 std::min<u64>(device_access_memory, normal_memory + scaler_memory);
1330 }
1331
1328 return; 1332 return;
1329 } 1333 }
1330 const s64 available_memory = static_cast<s64>(device_access_memory - device_initial_usage); 1334 const s64 available_memory = static_cast<s64>(device_access_memory - device_initial_usage);
diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp
index d138b53c8..0549e8ae4 100755
--- a/src/yuzu/configuration/shared_translation.cpp
+++ b/src/yuzu/configuration/shared_translation.cpp
@@ -164,6 +164,11 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) {
164 "the emulator to decompress to an intermediate format any card supports, RGBA8.\n" 164 "the emulator to decompress to an intermediate format any card supports, RGBA8.\n"
165 "This option recompresses RGBA8 to either the BC1 or BC3 format, saving VRAM but " 165 "This option recompresses RGBA8 to either the BC1 or BC3 format, saving VRAM but "
166 "negatively affecting image quality.")); 166 "negatively affecting image quality."));
167 INSERT(Settings, vram_usage_mode, tr("VRAM Usage Mode:"),
168 tr("Selects whether the emulator should prefer to conserve memory or make maximum usage "
169 "of available video memory for performance. Has no effect on integrated graphics. "
170 "Aggressive mode may severely impact the performance of other applications such as "
171 "recording software."));
167 INSERT( 172 INSERT(
168 Settings, vsync_mode, tr("VSync Mode:"), 173 Settings, vsync_mode, tr("VSync Mode:"),
169 tr("FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen " 174 tr("FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen "
@@ -315,6 +320,11 @@ std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent) {
315 PAIR(AstcRecompression, Bc1, tr("BC1 (Low quality)")), 320 PAIR(AstcRecompression, Bc1, tr("BC1 (Low quality)")),
316 PAIR(AstcRecompression, Bc3, tr("BC3 (Medium quality)")), 321 PAIR(AstcRecompression, Bc3, tr("BC3 (Medium quality)")),
317 }}); 322 }});
323 translations->insert({Settings::EnumMetadata<Settings::VramUsageMode>::Index(),
324 {
325 PAIR(VramUsageMode, Conservative, tr("Conservative")),
326 PAIR(VramUsageMode, Aggressive, tr("Aggressive")),
327 }});
318 translations->insert({Settings::EnumMetadata<Settings::RendererBackend>::Index(), 328 translations->insert({Settings::EnumMetadata<Settings::RendererBackend>::Index(),
319 { 329 {
320#ifdef HAS_OPENGL 330#ifdef HAS_OPENGL