This commit is contained in:
David Marcec 2019-06-16 20:18:35 +10:00
parent 335127af69
commit 5fb6781c61
12 changed files with 39 additions and 30 deletions

View file

@ -100,6 +100,7 @@ private:
u32 sample_rate; ///< Sample rate of the stream u32 sample_rate; ///< Sample rate of the stream
Format format; ///< Format 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 ReleaseCallback release_callback; ///< Buffer release callback for the stream
State state{State::Stopped}; ///< Playback state of the stream State state{State::Stopped}; ///< Playback state of the stream
Core::Timing::EventType* release_event{}; ///< Core timing release event for 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 SinkStream& sink_stream; ///< Output sink for the stream
Core::Timing::CoreTiming& core_timing; ///< Core timing instance. Core::Timing::CoreTiming& core_timing; ///< Core timing instance.
std::string name; ///< Name of the stream, must be unique 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<Stream>; using StreamPtr = std::shared_ptr<Stream>;

View file

@ -233,13 +233,13 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo
void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_ACC, "called"); LOG_DEBUG(Service_ACC, "called");
FileSys::NACP nacp; FileSys::NACP nacp;
const auto res = Core::System::GetInstance().GetAppLoader().ReadControlData(nacp); const auto res = system.GetAppLoader().ReadControlData(nacp);
bool is_locked = false; bool is_locked = false;
if (res != Loader::ResultStatus::Success) { if (res != Loader::ResultStatus::Success) {
FileSys::PatchManager pm{Core::CurrentProcess()->GetTitleID()}; FileSys::PatchManager pm{system.CurrentProcess()->GetTitleID()};
auto [nacp_unique, discard] = pm.GetControlMetadata(); auto nacp_unique = pm.GetControlMetadata().first;
if (nacp_unique != nullptr) { if (nacp_unique != nullptr) {
is_locked = nacp_unique->GetUserAccountSwitchLock(); is_locked = nacp_unique->GetUserAccountSwitchLock();
@ -250,7 +250,7 @@ void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushRaw<u8>(is_locked); rb.Push(is_locked);
} }
void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) { void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) {
@ -278,19 +278,22 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex
} }
Module::Interface::Interface(std::shared_ptr<Module> module, Module::Interface::Interface(std::shared_ptr<Module> module,
std::shared_ptr<ProfileManager> profile_manager, const char* name) std::shared_ptr<ProfileManager> profile_manager, Core::System& system,
const char* name)
: ServiceFramework(name), module(std::move(module)), : ServiceFramework(name), module(std::move(module)),
profile_manager(std::move(profile_manager)) {} profile_manager(std::move(profile_manager)), system(system) {}
Module::Interface::~Interface() = default; Module::Interface::~Interface() = default;
void InstallInterfaces(SM::ServiceManager& service_manager) { void InstallInterfaces(SM::ServiceManager& service_manager) {
auto module = std::make_shared<Module>(); auto module = std::make_shared<Module>();
auto profile_manager = std::make_shared<ProfileManager>(); auto profile_manager = std::make_shared<ProfileManager>();
std::make_shared<ACC_AA>(module, profile_manager)->InstallAsService(service_manager); Core::System& system = Core::System::GetInstance();
std::make_shared<ACC_SU>(module, profile_manager)->InstallAsService(service_manager);
std::make_shared<ACC_U0>(module, profile_manager)->InstallAsService(service_manager); std::make_shared<ACC_AA>(module, profile_manager, system)->InstallAsService(service_manager);
std::make_shared<ACC_U1>(module, profile_manager)->InstallAsService(service_manager); std::make_shared<ACC_SU>(module, profile_manager, system)->InstallAsService(service_manager);
std::make_shared<ACC_U0>(module, profile_manager, system)->InstallAsService(service_manager);
std::make_shared<ACC_U1>(module, profile_manager, system)->InstallAsService(service_manager);
} }
} // namespace Service::Account } // namespace Service::Account

View file

@ -15,7 +15,8 @@ public:
class Interface : public ServiceFramework<Interface> { class Interface : public ServiceFramework<Interface> {
public: public:
explicit Interface(std::shared_ptr<Module> module, explicit Interface(std::shared_ptr<Module> module,
std::shared_ptr<ProfileManager> profile_manager, const char* name); std::shared_ptr<ProfileManager> profile_manager, Core::System& system,
const char* name);
~Interface() override; ~Interface() override;
void GetUserCount(Kernel::HLERequestContext& ctx); void GetUserCount(Kernel::HLERequestContext& ctx);
@ -33,6 +34,7 @@ public:
protected: protected:
std::shared_ptr<Module> module; std::shared_ptr<Module> module;
std::shared_ptr<ProfileManager> profile_manager; std::shared_ptr<ProfileManager> profile_manager;
Core::System& system;
}; };
}; };

View file

@ -6,8 +6,9 @@
namespace Service::Account { namespace Service::Account {
ACC_AA::ACC_AA(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager) ACC_AA::ACC_AA(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
: Module::Interface(std::move(module), std::move(profile_manager), "acc:aa") { Core::System& system)
: Module::Interface(std::move(module), std::move(profile_manager), system, "acc:aa") {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "EnsureCacheAsync"}, {0, nullptr, "EnsureCacheAsync"},
{1, nullptr, "LoadCache"}, {1, nullptr, "LoadCache"},

View file

@ -10,8 +10,8 @@ namespace Service::Account {
class ACC_AA final : public Module::Interface { class ACC_AA final : public Module::Interface {
public: public:
explicit ACC_AA(std::shared_ptr<Module> module, explicit ACC_AA(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
std::shared_ptr<ProfileManager> profile_manager); Core::System& system);
~ACC_AA() override; ~ACC_AA() override;
}; };

View file

@ -6,8 +6,9 @@
namespace Service::Account { namespace Service::Account {
ACC_SU::ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager) ACC_SU::ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
: Module::Interface(std::move(module), std::move(profile_manager), "acc:su") { Core::System& system)
: Module::Interface(std::move(module), std::move(profile_manager), system, "acc:su") {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &ACC_SU::GetUserCount, "GetUserCount"}, {0, &ACC_SU::GetUserCount, "GetUserCount"},

View file

@ -10,8 +10,8 @@ namespace Service::Account {
class ACC_SU final : public Module::Interface { class ACC_SU final : public Module::Interface {
public: public:
explicit ACC_SU(std::shared_ptr<Module> module, explicit ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
std::shared_ptr<ProfileManager> profile_manager); Core::System& system);
~ACC_SU() override; ~ACC_SU() override;
}; };

View file

@ -6,8 +6,9 @@
namespace Service::Account { namespace Service::Account {
ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager) ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
: Module::Interface(std::move(module), std::move(profile_manager), "acc:u0") { Core::System& system)
: Module::Interface(std::move(module), std::move(profile_manager), system, "acc:u0") {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &ACC_U0::GetUserCount, "GetUserCount"}, {0, &ACC_U0::GetUserCount, "GetUserCount"},

View file

@ -10,8 +10,8 @@ namespace Service::Account {
class ACC_U0 final : public Module::Interface { class ACC_U0 final : public Module::Interface {
public: public:
explicit ACC_U0(std::shared_ptr<Module> module, explicit ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
std::shared_ptr<ProfileManager> profile_manager); Core::System& system);
~ACC_U0() override; ~ACC_U0() override;
}; };

View file

@ -6,8 +6,9 @@
namespace Service::Account { namespace Service::Account {
ACC_U1::ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager) ACC_U1::ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
: Module::Interface(std::move(module), std::move(profile_manager), "acc:u1") { Core::System& system)
: Module::Interface(std::move(module), std::move(profile_manager), system, "acc:u1") {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &ACC_U1::GetUserCount, "GetUserCount"}, {0, &ACC_U1::GetUserCount, "GetUserCount"},

View file

@ -10,8 +10,8 @@ namespace Service::Account {
class ACC_U1 final : public Module::Interface { class ACC_U1 final : public Module::Interface {
public: public:
explicit ACC_U1(std::shared_ptr<Module> module, explicit ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
std::shared_ptr<ProfileManager> profile_manager); Core::System& system);
~ACC_U1() override; ~ACC_U1() override;
}; };

View file

@ -185,7 +185,7 @@ private:
void SetAudioOutVolume(Kernel::HLERequestContext& ctx) { void SetAudioOutVolume(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
float volume = rp.PopRaw<float>(); const float volume = rp.Pop<float>();
LOG_DEBUG(Service_Audio, "called, volume={}", volume); LOG_DEBUG(Service_Audio, "called, volume={}", volume);
stream->SetVolume(volume); stream->SetVolume(volume);
@ -199,7 +199,7 @@ private:
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushRaw<float>(stream->GetVolume()); rb.Push(stream->GetVolume());
} }
AudioCore::AudioOut& audio_core; AudioCore::AudioOut& audio_core;