mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
refactor(fs): Move FSUIPC from fscommon to FS9
With default settings, FSUIPC was not really used by FS simulators (except FS9) as the transponder mode readout was done with SB offsets through SimConnect. For simplification, this removes FSUIPC from fscommon and moves it to FS9. Therefor this also removes the option for FSX/P3D users to toggle FSUIPC.
This commit is contained in:
@@ -45,7 +45,8 @@ namespace BlackSimPlugin::Fs9
|
|||||||
IClientProvider *clientProvider,
|
IClientProvider *clientProvider,
|
||||||
QObject *parent) : CSimulatorFsCommon(info, ownAircraftProvider, remoteAircraftProvider, weatherGridProvider, clientProvider, parent),
|
QObject *parent) : CSimulatorFsCommon(info, ownAircraftProvider, remoteAircraftProvider, weatherGridProvider, clientProvider, parent),
|
||||||
m_fs9Host(fs9Host),
|
m_fs9Host(fs9Host),
|
||||||
m_lobbyClient(lobbyClient)
|
m_lobbyClient(lobbyClient),
|
||||||
|
m_fsuipc(new CFsuipc(this))
|
||||||
{
|
{
|
||||||
// disabled CG/elevation parts
|
// disabled CG/elevation parts
|
||||||
this->setSimulationProviderEnabled(false, false);
|
this->setSimulationProviderEnabled(false, false);
|
||||||
@@ -73,7 +74,8 @@ namespace BlackSimPlugin::Fs9
|
|||||||
Q_ASSERT_X(m_fsuipc, Q_FUNC_INFO, "No FSUIPC");
|
Q_ASSERT_X(m_fsuipc, Q_FUNC_INFO, "No FSUIPC");
|
||||||
m_connectionHostMessages = connect(m_fs9Host.data(), &CFs9Host::customPacketReceived, this, &CSimulatorFs9::processFs9Message);
|
m_connectionHostMessages = connect(m_fs9Host.data(), &CFs9Host::customPacketReceived, this, &CSimulatorFs9::processFs9Message);
|
||||||
|
|
||||||
useFsuipc(true);
|
m_fsuipc->open();
|
||||||
|
|
||||||
this->initSimulatorInternals();
|
this->initSimulatorInternals();
|
||||||
m_timerId = startTimer(50);
|
m_timerId = startTimer(50);
|
||||||
return true;
|
return true;
|
||||||
@@ -88,7 +90,9 @@ namespace BlackSimPlugin::Fs9
|
|||||||
safeKillTimer();
|
safeKillTimer();
|
||||||
disconnectAllClients();
|
disconnectAllClients();
|
||||||
|
|
||||||
// disconnect FSUIPC and status
|
if (m_fsuipc) { m_fsuipc->close(); }
|
||||||
|
|
||||||
|
// emit status
|
||||||
CSimulatorFsCommon::disconnectFrom();
|
CSimulatorFsCommon::disconnectFrom();
|
||||||
m_simConnected = false;
|
m_simConnected = false;
|
||||||
emitSimulatorCombinedStatus();
|
emitSimulatorCombinedStatus();
|
||||||
@@ -246,7 +250,7 @@ namespace BlackSimPlugin::Fs9
|
|||||||
|
|
||||||
void CSimulatorFs9::dispatch()
|
void CSimulatorFs9::dispatch()
|
||||||
{
|
{
|
||||||
if (m_useFsuipc && m_fsuipc && m_fsuipc->isOpened())
|
if (m_fsuipc && m_fsuipc->isOpened())
|
||||||
{
|
{
|
||||||
CSimulatedAircraft fsuipcAircraft(getOwnAircraft());
|
CSimulatedAircraft fsuipcAircraft(getOwnAircraft());
|
||||||
const bool ok = m_fsuipc->read(fsuipcAircraft, true, true, true);
|
const bool ok = m_fsuipc->read(fsuipcAircraft, true, true, true);
|
||||||
@@ -410,7 +414,7 @@ namespace BlackSimPlugin::Fs9
|
|||||||
{
|
{
|
||||||
if (!m_simTimeSynced) { return; }
|
if (!m_simTimeSynced) { return; }
|
||||||
if (!this->isConnected()) { return; }
|
if (!this->isConnected()) { return; }
|
||||||
if (!m_useFsuipc || !m_fsuipc) { return; }
|
if (!m_fsuipc) { return; }
|
||||||
if (!m_fsuipc->isOpened()) { return; }
|
if (!m_fsuipc->isOpened()) { return; }
|
||||||
|
|
||||||
QDateTime myDateTime = QDateTime::currentDateTimeUtc();
|
QDateTime myDateTime = QDateTime::currentDateTimeUtc();
|
||||||
@@ -442,7 +446,7 @@ namespace BlackSimPlugin::Fs9
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_useFsuipc || !m_fsuipc) { return; }
|
if (!m_fsuipc) { return; }
|
||||||
if (!m_fsuipc->isOpened()) { return; }
|
if (!m_fsuipc->isOpened()) { return; }
|
||||||
if (weatherGrid.isEmpty())
|
if (weatherGrid.isEmpty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||||
#include "blackmisc/pixmap.h"
|
#include "blackmisc/pixmap.h"
|
||||||
|
#include "plugins/simulator/fscommon/fsuipc.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
@@ -96,6 +97,7 @@ namespace BlackSimPlugin::Fs9
|
|||||||
//! Sync time with user's computer
|
//! Sync time with user's computer
|
||||||
void synchronizeTime();
|
void synchronizeTime();
|
||||||
|
|
||||||
|
BlackSimPlugin::FsCommon::CFsuipc *m_fsuipc = nullptr; //!< FSUIPC
|
||||||
QHash<BlackMisc::Aviation::CCallsign, QPointer<CFs9Client>> m_hashFs9Clients;
|
QHash<BlackMisc::Aviation::CCallsign, QPointer<CFs9Client>> m_hashFs9Clients;
|
||||||
QMetaObject::Connection m_connectionHostMessages;
|
QMetaObject::Connection m_connectionHostMessages;
|
||||||
bool m_simConnected = false; //!< Is simulator connected?
|
bool m_simConnected = false; //!< Is simulator connected?
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ namespace BlackSimPlugin::FsCommon
|
|||||||
IRemoteAircraftProvider *renderedAircraftProvider,
|
IRemoteAircraftProvider *renderedAircraftProvider,
|
||||||
IWeatherGridProvider *weatherGridProvider,
|
IWeatherGridProvider *weatherGridProvider,
|
||||||
IClientProvider *clientProvider,
|
IClientProvider *clientProvider,
|
||||||
QObject *parent) : CSimulatorPluginCommon(info, ownAircraftProvider, renderedAircraftProvider, weatherGridProvider, clientProvider, parent),
|
QObject *parent) : CSimulatorPluginCommon(info, ownAircraftProvider, renderedAircraftProvider, weatherGridProvider, clientProvider, parent)
|
||||||
m_fsuipc(new CFsuipc(this))
|
|
||||||
{
|
{
|
||||||
CSimulatorFsCommon::registerHelp();
|
CSimulatorFsCommon::registerHelp();
|
||||||
}
|
}
|
||||||
@@ -38,26 +37,6 @@ namespace BlackSimPlugin::FsCommon
|
|||||||
{
|
{
|
||||||
CSimulatorPluginCommon::initSimulatorInternals();
|
CSimulatorPluginCommon::initSimulatorInternals();
|
||||||
m_simulatorInternals.setSimulatorVersion(this->getSimulatorVersion());
|
m_simulatorInternals.setSimulatorVersion(this->getSimulatorVersion());
|
||||||
m_simulatorInternals.setValue("fscommon/fsuipc", boolToOnOff(m_useFsuipc));
|
|
||||||
if (m_fsuipc)
|
|
||||||
{
|
|
||||||
const QString v(m_fsuipc->getVersion());
|
|
||||||
if (!v.isEmpty()) { m_simulatorInternals.setValue("fscommon/fsuipcversion", v); }
|
|
||||||
m_simulatorInternals.setValue("fscommon/fsuipcopen", boolToYesNo(m_fsuipc->isOpened()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSimulatorFsCommon::parseDetails(const CSimpleCommandParser &parser)
|
|
||||||
{
|
|
||||||
// .driver fsuipc on|off
|
|
||||||
if (parser.matchesPart(1, "fsuipc") && parser.hasPart(2))
|
|
||||||
{
|
|
||||||
const bool on = parser.toBool(2);
|
|
||||||
const bool s = this->useFsuipc(on);
|
|
||||||
CLogMessage(this, CLogCategories::cmdLine()).info(u"FSUIPC is '%1'") << boolToOnOff(s);
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
return CSimulatorPluginCommon::parseDetails(parser);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorFsCommon::reset()
|
void CSimulatorFsCommon::reset()
|
||||||
@@ -72,13 +51,10 @@ namespace BlackSimPlugin::FsCommon
|
|||||||
{
|
{
|
||||||
if (CSimpleCommandParser::registered("BlackSimPlugin::FsCommon::CSimulatorFsCommon")) { return; }
|
if (CSimpleCommandParser::registered("BlackSimPlugin::FsCommon::CSimulatorFsCommon")) { return; }
|
||||||
CSimpleCommandParser::registerCommand({ ".drv", "alias: .driver .plugin" });
|
CSimpleCommandParser::registerCommand({ ".drv", "alias: .driver .plugin" });
|
||||||
CSimpleCommandParser::registerCommand({ ".drv fsuipc on|off", "FSUIPC on|off if applicable" });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorFsCommon::disconnectFrom()
|
bool CSimulatorFsCommon::disconnectFrom()
|
||||||
{
|
{
|
||||||
if (m_fsuipc) { m_fsuipc->close(); }
|
|
||||||
|
|
||||||
// reset flags
|
// reset flags
|
||||||
m_simPaused = false;
|
m_simPaused = false;
|
||||||
const bool r = CSimulatorPluginCommon::disconnectFrom();
|
const bool r = CSimulatorPluginCommon::disconnectFrom();
|
||||||
@@ -86,29 +62,6 @@ namespace BlackSimPlugin::FsCommon
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorFsCommon::isFsuipcOpened() const
|
|
||||||
{
|
|
||||||
return m_fsuipc && m_fsuipc->isOpened();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSimulatorFsCommon::useFsuipc(bool on)
|
|
||||||
{
|
|
||||||
if (!m_fsuipc) { return false; } // no FSUIPC available
|
|
||||||
if (m_useFsuipc == on) { return m_useFsuipc; } // nothing changed
|
|
||||||
m_useFsuipc = on;
|
|
||||||
if (on)
|
|
||||||
{
|
|
||||||
m_useFsuipc = m_fsuipc->open();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_fsuipc->close();
|
|
||||||
}
|
|
||||||
|
|
||||||
this->initSimulatorInternals(); // update internals
|
|
||||||
return m_useFsuipc;
|
|
||||||
}
|
|
||||||
|
|
||||||
CTime CSimulatorFsCommon::getTimeSynchronizationOffset() const
|
CTime CSimulatorFsCommon::getTimeSynchronizationOffset() const
|
||||||
{
|
{
|
||||||
return m_syncTimeOffset;
|
return m_syncTimeOffset;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#ifndef BLACKSIMPLUGIN_FSCOMMON_SIMULATORFSCOMMON_H
|
#ifndef BLACKSIMPLUGIN_FSCOMMON_SIMULATORFSCOMMON_H
|
||||||
#define BLACKSIMPLUGIN_FSCOMMON_SIMULATORFSCOMMON_H
|
#define BLACKSIMPLUGIN_FSCOMMON_SIMULATORFSCOMMON_H
|
||||||
|
|
||||||
#include "plugins/simulator/fscommon/fsuipc.h"
|
|
||||||
#include "plugins/simulator/plugincommon/simulatorplugincommon.h"
|
#include "plugins/simulator/plugincommon/simulatorplugincommon.h"
|
||||||
#include "blackmisc/simulation/interpolator.h"
|
#include "blackmisc/simulation/interpolator.h"
|
||||||
#include "blackmisc/simulation/fscommon/aircraftcfgparser.h"
|
#include "blackmisc/simulation/fscommon/aircraftcfgparser.h"
|
||||||
@@ -29,12 +28,6 @@ namespace BlackSimPlugin::FsCommon
|
|||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CSimulatorFsCommon() override;
|
virtual ~CSimulatorFsCommon() override;
|
||||||
|
|
||||||
//! FSUIPC connected?
|
|
||||||
bool isFsuipcOpened() const;
|
|
||||||
|
|
||||||
//! FSUIPC on/off, correctly disconnecting/connecting
|
|
||||||
bool useFsuipc(bool on);
|
|
||||||
|
|
||||||
// ---------------------- ISimulator ------------------
|
// ---------------------- ISimulator ------------------
|
||||||
virtual bool disconnectFrom() override;
|
virtual bool disconnectFrom() override;
|
||||||
virtual bool isPaused() const override { return m_simPaused; }
|
virtual bool isPaused() const override { return m_simPaused; }
|
||||||
@@ -59,22 +52,14 @@ namespace BlackSimPlugin::FsCommon
|
|||||||
//! When swift DB data are read
|
//! When swift DB data are read
|
||||||
virtual void onSwiftDbAirportsRead() override;
|
virtual void onSwiftDbAirportsRead() override;
|
||||||
|
|
||||||
//! \ingroup swiftdotcommands
|
|
||||||
//! <pre>
|
|
||||||
//! .drv fsuipc on|off FSUIPC on/off
|
|
||||||
//! </pre>
|
|
||||||
virtual bool parseDetails(const BlackMisc::CSimpleCommandParser &parser) override;
|
|
||||||
|
|
||||||
//! \copydoc BlackCore::ISimulator::reset
|
//! \copydoc BlackCore::ISimulator::reset
|
||||||
virtual void reset() override;
|
virtual void reset() override;
|
||||||
|
|
||||||
//! Register help
|
//! Register help
|
||||||
static void registerHelp();
|
static void registerHelp();
|
||||||
|
|
||||||
CFsuipc *m_fsuipc = nullptr; //!< FSUIPC
|
|
||||||
int m_ownAircraftUpdateCycles = 0; //!< own aircraft updates, even with 50 updates/sec long enough even for 32bit
|
int m_ownAircraftUpdateCycles = 0; //!< own aircraft updates, even with 50 updates/sec long enough even for 32bit
|
||||||
int m_skipCockpitUpdateCycles = 0; //!< skip some update cycles to allow changes in simulator cockpit to be set
|
int m_skipCockpitUpdateCycles = 0; //!< skip some update cycles to allow changes in simulator cockpit to be set
|
||||||
bool m_useFsuipc = false; //!< use FSUIPC
|
|
||||||
bool m_simPaused = false; //!< simulator paused?
|
bool m_simPaused = false; //!< simulator paused?
|
||||||
bool m_simTimeSynced = false; //!< time synchronized?
|
bool m_simTimeSynced = false; //!< time synchronized?
|
||||||
BlackMisc::PhysicalQuantities::CTime m_syncTimeOffset; //!< time offset
|
BlackMisc::PhysicalQuantities::CTime m_syncTimeOffset; //!< time offset
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ namespace BlackSimPlugin::FsxCommon
|
|||||||
connect(ui->cb_AddingAsSimulatedObject, &QCheckBox::released, this, &CFsxSettingsComponent::onSimulatedObjectChanged);
|
connect(ui->cb_AddingAsSimulatedObject, &QCheckBox::released, this, &CFsxSettingsComponent::onSimulatedObjectChanged);
|
||||||
connect(ui->cb_TraceSimConnectCalls, &QCheckBox::released, this, &CFsxSettingsComponent::onSimConnectTraceChanged);
|
connect(ui->cb_TraceSimConnectCalls, &QCheckBox::released, this, &CFsxSettingsComponent::onSimConnectTraceChanged);
|
||||||
connect(ui->cb_EnableTerrainProbe, &QCheckBox::released, this, &CFsxSettingsComponent::onEnableTerrainProbeChanged);
|
connect(ui->cb_EnableTerrainProbe, &QCheckBox::released, this, &CFsxSettingsComponent::onEnableTerrainProbeChanged);
|
||||||
connect(ui->cb_UseFsuipc, &QCheckBox::released, this, &CFsxSettingsComponent::onFsuipcChanged);
|
|
||||||
connect(ui->cb_SBOffsets, &QCheckBox::released, this, &CFsxSettingsComponent::onSBOffsetsChanged);
|
connect(ui->cb_SBOffsets, &QCheckBox::released, this, &CFsxSettingsComponent::onSBOffsetsChanged);
|
||||||
connect(ui->pb_CopyTerrainProbe, &QPushButton::released, this, &CFsxSettingsComponent::copyTerrainProbe);
|
connect(ui->pb_CopyTerrainProbe, &QPushButton::released, this, &CFsxSettingsComponent::copyTerrainProbe);
|
||||||
connect(ui->pb_Refresh, &QPushButton::released, this, &CFsxSettingsComponent::refresh);
|
connect(ui->pb_Refresh, &QPushButton::released, this, &CFsxSettingsComponent::refresh);
|
||||||
@@ -66,7 +65,6 @@ namespace BlackSimPlugin::FsxCommon
|
|||||||
ui->cb_TraceSimConnectCalls->setChecked(fsxOrP3D->isTraceSendId());
|
ui->cb_TraceSimConnectCalls->setChecked(fsxOrP3D->isTraceSendId());
|
||||||
ui->cb_EnableTerrainProbe->setChecked(fsxOrP3D->isUsingFsxTerrainProbe());
|
ui->cb_EnableTerrainProbe->setChecked(fsxOrP3D->isUsingFsxTerrainProbe());
|
||||||
ui->cb_SBOffsets->setChecked(fsxOrP3D->isUsingSbOffsetValues());
|
ui->cb_SBOffsets->setChecked(fsxOrP3D->isUsingSbOffsetValues());
|
||||||
ui->cb_UseFsuipc->setChecked(fsxOrP3D->isFsuipcOpened());
|
|
||||||
ui->cb_AddingAsSimulatedObject->setChecked(fsxOrP3D->isAddingAsSimulatedObjectEnabled());
|
ui->cb_AddingAsSimulatedObject->setChecked(fsxOrP3D->isAddingAsSimulatedObjectEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +72,6 @@ namespace BlackSimPlugin::FsxCommon
|
|||||||
ui->cb_TraceSimConnectCalls->setEnabled(localSim);
|
ui->cb_TraceSimConnectCalls->setEnabled(localSim);
|
||||||
ui->cb_EnableTerrainProbe->setEnabled(localSim);
|
ui->cb_EnableTerrainProbe->setEnabled(localSim);
|
||||||
ui->cb_SBOffsets->setEnabled(localSim);
|
ui->cb_SBOffsets->setEnabled(localSim);
|
||||||
ui->cb_UseFsuipc->setEnabled(localSim);
|
|
||||||
|
|
||||||
const bool terrainProbe = CBuildConfig::isRunningOnWindowsNtPlatform() && (CBuildConfig::buildWordSize() == 32);
|
const bool terrainProbe = CBuildConfig::isRunningOnWindowsNtPlatform() && (CBuildConfig::buildWordSize() == 32);
|
||||||
ui->cb_EnableTerrainProbe->setEnabled(terrainProbe);
|
ui->cb_EnableTerrainProbe->setEnabled(terrainProbe);
|
||||||
@@ -102,13 +99,6 @@ namespace BlackSimPlugin::FsxCommon
|
|||||||
fsxOrP3D->setUsingFsxTerrainProbe(ui->cb_EnableTerrainProbe->isChecked());
|
fsxOrP3D->setUsingFsxTerrainProbe(ui->cb_EnableTerrainProbe->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFsxSettingsComponent::onFsuipcChanged()
|
|
||||||
{
|
|
||||||
CSimulatorFsxCommon *fsxOrP3D = this->getFsxOrP3DSimulator();
|
|
||||||
if (!fsxOrP3D) { return; }
|
|
||||||
fsxOrP3D->useFsuipc(ui->cb_UseFsuipc->isChecked());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CFsxSettingsComponent::onSBOffsetsChanged()
|
void CFsxSettingsComponent::onSBOffsetsChanged()
|
||||||
{
|
{
|
||||||
CSimulatorFsxCommon *fsxOrP3D = this->getFsxOrP3DSimulator();
|
CSimulatorFsxCommon *fsxOrP3D = this->getFsxOrP3DSimulator();
|
||||||
|
|||||||
@@ -55,9 +55,6 @@ namespace BlackSimPlugin::FsxCommon
|
|||||||
//! Using simulated objects
|
//! Using simulated objects
|
||||||
void onSimulatedObjectChanged();
|
void onSimulatedObjectChanged();
|
||||||
|
|
||||||
//! FSUIPC setting changed
|
|
||||||
void onFsuipcChanged();
|
|
||||||
|
|
||||||
//! Offsets on/off
|
//! Offsets on/off
|
||||||
void onSBOffsetsChanged();
|
void onSBOffsetsChanged();
|
||||||
|
|
||||||
|
|||||||
@@ -51,13 +51,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QCheckBox" name="cb_UseFsuipc">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QCheckBox" name="cb_AddingAsSimulatedObject">
|
<widget class="QCheckBox" name="cb_AddingAsSimulatedObject">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -105,13 +98,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
|
||||||
<widget class="QLabel" name="lbl_UseFsuipc">
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable FSUIPC support</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QCheckBox" name="cb_EnableTerrainProbe">
|
<widget class="QCheckBox" name="cb_EnableTerrainProbe">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -140,7 +126,6 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>cb_TraceSimConnectCalls</tabstop>
|
<tabstop>cb_TraceSimConnectCalls</tabstop>
|
||||||
<tabstop>cb_UseFsuipc</tabstop>
|
|
||||||
<tabstop>cb_SBOffsets</tabstop>
|
<tabstop>cb_SBOffsets</tabstop>
|
||||||
<tabstop>cb_AddingAsSimulatedObject</tabstop>
|
<tabstop>cb_AddingAsSimulatedObject</tabstop>
|
||||||
<tabstop>cb_EnableTerrainProbe</tabstop>
|
<tabstop>cb_EnableTerrainProbe</tabstop>
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ namespace BlackSimPlugin::FsxCommon
|
|||||||
Q_ASSERT_X(sApp, Q_FUNC_INFO, "Missing global object");
|
Q_ASSERT_X(sApp, Q_FUNC_INFO, "Missing global object");
|
||||||
|
|
||||||
m_simObjectTimer.setInterval(AddPendingAircraftIntervalMs);
|
m_simObjectTimer.setInterval(AddPendingAircraftIntervalMs);
|
||||||
m_useFsuipc = false;
|
|
||||||
// default model will be set in derived class
|
// default model will be set in derived class
|
||||||
|
|
||||||
CSimulatorFsxCommon::registerHelp();
|
CSimulatorFsxCommon::registerHelp();
|
||||||
@@ -69,7 +68,6 @@ namespace BlackSimPlugin::FsxCommon
|
|||||||
CSimulatorFsxCommon::~CSimulatorFsxCommon()
|
CSimulatorFsxCommon::~CSimulatorFsxCommon()
|
||||||
{
|
{
|
||||||
this->disconnectFrom();
|
this->disconnectFrom();
|
||||||
// fsuipc is disconnected in CSimulatorFsCommon
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorFsxCommon::isConnected() const
|
bool CSimulatorFsxCommon::isConnected() const
|
||||||
@@ -95,12 +93,6 @@ namespace BlackSimPlugin::FsxCommon
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FSUIPC too
|
|
||||||
if (m_useFsuipc)
|
|
||||||
{
|
|
||||||
m_fsuipc->open();
|
|
||||||
}
|
|
||||||
|
|
||||||
// set structures and move on
|
// set structures and move on
|
||||||
this->triggerAutoTraceSendId(); // we trace the init phase, so in case something goes wrong there
|
this->triggerAutoTraceSendId(); // we trace the init phase, so in case something goes wrong there
|
||||||
this->initEvents();
|
this->initEvents();
|
||||||
@@ -127,7 +119,7 @@ namespace BlackSimPlugin::FsxCommon
|
|||||||
m_simConnected = false;
|
m_simConnected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// emit status and disconnect FSUIPC
|
// emit status
|
||||||
return CSimulatorFsCommon::disconnectFrom();
|
return CSimulatorFsCommon::disconnectFrom();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +173,6 @@ namespace BlackSimPlugin::FsxCommon
|
|||||||
|
|
||||||
if (newTransponder.getTransponderMode() != m_simTransponder.getTransponderMode())
|
if (newTransponder.getTransponderMode() != m_simTransponder.getTransponderMode())
|
||||||
{
|
{
|
||||||
// use one way to transfer XPDR ident/mode not both
|
|
||||||
if (m_useSbOffsets)
|
if (m_useSbOffsets)
|
||||||
{
|
{
|
||||||
byte ident = newTransponder.isIdentifying() ? 1U : 0U; // 1 is ident
|
byte ident = newTransponder.isIdentifying() ? 1U : 0U; // 1 is ident
|
||||||
@@ -205,11 +196,6 @@ namespace BlackSimPlugin::FsxCommon
|
|||||||
}
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
else if (m_useFsuipc && m_fsuipc)
|
|
||||||
{
|
|
||||||
m_fsuipc->write(newTransponder);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// avoid changes of cockpit back to old values due to an outdated read back value
|
// avoid changes of cockpit back to old values due to an outdated read back value
|
||||||
@@ -959,18 +945,6 @@ namespace BlackSimPlugin::FsxCommon
|
|||||||
this->updateCockpit(myAircraft.getCom1System(), myAircraft.getCom2System(), xpdr, this->identifier());
|
this->updateCockpit(myAircraft.getCom1System(), myAircraft.getCom2System(), xpdr, this->identifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorFsxCommon::updateOwnAircraftFromSimulatorFsuipc(const CTransponder &xpdr)
|
|
||||||
{
|
|
||||||
if (!m_useFsuipc) { return; }
|
|
||||||
if (m_skipCockpitUpdateCycles > 0) { return; }
|
|
||||||
const CSimulatedAircraft myAircraft(this->getOwnAircraft());
|
|
||||||
const bool changed = (myAircraft.getTransponderMode() != xpdr.getTransponderMode());
|
|
||||||
if (!changed) { return; }
|
|
||||||
CTransponder myXpdr = myAircraft.getTransponder();
|
|
||||||
myXpdr.setTransponderMode(xpdr.getTransponderMode());
|
|
||||||
this->updateCockpit(myAircraft.getCom1System(), myAircraft.getCom2System(), myXpdr, this->identifier());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSimulatorFsxCommon::simulatorReportedObjectAdded(DWORD objectId)
|
bool CSimulatorFsxCommon::simulatorReportedObjectAdded(DWORD objectId)
|
||||||
{
|
{
|
||||||
if (this->isShuttingDownOrDisconnected()) { return true; } // pretend everything is fine
|
if (this->isShuttingDownOrDisconnected()) { return true; } // pretend everything is fine
|
||||||
@@ -1518,26 +1492,6 @@ namespace BlackSimPlugin::FsxCommon
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_dispatchErrors = 0;
|
m_dispatchErrors = 0;
|
||||||
if (m_useFsuipc && m_fsuipc)
|
|
||||||
{
|
|
||||||
if (m_dispatchProcCount % 10 == 0)
|
|
||||||
{
|
|
||||||
// slow updates, here only when SB/SimConnect is disabled as those do the same thing
|
|
||||||
if (!m_useSbOffsets)
|
|
||||||
{
|
|
||||||
CSimulatedAircraft fsuipcAircraft(this->getOwnAircraft());
|
|
||||||
const bool ok = m_fsuipc->read(fsuipcAircraft, true, false, false);
|
|
||||||
if (ok)
|
|
||||||
{
|
|
||||||
this->updateOwnAircraftFromSimulatorFsuipc(fsuipcAircraft.getTransponder());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// fast
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorFsxCommon::physicallyAddRemoteAircraftImpl(const CSimulatedAircraft &newRemoteAircraft, CSimulatorFsxCommon::AircraftAddMode addMode, const CSimConnectObject &correspondingSimObject)
|
bool CSimulatorFsxCommon::physicallyAddRemoteAircraftImpl(const CSimulatedAircraft &newRemoteAircraft, CSimulatorFsxCommon::AircraftAddMode addMode, const CSimConnectObject &correspondingSimObject)
|
||||||
|
|||||||
@@ -480,10 +480,6 @@ namespace BlackSimPlugin::FsxCommon
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
void updateOwnAircraftFromSimulator(const DataDefinitionClientAreaSb &sbDataArea);
|
void updateOwnAircraftFromSimulator(const DataDefinitionClientAreaSb &sbDataArea);
|
||||||
|
|
||||||
//! Update from FSUIPC
|
|
||||||
//! \threadsafe
|
|
||||||
void updateOwnAircraftFromSimulatorFsuipc(const BlackMisc::Aviation::CTransponder &xpdr);
|
|
||||||
|
|
||||||
//! An AI aircraft was added in the simulator
|
//! An AI aircraft was added in the simulator
|
||||||
bool simulatorReportedObjectAdded(DWORD objectId);
|
bool simulatorReportedObjectAdded(DWORD objectId);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user