From ef47d855cee7d3c3de62c9c8c63449357ec02011 Mon Sep 17 00:00:00 2001 From: JamePeng Date: Sun, 27 Mar 2016 18:15:48 +0800 Subject: [PATCH 1/3] Append the missing function name"GetAppletInfo" to APT:A --- src/core/hle/service/apt/apt_a.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/apt/apt_a.cpp b/src/core/hle/service/apt/apt_a.cpp index 0c6a773059..61f660f552 100644 --- a/src/core/hle/service/apt/apt_a.cpp +++ b/src/core/hle/service/apt/apt_a.cpp @@ -14,7 +14,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00030040, Enable, "Enable?"}, {0x00040040, nullptr, "Finalize?"}, {0x00050040, nullptr, "GetAppletManInfo?"}, - {0x00060040, nullptr, "GetAppletInfo?"}, + {0x00060040, GetAppletInfo, "GetAppletInfo"}, {0x00090040, IsRegistered, "IsRegistered"}, {0x000C0104, SendParameter, "SendParameter"}, {0x000D0080, ReceiveParameter, "ReceiveParameter"}, @@ -24,6 +24,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00180040, PrepareToStartLibraryApplet, "PrepareToStartLibraryApplet"}, {0x001E0084, StartLibraryApplet, "StartLibraryApplet"}, {0x003B0040, nullptr, "CancelLibraryApplet?"}, + {0x003E0080, nullptr, "ReplySleepQuery"}, {0x00430040, NotifyToWait, "NotifyToWait?"}, {0x00440000, GetSharedFont, "GetSharedFont?"}, {0x004B00C2, AppletUtility, "AppletUtility?"}, From af9a8258b93e4fd6a0fc1980fadfd07330d00de2 Mon Sep 17 00:00:00 2001 From: JamePeng Date: Tue, 29 Mar 2016 05:25:05 +0800 Subject: [PATCH 2/3] implement APT::GetStartupArgument --- src/core/hle/service/apt/apt.cpp | 17 +++++++++++++++++ src/core/hle/service/apt/apt.h | 17 +++++++++++++++++ src/core/hle/service/apt/apt_a.cpp | 1 + src/core/hle/service/apt/apt_s.cpp | 2 +- src/core/hle/service/apt/apt_u.cpp | 2 +- 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index a493652872..6d72e81887 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -397,6 +397,23 @@ void GetAppletInfo(Service::Interface* self) { LOG_WARNING(Service_APT, "(stubbed) called appid=%u", app_id); } +void GetStartupArgument(Service::Interface* self) { + u32* cmd_buff = Kernel::GetCommandBuffer(); + u32 parameter_size = cmd_buff[1]; + StartupArgumentType startup_argument_type = static_cast(cmd_buff[2]); + + if (parameter_size >= 0x300) { + LOG_ERROR(Service_APT, "Parameter size is outside the valid range (capped to 0x300): parameter_size=0x%08x", parameter_size); + return; + } + + LOG_WARNING(Service_APT,"(stubbed) called startup_argument_type=%u , parameter_size=0x%08x , parameter_value=0x%08x", + startup_argument_type, parameter_size, Memory::Read32(cmd_buff[41])); + + cmd_buff[1] = RESULT_SUCCESS.raw; + cmd_buff[2] = (parameter_size > 0) ? 1 : 0; +} + void Init() { AddService(new APT_A_Interface); AddService(new APT_S_Interface); diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index 47a97c1a18..e4f96855b5 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h @@ -67,6 +67,12 @@ enum class AppletId : u32 { Ed2 = 0x402, }; +enum class StartupArgumentType : u32 { + OtherApp = 0, + Restart = 1, + OtherMedia = 2, +}; + /// Send a parameter to the currently-running application, which will read it via ReceiveParameter void SendParameter(const MessageParameter& parameter); @@ -344,6 +350,17 @@ void PreloadLibraryApplet(Service::Interface* self); */ void StartLibraryApplet(Service::Interface* self); +/** +* APT::GetStartupArgument service function +* Inputs: +* 1 : Parameter Size (capped to 0x300) +* 2 : StartupArgumentType +* Outputs: +* 0 : Return header +* 1 : u8, Exists (0 = does not exist, 1 = exists) +*/ +void GetStartupArgument(Service::Interface* self); + /// Initialize the APT service void Init(); diff --git a/src/core/hle/service/apt/apt_a.cpp b/src/core/hle/service/apt/apt_a.cpp index 61f660f552..c0bbf7dd4c 100644 --- a/src/core/hle/service/apt/apt_a.cpp +++ b/src/core/hle/service/apt/apt_a.cpp @@ -28,6 +28,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00430040, NotifyToWait, "NotifyToWait?"}, {0x00440000, GetSharedFont, "GetSharedFont?"}, {0x004B00C2, AppletUtility, "AppletUtility?"}, + {0x00510080, GetStartupArgument, "GetStartupArgument"}, {0x00550040, nullptr, "WriteInputToNsState?"}, }; diff --git a/src/core/hle/service/apt/apt_s.cpp b/src/core/hle/service/apt/apt_s.cpp index 7f6e81a637..b978b8f671 100644 --- a/src/core/hle/service/apt/apt_s.cpp +++ b/src/core/hle/service/apt/apt_s.cpp @@ -89,7 +89,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x004E0000, nullptr, "HardwareResetAsync"}, {0x004F0080, nullptr, "SetApplicationCpuTimeLimit"}, {0x00500040, nullptr, "GetApplicationCpuTimeLimit"}, - {0x00510080, nullptr, "GetStartupArgument"}, + {0x00510080, GetStartupArgument, "GetStartupArgument"}, {0x00520104, nullptr, "Wrap1"}, {0x00530104, nullptr, "Unwrap1"}, {0x00580002, nullptr, "GetProgramID"}, diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp index b13b515494..0e85c6d08f 100644 --- a/src/core/hle/service/apt/apt_u.cpp +++ b/src/core/hle/service/apt/apt_u.cpp @@ -89,7 +89,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x004E0000, nullptr, "HardwareResetAsync"}, {0x004F0080, SetAppCpuTimeLimit, "SetAppCpuTimeLimit"}, {0x00500040, GetAppCpuTimeLimit, "GetAppCpuTimeLimit"}, - {0x00510080, nullptr, "GetStartupArgument"}, + {0x00510080, GetStartupArgument, "GetStartupArgument"}, {0x00520104, nullptr, "Wrap1"}, {0x00530104, nullptr, "Unwrap1"}, {0x00580002, nullptr, "GetProgramID"}, From 857bf9cd0963675605fc1cd3db0575335c902f7b Mon Sep 17 00:00:00 2001 From: JamePeng Date: Tue, 5 Apr 2016 02:24:02 +0800 Subject: [PATCH 3/3] append SetAppCpuTimeLimit and GetAppCpuTimeLimit to APT:A --- src/core/hle/service/apt/apt.h | 16 ++++++++-------- src/core/hle/service/apt/apt_a.cpp | 5 ++++- src/core/hle/service/apt/apt_s.cpp | 8 ++++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index e4f96855b5..668b4a66f2 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h @@ -351,14 +351,14 @@ void PreloadLibraryApplet(Service::Interface* self); void StartLibraryApplet(Service::Interface* self); /** -* APT::GetStartupArgument service function -* Inputs: -* 1 : Parameter Size (capped to 0x300) -* 2 : StartupArgumentType -* Outputs: -* 0 : Return header -* 1 : u8, Exists (0 = does not exist, 1 = exists) -*/ + * APT::GetStartupArgument service function + * Inputs: + * 1 : Parameter Size (capped to 0x300) + * 2 : StartupArgumentType + * Outputs: + * 0 : Return header + * 1 : u8, Exists (0 = does not exist, 1 = exists) + */ void GetStartupArgument(Service::Interface* self); /// Initialize the APT service diff --git a/src/core/hle/service/apt/apt_a.cpp b/src/core/hle/service/apt/apt_a.cpp index c0bbf7dd4c..9ff47701a9 100644 --- a/src/core/hle/service/apt/apt_a.cpp +++ b/src/core/hle/service/apt/apt_a.cpp @@ -13,9 +13,10 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00020080, Initialize, "Initialize?"}, {0x00030040, Enable, "Enable?"}, {0x00040040, nullptr, "Finalize?"}, - {0x00050040, nullptr, "GetAppletManInfo?"}, + {0x00050040, GetAppletManInfo, "GetAppletManInfo"}, {0x00060040, GetAppletInfo, "GetAppletInfo"}, {0x00090040, IsRegistered, "IsRegistered"}, + {0x000B0040, InquireNotification, "InquireNotification"}, {0x000C0104, SendParameter, "SendParameter"}, {0x000D0080, ReceiveParameter, "ReceiveParameter"}, {0x000E0080, GlanceParameter, "GlanceParameter"}, @@ -28,6 +29,8 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00430040, NotifyToWait, "NotifyToWait?"}, {0x00440000, GetSharedFont, "GetSharedFont?"}, {0x004B00C2, AppletUtility, "AppletUtility?"}, + {0x004F0080, SetAppCpuTimeLimit, "SetAppCpuTimeLimit"}, + {0x00500040, GetAppCpuTimeLimit, "GetAppCpuTimeLimit"}, {0x00510080, GetStartupArgument, "GetStartupArgument"}, {0x00550040, nullptr, "WriteInputToNsState?"}, }; diff --git a/src/core/hle/service/apt/apt_s.cpp b/src/core/hle/service/apt/apt_s.cpp index b978b8f671..ca54e593c0 100644 --- a/src/core/hle/service/apt/apt_s.cpp +++ b/src/core/hle/service/apt/apt_s.cpp @@ -13,8 +13,8 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00020080, Initialize, "Initialize"}, {0x00030040, Enable, "Enable"}, {0x00040040, nullptr, "Finalize"}, - {0x00050040, nullptr, "GetAppletManInfo"}, - {0x00060040, nullptr, "GetAppletInfo"}, + {0x00050040, GetAppletManInfo, "GetAppletManInfo"}, + {0x00060040, GetAppletInfo, "GetAppletInfo"}, {0x00070000, nullptr, "GetLastSignaledAppletId"}, {0x00080000, nullptr, "CountRegisteredApplet"}, {0x00090040, nullptr, "IsRegistered"}, @@ -87,8 +87,8 @@ const Interface::FunctionInfo FunctionTable[] = { {0x004C0000, nullptr, "SetFatalErrDispMode"}, {0x004D0080, nullptr, "GetAppletProgramInfo"}, {0x004E0000, nullptr, "HardwareResetAsync"}, - {0x004F0080, nullptr, "SetApplicationCpuTimeLimit"}, - {0x00500040, nullptr, "GetApplicationCpuTimeLimit"}, + {0x004F0080, SetAppCpuTimeLimit, "SetAppCpuTimeLimit"}, + {0x00500040, GetAppCpuTimeLimit, "GetAppCpuTimeLimit"}, {0x00510080, GetStartupArgument, "GetStartupArgument"}, {0x00520104, nullptr, "Wrap1"}, {0x00530104, nullptr, "Unwrap1"},