From dd0bd5520db7632a9cb709b93a26aed711f11daf Mon Sep 17 00:00:00 2001 From: Subv <subv2112@gmail.com> Date: Sat, 9 Dec 2017 11:28:57 -0500 Subject: [PATCH] HLE/News: Stubbed GetTotalNotifications to always return 0 notifications. This prevents an invalid read loop on games that call it. --- src/core/hle/service/news/news_s.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/news/news_s.cpp b/src/core/hle/service/news/news_s.cpp index dda3d0f6a..64f8d1b79 100644 --- a/src/core/hle/service/news/news_s.cpp +++ b/src/core/hle/service/news/news_s.cpp @@ -2,15 +2,36 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/ipc_helpers.h" #include "core/hle/service/news/news.h" #include "core/hle/service/news/news_s.h" namespace Service { namespace NEWS { +/** + * GetTotalNotifications service function. + * Inputs: + * 0 : 0x00050000 + * Outputs: + * 0 : 0x00050080 + * 1 : Result of function, 0 on success, otherwise error code + * 2 : Number of notifications + */ +static void GetTotalNotifications(Service::Interface* self) { + IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x5, 0, 0); + + LOG_WARNING(Service, "(STUBBED) called"); + + IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); + + rb.Push(RESULT_SUCCESS); + rb.Push<u32>(0); +} + const Interface::FunctionInfo FunctionTable[] = { {0x000100C6, nullptr, "AddNotification"}, - {0x00050000, nullptr, "GetTotalNotifications"}, + {0x00050000, GetTotalNotifications, "GetTotalNotifications"}, {0x00060042, nullptr, "SetNewsDBHeader"}, {0x00070082, nullptr, "SetNotificationHeader"}, {0x00080082, nullptr, "SetNotificationMessage"},