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"); 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() { void Init() {
using namespace Kernel; using namespace Kernel;

View File

@ -50,6 +50,20 @@ void GetTitleIDList(Service::Interface* self);
*/ */
void GetNumContentInfos(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 /// Initialize AM service
void Init(); void Init();

View File

@ -14,7 +14,7 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x10030142, nullptr, "ListContentInfos"}, {0x10030142, nullptr, "ListContentInfos"},
{0x10040102, nullptr, "DeleteContents"}, {0x10040102, nullptr, "DeleteContents"},
{0x10050084, nullptr, "GetDataTitleInfos"}, {0x10050084, nullptr, "GetDataTitleInfos"},
{0x10070102, nullptr, "ListDataTitleTicketInfos"}, {0x10070102, ListDataTitleTicketInfos, "ListDataTitleTicketInfos"},
{0x100900C0, nullptr, "IsDataTitleInUse"}, {0x100900C0, nullptr, "IsDataTitleInUse"},
{0x100A0000, nullptr, "IsExternalTitleDatabaseInitialized"}, {0x100A0000, nullptr, "IsExternalTitleDatabaseInitialized"},
}; };

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

View File

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

View File

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

View File

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

View File

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