service/qtm: Migrate to ServiceFramework (#3892)

* service/qtm: Migrate to ServiceFramework

* service/qtm: Fix clang format
This commit is contained in:
NarcolepticK 2018-06-29 04:13:56 -04:00 committed by Weiyi Wang
parent 9ae70e733f
commit 3e42b361b1
12 changed files with 91 additions and 49 deletions

View file

@ -342,6 +342,8 @@ add_library(core STATIC
hle/service/pxi/pxi.h
hle/service/qtm/qtm.cpp
hle/service/qtm/qtm.h
hle/service/qtm/qtm_c.cpp
hle/service/qtm/qtm_c.h
hle/service/qtm/qtm_s.cpp
hle/service/qtm/qtm_s.h
hle/service/qtm/qtm_sp.cpp

View file

@ -3,18 +3,19 @@
// Refer to the license.txt file included.
#include "core/hle/service/qtm/qtm.h"
#include "core/hle/service/qtm/qtm_c.h"
#include "core/hle/service/qtm/qtm_s.h"
#include "core/hle/service/qtm/qtm_sp.h"
#include "core/hle/service/qtm/qtm_u.h"
#include "core/hle/service/service.h"
namespace Service {
namespace QTM {
void Init() {
AddService(new QTM_S());
AddService(new QTM_SP());
AddService(new QTM_U());
void InstallInterfaces(SM::ServiceManager& service_manager) {
std::make_shared<QTM_C>()->InstallAsService(service_manager);
std::make_shared<QTM_S>()->InstallAsService(service_manager);
std::make_shared<QTM_SP>()->InstallAsService(service_manager);
std::make_shared<QTM_U>()->InstallAsService(service_manager);
}
} // namespace QTM

View file

@ -4,11 +4,13 @@
#pragma once
#include "core/hle/service/service.h"
namespace Service {
namespace QTM {
/// Initializes all QTM services.
void Init();
void InstallInterfaces(SM::ServiceManager& service_manager);
} // namespace QTM
} // namespace Service

View file

@ -0,0 +1,24 @@
// Copyright 2016 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/ipc_helpers.h"
#include "core/hle/service/qtm/qtm_c.h"
namespace Service {
namespace QTM {
QTM_C::QTM_C() : ServiceFramework("qtm:c", 2) {
static const FunctionInfo functions[] = {
// clang-format off
// qtm calibration commands
{0x00010000, nullptr, "InitializeHardwareCheck"},
{0x00050040, nullptr, "SetIrLedCheck"},
// clang-format on
};
RegisterHandlers(functions);
};
} // namespace QTM
} // namespace Service

View file

@ -0,0 +1,19 @@
// Copyright 2016 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include "core/hle/service/service.h"
namespace Service {
namespace QTM {
class QTM_C final : public ServiceFramework<QTM_C> {
public:
QTM_C();
~QTM_C() = default;
};
} // namespace QTM
} // namespace Service

View file

@ -2,21 +2,22 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/ipc_helpers.h"
#include "core/hle/service/qtm/qtm_s.h"
namespace Service {
namespace QTM {
const Interface::FunctionInfo FunctionTable[] = {
QTM_S::QTM_S() : ServiceFramework("qtm:s", 2) {
static const FunctionInfo functions[] = {
// clang-format off
// qtm common commands
{0x00010080, nullptr, "GetHeadtrackingInfoRaw"},
{0x00020080, nullptr, "GetHeadtrackingInfo"},
// clang-format on
};
};
QTM_S::QTM_S() {
Register(FunctionTable);
RegisterHandlers(functions);
}
} // namespace QTM

View file

@ -9,13 +9,10 @@
namespace Service {
namespace QTM {
class QTM_S final : public Interface {
class QTM_S final : public ServiceFramework<QTM_S> {
public:
QTM_S();
std::string GetPortName() const override {
return "qtm:s";
}
~QTM_S() = default;
};
} // namespace QTM

View file

@ -2,21 +2,22 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/ipc_helpers.h"
#include "core/hle/service/qtm/qtm_sp.h"
namespace Service {
namespace QTM {
const Interface::FunctionInfo FunctionTable[] = {
QTM_SP::QTM_SP() : ServiceFramework("qtm:sp", 2) {
static const FunctionInfo functions[] = {
// clang-format off
// qtm common commands
{0x00010080, nullptr, "GetHeadtrackingInfoRaw"},
{0x00020080, nullptr, "GetHeadtrackingInfo"},
// clang-format on
};
};
QTM_SP::QTM_SP() {
Register(FunctionTable);
RegisterHandlers(functions);
}
} // namespace QTM

View file

@ -9,13 +9,10 @@
namespace Service {
namespace QTM {
class QTM_SP final : public Interface {
class QTM_SP final : public ServiceFramework<QTM_SP> {
public:
QTM_SP();
std::string GetPortName() const override {
return "qtm:sp";
}
~QTM_SP() = default;
};
} // namespace QTM

View file

@ -2,21 +2,22 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/ipc_helpers.h"
#include "core/hle/service/qtm/qtm_u.h"
namespace Service {
namespace QTM {
const Interface::FunctionInfo FunctionTable[] = {
QTM_U::QTM_U() : ServiceFramework("qtm:u", 2) {
static const FunctionInfo functions[] = {
// clang-format off
// qtm common commands
{0x00010080, nullptr, "GetHeadtrackingInfoRaw"},
{0x00020080, nullptr, "GetHeadtrackingInfo"},
// clang-format on
};
};
QTM_U::QTM_U() {
Register(FunctionTable);
RegisterHandlers(functions);
}
} // namespace QTM

View file

@ -9,13 +9,10 @@
namespace Service {
namespace QTM {
class QTM_U final : public Interface {
class QTM_U final : public ServiceFramework<QTM_U> {
public:
QTM_U();
std::string GetPortName() const override {
return "qtm:u";
}
~QTM_U() = default;
};
} // namespace QTM

View file

@ -254,7 +254,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) {
NIM::InstallInterfaces(*sm);
NWM::Init();
PTM::InstallInterfaces(*sm);
QTM::Init();
QTM::InstallInterfaces(*sm);
AddService(new CSND::CSND_SND);
AddService(new DSP_DSP::Interface);