Make Steamworks a plugin

This commit is contained in:
Atlante45 2016-12-14 14:43:46 -08:00
parent 1829f540cf
commit 0dec97fc03
18 changed files with 290 additions and 151 deletions

View file

@ -175,10 +175,6 @@ if (WIN32)
set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG "/OPT:NOREF /OPT:NOICF")
endif()
if (NOT ANDROID)
set(NON_ANDROID_LIBRARIES steamworks-wrapper)
endif ()
# link required hifi libraries
link_hifi_libraries(
shared octree gpu gl gpu-gl procedural model render

View file

@ -90,9 +90,10 @@
#include <PerfStat.h>
#include <PhysicsEngine.h>
#include <PhysicsHelpers.h>
#include <plugins/CodecPlugin.h>
#include <plugins/PluginManager.h>
#include <plugins/PluginUtils.h>
#include <plugins/CodecPlugin.h>
#include <plugins/SteamClientPlugin.h>
#include <RecordingScriptingInterface.h>
#include <RenderableWebEntityItem.h>
#include <RenderShadowTask.h>
@ -103,7 +104,6 @@
#include <ScriptEngines.h>
#include <ScriptCache.h>
#include <SoundCache.h>
#include <steamworks-wrapper/SteamClient.h>
#include <Tooltip.h>
#include <udt/PacketHeaders.h>
#include <UserActivityLogger.h>
@ -421,6 +421,10 @@ bool setupEssentials(int& argc, char** argv) {
Setting::preInit();
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->init();
}
#if defined(Q_OS_WIN)
// Select appropriate audio DLL
QString audioDLLPath = QCoreApplication::applicationDirPath();
@ -551,7 +555,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
_maxOctreePPS(maxOctreePacketsPerSecond.get()),
_lastFaceTrackerUpdate(0)
{
setProperty(hifi::properties::STEAM, SteamClient::isRunning());
auto steamClient = PluginManager::getInstance()->getSteamClientPlugin();
setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning()));
setProperty(hifi::properties::CRASHED, _previousSessionCrashed);
{
@ -606,7 +611,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
_deadlockWatchdogThread = new DeadlockWatchdogThread();
_deadlockWatchdogThread->start();
qCDebug(interfaceapp) << "[VERSION] SteamVR buildID:" << SteamClient::getSteamVRBuildID();
if (steamClient) {
qCDebug(interfaceapp) << "[VERSION] SteamVR buildID:" << steamClient->getSteamVRBuildID();
}
qCDebug(interfaceapp) << "[VERSION] Build sequence:" << qPrintable(applicationVersion());
qCDebug(interfaceapp) << "[VERSION] MODIFIED_ORGANIZATION:" << BuildInfo::MODIFIED_ORGANIZATION;
qCDebug(interfaceapp) << "[VERSION] VERSION:" << BuildInfo::VERSION;
@ -1695,6 +1702,10 @@ Application::~Application() {
Leapmotion::destroy();
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->shutdown();
}
#if 0
ConnexionClient::getInstance().destroy();
#endif
@ -1874,8 +1885,10 @@ void Application::initializeUi() {
rootContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
rootContext->setContextProperty("Steam", new SteamScriptingInterface(engine));
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
rootContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));
}
_glWidget->installEventFilter(offscreenUi.data());
offscreenUi->setMouseTranslator([=](const QPointF& pt) {
@ -3201,7 +3214,9 @@ void Application::idle(float nsecsElapsed) {
PROFILE_RANGE(__FUNCTION__);
SteamClient::runCallbacks();
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->runCallbacks();
}
float secondsSinceLastUpdate = nsecsElapsed / NSECS_PER_MSEC / MSECS_PER_SECOND;
@ -3533,12 +3548,16 @@ void Application::init() {
_timerStart.start();
_lastTimeUpdated.start();
// when +connect_lobby in command line, join steam lobby
const QString STEAM_LOBBY_COMMAND_LINE_KEY = "+connect_lobby";
int lobbyIndex = arguments().indexOf(STEAM_LOBBY_COMMAND_LINE_KEY);
if (lobbyIndex != -1) {
QString lobbyId = arguments().value(lobbyIndex + 1);
SteamClient::joinLobby(lobbyId);
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
// when +connect_lobby in command line, join steam lobby
const QString STEAM_LOBBY_COMMAND_LINE_KEY = "+connect_lobby";
int lobbyIndex = arguments().indexOf(STEAM_LOBBY_COMMAND_LINE_KEY);
if (lobbyIndex != -1) {
QString lobbyId = arguments().value(lobbyIndex + 1);
steamClient->joinLobby(lobbyId);
}
}
@ -5193,8 +5212,9 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
scriptEngine->registerGlobalObject("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
scriptEngine->registerGlobalObject("Users", DependencyManager::get<UsersScriptingInterface>().data());
scriptEngine->registerGlobalObject("Steam", new SteamScriptingInterface(scriptEngine));
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
scriptEngine->registerGlobalObject("Steam", new SteamScriptingInterface(scriptEngine, steamClient.get()));
}
auto scriptingInterface = DependencyManager::get<controller::ScriptingInterface>();
scriptEngine->registerGlobalObject("Controller", scriptingInterface.data());
UserInputMapper::registerControllerTypes(scriptEngine);

View file

@ -15,7 +15,8 @@
#include <AddressManager.h>
#include <DomainHandler.h>
#include <NodeList.h>
#include <steamworks-wrapper/SteamClient.h>
#include <plugins/PluginManager.h>
#include <plugins/SteamClientPlugin.h>
#include <UserActivityLogger.h>
#include <UUID.h>
@ -111,7 +112,9 @@ void DiscoverabilityManager::updateLocation() {
}
// Update Steam
SteamClient::updateLocation(domainHandler.getHostname(), addressManager->currentFacingShareableAddress());
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->updateLocation(domainHandler.getHostname(), addressManager->currentFacingShareableAddress());
}
}
void DiscoverabilityManager::handleHeartbeatResponse(QNetworkReply& requestReply) {

View file

@ -22,7 +22,6 @@
#include <gl/OpenGLVersionChecker.h>
#include <SharedUtil.h>
#include <steamworks-wrapper/SteamClient.h>
#include "AddressManager.h"
#include "Application.h"
@ -129,8 +128,10 @@ int main(int argc, const char* argv[]) {
}
QCommandLineParser parser;
QCommandLineOption checkMinSpecOption("checkMinSpec", "Check machine has minimum specifications");
QCommandLineOption runServerOption("runServer", "Whether to run the server");
QCommandLineOption serverContentPathOption("serverContentPath", "Where to find server content", "serverContentPath");
parser.addOption(checkMinSpecOption);
parser.addOption(runServerOption);
parser.addOption(serverContentPathOption);
parser.parse(arguments);
@ -157,11 +158,9 @@ int main(int argc, const char* argv[]) {
// or in the main window ctor, before GL startup.
Application::initPlugins(arguments);
SteamClient::init();
#ifdef Q_OS_WIN
// If we're running in steam mode, we need to do an explicit check to ensure we're up to the required min spec
if (SteamClient::isRunning()) {
if (parser.isSet(checkMinSpecOption)) {
QString appPath;
{
char filename[MAX_PATH];
@ -245,8 +244,6 @@ int main(int argc, const char* argv[]) {
Application::shutdownPlugins();
SteamClient::shutdown();
qCDebug(interfaceapp, "Normal exit.");
#if !defined(DEBUG) && !defined(Q_OS_LINUX)
// HACK: exit immediately (don't handle shutdown callbacks) for Release build

View file

@ -17,7 +17,8 @@
#include <QtNetwork/QNetworkReply>
#include <NetworkingConstants.h>
#include <steamworks-wrapper/SteamClient.h>
#include <plugins/PluginManager.h>
#include <plugins/SteamClientPlugin.h>
#include "AccountManager.h"
#include "DependencyManager.h"
@ -56,7 +57,8 @@ void LoginDialog::toggleAction() {
}
bool LoginDialog::isSteamRunning() const {
return SteamClient::isRunning();
auto steamClient = PluginManager::getInstance()->getSteamClientPlugin();
return steamClient && steamClient->isRunning();
}
void LoginDialog::login(const QString& username, const QString& password) const {
@ -66,69 +68,75 @@ void LoginDialog::login(const QString& username, const QString& password) const
void LoginDialog::loginThroughSteam() {
qDebug() << "Attempting to login through Steam";
SteamClient::requestTicket([this](Ticket ticket) {
if (ticket.isNull()) {
emit handleLoginFailed();
return;
}
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->requestTicket([this](Ticket ticket) {
if (ticket.isNull()) {
emit handleLoginFailed();
return;
}
DependencyManager::get<AccountManager>()->requestAccessTokenWithSteam(ticket);
});
DependencyManager::get<AccountManager>()->requestAccessTokenWithSteam(ticket);
});
}
}
void LoginDialog::linkSteam() {
qDebug() << "Attempting to link Steam account";
SteamClient::requestTicket([this](Ticket ticket) {
if (ticket.isNull()) {
emit handleLoginFailed();
return;
}
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->requestTicket([this](Ticket ticket) {
if (ticket.isNull()) {
emit handleLoginFailed();
return;
}
JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this;
callbackParams.jsonCallbackMethod = "linkCompleted";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "linkFailed";
JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this;
callbackParams.jsonCallbackMethod = "linkCompleted";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "linkFailed";
const QString LINK_STEAM_PATH = "api/v1/user/steam/link";
const QString LINK_STEAM_PATH = "api/v1/user/steam/link";
QJsonObject payload;
payload.insert("steam_auth_ticket", QJsonValue::fromVariant(QVariant(ticket)));
QJsonObject payload;
payload.insert("steam_auth_ticket", QJsonValue::fromVariant(QVariant(ticket)));
auto accountManager = DependencyManager::get<AccountManager>();
accountManager->sendRequest(LINK_STEAM_PATH, AccountManagerAuth::Required,
QNetworkAccessManager::PostOperation, callbackParams,
QJsonDocument(payload).toJson());
});
auto accountManager = DependencyManager::get<AccountManager>();
accountManager->sendRequest(LINK_STEAM_PATH, AccountManagerAuth::Required,
QNetworkAccessManager::PostOperation, callbackParams,
QJsonDocument(payload).toJson());
});
}
}
void LoginDialog::createAccountFromStream(QString username) {
qDebug() << "Attempting to create account from Steam info";
SteamClient::requestTicket([this, username](Ticket ticket) {
if (ticket.isNull()) {
emit handleLoginFailed();
return;
}
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
steamClient->requestTicket([this, username](Ticket ticket) {
if (ticket.isNull()) {
emit handleLoginFailed();
return;
}
JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this;
callbackParams.jsonCallbackMethod = "createCompleted";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "createFailed";
JSONCallbackParameters callbackParams;
callbackParams.jsonCallbackReceiver = this;
callbackParams.jsonCallbackMethod = "createCompleted";
callbackParams.errorCallbackReceiver = this;
callbackParams.errorCallbackMethod = "createFailed";
const QString CREATE_ACCOUNT_FROM_STEAM_PATH = "api/v1/user/steam/create";
const QString CREATE_ACCOUNT_FROM_STEAM_PATH = "api/v1/user/steam/create";
QJsonObject payload;
payload.insert("steam_auth_ticket", QJsonValue::fromVariant(QVariant(ticket)));
if (!username.isEmpty()) {
payload.insert("username", QJsonValue::fromVariant(QVariant(username)));
}
QJsonObject payload;
payload.insert("steam_auth_ticket", QJsonValue::fromVariant(QVariant(ticket)));
if (!username.isEmpty()) {
payload.insert("username", QJsonValue::fromVariant(QVariant(username)));
}
auto accountManager = DependencyManager::get<AccountManager>();
accountManager->sendRequest(CREATE_ACCOUNT_FROM_STEAM_PATH, AccountManagerAuth::None,
QNetworkAccessManager::PostOperation, callbackParams,
QJsonDocument(payload).toJson());
});
auto accountManager = DependencyManager::get<AccountManager>();
accountManager->sendRequest(CREATE_ACCOUNT_FROM_STEAM_PATH, AccountManagerAuth::None,
QNetworkAccessManager::PostOperation, callbackParams,
QJsonDocument(payload).toJson());
});
}
}

View file

@ -19,6 +19,7 @@ enum class PluginType {
class DisplayPlugin;
class InputPlugin;
class CodecPlugin;
class SteamClientPlugin;
class Plugin;
class PluginContainer;
class PluginManager;
@ -29,4 +30,4 @@ using InputPluginPointer = std::shared_ptr<InputPlugin>;
using InputPluginList = std::vector<InputPluginPointer>;
using CodecPluginPointer = std::shared_ptr<CodecPlugin>;
using CodecPluginList = std::vector<CodecPluginPointer>;
using SteamClientPluginPointer = std::shared_ptr<SteamClientPlugin>;

View file

@ -147,6 +147,22 @@ const CodecPluginList& PluginManager::getCodecPlugins() {
return codecPlugins;
}
const SteamClientPluginPointer PluginManager::getSteamClientPlugin() {
static SteamClientPluginPointer steamClientPlugin;
static std::once_flag once;
std::call_once(once, [&] {
// Now grab the dynamic plugins
for (auto loader : getLoadedPlugins()) {
SteamClientProvider* steamClientProvider = qobject_cast<SteamClientProvider*>(loader->instance());
if (steamClientProvider) {
steamClientPlugin = steamClientProvider->getSteamClientPlugin();
break;
}
}
});
return steamClientPlugin;
}
#ifndef Q_OS_ANDROID
// TODO migrate to a DLL model where plugins are discovered and loaded at runtime by the PluginManager class

View file

@ -19,6 +19,7 @@ public:
const DisplayPluginList& getDisplayPlugins();
const InputPluginList& getInputPlugins();
const CodecPluginList& getCodecPlugins();
const SteamClientPluginPointer getSteamClientPlugin();
DisplayPluginList getPreferredDisplayPlugins();
void setPreferredDisplayPlugins(const QStringList& displays);

View file

@ -45,3 +45,11 @@ public:
#define CodecProvider_iid "com.highfidelity.plugins.codec"
Q_DECLARE_INTERFACE(CodecProvider, CodecProvider_iid)
class SteamClientProvider {
public:
virtual ~SteamClientProvider() {}
virtual SteamClientPluginPointer getSteamClientPlugin() = 0;
};
#define SteamClientProvider_iid "com.highfidelity.plugins.steamclient"
Q_DECLARE_INTERFACE(SteamClientProvider, SteamClientProvider_iid)

View file

@ -0,0 +1,59 @@
//
// SteamClientPlugin.h
// libraries/plugins/src/plugins
//
// Created by Clement Brisset on 12/14/16.
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_SteamClientPlugin_h
#define hifi_SteamClientPlugin_h
#include <functional>
#include <QtCore/QObject>
#include <QtCore/QByteArray>
using Ticket = QByteArray;
using TicketRequestCallback = std::function<void(Ticket)>;
class SteamClientPlugin {
public:
virtual ~SteamClientPlugin() {};
virtual bool init() = 0;
virtual void shutdown() = 0;
virtual bool isRunning() = 0;
virtual void runCallbacks() = 0;
virtual void requestTicket(TicketRequestCallback callback) = 0;
virtual void updateLocation(QString status, QUrl locationUrl) = 0;
virtual void openInviteOverlay() = 0;
virtual void joinLobby(QString lobbyId) = 0;
virtual int getSteamVRBuildID() = 0;
};
class SteamScriptingInterface : public QObject {
Q_OBJECT
Q_PROPERTY(bool isRunning READ isRunning)
public:
SteamScriptingInterface(QObject* parent, SteamClientPlugin* plugin) : QObject(parent) {}
public slots:
bool isRunning() const { return _plugin->isRunning(); }
void openInviteOverlay() const { _plugin->openInviteOverlay(); }
private:
SteamClientPlugin* _plugin;
};
#endif /* hifi_SteamClientPlugin_h */

View file

@ -1,5 +0,0 @@
set(TARGET_NAME steamworks-wrapper)
setup_hifi_library()
link_hifi_libraries()
target_steamworks()

View file

@ -1,57 +0,0 @@
//
// SteamClient.h
// steamworks-wrapper/src/steamworks-wrapper
//
// Created by Clement Brisset on 6/8/16.
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_SteamClient_h
#define hifi_SteamClient_h
#include <functional>
#include <QtCore/QObject>
#include <QtCore/QByteArray>
using Ticket = QByteArray;
using TicketRequestCallback = std::function<void(Ticket)>;
class QUrl;
class SteamClient {
public:
static bool isRunning();
static bool init();
static void shutdown();
static void runCallbacks();
static void requestTicket(TicketRequestCallback callback);
static void updateLocation(QString status, QUrl locationUrl);
static void openInviteOverlay();
static void joinLobby(QString lobbyId);
static int getSteamVRBuildID();
};
class SteamScriptingInterface : public QObject {
Q_OBJECT
Q_PROPERTY(bool isRunning READ isRunning)
public:
SteamScriptingInterface(QObject* parent) : QObject(parent) {}
public slots:
bool isRunning() const { return SteamClient::isRunning(); }
void openInviteOverlay() const { SteamClient::openInviteOverlay(); }
};
#endif // hifi_SteamClient_h

View file

@ -26,9 +26,10 @@ if (NOT SERVER_ONLY AND NOT ANDROID)
add_subdirectory(${DIR})
set(DIR "hifiNeuron")
add_subdirectory(${DIR})
set(DIR "hifiKinect")
add_subdirectory(${DIR})
set(DIR "steamClient")
add_subdirectory(${DIR})
endif()
# server-side plugins

View file

@ -0,0 +1,12 @@
#
# Created by Clément Brisset on 12/14/16
# Copyright 2016 High Fidelity, Inc.
#
# Distributed under the Apache License, Version 2.0.
# See the accompanying file LICENSE or http:#www.apache.org/licenses/LICENSE-2.0.html
#
set(TARGET_NAME steamClient)
setup_hifi_plugin(Gui)
link_hifi_libraries(plugins)
target_steamworks()

View file

@ -1,6 +1,6 @@
//
// SteamClient.cpp
// steamworks-wrapper/src/steamworks-wrapper
// SteamAPIPlugin.cpp
// plugins/steamClient/src
//
// Created by Clement Brisset on 6/8/16.
// Copyright 2016 High Fidelity, Inc.
@ -9,7 +9,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "SteamClient.h"
#include "SteamAPIPlugin.h"
#include <atomic>
@ -226,18 +226,18 @@ static std::atomic_bool initialized { false };
static SteamCallbackManager steamCallbackManager;
bool SteamClient::isRunning() {
bool SteamAPIPlugin::isRunning() {
return initialized;
}
bool SteamClient::init() {
bool SteamAPIPlugin::init() {
if (SteamAPI_IsSteamRunning() && !initialized) {
initialized = SteamAPI_Init();
}
return initialized;
}
void SteamClient::shutdown() {
void SteamAPIPlugin::shutdown() {
if (initialized) {
SteamAPI_Shutdown();
}
@ -245,7 +245,7 @@ void SteamClient::shutdown() {
steamCallbackManager.getTicketRequests().stopAll();
}
int SteamClient::getSteamVRBuildID() {
int SteamAPIPlugin::getSteamVRBuildID() {
if (initialized) {
static const int MAX_PATH_SIZE = 512;
static const int STEAMVR_APPID = 250820;
@ -271,7 +271,7 @@ int SteamClient::getSteamVRBuildID() {
}
void SteamClient::runCallbacks() {
void SteamAPIPlugin::runCallbacks() {
if (!initialized) {
return;
}
@ -285,7 +285,7 @@ void SteamClient::runCallbacks() {
Steam_RunCallbacks(steamPipe, false);
}
void SteamClient::requestTicket(TicketRequestCallback callback) {
void SteamAPIPlugin::requestTicket(TicketRequestCallback callback) {
if (!initialized) {
if (SteamAPI_IsSteamRunning()) {
init();
@ -304,7 +304,7 @@ void SteamClient::requestTicket(TicketRequestCallback callback) {
steamCallbackManager.getTicketRequests().startRequest(callback);
}
void SteamClient::updateLocation(QString status, QUrl locationUrl) {
void SteamAPIPlugin::updateLocation(QString status, QUrl locationUrl) {
if (!initialized) {
return;
}
@ -315,7 +315,7 @@ void SteamClient::updateLocation(QString status, QUrl locationUrl) {
SteamFriends()->SetRichPresence("connect", connectStr.toLocal8Bit().data());
}
void SteamClient::openInviteOverlay() {
void SteamAPIPlugin::openInviteOverlay() {
if (!initialized) {
return;
}
@ -326,7 +326,7 @@ void SteamClient::openInviteOverlay() {
}
void SteamClient::joinLobby(QString lobbyIdStr) {
void SteamAPIPlugin::joinLobby(QString lobbyIdStr) {
if (!initialized) {
if (SteamAPI_IsSteamRunning()) {
init();

View file

@ -0,0 +1,37 @@
//
// SteamAPIPlugin.h
// plugins/steamClient/src
//
// Created by Clement Brisset on 6/8/16.
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_SteamAPIPlugin_h
#define hifi_SteamAPIPlugin_h
#include <plugins/SteamClientPlugin.h>
class QUrl;
class SteamAPIPlugin : public SteamClientPlugin {
public:
bool isRunning();
bool init();
void shutdown();
void runCallbacks();
void requestTicket(TicketRequestCallback callback);
void updateLocation(QString status, QUrl locationUrl);
void openInviteOverlay();
void joinLobby(QString lobbyId);
int getSteamVRBuildID();
};
#endif // hifi_SteamAPIPlugin_h

View file

@ -0,0 +1,41 @@
//
// Created by Clément Brisset on 12/14/16
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <mutex>
#include <QtCore/QObject>
#include <QtCore/QtPlugin>
#include <QtCore/QStringList>
#include <plugins/RuntimePlugin.h>
#include <plugins/SteamClientPlugin.h>
#include "SteamAPIPlugin.h"
class SteamAPIProvider : public QObject, public SteamClientProvider {
Q_OBJECT
Q_PLUGIN_METADATA(IID SteamClientProvider_iid FILE "plugin.json")
Q_INTERFACES(SteamClientProvider)
public:
SteamAPIProvider(QObject* parent = nullptr) : QObject(parent) {}
virtual ~SteamAPIProvider() {}
virtual SteamClientPluginPointer getSteamClientPlugin() override {
static std::once_flag once;
std::call_once(once, [&] {
_steamClientPlugin = std::make_shared<SteamAPIPlugin>();
});
return _steamClientPlugin;
}
private:
SteamClientPluginPointer _steamClientPlugin;
};
#include "SteamClientProvider.moc"

View file

@ -0,0 +1 @@
{"name":"Steam Client"}