Skip to content
Snippets Groups Projects
Commit 5d6bf752 authored by Zach Hilman's avatar Zach Hilman
Browse files

es: Implement ETicket ListCommonTicket (11)

Returns an application specified count of entries of common tickets, starting at offset 0.
parent 11f45e60
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,7 @@ public: ...@@ -26,7 +26,7 @@ public:
{8, &ETicket::GetTitleKey, "GetTitleKey"}, {8, &ETicket::GetTitleKey, "GetTitleKey"},
{9, &ETicket::CountCommonTicket, "CountCommonTicket"}, {9, &ETicket::CountCommonTicket, "CountCommonTicket"},
{10, &ETicket::CountPersonalizedTicket, "CountPersonalizedTicket"}, {10, &ETicket::CountPersonalizedTicket, "CountPersonalizedTicket"},
{11, nullptr, "ListCommonTicket"}, {11, &ETicket::ListCommonTicket, "ListCommonTicket"},
{12, nullptr, "ListPersonalizedTicket"}, {12, nullptr, "ListPersonalizedTicket"},
{13, nullptr, "ListMissingPersonalizedTicket"}, {13, nullptr, "ListMissingPersonalizedTicket"},
{14, nullptr, "GetCommonTicketSize"}, {14, nullptr, "GetCommonTicketSize"},
...@@ -144,6 +144,29 @@ private: ...@@ -144,6 +144,29 @@ private:
rb.Push<u32>(count); rb.Push<u32>(count);
} }
void ListCommonTicket(Kernel::HLERequestContext& ctx) {
u32 out_entries;
if (keys.GetCommonTickets().empty())
out_entries = 0;
else
out_entries = ctx.GetWriteBufferSize() / sizeof(u128);
LOG_DEBUG(Service_ETicket, "called, entries={:016X}", out_entries);
keys.PopulateTickets();
const auto tickets = keys.GetCommonTickets();
std::vector<u128> ids;
std::transform(tickets.begin(), tickets.end(), std::back_inserter(ids),
[](const auto& pair) { return pair.first; });
out_entries = std::min<u32>(ids.size(), out_entries);
ctx.WriteBuffer(ids.data(), out_entries * sizeof(u128));
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push<u32>(out_entries);
}
}; };
void InstallInterfaces(SM::ServiceManager& service_manager) { void InstallInterfaces(SM::ServiceManager& service_manager) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment