apt: GetAppletInfo

This commit is contained in:
mailwl 2016-02-23 13:26:12 +03:00
parent 878562c291
commit 9e4e413d0c
4 changed files with 68 additions and 13 deletions

View File

@ -29,6 +29,10 @@ namespace APT {
// correctly mapping it in Citra, however we still do not understand how the mapping is determined.
static const VAddr SHARED_FONT_VADDR = 0x18000000;
static const u32 TID_HI_APPLET = 0x00040030;
static const u32 TID_LOW_SWKBD = 0x0000C802;
/// Handle to shared memory region designated to for shared system font
static Kernel::SharedPtr<Kernel::SharedMemory> shared_font_mem;
@ -128,7 +132,7 @@ void GetAppletManInfo(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
u32 unk = cmd_buff[1];
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
cmd_buff[2] = 0;
cmd_buff[2] = static_cast<u32>(AppletAttr::SYS);
cmd_buff[3] = 0;
cmd_buff[4] = static_cast<u32>(AppletId::HomeMenu); // Home menu AppID
cmd_buff[5] = static_cast<u32>(AppletId::Application); // TODO(purpasmart96): Do this correctly
@ -136,6 +140,33 @@ void GetAppletManInfo(Service::Interface* self) {
LOG_WARNING(Service_APT, "(STUBBED) called unk=0x%08X", unk);
}
void GetAppletInfo(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
AppletId app_id = static_cast<AppletId>(cmd_buff[1]);
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
switch(app_id) {
case AppletId::SoftwareKeyboard2:
cmd_buff[2] = TID_LOW_SWKBD;
break;
default:
cmd_buff[2] = 0;
LOG_WARNING(Service_APT, "No title ID low for AppletID=0x%08X", app_id);
break;
}
cmd_buff[3] = TID_HI_APPLET;
cmd_buff[4] = 0; // NAND
cmd_buff[5] = true;
cmd_buff[6] = true;
cmd_buff[7] = static_cast<u32>(AppletAttr::SYS);
LOG_WARNING(Service_APT, "(STUBBED) called AppletID=0x%08X", app_id);
}
void IsRegistered(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
u32 app_id = cmd_buff[1];

View File

@ -66,6 +66,14 @@ enum class AppletId : u32 {
SoftwareKeyboard2 = 0x401,
};
enum class AppletAttr : u32 {
APP = 0x00,
APPLIB = 0x01,
SYS = 0x02,
SYSLIB = 0x03,
RESIDENT = 0x04,
};
/// Send a parameter to the currently-running application, which will read it via ReceiveParameter
void SendParameter(const MessageParameter& parameter);
@ -120,18 +128,33 @@ void GetLockHandle(Service::Interface* self);
void Enable(Service::Interface* self);
/**
* APT::GetAppletManInfo service function.
* Inputs:
* 1 : Unknown
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
* 2 : Unknown u32 value
* 3 : Unknown u8 value
* 4 : Home Menu AppId
* 5 : AppID of currently active app
*/
* APT::GetAppletManInfo service function.
* Inputs:
* 1 : AppletPos
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
* 2 : AppletPos
* 3 : Requested AppID
* 4 : Home Menu AppId
* 5 : AppID of currently active app
*/
void GetAppletManInfo(Service::Interface* self);
/**
* APT::GetAppletInfo service function.
* Inputs:
* 1 : AppID
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
* 2 : TitleID (low 32 bits)
* 3 : TitleID (hi 32 bits)
* 4 : Media Type
* 5 : Registered
* 6 : Loaded
* 7 : AppletAttr
*/
void GetAppletInfo(Service::Interface* self);
/**
* APT::IsRegistered service function. This returns whether the specified AppID is registered with NS yet.
* An AppID is "registered" once the process associated with the AppID uses APT:Enable. Home Menu uses this

View File

@ -14,7 +14,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00030040, Enable, "Enable"},
{0x00040040, nullptr, "Finalize"},
{0x00050040, GetAppletManInfo, "GetAppletManInfo"},
{0x00060040, nullptr, "GetAppletInfo"},
{0x00060040, GetAppletInfo, "GetAppletInfo"},
{0x00070000, nullptr, "GetLastSignaledAppletId"},
{0x00080000, nullptr, "CountRegisteredApplet"},
{0x00090040, IsRegistered, "IsRegistered"},

View File

@ -41,7 +41,8 @@ enum class ArchiveIdCode : u32 {
/// Media types for the archives
enum class MediaType : u32 {
NAND = 0,
SDMC = 1
SDMC = 1,
GameCard = 2
};
typedef u64 ArchiveHandle;