From db75b80e22522bafb6978e338d1dce7b6ce5d698 Mon Sep 17 00:00:00 2001 From: NarcolepticK Date: Fri, 29 Jun 2018 04:14:49 -0400 Subject: [PATCH] service/mvd: Migrate to ServiceFramework (#3890) * service/mvd: Migrate to ServiceFramework * service/mvd: Silenced clang format --- src/core/hle/service/mvd/mvd.cpp | 5 ++-- src/core/hle/service/mvd/mvd.h | 4 ++- src/core/hle/service/mvd/mvd_std.cpp | 39 ++++++++++++++-------------- src/core/hle/service/mvd/mvd_std.h | 7 ++--- src/core/hle/service/service.cpp | 2 +- 5 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/core/hle/service/mvd/mvd.cpp b/src/core/hle/service/mvd/mvd.cpp index 9416fe5d6..38096904a 100644 --- a/src/core/hle/service/mvd/mvd.cpp +++ b/src/core/hle/service/mvd/mvd.cpp @@ -4,13 +4,12 @@ #include "core/hle/service/mvd/mvd.h" #include "core/hle/service/mvd/mvd_std.h" -#include "core/hle/service/service.h" namespace Service { namespace MVD { -void Init() { - AddService(new MVD_STD()); +void InstallInterfaces(SM::ServiceManager& service_manager) { + std::make_shared()->InstallAsService(service_manager); } } // namespace MVD diff --git a/src/core/hle/service/mvd/mvd.h b/src/core/hle/service/mvd/mvd.h index 7b212e839..b50e243cd 100644 --- a/src/core/hle/service/mvd/mvd.h +++ b/src/core/hle/service/mvd/mvd.h @@ -4,11 +4,13 @@ #pragma once +#include "core/hle/service/service.h" + namespace Service { namespace MVD { /// Initializes all MVD services. -void Init(); +void InstallInterfaces(SM::ServiceManager& service_manager); } // namespace MVD } // namespace Service diff --git a/src/core/hle/service/mvd/mvd_std.cpp b/src/core/hle/service/mvd/mvd_std.cpp index fd7ca87d3..09a8953a3 100644 --- a/src/core/hle/service/mvd/mvd_std.cpp +++ b/src/core/hle/service/mvd/mvd_std.cpp @@ -2,31 +2,32 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/ipc_helpers.h" #include "core/hle/service/mvd/mvd_std.h" namespace Service { namespace MVD { -const Interface::FunctionInfo FunctionTable[] = { - // clang-format off - {0x00010082, nullptr, "Initialize"}, - {0x00020000, nullptr, "Shutdown"}, - {0x00030300, nullptr, "CalculateWorkBufSize"}, - {0x000400C0, nullptr, "CalculateImageSize"}, - {0x00080142, nullptr, "ProcessNALUnit"}, - {0x00090042, nullptr, "ControlFrameRendering"}, - {0x000A0000, nullptr, "GetStatus"}, - {0x000B0000, nullptr, "GetStatusOther"}, - {0x001D0042, nullptr, "GetConfig"}, - {0x001E0044, nullptr, "SetConfig"}, - {0x001F0902, nullptr, "SetOutputBuffer"}, - {0x00210100, nullptr, "OverrideOutputBuffers"} - // clang-format on -}; +MVD_STD::MVD_STD() : ServiceFramework("mvd:std", 1) { + static const FunctionInfo functions[] = { + // clang-format off + {0x00010082, nullptr, "Initialize"}, + {0x00020000, nullptr, "Shutdown"}, + {0x00030300, nullptr, "CalculateWorkBufSize"}, + {0x000400C0, nullptr, "CalculateImageSize"}, + {0x00080142, nullptr, "ProcessNALUnit"}, + {0x00090042, nullptr, "ControlFrameRendering"}, + {0x000A0000, nullptr, "GetStatus"}, + {0x000B0000, nullptr, "GetStatusOther"}, + {0x001D0042, nullptr, "GetConfig"}, + {0x001E0044, nullptr, "SetConfig"}, + {0x001F0902, nullptr, "SetOutputBuffer"}, + {0x00210100, nullptr, "OverrideOutputBuffers"} + // clang-format on + }; -MVD_STD::MVD_STD() { - Register(FunctionTable); -} + RegisterHandlers(functions); +}; } // namespace MVD } // namespace Service diff --git a/src/core/hle/service/mvd/mvd_std.h b/src/core/hle/service/mvd/mvd_std.h index 7db9e2e50..02a1b46b1 100644 --- a/src/core/hle/service/mvd/mvd_std.h +++ b/src/core/hle/service/mvd/mvd_std.h @@ -9,13 +9,10 @@ namespace Service { namespace MVD { -class MVD_STD final : public Interface { +class MVD_STD final : public ServiceFramework { public: MVD_STD(); - - std::string GetPortName() const override { - return "mvd:std"; - } + ~MVD_STD() = default; }; } // namespace MVD diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index b5f96602f..a1541cffc 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -247,7 +247,7 @@ void Init(std::shared_ptr& sm) { GSP::InstallInterfaces(*sm); HID::InstallInterfaces(*sm); IR::InstallInterfaces(*sm); - MVD::Init(); + MVD::InstallInterfaces(*sm); NDM::InstallInterfaces(*sm); NEWS::InstallInterfaces(*sm); NFC::InstallInterfaces(*sm);