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