From 335127af6921ce298a6dd63682895768c6b06e86 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sun, 16 Jun 2019 19:06:33 +1000 Subject: 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. --- src/core/file_sys/control_metadata.cpp | 4 ++++ src/core/file_sys/control_metadata.h | 4 +++- src/core/hle/service/acc/acc.cpp | 29 ++++++++++++++++++++++++++++- src/core/hle/service/acc/acc.h | 3 ++- src/core/hle/service/acc/acc_u0.cpp | 4 ++-- src/core/hle/service/am/am.cpp | 17 ++++++++++++++++- src/core/hle/service/am/am.h | 3 +++ src/core/hle/service/audio/audout_u.cpp | 23 +++++++++++++++++++++-- 8 files changed, 79 insertions(+), 8 deletions(-) (limited to 'src/core') 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 { return raw.user_account_save_data_journal_size; } +bool NACP::GetUserAccountSwitchLock() const { + return raw.user_account_switch_lock == 1; +} + u32 NACP::GetSupportedLanguages() const { return raw.supported_languages; } 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 { std::array language_entries; std::array isbn; u8 startup_user_account; - INSERT_PADDING_BYTES(2); + u8 user_account_switch_lock; + u8 addon_content_registration_type; u32_le application_attribute; u32_le supported_languages; u32_le parental_control; @@ -111,6 +112,7 @@ public: u64 GetDefaultJournalSaveSize() const; u32 GetSupportedLanguages() const; std::vector GetRawBytes() const; + bool GetUserAccountSwitchLock() const; private: 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 @@ #include "common/swap.h" #include "core/constants.h" #include "core/core_timing.h" +#include "core/file_sys/control_metadata.h" +#include "core/file_sys/patch_manager.h" #include "core/hle/ipc_helpers.h" +#include "core/hle/kernel/process.h" #include "core/hle/service/acc/acc.h" #include "core/hle/service/acc/acc_aa.h" #include "core/hle/service/acc/acc_su.h" #include "core/hle/service/acc/acc_u0.h" #include "core/hle/service/acc/acc_u1.h" #include "core/hle/service/acc/profile_manager.h" +#include "core/loader/loader.h" namespace Service::Account { @@ -213,7 +217,7 @@ void Module::Interface::IsUserRegistrationRequestPermitted(Kernel::HLERequestCon rb.Push(profile_manager->CanSystemRegisterUser()); } -void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) { +void Module::Interface::InitializeApplicationInfoOld(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_ACC, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); @@ -226,6 +230,29 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo rb.PushIpcInterface(); } +void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_ACC, "called"); + FileSys::NACP nacp; + const auto res = Core::System::GetInstance().GetAppLoader().ReadControlData(nacp); + + bool is_locked = false; + + if (res != Loader::ResultStatus::Success) { + FileSys::PatchManager pm{Core::CurrentProcess()->GetTitleID()}; + auto [nacp_unique, discard] = pm.GetControlMetadata(); + + if (nacp_unique != nullptr) { + is_locked = nacp_unique->GetUserAccountSwitchLock(); + } + } else { + is_locked = nacp.GetUserAccountSwitchLock(); + } + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(RESULT_SUCCESS); + rb.PushRaw(is_locked); +} + void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called"); // 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: void ListOpenUsers(Kernel::HLERequestContext& ctx); void GetLastOpenedUser(Kernel::HLERequestContext& ctx); void GetProfile(Kernel::HLERequestContext& ctx); - void InitializeApplicationInfo(Kernel::HLERequestContext& ctx); + void InitializeApplicationInfoOld(Kernel::HLERequestContext& ctx); void GetBaasAccountManagerForApplication(Kernel::HLERequestContext& ctx); void IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx); void TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx); + void IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx); protected: std::shared_ptr 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, std::shared_ptr p {51, &ACC_U0::TrySelectUserWithoutInteraction, "TrySelectUserWithoutInteraction"}, {60, nullptr, "ListOpenContextStoredUsers"}, {99, nullptr, "DebugActivateOpenContextRetention"}, - {100, &ACC_U0::InitializeApplicationInfo, "InitializeApplicationInfo"}, + {100, &ACC_U0::InitializeApplicationInfoOld, "InitializeApplicationInfoOld"}, {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"}, {102, nullptr, "AuthenticateApplicationAsync"}, {103, nullptr, "CheckNetworkServiceAvailabilityAsync"}, @@ -32,7 +32,7 @@ ACC_U0::ACC_U0(std::shared_ptr module, std::shared_ptr p {131, nullptr, "ListOpenContextStoredUsers"}, {140, nullptr, "InitializeApplicationInfo"}, {141, nullptr, "ListQualifiedUsers"}, - {150, nullptr, "IsUserAccountSwitchLocked"}, + {150, &ACC_U0::IsUserAccountSwitchLocked, "IsUserAccountSwitchLocked"}, }; // clang-format on 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 {71, nullptr, "GetCurrentIlluminanceEx"}, {80, nullptr, "SetWirelessPriorityMode"}, {90, nullptr, "GetAccumulatedSuspendedTickValue"}, - {91, nullptr, "GetAccumulatedSuspendedTickChangedEvent"}, + {91, &ISelfController::GetAccumulatedSuspendedTickChangedEvent, "GetAccumulatedSuspendedTickChangedEvent"}, {100, nullptr, "SetAlbumImageTakenNotificationEnabled"}, {1000, nullptr, "GetDebugStorageChannel"}, }; @@ -282,6 +282,10 @@ ISelfController::ISelfController(std::shared_ptr nvflinger auto& kernel = Core::System::GetInstance().Kernel(); launchable_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, "ISelfController:LaunchableEvent"); + + // TODO(ogniK): Figure out where, when and why this event gets signalled + accumulated_suspended_tick_changed_event = Kernel::WritableEvent::CreateEventPair( + kernel, Kernel::ResetType::Manual, "ISelfController:AccumulatedSuspendedTickChangedEvent"); } ISelfController::~ISelfController() = default; @@ -444,6 +448,17 @@ void ISelfController::GetIdleTimeDetectionExtension(Kernel::HLERequestContext& c rb.Push(idle_time_detection_extension); } +void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx) { + // The implementation of this function is fine as is, the reason we're labelling it as stubbed + // is because we're currently unsure when and where accumulated_suspended_tick_changed_event is + // actually signalled for the time being. + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushCopyObjects(accumulated_suspended_tick_changed_event.readable); +} + AppletMessageQueue::AppletMessageQueue() { auto& kernel = Core::System::GetInstance().Kernel(); 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: void SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx); void SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); void GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); + void GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx); std::shared_ptr nvflinger; Kernel::EventPair launchable_event; + Kernel::EventPair accumulated_suspended_tick_changed_event; + u32 idle_time_detection_extension = 0; u64 num_fatal_sections_entered = 0; }; 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: {9, &IAudioOut::GetAudioOutBufferCount, "GetAudioOutBufferCount"}, {10, nullptr, "GetAudioOutPlayedSampleCount"}, {11, nullptr, "FlushAudioOutBuffers"}, - {12, nullptr, "SetAudioOutVolume"}, - {13, nullptr, "GetAudioOutVolume"}, + {12, &IAudioOut::SetAudioOutVolume, "SetAudioOutVolume"}, + {13, &IAudioOut::GetAudioOutVolume, "GetAudioOutVolume"}, }; // clang-format on RegisterHandlers(functions); @@ -183,6 +183,25 @@ private: rb.Push(static_cast(stream->GetQueueSize())); } + void SetAudioOutVolume(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + float volume = rp.PopRaw(); + LOG_DEBUG(Service_Audio, "called, volume={}", volume); + + stream->SetVolume(volume); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); + } + + void GetAudioOutVolume(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_Audio, "called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(RESULT_SUCCESS); + rb.PushRaw(stream->GetVolume()); + } + AudioCore::AudioOut& audio_core; AudioCore::StreamPtr stream; std::string device_name; -- cgit v1.2.3 From 5fb6781c6104a618ee366c444725e32765a0c534 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sun, 16 Jun 2019 20:18:35 +1000 Subject: Cleanup --- 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 ++-- 11 files changed, 38 insertions(+), 29 deletions(-) (limited to 'src/core') 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 From 50e3269f3bef27fad91ca2d1514944b1a5637a49 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Sun, 16 Jun 2019 22:18:54 +1000 Subject: Signalled accumulated_suspended_tick_changed_event on creation based on RE --- src/core/hle/service/am/am.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/core') diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 73caf8739..4a7bf4acb 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -286,6 +286,7 @@ ISelfController::ISelfController(std::shared_ptr nvflinger // TODO(ogniK): Figure out where, when and why this event gets signalled accumulated_suspended_tick_changed_event = Kernel::WritableEvent::CreateEventPair( kernel, Kernel::ResetType::Manual, "ISelfController:AccumulatedSuspendedTickChangedEvent"); + accumulated_suspended_tick_changed_event.writable->Signal(); // Is signalled on creation } ISelfController::~ISelfController() = default; -- cgit v1.2.3 From 6ca20ad7ba594fd01c01e8d56e5e02d84609d9e1 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Mon, 17 Jun 2019 08:17:26 +1000 Subject: Addressed issues --- src/core/file_sys/control_metadata.cpp | 2 +- src/core/hle/service/acc/acc.cpp | 17 +++++++++++------ src/core/hle/service/acc/acc.h | 2 +- src/core/hle/service/service.cpp | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src/core') diff --git a/src/core/file_sys/control_metadata.cpp b/src/core/file_sys/control_metadata.cpp index 735526b1c..f155a1341 100644 --- a/src/core/file_sys/control_metadata.cpp +++ b/src/core/file_sys/control_metadata.cpp @@ -88,7 +88,7 @@ u64 NACP::GetDefaultJournalSaveSize() const { } bool NACP::GetUserAccountSwitchLock() const { - return raw.user_account_switch_lock == 1; + return raw.user_account_switch_lock != 0; } u32 NACP::GetSupportedLanguages() const { diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index f02f54f91..025714e5a 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -243,6 +243,8 @@ void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx if (nacp_unique != nullptr) { is_locked = nacp_unique->GetUserAccountSwitchLock(); + } else { + LOG_ERROR(Service_ACC, "nacp_unique is null!"); } } else { is_locked = nacp.GetUserAccountSwitchLock(); @@ -285,15 +287,18 @@ Module::Interface::Interface(std::shared_ptr module, Module::Interface::~Interface() = default; -void InstallInterfaces(SM::ServiceManager& service_manager) { +void InstallInterfaces(Core::System& system) { auto module = std::make_shared(); auto profile_manager = std::make_shared(); - 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); + std::make_shared(module, profile_manager, system) + ->InstallAsService(system.ServiceManager()); + std::make_shared(module, profile_manager, system) + ->InstallAsService(system.ServiceManager()); + std::make_shared(module, profile_manager, system) + ->InstallAsService(system.ServiceManager()); + std::make_shared(module, profile_manager, system) + ->InstallAsService(system.ServiceManager()); } } // namespace Service::Account diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h index 47a7c46d7..350f123a0 100644 --- a/src/core/hle/service/acc/acc.h +++ b/src/core/hle/service/acc/acc.h @@ -39,6 +39,6 @@ public: }; /// Registers all ACC services with the specified service manager. -void InstallInterfaces(SM::ServiceManager& service_manager); +void InstallInterfaces(Core::System& system); } // namespace Service::Account 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, Core::System& system, SM::ServiceManager::InstallInterfaces(sm); - Account::InstallInterfaces(*sm); + Account::InstallInterfaces(system); AM::InstallInterfaces(*sm, nv_flinger); AOC::InstallInterfaces(*sm); APM::InstallInterfaces(*sm); -- cgit v1.2.3