aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xREADME.md2
-rwxr-xr-xsrc/common/ring_buffer.h1
-rwxr-xr-xsrc/core/hle/service/audio/audio_controller.cpp2
-rwxr-xr-xsrc/core/hle/service/btdrv/btdrv.cpp32
-rwxr-xr-xsrc/core/hle/service/friend/friend.cpp91
-rwxr-xr-xsrc/core/hle/service/hid/hid_system_server.cpp12
-rwxr-xr-xsrc/core/hle/service/hid/hid_system_server.h1
-rwxr-xr-xsrc/core/hle/service/lbl/lbl.cpp31
-rwxr-xr-xsrc/core/hle/service/nfc/common/device_manager.cpp8
-rwxr-xr-xsrc/core/hle/service/nfc/common/device_manager.h5
-rwxr-xr-xsrc/core/hle/service/nfc/nfc.cpp4
-rwxr-xr-xsrc/core/hle/service/nfc/nfc_interface.cpp24
-rwxr-xr-xsrc/core/hle/service/nfc/nfc_interface.h6
-rwxr-xr-xsrc/core/hle/service/npns/npns.cpp42
-rwxr-xr-xsrc/core/hle/service/set/settings_types.h3
-rwxr-xr-xsrc/core/hle/service/set/system_settings_server.cpp11
16 files changed, 211 insertions, 64 deletions
diff --git a/README.md b/README.md
index bda1e0184..7c0cf163c 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 4164. 4This is the source code for early-access 4165.
5 5
6## Legal Notice 6## Legal Notice
7 7
diff --git a/src/common/ring_buffer.h b/src/common/ring_buffer.h
index 50877bc15..636c6c53c 100755
--- a/src/common/ring_buffer.h
+++ b/src/common/ring_buffer.h
@@ -8,6 +8,7 @@
8#include <atomic> 8#include <atomic>
9#include <cstddef> 9#include <cstddef>
10#include <cstring> 10#include <cstring>
11#include <limits>
11#include <new> 12#include <new>
12#include <span> 13#include <span>
13#include <type_traits> 14#include <type_traits>
diff --git a/src/core/hle/service/audio/audio_controller.cpp b/src/core/hle/service/audio/audio_controller.cpp
index c9804cf9c..7a51d1023 100755
--- a/src/core/hle/service/audio/audio_controller.cpp
+++ b/src/core/hle/service/audio/audio_controller.cpp
@@ -138,7 +138,7 @@ Result IAudioController::SetOutputModeSetting(Set::AudioOutputModeTarget target,
138} 138}
139 139
140Result IAudioController::SetHeadphoneOutputLevelMode(HeadphoneOutputLevelMode output_level_mode) { 140Result IAudioController::SetHeadphoneOutputLevelMode(HeadphoneOutputLevelMode output_level_mode) {
141 LOG_WARNING(Audio, "(STUBBED) called"); 141 LOG_WARNING(Audio, "(STUBBED) called, output_level_mode={}", output_level_mode);
142 R_SUCCEED(); 142 R_SUCCEED();
143} 143}
144 144
diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp
index 58948ca4f..2b0e0c13b 100755
--- a/src/core/hle/service/btdrv/btdrv.cpp
+++ b/src/core/hle/service/btdrv/btdrv.cpp
@@ -5,6 +5,7 @@
5#include "core/core.h" 5#include "core/core.h"
6#include "core/hle/kernel/k_event.h" 6#include "core/hle/kernel/k_event.h"
7#include "core/hle/service/btdrv/btdrv.h" 7#include "core/hle/service/btdrv/btdrv.h"
8#include "core/hle/service/cmif_serialization.h"
8#include "core/hle/service/ipc_helpers.h" 9#include "core/hle/service/ipc_helpers.h"
9#include "core/hle/service/kernel_helpers.h" 10#include "core/hle/service/kernel_helpers.h"
10#include "core/hle/service/server_manager.h" 11#include "core/hle/service/server_manager.h"
@@ -13,9 +14,9 @@
13 14
14namespace Service::BtDrv { 15namespace Service::BtDrv {
15 16
16class Bt final : public ServiceFramework<Bt> { 17class IBluetoothUser final : public ServiceFramework<IBluetoothUser> {
17public: 18public:
18 explicit Bt(Core::System& system_) 19 explicit IBluetoothUser(Core::System& system_)
19 : ServiceFramework{system_, "bt"}, service_context{system_, "bt"} { 20 : ServiceFramework{system_, "bt"}, service_context{system_, "bt"} {
20 // clang-format off 21 // clang-format off
21 static const FunctionInfo functions[] = { 22 static const FunctionInfo functions[] = {
@@ -28,7 +29,7 @@ public:
28 {6, nullptr, "SetLeResponse"}, 29 {6, nullptr, "SetLeResponse"},
29 {7, nullptr, "LeSendIndication"}, 30 {7, nullptr, "LeSendIndication"},
30 {8, nullptr, "GetLeEventInfo"}, 31 {8, nullptr, "GetLeEventInfo"},
31 {9, &Bt::RegisterBleEvent, "RegisterBleEvent"}, 32 {9, C<&IBluetoothUser::RegisterBleEvent>, "RegisterBleEvent"},
32 }; 33 };
33 // clang-format on 34 // clang-format on
34 RegisterHandlers(functions); 35 RegisterHandlers(functions);
@@ -36,17 +37,16 @@ public:
36 register_event = service_context.CreateEvent("BT:RegisterEvent"); 37 register_event = service_context.CreateEvent("BT:RegisterEvent");
37 } 38 }
38 39
39 ~Bt() override { 40 ~IBluetoothUser() override {
40 service_context.CloseEvent(register_event); 41 service_context.CloseEvent(register_event);
41 } 42 }
42 43
43private: 44private:
44 void RegisterBleEvent(HLERequestContext& ctx) { 45 Result RegisterBleEvent(OutCopyHandle<Kernel::KReadableEvent> out_event) {
45 LOG_WARNING(Service_BTM, "(STUBBED) called"); 46 LOG_WARNING(Service_BTM, "(STUBBED) called");
46 47
47 IPC::ResponseBuilder rb{ctx, 2, 1}; 48 *out_event = &register_event->GetReadableEvent();
48 rb.Push(ResultSuccess); 49 R_SUCCEED();
49 rb.PushCopyObjects(register_event->GetReadableEvent());
50 } 50 }
51 51
52 KernelHelpers::ServiceContext service_context; 52 KernelHelpers::ServiceContext service_context;
@@ -54,9 +54,9 @@ private:
54 Kernel::KEvent* register_event; 54 Kernel::KEvent* register_event;
55}; 55};
56 56
57class BtDrv final : public ServiceFramework<BtDrv> { 57class IBluetoothDriver final : public ServiceFramework<IBluetoothDriver> {
58public: 58public:
59 explicit BtDrv(Core::System& system_) : ServiceFramework{system_, "btdrv"} { 59 explicit IBluetoothDriver(Core::System& system_) : ServiceFramework{system_, "btdrv"} {
60 // clang-format off 60 // clang-format off
61 static const FunctionInfo functions[] = { 61 static const FunctionInfo functions[] = {
62 {0, nullptr, "InitializeBluetoothDriver"}, 62 {0, nullptr, "InitializeBluetoothDriver"},
@@ -93,7 +93,7 @@ public:
93 {31, nullptr, "EnableMcMode"}, 93 {31, nullptr, "EnableMcMode"},
94 {32, nullptr, "EnableLlrScan"}, 94 {32, nullptr, "EnableLlrScan"},
95 {33, nullptr, "DisableLlrScan"}, 95 {33, nullptr, "DisableLlrScan"},
96 {34, nullptr, "EnableRadio"}, 96 {34, C<&IBluetoothDriver::EnableRadio>, "EnableRadio"},
97 {35, nullptr, "SetVisibility"}, 97 {35, nullptr, "SetVisibility"},
98 {36, nullptr, "EnableTbfcScan"}, 98 {36, nullptr, "EnableTbfcScan"},
99 {37, nullptr, "RegisterHidReportEvent"}, 99 {37, nullptr, "RegisterHidReportEvent"},
@@ -195,13 +195,19 @@ public:
195 195
196 RegisterHandlers(functions); 196 RegisterHandlers(functions);
197 } 197 }
198
199private:
200 Result EnableRadio() {
201 LOG_WARNING(Service_BTDRV, "(STUBBED) called");
202 R_SUCCEED();
203 }
198}; 204};
199 205
200void LoopProcess(Core::System& system) { 206void LoopProcess(Core::System& system) {
201 auto server_manager = std::make_unique<ServerManager>(system); 207 auto server_manager = std::make_unique<ServerManager>(system);
202 208
203 server_manager->RegisterNamedService("btdrv", std::make_shared<BtDrv>(system)); 209 server_manager->RegisterNamedService("btdrv", std::make_shared<IBluetoothDriver>(system));
204 server_manager->RegisterNamedService("bt", std::make_shared<Bt>(system)); 210 server_manager->RegisterNamedService("bt", std::make_shared<IBluetoothUser>(system));
205 ServerManager::RunServer(std::move(server_manager)); 211 ServerManager::RunServer(std::move(server_manager));
206} 212}
207 213
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp
index 26b2c0673..96b7b0f6d 100755
--- a/src/core/hle/service/friend/friend.cpp
+++ b/src/core/hle/service/friend/friend.cpp
@@ -42,13 +42,13 @@ public:
42 {10701, nullptr, "GetPlayHistoryRegistrationKeyWithNetworkServiceAccountId"}, 42 {10701, nullptr, "GetPlayHistoryRegistrationKeyWithNetworkServiceAccountId"},
43 {10702, nullptr, "AddPlayHistory"}, 43 {10702, nullptr, "AddPlayHistory"},
44 {11000, nullptr, "GetProfileImageUrl"}, 44 {11000, nullptr, "GetProfileImageUrl"},
45 {20100, nullptr, "GetFriendCount"}, 45 {20100, &IFriendService::GetFriendCount, "GetFriendCount"},
46 {20101, nullptr, "GetNewlyFriendCount"}, 46 {20101, &IFriendService::GetNewlyFriendCount, "GetNewlyFriendCount"},
47 {20102, nullptr, "GetFriendDetailedInfo"}, 47 {20102, nullptr, "GetFriendDetailedInfo"},
48 {20103, nullptr, "SyncFriendList"}, 48 {20103, nullptr, "SyncFriendList"},
49 {20104, nullptr, "RequestSyncFriendList"}, 49 {20104, nullptr, "RequestSyncFriendList"},
50 {20110, nullptr, "LoadFriendSetting"}, 50 {20110, nullptr, "LoadFriendSetting"},
51 {20200, nullptr, "GetReceivedFriendRequestCount"}, 51 {20200, &IFriendService::GetReceivedFriendRequestCount, "GetReceivedFriendRequestCount"},
52 {20201, nullptr, "GetFriendRequestList"}, 52 {20201, nullptr, "GetFriendRequestList"},
53 {20300, nullptr, "GetFriendCandidateList"}, 53 {20300, nullptr, "GetFriendCandidateList"},
54 {20301, nullptr, "GetNintendoNetworkIdInfo"}, 54 {20301, nullptr, "GetNintendoNetworkIdInfo"},
@@ -61,14 +61,14 @@ public:
61 {20501, nullptr, "GetRelationship"}, 61 {20501, nullptr, "GetRelationship"},
62 {20600, nullptr, "GetUserPresenceView"}, 62 {20600, nullptr, "GetUserPresenceView"},
63 {20700, nullptr, "GetPlayHistoryList"}, 63 {20700, nullptr, "GetPlayHistoryList"},
64 {20701, nullptr, "GetPlayHistoryStatistics"}, 64 {20701, &IFriendService::GetPlayHistoryStatistics, "GetPlayHistoryStatistics"},
65 {20800, nullptr, "LoadUserSetting"}, 65 {20800, nullptr, "LoadUserSetting"},
66 {20801, nullptr, "SyncUserSetting"}, 66 {20801, nullptr, "SyncUserSetting"},
67 {20900, nullptr, "RequestListSummaryOverlayNotification"}, 67 {20900, nullptr, "RequestListSummaryOverlayNotification"},
68 {21000, nullptr, "GetExternalApplicationCatalog"}, 68 {21000, nullptr, "GetExternalApplicationCatalog"},
69 {22000, nullptr, "GetReceivedFriendInvitationList"}, 69 {22000, nullptr, "GetReceivedFriendInvitationList"},
70 {22001, nullptr, "GetReceivedFriendInvitationDetailedInfo"}, 70 {22001, nullptr, "GetReceivedFriendInvitationDetailedInfo"},
71 {22010, nullptr, "GetReceivedFriendInvitationCountCache"}, 71 {22010, &IFriendService::GetReceivedFriendInvitationCountCache, "GetReceivedFriendInvitationCountCache"},
72 {30100, nullptr, "DropFriendNewlyFlags"}, 72 {30100, nullptr, "DropFriendNewlyFlags"},
73 {30101, nullptr, "DeleteFriend"}, 73 {30101, nullptr, "DeleteFriend"},
74 {30110, nullptr, "DropFriendNewlyFlag"}, 74 {30110, nullptr, "DropFriendNewlyFlag"},
@@ -144,6 +144,33 @@ private:
144 rb.PushCopyObjects(completion_event->GetReadableEvent()); 144 rb.PushCopyObjects(completion_event->GetReadableEvent());
145 } 145 }
146 146
147 void GetFriendList(HLERequestContext& ctx) {
148 IPC::RequestParser rp{ctx};
149 const auto friend_offset = rp.Pop<u32>();
150 const auto uuid = rp.PopRaw<Common::UUID>();
151 [[maybe_unused]] const auto filter = rp.PopRaw<SizedFriendFilter>();
152 const auto pid = rp.Pop<u64>();
153 LOG_WARNING(Service_Friend, "(STUBBED) called, offset={}, uuid=0x{}, pid={}", friend_offset,
154 uuid.RawString(), pid);
155
156 IPC::ResponseBuilder rb{ctx, 3};
157 rb.Push(ResultSuccess);
158
159 rb.Push<u32>(0); // Friend count
160 // TODO(ogniK): Return a buffer of u64s which are the "NetworkServiceAccountId"
161 }
162
163 void CheckFriendListAvailability(HLERequestContext& ctx) {
164 IPC::RequestParser rp{ctx};
165 const auto uuid{rp.PopRaw<Common::UUID>()};
166
167 LOG_WARNING(Service_Friend, "(STUBBED) called, uuid=0x{}", uuid.RawString());
168
169 IPC::ResponseBuilder rb{ctx, 3};
170 rb.Push(ResultSuccess);
171 rb.Push(true);
172 }
173
147 void GetBlockedUserListIds(HLERequestContext& ctx) { 174 void GetBlockedUserListIds(HLERequestContext& ctx) {
148 // This is safe to stub, as there should be no adverse consequences from reporting no 175 // This is safe to stub, as there should be no adverse consequences from reporting no
149 // blocked users. 176 // blocked users.
@@ -153,6 +180,17 @@ private:
153 rb.Push<u32>(0); // Indicates there are no blocked users 180 rb.Push<u32>(0); // Indicates there are no blocked users
154 } 181 }
155 182
183 void CheckBlockedUserListAvailability(HLERequestContext& ctx) {
184 IPC::RequestParser rp{ctx};
185 const auto uuid{rp.PopRaw<Common::UUID>()};
186
187 LOG_WARNING(Service_Friend, "(STUBBED) called, uuid=0x{}", uuid.RawString());
188
189 IPC::ResponseBuilder rb{ctx, 3};
190 rb.Push(ResultSuccess);
191 rb.Push(true);
192 }
193
156 void DeclareCloseOnlinePlaySession(HLERequestContext& ctx) { 194 void DeclareCloseOnlinePlaySession(HLERequestContext& ctx) {
157 // Stub used by Splatoon 2 195 // Stub used by Splatoon 2
158 LOG_WARNING(Service_Friend, "(STUBBED) called"); 196 LOG_WARNING(Service_Friend, "(STUBBED) called");
@@ -179,42 +217,43 @@ private:
179 rb.Push(ResultSuccess); 217 rb.Push(ResultSuccess);
180 } 218 }
181 219
182 void GetFriendList(HLERequestContext& ctx) { 220 void GetFriendCount(HLERequestContext& ctx) {
183 IPC::RequestParser rp{ctx}; 221 LOG_DEBUG(Service_Friend, "(STUBBED) called");
184 const auto friend_offset = rp.Pop<u32>();
185 const auto uuid = rp.PopRaw<Common::UUID>();
186 [[maybe_unused]] const auto filter = rp.PopRaw<SizedFriendFilter>();
187 const auto pid = rp.Pop<u64>();
188 LOG_WARNING(Service_Friend, "(STUBBED) called, offset={}, uuid=0x{}, pid={}", friend_offset,
189 uuid.RawString(), pid);
190 222
191 IPC::ResponseBuilder rb{ctx, 3}; 223 IPC::ResponseBuilder rb{ctx, 3};
192 rb.Push(ResultSuccess); 224 rb.Push(ResultSuccess);
193 225 rb.Push(0);
194 rb.Push<u32>(0); // Friend count
195 // TODO(ogniK): Return a buffer of u64s which are the "NetworkServiceAccountId"
196 } 226 }
197 227
198 void CheckFriendListAvailability(HLERequestContext& ctx) { 228 void GetNewlyFriendCount(HLERequestContext& ctx) {
199 IPC::RequestParser rp{ctx}; 229 LOG_DEBUG(Service_Friend, "(STUBBED) called");
200 const auto uuid{rp.PopRaw<Common::UUID>()};
201 230
202 LOG_WARNING(Service_Friend, "(STUBBED) called, uuid=0x{}", uuid.RawString()); 231 IPC::ResponseBuilder rb{ctx, 3};
232 rb.Push(ResultSuccess);
233 rb.Push(0);
234 }
235
236 void GetReceivedFriendRequestCount(HLERequestContext& ctx) {
237 LOG_DEBUG(Service_Friend, "(STUBBED) called");
203 238
204 IPC::ResponseBuilder rb{ctx, 3}; 239 IPC::ResponseBuilder rb{ctx, 3};
205 rb.Push(ResultSuccess); 240 rb.Push(ResultSuccess);
206 rb.Push(true); 241 rb.Push(0);
207 } 242 }
208 243
209 void CheckBlockedUserListAvailability(HLERequestContext& ctx) { 244 void GetPlayHistoryStatistics(HLERequestContext& ctx) {
210 IPC::RequestParser rp{ctx}; 245 LOG_ERROR(Service_Friend, "(STUBBED) called, check in out");
211 const auto uuid{rp.PopRaw<Common::UUID>()};
212 246
213 LOG_WARNING(Service_Friend, "(STUBBED) called, uuid=0x{}", uuid.RawString()); 247 IPC::ResponseBuilder rb{ctx, 2};
248 rb.Push(ResultSuccess);
249 }
250
251 void GetReceivedFriendInvitationCountCache(HLERequestContext& ctx) {
252 LOG_DEBUG(Service_Friend, "(STUBBED) called, check in out");
214 253
215 IPC::ResponseBuilder rb{ctx, 3}; 254 IPC::ResponseBuilder rb{ctx, 3};
216 rb.Push(ResultSuccess); 255 rb.Push(ResultSuccess);
217 rb.Push(true); 256 rb.Push(0);
218 } 257 }
219 258
220 KernelHelpers::ServiceContext service_context; 259 KernelHelpers::ServiceContext service_context;
diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp
index 7126a1dcd..b0cd63d72 100755
--- a/src/core/hle/service/hid/hid_system_server.cpp
+++ b/src/core/hle/service/hid/hid_system_server.cpp
@@ -201,7 +201,7 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour
201 {1269, nullptr, "DeleteButtonConfigStorageLeft"}, 201 {1269, nullptr, "DeleteButtonConfigStorageLeft"},
202 {1270, nullptr, "DeleteButtonConfigStorageRight"}, 202 {1270, nullptr, "DeleteButtonConfigStorageRight"},
203 {1271, &IHidSystemServer::IsUsingCustomButtonConfig, "IsUsingCustomButtonConfig"}, 203 {1271, &IHidSystemServer::IsUsingCustomButtonConfig, "IsUsingCustomButtonConfig"},
204 {1272, nullptr, "IsAnyCustomButtonConfigEnabled"}, 204 {1272, &IHidSystemServer::IsAnyCustomButtonConfigEnabled, "IsAnyCustomButtonConfigEnabled"},
205 {1273, nullptr, "SetAllCustomButtonConfigEnabled"}, 205 {1273, nullptr, "SetAllCustomButtonConfigEnabled"},
206 {1274, nullptr, "SetDefaultButtonConfig"}, 206 {1274, nullptr, "SetDefaultButtonConfig"},
207 {1275, nullptr, "SetAllDefaultButtonConfig"}, 207 {1275, nullptr, "SetAllDefaultButtonConfig"},
@@ -926,6 +926,16 @@ void IHidSystemServer::IsUsingCustomButtonConfig(HLERequestContext& ctx) {
926 rb.Push(is_enabled); 926 rb.Push(is_enabled);
927} 927}
928 928
929void IHidSystemServer::IsAnyCustomButtonConfigEnabled(HLERequestContext& ctx) {
930 const bool is_enabled = false;
931
932 LOG_DEBUG(Service_HID, "(STUBBED) called, is_enabled={}", is_enabled);
933
934 IPC::ResponseBuilder rb{ctx, 3};
935 rb.Push(ResultSuccess);
936 rb.Push(is_enabled);
937}
938
929std::shared_ptr<ResourceManager> IHidSystemServer::GetResourceManager() { 939std::shared_ptr<ResourceManager> IHidSystemServer::GetResourceManager() {
930 resource_manager->Initialize(); 940 resource_manager->Initialize();
931 return resource_manager; 941 return resource_manager;
diff --git a/src/core/hle/service/hid/hid_system_server.h b/src/core/hle/service/hid/hid_system_server.h
index 738313e08..1a4f244d7 100755
--- a/src/core/hle/service/hid/hid_system_server.h
+++ b/src/core/hle/service/hid/hid_system_server.h
@@ -77,6 +77,7 @@ private:
77 void GetTouchScreenDefaultConfiguration(HLERequestContext& ctx); 77 void GetTouchScreenDefaultConfiguration(HLERequestContext& ctx);
78 void SetForceHandheldStyleVibration(HLERequestContext& ctx); 78 void SetForceHandheldStyleVibration(HLERequestContext& ctx);
79 void IsUsingCustomButtonConfig(HLERequestContext& ctx); 79 void IsUsingCustomButtonConfig(HLERequestContext& ctx);
80 void IsAnyCustomButtonConfigEnabled(HLERequestContext& ctx);
80 81
81 std::shared_ptr<ResourceManager> GetResourceManager(); 82 std::shared_ptr<ResourceManager> GetResourceManager();
82 83
diff --git a/src/core/hle/service/lbl/lbl.cpp b/src/core/hle/service/lbl/lbl.cpp
index 39f5b7c72..b1737139f 100755
--- a/src/core/hle/service/lbl/lbl.cpp
+++ b/src/core/hle/service/lbl/lbl.cpp
@@ -18,8 +18,8 @@ public:
18 explicit LBL(Core::System& system_) : ServiceFramework{system_, "lbl"} { 18 explicit LBL(Core::System& system_) : ServiceFramework{system_, "lbl"} {
19 // clang-format off 19 // clang-format off
20 static const FunctionInfo functions[] = { 20 static const FunctionInfo functions[] = {
21 {0, nullptr, "SaveCurrentSetting"}, 21 {0, &LBL::SaveCurrentSetting, "SaveCurrentSetting"},
22 {1, nullptr, "LoadCurrentSetting"}, 22 {1, &LBL::LoadCurrentSetting, "LoadCurrentSetting"},
23 {2, &LBL::SetCurrentBrightnessSetting, "SetCurrentBrightnessSetting"}, 23 {2, &LBL::SetCurrentBrightnessSetting, "SetCurrentBrightnessSetting"},
24 {3, &LBL::GetCurrentBrightnessSetting, "GetCurrentBrightnessSetting"}, 24 {3, &LBL::GetCurrentBrightnessSetting, "GetCurrentBrightnessSetting"},
25 {4, nullptr, "ApplyCurrentBrightnessSettingToBacklight"}, 25 {4, nullptr, "ApplyCurrentBrightnessSettingToBacklight"},
@@ -47,7 +47,7 @@ public:
47 {26, &LBL::EnableVrMode, "EnableVrMode"}, 47 {26, &LBL::EnableVrMode, "EnableVrMode"},
48 {27, &LBL::DisableVrMode, "DisableVrMode"}, 48 {27, &LBL::DisableVrMode, "DisableVrMode"},
49 {28, &LBL::IsVrModeEnabled, "IsVrModeEnabled"}, 49 {28, &LBL::IsVrModeEnabled, "IsVrModeEnabled"},
50 {29, nullptr, "IsAutoBrightnessControlSupported"}, 50 {29, &LBL::IsAutoBrightnessControlSupported, "IsAutoBrightnessControlSupported"},
51 }; 51 };
52 // clang-format on 52 // clang-format on
53 53
@@ -60,6 +60,20 @@ private:
60 On = 1, 60 On = 1,
61 }; 61 };
62 62
63 void SaveCurrentSetting(HLERequestContext& ctx) {
64 LOG_WARNING(Service_LBL, "(STUBBED) called");
65
66 IPC::ResponseBuilder rb{ctx, 2};
67 rb.Push(ResultSuccess);
68 }
69
70 void LoadCurrentSetting(HLERequestContext& ctx) {
71 LOG_WARNING(Service_LBL, "(STUBBED) called");
72
73 IPC::ResponseBuilder rb{ctx, 2};
74 rb.Push(ResultSuccess);
75 }
76
63 void SetCurrentBrightnessSetting(HLERequestContext& ctx) { 77 void SetCurrentBrightnessSetting(HLERequestContext& ctx) {
64 IPC::RequestParser rp{ctx}; 78 IPC::RequestParser rp{ctx};
65 auto brightness = rp.Pop<float>(); 79 auto brightness = rp.Pop<float>();
@@ -310,6 +324,14 @@ private:
310 rb.Push(vr_mode_enabled); 324 rb.Push(vr_mode_enabled);
311 } 325 }
312 326
327 void IsAutoBrightnessControlSupported(HLERequestContext& ctx) {
328 LOG_DEBUG(Service_LBL, "called");
329
330 IPC::ResponseBuilder rb{ctx, 3};
331 rb.Push(ResultSuccess);
332 rb.Push<u8>(auto_brightness_supported);
333 }
334
313 bool vr_mode_enabled = false; 335 bool vr_mode_enabled = false;
314 float current_brightness = 1.0f; 336 float current_brightness = 1.0f;
315 float ambient_light_value = 0.0f; 337 float ambient_light_value = 0.0f;
@@ -317,7 +339,8 @@ private:
317 bool dimming = true; 339 bool dimming = true;
318 bool backlight_enabled = true; 340 bool backlight_enabled = true;
319 bool update_instantly = false; 341 bool update_instantly = false;
320 bool auto_brightness = false; // TODO(ogniK): Move to system settings 342 bool auto_brightness = false;
343 bool auto_brightness_supported = true; // TODO(ogniK): Move to system settings
321}; 344};
322 345
323void LoopProcess(Core::System& system) { 346void LoopProcess(Core::System& system) {
diff --git a/src/core/hle/service/nfc/common/device_manager.cpp b/src/core/hle/service/nfc/common/device_manager.cpp
index 94a8243b5..2dd3e9f89 100755
--- a/src/core/hle/service/nfc/common/device_manager.cpp
+++ b/src/core/hle/service/nfc/common/device_manager.cpp
@@ -13,6 +13,7 @@
13#include "core/hle/service/nfc/nfc_result.h" 13#include "core/hle/service/nfc/nfc_result.h"
14#include "core/hle/service/psc/time/steady_clock.h" 14#include "core/hle/service/psc/time/steady_clock.h"
15#include "core/hle/service/service.h" 15#include "core/hle/service/service.h"
16#include "core/hle/service/set/system_settings_server.h"
16#include "core/hle/service/sm/sm.h" 17#include "core/hle/service/sm/sm.h"
17#include "hid_core/hid_types.h" 18#include "hid_core/hid_types.h"
18#include "hid_core/hid_util.h" 19#include "hid_core/hid_util.h"
@@ -32,6 +33,9 @@ DeviceManager::DeviceManager(Core::System& system_, KernelHelpers::ServiceContex
32 } 33 }
33 34
34 is_initialized = false; 35 is_initialized = false;
36
37 m_set_sys =
38 system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys", true);
35} 39}
36 40
37DeviceManager ::~DeviceManager() { 41DeviceManager ::~DeviceManager() {
@@ -774,8 +778,8 @@ Result DeviceManager::CheckDeviceState(std::shared_ptr<NfcDevice> device) const
774} 778}
775 779
776Result DeviceManager::IsNfcEnabled() const { 780Result DeviceManager::IsNfcEnabled() const {
777 // TODO: This calls nn::settings::detail::GetNfcEnableFlag 781 bool is_enabled{};
778 const bool is_enabled = true; 782 R_TRY(m_set_sys->GetNfcEnableFlag(&is_enabled));
779 if (!is_enabled) { 783 if (!is_enabled) {
780 return ResultNfcDisabled; 784 return ResultNfcDisabled;
781 } 785 }
diff --git a/src/core/hle/service/nfc/common/device_manager.h b/src/core/hle/service/nfc/common/device_manager.h
index c56a2fbda..6c0e6b255 100755
--- a/src/core/hle/service/nfc/common/device_manager.h
+++ b/src/core/hle/service/nfc/common/device_manager.h
@@ -15,6 +15,10 @@
15#include "core/hle/service/service.h" 15#include "core/hle/service/service.h"
16#include "hid_core/hid_types.h" 16#include "hid_core/hid_types.h"
17 17
18namespace Service::Set {
19class ISystemSettingsServer;
20}
21
18namespace Service::NFC { 22namespace Service::NFC {
19class NfcDevice; 23class NfcDevice;
20 24
@@ -98,6 +102,7 @@ private:
98 Core::System& system; 102 Core::System& system;
99 KernelHelpers::ServiceContext service_context; 103 KernelHelpers::ServiceContext service_context;
100 Kernel::KEvent* availability_change_event; 104 Kernel::KEvent* availability_change_event;
105 std::shared_ptr<Service::Set::ISystemSettingsServer> m_set_sys;
101}; 106};
102 107
103} // namespace Service::NFC 108} // namespace Service::NFC
diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp
index 8a5d4cffa..82f5f9229 100755
--- a/src/core/hle/service/nfc/nfc.cpp
+++ b/src/core/hle/service/nfc/nfc.cpp
@@ -57,7 +57,7 @@ public:
57 {1, &NfcInterface::Finalize, "FinalizeOld"}, 57 {1, &NfcInterface::Finalize, "FinalizeOld"},
58 {2, &NfcInterface::GetState, "GetStateOld"}, 58 {2, &NfcInterface::GetState, "GetStateOld"},
59 {3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"}, 59 {3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"},
60 {100, nullptr, "SetNfcEnabledOld"}, 60 {100, &NfcInterface::SetNfcEnabled, "SetNfcEnabledOld"},
61 {400, &NfcInterface::Initialize, "Initialize"}, 61 {400, &NfcInterface::Initialize, "Initialize"},
62 {401, &NfcInterface::Finalize, "Finalize"}, 62 {401, &NfcInterface::Finalize, "Finalize"},
63 {402, &NfcInterface::GetState, "GetState"}, 63 {402, &NfcInterface::GetState, "GetState"},
@@ -71,7 +71,7 @@ public:
71 {410, &NfcInterface::GetTagInfo, "GetTagInfo"}, 71 {410, &NfcInterface::GetTagInfo, "GetTagInfo"},
72 {411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"}, 72 {411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"},
73 {412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"}, 73 {412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"},
74 {500, nullptr, "SetNfcEnabled"}, 74 {500, &NfcInterface::SetNfcEnabled, "SetNfcEnabled"},
75 {510, nullptr, "OutputTestWave"}, 75 {510, nullptr, "OutputTestWave"},
76 {1000, &NfcInterface::ReadMifare, "ReadMifare"}, 76 {1000, &NfcInterface::ReadMifare, "ReadMifare"},
77 {1001, &NfcInterface::WriteMifare, "WriteMifare"}, 77 {1001, &NfcInterface::WriteMifare, "WriteMifare"},
diff --git a/src/core/hle/service/nfc/nfc_interface.cpp b/src/core/hle/service/nfc/nfc_interface.cpp
index 3e2c7deab..c28e55431 100755
--- a/src/core/hle/service/nfc/nfc_interface.cpp
+++ b/src/core/hle/service/nfc/nfc_interface.cpp
@@ -13,13 +13,18 @@
13#include "core/hle/service/nfc/nfc_result.h" 13#include "core/hle/service/nfc/nfc_result.h"
14#include "core/hle/service/nfc/nfc_types.h" 14#include "core/hle/service/nfc/nfc_types.h"
15#include "core/hle/service/nfp/nfp_result.h" 15#include "core/hle/service/nfp/nfp_result.h"
16#include "core/hle/service/set/system_settings_server.h"
17#include "core/hle/service/sm/sm.h"
16#include "hid_core/hid_types.h" 18#include "hid_core/hid_types.h"
17 19
18namespace Service::NFC { 20namespace Service::NFC {
19 21
20NfcInterface::NfcInterface(Core::System& system_, const char* name, BackendType service_backend) 22NfcInterface::NfcInterface(Core::System& system_, const char* name, BackendType service_backend)
21 : ServiceFramework{system_, name}, service_context{system_, service_name}, 23 : ServiceFramework{system_, name}, service_context{system_, service_name},
22 backend_type{service_backend} {} 24 backend_type{service_backend} {
25 m_set_sys =
26 system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys", true);
27}
23 28
24NfcInterface ::~NfcInterface() = default; 29NfcInterface ::~NfcInterface() = default;
25 30
@@ -65,11 +70,11 @@ void NfcInterface::GetState(HLERequestContext& ctx) {
65void NfcInterface::IsNfcEnabled(HLERequestContext& ctx) { 70void NfcInterface::IsNfcEnabled(HLERequestContext& ctx) {
66 LOG_DEBUG(Service_NFC, "called"); 71 LOG_DEBUG(Service_NFC, "called");
67 72
68 // TODO: This calls nn::settings::detail::GetNfcEnableFlag 73 bool is_enabled{};
69 const bool is_enabled = true; 74 const auto result = m_set_sys->GetNfcEnableFlag(&is_enabled);
70 75
71 IPC::ResponseBuilder rb{ctx, 3}; 76 IPC::ResponseBuilder rb{ctx, 3};
72 rb.Push(ResultSuccess); 77 rb.Push(result);
73 rb.Push(is_enabled); 78 rb.Push(is_enabled);
74} 79}
75 80
@@ -212,6 +217,17 @@ void NfcInterface::AttachDeactivateEvent(HLERequestContext& ctx) {
212 rb.PushCopyObjects(out_event); 217 rb.PushCopyObjects(out_event);
213} 218}
214 219
220void NfcInterface::SetNfcEnabled(HLERequestContext& ctx) {
221 IPC::RequestParser rp{ctx};
222 const auto is_enabled{rp.Pop<bool>()};
223 LOG_DEBUG(Service_NFC, "called, is_enabled={}", is_enabled);
224
225 const auto result = m_set_sys->SetNfcEnableFlag(is_enabled);
226
227 IPC::ResponseBuilder rb{ctx, 2};
228 rb.Push(result);
229}
230
215void NfcInterface::ReadMifare(HLERequestContext& ctx) { 231void NfcInterface::ReadMifare(HLERequestContext& ctx) {
216 IPC::RequestParser rp{ctx}; 232 IPC::RequestParser rp{ctx};
217 const auto device_handle{rp.Pop<u64>()}; 233 const auto device_handle{rp.Pop<u64>()};
diff --git a/src/core/hle/service/nfc/nfc_interface.h b/src/core/hle/service/nfc/nfc_interface.h
index 08be174d8..5cc0d8ec0 100755
--- a/src/core/hle/service/nfc/nfc_interface.h
+++ b/src/core/hle/service/nfc/nfc_interface.h
@@ -7,6 +7,10 @@
7#include "core/hle/service/nfc/nfc_types.h" 7#include "core/hle/service/nfc/nfc_types.h"
8#include "core/hle/service/service.h" 8#include "core/hle/service/service.h"
9 9
10namespace Service::Set {
11class ISystemSettingsServer;
12}
13
10namespace Service::NFC { 14namespace Service::NFC {
11class DeviceManager; 15class DeviceManager;
12 16
@@ -29,6 +33,7 @@ public:
29 void AttachActivateEvent(HLERequestContext& ctx); 33 void AttachActivateEvent(HLERequestContext& ctx);
30 void AttachDeactivateEvent(HLERequestContext& ctx); 34 void AttachDeactivateEvent(HLERequestContext& ctx);
31 void ReadMifare(HLERequestContext& ctx); 35 void ReadMifare(HLERequestContext& ctx);
36 void SetNfcEnabled(HLERequestContext& ctx);
32 void WriteMifare(HLERequestContext& ctx); 37 void WriteMifare(HLERequestContext& ctx);
33 void SendCommandByPassThrough(HLERequestContext& ctx); 38 void SendCommandByPassThrough(HLERequestContext& ctx);
34 39
@@ -44,6 +49,7 @@ protected:
44 BackendType backend_type; 49 BackendType backend_type;
45 State state{State::NonInitialized}; 50 State state{State::NonInitialized};
46 std::shared_ptr<DeviceManager> device_manager = nullptr; 51 std::shared_ptr<DeviceManager> device_manager = nullptr;
52 std::shared_ptr<Service::Set::ISystemSettingsServer> m_set_sys;
47}; 53};
48 54
49} // namespace Service::NFC 55} // namespace Service::NFC
diff --git a/src/core/hle/service/npns/npns.cpp b/src/core/hle/service/npns/npns.cpp
index 2ae68a79a..06f9f752d 100755
--- a/src/core/hle/service/npns/npns.cpp
+++ b/src/core/hle/service/npns/npns.cpp
@@ -3,22 +3,26 @@
3 3
4#include <memory> 4#include <memory>
5 5
6#include "core/hle/kernel/k_event.h"
7#include "core/hle/service/cmif_serialization.h"
8#include "core/hle/service/kernel_helpers.h"
6#include "core/hle/service/npns/npns.h" 9#include "core/hle/service/npns/npns.h"
7#include "core/hle/service/server_manager.h" 10#include "core/hle/service/server_manager.h"
8#include "core/hle/service/service.h" 11#include "core/hle/service/service.h"
9 12
10namespace Service::NPNS { 13namespace Service::NPNS {
11 14
12class NPNS_S final : public ServiceFramework<NPNS_S> { 15class INpnsSystem final : public ServiceFramework<INpnsSystem> {
13public: 16public:
14 explicit NPNS_S(Core::System& system_) : ServiceFramework{system_, "npns:s"} { 17 explicit INpnsSystem(Core::System& system_)
18 : ServiceFramework{system_, "npns:s"}, service_context{system, "npns:s"} {
15 // clang-format off 19 // clang-format off
16 static const FunctionInfo functions[] = { 20 static const FunctionInfo functions[] = {
17 {1, nullptr, "ListenAll"}, 21 {1, nullptr, "ListenAll"},
18 {2, nullptr, "ListenTo"}, 22 {2, C<&INpnsSystem::ListenTo>, "ListenTo"},
19 {3, nullptr, "Receive"}, 23 {3, nullptr, "Receive"},
20 {4, nullptr, "ReceiveRaw"}, 24 {4, nullptr, "ReceiveRaw"},
21 {5, nullptr, "GetReceiveEvent"}, 25 {5, C<&INpnsSystem::GetReceiveEvent>, "GetReceiveEvent"},
22 {6, nullptr, "ListenUndelivered"}, 26 {6, nullptr, "ListenUndelivered"},
23 {7, nullptr, "GetStateChangeEVent"}, 27 {7, nullptr, "GetStateChangeEVent"},
24 {11, nullptr, "SubscribeTopic"}, 28 {11, nullptr, "SubscribeTopic"},
@@ -59,12 +63,34 @@ public:
59 // clang-format on 63 // clang-format on
60 64
61 RegisterHandlers(functions); 65 RegisterHandlers(functions);
66
67 get_receive_event = service_context.CreateEvent("npns:s:GetReceiveEvent");
62 } 68 }
69
70 ~INpnsSystem() override {
71 service_context.CloseEvent(get_receive_event);
72 }
73
74private:
75 Result ListenTo(u32 program_id) {
76 LOG_WARNING(Service_AM, "(STUBBED) called, program_id={}", program_id);
77 R_SUCCEED();
78 }
79
80 Result GetReceiveEvent(OutCopyHandle<Kernel::KReadableEvent> out_event) {
81 LOG_WARNING(Service_AM, "(STUBBED) called");
82
83 *out_event = &get_receive_event->GetReadableEvent();
84 R_SUCCEED();
85 }
86
87 KernelHelpers::ServiceContext service_context;
88 Kernel::KEvent* get_receive_event;
63}; 89};
64 90
65class NPNS_U final : public ServiceFramework<NPNS_U> { 91class INpnsUser final : public ServiceFramework<INpnsUser> {
66public: 92public:
67 explicit NPNS_U(Core::System& system_) : ServiceFramework{system_, "npns:u"} { 93 explicit INpnsUser(Core::System& system_) : ServiceFramework{system_, "npns:u"} {
68 // clang-format off 94 // clang-format off
69 static const FunctionInfo functions[] = { 95 static const FunctionInfo functions[] = {
70 {1, nullptr, "ListenAll"}, 96 {1, nullptr, "ListenAll"},
@@ -97,8 +123,8 @@ public:
97void LoopProcess(Core::System& system) { 123void LoopProcess(Core::System& system) {
98 auto server_manager = std::make_unique<ServerManager>(system); 124 auto server_manager = std::make_unique<ServerManager>(system);
99 125
100 server_manager->RegisterNamedService("npns:s", std::make_shared<NPNS_S>(system)); 126 server_manager->RegisterNamedService("npns:s", std::make_shared<INpnsSystem>(system));
101 server_manager->RegisterNamedService("npns:u", std::make_shared<NPNS_U>(system)); 127 server_manager->RegisterNamedService("npns:u", std::make_shared<INpnsUser>(system));
102 ServerManager::RunServer(std::move(server_manager)); 128 ServerManager::RunServer(std::move(server_manager));
103} 129}
104 130
diff --git a/src/core/hle/service/set/settings_types.h b/src/core/hle/service/set/settings_types.h
index 29664e88c..4fd34f46b 100755
--- a/src/core/hle/service/set/settings_types.h
+++ b/src/core/hle/service/set/settings_types.h
@@ -405,8 +405,7 @@ struct EulaVersion {
405 SystemRegionCode region_code; 405 SystemRegionCode region_code;
406 EulaVersionClockType clock_type; 406 EulaVersionClockType clock_type;
407 INSERT_PADDING_BYTES(0x4); 407 INSERT_PADDING_BYTES(0x4);
408 s64 posix_time; 408 Service::PSC::Time::SystemClockContext system_clock_context;
409 Service::PSC::Time::SteadyClockTimePoint timestamp;
410}; 409};
411static_assert(sizeof(EulaVersion) == 0x30, "EulaVersion is incorrect size"); 410static_assert(sizeof(EulaVersion) == 0x30, "EulaVersion is incorrect size");
412 411
diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp
index 93925f783..45def67db 100755
--- a/src/core/hle/service/set/system_settings_server.cpp
+++ b/src/core/hle/service/set/system_settings_server.cpp
@@ -306,6 +306,17 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
306 RegisterHandlers(functions); 306 RegisterHandlers(functions);
307 307
308 SetupSettings(); 308 SetupSettings();
309
310 // TODO: Remove this when starter applet is fully functional
311 EulaVersion eula_version{
312 .version = 0x10000,
313 .region_code = m_system_settings.region_code,
314 .clock_type = EulaVersionClockType::SteadyClock,
315 .system_clock_context = m_system_settings.user_system_clock_context,
316 };
317 m_system_settings.eula_versions[0] = eula_version;
318 m_system_settings.eula_version_count = 1;
319
309 m_save_thread = 320 m_save_thread =
310 std::jthread([this](std::stop_token stop_token) { StoreSettingsThreadFunc(stop_token); }); 321 std::jthread([this](std::stop_token stop_token) { StoreSettingsThreadFunc(stop_token); });
311} 322}