From 5fb6781c6104a618ee366c444725e32765a0c534 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sun, 16 Jun 2019 20:18:35 +1000 Subject: Cleanup --- src/audio_core/stream.h | 2 +- src/core/hle/service/acc/acc.cpp | 23 +++++++++++++---------- src/core/hle/service/acc/acc.h | 4 +++- src/core/hle/service/acc/acc_aa.cpp | 5 +++-- src/core/hle/service/acc/acc_aa.h | 4 ++-- src/core/hle/service/acc/acc_su.cpp | 5 +++-- src/core/hle/service/acc/acc_su.h | 4 ++-- src/core/hle/service/acc/acc_u0.cpp | 5 +++-- src/core/hle/service/acc/acc_u0.h | 4 ++-- src/core/hle/service/acc/acc_u1.cpp | 5 +++-- src/core/hle/service/acc/acc_u1.h | 4 ++-- src/core/hle/service/audio/audout_u.cpp | 4 ++-- 12 files changed, 39 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/audio_core/stream.h b/src/audio_core/stream.h index 97458c80a..8106cea43 100644 --- a/src/audio_core/stream.h +++ b/src/audio_core/stream.h @@ -100,6 +100,7 @@ private: u32 sample_rate; ///< Sample rate of the stream Format format; ///< Format of the stream + float game_volume = 1.0f; ///< The volume the game currently has set ReleaseCallback release_callback; ///< Buffer release callback for the stream State state{State::Stopped}; ///< Playback state of the stream Core::Timing::EventType* release_event{}; ///< Core timing release event for the stream @@ -109,7 +110,6 @@ private: SinkStream& sink_stream; ///< Output sink for the stream Core::Timing::CoreTiming& core_timing; ///< Core timing instance. std::string name; ///< Name of the stream, must be unique - float game_volume = 1.0f; ///< The volume the game currently has set }; using StreamPtr = std::shared_ptr; diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 7a4fd636b..f02f54f91 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -233,13 +233,13 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called"); FileSys::NACP nacp; - const auto res = Core::System::GetInstance().GetAppLoader().ReadControlData(nacp); + const auto res = system.GetAppLoader().ReadControlData(nacp); bool is_locked = false; if (res != Loader::ResultStatus::Success) { - FileSys::PatchManager pm{Core::CurrentProcess()->GetTitleID()}; - auto [nacp_unique, discard] = pm.GetControlMetadata(); + FileSys::PatchManager pm{system.CurrentProcess()->GetTitleID()}; + auto nacp_unique = pm.GetControlMetadata().first; if (nacp_unique != nullptr) { is_locked = nacp_unique->GetUserAccountSwitchLock(); @@ -250,7 +250,7 @@ void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); - rb.PushRaw(is_locked); + rb.Push(is_locked); } void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) { @@ -278,19 +278,22 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex } Module::Interface::Interface(std::shared_ptr module, - std::shared_ptr profile_manager, const char* name) + std::shared_ptr profile_manager, Core::System& system, + const char* name) : ServiceFramework(name), module(std::move(module)), - profile_manager(std::move(profile_manager)) {} + profile_manager(std::move(profile_manager)), system(system) {} Module::Interface::~Interface() = default; void InstallInterfaces(SM::ServiceManager& service_manager) { auto module = std::make_shared(); auto profile_manager = std::make_shared(); - std::make_shared(module, profile_manager)->InstallAsService(service_manager); - std::make_shared(module, profile_manager)->InstallAsService(service_manager); - std::make_shared(module, profile_manager)->InstallAsService(service_manager); - std::make_shared(module, profile_manager)->InstallAsService(service_manager); + Core::System& system = Core::System::GetInstance(); + + std::make_shared(module, profile_manager, system)->InstallAsService(service_manager); + std::make_shared(module, profile_manager, system)->InstallAsService(service_manager); + std::make_shared(module, profile_manager, system)->InstallAsService(service_manager); + std::make_shared(module, profile_manager, system)->InstallAsService(service_manager); } } // namespace Service::Account diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h index 6d90af3f1..47a7c46d7 100644 --- a/src/core/hle/service/acc/acc.h +++ b/src/core/hle/service/acc/acc.h @@ -15,7 +15,8 @@ public: class Interface : public ServiceFramework { public: explicit Interface(std::shared_ptr module, - std::shared_ptr profile_manager, const char* name); + std::shared_ptr profile_manager, Core::System& system, + const char* name); ~Interface() override; void GetUserCount(Kernel::HLERequestContext& ctx); @@ -33,6 +34,7 @@ public: protected: std::shared_ptr module; std::shared_ptr profile_manager; + Core::System& system; }; }; 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 @@ namespace Service::Account { -ACC_AA::ACC_AA(std::shared_ptr module, std::shared_ptr profile_manager) - : Module::Interface(std::move(module), std::move(profile_manager), "acc:aa") { +ACC_AA::ACC_AA(std::shared_ptr module, std::shared_ptr profile_manager, + Core::System& system) + : Module::Interface(std::move(module), std::move(profile_manager), system, "acc:aa") { static const FunctionInfo functions[] = { {0, nullptr, "EnsureCacheAsync"}, {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 { class ACC_AA final : public Module::Interface { public: - explicit ACC_AA(std::shared_ptr module, - std::shared_ptr profile_manager); + explicit ACC_AA(std::shared_ptr module, std::shared_ptr profile_manager, + Core::System& system); ~ACC_AA() override; }; 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 @@ namespace Service::Account { -ACC_SU::ACC_SU(std::shared_ptr module, std::shared_ptr profile_manager) - : Module::Interface(std::move(module), std::move(profile_manager), "acc:su") { +ACC_SU::ACC_SU(std::shared_ptr module, std::shared_ptr profile_manager, + Core::System& system) + : Module::Interface(std::move(module), std::move(profile_manager), system, "acc:su") { // clang-format off static const FunctionInfo functions[] = { {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 { class ACC_SU final : public Module::Interface { public: - explicit ACC_SU(std::shared_ptr module, - std::shared_ptr profile_manager); + explicit ACC_SU(std::shared_ptr module, std::shared_ptr profile_manager, + Core::System& system); ~ACC_SU() override; }; diff --git a/src/core/hle/service/acc/acc_u0.cpp b/src/core/hle/service/acc/acc_u0.cpp index 932838c41..2f239e8c0 100644 --- a/src/core/hle/service/acc/acc_u0.cpp +++ b/src/core/hle/service/acc/acc_u0.cpp @@ -6,8 +6,9 @@ namespace Service::Account { -ACC_U0::ACC_U0(std::shared_ptr module, std::shared_ptr profile_manager) - : Module::Interface(std::move(module), std::move(profile_manager), "acc:u0") { +ACC_U0::ACC_U0(std::shared_ptr module, std::shared_ptr profile_manager, + Core::System& system) + : Module::Interface(std::move(module), std::move(profile_manager), system, "acc:u0") { // clang-format off static const FunctionInfo functions[] = { {0, &ACC_U0::GetUserCount, "GetUserCount"}, 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 { class ACC_U0 final : public Module::Interface { public: - explicit ACC_U0(std::shared_ptr module, - std::shared_ptr profile_manager); + explicit ACC_U0(std::shared_ptr module, std::shared_ptr profile_manager, + Core::System& system); ~ACC_U0() override; }; 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 @@ namespace Service::Account { -ACC_U1::ACC_U1(std::shared_ptr module, std::shared_ptr profile_manager) - : Module::Interface(std::move(module), std::move(profile_manager), "acc:u1") { +ACC_U1::ACC_U1(std::shared_ptr module, std::shared_ptr profile_manager, + Core::System& system) + : Module::Interface(std::move(module), std::move(profile_manager), system, "acc:u1") { // clang-format off static const FunctionInfo functions[] = { {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 { class ACC_U1 final : public Module::Interface { public: - explicit ACC_U1(std::shared_ptr module, - std::shared_ptr profile_manager); + explicit ACC_U1(std::shared_ptr module, std::shared_ptr profile_manager, + Core::System& system); ~ACC_U1() override; }; diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index 0004f2f47..7db6eb08d 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp @@ -185,7 +185,7 @@ private: void SetAudioOutVolume(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - float volume = rp.PopRaw(); + const float volume = rp.Pop(); LOG_DEBUG(Service_Audio, "called, volume={}", volume); stream->SetVolume(volume); @@ -199,7 +199,7 @@ private: IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); - rb.PushRaw(stream->GetVolume()); + rb.Push(stream->GetVolume()); } AudioCore::AudioOut& audio_core; -- cgit v1.2.3