Implement ReplySleepQuery() and ListDataTitleTicketInfos()

Correct AppletUtility() parameter!
Signed-off-by: JamePeng <jame_peng@sina.com>
This commit is contained in:
JamePeng 2016-02-11 02:09:41 +08:00
parent 539b072abf
commit 3b0a54437c
8 changed files with 82 additions and 26 deletions

View File

@ -44,6 +44,20 @@ void GetNumContentInfos(Service::Interface* self) {
LOG_WARNING(Service_AM, "(STUBBED) called");
}
void ListDataTitleTicketInfos(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
u32 ticket_count = cmd_buff[1];
u64 title_id = cmd_buff[2];
title_id = (title_id << 32) | cmd_buff[3];
u32 start_index = cmd_buff[4];
u32 tipointer = cmd_buff[6];
cmd_buff[1] = RESULT_SUCCESS.raw;
cmd_buff[2] = 0x18;
LOG_WARNING(Service_AM, "(STUBBED) TicketCount=0x%08X TitleID==0x%16X StartIndex=0x%08X",
"TicketInfosPointer=0x%08X",ticket_count, title_id, start_index, tipointer);
}
void Init() {
using namespace Kernel;

View File

@ -50,6 +50,20 @@ void GetTitleIDList(Service::Interface* self);
*/
void GetNumContentInfos(Service::Interface* self);
/**
* AM::ListDataTitleTicketInfos service function
* Inputs:
* 1 : Ticket count
* 2-3 : u64, Title ID
* 4 : Start Index?
* 5 : (TicketCount * 24) << 8 | 0x4
* 6 : Ticket Infos pointer
* Outputs:
* 1 : Result, 0 on success, otherwise error code
* 2 : Number of content infos plus one ,0x18
*/
void ListDataTitleTicketInfos(Service::Interface* self);
/// Initialize AM service
void Init();

View File

@ -9,14 +9,14 @@ namespace Service {
namespace AM {
const Interface::FunctionInfo FunctionTable[] = {
{0x100100C0, GetNumContentInfos, "GetNumContentInfos"},
{0x10020104, nullptr, "FindContentInfos"},
{0x10030142, nullptr, "ListContentInfos"},
{0x10040102, nullptr, "DeleteContents"},
{0x10050084, nullptr, "GetDataTitleInfos"},
{0x10070102, nullptr, "ListDataTitleTicketInfos"},
{0x100900C0, nullptr, "IsDataTitleInUse"},
{0x100A0000, nullptr, "IsExternalTitleDatabaseInitialized"},
{0x100100C0, GetNumContentInfos, "GetNumContentInfos"},
{0x10020104, nullptr, "FindContentInfos"},
{0x10030142, nullptr, "ListContentInfos"},
{0x10040102, nullptr, "DeleteContents"},
{0x10050084, nullptr, "GetDataTitleInfos"},
{0x10070102, ListDataTitleTicketInfos, "ListDataTitleTicketInfos"},
{0x100900C0, nullptr, "IsDataTitleInUse"},
{0x100A0000, nullptr, "IsExternalTitleDatabaseInitialized"},
};
AM_APP_Interface::AM_APP_Interface() {

View File

@ -92,11 +92,20 @@ void GetSharedFont(Service::Interface* self) {
}
}
void ReplySleepQuery(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
u32 app_id = cmd_buff[1];
QueryReply qr = static_cast<QueryReply>(cmd_buff[2]);
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
LOG_WARNING(Service_APT, "(STUBBED) app_id=0x%08X QueryReply=0x%08X", app_id,qr);
}
void NotifyToWait(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
u32 app_id = cmd_buff[1];
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
LOG_WARNING(Service_APT, "(STUBBED) app_id=%u", app_id);
LOG_WARNING(Service_APT, "(STUBBED) app_id=0x%08X", app_id);
}
void GetLockHandle(Service::Interface* self) {
@ -289,18 +298,17 @@ void StartApplication(Service::Interface* self) {
void AppletUtility(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
// These are from 3dbrew - I'm not really sure what they're used for.
u32 command = cmd_buff[1];
u32 buffer1_size = cmd_buff[2];
u32 buffer2_size = cmd_buff[3];
u32 buffer1_addr = cmd_buff[5];
u32 buffer2_addr = cmd_buff[65];
u32 util = cmd_buff[1];
u32 i_size = cmd_buff[2];
u32 o_size = cmd_buff[3];
u32 td = cmd_buff[5];
u32 i_addr = cmd_buff[65];
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
cmd_buff[2] = RESULT_SUCCESS.raw; // No error
LOG_WARNING(Service_APT, "(STUBBED) called command=0x%08X, buffer1_size=0x%08X, buffer2_size=0x%08X, "
"buffer1_addr=0x%08X, buffer2_addr=0x%08X", command, buffer1_size, buffer2_size,
buffer1_addr, buffer2_addr);
LOG_WARNING(Service_APT, "(STUBBED) called Utility=0x%08X, InputSize=0x%08X, OutputSize=0x%08X, "
"TranslationDescriptor=0x%08X, InputAddress=0x%08X", util, i_size, o_size, td, i_addr);
}
void SetAppCpuTimeLimit(Service::Interface* self) {

View File

@ -31,6 +31,13 @@ struct AppletStartupParameter {
u8* data = nullptr;
};
enum class QueryReply : u32
{
REPLY_REJECT = 0x0,
REPLY_ACCEPT = 0x1,
REPLY_LATER = 0x2
};
/// Signals used by APT functions
enum class SignalType : u32 {
None = 0x0,
@ -98,6 +105,17 @@ void Initialize(Service::Interface* self);
*/
void GetSharedFont(Service::Interface* self);
/**
* APT::ReplySleepQuery service function
* Inputs:
* 1 : AppID
* 2 : ReplySleepQuery
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
*/
void ReplySleepQuery(Service::Interface* self);
/**
* APT::NotifyToWait service function
* Inputs:
@ -105,6 +123,7 @@ void GetSharedFont(Service::Interface* self);
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
*/
void NotifyToWait(Service::Interface* self);
/**
@ -270,13 +289,14 @@ void StartApplication(Service::Interface* self);
/**
* APT::AppletUtility service function
* Inputs:
* 1 : Unknown, but clearly used for something
* 2 : Buffer 1 size (purpose is unknown)
* 3 : Buffer 2 size (purpose is unknown)
* 5 : Buffer 1 address (purpose is unknown)
* 65 : Buffer 2 address (purpose is unknown)
* 1 : Utility
* 2 : Input Size
* 3 : Output Size
* 4: Translation descriptor: (Input Size << 14) | 0x402
* 5 : void*, Input
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
* 2 : Applet Result
*/
void AppletUtility(Service::Interface* self);

View File

@ -70,7 +70,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x003B0040, nullptr, "CancelLibraryApplet" },
{0x003C0042, nullptr, "SendDspSleep" },
{0x003D0042, nullptr, "SendDspWakeUp" },
{0x003E0080, nullptr, "ReplySleepQuery" },
{0x003E0080, ReplySleepQuery, "ReplySleepQuery" },
{0x003F0040, nullptr, "ReplySleepNotificationComplete" },
{0x00400042, nullptr, "SendCaptureBufferInfo" },
{0x00410040, nullptr, "ReceiveCaptureBufferInfo" },

View File

@ -70,7 +70,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x003B0040, nullptr, "CancelLibraryApplet"},
{0x003C0042, nullptr, "SendDspSleep"},
{0x003D0042, nullptr, "SendDspWakeUp"},
{0x003E0080, nullptr, "ReplySleepQuery"},
{0x003E0080, ReplySleepQuery, "ReplySleepQuery"},
{0x003F0040, nullptr, "ReplySleepNotificationComplete"},
{0x00400042, nullptr, "SendCaptureBufferInfo"},
{0x00410040, nullptr, "ReceiveCaptureBufferInfo"},

View File

@ -70,7 +70,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x003B0040, nullptr, "CancelLibraryApplet"},
{0x003C0042, nullptr, "SendDspSleep"},
{0x003D0042, nullptr, "SendDspWakeUp"},
{0x003E0080, nullptr, "ReplySleepQuery"},
{0x003E0080, ReplySleepQuery, "ReplySleepQuery"},
{0x003F0040, nullptr, "ReplySleepNotificationComplete"},
{0x00400042, nullptr, "SendCaptureBufferInfo"},
{0x00410040, nullptr, "ReceiveCaptureBufferInfo"},