From a2cc3b10bb6115b17d980fdb83ed5c561835eb3b Mon Sep 17 00:00:00 2001 From: David Marcec Date: Mon, 26 Nov 2018 17:06:13 +1100 Subject: Changed logging to be "Log before execution", Added more error logging, all services should now log on some level --- src/core/hle/service/am/am.cpp | 209 ++++++++++++++++++---------------- src/core/hle/service/am/applet_ae.cpp | 66 +++++++---- src/core/hle/service/am/applet_oe.cpp | 27 +++-- 3 files changed, 174 insertions(+), 128 deletions(-) (limited to 'src/core/hle/service/am') diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 4f17b52f9..0bd52b602 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -217,6 +217,7 @@ ISelfController::~ISelfController() = default; void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) { // Takes 3 input u8s with each field located immediately after the previous // u8, these are bool flags. No output. + LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::RequestParser rp{ctx}; @@ -229,44 +230,40 @@ void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::SetRestartMessageEnabled(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; bool flag = rp.Pop(); + LOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag); } void ISelfController::SetScreenShotPermission(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; bool flag = rp.Pop(); + LOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_WARNING(Service_AM, "(STUBBED) called flag={}", flag); } void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx) { @@ -275,45 +272,45 @@ void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& IPC::RequestParser rp{ctx}; bool enabled = rp.Pop(); + LOG_WARNING(Service_AM, "(STUBBED) called enabled={}", enabled); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_WARNING(Service_AM, "(STUBBED) called enabled={}", enabled); } void ISelfController::LockExit(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + launchable_event->Signal(); IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(launchable_event); - - LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::SetScreenShotImageOrientation(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); // TODO(Subv): Find out how AM determines the display to use, for now just // create the layer in the Default display. u64 display_id = nvflinger->OpenDisplay("Default"); @@ -322,32 +319,31 @@ void ISelfController::CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx) IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); rb.Push(layer_id); - - LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; idle_time_detection_extension = rp.Pop(); + LOG_WARNING(Service_AM, "(STUBBED) called idle_time_detection_extension={}", + idle_time_detection_extension); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_WARNING(Service_AM, "(STUBBED) called"); } void ISelfController::GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(idle_time_detection_extension); - - LOG_WARNING(Service_AM, "(STUBBED) called"); } AppletMessageQueue::AppletMessageQueue() { @@ -438,47 +434,49 @@ ICommonStateGetter::ICommonStateGetter(std::shared_ptr msg_q ICommonStateGetter::~ICommonStateGetter() = default; void ICommonStateGetter::GetBootMode(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(static_cast(Service::PM::SystemBootMode::Normal)); // Normal boot mode - - LOG_DEBUG(Service_AM, "called"); } void ICommonStateGetter::GetEventHandle(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(msg_queue->GetMesssageRecieveEvent()); - - LOG_DEBUG(Service_AM, "called"); } void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.PushEnum(msg_queue->PopMessage()); - - LOG_DEBUG(Service_AM, "called"); } void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(static_cast(FocusState::InFocus)); - - LOG_WARNING(Service_AM, "(STUBBED) called"); } void ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(msg_queue->GetOperationModeChangedEvent()); - - LOG_DEBUG(Service_AM, "called"); } void ICommonStateGetter::GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); @@ -493,8 +491,6 @@ void ICommonStateGetter::GetDefaultDisplayResolution(Kernel::HLERequestContext& rb.Push(static_cast(Service::VI::DisplayResolution::UndockedHeight) * static_cast(Settings::values.resolution_factor)); } - - LOG_DEBUG(Service_AM, "called"); } IStorage::IStorage(std::vector buffer) @@ -517,21 +513,21 @@ const std::vector& IStorage::GetData() const { void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { const bool use_docked_mode{Settings::values.use_docked_mode}; + LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode); + IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(static_cast(use_docked_mode ? OperationMode::Docked : OperationMode::Handheld)); - - LOG_DEBUG(Service_AM, "called"); } void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) { const bool use_docked_mode{Settings::values.use_docked_mode}; + LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode); + IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(static_cast(use_docked_mode ? APM::PerformanceMode::Docked : APM::PerformanceMode::Handheld)); - - LOG_DEBUG(Service_AM, "called"); } class ILibraryAppletAccessor final : public ServiceFramework { @@ -566,32 +562,34 @@ public: private: void GetAppletStateChangedEvent(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + const auto event = applet->GetBroker().GetStateChangedEvent(); event->Signal(); IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(event); - - LOG_DEBUG(Service_AM, "called"); } void IsCompleted(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(applet->TransactionComplete()); - - LOG_DEBUG(Service_AM, "called"); } void GetResult(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(applet->GetStatus()); - - LOG_DEBUG(Service_AM, "called"); } void Start(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + ASSERT(applet != nullptr); applet->Initialize(); @@ -599,36 +597,38 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_DEBUG(Service_AM, "called"); } void PushInData(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::RequestParser rp{ctx}; applet->GetBroker().PushNormalDataFromGame(*rp.PopIpcInterface()); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_DEBUG(Service_AM, "called"); } void PopOutData(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; const auto storage = applet->GetBroker().PopNormalDataToGame(); if (storage == nullptr) { + LOG_ERROR(Service_AM, "storage is a nullptr"); + rb.Push(ERR_NO_DATA_IN_CHANNEL); return; } rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(std::move(*storage)); - - LOG_DEBUG(Service_AM, "called"); } void PushInteractiveInData(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::RequestParser rp{ctx}; applet->GetBroker().PushInteractiveDataFromGame(*rp.PopIpcInterface()); @@ -638,51 +638,51 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_DEBUG(Service_AM, "called"); } void PopInteractiveOutData(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; const auto storage = applet->GetBroker().PopInteractiveDataToGame(); if (storage == nullptr) { + LOG_ERROR(Service_AM, "storage is a nullptr"); + rb.Push(ERR_NO_DATA_IN_CHANNEL); return; } rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(std::move(*storage)); - - LOG_DEBUG(Service_AM, "called"); } void GetPopOutDataEvent(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(applet->GetBroker().GetNormalDataEvent()); - - LOG_DEBUG(Service_AM, "called"); } void GetPopInteractiveOutDataEvent(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(applet->GetBroker().GetInteractiveDataEvent()); - - LOG_DEBUG(Service_AM, "called"); } std::shared_ptr applet; }; void IStorage::Open(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(*this); - - LOG_DEBUG(Service_AM, "called"); } IStorageAccessor::IStorageAccessor(IStorage& storage) @@ -701,21 +701,25 @@ IStorageAccessor::IStorageAccessor(IStorage& storage) IStorageAccessor::~IStorageAccessor() = default; void IStorageAccessor::GetSize(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); rb.Push(static_cast(backing.buffer.size())); - - LOG_DEBUG(Service_AM, "called"); } void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 offset{rp.Pop()}; + LOG_DEBUG(Service_AM, "called, offset={}", offset); + const std::vector data{ctx.ReadBuffer()}; if (data.size() > backing.buffer.size() - offset) { + LOG_ERROR(Service_AM, "offset is out of bounds"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ERR_SIZE_OUT_OF_BOUNDS); } @@ -724,17 +728,19 @@ void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_DEBUG(Service_AM, "called, offset={}", offset); } void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 offset{rp.Pop()}; + LOG_DEBUG(Service_AM, "called, offset={}", offset); + const std::size_t size{ctx.GetWriteBufferSize()}; if (size > backing.buffer.size() - offset) { + LOG_ERROR(Service_AM, "offset is out of bounds"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ERR_SIZE_OUT_OF_BOUNDS); } @@ -743,8 +749,6 @@ void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_DEBUG(Service_AM, "called, offset={}", offset); } ILibraryAppletCreator::ILibraryAppletCreator() : ServiceFramework("ILibraryAppletCreator") { @@ -783,6 +787,8 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx) const auto applet = GetAppletFromId(applet_id); if (applet == nullptr) { + LOG_ERROR(Service_AM, "Applet doesn't exist!"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultCode(-1)); return; @@ -792,23 +798,23 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx) rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(applet); - - LOG_DEBUG(Service_AM, "called"); } void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 size{rp.Pop()}; + LOG_DEBUG(Service_AM, "called, size={}", size); + std::vector buffer(size); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(std::move(buffer)); - - LOG_DEBUG(Service_AM, "called, size={}", size); } void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::RequestParser rp{ctx}; rp.SetCurrentOffset(3); @@ -819,6 +825,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex handle); if (shared_mem == nullptr) { + LOG_ERROR(Service_AM, "shared_mem is a nullpr"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultCode(-1)); return; @@ -882,38 +889,45 @@ IApplicationFunctions::IApplicationFunctions() : ServiceFramework("IApplicationF IApplicationFunctions::~IApplicationFunctions() = default; void IApplicationFunctions::EnableApplicationCrashReport(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed( Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed( Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::BeginBlockingHomeButton(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::EndBlockingHomeButton(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + LaunchParameters params{}; params.magic = POP_LAUNCH_PARAMETER_MAGIC; @@ -932,21 +946,19 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { std::memcpy(buffer.data(), ¶ms, buffer.size()); rb.PushIpcInterface(buffer); - - LOG_DEBUG(Service_AM, "called"); } void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest( Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; u128 uid = rp.PopRaw(); // What does this do? - LOG_WARNING(Service, "(STUBBED) called uid = {:016X}{:016X}", uid[1], uid[0]); IPC::ResponseBuilder rb{ctx, 4}; @@ -961,60 +973,62 @@ void IApplicationFunctions::SetTerminateResult(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; u32 result = rp.Pop(); + LOG_WARNING(Service_AM, "(STUBBED) called, result=0x{:08X}", result); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_WARNING(Service_AM, "(STUBBED) called, result=0x{:08X}", result); } void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 6}; rb.Push(RESULT_SUCCESS); rb.Push(1); rb.Push(0); - LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { // TODO(bunnei): This should be configurable + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); rb.Push( static_cast(Service::Set::GetLanguageCodeFromIndex(Settings::values.language_index))); - LOG_DEBUG(Service_AM, "called"); } void IApplicationFunctions::InitializeGamePlayRecording(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::SetGamePlayRecordingState(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - - LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::NotifyRunning(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); rb.Push(0); // Unknown, seems to be ignored by official processes - - LOG_WARNING(Service_AM, "(STUBBED) called"); } void IApplicationFunctions::GetPseudoDeviceId(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 6}; rb.Push(RESULT_SUCCESS); // Returns a 128-bit UUID rb.Push(0); rb.Push(0); - - LOG_WARNING(Service_AM, "(STUBBED) called"); } void InstallInterfaces(SM::ServiceManager& service_manager, @@ -1051,9 +1065,10 @@ IHomeMenuFunctions::IHomeMenuFunctions() : ServiceFramework("IHomeMenuFunctions" IHomeMenuFunctions::~IHomeMenuFunctions() = default; void IHomeMenuFunctions::RequestToGetForeground(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); - LOG_WARNING(Service_AM, "(STUBBED) called"); } IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStateController") { diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp index ec93e3529..41a573a91 100644 --- a/src/core/hle/service/am/applet_ae.cpp +++ b/src/core/hle/service/am/applet_ae.cpp @@ -32,66 +32,75 @@ public: private: void GetCommonStateGetter(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(msg_queue); - LOG_DEBUG(Service_AM, "called"); } void GetSelfController(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(nvflinger); - LOG_DEBUG(Service_AM, "called"); } void GetWindowController(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetAudioController(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetDisplayController(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetProcessWindingController(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetDebugFunctions(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetApplicationFunctions(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } std::shared_ptr nvflinger; @@ -122,97 +131,110 @@ public: private: void GetCommonStateGetter(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(msg_queue); - LOG_DEBUG(Service_AM, "called"); } void GetSelfController(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(nvflinger); - LOG_DEBUG(Service_AM, "called"); } void GetWindowController(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetAudioController(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetDisplayController(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetDebugFunctions(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetHomeMenuFunctions(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetGlobalStateController(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetApplicationCreator(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } std::shared_ptr nvflinger; std::shared_ptr msg_queue; }; void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(nvflinger, msg_queue); - LOG_DEBUG(Service_AM, "called"); } void AppletAE::OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(nvflinger, msg_queue); - LOG_DEBUG(Service_AM, "called"); } void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(nvflinger, msg_queue); - LOG_DEBUG(Service_AM, "called"); } AppletAE::AppletAE(std::shared_ptr nvflinger, diff --git a/src/core/hle/service/am/applet_oe.cpp b/src/core/hle/service/am/applet_oe.cpp index 20c8d5fff..d3a0a1568 100644 --- a/src/core/hle/service/am/applet_oe.cpp +++ b/src/core/hle/service/am/applet_oe.cpp @@ -35,59 +35,67 @@ public: private: void GetAudioController(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetDisplayController(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetDebugFunctions(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetWindowController(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetSelfController(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(nvflinger); - LOG_DEBUG(Service_AM, "called"); } void GetCommonStateGetter(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(msg_queue); - LOG_DEBUG(Service_AM, "called"); } void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } void GetApplicationFunctions(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(); - LOG_DEBUG(Service_AM, "called"); } std::shared_ptr nvflinger; @@ -95,10 +103,11 @@ private: }; void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface(nvflinger, msg_queue); - LOG_DEBUG(Service_AM, "called"); } AppletOE::AppletOE(std::shared_ptr nvflinger, -- cgit v1.2.3 From 3d627df4d8a682d39e94116b0fc094b752d8d49f Mon Sep 17 00:00:00 2001 From: David Marcec Date: Mon, 26 Nov 2018 20:05:09 +1100 Subject: Improved error messages in AM, HwOpus and NvMap --- src/core/hle/service/am/am.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/core/hle/service/am') diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 0bd52b602..f6757adab 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -616,7 +616,7 @@ private: const auto storage = applet->GetBroker().PopNormalDataToGame(); if (storage == nullptr) { - LOG_ERROR(Service_AM, "storage is a nullptr"); + LOG_ERROR(Service_AM, "storage is a nullptr. There is no data in the current channel"); rb.Push(ERR_NO_DATA_IN_CHANNEL); return; @@ -647,7 +647,7 @@ private: const auto storage = applet->GetBroker().PopInteractiveDataToGame(); if (storage == nullptr) { - LOG_ERROR(Service_AM, "storage is a nullptr"); + LOG_ERROR(Service_AM, "storage is a nullptr. There is no data in the current channel"); rb.Push(ERR_NO_DATA_IN_CHANNEL); return; @@ -718,7 +718,9 @@ void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) { const std::vector data{ctx.ReadBuffer()}; if (data.size() > backing.buffer.size() - offset) { - LOG_ERROR(Service_AM, "offset is out of bounds"); + LOG_ERROR(Service_AM, + "offset is out of bounds, backing_buffer_sz={}, data_size={}, offset={}", + backing.buffer.size(), data.size(), offset); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ERR_SIZE_OUT_OF_BOUNDS); @@ -739,7 +741,8 @@ void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) { const std::size_t size{ctx.GetWriteBufferSize()}; if (size > backing.buffer.size() - offset) { - LOG_ERROR(Service_AM, "offset is out of bounds"); + LOG_ERROR(Service_AM, "offset is out of bounds, backing_buffer_sz={}, size={}, offset={}", + backing.buffer.size(), size, offset); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ERR_SIZE_OUT_OF_BOUNDS); @@ -787,7 +790,7 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx) const auto applet = GetAppletFromId(applet_id); if (applet == nullptr) { - LOG_ERROR(Service_AM, "Applet doesn't exist!"); + LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", static_cast(applet_id)); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultCode(-1)); @@ -825,7 +828,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex handle); if (shared_mem == nullptr) { - LOG_ERROR(Service_AM, "shared_mem is a nullpr"); + LOG_ERROR(Service_AM, "shared_mem is a nullpr for handle={:08X}", handle); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultCode(-1)); return; -- cgit v1.2.3 From f271316822c8887b1b6dfeff0803077f5ec2c0a8 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Tue, 27 Nov 2018 12:29:06 +1100 Subject: Reworked svcs slightly, improved error messages in AM and fsp_srv --- src/core/hle/service/am/am.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/core/hle/service/am') diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index f6757adab..d595c37b0 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -616,7 +616,8 @@ private: const auto storage = applet->GetBroker().PopNormalDataToGame(); if (storage == nullptr) { - LOG_ERROR(Service_AM, "storage is a nullptr. There is no data in the current channel"); + LOG_ERROR(Service_AM, + "storage is a nullptr. There is no data in the current normal channel"); rb.Push(ERR_NO_DATA_IN_CHANNEL); return; @@ -647,7 +648,8 @@ private: const auto storage = applet->GetBroker().PopInteractiveDataToGame(); if (storage == nullptr) { - LOG_ERROR(Service_AM, "storage is a nullptr. There is no data in the current channel"); + LOG_ERROR(Service_AM, + "storage is a nullptr. There is no data in the current interactive channel"); rb.Push(ERR_NO_DATA_IN_CHANNEL); return; -- cgit v1.2.3