APT: Implement SendCaptureBufferInfo and ReceiveCaptureBufferInfo (#3467)

* APT: Implement SendCaptureBufferInfo and ReceiveCaptureBufferInfo

* adressed comments

* Clear screen_capture_buffer on Receive

* fix response in ReceiveCaptureBufferInfo

* fix response in ReceiveCaptureBufferInfo

* fix clang-format
This commit is contained in:
Ben 2018-03-04 12:25:33 +01:00 committed by Weiyi Wang
parent 001ad9da3b
commit d6157a49db
5 changed files with 59 additions and 9 deletions

View file

@ -550,6 +550,27 @@ void Module::Interface::CancelLibraryApplet(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_APT, "(STUBBED) called exiting=%d", exiting);
}
void Module::Interface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x40, 1, 2); // 0x00400042
u32 size = rp.Pop<u32>();
ASSERT(size == 0x20);
apt->screen_capture_buffer = rp.PopStaticBuffer();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS);
}
void Module::Interface::ReceiveCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x41, 1, 0); // 0x00410040
u32 size = rp.Pop<u32>();
ASSERT(size == 0x20);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS);
rb.Push(static_cast<u32>(apt->screen_capture_buffer.size()));
rb.PushStaticBuffer(std::move(apt->screen_capture_buffer), 0);
}
void Module::Interface::SetScreenCapPostPermission(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x55, 1, 0); // 0x00550040

View file

@ -14,7 +14,7 @@
namespace Kernel {
class Mutex;
class SharedMemory;
}
} // namespace Kernel
namespace Service {
namespace APT {
@ -212,7 +212,7 @@ public:
* Outputs:
* 0 : Return Header
* 1 : Result of function, 0 on success, otherwise error code
*/
*/
void SendParameter(Kernel::HLERequestContext& ctx);
/**
@ -313,7 +313,7 @@ public:
* Outputs:
* 0 : Return Header
* 1 : Result of function, 0 on success, otherwise error code
*/
*/
void StartApplication(Kernel::HLERequestContext& ctx);
/**
@ -420,6 +420,33 @@ public:
*/
void CancelLibraryApplet(Kernel::HLERequestContext& ctx);
/**
* APT::SendCaptureBufferInfo service function
* Inputs:
* 0 : Command header [0x00400042]
* 1 : Size
* 2 : (Size << 14) | 2
* 3 : void*, CaptureBufferInfo
* Outputs:
* 0 : Header code
* 1 : Result code
*/
void SendCaptureBufferInfo(Kernel::HLERequestContext& ctx);
/**
* APT::ReceiveCaptureBufferInfo service function
* Inputs:
* 0 : Command header [0x00410040]
* 1 : Size
* 64 : Size << 14 | 2
* 65 : void*, CaptureBufferInfo
* Outputs:
* 0 : Header code
* 1 : Result code
* 2 : Actual Size
*/
void ReceiveCaptureBufferInfo(Kernel::HLERequestContext& ctx);
/**
* APT::GetStartupArgument service function
* Inputs:
@ -496,6 +523,8 @@ private:
// APT::CheckNew3DSApp will check this unknown_ns_state_field to determine processing mode
u8 unknown_ns_state_field = 0;
std::vector<u8> screen_capture_buffer;
ScreencapPostPermission screen_capture_post_permission =
ScreencapPostPermission::CleanThePermission; // TODO(JamePeng): verify the initial value

View file

@ -73,8 +73,8 @@ APT_A::APT_A(std::shared_ptr<Module> apt)
{0x003D0042, nullptr, "SendDspWakeUp"},
{0x003E0080, nullptr, "ReplySleepQuery"},
{0x003F0040, nullptr, "ReplySleepNotificationComplete"},
{0x00400042, nullptr, "SendCaptureBufferInfo"},
{0x00410040, nullptr, "ReceiveCaptureBufferInfo"},
{0x00400042, &APT_A::SendCaptureBufferInfo, "SendCaptureBufferInfo"},
{0x00410040, &APT_A::ReceiveCaptureBufferInfo, "ReceiveCaptureBufferInfo"},
{0x00420080, nullptr, "SleepSystem"},
{0x00430040, &APT_A::NotifyToWait, "NotifyToWait"},
{0x00440000, &APT_A::GetSharedFont, "GetSharedFont"},

View file

@ -73,8 +73,8 @@ APT_S::APT_S(std::shared_ptr<Module> apt)
{0x003D0042, nullptr, "SendDspWakeUp"},
{0x003E0080, nullptr, "ReplySleepQuery"},
{0x003F0040, nullptr, "ReplySleepNotificationComplete"},
{0x00400042, nullptr, "SendCaptureBufferInfo"},
{0x00410040, nullptr, "ReceiveCaptureBufferInfo"},
{0x00400042, &APT_S::SendCaptureBufferInfo, "SendCaptureBufferInfo"},
{0x00410040, &APT_S::ReceiveCaptureBufferInfo, "ReceiveCaptureBufferInfo"},
{0x00420080, nullptr, "SleepSystem"},
{0x00430040, &APT_S::NotifyToWait, "NotifyToWait"},
{0x00440000, &APT_S::GetSharedFont, "GetSharedFont"},

View file

@ -73,8 +73,8 @@ APT_U::APT_U(std::shared_ptr<Module> apt)
{0x003D0042, nullptr, "SendDspWakeUp"},
{0x003E0080, nullptr, "ReplySleepQuery"},
{0x003F0040, nullptr, "ReplySleepNotificationComplete"},
{0x00400042, nullptr, "SendCaptureBufferInfo"},
{0x00410040, nullptr, "ReceiveCaptureBufferInfo"},
{0x00400042, &APT_U::SendCaptureBufferInfo, "SendCaptureBufferInfo"},
{0x00410040, &APT_U::ReceiveCaptureBufferInfo, "ReceiveCaptureBufferInfo"},
{0x00420080, nullptr, "SleepSystem"},
{0x00430040, &APT_U::NotifyToWait, "NotifyToWait"},
{0x00440000, &APT_U::GetSharedFont, "GetSharedFont"},