From 75c9784239215cdf21367137a049cca52b84597a Mon Sep 17 00:00:00 2001 From: Sebastian Valle Date: Sat, 18 Apr 2020 13:48:09 -0500 Subject: [PATCH] Services/APT: Implemented the GetCaptureInfo function. (#5194) This one is similar to the ReceiveCaptureBufferInfo function except it doesn't clear the capture buffer, according to 3dbrew. This function is used by the Home Menu --- src/core/hle/service/apt/apt.cpp | 12 ++++++++++++ src/core/hle/service/apt/apt.h | 14 ++++++++++++++ src/core/hle/service/apt/apt_s.cpp | 2 +- src/core/hle/service/apt/apt_u.cpp | 2 +- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 07c5ff5d3..96f03704e 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -722,6 +722,18 @@ void Module::APTInterface::ReceiveCaptureBufferInfo(Kernel::HLERequestContext& c rb.PushStaticBuffer(std::move(apt->screen_capture_buffer), 0); } +void Module::APTInterface::GetCaptureInfo(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp(ctx, 0x4A, 1, 0); // 0x004A0040 + const u32 size = rp.Pop(); + ASSERT(size == 0x20); + + IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); + rb.Push(RESULT_SUCCESS); + rb.Push(static_cast(apt->screen_capture_buffer.size())); + // This service function does not clear the capture buffer. + rb.PushStaticBuffer(apt->screen_capture_buffer, 0); +} + void Module::APTInterface::SetScreenCapPostPermission(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x55, 1, 0); // 0x00550040 diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index 25cac1357..b413715b1 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h @@ -576,6 +576,20 @@ public: */ void ReceiveCaptureBufferInfo(Kernel::HLERequestContext& ctx); + /** + * APT::GetCaptureInfo service function + * Inputs: + * 0 : Command header [0x004A0040] + * 1 : Size + * 64 : Size << 14 | 2 + * 65 : void*, CaptureBufferInfo + * Outputs: + * 0 : Header code + * 1 : Result code + * 2 : Actual Size + */ + void GetCaptureInfo(Kernel::HLERequestContext& ctx); + /** * APT::GetStartupArgument service function * Inputs: diff --git a/src/core/hle/service/apt/apt_s.cpp b/src/core/hle/service/apt/apt_s.cpp index f66c67af8..b0824628d 100644 --- a/src/core/hle/service/apt/apt_s.cpp +++ b/src/core/hle/service/apt/apt_s.cpp @@ -83,7 +83,7 @@ APT_S::APT_S(std::shared_ptr apt) {0x00470104, &APT_S::Unwrap, "Unwrap"}, {0x00480100, nullptr, "GetProgramInfo"}, {0x00490180, nullptr, "Reboot"}, - {0x004A0040, nullptr, "GetCaptureInfo"}, + {0x004A0040, &APT_S::GetCaptureInfo, "GetCaptureInfo"}, {0x004B00C2, &APT_S::AppletUtility, "AppletUtility"}, {0x004C0000, nullptr, "SetFatalErrDispMode"}, {0x004D0080, nullptr, "GetAppletProgramInfo"}, diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp index 03795c94c..f36da98e5 100644 --- a/src/core/hle/service/apt/apt_u.cpp +++ b/src/core/hle/service/apt/apt_u.cpp @@ -83,7 +83,7 @@ APT_U::APT_U(std::shared_ptr apt) {0x00470104, &APT_U::Unwrap, "Unwrap"}, {0x00480100, nullptr, "GetProgramInfo"}, {0x00490180, nullptr, "Reboot"}, - {0x004A0040, nullptr, "GetCaptureInfo"}, + {0x004A0040, &APT_U::GetCaptureInfo, "GetCaptureInfo"}, {0x004B00C2, &APT_U::AppletUtility, "AppletUtility"}, {0x004C0000, nullptr, "SetFatalErrDispMode"}, {0x004D0080, nullptr, "GetAppletProgramInfo"},