citra-emu
/
citra-canary
Archived
1
0
Fork 0

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/pxi/pxi.h
hle/service/qtm/qtm.cpp hle/service/qtm/qtm.cpp
hle/service/qtm/qtm.h 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.cpp
hle/service/qtm/qtm_s.h hle/service/qtm/qtm_s.h
hle/service/qtm/qtm_sp.cpp hle/service/qtm/qtm_sp.cpp

View File

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

View File

@ -4,11 +4,13 @@
#pragma once #pragma once
#include "core/hle/service/service.h"
namespace Service { namespace Service {
namespace QTM { namespace QTM {
/// Initializes all QTM services. /// Initializes all QTM services.
void Init(); void InstallInterfaces(SM::ServiceManager& service_manager);
} // namespace QTM } // namespace QTM
} // namespace Service } // 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 // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "core/hle/ipc_helpers.h"
#include "core/hle/service/qtm/qtm_s.h" #include "core/hle/service/qtm/qtm_s.h"
namespace Service { namespace Service {
namespace QTM { namespace QTM {
const Interface::FunctionInfo FunctionTable[] = { QTM_S::QTM_S() : ServiceFramework("qtm:s", 2) {
// clang-format off static const FunctionInfo functions[] = {
// qtm common commands // clang-format off
{0x00010080, nullptr, "GetHeadtrackingInfoRaw"}, // qtm common commands
{0x00020080, nullptr, "GetHeadtrackingInfo"}, {0x00010080, nullptr, "GetHeadtrackingInfoRaw"},
// clang-format on {0x00020080, nullptr, "GetHeadtrackingInfo"},
}; // clang-format on
};
QTM_S::QTM_S() { RegisterHandlers(functions);
Register(FunctionTable);
} }
} // namespace QTM } // namespace QTM

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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