summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Zach Hilman2019-06-19 10:29:42 -0400
committerGravatar GitHub2019-06-19 10:29:42 -0400
commit5c665fcc5b3086d8b7d6d84ccdec5356ec58f5fb (patch)
tree59fbc197a941e8a363cef85a3f75b2293c3c3bff /src
parentMerge pull request #2562 from ReinUsesLisp/split-cbuf-upload (diff)
parentAddressed issues (diff)
downloadyuzu-5c665fcc5b3086d8b7d6d84ccdec5356ec58f5fb.tar.gz
yuzu-5c665fcc5b3086d8b7d6d84ccdec5356ec58f5fb.tar.xz
yuzu-5c665fcc5b3086d8b7d6d84ccdec5356ec58f5fb.zip
Merge pull request #2584 from ogniK5377/cadence
Impl'd IsUserAccountSwitchLocked, SetAudioOutVolume, GetAudioOutVolume & Partial impl of GetAccumulatedSuspendedTickChangedEvent
Diffstat (limited to 'src')
-rw-r--r--src/audio_core/stream.cpp10
-rw-r--r--src/audio_core/stream.h7
-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.cpp51
-rw-r--r--src/core/hle/service/acc/acc.h9
-rw-r--r--src/core/hle/service/acc/acc_aa.cpp5
-rw-r--r--src/core/hle/service/acc/acc_aa.h4
-rw-r--r--src/core/hle/service/acc/acc_su.cpp5
-rw-r--r--src/core/hle/service/acc/acc_su.h4
-rw-r--r--src/core/hle/service/acc/acc_u0.cpp9
-rw-r--r--src/core/hle/service/acc/acc_u0.h4
-rw-r--r--src/core/hle/service/acc/acc_u1.cpp5
-rw-r--r--src/core/hle/service/acc/acc_u1.h4
-rw-r--r--src/core/hle/service/am/am.cpp18
-rw-r--r--src/core/hle/service/am/am.h3
-rw-r--r--src/core/hle/service/audio/audout_u.cpp23
-rw-r--r--src/core/hle/service/service.cpp2
18 files changed, 134 insertions, 37 deletions
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp
index 11481a776..982c7af2f 100644
--- a/src/audio_core/stream.cpp
+++ b/src/audio_core/stream.cpp
@@ -51,6 +51,10 @@ void Stream::Stop() {
51 UNIMPLEMENTED(); 51 UNIMPLEMENTED();
52} 52}
53 53
54void Stream::SetVolume(float volume) {
55 game_volume = volume;
56}
57
54Stream::State Stream::GetState() const { 58Stream::State Stream::GetState() const {
55 return state; 59 return state;
56} 60}
@@ -62,8 +66,8 @@ s64 Stream::GetBufferReleaseCycles(const Buffer& buffer) const {
62 return Core::Timing::usToCycles(us); 66 return Core::Timing::usToCycles(us);
63} 67}
64 68
65static void VolumeAdjustSamples(std::vector<s16>& samples) { 69static void VolumeAdjustSamples(std::vector<s16>& samples, float game_volume) {
66 const float volume{std::clamp(Settings::values.volume, 0.0f, 1.0f)}; 70 const float volume{std::clamp(Settings::values.volume - (1.0f - game_volume), 0.0f, 1.0f)};
67 71
68 if (volume == 1.0f) { 72 if (volume == 1.0f) {
69 return; 73 return;
@@ -97,7 +101,7 @@ void Stream::PlayNextBuffer() {
97 active_buffer = queued_buffers.front(); 101 active_buffer = queued_buffers.front();
98 queued_buffers.pop(); 102 queued_buffers.pop();
99 103
100 VolumeAdjustSamples(active_buffer->GetSamples()); 104 VolumeAdjustSamples(active_buffer->GetSamples(), game_volume);
101 105
102 sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples()); 106 sink_stream.EnqueueSamples(GetNumChannels(), active_buffer->GetSamples());
103 107
diff --git a/src/audio_core/stream.h b/src/audio_core/stream.h
index 05071243b..8106cea43 100644
--- a/src/audio_core/stream.h
+++ b/src/audio_core/stream.h
@@ -61,6 +61,12 @@ public:
61 /// Returns a vector of recently released buffers specified by tag 61 /// Returns a vector of recently released buffers specified by tag
62 std::vector<Buffer::Tag> GetTagsAndReleaseBuffers(std::size_t max_count); 62 std::vector<Buffer::Tag> GetTagsAndReleaseBuffers(std::size_t max_count);
63 63
64 void SetVolume(float volume);
65
66 float GetVolume() const {
67 return game_volume;
68 }
69
64 /// Returns true if the stream is currently playing 70 /// Returns true if the stream is currently playing
65 bool IsPlaying() const { 71 bool IsPlaying() const {
66 return state == State::Playing; 72 return state == State::Playing;
@@ -94,6 +100,7 @@ private:
94 100
95 u32 sample_rate; ///< Sample rate of the stream 101 u32 sample_rate; ///< Sample rate of the stream
96 Format format; ///< Format of the stream 102 Format format; ///< Format of the stream
103 float game_volume = 1.0f; ///< The volume the game currently has set
97 ReleaseCallback release_callback; ///< Buffer release callback for the stream 104 ReleaseCallback release_callback; ///< Buffer release callback for the stream
98 State state{State::Stopped}; ///< Playback state of the stream 105 State state{State::Stopped}; ///< Playback state of the stream
99 Core::Timing::EventType* release_event{}; ///< Core timing release event for the stream 106 Core::Timing::EventType* release_event{}; ///< Core timing release event for the stream
diff --git a/src/core/file_sys/control_metadata.cpp b/src/core/file_sys/control_metadata.cpp
index 04da30825..f155a1341 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 != 0;
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..025714e5a 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,31 @@ 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 = system.GetAppLoader().ReadControlData(nacp);
237
238 bool is_locked = false;
239
240 if (res != Loader::ResultStatus::Success) {
241 FileSys::PatchManager pm{system.CurrentProcess()->GetTitleID()};
242 auto nacp_unique = pm.GetControlMetadata().first;
243
244 if (nacp_unique != nullptr) {
245 is_locked = nacp_unique->GetUserAccountSwitchLock();
246 } else {
247 LOG_ERROR(Service_ACC, "nacp_unique is null!");
248 }
249 } else {
250 is_locked = nacp.GetUserAccountSwitchLock();
251 }
252
253 IPC::ResponseBuilder rb{ctx, 3};
254 rb.Push(RESULT_SUCCESS);
255 rb.Push(is_locked);
256}
257
229void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) { 258void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) {
230 LOG_DEBUG(Service_ACC, "called"); 259 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 260 // A u8 is passed into this function which we can safely ignore. It's to determine if we have
@@ -251,19 +280,25 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex
251} 280}
252 281
253Module::Interface::Interface(std::shared_ptr<Module> module, 282Module::Interface::Interface(std::shared_ptr<Module> module,
254 std::shared_ptr<ProfileManager> profile_manager, const char* name) 283 std::shared_ptr<ProfileManager> profile_manager, Core::System& system,
284 const char* name)
255 : ServiceFramework(name), module(std::move(module)), 285 : ServiceFramework(name), module(std::move(module)),
256 profile_manager(std::move(profile_manager)) {} 286 profile_manager(std::move(profile_manager)), system(system) {}
257 287
258Module::Interface::~Interface() = default; 288Module::Interface::~Interface() = default;
259 289
260void InstallInterfaces(SM::ServiceManager& service_manager) { 290void InstallInterfaces(Core::System& system) {
261 auto module = std::make_shared<Module>(); 291 auto module = std::make_shared<Module>();
262 auto profile_manager = std::make_shared<ProfileManager>(); 292 auto profile_manager = std::make_shared<ProfileManager>();
263 std::make_shared<ACC_AA>(module, profile_manager)->InstallAsService(service_manager); 293
264 std::make_shared<ACC_SU>(module, profile_manager)->InstallAsService(service_manager); 294 std::make_shared<ACC_AA>(module, profile_manager, system)
265 std::make_shared<ACC_U0>(module, profile_manager)->InstallAsService(service_manager); 295 ->InstallAsService(system.ServiceManager());
266 std::make_shared<ACC_U1>(module, profile_manager)->InstallAsService(service_manager); 296 std::make_shared<ACC_SU>(module, profile_manager, system)
297 ->InstallAsService(system.ServiceManager());
298 std::make_shared<ACC_U0>(module, profile_manager, system)
299 ->InstallAsService(system.ServiceManager());
300 std::make_shared<ACC_U1>(module, profile_manager, system)
301 ->InstallAsService(system.ServiceManager());
267} 302}
268 303
269} // namespace Service::Account 304} // namespace Service::Account
diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h
index 89b2104fa..350f123a0 100644
--- a/src/core/hle/service/acc/acc.h
+++ b/src/core/hle/service/acc/acc.h
@@ -15,7 +15,8 @@ public:
15 class Interface : public ServiceFramework<Interface> { 15 class Interface : public ServiceFramework<Interface> {
16 public: 16 public:
17 explicit Interface(std::shared_ptr<Module> module, 17 explicit Interface(std::shared_ptr<Module> module,
18 std::shared_ptr<ProfileManager> profile_manager, const char* name); 18 std::shared_ptr<ProfileManager> profile_manager, Core::System& system,
19 const char* name);
19 ~Interface() override; 20 ~Interface() override;
20 21
21 void GetUserCount(Kernel::HLERequestContext& ctx); 22 void GetUserCount(Kernel::HLERequestContext& ctx);
@@ -24,18 +25,20 @@ public:
24 void ListOpenUsers(Kernel::HLERequestContext& ctx); 25 void ListOpenUsers(Kernel::HLERequestContext& ctx);
25 void GetLastOpenedUser(Kernel::HLERequestContext& ctx); 26 void GetLastOpenedUser(Kernel::HLERequestContext& ctx);
26 void GetProfile(Kernel::HLERequestContext& ctx); 27 void GetProfile(Kernel::HLERequestContext& ctx);
27 void InitializeApplicationInfo(Kernel::HLERequestContext& ctx); 28 void InitializeApplicationInfoOld(Kernel::HLERequestContext& ctx);
28 void GetBaasAccountManagerForApplication(Kernel::HLERequestContext& ctx); 29 void GetBaasAccountManagerForApplication(Kernel::HLERequestContext& ctx);
29 void IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx); 30 void IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx);
30 void TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx); 31 void TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx);
32 void IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx);
31 33
32 protected: 34 protected:
33 std::shared_ptr<Module> module; 35 std::shared_ptr<Module> module;
34 std::shared_ptr<ProfileManager> profile_manager; 36 std::shared_ptr<ProfileManager> profile_manager;
37 Core::System& system;
35 }; 38 };
36}; 39};
37 40
38/// Registers all ACC services with the specified service manager. 41/// Registers all ACC services with the specified service manager.
39void InstallInterfaces(SM::ServiceManager& service_manager); 42void InstallInterfaces(Core::System& system);
40 43
41} // namespace Service::Account 44} // namespace Service::Account
diff --git a/src/core/hle/service/acc/acc_aa.cpp b/src/core/hle/service/acc/acc_aa.cpp
index e84d9f7cf..3bac6bcd1 100644
--- a/src/core/hle/service/acc/acc_aa.cpp
+++ b/src/core/hle/service/acc/acc_aa.cpp
@@ -6,8 +6,9 @@
6 6
7namespace Service::Account { 7namespace Service::Account {
8 8
9ACC_AA::ACC_AA(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager) 9ACC_AA::ACC_AA(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
10 : Module::Interface(std::move(module), std::move(profile_manager), "acc:aa") { 10 Core::System& system)
11 : Module::Interface(std::move(module), std::move(profile_manager), system, "acc:aa") {
11 static const FunctionInfo functions[] = { 12 static const FunctionInfo functions[] = {
12 {0, nullptr, "EnsureCacheAsync"}, 13 {0, nullptr, "EnsureCacheAsync"},
13 {1, nullptr, "LoadCache"}, 14 {1, nullptr, "LoadCache"},
diff --git a/src/core/hle/service/acc/acc_aa.h b/src/core/hle/service/acc/acc_aa.h
index 9edb0421b..932c04890 100644
--- a/src/core/hle/service/acc/acc_aa.h
+++ b/src/core/hle/service/acc/acc_aa.h
@@ -10,8 +10,8 @@ namespace Service::Account {
10 10
11class ACC_AA final : public Module::Interface { 11class ACC_AA final : public Module::Interface {
12public: 12public:
13 explicit ACC_AA(std::shared_ptr<Module> module, 13 explicit ACC_AA(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
14 std::shared_ptr<ProfileManager> profile_manager); 14 Core::System& system);
15 ~ACC_AA() override; 15 ~ACC_AA() override;
16}; 16};
17 17
diff --git a/src/core/hle/service/acc/acc_su.cpp b/src/core/hle/service/acc/acc_su.cpp
index d66233cad..1b7ec3ed0 100644
--- a/src/core/hle/service/acc/acc_su.cpp
+++ b/src/core/hle/service/acc/acc_su.cpp
@@ -6,8 +6,9 @@
6 6
7namespace Service::Account { 7namespace Service::Account {
8 8
9ACC_SU::ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager) 9ACC_SU::ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
10 : Module::Interface(std::move(module), std::move(profile_manager), "acc:su") { 10 Core::System& system)
11 : Module::Interface(std::move(module), std::move(profile_manager), system, "acc:su") {
11 // clang-format off 12 // clang-format off
12 static const FunctionInfo functions[] = { 13 static const FunctionInfo functions[] = {
13 {0, &ACC_SU::GetUserCount, "GetUserCount"}, 14 {0, &ACC_SU::GetUserCount, "GetUserCount"},
diff --git a/src/core/hle/service/acc/acc_su.h b/src/core/hle/service/acc/acc_su.h
index fcced063a..0a700d9bf 100644
--- a/src/core/hle/service/acc/acc_su.h
+++ b/src/core/hle/service/acc/acc_su.h
@@ -10,8 +10,8 @@ namespace Service::Account {
10 10
11class ACC_SU final : public Module::Interface { 11class ACC_SU final : public Module::Interface {
12public: 12public:
13 explicit ACC_SU(std::shared_ptr<Module> module, 13 explicit ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
14 std::shared_ptr<ProfileManager> profile_manager); 14 Core::System& system);
15 ~ACC_SU() override; 15 ~ACC_SU() override;
16}; 16};
17 17
diff --git a/src/core/hle/service/acc/acc_u0.cpp b/src/core/hle/service/acc/acc_u0.cpp
index 182f7c7e5..2f239e8c0 100644
--- a/src/core/hle/service/acc/acc_u0.cpp
+++ b/src/core/hle/service/acc/acc_u0.cpp
@@ -6,8 +6,9 @@
6 6
7namespace Service::Account { 7namespace Service::Account {
8 8
9ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager) 9ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
10 : Module::Interface(std::move(module), std::move(profile_manager), "acc:u0") { 10 Core::System& system)
11 : Module::Interface(std::move(module), std::move(profile_manager), system, "acc:u0") {
11 // clang-format off 12 // clang-format off
12 static const FunctionInfo functions[] = { 13 static const FunctionInfo functions[] = {
13 {0, &ACC_U0::GetUserCount, "GetUserCount"}, 14 {0, &ACC_U0::GetUserCount, "GetUserCount"},
@@ -21,7 +22,7 @@ ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
21 {51, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, 22 {51, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"},
22 {60, nullptr, "ListOpenContextStoredUsers"}, 23 {60, nullptr, "ListOpenContextStoredUsers"},
23 {99, nullptr, "DebugActivateOpenContextRetention"}, 24 {99, nullptr, "DebugActivateOpenContextRetention"},
24 {100, &ACC_U0::InitializeApplicationInfo, "InitializeApplicationInfo"}, 25 {100, &ACC_U0::InitializeApplicationInfoOld, "InitializeApplicationInfoOld"},
25 {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"}, 26 {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"},
26 {102, nullptr, "AuthenticateApplicationAsync"}, 27 {102, nullptr, "AuthenticateApplicationAsync"},
27 {103, nullptr, "CheckNetworkServiceAvailabilityAsync"}, 28 {103, nullptr, "CheckNetworkServiceAvailabilityAsync"},
@@ -32,7 +33,7 @@ ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
32 {131, nullptr, "ListOpenContextStoredUsers"}, 33 {131, nullptr, "ListOpenContextStoredUsers"},
33 {140, nullptr, "InitializeApplicationInfo"}, 34 {140, nullptr, "InitializeApplicationInfo"},
34 {141, nullptr, "ListQualifiedUsers"}, 35 {141, nullptr, "ListQualifiedUsers"},
35 {150, nullptr, "IsUserAccountSwitchLocked"}, 36 {150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked"},
36 }; 37 };
37 // clang-format on 38 // clang-format on
38 39
diff --git a/src/core/hle/service/acc/acc_u0.h b/src/core/hle/service/acc/acc_u0.h
index a1290e0bd..3bd9c3164 100644
--- a/src/core/hle/service/acc/acc_u0.h
+++ b/src/core/hle/service/acc/acc_u0.h
@@ -10,8 +10,8 @@ namespace Service::Account {
10 10
11class ACC_U0 final : public Module::Interface { 11class ACC_U0 final : public Module::Interface {
12public: 12public:
13 explicit ACC_U0(std::shared_ptr<Module> module, 13 explicit ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
14 std::shared_ptr<ProfileManager> profile_manager); 14 Core::System& system);
15 ~ACC_U0() override; 15 ~ACC_U0() override;
16}; 16};
17 17
diff --git a/src/core/hle/service/acc/acc_u1.cpp b/src/core/hle/service/acc/acc_u1.cpp
index 2dd17d935..6520b3968 100644
--- a/src/core/hle/service/acc/acc_u1.cpp
+++ b/src/core/hle/service/acc/acc_u1.cpp
@@ -6,8 +6,9 @@
6 6
7namespace Service::Account { 7namespace Service::Account {
8 8
9ACC_U1::ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager) 9ACC_U1::ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
10 : Module::Interface(std::move(module), std::move(profile_manager), "acc:u1") { 10 Core::System& system)
11 : Module::Interface(std::move(module), std::move(profile_manager), system, "acc:u1") {
11 // clang-format off 12 // clang-format off
12 static const FunctionInfo functions[] = { 13 static const FunctionInfo functions[] = {
13 {0, &ACC_U1::GetUserCount, "GetUserCount"}, 14 {0, &ACC_U1::GetUserCount, "GetUserCount"},
diff --git a/src/core/hle/service/acc/acc_u1.h b/src/core/hle/service/acc/acc_u1.h
index 9e79daee3..829f8a744 100644
--- a/src/core/hle/service/acc/acc_u1.h
+++ b/src/core/hle/service/acc/acc_u1.h
@@ -10,8 +10,8 @@ namespace Service::Account {
10 10
11class ACC_U1 final : public Module::Interface { 11class ACC_U1 final : public Module::Interface {
12public: 12public:
13 explicit ACC_U1(std::shared_ptr<Module> module, 13 explicit ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
14 std::shared_ptr<ProfileManager> profile_manager); 14 Core::System& system);
15 ~ACC_U1() override; 15 ~ACC_U1() override;
16}; 16};
17 17
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 3f201c821..4a7bf4acb 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,11 @@ 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");
289 accumulated_suspended_tick_changed_event.writable->Signal(); // Is signalled on creation
285} 290}
286 291
287ISelfController::~ISelfController() = default; 292ISelfController::~ISelfController() = default;
@@ -444,6 +449,17 @@ void ISelfController::GetIdleTimeDetectionExtension(Kernel::HLERequestContext& c
444 rb.Push<u32>(idle_time_detection_extension); 449 rb.Push<u32>(idle_time_detection_extension);
445} 450}
446 451
452void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx) {
453 // The implementation of this function is fine as is, the reason we're labelling it as stubbed
454 // is because we're currently unsure when and where accumulated_suspended_tick_changed_event is
455 // actually signalled for the time being.
456 LOG_WARNING(Service_AM, "(STUBBED) called");
457
458 IPC::ResponseBuilder rb{ctx, 2, 1};
459 rb.Push(RESULT_SUCCESS);
460 rb.PushCopyObjects(accumulated_suspended_tick_changed_event.readable);
461}
462
447AppletMessageQueue::AppletMessageQueue() { 463AppletMessageQueue::AppletMessageQueue() {
448 auto& kernel = Core::System::GetInstance().Kernel(); 464 auto& kernel = Core::System::GetInstance().Kernel();
449 on_new_message = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, 465 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..7db6eb08d 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 const float volume = rp.Pop<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.Push(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;
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 00806b0ed..6c69f899e 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -200,7 +200,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system,
200 200
201 SM::ServiceManager::InstallInterfaces(sm); 201 SM::ServiceManager::InstallInterfaces(sm);
202 202
203 Account::InstallInterfaces(*sm); 203 Account::InstallInterfaces(system);
204 AM::InstallInterfaces(*sm, nv_flinger); 204 AM::InstallInterfaces(*sm, nv_flinger);
205 AOC::InstallInterfaces(*sm); 205 AOC::InstallInterfaces(*sm);
206 APM::InstallInterfaces(*sm); 206 APM::InstallInterfaces(*sm);