2015-06-11 22:12:16 +00:00
|
|
|
// Copyright 2015 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2016-04-08 19:44:00 +00:00
|
|
|
#include <cinttypes>
|
2015-06-11 22:12:16 +00:00
|
|
|
#include "common/logging/log.h"
|
2016-09-21 06:52:38 +00:00
|
|
|
#include "core/hle/service/am/am.h"
|
2015-06-11 22:12:16 +00:00
|
|
|
#include "core/hle/service/am/am_app.h"
|
|
|
|
#include "core/hle/service/am/am_net.h"
|
|
|
|
#include "core/hle/service/am/am_sys.h"
|
2016-04-08 19:44:00 +00:00
|
|
|
#include "core/hle/service/am/am_u.h"
|
2016-09-18 00:38:01 +00:00
|
|
|
#include "core/hle/service/service.h"
|
2015-06-11 22:12:16 +00:00
|
|
|
|
|
|
|
namespace Service {
|
|
|
|
namespace AM {
|
|
|
|
|
2016-09-18 00:38:01 +00:00
|
|
|
static std::array<u32, 3> am_content_count = {0, 0, 0};
|
|
|
|
static std::array<u32, 3> am_titles_count = {0, 0, 0};
|
|
|
|
static std::array<u32, 3> am_titles_list_count = {0, 0, 0};
|
2016-04-08 19:44:00 +00:00
|
|
|
static u32 am_ticket_count = 0;
|
|
|
|
static u32 am_ticket_list_count = 0;
|
|
|
|
|
|
|
|
void GetTitleCount(Service::Interface* self) {
|
2015-06-11 22:12:16 +00:00
|
|
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
2016-04-08 19:44:00 +00:00
|
|
|
|
2015-06-11 22:12:16 +00:00
|
|
|
u32 media_type = cmd_buff[1] & 0xFF;
|
|
|
|
|
|
|
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
2016-04-08 19:44:00 +00:00
|
|
|
cmd_buff[2] = am_titles_count[media_type];
|
2016-09-18 00:38:01 +00:00
|
|
|
LOG_WARNING(Service_AM, "(STUBBED) media_type=%u, title_count=0x%08x", media_type,
|
|
|
|
am_titles_count[media_type]);
|
2016-04-08 19:44:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FindContentInfos(Service::Interface* self) {
|
|
|
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
|
|
|
|
|
|
|
u32 media_type = cmd_buff[1] & 0xFF;
|
|
|
|
u64 title_id = (static_cast<u64>(cmd_buff[3]) << 32) | cmd_buff[2];
|
|
|
|
u32 content_ids_pointer = cmd_buff[6];
|
|
|
|
u32 content_info_pointer = cmd_buff[8];
|
|
|
|
|
|
|
|
am_content_count[media_type] = cmd_buff[4];
|
2015-06-11 22:12:16 +00:00
|
|
|
|
2016-04-08 19:44:00 +00:00
|
|
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
2016-09-18 00:38:01 +00:00
|
|
|
LOG_WARNING(Service_AM, "(STUBBED) media_type=%u, title_id=0x%016llx, content_cound=%u, "
|
|
|
|
"content_ids_pointer=0x%08x, content_info_pointer=0x%08x",
|
|
|
|
media_type, title_id, am_content_count[media_type], content_ids_pointer,
|
|
|
|
content_info_pointer);
|
2015-06-11 22:12:16 +00:00
|
|
|
}
|
|
|
|
|
2016-04-08 19:44:00 +00:00
|
|
|
void ListContentInfos(Service::Interface* self) {
|
2015-06-11 22:12:16 +00:00
|
|
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
2016-04-08 19:44:00 +00:00
|
|
|
|
2015-06-11 22:12:16 +00:00
|
|
|
u32 media_type = cmd_buff[2] & 0xFF;
|
2016-04-08 19:44:00 +00:00
|
|
|
u64 title_id = (static_cast<u64>(cmd_buff[4]) << 32) | cmd_buff[3];
|
|
|
|
u32 start_index = cmd_buff[5];
|
|
|
|
u32 content_info_pointer = cmd_buff[7];
|
|
|
|
|
|
|
|
am_content_count[media_type] = cmd_buff[1];
|
2015-06-11 22:12:16 +00:00
|
|
|
|
|
|
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
2016-04-08 19:44:00 +00:00
|
|
|
cmd_buff[2] = am_content_count[media_type];
|
2016-09-18 00:38:01 +00:00
|
|
|
LOG_WARNING(Service_AM, "(STUBBED) media_type=%u, content_count=%u, title_id=0x%016" PRIx64
|
|
|
|
", start_index=0x%08x, content_info_pointer=0x%08X",
|
|
|
|
media_type, am_content_count[media_type], title_id, start_index,
|
|
|
|
content_info_pointer);
|
2016-04-08 19:44:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DeleteContents(Service::Interface* self) {
|
|
|
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
|
|
|
|
|
|
|
u32 media_type = cmd_buff[1] & 0xFF;
|
|
|
|
u64 title_id = (static_cast<u64>(cmd_buff[3]) << 32) | cmd_buff[2];
|
|
|
|
u32 content_ids_pointer = cmd_buff[6];
|
2015-06-11 22:12:16 +00:00
|
|
|
|
2016-04-08 19:44:00 +00:00
|
|
|
am_content_count[media_type] = cmd_buff[4];
|
|
|
|
|
|
|
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
2016-09-18 00:38:01 +00:00
|
|
|
LOG_WARNING(Service_AM, "(STUBBED) media_type=%u, title_id=0x%016" PRIx64
|
|
|
|
", content_count=%u, content_ids_pointer=0x%08x",
|
|
|
|
media_type, title_id, am_content_count[media_type], content_ids_pointer);
|
2016-04-08 19:44:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetTitleList(Service::Interface* self) {
|
|
|
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
|
|
|
|
|
|
|
u32 media_type = cmd_buff[2] & 0xFF;
|
|
|
|
u32 title_ids_output_pointer = cmd_buff[4];
|
|
|
|
|
|
|
|
am_titles_list_count[media_type] = cmd_buff[1];
|
|
|
|
|
|
|
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
|
|
|
cmd_buff[2] = am_titles_list_count[media_type];
|
2016-09-18 00:38:01 +00:00
|
|
|
LOG_WARNING(
|
|
|
|
Service_AM,
|
|
|
|
"(STUBBED) media_type=%u, titles_list_count=0x%08X, title_ids_output_pointer=0x%08X",
|
|
|
|
media_type, am_titles_list_count[media_type], title_ids_output_pointer);
|
2016-04-08 19:44:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetTitleInfo(Service::Interface* self) {
|
|
|
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
|
|
|
|
|
|
|
u32 media_type = cmd_buff[1] & 0xFF;
|
|
|
|
u32 title_id_list_pointer = cmd_buff[4];
|
|
|
|
u32 title_list_pointer = cmd_buff[6];
|
|
|
|
|
|
|
|
am_titles_count[media_type] = cmd_buff[2];
|
|
|
|
|
|
|
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
2016-09-18 00:38:01 +00:00
|
|
|
LOG_WARNING(Service_AM, "(STUBBED) media_type=%u, total_titles=0x%08X, "
|
|
|
|
"title_id_list_pointer=0x%08X, title_list_pointer=0x%08X",
|
2016-04-08 19:44:00 +00:00
|
|
|
media_type, am_titles_count[media_type], title_id_list_pointer, title_list_pointer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GetDataTitleInfos(Service::Interface* self) {
|
|
|
|
GetTitleInfo(self);
|
|
|
|
|
|
|
|
LOG_WARNING(Service_AM, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
|
|
|
void ListDataTitleTicketInfos(Service::Interface* self) {
|
|
|
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
|
|
|
|
|
|
|
u64 title_id = (static_cast<u64>(cmd_buff[3]) << 32) | cmd_buff[2];
|
|
|
|
u32 start_index = cmd_buff[4];
|
|
|
|
u32 ticket_info_pointer = cmd_buff[6];
|
|
|
|
|
|
|
|
am_ticket_count = cmd_buff[1];
|
|
|
|
|
|
|
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
|
|
|
cmd_buff[2] = am_ticket_count;
|
2016-09-18 00:38:01 +00:00
|
|
|
LOG_WARNING(Service_AM, "(STUBBED) ticket_count=0x%08X, title_id=0x%016" PRIx64
|
|
|
|
", start_index=0x%08X, ticket_info_pointer=0x%08X",
|
|
|
|
am_ticket_count, title_id, start_index, ticket_info_pointer);
|
2015-06-11 22:12:16 +00:00
|
|
|
}
|
|
|
|
|
2015-07-21 05:12:13 +00:00
|
|
|
void GetNumContentInfos(Service::Interface* self) {
|
|
|
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
|
|
|
|
|
|
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
|
|
|
cmd_buff[2] = 1; // Number of content infos plus one
|
|
|
|
LOG_WARNING(Service_AM, "(STUBBED) called");
|
|
|
|
}
|
|
|
|
|
2016-04-08 19:44:00 +00:00
|
|
|
void DeleteTicket(Service::Interface* self) {
|
|
|
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
|
|
|
|
|
|
|
u64 title_id = (static_cast<u64>(cmd_buff[2]) << 32) | cmd_buff[1];
|
|
|
|
|
|
|
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
2016-09-18 00:38:01 +00:00
|
|
|
LOG_WARNING(Service_AM, "(STUBBED) called title_id=0x%016" PRIx64 "", title_id);
|
2016-04-08 19:44:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetTicketCount(Service::Interface* self) {
|
|
|
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
|
|
|
|
|
|
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
|
|
|
cmd_buff[2] = am_ticket_count;
|
2016-09-18 00:38:01 +00:00
|
|
|
LOG_WARNING(Service_AM, "(STUBBED) called ticket_count=0x%08x", am_ticket_count);
|
2016-04-08 19:44:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetTicketList(Service::Interface* self) {
|
|
|
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
|
|
|
|
|
|
|
u32 num_of_skip = cmd_buff[2];
|
|
|
|
u32 ticket_list_pointer = cmd_buff[4];
|
|
|
|
|
|
|
|
am_ticket_list_count = cmd_buff[1];
|
|
|
|
|
|
|
|
cmd_buff[1] = RESULT_SUCCESS.raw;
|
|
|
|
cmd_buff[2] = am_ticket_list_count;
|
2016-09-18 00:38:01 +00:00
|
|
|
LOG_WARNING(
|
|
|
|
Service_AM,
|
|
|
|
"(STUBBED) ticket_list_count=0x%08x, num_of_skip=0x%08x, ticket_list_pointer=0x%08x",
|
|
|
|
am_ticket_list_count, num_of_skip, ticket_list_pointer);
|
2016-04-08 19:44:00 +00:00
|
|
|
}
|
|
|
|
|
2015-06-11 22:12:16 +00:00
|
|
|
void Init() {
|
|
|
|
using namespace Kernel;
|
|
|
|
|
|
|
|
AddService(new AM_APP_Interface);
|
|
|
|
AddService(new AM_NET_Interface);
|
|
|
|
AddService(new AM_SYS_Interface);
|
2016-04-08 19:44:00 +00:00
|
|
|
AddService(new AM_U_Interface);
|
2015-06-11 22:12:16 +00:00
|
|
|
}
|
|
|
|
|
2016-09-19 01:01:46 +00:00
|
|
|
void Shutdown() {}
|
2015-06-11 22:12:16 +00:00
|
|
|
|
|
|
|
} // namespace AM
|
|
|
|
|
|
|
|
} // namespace Service
|