From d5aa47478895386a59f59a650d7391e3598e6739 Mon Sep 17 00:00:00 2001 From: JamePeng Date: Thu, 14 Jul 2016 18:26:43 +0800 Subject: Correct APT::0x00550040 and APT::0x00560000 function --- src/core/hle/service/apt/apt.cpp | 15 +++++++++------ src/core/hle/service/apt/apt.h | 26 ++++++++++++++++---------- src/core/hle/service/apt/apt_a.cpp | 4 ++-- src/core/hle/service/apt/apt_s.cpp | 4 ++-- src/core/hle/service/apt/apt_u.cpp | 4 ++-- 5 files changed, 31 insertions(+), 22 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 1e54a53dd..14d661b38 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -37,6 +37,8 @@ static u32 cpu_percent; ///< CPU time available to the running application // APT::CheckNew3DSApp will check this unknown_ns_state_field to determine processing mode static u8 unknown_ns_state_field; +static ScreencapPostPermission screen_capture_post_permission; + /// Parameter data to be returned in the next call to Glance/ReceiveParameter static MessageParameter next_parameter; @@ -382,23 +384,23 @@ void StartLibraryApplet(Service::Interface* self) { cmd_buff[1] = applet->Start(parameter).raw; } -void SetNSStateField(Service::Interface* self) { +void SetScreenCapPostPermission(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); - unknown_ns_state_field = cmd_buff[1]; + screen_capture_post_permission = static_cast(cmd_buff[1] & 0xF); cmd_buff[0] = IPC::MakeHeader(0x55, 1, 0); cmd_buff[1] = RESULT_SUCCESS.raw; - LOG_WARNING(Service_APT, "(STUBBED) unknown_ns_state_field=%u", unknown_ns_state_field); + LOG_WARNING(Service_APT, "(STUBBED) screen_capture_post_permission=%u", screen_capture_post_permission); } -void GetNSStateField(Service::Interface* self) { +void GetScreenCapPostPermission(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); cmd_buff[0] = IPC::MakeHeader(0x56, 2, 0); cmd_buff[1] = RESULT_SUCCESS.raw; - cmd_buff[8] = unknown_ns_state_field; - LOG_WARNING(Service_APT, "(STUBBED) unknown_ns_state_field=%u", unknown_ns_state_field); + cmd_buff[2] = static_cast(screen_capture_post_permission); + LOG_WARNING(Service_APT, "(STUBBED) screen_capture_post_permission=%u", screen_capture_post_permission); } void GetAppletInfo(Service::Interface* self) { @@ -493,6 +495,7 @@ void Init() { cpu_percent = 0; unknown_ns_state_field = 0; + screen_capture_post_permission = ScreencapPostPermission::CleanThePermission; // TODO(JamePeng): verify the initial value // TODO(bunnei): Check if these are created in Initialize or on APT process startup. notification_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "APT_U:Notification"); diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index 53cee4867..077a6a316 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h @@ -94,6 +94,13 @@ enum class StartupArgumentType : u32 { OtherMedia = 2, }; +enum class ScreencapPostPermission : u32 { + CleanThePermission = 0, //TODO(JamePeng): verify what "zero" means + NoExplicitSetting = 1, + EnableScreenshotPostingToMiiverse = 2, + DisableScreenshotPostingToMiiverse = 3 +}; + /// Send a parameter to the currently-running application, which will read it via ReceiveParameter void SendParameter(const MessageParameter& parameter); @@ -383,25 +390,24 @@ void StartLibraryApplet(Service::Interface* self); void GetStartupArgument(Service::Interface* self); /** - * APT::SetNSStateField service function + * APT::SetScreenCapPostPermission service function * Inputs: - * 1 : u8 NS state field + * 0 : Header Code[0x00550040] + * 1 : u8 The screenshot posting permission * Outputs: * 1 : Result of function, 0 on success, otherwise error code - * Note: - * This writes the input u8 to a NS state field. */ -void SetNSStateField(Service::Interface* self); +void SetScreenCapPostPermission(Service::Interface* self); /** - * APT::GetNSStateField service function + * APT::GetScreenCapPostPermission service function + * Inputs: + * 0 : Header Code[0x00560000] * Outputs: * 1 : Result of function, 0 on success, otherwise error code - * 8 : u8 NS state field - * Note: - * This returns a u8 NS state field(which can be set by cmd 0x00550040), at cmdreply+8. + * 2 : u8 The screenshot posting permission */ -void GetNSStateField(Service::Interface* self); +void GetScreenCapPostPermission(Service::Interface* self); /** * APT::CheckNew3DSApp service function diff --git a/src/core/hle/service/apt/apt_a.cpp b/src/core/hle/service/apt/apt_a.cpp index 223c0a8bd..6c44c491c 100644 --- a/src/core/hle/service/apt/apt_a.cpp +++ b/src/core/hle/service/apt/apt_a.cpp @@ -33,8 +33,8 @@ const Interface::FunctionInfo FunctionTable[] = { {0x004F0080, SetAppCpuTimeLimit, "SetAppCpuTimeLimit"}, {0x00500040, GetAppCpuTimeLimit, "GetAppCpuTimeLimit"}, {0x00510080, GetStartupArgument, "GetStartupArgument"}, - {0x00550040, SetNSStateField, "SetNSStateField?"}, - {0x00560000, GetNSStateField, "GetNSStateField?"}, + {0x00550040, SetScreenCapPostPermission, "SetScreenCapPostPermission"}, + {0x00560000, GetScreenCapPostPermission, "GetScreenCapPostPermission"}, {0x01010000, CheckNew3DSApp, "CheckNew3DSApp"}, {0x01020000, CheckNew3DS, "CheckNew3DS"} }; diff --git a/src/core/hle/service/apt/apt_s.cpp b/src/core/hle/service/apt/apt_s.cpp index f5c52fa3d..c70f2201f 100644 --- a/src/core/hle/service/apt/apt_s.cpp +++ b/src/core/hle/service/apt/apt_s.cpp @@ -92,8 +92,8 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00510080, GetStartupArgument, "GetStartupArgument"}, {0x00520104, nullptr, "Wrap1"}, {0x00530104, nullptr, "Unwrap1"}, - {0x00550040, SetNSStateField, "SetNSStateField?" }, - {0x00560000, GetNSStateField, "GetNSStateField?" }, + {0x00550040, SetScreenCapPostPermission, "SetScreenCapPostPermission"}, + {0x00560000, GetScreenCapPostPermission, "GetScreenCapPostPermission"}, {0x00580002, nullptr, "GetProgramID"}, {0x01010000, CheckNew3DSApp, "CheckNew3DSApp"}, {0x01020000, CheckNew3DS, "CheckNew3DS"} diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp index 0e60bd34f..7bb804ffa 100644 --- a/src/core/hle/service/apt/apt_u.cpp +++ b/src/core/hle/service/apt/apt_u.cpp @@ -92,8 +92,8 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00510080, GetStartupArgument, "GetStartupArgument"}, {0x00520104, nullptr, "Wrap1"}, {0x00530104, nullptr, "Unwrap1"}, - {0x00550040, SetNSStateField, "SetNSStateField?"}, - {0x00560000, GetNSStateField, "GetNSStateField?"}, + {0x00550040, SetScreenCapPostPermission, "SetScreenCapPostPermission"}, + {0x00560000, GetScreenCapPostPermission, "GetScreenCapPostPermission"}, {0x00580002, nullptr, "GetProgramID"}, {0x01010000, CheckNew3DSApp, "CheckNew3DSApp"}, {0x01020000, CheckNew3DS, "CheckNew3DS"} -- cgit v1.2.3