hle: Stub some service calls used by the home menu. (#6675)

This commit is contained in:
Steveice10 2023-07-07 22:05:38 -07:00 committed by GitHub
parent 26e3f96983
commit 662bb9ba77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 187 additions and 22 deletions

View file

@ -10,6 +10,13 @@ SERIALIZE_EXPORT_IMPL(Service::NEWS::NEWS_S)
namespace Service::NEWS {
struct NewsDbHeader {
u8 unknown_one;
u8 flags;
INSERT_PADDING_BYTES(0xE);
};
static_assert(sizeof(NewsDbHeader) == 0x10, "News DB Header structure size is wrong");
void NEWS_S::GetTotalNotifications(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x5, 0, 0);
@ -21,6 +28,22 @@ void NEWS_S::GetTotalNotifications(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(0);
}
void NEWS_S::GetNewsDBHeader(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0xA, 1, 2);
const auto size = rp.Pop<u32>();
auto output_buffer = rp.PopMappedBuffer();
LOG_WARNING(Service, "(STUBBED) called size={}", size);
NewsDbHeader dummy = {.unknown_one = 1, .flags = 0};
output_buffer.Write(&dummy, 0, std::min(sizeof(NewsDbHeader), static_cast<std::size_t>(size)));
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);
rb.Push<u32>(size);
}
NEWS_S::NEWS_S() : ServiceFramework("news:s", 2) {
const FunctionInfo functions[] = {
// clang-format off
@ -30,7 +53,7 @@ NEWS_S::NEWS_S() : ServiceFramework("news:s", 2) {
{IPC::MakeHeader(0x0007, 2, 2), nullptr, "SetNotificationHeader"},
{IPC::MakeHeader(0x0008, 2, 2), nullptr, "SetNotificationMessage"},
{IPC::MakeHeader(0x0009, 2, 2), nullptr, "SetNotificationImage"},
{IPC::MakeHeader(0x000A, 1, 2), nullptr, "GetNewsDBHeader"},
{IPC::MakeHeader(0x000A, 1, 2), &NEWS_S::GetNewsDBHeader, "GetNewsDBHeader"},
{IPC::MakeHeader(0x000B, 2, 2), nullptr, "GetNotificationHeader"},
{IPC::MakeHeader(0x000C, 2, 2), nullptr, "GetNotificationMessage"},
{IPC::MakeHeader(0x000D, 2, 2), nullptr, "GetNotificationImage"},

View file

@ -25,6 +25,20 @@ private:
*/
void GetTotalNotifications(Kernel::HLERequestContext& ctx);
/**
* GetNewsDBHeader service function.
* Inputs:
* 0 : 0x000A0042
* 1 : Size
* 2 : Output Buffer Mapping Translation Header ((Size << 4) | 0xC)
* 3 : Output Buffer Pointer
* Outputs:
* 0 : 0x000A0080
* 1 : Result of function, 0 on success, otherwise error code
* 2 : Actual Size
*/
void GetNewsDBHeader(Kernel::HLERequestContext& ctx);
SERVICE_SERIALIZATION_SIMPLE
};