diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 69255e2ef..4713dbc52 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -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 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(AppletAttr::SYS); cmd_buff[3] = 0; cmd_buff[4] = static_cast(AppletId::HomeMenu); // Home menu AppID cmd_buff[5] = static_cast(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(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(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]; diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index 4a72b6b5c..78c7a01bd 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h @@ -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 diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp index 209a0055b..b13b51549 100644 --- a/src/core/hle/service/apt/apt_u.cpp +++ b/src/core/hle/service/apt/apt_u.cpp @@ -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"}, diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h index 952deb4d4..dd7e74f6c 100644 --- a/src/core/hle/service/fs/archive.h +++ b/src/core/hle/service/fs/archive.h @@ -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;