mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 06:45:37 +08:00
@@ -178,13 +178,18 @@ namespace swift::simplugin::fsxcommon
|
||||
"ROTATION VELOCITY BODY Y", "Radians per second");
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft,
|
||||
"ROTATION VELOCITY BODY Z", "Radians per second");
|
||||
// MSFS 2020/2024 only
|
||||
// MSFS 2020/2024 only. Placed at the end because non-MSFS simulators fail with these and skip them.
|
||||
// Only access the members when using MSFS!
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft,
|
||||
"INDICATED ALTITUDE CALIBRATED", "Feet");
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft,
|
||||
"TRANSPONDER STATE:1", "Enum");
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft,
|
||||
"TRANSPONDER IDENT:1", "Bool");
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft,
|
||||
"COM VOLUME:1", "Percent");
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraft,
|
||||
"COM VOLUME:2", "Percent");
|
||||
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataOwnAircraftTitle, "TITLE",
|
||||
nullptr, SIMCONNECT_DATATYPE_STRING256);
|
||||
|
||||
@@ -79,6 +79,8 @@ namespace swift::simplugin::fsxcommon
|
||||
double altitudeCalibratedFt; //!< Altitude without temperature effect (ft, MSFS)
|
||||
double transponderMode; //!< transponder state (MSFS)
|
||||
double ident; //!< ident (MSFS)
|
||||
double com1Volume; //!< COM1 volume (MSFS)
|
||||
double com2Volume; //!< COM2 volume (MSFS)
|
||||
};
|
||||
|
||||
//! Data struct of aircraft position
|
||||
|
||||
@@ -687,6 +687,14 @@ namespace swift::simplugin::fsxcommon
|
||||
[[maybe_unused]] const swift::simplugin::fsxcommon::DataDefinitionOwnAircraft &simulatorOwnAircraft)
|
||||
{ /* Do not modify the transponder mode by default. Only MSFS allows to read it from SimVars */ }
|
||||
|
||||
void CSimulatorFsxCommon::setComVolume(
|
||||
[[maybe_unused]] swift::misc::aviation::CComSystem &com,
|
||||
[[maybe_unused]] const swift::simplugin::fsxcommon::DataDefinitionOwnAircraft &simulatorOwnAircraft,
|
||||
[[maybe_unused]] swift::misc::aviation::CComSystem::ComUnit unit)
|
||||
{
|
||||
/* Do not modify the COM volume by default. Only MSFS allows to read it from SimVars */
|
||||
}
|
||||
|
||||
|
||||
void CSimulatorFsxCommon::updateOwnAircraftFromSimulator(const DataDefinitionOwnAircraft &simulatorOwnAircraft)
|
||||
{
|
||||
@@ -792,6 +800,8 @@ namespace swift::simplugin::fsxcommon
|
||||
if (!changedCom1Standby) { com1.setFrequencyStandby(myAircraft.getCom1System().getFrequencyStandby()); }
|
||||
else { m_lastCom1Standby.setNull(); }
|
||||
|
||||
setComVolume(com1, simulatorOwnAircraft, CComSystem::Com1);
|
||||
|
||||
const bool changedCom1 = myAircraft.getCom1System() != com1;
|
||||
|
||||
m_simCom1 = com1;
|
||||
@@ -820,6 +830,8 @@ namespace swift::simplugin::fsxcommon
|
||||
if (!changedCom2Standby) { com2.setFrequencyStandby(myAircraft.getCom2System().getFrequencyStandby()); }
|
||||
else { m_lastCom2Standby.setNull(); }
|
||||
|
||||
setComVolume(com2, simulatorOwnAircraft, CComSystem::Com2);
|
||||
|
||||
const bool changedCom2 = myAircraft.getCom2System() != com2;
|
||||
|
||||
m_simCom2 = com2;
|
||||
|
||||
@@ -508,6 +508,12 @@ namespace swift::simplugin::fsxcommon
|
||||
setTransponderMode(swift::misc::aviation::CTransponder &transponder,
|
||||
const swift::simplugin::fsxcommon::DataDefinitionOwnAircraft &simulatorOwnAircraft);
|
||||
|
||||
//! Customization point for changing the COM volume
|
||||
virtual void
|
||||
setComVolume(swift::misc::aviation::CComSystem &com,
|
||||
const swift::simplugin::fsxcommon::DataDefinitionOwnAircraft &simulatorOwnAircraft,
|
||||
swift::misc::aviation::CComSystem::ComUnit unit);
|
||||
|
||||
//! Called when data about our own aircraft are received
|
||||
void updateOwnAircraftFromSimulator(const DataDefinitionOwnAircraft &simulatorOwnAircraft);
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ namespace swift::simplugin::fsxcommon
|
||||
{
|
||||
case CSimConnectDefinitions::RequestOwnAircraft:
|
||||
{
|
||||
static_assert(sizeof(DataDefinitionOwnAircraft) == 47 * sizeof(double),
|
||||
static_assert(sizeof(DataDefinitionOwnAircraft) == 49 * sizeof(double),
|
||||
"DataDefinitionOwnAircraft has an incorrect size.");
|
||||
const DataDefinitionOwnAircraft *ownAircaft =
|
||||
reinterpret_cast<const DataDefinitionOwnAircraft *>(&pObjData->dwData);
|
||||
|
||||
@@ -54,6 +54,15 @@ namespace swift::simplugin::msfs
|
||||
transponder.setTransponderMode(mode);
|
||||
}
|
||||
|
||||
void CSimulatorMsFs::setComVolume(
|
||||
swift::misc::aviation::CComSystem& com,
|
||||
const swift::simplugin::fsxcommon::DataDefinitionOwnAircraft& simulatorOwnAircraft,
|
||||
swift::misc::aviation::CComSystem::ComUnit unit)
|
||||
{
|
||||
if (unit == CComSystem::Com1) { com.setVolumeReceive(simulatorOwnAircraft.com1Volume);}
|
||||
if (unit == CComSystem::Com2) { com.setVolumeReceive(simulatorOwnAircraft.com2Volume); }
|
||||
}
|
||||
|
||||
|
||||
void CSimulatorMsFsListener::startImpl()
|
||||
{
|
||||
|
||||
@@ -35,6 +35,10 @@ namespace swift::simplugin::msfs
|
||||
setTransponderMode(swift::misc::aviation::CTransponder &transponder,
|
||||
const swift::simplugin::fsxcommon::DataDefinitionOwnAircraft &simulatorOwnAircraft) override;
|
||||
|
||||
void setComVolume(swift::misc::aviation::CComSystem &com,
|
||||
const swift::simplugin::fsxcommon::DataDefinitionOwnAircraft &simulatorOwnAircraft,
|
||||
swift::misc::aviation::CComSystem::ComUnit unit) override;
|
||||
|
||||
};
|
||||
|
||||
//! Listener for MSFS
|
||||
|
||||
Reference in New Issue
Block a user