summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar David Marcec2019-06-16 19:06:33 +1000
committerGravatar David Marcec2019-06-16 19:06:33 +1000
commit335127af6921ce298a6dd63682895768c6b06e86 (patch)
tree0a505fec2c232dec0945fc02159eecc9c3af087e /src/core
parentMerge pull request #2538 from ReinUsesLisp/ssy-pbk (diff)
downloadyuzu-335127af6921ce298a6dd63682895768c6b06e86.tar.gz
yuzu-335127af6921ce298a6dd63682895768c6b06e86.tar.xz
yuzu-335127af6921ce298a6dd63682895768c6b06e86.zip
Impl'd IsUserAccountSwitchLocked, SetAudioOutVolume, GetAudioOutVolume & Partial impl of GetAccumulatedSuspendedTickChangedEvent
IPC-100 was changed to InitializeApplicationInfoOld instead of InitializeApplicationInfo. IPC-150 makes an indentical call to IPC-100 however does extra processing. They should not have the same name as it's quite confusing to debug.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/file_sys/control_metadata.cpp4
-rw-r--r--src/core/file_sys/control_metadata.h4
-rw-r--r--src/core/hle/service/acc/acc.cpp29
-rw-r--r--src/core/hle/service/acc/acc.h3
-rw-r--r--src/core/hle/service/acc/acc_u0.cpp4
-rw-r--r--src/core/hle/service/am/am.cpp17
-rw-r--r--src/core/hle/service/am/am.h3
-rw-r--r--src/core/hle/service/audio/audout_u.cpp23
8 files changed, 79 insertions, 8 deletions
diff --git a/src/core/file_sys/control_metadata.cpp b/src/core/file_sys/control_metadata.cpp
index 04da30825..735526b1c 100644
--- a/src/core/file_sys/control_metadata.cpp
+++ b/src/core/file_sys/control_metadata.cpp
@@ -87,6 +87,10 @@ u64 NACP::GetDefaultJournalSaveSize() const {
87 return raw.user_account_save_data_journal_size; 87 return raw.user_account_save_data_journal_size;
88} 88}
89 89
90bool NACP::GetUserAccountSwitchLock() const {
91 return raw.user_account_switch_lock == 1;
92}
93
90u32 NACP::GetSupportedLanguages() const { 94u32 NACP::GetSupportedLanguages() const {
91 return raw.supported_languages; 95 return raw.supported_languages;
92} 96}
diff --git a/src/core/file_sys/control_metadata.h b/src/core/file_sys/control_metadata.h
index 1be34ed55..2d8c251ac 100644
--- a/src/core/file_sys/control_metadata.h
+++ b/src/core/file_sys/control_metadata.h
@@ -30,7 +30,8 @@ struct RawNACP {
30 std::array<LanguageEntry, 16> language_entries; 30 std::array<LanguageEntry, 16> language_entries;
31 std::array<u8, 0x25> isbn; 31 std::array<u8, 0x25> isbn;
32 u8 startup_user_account; 32 u8 startup_user_account;
33 INSERT_PADDING_BYTES(2); 33 u8 user_account_switch_lock;
34 u8 addon_content_registration_type;
34 u32_le application_attribute; 35 u32_le application_attribute;
35 u32_le supported_languages; 36 u32_le supported_languages;
36 u32_le parental_control; 37 u32_le parental_control;
@@ -111,6 +112,7 @@ public:
111 u64 GetDefaultJournalSaveSize() const; 112 u64 GetDefaultJournalSaveSize() const;
112 u32 GetSupportedLanguages() const; 113 u32 GetSupportedLanguages() const;
113 std::vector<u8> GetRawBytes() const; 114 std::vector<u8> GetRawBytes() const;
115 bool GetUserAccountSwitchLock() const;
114 116
115private: 117private:
116 RawNACP raw{}; 118 RawNACP raw{};
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index cb66e344b..7a4fd636b 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -12,13 +12,17 @@
12#include "common/swap.h" 12#include "common/swap.h"
13#include "core/constants.h" 13#include "core/constants.h"
14#include "core/core_timing.h" 14#include "core/core_timing.h"
15#include "core/file_sys/control_metadata.h"
16#include "core/file_sys/patch_manager.h"
15#include "core/hle/ipc_helpers.h" 17#include "core/hle/ipc_helpers.h"
18#include "core/hle/kernel/process.h"
16#include "core/hle/service/acc/acc.h" 19#include "core/hle/service/acc/acc.h"
17#include "core/hle/service/acc/acc_aa.h" 20#include "core/hle/service/acc/acc_aa.h"
18#include "core/hle/service/acc/acc_su.h" 21#include "core/hle/service/acc/acc_su.h"
19#include "core/hle/service/acc/acc_u0.h" 22#include "core/hle/service/acc/acc_u0.h"
20#include "core/hle/service/acc/acc_u1.h" 23#include "core/hle/service/acc/acc_u1.h"
21#include "core/hle/service/acc/profile_manager.h" 24#include "core/hle/service/acc/profile_manager.h"
25#include "core/loader/loader.h"
22 26
23namespace Service::Account { 27namespace Service::Account {
24 28
@@ -213,7 +217,7 @@ void Module::Interface::IsUserRegistrationRequestPermitted(Kernel::HLERequestCon
213 rb.Push(profile_manager->CanSystemRegisterUser()); 217 rb.Push(profile_manager->CanSystemRegisterUser());
214} 218}
215 219
216void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) { 220void Module::Interface::InitializeApplicationInfoOld(Kernel::HLERequestContext& ctx) {
217 LOG_WARNING(Service_ACC, "(STUBBED) called"); 221 LOG_WARNING(Service_ACC, "(STUBBED) called");
218 IPC::ResponseBuilder rb{ctx, 2}; 222 IPC::ResponseBuilder rb{ctx, 2};
219 rb.Push(RESULT_SUCCESS); 223 rb.Push(RESULT_SUCCESS);
@@ -226,6 +230,29 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo
226 rb.PushIpcInterface<IManagerForApplication>(); 230 rb.PushIpcInterface<IManagerForApplication>();
227} 231}
228 232
233void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) {
234 LOG_DEBUG(Service_ACC, "called");
235 FileSys::NACP nacp;
236 const auto res = Core::System::GetInstance().GetAppLoader().ReadControlData(nacp);
237
238 bool is_locked = false;
239
240 if (res != Loader::ResultStatus::Success) {
241 FileSys::PatchManager pm{Core::CurrentProcess()->GetTitleID()};
242 auto [nacp_unique, discard] = pm.GetControlMetadata();
243
244 if (nacp_unique != nullptr) {
245 is_locked = nacp_unique->GetUserAccountSwitchLock();
246 }
247 } else {
248 is_locked = nacp.GetUserAccountSwitchLock();
249 }
250
251 IPC::ResponseBuilder rb{ctx, 3};
252 rb.Push(RESULT_SUCCESS);
253 rb.PushRaw<u8>(is_locked);
254}
255
229void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) { 256void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) {
230 LOG_DEBUG(Service_ACC, "called"); 257 LOG_DEBUG(Service_ACC, "called");
231 // A u8 is passed into this function which we can safely ignore. It's to determine if we have 258 // A u8 is passed into this function which we can safely ignore. It's to determine if we have
diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h
index 89b2104fa..6d90af3f1 100644
--- a/src/core/hle/service/acc/acc.h
+++ b/src/core/hle/service/acc/acc.h
@@ -24,10 +24,11 @@ public:
24 void ListOpenUsers(Kernel::HLERequestContext& ctx); 24 void ListOpenUsers(Kernel::HLERequestContext& ctx);
25 void GetLastOpenedUser(Kernel::HLERequestContext& ctx); 25 void GetLastOpenedUser(Kernel::HLERequestContext& ctx);
26 void GetProfile(Kernel::HLERequestContext& ctx); 26 void GetProfile(Kernel::HLERequestContext& ctx);
27 void InitializeApplicationInfo(Kernel::HLERequestContext& ctx); 27 void InitializeApplicationInfoOld(Kernel::HLERequestContext& ctx);
28 void GetBaasAccountManagerForApplication(Kernel::HLERequestContext& ctx); 28 void GetBaasAccountManagerForApplication(Kernel::HLERequestContext& ctx);
29 void IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx); 29 void IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx);
30 void TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx); 30 void TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx);
31 void IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx);
31 32
32 protected: 33 protected:
33 std::shared_ptr<Module> module; 34 std::shared_ptr<Module> module;
diff --git a/src/core/hle/service/acc/acc_u0.cpp b/src/core/hle/service/acc/acc_u0.cpp
index 182f7c7e5..932838c41 100644
--- a/src/core/hle/service/acc/acc_u0.cpp
+++ b/src/core/hle/service/acc/acc_u0.cpp
@@ -21,7 +21,7 @@ ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
21 {51, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, 21 {51, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"},
22 {60, nullptr, "ListOpenContextStoredUsers"}, 22 {60, nullptr, "ListOpenContextStoredUsers"},
23 {99, nullptr, "DebugActivateOpenContextRetention"}, 23 {99, nullptr, "DebugActivateOpenContextRetention"},
24 {100, &ACC_U0::InitializeApplicationInfo, "InitializeApplicationInfo"}, 24 {100, &ACC_U0::InitializeApplicationInfoOld, "InitializeApplicationInfoOld"},
25 {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"}, 25 {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"},
26 {102, nullptr, "AuthenticateApplicationAsync"}, 26 {102, nullptr, "AuthenticateApplicationAsync"},
27 {103, nullptr, "CheckNetworkServiceAvailabilityAsync"}, 27 {103, nullptr, "CheckNetworkServiceAvailabilityAsync"},
@@ -32,7 +32,7 @@ ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
32 {131, nullptr, "ListOpenContextStoredUsers"}, 32 {131, nullptr, "ListOpenContextStoredUsers"},
33 {140, nullptr, "InitializeApplicationInfo"}, 33 {140, nullptr, "InitializeApplicationInfo"},
34 {141, nullptr, "ListQualifiedUsers"}, 34 {141, nullptr, "ListQualifiedUsers"},
35 {150, nullptr, "IsUserAccountSwitchLocked"}, 35 {150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked"},
36 }; 36 };
37 // clang-format on 37 // clang-format on
38 38
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 3f201c821..73caf8739 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -271,7 +271,7 @@ ISelfController::ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger
271 {71, nullptr, "GetCurrentIlluminanceEx"}, 271 {71, nullptr, "GetCurrentIlluminanceEx"},
272 {80, nullptr, "SetWirelessPriorityMode"}, 272 {80, nullptr, "SetWirelessPriorityMode"},
273 {90, nullptr, "GetAccumulatedSuspendedTickValue"}, 273 {90, nullptr, "GetAccumulatedSuspendedTickValue"},
274 {91, nullptr, "GetAccumulatedSuspendedTickChangedEvent"}, 274 {91, &ISelfController::GetAccumulatedSuspendedTickChangedEvent, "GetAccumulatedSuspendedTickChangedEvent"},
275 {100, nullptr, "SetAlbumImageTakenNotificationEnabled"}, 275 {100, nullptr, "SetAlbumImageTakenNotificationEnabled"},
276 {1000, nullptr, "GetDebugStorageChannel"}, 276 {1000, nullptr, "GetDebugStorageChannel"},
277 }; 277 };
@@ -282,6 +282,10 @@ ISelfController::ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger
282 auto& kernel = Core::System::GetInstance().Kernel(); 282 auto& kernel = Core::System::GetInstance().Kernel();
283 launchable_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, 283 launchable_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual,
284 "ISelfController:LaunchableEvent"); 284 "ISelfController:LaunchableEvent");
285
286 // TODO(ogniK): Figure out where, when and why this event gets signalled
287 accumulated_suspended_tick_changed_event = Kernel::WritableEvent::CreateEventPair(
288 kernel, Kernel::ResetType::Manual, "ISelfController:AccumulatedSuspendedTickChangedEvent");
285} 289}
286 290
287ISelfController::~ISelfController() = default; 291ISelfController::~ISelfController() = default;
@@ -444,6 +448,17 @@ void ISelfController::GetIdleTimeDetectionExtension(Kernel::HLERequestContext& c
444 rb.Push<u32>(idle_time_detection_extension); 448 rb.Push<u32>(idle_time_detection_extension);
445} 449}
446 450
451void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx) {
452 // The implementation of this function is fine as is, the reason we're labelling it as stubbed
453 // is because we're currently unsure when and where accumulated_suspended_tick_changed_event is
454 // actually signalled for the time being.
455 LOG_WARNING(Service_AM, "(STUBBED) called");
456
457 IPC::ResponseBuilder rb{ctx, 2, 1};
458 rb.Push(RESULT_SUCCESS);
459 rb.PushCopyObjects(accumulated_suspended_tick_changed_event.readable);
460}
461
447AppletMessageQueue::AppletMessageQueue() { 462AppletMessageQueue::AppletMessageQueue() {
448 auto& kernel = Core::System::GetInstance().Kernel(); 463 auto& kernel = Core::System::GetInstance().Kernel();
449 on_new_message = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, 464 on_new_message = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual,
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h
index 991b7d47c..1fa069e56 100644
--- a/src/core/hle/service/am/am.h
+++ b/src/core/hle/service/am/am.h
@@ -133,9 +133,12 @@ private:
133 void SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx); 133 void SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx);
134 void SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); 134 void SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx);
135 void GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); 135 void GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx);
136 void GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx);
136 137
137 std::shared_ptr<NVFlinger::NVFlinger> nvflinger; 138 std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
138 Kernel::EventPair launchable_event; 139 Kernel::EventPair launchable_event;
140 Kernel::EventPair accumulated_suspended_tick_changed_event;
141
139 u32 idle_time_detection_extension = 0; 142 u32 idle_time_detection_extension = 0;
140 u64 num_fatal_sections_entered = 0; 143 u64 num_fatal_sections_entered = 0;
141}; 144};
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp
index 6ba41b20a..0004f2f47 100644
--- a/src/core/hle/service/audio/audout_u.cpp
+++ b/src/core/hle/service/audio/audout_u.cpp
@@ -58,8 +58,8 @@ public:
58 {9, &IAudioOut::GetAudioOutBufferCount, "GetAudioOutBufferCount"}, 58 {9, &IAudioOut::GetAudioOutBufferCount, "GetAudioOutBufferCount"},
59 {10, nullptr, "GetAudioOutPlayedSampleCount"}, 59 {10, nullptr, "GetAudioOutPlayedSampleCount"},
60 {11, nullptr, "FlushAudioOutBuffers"}, 60 {11, nullptr, "FlushAudioOutBuffers"},
61 {12, nullptr, "SetAudioOutVolume"}, 61 {12, &IAudioOut::SetAudioOutVolume, "SetAudioOutVolume"},
62 {13, nullptr, "GetAudioOutVolume"}, 62 {13, &IAudioOut::GetAudioOutVolume, "GetAudioOutVolume"},
63 }; 63 };
64 // clang-format on 64 // clang-format on
65 RegisterHandlers(functions); 65 RegisterHandlers(functions);
@@ -183,6 +183,25 @@ private:
183 rb.Push(static_cast<u32>(stream->GetQueueSize())); 183 rb.Push(static_cast<u32>(stream->GetQueueSize()));
184 } 184 }
185 185
186 void SetAudioOutVolume(Kernel::HLERequestContext& ctx) {
187 IPC::RequestParser rp{ctx};
188 float volume = rp.PopRaw<float>();
189 LOG_DEBUG(Service_Audio, "called, volume={}", volume);
190
191 stream->SetVolume(volume);
192
193 IPC::ResponseBuilder rb{ctx, 2};
194 rb.Push(RESULT_SUCCESS);
195 }
196
197 void GetAudioOutVolume(Kernel::HLERequestContext& ctx) {
198 LOG_DEBUG(Service_Audio, "called");
199
200 IPC::ResponseBuilder rb{ctx, 3};
201 rb.Push(RESULT_SUCCESS);
202 rb.PushRaw<float>(stream->GetVolume());
203 }
204
186 AudioCore::AudioOut& audio_core; 205 AudioCore::AudioOut& audio_core;
187 AudioCore::StreamPtr stream; 206 AudioCore::StreamPtr stream;
188 std::string device_name; 207 std::string device_name;