mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-27 12:04:16 +01:00
Service/NEWS: convert to ServiceFramework
This commit is contained in:
parent
3566987ecc
commit
61069d2b67
@ -3,7 +3,6 @@
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "common/logging/log.h"
|
||||
#include "core/hle/service/news/news.h"
|
||||
#include "core/hle/service/news/news_s.h"
|
||||
#include "core/hle/service/news/news_u.h"
|
||||
#include "core/hle/service/service.h"
|
||||
@ -11,15 +10,11 @@
|
||||
namespace Service {
|
||||
namespace NEWS {
|
||||
|
||||
void Init() {
|
||||
using namespace Kernel;
|
||||
|
||||
AddService(new NEWS_S_Interface);
|
||||
AddService(new NEWS_U_Interface);
|
||||
void InstallInterfaces(SM::ServiceManager& service_manager) {
|
||||
std::make_shared<NEWS_S>()->InstallAsService(service_manager);
|
||||
std::make_shared<NEWS_U>()->InstallAsService(service_manager);
|
||||
}
|
||||
|
||||
void Shutdown() {}
|
||||
|
||||
} // namespace NEWS
|
||||
|
||||
} // namespace Service
|
||||
|
@ -7,11 +7,7 @@
|
||||
namespace Service {
|
||||
namespace NEWS {
|
||||
|
||||
/// Initialize NEWS service(s)
|
||||
void Init();
|
||||
|
||||
/// Shutdown NEWS service(s)
|
||||
void Shutdown();
|
||||
void InstallInterfaces(SM::ServiceManager& service_manager);
|
||||
|
||||
} // namespace NEWS
|
||||
} // namespace Service
|
||||
|
@ -3,23 +3,13 @@
|
||||
// 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);
|
||||
void NEWS_S::GetTotalNotifications(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x5, 0, 0);
|
||||
|
||||
LOG_WARNING(Service, "(STUBBED) called");
|
||||
|
||||
@ -29,24 +19,23 @@ static void GetTotalNotifications(Service::Interface* self) {
|
||||
rb.Push<u32>(0);
|
||||
}
|
||||
|
||||
const Interface::FunctionInfo FunctionTable[] = {
|
||||
{0x000100C6, nullptr, "AddNotification"},
|
||||
{0x00050000, GetTotalNotifications, "GetTotalNotifications"},
|
||||
{0x00060042, nullptr, "SetNewsDBHeader"},
|
||||
{0x00070082, nullptr, "SetNotificationHeader"},
|
||||
{0x00080082, nullptr, "SetNotificationMessage"},
|
||||
{0x00090082, nullptr, "SetNotificationImage"},
|
||||
{0x000A0042, nullptr, "GetNewsDBHeader"},
|
||||
{0x000B0082, nullptr, "GetNotificationHeader"},
|
||||
{0x000C0082, nullptr, "GetNotificationMessage"},
|
||||
{0x000D0082, nullptr, "GetNotificationImage"},
|
||||
{0x000E0040, nullptr, "SetInfoLEDPattern"},
|
||||
{0x00120082, nullptr, "GetNotificationHeaderOther"},
|
||||
{0x00130000, nullptr, "WriteNewsDBSavedata"},
|
||||
};
|
||||
|
||||
NEWS_S_Interface::NEWS_S_Interface() {
|
||||
Register(FunctionTable);
|
||||
NEWS_S::NEWS_S() : ServiceFramework("news:s", 2) {
|
||||
const FunctionInfo functions[] = {
|
||||
{0x000100C6, nullptr, "AddNotification"},
|
||||
{0x00050000, &NEWS_S::GetTotalNotifications, "GetTotalNotifications"},
|
||||
{0x00060042, nullptr, "SetNewsDBHeader"},
|
||||
{0x00070082, nullptr, "SetNotificationHeader"},
|
||||
{0x00080082, nullptr, "SetNotificationMessage"},
|
||||
{0x00090082, nullptr, "SetNotificationImage"},
|
||||
{0x000A0042, nullptr, "GetNewsDBHeader"},
|
||||
{0x000B0082, nullptr, "GetNotificationHeader"},
|
||||
{0x000C0082, nullptr, "GetNotificationMessage"},
|
||||
{0x000D0082, nullptr, "GetNotificationImage"},
|
||||
{0x000E0040, nullptr, "SetInfoLEDPattern"},
|
||||
{0x00120082, nullptr, "GetNotificationHeaderOther"},
|
||||
{0x00130000, nullptr, "WriteNewsDBSavedata"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
} // namespace NEWS
|
||||
|
@ -4,18 +4,27 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Service {
|
||||
namespace NEWS {
|
||||
|
||||
class NEWS_S_Interface : public Service::Interface {
|
||||
class NEWS_S final : public ServiceFramework<NEWS_S> {
|
||||
public:
|
||||
NEWS_S_Interface();
|
||||
NEWS_S();
|
||||
|
||||
std::string GetPortName() const override {
|
||||
return "news:s";
|
||||
}
|
||||
private:
|
||||
/**
|
||||
* GetTotalNotifications service function.
|
||||
* Inputs:
|
||||
* 0 : 0x00050000
|
||||
* Outputs:
|
||||
* 0 : 0x00050080
|
||||
* 1 : Result of function, 0 on success, otherwise error code
|
||||
* 2 : Number of notifications
|
||||
*/
|
||||
void GetTotalNotifications(Kernel::HLERequestContext& ctx);
|
||||
};
|
||||
|
||||
} // namespace NEWS
|
||||
|
@ -7,12 +7,11 @@
|
||||
namespace Service {
|
||||
namespace NEWS {
|
||||
|
||||
const Interface::FunctionInfo FunctionTable[] = {
|
||||
{0x000100C8, nullptr, "AddNotification"},
|
||||
};
|
||||
|
||||
NEWS_U_Interface::NEWS_U_Interface() {
|
||||
Register(FunctionTable);
|
||||
NEWS_U::NEWS_U() : ServiceFramework("news:u", 1) {
|
||||
const FunctionInfo functions[] = {
|
||||
{0x000100C8, nullptr, "AddNotification"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
} // namespace NEWS
|
||||
|
@ -4,18 +4,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Service {
|
||||
namespace NEWS {
|
||||
|
||||
class NEWS_U_Interface : public Service::Interface {
|
||||
class NEWS_U final : public ServiceFramework<NEWS_U> {
|
||||
public:
|
||||
NEWS_U_Interface();
|
||||
|
||||
std::string GetPortName() const override {
|
||||
return "news:u";
|
||||
}
|
||||
NEWS_U();
|
||||
};
|
||||
|
||||
} // namespace NEWS
|
||||
|
@ -250,7 +250,7 @@ void Init() {
|
||||
IR::InstallInterfaces(*SM::g_service_manager);
|
||||
MVD::Init();
|
||||
NDM::Init();
|
||||
NEWS::Init();
|
||||
NEWS::InstallInterfaces(*SM::g_service_manager);
|
||||
NFC::Init();
|
||||
NIM::InstallInterfaces(*SM::g_service_manager);
|
||||
NWM::Init();
|
||||
@ -272,7 +272,6 @@ void Init() {
|
||||
/// Shutdown ServiceManager
|
||||
void Shutdown() {
|
||||
NFC::Shutdown();
|
||||
NEWS::Shutdown();
|
||||
NDM::Shutdown();
|
||||
FRD::Shutdown();
|
||||
DLP::Shutdown();
|
||||
|
Loading…
Reference in New Issue
Block a user