mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 10:26:03 +08:00
Ref T349, P3D version as setting
This commit is contained in:
@@ -188,7 +188,7 @@ namespace BlackMisc
|
|||||||
CSimulatorInfo m_simulator; //!< represented simulator
|
CSimulatorInfo m_simulator; //!< represented simulator
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Allows to have specific utility functions for each simulator
|
//! XPlane specific settings
|
||||||
class BLACKMISC_EXPORT CXPlaneSimulatorSettings : public CSpecializedSimulatorSettings
|
class BLACKMISC_EXPORT CXPlaneSimulatorSettings : public CSpecializedSimulatorSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -234,6 +234,23 @@ namespace BlackMisc
|
|||||||
static const QString &humanReadable() { static const QString name("P3D settings"); return name; }
|
static const QString &humanReadable() { static const QString name("P3D settings"); return name; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! Selected P3D version (64bit)
|
||||||
|
struct TP3DVersion : public TSettingTrait<QString>
|
||||||
|
{
|
||||||
|
//! \copydoc BlackMisc::TSettingTrait::key
|
||||||
|
static const char *key() { return "simulator/p3dversion"; }
|
||||||
|
|
||||||
|
//! \copydoc BlackCore::TSettingTrait::humanReadable
|
||||||
|
static const QString &humanReadable() { static const QString name("P3D version"); return name; }
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
||||||
|
static const QString &defaultValue()
|
||||||
|
{
|
||||||
|
static const QString version("4.2");
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//! Trait for simulator settings
|
//! Trait for simulator settings
|
||||||
struct TSimulatorXP : public TSettingTrait<CSimulatorSettings>
|
struct TSimulatorXP : public TSettingTrait<CSimulatorSettings>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,10 +31,6 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
namespace P3D
|
namespace P3D
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN64
|
|
||||||
static P3DSimConnectVersion gP3DSimConnectVersion = P3DSimConnectv42;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CSimulatorP3D::CSimulatorP3D(const CSimulatorPluginInfo &info,
|
CSimulatorP3D::CSimulatorP3D(const CSimulatorPluginInfo &info,
|
||||||
IOwnAircraftProvider *ownAircraftProvider,
|
IOwnAircraftProvider *ownAircraftProvider,
|
||||||
IRemoteAircraftProvider *remoteAircraftProvider,
|
IRemoteAircraftProvider *remoteAircraftProvider,
|
||||||
@@ -57,7 +53,7 @@ namespace BlackSimPlugin
|
|||||||
bool CSimulatorP3D::connectTo()
|
bool CSimulatorP3D::connectTo()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN64
|
#ifdef Q_OS_WIN64
|
||||||
if (!loadAndResolveP3DSimConnect(gP3DSimConnectVersion)) { return false; }
|
if (!loadAndResolveP3DSimConnectByString(m_p3dVersion.get())) { return false; }
|
||||||
return CSimulatorFsxCommon::connectTo();
|
return CSimulatorFsxCommon::connectTo();
|
||||||
#else
|
#else
|
||||||
if (!loadAndResolveFsxSimConnect(true)) { return false; }
|
if (!loadAndResolveFsxSimConnect(true)) { return false; }
|
||||||
@@ -297,7 +293,7 @@ namespace BlackSimPlugin
|
|||||||
void CSimulatorP3DListener::startImpl()
|
void CSimulatorP3DListener::startImpl()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN64
|
#ifdef Q_OS_WIN64
|
||||||
if (!loadAndResolveP3DSimConnect(gP3DSimConnectVersion)) { return; }
|
if (!loadAndResolveP3DSimConnectByString(m_p3dVersion.get())) { return; }
|
||||||
return CSimulatorFsxCommonListener::startImpl();
|
return CSimulatorFsxCommonListener::startImpl();
|
||||||
#else
|
#else
|
||||||
if (!loadAndResolveFsxSimConnect(true)) { return; }
|
if (!loadAndResolveFsxSimConnect(true)) { return; }
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
#include "../fsxcommon/simulatorfsxcommon.h"
|
#include "../fsxcommon/simulatorfsxcommon.h"
|
||||||
#include "../fsxcommon/simconnectobject.h"
|
#include "../fsxcommon/simconnectobject.h"
|
||||||
|
#include "blackmisc/simulation/settings/simulatorsettings.h"
|
||||||
|
#include "blackmisc/settingscache.h"
|
||||||
|
|
||||||
namespace BlackSimPlugin
|
namespace BlackSimPlugin
|
||||||
{
|
{
|
||||||
@@ -70,9 +72,11 @@ namespace BlackSimPlugin
|
|||||||
//! \remark P3D API release of control
|
//! \remark P3D API release of control
|
||||||
virtual bool releaseAIControl(const FsxCommon::CSimConnectObject &simObject, SIMCONNECT_DATA_REQUEST_ID requestId) override;
|
virtual bool releaseAIControl(const FsxCommon::CSimConnectObject &simObject, SIMCONNECT_DATA_REQUEST_ID requestId) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//! SimConnect Callback
|
//! SimConnect Callback
|
||||||
static void CALLBACK SimConnectProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext);
|
static void CALLBACK SimConnectProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext);
|
||||||
|
|
||||||
|
private:
|
||||||
|
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TP3DVersion> m_p3dVersion { this };
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Listener for P3D
|
//! Listener for P3D
|
||||||
@@ -86,6 +90,9 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void startImpl() override;
|
virtual void startImpl() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TP3DVersion> m_p3dVersion { this };
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
Reference in New Issue
Block a user