feat: add native msfs2024 support

This commit is contained in:
tzobler
2024-12-17 23:06:46 +01:00
committed by Lars Toenning
parent 6267cab3aa
commit 940b7281c9
57 changed files with 978 additions and 346 deletions

1
.gitignore vendored
View File

@@ -51,3 +51,4 @@ cmake-build-*/
/out/
/dist/
CMakeUserPresets.json
/third_party/externals

View File

@@ -44,6 +44,7 @@ cmake_dependent_option(SWIFT_BUILD_XSWIFTBUS "Build xswiftbus" ON "NOT SWIFT_WIN
option(SWIFT_BUILD_FLIGHTGEAR_PLUGIN "Build Flightgear plugin" ON)
option(SWIFT_BUILD_EMULATED_PLUGIN "Build Emulated plugin" ON)
cmake_dependent_option(SWIFT_BUILD_MSFS_PLUGIN "Build MSFS plugin" ON WIN32 OFF)
cmake_dependent_option(SWIFT_BUILD_MSFS2024_PLUGIN "Build MSFS2024 plugin" ON WIN32 OFF)
option(SWIFT_MINIFY_DEBUG_SYMBOLS "Minify debug symbols" OFF)
option(SWIFT_USE_CRASHPAD "Use crashpad" OFF)
@@ -197,6 +198,7 @@ message(STATUS "\t FS9: ${SWIFT_BUILD_FS9_PLUGIN}")
message(STATUS "\t FSX: ${SWIFT_BUILD_FSX_PLUGIN}")
message(STATUS "\t P3D: ${SWIFT_BUILD_P3D_PLUGIN}")
message(STATUS "\t MSFS: ${SWIFT_BUILD_MSFS_PLUGIN}")
message(STATUS "\t MSFS2024: ${SWIFT_BUILD_MSFS2024_PLUGIN}")
message(STATUS "\t XPLANE: ${SWIFT_BUILD_XPLANE_PLUGIN}")
message(STATUS "\t XSWIFTBUS: ${SWIFT_BUILD_XPLANE_PLUGIN}")
message(STATUS "\t FLIGHTGEAR: ${SWIFT_BUILD_FLIGHTGEAR_PLUGIN}")

View File

@@ -4,7 +4,7 @@
# Checks if variable for SDK path is set and SimConnect.h does exist in the include path.
# If not, disable building the simulator plugin and emit warning message
if(SWIFT_BUILD_FSX_PLUGIN OR SWIFT_BUILD_P3D_PLUGIN OR SWIFT_BUILD_MSFS_PLUGIN)
if(SWIFT_BUILD_FSX_PLUGIN OR SWIFT_BUILD_P3D_PLUGIN OR SWIFT_BUILD_MSFS_PLUGIN OR SWIFT_BUILD_MSFS2024_PLUGIN)
add_library(externals_simconnect INTERFACE IMPORTED GLOBAL)
target_compile_definitions(externals_simconnect INTERFACE SIMCONNECT_H_NOMANIFEST)
target_compile_definitions(externals_simconnect INTERFACE BUID_SIMCONNECT_LIB)
@@ -30,6 +30,7 @@ if(SWIFT_BUILD_FSX_PLUGIN OR SWIFT_BUILD_P3D_PLUGIN OR SWIFT_BUILD_MSFS_PLUGIN)
add_install_command(${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/32/lib/SimConnect.dll)
elseif(SWIFT_WIN64)
list(APPEND LIBS SimConnect.MSFS.dll)
list(APPEND LIBS SimConnect.MSFS2024.dll)
list(APPEND LIBS SimConnect.P3D-v4.0.dll)
list(APPEND LIBS SimConnect.P3D-v4.1.dll)
list(APPEND LIBS SimConnect.P3D-v4.2.dll)

View File

@@ -3,209 +3,247 @@
SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
-->
<componentGroup>
<name>simulators</name>
<description>Simulator Plugins</description>
<canBeEdited>1</canBeEdited>
<selected>1</selected>
<show>1</show>
<componentList>
<component>
<name>fs2004</name>
<description>FS9: Flight Sim 2004</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>MS Flight Simulator 2004 Simulator Plugin</detailedDescription>
<selected>1</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>windows</platforms>
<distributionFileList>
<distributionFile>
<origin>../../dist/bin/plugins/simulator/simulatorfs9.dll</origin>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
<shouldPackRuleList>
<platformTest>
<type>windows</type>
</platformTest>
<compareText>
<logic>equals</logic>
<text>${architecture}</text>
<value>32</value>
</compareText>
</shouldPackRuleList>
</component>
<component>
<name>fsx</name>
<description>FSX: Flight Sim X</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>MS Flight Simulator X Simulator Plugin
This plugin acts as the interface between swift and FSX.</detailedDescription>
<selected>1</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>windows</platforms>
<distributionFileList>
<distributionFile>
<origin>../../dist/bin/plugins/simulator/simulatorfsx.dll</origin>
</distributionFile>
<distributionFile>
<origin>../../dist/bin/plugins/simulator/simulatorfsxconfig.dll</origin>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
<shouldPackRuleList>
<platformTest>
<type>windows</type>
</platformTest>
<compareText>
<logic>equals</logic>
<text>${architecture}</text>
<value>32</value>
</compareText>
</shouldPackRuleList>
</component>
<component>
<name>msfs</name>
<description>MSFS: Flight Sim 2020</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>MS Flight Simulator 2020 Simulator Plugin
This plugin acts as the interface between swift and MSFS.</detailedDescription>
<selected>1</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>windows</platforms>
<distributionFileList>
<distributionFile>
<origin>../../dist/bin/plugins/simulator/simulatormsfs.dll</origin>
</distributionFile>
<distributionFile>
<origin>../../dist/bin/plugins/simulator/simulatormsfsconfig.dll</origin>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
<shouldPackRuleList>
<platformTest>
<type>windows</type>
</platformTest>
</shouldPackRuleList>
</component>
<component>
<name>p3d</name>
<description>PREPAR3D</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>LM Prepar3D Simulator Plugin
This plugin acts as the interface between swift and P3D.</detailedDescription>
<selected>1</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>windows</platforms>
<distributionFileList>
<distributionFile>
<origin>../../dist/bin/plugins/simulator/simulatorp3d.dll</origin>
</distributionFile>
<distributionFile>
<origin>../../dist/bin/plugins/simulator/simulatorp3dconfig.dll</origin>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
<shouldPackRuleList>
<platformTest>
<type>windows</type>
</platformTest>
</shouldPackRuleList>
</component>
<component>
<name>xplane</name>
<description>X-Plane</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>X-Plane Simulator Plugin
This plugin acts as the interface between swift and X-Plane</detailedDescription>
<selected>1</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>all</platforms>
<distributionFileList>
<distributionFile>
<allowWildcards>1</allowWildcards>
<origin>../../dist/bin/plugins/simulator/*simulatorxplane*</origin>
<excludeFiles>*/*.pdb;*/*.debug;*/*.dSYM</excludeFiles>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
</component>
<component>
<name>flightgear</name>
<description>FlightGear</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>FlightGear Simulator Plugin
This plugin acts as the interface between swift and FlightGear</detailedDescription>
<selected>1</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>all</platforms>
<distributionFileList>
<distributionFile>
<allowWildcards>1</allowWildcards>
<origin>../../dist/bin/plugins/simulator/*simulatorflightgear*</origin>
<excludeFiles>*/*.pdb;*/*.debug;*/*.dSYM</excludeFiles>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
</component>
<component>
<name>emulated</name>
<description>Emulated Simulator</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>Emulated Simulator Plugin
This plugin emulates a running simulator. Use this for testing swift only</detailedDescription>
<selected>0</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>all</platforms>
<distributionFileList>
<distributionFile>
<allowWildcards>1</allowWildcards>
<origin>../../dist/bin/plugins/simulator/*simulatoremulated*</origin>
<excludeFiles>*/*.pdb;*/*.debug;*/*.dSYM</excludeFiles>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
</component>
</componentList>
<name>simulators</name>
<description>Simulator Plugins</description>
<canBeEdited>1</canBeEdited>
<selected>1</selected>
<show>1</show>
<componentList>
<component>
<name>fs2004</name>
<description>FS9: Flight Sim 2004</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>MS Flight Simulator 2004 Simulator Plugin</detailedDescription>
<selected>1</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>windows</platforms>
<distributionFileList>
<distributionFile>
<origin>../../dist/bin/plugins/simulator/simulatorfs9.dll</origin>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
<shouldPackRuleList>
<platformTest>
<type>windows</type>
</platformTest>
<compareText>
<logic>equals</logic>
<text>${architecture}</text>
<value>32</value>
</compareText>
</shouldPackRuleList>
</component>
<component>
<name>fsx</name>
<description>FSX: Flight Sim X</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>
MS Flight Simulator X Simulator Plugin
This plugin acts as the interface between swift and FSX.
</detailedDescription>
<selected>1</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>windows</platforms>
<distributionFileList>
<distributionFile>
<origin>../../dist/bin/plugins/simulator/simulatorfsx.dll</origin>
</distributionFile>
<distributionFile>
<origin>../../dist/bin/plugins/simulator/simulatorfsxconfig.dll</origin>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
<shouldPackRuleList>
<platformTest>
<type>windows</type>
</platformTest>
<compareText>
<logic>equals</logic>
<text>${architecture}</text>
<value>32</value>
</compareText>
</shouldPackRuleList>
</component>
<component>
<name>msfs</name>
<description>MSFS: Flight Sim 2020</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>
MS Flight Simulator 2020 Simulator Plugin
This plugin acts as the interface between swift and MSFS.
</detailedDescription>
<selected>1</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>windows</platforms>
<distributionFileList>
<distributionFile>
<origin>../../dist/bin/plugins/simulator/simulatormsfs.dll</origin>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
<shouldPackRuleList>
<platformTest>
<type>windows</type>
</platformTest>
</shouldPackRuleList>
</component>
<component>
<name>msfs2024</name>
<description>MSFS2024: Flight Sim 2024</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>
MS Flight Simulator 2024 Simulator Plugin
This plugin acts as the interface between swift and MSFS2024.
</detailedDescription>
<selected>1</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>windows</platforms>
<distributionFileList>
<distributionFile>
<origin>../../dist/bin/plugins/simulator/simulatormsfs2024.dll</origin>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
<shouldPackRuleList>
<platformTest>
<type>windows</type>
</platformTest>
</shouldPackRuleList>
</component>
<component>
<name>p3d</name>
<description>PREPAR3D</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>
LM Prepar3D Simulator Plugin
This plugin acts as the interface between swift and P3D.
</detailedDescription>
<selected>1</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>windows</platforms>
<distributionFileList>
<distributionFile>
<origin>../../dist/bin/plugins/simulator/simulatorp3d.dll</origin>
</distributionFile>
<distributionFile>
<origin>../../dist/bin/plugins/simulator/simulatorp3dconfig.dll</origin>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
<shouldPackRuleList>
<platformTest>
<type>windows</type>
</platformTest>
</shouldPackRuleList>
</component>
<component>
<name>xplane</name>
<description>X-Plane</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>
X-Plane Simulator Plugin
This plugin acts as the interface between swift and X-Plane
</detailedDescription>
<selected>1</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>all</platforms>
<distributionFileList>
<distributionFile>
<allowWildcards>1</allowWildcards>
<origin>../../dist/bin/plugins/simulator/*simulatorxplane*</origin>
<excludeFiles>*/*.pdb;*/*.debug;*/*.dSYM</excludeFiles>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
</component>
<component>
<name>flightgear</name>
<description>FlightGear</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>
FlightGear Simulator Plugin
This plugin acts as the interface between swift and FlightGear
</detailedDescription>
<selected>1</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>all</platforms>
<distributionFileList>
<distributionFile>
<allowWildcards>1</allowWildcards>
<origin>../../dist/bin/plugins/simulator/*simulatorflightgear*</origin>
<excludeFiles>*/*.pdb;*/*.debug;*/*.dSYM</excludeFiles>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
</component>
<component>
<name>emulated</name>
<description>Emulated Simulator</description>
<canBeEdited>1</canBeEdited>
<detailedDescription>
Emulated Simulator Plugin
This plugin emulates a running simulator. Use this for testing swift only
</detailedDescription>
<selected>0</selected>
<show>1</show>
<folderList>
<folder>
<description>bin/plugins/simulator</description>
<destination>${installdir}/bin/plugins/simulator</destination>
<name>bin_plugins_simulator</name>
<platforms>all</platforms>
<distributionFileList>
<distributionFile>
<allowWildcards>1</allowWildcards>
<origin>../../dist/bin/plugins/simulator/*simulatoremulated*</origin>
<excludeFiles>*/*.pdb;*/*.debug;*/*.dSYM</excludeFiles>
</distributionFile>
</distributionFileList>
</folder>
</folderList>
</component>
</componentList>
</componentGroup>

View File

@@ -30,6 +30,9 @@ namespace swift::config
//! with MSFS support?
static constexpr bool isCompiledWithMSFSSupport(); // defined in buildconfig_gen.inc.in
//! with MSFS2024 support?
static constexpr bool isCompiledWithMSFS2024Support(); // defined in buildconfig_gen.inc.in
//! with FSUIPC support?
static constexpr bool isCompiledWithFsuipcSupport(); // defined in buildconfig_gen.inc.in

View File

@@ -14,7 +14,7 @@ namespace swift::config
{
constexpr bool CBuildConfig::isCompiledWithMsFlightSimulatorSupport()
{
return CBuildConfig::isCompiledWithFs9Support() || CBuildConfig::isCompiledWithFsxSupport() || CBuildConfig::isCompiledWithP3DSupport() || isCompiledWithMSFSSupport();
return CBuildConfig::isCompiledWithFs9Support() || CBuildConfig::isCompiledWithFsxSupport() || CBuildConfig::isCompiledWithP3DSupport() || isCompiledWithMSFSSupport() || isCompiledWithMSFS2024Support();
}
constexpr bool CBuildConfig::isCompiledWithFlightSimulatorSupport()

View File

@@ -25,7 +25,7 @@ constexpr bool swift::config::CBuildConfig::isCompiledWithFsxSupport()
constexpr bool swift::config::CBuildConfig::isCompiledWithFsuipcSupport()
{
return isCompiledWithFsxSupport() || isCompiledWithP3DSupport() || isCompiledWithFs9Support() || isCompiledWithMSFSSupport();
return isCompiledWithFsxSupport() || isCompiledWithP3DSupport() || isCompiledWithFs9Support() || isCompiledWithMSFSSupport() || isCompiledWithMSFS2024Support();
}
constexpr bool swift::config::CBuildConfig::isCompiledWithXPlaneSupport()
@@ -43,6 +43,11 @@ constexpr bool swift::config::CBuildConfig::isCompiledWithMSFSSupport()
return SWIFTCONFIG_${SWIFT_BUILD_MSFS_PLUGIN};
}
constexpr bool swift::config::CBuildConfig::isCompiledWithMSFS2024Support()
{
return SWIFTCONFIG_${SWIFT_BUILD_MSFS2024_PLUGIN};
}
constexpr int swift::config::CBuildConfig::versionMajor() { return ${SWIFT_VERSION_MAJOR}; }
constexpr int swift::config::CBuildConfig::versionMinor() { return ${SWIFT_VERSION_MINOR}; }

View File

@@ -53,6 +53,7 @@ namespace swift::core::fsd
MSFS2004, /*!< MS Flight Simulator 2004 */
MSFSX, /*!< MS Flight Simulator X */
MSFS, /*!< MS Flight Simulator 2020 */
MSFS2024, /*!< MS Flight Simulator 2024 */
XPLANE8, /*!< X-Plane 8 */
XPLANE9, /*!< X-Plane 9 */
XPLANE10, /*!< X-Plane 10 */

View File

@@ -205,6 +205,7 @@ namespace swift::core::fsd
case CSimulatorInfo::FG: m_simType = SimType::FlightGear; break;
case CSimulatorInfo::XPLANE: m_simType = SimType::XPLANE11; break;
case CSimulatorInfo::MSFS: m_simType = SimType::MSFS; break;
case CSimulatorInfo::MSFS2024: m_simType = SimType::MSFS2024; break;
default: m_simType = SimType::Unknown; break;
}
m_simTypeInfo = CSimulatorInfo(simulator);

View File

@@ -168,6 +168,8 @@ namespace swift::core::fsd
case SimType::MSCFS3: return "7";
case SimType::MSFS2004: return "8";
case SimType::MSFSX: return "9";
case SimType::MSFS: return "10";
case SimType::MSFS2024: return "11";
case SimType::XPLANE8: return "12";
case SimType::XPLANE9: return "13";
case SimType::XPLANE10: return "14";
@@ -178,10 +180,10 @@ namespace swift::core::fsd
case SimType::P3Dv3: return "30";
case SimType::P3Dv4: return "30";
// future versions
// future versions
case SimType::XPLANE12:
case SimType::P3Dv5:
case SimType::MSFS: return "0";
case SimType::P3Dv5: return "0";
}
Q_UNREACHABLE();
@@ -215,6 +217,10 @@ namespace swift::core::fsd
return SimType::MSFS2004;
else if (str == "9")
return SimType::MSFSX;
else if (str == "10")
return SimType::MSFS;
else if (str == "11")
return SimType::MSFS2024;
else if (str == "12")
return SimType::XPLANE8;
else if (str == "13")

View File

@@ -59,6 +59,8 @@ namespace swift::gui::components
(sims.isFS9() || !CFsDirectories::fs9Dir().isEmpty()) && CBuildConfig::isCompiledWithFs9Support();
const bool msfs =
(sims.isMSFS() || !CFsDirectories::msfsDir().isEmpty()) && CBuildConfig::isCompiledWithMSFSSupport();
const bool msfs2024 = (sims.isMSFS2024() || !CFsDirectories::msfs2024Dir().isEmpty()) &&
CBuildConfig::isCompiledWithMSFS2024Support();
const bool xp = sims.isXPlane() && CBuildConfig::isCompiledWithXPlaneSupport();
const bool fg = sims.isFG() && CBuildConfig::isCompiledWithFGSupport();
@@ -68,6 +70,7 @@ namespace swift::gui::components
ui->cb_XP->setChecked(xp);
ui->cb_FG->setChecked(fg);
ui->cb_MSFS->setChecked(msfs);
ui->cb_MSFS2024->setChecked(msfs2024);
ui->cb_P3D->setEnabled(CBuildConfig::isCompiledWithP3DSupport());
ui->cb_FSX->setEnabled(CBuildConfig::isCompiledWithFsxSupport());
@@ -75,6 +78,7 @@ namespace swift::gui::components
ui->cb_XP->setEnabled(CBuildConfig::isCompiledWithXPlaneSupport());
ui->cb_FG->setEnabled(CBuildConfig::isCompiledWithFGSupport());
ui->cb_MSFS->setEnabled(CBuildConfig::isCompiledWithMSFSSupport());
ui->cb_MSFS2024->setEnabled(CBuildConfig::isCompiledWithMSFS2024Support());
CGuiUtility::checkBoxReadOnly(ui->cb_P3D, !CBuildConfig::isCompiledWithP3DSupport());
CGuiUtility::checkBoxReadOnly(ui->cb_FSX, !CBuildConfig::isCompiledWithFsxSupport());
@@ -82,6 +86,7 @@ namespace swift::gui::components
CGuiUtility::checkBoxReadOnly(ui->cb_XP, !CBuildConfig::isCompiledWithXPlaneSupport());
CGuiUtility::checkBoxReadOnly(ui->cb_FG, !CBuildConfig::isCompiledWithFGSupport());
CGuiUtility::checkBoxReadOnly(ui->cb_MSFS, !CBuildConfig::isCompiledWithMSFSSupport());
CGuiUtility::checkBoxReadOnly(ui->cb_MSFS2024, !CBuildConfig::isCompiledWithMSFS2024Support());
if (p3d) { ui->comp_SettingsSimulator->setSimulator(CSimulatorInfo(CSimulatorInfo::P3D)); }
else if (fsx) { ui->comp_SettingsSimulator->setSimulator(CSimulatorInfo(CSimulatorInfo::FSX)); }
@@ -89,6 +94,7 @@ namespace swift::gui::components
else if (xp) { ui->comp_SettingsSimulator->setSimulator(CSimulatorInfo(CSimulatorInfo::XPLANE)); }
else if (fg) { ui->comp_SettingsSimulator->setSimulator(CSimulatorInfo(CSimulatorInfo::FG)); }
else if (msfs) { ui->comp_SettingsSimulator->setSimulator(CSimulatorInfo(CSimulatorInfo::MSFS)); }
else if (msfs2024) { ui->comp_SettingsSimulator->setSimulator(CSimulatorInfo(CSimulatorInfo::MSFS2024)); }
}
QStringList CConfigSimulatorComponent::selectedSimsToPluginIds()
@@ -102,6 +108,7 @@ namespace swift::gui::components
if (ui->cb_XP->isChecked()) { ids << CSimulatorPluginInfo::xplanePluginIdentifier(); }
if (ui->cb_FG->isChecked()) { ids << CSimulatorPluginInfo::fgPluginIdentifier(); }
if (ui->cb_MSFS->isChecked()) { ids << CSimulatorPluginInfo::msfsPluginIdentifier(); }
if (ui->cb_MSFS2024->isChecked()) { ids << CSimulatorPluginInfo::msfs2024PluginIdentifier(); }
return ids;
}

View File

@@ -92,6 +92,13 @@
</property>
</widget>
</item>
<item row="1" column="6" alignment="Qt::AlignHCenter">
<widget class="QCheckBox" name="cb_MSFS2024">
<property name="text">
<string>MSFS2024 (64-bit)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -393,6 +393,19 @@ namespace swift::gui::components
}
menuActions.addAction(m_loadActions[5], CMenuAction::pathSimulator());
}
if (sims.isMSFS2024())
{
if (!m_loadActions[6])
{
m_loadActions[6] = new QAction(CIcons::appModels16(), "MSFS2024 models", this);
connect(m_loadActions[6], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) {
if (!ownModelsComp) { return; }
Q_UNUSED(checked)
ownModelsComp->setSimulator(CSimulatorInfo::msfs2024(), true);
});
}
menuActions.addAction(m_loadActions[6], CMenuAction::pathSimulator());
}
// with models loaded I allow a refresh reload
// I need those models because I want to merge with DB data in the loader
@@ -400,8 +413,9 @@ namespace swift::gui::components
{
if (m_reloadActions.isEmpty())
{
m_reloadActions = QList<QAction *>({ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr });
m_reloadActions =
QList<QAction *>({ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr });
}
menuActions.addMenu(CIcons::refresh16(), "Force model reload",
CMenuAction::pathSimulatorModelsReload());
@@ -571,6 +585,33 @@ namespace swift::gui::components
menuActions.addAction(m_reloadActions[10], CMenuAction::pathSimulatorModelsReload());
menuActions.addAction(m_reloadActions[11], CMenuAction::pathSimulatorModelsReload());
}
if (sims.isMSFS2024())
{
if (!m_reloadActions[12])
{
m_reloadActions[12] = new QAction(CIcons::appModels16(), "MSFS2024 models", this);
connect(m_reloadActions[12], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) {
if (!ownModelsComp) { return; }
Q_UNUSED(checked)
ownModelsComp->requestSimulatorModels(CSimulatorInfo::msfs2024(),
IAircraftModelLoader::InBackgroundNoCache);
});
m_reloadActions[13] = new QAction(CIcons::appModels16(), "MSFS2024 models from directoy", this);
connect(m_reloadActions[13], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) {
if (!ownModelsComp) { return; }
Q_UNUSED(checked)
const CSimulatorInfo sim(CSimulatorInfo::MSFS2024);
const QString dir = ownModelsComp->directorySelector(sim);
if (!dir.isEmpty())
{
ownModelsComp->requestSimulatorModels(sim, IAircraftModelLoader::InBackgroundNoCache,
QStringList(dir));
}
});
}
menuActions.addAction(m_reloadActions[12], CMenuAction::pathSimulatorModelsReload());
menuActions.addAction(m_reloadActions[13], CMenuAction::pathSimulatorModelsReload());
}
}
else
{
@@ -582,7 +623,8 @@ namespace swift::gui::components
if (m_clearCacheActions.isEmpty())
{
m_clearCacheActions = QList<QAction *>({ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr });
m_clearCacheActions =
QList<QAction *>({ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr });
}
menuActions.addMenu(CIcons::delete16(), "Clear model caches", CMenuAction::pathSimulatorModelsClearCache());
if (sims.isFSX())
@@ -590,7 +632,7 @@ namespace swift::gui::components
if (!m_clearCacheActions[0])
{
m_clearCacheActions[0] = new QAction(CIcons::appModels16(), "Clear FSX cache", this);
connect(m_loadActions[0], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) {
connect(m_clearCacheActions[0], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) {
if (!ownModelsComp) { return; }
Q_UNUSED(checked)
ownModelsComp->clearSimulatorCache(CSimulatorInfo::fsx());
@@ -663,6 +705,19 @@ namespace swift::gui::components
}
menuActions.addAction(m_clearCacheActions[5], CMenuAction::pathSimulatorModelsClearCache());
}
if (sims.isMSFS2024())
{
if (!m_clearCacheActions[6])
{
m_clearCacheActions[6] = new QAction(CIcons::appModels16(), "Clear MSFS2024 cache", this);
connect(m_clearCacheActions[6], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) {
if (!ownModelsComp) { return; }
Q_UNUSED(checked)
ownModelsComp->clearSimulatorCache(CSimulatorInfo::msfs2024());
});
}
menuActions.addAction(m_clearCacheActions[6], CMenuAction::pathSimulatorModelsClearCache());
}
if (sims.isXPlane() && CBuildConfig::isRunningOnWindowsNtPlatform() && CBuildConfig::buildWordSize() == 64)
{

View File

@@ -604,6 +604,22 @@ namespace swift::gui::components
});
m_setNewActions.append(a);
}
if (sims.isMSFS2024())
{
QAction *a = new QAction(CIcons::appModels16(), "MSFS2024 models", this);
connect(a, &QAction::triggered, ownModelSetComp, [ownModelSetComp](bool checked) {
Q_UNUSED(checked)
ownModelSetComp->setSimulator(CSimulatorInfo(CSimulatorInfo::MSFS2024));
});
m_setActions.append(a);
a = new QAction(CIcons::appModels16(), "New set MSFS2024 models", this);
connect(a, &QAction::triggered, ownModelSetComp, [ownModelSetComp](bool checked) {
Q_UNUSED(checked)
ownModelSetComp->setModelSet(CAircraftModelList(), CSimulatorInfo(CSimulatorInfo::MSFS2024));
});
m_setNewActions.append(a);
}
QAction *a = new QAction(CIcons::appDistributors16(), "Apply distributor preferences", this);
connect(a, &QAction::triggered, ownModelSetComp,

View File

@@ -38,6 +38,7 @@ namespace swift::gui::components
connect(ui->rb_FG, &QRadioButton::toggled, this, &CSimulatorSelector::radioButtonChanged);
connect(ui->rb_XPlane, &QRadioButton::toggled, this, &CSimulatorSelector::radioButtonChanged);
connect(ui->rb_MSFS, &QRadioButton::toggled, this, &CSimulatorSelector::radioButtonChanged);
connect(ui->rb_MSFS2024, &QRadioButton::toggled, this, &CSimulatorSelector::radioButtonChanged);
connect(ui->cb_FS9, &QRadioButton::toggled, this, &CSimulatorSelector::checkBoxChanged);
connect(ui->cb_FSX, &QRadioButton::toggled, this, &CSimulatorSelector::checkBoxChanged);
@@ -45,6 +46,7 @@ namespace swift::gui::components
connect(ui->cb_FG, &QRadioButton::toggled, this, &CSimulatorSelector::checkBoxChanged);
connect(ui->cb_XPlane, &QRadioButton::toggled, this, &CSimulatorSelector::checkBoxChanged);
connect(ui->cb_MSFS, &QRadioButton::toggled, this, &CSimulatorSelector::checkBoxChanged);
connect(ui->cb_MSFS2024, &QRadioButton::toggled, this, &CSimulatorSelector::checkBoxChanged);
connect(ui->cb_Simulators, &QComboBox::currentTextChanged, this, &CSimulatorSelector::comboBoxChanged);
}
@@ -79,10 +81,12 @@ namespace swift::gui::components
default:
case CheckBoxes:
return CSimulatorInfo(ui->cb_FSX->isChecked(), ui->cb_FS9->isChecked(), ui->cb_XPlane->isChecked(),
ui->cb_P3D->isChecked(), ui->cb_FG->isChecked(), ui->cb_MSFS->isChecked());
ui->cb_P3D->isChecked(), ui->cb_FG->isChecked(), ui->cb_MSFS->isChecked(),
ui->cb_MSFS2024->isChecked());
case RadioButtons:
return CSimulatorInfo(ui->rb_FSX->isChecked(), ui->rb_FS9->isChecked(), ui->rb_XPlane->isChecked(),
ui->rb_P3D->isChecked(), ui->rb_FG->isChecked(), ui->rb_MSFS->isChecked());
ui->rb_P3D->isChecked(), ui->rb_FG->isChecked(), ui->rb_MSFS->isChecked(),
ui->rb_MSFS2024->isChecked());
case ComboBox: return CSimulatorInfo(ui->cb_Simulators->currentText());
}
}
@@ -99,6 +103,7 @@ namespace swift::gui::components
ui->cb_P3D->setChecked(simulator.isP3D());
ui->cb_FG->setChecked(simulator.isFG());
ui->cb_MSFS->setChecked(simulator.isMSFS());
ui->cb_MSFS2024->setChecked(simulator.isMSFS2024());
// Combo
ui->cb_Simulators->setCurrentText(simulator.toQString(true));
@@ -134,6 +139,11 @@ namespace swift::gui::components
ui->rb_MSFS->setChecked(simulator.isMSFS());
return;
}
if (simulator.isMSFS2024())
{
ui->rb_MSFS2024->setChecked(simulator.isMSFS2024());
return;
}
}
void CSimulatorSelector::setToLastSelection()
@@ -211,6 +221,7 @@ namespace swift::gui::components
ui->cb_P3D->setChecked(true);
ui->cb_FG->setChecked(true);
ui->cb_MSFS->setChecked(true);
ui->cb_MSFS2024->setChecked(true);
// radio
ui->rb_P3D->setChecked(true);
@@ -225,6 +236,7 @@ namespace swift::gui::components
ui->cb_P3D->setChecked(false);
ui->cb_FG->setChecked(false);
ui->cb_MSFS->setChecked(false);
ui->cb_MSFS2024->setChecked(false);
}
bool CSimulatorSelector::isUnselected() const
@@ -235,11 +247,13 @@ namespace swift::gui::components
default:
case CheckBoxes:
c = ui->cb_FSX->isChecked() || ui->cb_FS9->isChecked() || ui->cb_XPlane->isChecked() ||
ui->cb_P3D->isChecked() || ui->cb_FG->isChecked() || ui->cb_MSFS->isChecked();
ui->cb_P3D->isChecked() || ui->cb_FG->isChecked() || ui->cb_MSFS->isChecked() ||
ui->cb_MSFS2024->isChecked();
break;
case RadioButtons:
c = ui->rb_FSX->isChecked() || ui->rb_FS9->isChecked() || ui->rb_XPlane->isChecked() ||
ui->rb_P3D->isChecked() || ui->rb_FG->isChecked() || ui->rb_MSFS->isChecked();
ui->rb_P3D->isChecked() || ui->rb_FG->isChecked() || ui->rb_MSFS->isChecked() ||
ui->rb_MSFS2024->isChecked();
break;
case ComboBox:
const int i = ui->cb_Simulators->currentIndex();
@@ -257,7 +271,8 @@ namespace swift::gui::components
default:
case CheckBoxes:
c = ui->cb_FSX->isChecked() && ui->cb_FS9->isChecked() && ui->cb_XPlane->isChecked() &&
ui->cb_P3D->isChecked() && ui->cb_FG->isChecked() && ui->cb_MSFS->isChecked();
ui->cb_P3D->isChecked() && ui->cb_FG->isChecked() && ui->cb_MSFS->isChecked() &&
ui->cb_MSFS2024->isChecked();
break;
case RadioButtons:
// actually this should never be true
@@ -304,6 +319,7 @@ namespace swift::gui::components
ui->rb_P3D->setEnabled(!readOnly);
ui->rb_FG->setEnabled(!readOnly);
ui->rb_MSFS->setEnabled(!readOnly);
ui->rb_MSFS2024->setEnabled(!readOnly);
ui->cb_Simulators->setEnabled(!readOnly);
@@ -397,5 +413,6 @@ namespace swift::gui::components
ui->cb_Simulators->insertItem(cbi++, CSimulatorInfo::xplane().toQString());
ui->cb_Simulators->insertItem(cbi++, CSimulatorInfo::fg().toQString());
ui->cb_Simulators->insertItem(cbi++, CSimulatorInfo::msfs().toQString());
ui->cb_Simulators->insertItem(cbi++, CSimulatorInfo::msfs2024().toQString());
}
} // namespace swift::gui::components

View File

@@ -95,6 +95,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cb_MSFS2024">
<property name="text">
<string>MSFS2024</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -173,6 +180,13 @@
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rb_MSFS2024">
<property name="text">
<string>MSFS2024</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -106,6 +106,8 @@ namespace swift::misc::simulation
obj.insert("simfs9", QJsonValue(flag));
flag = CDatastoreUtility::boolToDbYN(sim.isMSFS());
obj.insert("simmsfs", QJsonValue(flag));
flag = CDatastoreUtility::boolToDbYN(sim.isMSFS2024());
obj.insert("simmsfs2024", QJsonValue(flag));
flag = CDatastoreUtility::boolToDbYN(sim.isXPlane());
obj.insert("simxplane", QJsonValue(flag));
flag = CDatastoreUtility::boolToDbYN(sim.isFG());

View File

@@ -69,6 +69,11 @@ namespace swift::misc::simulation
if (!m_loaderMsfs) { m_loaderMsfs = this->initLoader(CSimulatorInfo::msfs()); }
return m_loaderMsfs;
}
case CSimulatorInfo::MSFS2024:
{
if (!m_loaderMsfs2024) { m_loaderMsfs2024 = this->initLoader(CSimulatorInfo::msfs2024()); }
return m_loaderMsfs2024;
}
default: Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator"); break;
}
return nullptr;

View File

@@ -58,6 +58,7 @@ namespace swift::misc::simulation
IAircraftModelLoader *m_loaderFS9 = nullptr;
IAircraftModelLoader *m_loaderFG = nullptr;
IAircraftModelLoader *m_loaderMsfs = nullptr;
IAircraftModelLoader *m_loaderMsfs2024 = nullptr;
//! Init the loader
IAircraftModelLoader *initLoader(const CSimulatorInfo &simulator);

View File

@@ -193,6 +193,12 @@ namespace swift::misc::simulation
models, validModels, invalidModels, ignoreEmpty, stopAtFailedFiles, wasStopped, simulatorDir);
specificTests.push_back(specificTests2);
}
else if (simulator.isMSFS2024())
{
const CStatusMessageList specificTests2 = fscommon::CFsCommonUtil::validateMSFS2024SimObjectsPath(
models, validModels, invalidModels, ignoreEmpty, stopAtFailedFiles, wasStopped, simulatorDir);
specificTests.push_back(specificTests2);
}
}
else if (simulator.isXPlane() || models.isLikelyXPlaneModelList())
{

View File

@@ -221,6 +221,7 @@ namespace swift::misc::simulation
this->insert("testModelString5", CSimulatorInfo::fsx());
this->insert("testModelString6", CSimulatorInfo::fsx());
this->insert("testModelString7", CSimulatorInfo::msfs());
this->insert("testModelString8", CSimulatorInfo::msfs2024());
}
const QString &CAutoPublishData::fileBaseName()

View File

@@ -42,11 +42,12 @@ namespace swift::misc::simulation::data
QString IMultiSimulatorModelCaches::getInfoStringFsFamily() const
{
static const QString is("FSX: %1, P3D: %2, FS9: %3, MSFS: %4");
static const QString is("FSX: %1, P3D: %2, FS9: %3, MSFS: %4, MSFS2024: %5");
return is.arg(this->getCachedModelsCount(CSimulatorInfo::FSX))
.arg(this->getCachedModelsCount(CSimulatorInfo::P3D))
.arg(this->getCachedModelsCount(CSimulatorInfo::FS9))
.arg(this->getCachedModelsCount(CSimulatorInfo::MSFS));
.arg(this->getCachedModelsCount(CSimulatorInfo::MSFS))
.arg(this->getCachedModelsCount(CSimulatorInfo::MSFS2024));
}
QString IMultiSimulatorModelCaches::getCacheCountAndTimestamp(const CSimulatorInfo &simulator) const
@@ -72,6 +73,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: m_syncXPlane = synchronized; break;
case CSimulatorInfo::FG: m_syncFG = synchronized; break;
case CSimulatorInfo::MSFS: m_syncMsfs = synchronized; break;
case CSimulatorInfo::MSFS2024: m_syncMsfs2024 = synchronized; break;
default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); break;
}
}
@@ -102,6 +104,10 @@ namespace swift::misc::simulation::data
if (this->hasOtherVersionFile(info, CSimulatorInfo::fg())) { sim.addSimulator(CSimulatorInfo::fg()); }
if (this->hasOtherVersionFile(info, CSimulatorInfo::xplane())) { sim.addSimulator(CSimulatorInfo::xplane()); }
if (this->hasOtherVersionFile(info, CSimulatorInfo::msfs())) { sim.addSimulator(CSimulatorInfo::msfs()); }
if (this->hasOtherVersionFile(info, CSimulatorInfo::msfs2024()))
{
sim.addSimulator(CSimulatorInfo::msfs2024());
}
return sim;
}
@@ -114,6 +120,7 @@ namespace swift::misc::simulation::data
this->getFilename(CSimulatorInfo::XPLANE),
this->getFilename(CSimulatorInfo::FG),
this->getFilename(CSimulatorInfo::MSFS),
this->getFilename(CSimulatorInfo::MSFS2024),
});
}
@@ -207,6 +214,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: return m_modelCacheXP.get();
case CSimulatorInfo::FG: return m_modelCacheFG.get();
case CSimulatorInfo::MSFS: return m_modelCacheMsfs.get();
case CSimulatorInfo::MSFS2024: return m_modelCacheMsfs2024.get();
default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return CAircraftModelList();
}
}
@@ -226,6 +234,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: msg = m_modelCacheXP.set(setModels); break;
case CSimulatorInfo::FG: msg = m_modelCacheFG.set(setModels); break;
case CSimulatorInfo::MSFS: msg = m_modelCacheMsfs.set(setModels); break;
case CSimulatorInfo::MSFS2024: msg = m_modelCacheMsfs2024.set(setModels); break;
default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return CStatusMessage();
}
this->emitCacheChanged(simulator); // set
@@ -249,6 +258,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: return m_syncXPlane;
case CSimulatorInfo::FG: return m_syncFG;
case CSimulatorInfo::MSFS: return m_syncMsfs;
case CSimulatorInfo::MSFS2024: return m_syncMsfs2024;
default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); break;
}
return false;
@@ -281,6 +291,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: return m_modelCacheXP.getAvailableTimestamp();
case CSimulatorInfo::FG: return m_modelCacheFG.getAvailableTimestamp();
case CSimulatorInfo::MSFS: return m_modelCacheMsfs.getAvailableTimestamp();
case CSimulatorInfo::MSFS2024: return m_modelCacheMsfs2024.getAvailableTimestamp();
default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return QDateTime();
}
}
@@ -300,6 +311,8 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: return m_modelCacheXP.set(m_modelCacheXP.get(), ts.toMSecsSinceEpoch());
case CSimulatorInfo::FG: return m_modelCacheFG.set(m_modelCacheFG.get(), ts.toMSecsSinceEpoch());
case CSimulatorInfo::MSFS: return m_modelCacheMsfs.set(m_modelCacheMsfs.get(), ts.toMSecsSinceEpoch());
case CSimulatorInfo::MSFS2024:
return m_modelCacheMsfs2024.set(m_modelCacheMsfs2024.get(), ts.toMSecsSinceEpoch());
default: Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator"); break;
}
return CStatusMessage();
@@ -320,6 +333,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: return m_modelCacheXP.getFilename();
case CSimulatorInfo::FG: return m_modelCacheFG.getFilename();
case CSimulatorInfo::MSFS: return m_modelCacheMsfs.getFilename();
case CSimulatorInfo::MSFS2024: return m_modelCacheMsfs2024.getFilename();
default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); break;
}
return {};
@@ -336,6 +350,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: return m_modelCacheXP.isSaved();
case CSimulatorInfo::FG: return m_modelCacheFG.isSaved();
case CSimulatorInfo::MSFS: return m_modelCacheMsfs.isSaved();
case CSimulatorInfo::MSFS2024: return m_modelCacheMsfs2024.isSaved();
default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); break;
}
return false;
@@ -354,6 +369,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: m_modelCacheXP.synchronize(); break;
case CSimulatorInfo::FG: m_modelCacheFG.synchronize(); break;
case CSimulatorInfo::MSFS: m_modelCacheMsfs.synchronize(); break;
case CSimulatorInfo::MSFS2024: m_modelCacheMsfs2024.synchronize(); break;
default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); break;
}
this->markCacheAsAlreadySynchronized(simulator, true);
@@ -373,6 +389,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: m_modelCacheXP.admit(); break;
case CSimulatorInfo::FG: m_modelCacheFG.admit(); break;
case CSimulatorInfo::MSFS: m_modelCacheMsfs.admit(); break;
case CSimulatorInfo::MSFS2024: m_modelCacheMsfs2024.admit(); break;
default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); break;
}
return true;
@@ -414,6 +431,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: return m_modelCacheXP.get();
case CSimulatorInfo::FG: return m_modelCacheFG.get();
case CSimulatorInfo::MSFS: return m_modelCacheMsfs.get();
case CSimulatorInfo::MSFS2024: return m_modelCacheMsfs2024.get();
default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return CAircraftModelList();
}
}
@@ -444,6 +462,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: msg = m_modelCacheXP.set(orderedModels); break;
case CSimulatorInfo::FG: msg = m_modelCacheFG.set(orderedModels); break;
case CSimulatorInfo::MSFS: msg = m_modelCacheMsfs.set(orderedModels); break;
case CSimulatorInfo::MSFS2024: msg = m_modelCacheMsfs2024.set(orderedModels); break;
default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return CStatusMessage();
}
this->emitCacheChanged(simulator); // set
@@ -461,6 +480,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: return m_modelCacheXP.getAvailableTimestamp();
case CSimulatorInfo::FG: return m_modelCacheFG.getAvailableTimestamp();
case CSimulatorInfo::MSFS: return m_modelCacheMsfs.getAvailableTimestamp();
case CSimulatorInfo::MSFS2024: return m_modelCacheMsfs2024.getAvailableTimestamp();
default: Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator"); return QDateTime();
}
}
@@ -480,6 +500,8 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: return m_modelCacheXP.set(m_modelCacheXP.get(), ts.toMSecsSinceEpoch());
case CSimulatorInfo::FG: return m_modelCacheFG.set(m_modelCacheFG.get(), ts.toMSecsSinceEpoch());
case CSimulatorInfo::MSFS: return m_modelCacheMsfs.set(m_modelCacheMsfs.get(), ts.toMSecsSinceEpoch());
case CSimulatorInfo::MSFS2024:
return m_modelCacheMsfs2024.set(m_modelCacheMsfs2024.get(), ts.toMSecsSinceEpoch());
default: Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator"); break;
}
return CStatusMessage();
@@ -500,6 +522,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: return m_modelCacheXP.getFilename();
case CSimulatorInfo::FG: return m_modelCacheFG.getFilename();
case CSimulatorInfo::MSFS: return m_modelCacheMsfs.getFilename();
case CSimulatorInfo::MSFS2024: return m_modelCacheMsfs2024.getFilename();
default: Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator"); break;
}
return {};
@@ -516,6 +539,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: return m_modelCacheXP.isSaved();
case CSimulatorInfo::FG: return m_modelCacheFG.isSaved();
case CSimulatorInfo::MSFS: return m_modelCacheMsfs.isSaved();
case CSimulatorInfo::MSFS2024: return m_modelCacheMsfs2024.isSaved();
default: Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator"); break;
}
return false;
@@ -534,6 +558,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: m_modelCacheXP.synchronize(); break;
case CSimulatorInfo::FG: m_modelCacheFG.synchronize(); break;
case CSimulatorInfo::MSFS: m_modelCacheMsfs.synchronize(); break;
case CSimulatorInfo::MSFS2024: m_modelCacheMsfs2024.synchronize(); break;
default: Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator"); break;
}
this->markCacheAsAlreadySynchronized(simulator, true);
@@ -553,6 +578,7 @@ namespace swift::misc::simulation::data
case CSimulatorInfo::XPLANE: m_modelCacheXP.admit(); break;
case CSimulatorInfo::FG: m_modelCacheFG.admit(); break;
case CSimulatorInfo::MSFS: m_modelCacheMsfs.admit(); break;
case CSimulatorInfo::MSFS2024: m_modelCacheMsfs2024.admit(); break;
default: Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator"); break;
}
return true;

View File

@@ -74,6 +74,13 @@ namespace swift::misc::simulation::data
static const char *key() { return "modelcachemsfs"; }
};
//! MSFS2024
struct TModelCacheMsfs2024 : public TModelCache
{
//! Key in data cache
static const char *key() { return "modelcachemsfs2024"; }
};
//! Last selection
struct TModelCacheLastSelection : public TDataTrait<CSimulatorInfo>
{
@@ -133,6 +140,13 @@ namespace swift::misc::simulation::data
static const char *key() { return "modelsetmsfs"; }
};
//! MSFS2024
struct TModelSetCacheMsfs2024 : public TModelCache
{
//! Key in data cache
static const char *key() { return "modelsetmsfs2024"; }
};
//! Last selection
struct TSimulatorLastSelection : public TDataTrait<CSimulatorInfo>
{
@@ -296,6 +310,7 @@ namespace swift::misc::simulation::data
void changedXP() { this->emitCacheChanged(CSimulatorInfo::xplane()); }
void changedFG() { this->emitCacheChanged(CSimulatorInfo::fg()); }
void changedMsfs() { this->emitCacheChanged(CSimulatorInfo::msfs()); }
void changedMsfs2024() { this->emitCacheChanged(CSimulatorInfo::msfs2024()); }
//! @}
//! Is the cache already synchronized?
@@ -314,6 +329,7 @@ namespace swift::misc::simulation::data
std::atomic_bool m_syncFG { false };
std::atomic_bool m_syncXPlane { false };
std::atomic_bool m_syncMsfs { false };
std::atomic_bool m_syncMsfs2024 { false };
//! @}
};
@@ -350,6 +366,7 @@ namespace swift::misc::simulation::data
CData<TModelCacheXP> m_modelCacheXP { this, &CModelCaches::changedXP }; //!< XP cache
CData<TModelCacheFG> m_modelCacheFG { this, &CModelCaches::changedFG }; //!< XP cache
CData<TModelCacheMsfs> m_modelCacheMsfs { this, &CModelCaches::changedMsfs }; //!< MSFS cache
CData<TModelCacheMsfs2024> m_modelCacheMsfs2024 { this, &CModelCaches::changedMsfs2024 }; //!< MSFS2024 cache
//! Non virtual version (can be used in ctor)
void synchronizeCacheImpl(const CSimulatorInfo &simulator);
@@ -392,6 +409,8 @@ namespace swift::misc::simulation::data
CData<TModelSetCacheXP> m_modelCacheXP { this, &CModelSetCaches::changedXP }; //!< XP cache
CData<TModelSetCacheFG> m_modelCacheFG { this, &CModelSetCaches::changedFG }; //!< FG cache
CData<TModelSetCacheMsfs> m_modelCacheMsfs { this, &CModelSetCaches::changedMsfs }; //!< MSFS cache
CData<TModelSetCacheMsfs2024> m_modelCacheMsfs2024 { this,
&CModelSetCaches::changedMsfs2024 }; //!< MSFS2024 cache
//! Non virtual version (can be used in ctor)
void synchronizeCacheImpl(const CSimulatorInfo &simulator);

View File

@@ -229,7 +229,8 @@ namespace swift::misc::simulation
const QSet<QString> &CDistributor::standardAllFsFamily()
{
static const QSet<QString> fsFamily({ standardFS9(), standardFSX(), standardP3D(), standardMsfs() });
static const QSet<QString> fsFamily(
{ standardFS9(), standardFSX(), standardP3D(), standardMsfs(), standardMsfs2024() });
return fsFamily;
}
@@ -257,6 +258,12 @@ namespace swift::misc::simulation
return k;
}
const QString &CDistributor::standardMsfs2024()
{
static const QString k("MSFS2024");
return k;
}
QString CDistributor::unifyKeyOrAlias(const QString &value)
{
return removeChars(value.trimmed().toUpper(), [](QChar c) { return !c.isLetterOrNumber(); });

View File

@@ -133,6 +133,7 @@ namespace swift::misc::simulation
static const QString &xplaneBlueBell();
static const QString &xplaneXcsl();
static const QString &standardMsfs();
static const QString &standardMsfs2024();
//! @}
private:

View File

@@ -22,6 +22,7 @@ namespace swift::misc::simulation
case CSimulatorInfo::FG: return m_distributorsFG;
case CSimulatorInfo::XPLANE: return m_distributorsXPlane;
case CSimulatorInfo::MSFS: return m_distributorsMsfs;
case CSimulatorInfo::MSFS2024: return m_distributorsMsfs2024;
default: Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator"); break;
}
@@ -50,6 +51,7 @@ namespace swift::misc::simulation
case CSimulatorInfo::FG: m_distributorsFG = d; break;
case CSimulatorInfo::XPLANE: m_distributorsXPlane = d; break;
case CSimulatorInfo::MSFS: m_distributorsMsfs = d; break;
case CSimulatorInfo::MSFS2024: m_distributorsMsfs2024 = d; break;
default: Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator"); break;
}
}

View File

@@ -53,6 +53,7 @@ namespace swift::misc::simulation
CDistributorList m_distributorsXPlane;
CDistributorList m_distributorsFG;
CDistributorList m_distributorsMsfs;
CDistributorList m_distributorsMsfs2024;
CSimulatorInfo m_lastUpdatedSimulator;
SWIFT_METACLASS(
@@ -63,6 +64,7 @@ namespace swift::misc::simulation
SWIFT_METAMEMBER(distributorsXPlane),
SWIFT_METAMEMBER(distributorsFG),
SWIFT_METAMEMBER(distributorsMsfs),
SWIFT_METAMEMBER(distributorsMsfs2024),
SWIFT_METAMEMBER(lastUpdatedSimulator));
};
} // namespace swift::misc::simulation

View File

@@ -153,8 +153,11 @@ namespace swift::misc::simulation::fscommon
// set directory with name filters, get aircraft.cfg and sub directories
static const QString NoNameFilter;
QDir dir(directory, NoNameFilter, QDir::Name, QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot);
// for MSFS we only need aircraft.cfg
dir.setNameFilters(fileNameFilters(getSimulator().isMSFS()));
// TODO TZ: still have to figure out how msfs2024 handles this
// for MSFS2020 we only need aircraft.cfg
// MSFS2024 has aircraft.cfg only in communityfolder
// a solution for the aircraft from the marketplace may be prepared by ASOBO
dir.setNameFilters(fileNameFilters(getSimulator().isMSFS(), getSimulator().isMSFS2024()));
if (!dir.exists())
{
return CAircraftCfgEntriesList(); // can happen if there are shortcuts or linked dirs not available
@@ -464,9 +467,10 @@ namespace swift::misc::simulation::fscommon
return content;
}
const QStringList &CAircraftCfgParser::fileNameFilters(bool isMSFS)
// TODO TZ: MSFS2024 currently has aircraft.cfg only in the community folder
const QStringList &CAircraftCfgParser::fileNameFilters(bool isMSFS, bool isMSFS2024)
{
if (CBuildConfig::buildWordSize() == 32 || isMSFS)
if (CBuildConfig::buildWordSize() == 32 || isMSFS || isMSFS2024)
{
static const QStringList f({ "aircraft.cfg" });
return f;

View File

@@ -89,7 +89,7 @@ namespace swift::misc
static QString getFixedIniLineContent(const QString &line);
//! Files to be used
static const QStringList &fileNameFilters(bool isMSFS);
static const QStringList &fileNameFilters(bool isMSFS, bool isMSFS2024);
//! Exclude the sub directories not to be parsed
static bool isExcludedSubDirectory(const QString &excludeDirectory);

View File

@@ -230,6 +230,17 @@ namespace swift::misc::simulation::fscommon
stopAtFailedFiles, stopped);
}
CStatusMessageList CFsCommonUtil::validateMSFS2024SimObjectsPath(
const CAircraftModelList &models, CAircraftModelList &validModels, CAircraftModelList &invalidModels,
bool ignoreEmptyFileNames, int stopAtFailedFiles, std::atomic_bool &stopped, const QString &simulatorDir)
{
Q_UNUSED(simulatorDir)
const QStringList simObjectPaths = CFsDirectories::msfs2024SimObjectsDirPath();
return CFsCommonUtil::validateSimObjectsPath(QSet<QString>(simObjectPaths.begin(), simObjectPaths.end()),
models, validModels, invalidModels, ignoreEmptyFileNames,
stopAtFailedFiles, stopped);
}
CStatusMessageList
CFsCommonUtil::validateSimObjectsPath(const QSet<QString> &simObjectDirs, const CAircraftModelList &models,
CAircraftModelList &validModels, CAircraftModelList &invalidModels,

View File

@@ -67,6 +67,15 @@ namespace swift::misc::simulation::fscommon
bool ignoreEmptyFileNames, int stopAtFailedFiles,
std::atomic_bool &wasStopped, const QString &simulatorDir);
//! Validate if known SimObjects path are used
//! \remark only for MSFS2024
static CStatusMessageList validateMSFS2024SimObjectsPath(const CAircraftModelList &models,
CAircraftModelList &validModels,
CAircraftModelList &invalidModels,
bool ignoreEmptyFileNames, int stopAtFailedFiles,
std::atomic_bool &wasStopped,
const QString &simulatorDir);
private:
//! Validate if known SimObjects path are used
//! \remark only for P3D/FSX

View File

@@ -181,9 +181,70 @@ namespace swift::misc::simulation::fscommon
if (!d.exists()) { continue; }
return msfs2024Package;
}
// then we look for steam-edition
for (QString path : locations)
{
// there seems to be no constant for the roaming directory, so we have to do some magic
// https://doc.qt.io/qt-6/qstandardpaths.html
path.replace("Local", "Roaming");
const QString msfsPackage = CFileUtils::appendFilePaths(path, "Microsoft Flight Simulator 2024");
const QString fileName = CFileUtils::appendFilePaths(msfsPackage, "UserCfg.opt");
const QFileInfo fi(fileName);
if (!fi.exists()) { continue; }
return msfsPackage;
}
return {};
}
const QString &CFsDirectories::msfs2024Dir()
{
static const QString dir(msfs2024DirImpl());
return dir;
}
QString msfs2024PackagesDirImpl()
{
QString userCfg = "";
QString msfs2024Directory(CFsDirectories::msfs2024Dir());
// for Steam edition
if (msfs2024Directory.contains("Roaming", Qt::CaseInsensitive))
{
userCfg = CFileUtils::appendFilePaths(msfs2024Directory, "UserCfg.opt");
}
else
{
userCfg = CFileUtils::appendFilePaths(CFileUtils::appendFilePaths(msfs2024Directory, "LocalCache"),
"UserCfg.opt");
}
QFile file(userCfg);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { return {}; }
QTextStream in(&file);
while (!in.atEnd())
{
QString line = in.readLine();
if (line.contains("InstalledPackagesPath"))
{
// change the split separator because of path names with multiple spaces in Steamedition
QStringList split = line.split("\"");
// we have 2 quotation marks in the line so 3 parts
if (split.size() != 3) { return {}; }
QString packagePath = split[1].remove("\"");
const QDir dir(packagePath);
if (dir.exists()) { return packagePath; }
}
}
return {};
}
const QString &CFsDirectories::msfs2024PackagesDir()
{
static const QString dir(msfs2024PackagesDirImpl());
return dir;
}
QString fsxSimObjectsDirFromRegistryImpl()
{
const QString fsxPath = CFileUtils::normalizeFilePathToQtStandard(CFsDirectories::fsxDirFromRegistry());
@@ -211,6 +272,13 @@ namespace swift::misc::simulation::fscommon
return CFileUtils::normalizeFilePathToQtStandard(msfsPackagesDirImpl());
}
QString msfs2024SimObjectsDirImpl()
{
QString dir(CFsDirectories::msfs2024Dir());
if (dir.isEmpty()) { return {}; }
return CFileUtils::normalizeFilePathToQtStandard(msfs2024PackagesDirImpl());
}
const QString &CFsDirectories::fsxSimObjectsDir()
{
static const QString dir(fsxSimObjectsDirImpl());
@@ -223,6 +291,11 @@ namespace swift::misc::simulation::fscommon
return dir;
}
const QString &CFsDirectories::msfs2024SimObjectsDir()
{
static const QString dir(msfs2024SimObjectsDirImpl());
return dir;
}
QString CFsDirectories::fsxSimObjectsDirFromSimDir(const QString &simDir)
{
if (simDir.isEmpty()) { return {}; }
@@ -263,6 +336,16 @@ namespace swift::misc::simulation::fscommon
return exclude;
}
const QStringList &CFsDirectories::msfs2024SimObjectsExcludeDirectoryPatterns()
{
static const QStringList exclude {
"landingchallenge",
"tutorials",
};
return exclude;
}
QString p3dDirFromRegistryImpl()
{
QString p3dPath;
@@ -365,6 +448,12 @@ namespace swift::misc::simulation::fscommon
return Path;
}
QStringList CFsDirectories::msfs2024SimObjectsDirPath(const QString &simObjectsDir)
{
Q_UNUSED(simObjectsDir);
static const QStringList Path { CFsDirectories::msfs2024SimObjectsDir() };
return Path;
}
QStringList CFsDirectories::p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths(const QString &simObjectsDir,
const QString &versionHint)
{

View File

@@ -38,6 +38,9 @@ namespace swift::misc::simulation::fscommon
//! MSFS's simobject dir, resolved from multiple sources
static const QString &msfsSimObjectsDir();
//! MSFS's simobject dir, resolved from multiple sources
static const QString &msfs2024SimObjectsDir();
//! FSX aircraft dir, relative to simulator directory
static QString fsxSimObjectsDirFromSimDir(const QString &simDir);
@@ -47,12 +50,18 @@ namespace swift::misc::simulation::fscommon
//! Exclude directories for simObjects
static const QStringList &msfs20SimObjectsExcludeDirectoryPatterns();
//! Exclude directories for simObjects
static const QStringList &msfs2024SimObjectsExcludeDirectoryPatterns();
//! FSX's simObject dir and the add on dirs
static QStringList fsxSimObjectsDirPlusAddOnXmlSimObjectsPaths(const QString &simObjectsDir = "");
//! MSFS's simObject dir and the add on dirs
static QStringList msfsSimObjectsDirPath(const QString &simObjectsDir = "");
//! MSFS2024's simObject dir and the add on dirs
static QStringList msfs2024SimObjectsDirPath(const QString &simObjectsDir = "");
//! P3D's simObject dir and the add on dirs
static QStringList p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths(const QString &simObjectsDir,
const QString &versionHint);
@@ -84,6 +93,12 @@ namespace swift::misc::simulation::fscommon
//! MSFS's packages dir
static const QString &msfsPackagesDir();
//! MSFS directory from different sources
static const QString &msfs2024Dir();
//! MSFS's packages dir
static const QString &msfs2024PackagesDir();
//! FS9 directory obtained from registry
static const QString &fs9DirFromRegistry();
@@ -126,19 +141,10 @@ namespace swift::misc::simulation::fscommon
//! Get all the SimObjects paths from all config files
static QSet<QString> allFsxSimObjectPaths();
// TODO TZ
//! Get all the SimObjects paths from all config files
// static QSet<QString> allMsfsSimObjectPaths();
//! Find the config files (fsx.cfg)
// C:/Users/Joe Doe/AppData/Roaming/Microsoft/FSX/fsx.cfg
static QStringList findFsxConfigFiles();
// TODO TZ
//! Find the config files (fsx.cfg)
// C:/Users/Joe Doe/AppData/Roaming/Microsoft/FSX/fsx.cfg
// static QStringList findMsfsConfigFiles();
//! Get all the SimObjects paths from fsx.cfg
// SimObjectPaths.0=SimObjects\Airplanes
static QSet<QString> fsxSimObjectsPaths(const QStringList &fsxFiles, bool checked);

View File

@@ -197,6 +197,7 @@ namespace swift::misc::simulation::settings
case CSimulatorInfo::FSX: return m_simSettingsFsx.get();
case CSimulatorInfo::P3D: return m_simSettingsP3D.get();
case CSimulatorInfo::MSFS: return m_simSettingsMsfs.get();
case CSimulatorInfo::MSFS2024: return m_simSettingsMsfs2024.get();
case CSimulatorInfo::XPLANE: return m_simSettingsXP.get();
default: Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator"); break;
@@ -220,6 +221,7 @@ namespace swift::misc::simulation::settings
case CSimulatorInfo::FSX: return m_simSettingsFsx.set(settings);
case CSimulatorInfo::P3D: return m_simSettingsP3D.set(settings);
case CSimulatorInfo::MSFS: return m_simSettingsMsfs.set(settings);
case CSimulatorInfo::MSFS2024: return m_simSettingsMsfs2024.set(settings);
case CSimulatorInfo::XPLANE: return m_simSettingsXP.set(settings);
default: Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator"); break;
}
@@ -257,6 +259,7 @@ namespace swift::misc::simulation::settings
case CSimulatorInfo::FSX: break;
case CSimulatorInfo::P3D: break;
case CSimulatorInfo::MSFS: break;
case CSimulatorInfo::MSFS2024: break;
case CSimulatorInfo::XPLANE:
{
if (settings.hasModelDirectories())
@@ -282,6 +285,7 @@ namespace swift::misc::simulation::settings
case CSimulatorInfo::FSX: return m_simSettingsFsx.setAndSave(settings);
case CSimulatorInfo::P3D: return m_simSettingsP3D.setAndSave(settings);
case CSimulatorInfo::MSFS: return m_simSettingsMsfs.setAndSave(settings);
case CSimulatorInfo::MSFS2024: return m_simSettingsMsfs2024.setAndSave(settings);
case CSimulatorInfo::XPLANE: return m_simSettingsXP.setAndSave(settings);
default: Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator"); break;
}
@@ -304,6 +308,7 @@ namespace swift::misc::simulation::settings
case CSimulatorInfo::FSX: return m_simSettingsFsx.save();
case CSimulatorInfo::P3D: return m_simSettingsP3D.save();
case CSimulatorInfo::MSFS: return m_simSettingsMsfs.save();
case CSimulatorInfo::MSFS2024: return m_simSettingsMsfs2024.save();
case CSimulatorInfo::XPLANE: return m_simSettingsXP.save();
default: Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator"); break;
}
@@ -374,6 +379,8 @@ namespace swift::misc::simulation::settings
void CMultiSimulatorSettings::onMsfsSettingsChanged() { this->emitSettingsChanged(CSimulatorInfo::msfs()); }
void CMultiSimulatorSettings::onMsfs2024SettingsChanged() { this->emitSettingsChanged(CSimulatorInfo::msfs2024()); }
void CMultiSimulatorSettings::onXPSettingsChanged() { this->emitSettingsChanged(CSimulatorInfo::xplane()); }
void CMultiSimulatorSettings::onFGSettingsChanged() { this->emitSettingsChanged(CSimulatorInfo::fg()); }
@@ -584,6 +591,8 @@ namespace swift::misc::simulation::settings
}
break;
case CSimulatorInfo::XPLANE: dirs = QStringList({ CXPlaneUtil::modelDirectoriesFromSimDir(s) }); break;
case CSimulatorInfo::MSFS: dirs = QStringList({ CFsDirectories::msfsSimObjectsDir() }); break;
case CSimulatorInfo::MSFS2024: dirs = QStringList({ CFsDirectories::msfs2024SimObjectsDir() }); break;
default: break;
}
@@ -678,11 +687,19 @@ namespace swift::misc::simulation::settings
}
case CSimulatorInfo::MSFS:
{
static const QString msfs = CFsDirectories::msfsPackagesDir();
static const QString msfs = CFileUtils::normalizeFilePathToQtStandard(CFsDirectories::msfsPackagesDir());
if (msfs.isEmpty()) { return e; }
static const QStringList md { msfs };
return md;
}
case CSimulatorInfo::MSFS2024:
{
static const QString msfs2024 =
CFileUtils::normalizeFilePathToQtStandard(CFsDirectories::msfs2024PackagesDir());
if (msfs2024.isEmpty()) { return e; }
static const QStringList md { msfs2024 };
return md;
}
case CSimulatorInfo::XPLANE:
{
return CXPlaneUtil::xplaneModelDirectories();
@@ -703,6 +720,7 @@ namespace swift::misc::simulation::settings
case CSimulatorInfo::FSX: return CFsDirectories::fsxDir();
case CSimulatorInfo::P3D: return CFsDirectories::p3dDir();
case CSimulatorInfo::MSFS: return CFsDirectories::msfsDir();
case CSimulatorInfo::MSFS2024: return CFsDirectories::msfs2024Dir();
case CSimulatorInfo::XPLANE: return CXPlaneUtil::xplaneRootDir();
default: Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator"); break;
}
@@ -722,6 +740,7 @@ namespace swift::misc::simulation::settings
case CSimulatorInfo::P3D: return CFsDirectories::p3dSimObjectsExcludeDirectoryPatterns();
case CSimulatorInfo::XPLANE: return CXPlaneUtil::xplaneModelExcludeDirectoryPatterns();
case CSimulatorInfo::MSFS: return CFsDirectories::msfs20SimObjectsExcludeDirectoryPatterns();
case CSimulatorInfo::MSFS2024: return CFsDirectories::msfs2024SimObjectsExcludeDirectoryPatterns();
default: Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator"); break;
}
return empty;

View File

@@ -354,6 +354,20 @@ namespace swift::misc::simulation::settings
}
};
//! Trait for simulator settings
struct TSimulatorMsfs2024 : public TSettingTrait<CSimulatorSettings>
{
//! \copydoc swift::misc::TSettingTrait::key
static const char *key() { return "settingssimulatormsfs2024"; }
//! \copydoc swift::misc::TSettingTrait::humanReadable
static const QString &humanReadable()
{
static const QString name("MSFS2024 settings");
return name;
}
};
//! Selected P3D version (64bit)
struct TP3DVersion : public TSettingTrait<QString>
{
@@ -545,6 +559,9 @@ namespace swift::misc::simulation::settings
CSetting<TSimulatorMsfs> m_simSettingsMsfs {
this, &CMultiSimulatorSettings::onMsfsSettingsChanged
}; //!< MSFS settings
CSetting<TSimulatorMsfs2024> m_simSettingsMsfs2024 {
this, &CMultiSimulatorSettings::onMsfs2024SettingsChanged
}; //!< MSFS settings
CSetting<TSimulatorXP> m_simSettingsXP { this, &CMultiSimulatorSettings::onXPSettingsChanged }; //!< XP settings
CSetting<TSimulatorFG> m_simSettingsFG { this, &CMultiSimulatorSettings::onFGSettingsChanged }; //!< FG settings
@@ -554,6 +571,7 @@ namespace swift::misc::simulation::settings
void onFs9SettingsChanged();
void onP3DSettingsChanged();
void onMsfsSettingsChanged();
void onMsfs2024SettingsChanged();
void onXPSettingsChanged();
void onFGSettingsChanged();
//! @}

View File

@@ -41,8 +41,8 @@ namespace swift::misc::simulation
CSimulatorInfo::CSimulatorInfo(Simulator simulator) : m_simulator(static_cast<int>(simulator)) {}
CSimulatorInfo::CSimulatorInfo(bool fsx, bool fs9, bool xp, bool p3d, bool fg, bool msfs)
: m_simulator(boolToFlag(fsx, fs9, xp, p3d, fg, msfs))
CSimulatorInfo::CSimulatorInfo(bool fsx, bool fs9, bool xp, bool p3d, bool fg, bool msfs, bool msfs2024)
: m_simulator(boolToFlag(fsx, fs9, xp, p3d, fg, msfs, msfs2024))
{}
CSimulatorInfo::CSimulatorInfo(int flagsAsInt) : m_simulator(flagsAsInt) {}
@@ -61,9 +61,11 @@ namespace swift::misc::simulation
bool CSimulatorInfo::isMSFS() const { return getSimulator().testFlag(MSFS); }
bool CSimulatorInfo::isMSFS2024() const { return getSimulator().testFlag(MSFS2024); }
bool CSimulatorInfo::isAnySimulator() const
{
return isFSX() || isFS9() || isXPlane() || isP3D() || isFG() || isMSFS();
return isFSX() || isFS9() || isXPlane() || isP3D() || isFG() || isMSFS() || isMSFS2024();
}
bool CSimulatorInfo::isSingleSimulator() const { return this->numberSimulators() == 1; }
@@ -74,14 +76,14 @@ namespace swift::misc::simulation
bool CSimulatorInfo::isAllSimulators() const
{
return isFSX() && isFS9() && isXPlane() && isP3D() && isFG() && isMSFS();
return isFSX() && isFS9() && isXPlane() && isP3D() && isFG() && isMSFS() && isMSFS2024();
}
bool CSimulatorInfo::isMicrosoftSimulator() const { return isFSX() || isFS9() || isMSFS(); }
bool CSimulatorInfo::isMicrosoftSimulator() const { return isFSX() || isFS9() || isMSFS() || isMSFS2024(); }
bool CSimulatorInfo::isMicrosoftOrPrepare3DSimulator() const { return isMicrosoftSimulator() || isP3D(); }
bool CSimulatorInfo::isFsxP3DFamily() const { return isFSX() || isP3D() || isMSFS(); }
bool CSimulatorInfo::isFsxP3DFamily() const { return isFSX() || isP3D() || isMSFS() || isMSFS2024(); }
int CSimulatorInfo::numberSimulators() const
{
@@ -91,6 +93,7 @@ namespace swift::misc::simulation
if (isP3D()) { c++; }
if (isFG()) { c++; }
if (isMSFS()) { c++; }
if (isMSFS2024()) { c++; }
return c;
}
@@ -125,7 +128,8 @@ namespace swift::misc::simulation
(s.testFlag(P3D) ? QStringLiteral("P3D ") : QString()) %
(s.testFlag(XPLANE) ? QStringLiteral("XPlane ") : QString()) %
(s.testFlag(FG) ? QStringLiteral("FG ") : QString()) %
(s.testFlag(MSFS) ? QStringLiteral("MSFS ") : QString());
(s.testFlag(MSFS) ? QStringLiteral("MSFS ") : QString()) %
(s.testFlag(MSFS2024) ? QStringLiteral("MSFS2024 ") : QString());
return str.trimmed();
}
@@ -151,6 +155,7 @@ namespace swift::misc::simulation
if (m_simulator & FG) { set.insert(CSimulatorInfo(FG)); }
if (m_simulator & XPLANE) { set.insert(CSimulatorInfo(XPLANE)); }
if (m_simulator & MSFS) { set.insert(CSimulatorInfo(MSFS)); }
if (m_simulator & MSFS2024) { set.insert(CSimulatorInfo(MSFS2024)); }
return set;
}
@@ -175,7 +180,8 @@ namespace swift::misc::simulation
return m.info(u"Simulators OK for model");
}
CSimulatorInfo::Simulator CSimulatorInfo::boolToFlag(bool fsx, bool fs9, bool xp, bool p3d, bool fg, bool msfs)
CSimulatorInfo::Simulator CSimulatorInfo::boolToFlag(bool fsx, bool fs9, bool xp, bool p3d, bool fg, bool msfs,
bool msfs2024)
{
Simulator s = fsx ? FSX : None;
if (fs9) { s |= FS9; }
@@ -183,6 +189,7 @@ namespace swift::misc::simulation
if (p3d) { s |= P3D; }
if (fg) { s |= FG; }
if (msfs) { s |= MSFS; }
if (msfs2024) { s |= MSFS2024; }
return s;
}
@@ -200,6 +207,12 @@ namespace swift::misc::simulation
{
s |= P3D;
}
if (i.contains("msfs2024"))
{
s |= MSFS2024;
return s;
}
if (i.contains("msfs")) { s |= MSFS; }
return s;
}
@@ -241,6 +254,7 @@ namespace swift::misc::simulation
bool p3d = false;
bool fg = false;
bool msfs = false;
bool msfs2024 = false;
if (CBuildConfig::isRunningOnWindowsNtPlatform())
{
@@ -248,11 +262,12 @@ namespace swift::misc::simulation
fsx = !CFsDirectories::fsxSimObjectsDir().isEmpty() && !CFsDirectories::fsxDir().isEmpty();
p3d = !CFsDirectories::p3dDir().isEmpty() && !CFsDirectories::p3dSimObjectsDir().isEmpty();
msfs = !CFsDirectories::msfsDir().isEmpty() && !CFsDirectories::msfsPackagesDir().isEmpty();
msfs2024 = !CFsDirectories::msfs2024Dir().isEmpty() && !CFsDirectories::msfs2024PackagesDir().isEmpty();
}
const bool xp = !CXPlaneUtil::xplaneRootDir().isEmpty();
sim.setSimulator(CSimulatorInfo::boolToFlag(fsx, fs9, xp, p3d, fg, msfs));
sim.setSimulator(CSimulatorInfo::boolToFlag(fsx, fs9, xp, p3d, fg, msfs, msfs2024));
return sim;
}
@@ -287,6 +302,7 @@ namespace swift::misc::simulation
const QJsonValue jp3d = json.value(prefix % u"simp3d");
const QJsonValue jfg = json.value(prefix % u"simfg");
const QJsonValue jmsfs = json.value(prefix % u"simmsfs");
const QJsonValue jmsfs2024 = json.value(prefix % u"simmsfs2024");
// we handle bool JSON values and bool as string
const bool fsx = jfsx.isBool() ? jfsx.toBool() : CDatastoreUtility::dbBoolStringToBool(jfsx.toString());
@@ -295,8 +311,10 @@ namespace swift::misc::simulation
const bool p3d = jp3d.isBool() ? jp3d.toBool() : CDatastoreUtility::dbBoolStringToBool(jp3d.toString());
const bool fg = jfg.isBool() ? jfg.toBool() : CDatastoreUtility::dbBoolStringToBool(jfg.toString());
const bool msfs = jmsfs.isBool() ? jmsfs.toBool() : CDatastoreUtility::dbBoolStringToBool(jmsfs.toString());
const bool msfs2024 =
jmsfs2024.isBool() ? jmsfs2024.toBool() : CDatastoreUtility::dbBoolStringToBool(jmsfs2024.toString());
const CSimulatorInfo simInfo(fsx, fs9, xp, p3d, fg, msfs);
const CSimulatorInfo simInfo(fsx, fs9, xp, p3d, fg, msfs, msfs2024);
return simInfo;
}
@@ -319,13 +337,14 @@ namespace swift::misc::simulation
int CCountPerSimulator::getCountForFsFamilySimulators() const
{
return this->getCount(CSimulatorInfo::fsx()) + this->getCount(CSimulatorInfo::p3d()) +
this->getCount(CSimulatorInfo::fs9()) + this->getCount(CSimulatorInfo::msfs());
this->getCount(CSimulatorInfo::fs9()) + this->getCount(CSimulatorInfo::msfs()) +
this->getCount(CSimulatorInfo::msfs2024());
}
int CCountPerSimulator::getCountForFsxFamilySimulators() const
{
return this->getCount(CSimulatorInfo::fsx()) + this->getCount(CSimulatorInfo::p3d()) +
this->getCount(CSimulatorInfo::msfs());
this->getCount(CSimulatorInfo::msfs()) + this->getCount(CSimulatorInfo::msfs2024());
}
int CCountPerSimulator::getMaximum() const { return *std::min_element(m_counts.begin(), m_counts.end()); }
@@ -353,7 +372,8 @@ namespace swift::misc::simulation
{
return u"FSX: " % QString::number(m_counts[0]) % u" P3D: " % QString::number(m_counts[1]) % u" FS9: " %
QString::number(m_counts[2]) % u" XPlane: " % QString::number(m_counts[3]) % u" FG: " %
QString::number(m_counts[4]) % u" MSFS: " % QString::number(m_counts[5]);
QString::number(m_counts[4]) % u" MSFS: " % QString::number(m_counts[5]) % u" MSFS2024: " %
QString::number(m_counts[6]);
}
void CCountPerSimulator::setCount(int count, const CSimulatorInfo &simulator)
@@ -375,6 +395,7 @@ namespace swift::misc::simulation
if (simulator.isXPlane()) { m_counts[3]++; }
if (simulator.isFG()) { m_counts[4]++; }
if (simulator.isMSFS()) { m_counts[5]++; }
if (simulator.isMSFS2024()) { m_counts[6]++; }
}
int CCountPerSimulator::internalIndex(const CSimulatorInfo &simulator)
@@ -388,6 +409,7 @@ namespace swift::misc::simulation
case CSimulatorInfo::XPLANE: return 3;
case CSimulatorInfo::FG: return 4;
case CSimulatorInfo::MSFS: return 5;
case CSimulatorInfo::MSFS2024: return 6;
default: return CSimulatorInfo::NumberOfSimulators; // unknown
}
}
@@ -402,6 +424,7 @@ namespace swift::misc::simulation
case 3: return CSimulatorInfo(CSimulatorInfo::XPLANE);
case 4: return CSimulatorInfo(CSimulatorInfo::FG);
case 5: return CSimulatorInfo(CSimulatorInfo::MSFS);
case 6: return CSimulatorInfo(CSimulatorInfo::MSFS2024);
default: return CSimulatorInfo(CSimulatorInfo::None);
}
}

View File

@@ -50,14 +50,15 @@ namespace swift::misc::simulation
P3D = 1 << 3,
FG = 1 << 4,
MSFS = 1 << 5,
MSFS2024 = 1 << 6,
FSX_P3D = FSX | P3D,
AllFsFamily = FSX | FS9 | P3D | MSFS,
All = FSX | FS9 | XPLANE | P3D | FG | MSFS
AllFsFamily = FSX | FS9 | P3D | MSFS | MSFS2024,
All = FSX | FS9 | XPLANE | P3D | FG | MSFS | MSFS2024
};
Q_DECLARE_FLAGS(Simulator, SimulatorFlag)
//! Number of known individual simulators
static constexpr int NumberOfSimulators = 6;
static constexpr int NumberOfSimulators = 7;
//! Default constructor
CSimulatorInfo();
@@ -75,7 +76,7 @@ namespace swift::misc::simulation
CSimulatorInfo(int flagsAsInt);
//! Constructor
CSimulatorInfo(bool isFSX, bool isFS9, bool xp, bool isP3D, bool fg, bool msfs);
CSimulatorInfo(bool isFSX, bool isFS9, bool xp, bool isP3D, bool fg, bool msfs, bool msfs2024);
//! Unspecified simulator
bool isUnspecified() const;
@@ -98,6 +99,9 @@ namespace swift::misc::simulation
//! MSFS?
bool isMSFS() const;
//! MSFS2024?
bool isMSFS2024() const;
//! Any simulator?
bool isAnySimulator() const;
@@ -172,7 +176,7 @@ namespace swift::misc::simulation
CStatusMessage validateSimulatorsForModel() const;
//! Bool flags to enum
static Simulator boolToFlag(bool isFSX, bool isFS9, bool xp, bool isP3D, bool fg, bool msfs);
static Simulator boolToFlag(bool isFSX, bool isFS9, bool xp, bool isP3D, bool fg, bool msfs, bool msfs2024);
//! Identifer, as provided by plugin
static Simulator identifierToSimulator(const QString &identifier);
@@ -230,6 +234,11 @@ namespace swift::misc::simulation
static const CSimulatorInfo s(MSFS);
return s;
}
static const CSimulatorInfo &msfs2024()
{
static const CSimulatorInfo s(MSFS2024);
return s;
}
//! @}
private:

View File

@@ -50,6 +50,7 @@ namespace swift::misc::simulation
if (sim.isFSX()) { sims.push_back(CSimulatorInfo(CSimulatorInfo::FSX)); }
if (sim.isP3D()) { sims.push_back(CSimulatorInfo(CSimulatorInfo::P3D)); }
if (sim.isMSFS()) { sims.push_back(CSimulatorInfo(CSimulatorInfo::MSFS)); }
if (sim.isMSFS2024()) { sims.push_back(CSimulatorInfo(CSimulatorInfo::MSFS2024)); }
if (sim.isXPlane()) { sims.push_back(CSimulatorInfo(CSimulatorInfo::XPLANE)); }
return sims;
}

View File

@@ -65,6 +65,8 @@ namespace swift::misc::simulation
if (s.testFlag(CSimulatorInfo::XPLANE)) { return CSimulatorPluginInfo::xplanePluginIdentifier(); }
if (s.testFlag(CSimulatorInfo::FG)) { return CSimulatorPluginInfo::fgPluginIdentifier(); }
if (s.testFlag(CSimulatorInfo::MSFS)) { return CSimulatorPluginInfo::msfsPluginIdentifier(); }
if (s.testFlag(CSimulatorInfo::MSFS2024)) { return CSimulatorPluginInfo::msfs2024PluginIdentifier(); }
return e;
}
@@ -104,6 +106,12 @@ namespace swift::misc::simulation
return s;
}
const QString &CSimulatorPluginInfo::msfs2024PluginIdentifier()
{
static const QString s("org.swift-project.plugins.simulator.msfs2024");
return s;
}
const QString &CSimulatorPluginInfo::emulatedPluginIdentifier()
{
static const QString s("org.swift-project.plugins.simulator.emulated");
@@ -114,7 +122,7 @@ namespace swift::misc::simulation
{
static const QStringList identifiers({ fsxPluginIdentifier(), p3dPluginIdentifier(), xplanePluginIdentifier(),
fs9PluginIdentifier(), emulatedPluginIdentifier(), fgPluginIdentifier(),
msfsPluginIdentifier() });
msfsPluginIdentifier(), msfs2024PluginIdentifier() });
return identifiers;
}
@@ -126,7 +134,9 @@ namespace swift::misc::simulation
return QStringList { xplanePluginIdentifier(), fgPluginIdentifier() };
}
return QStringList { fsxPluginIdentifier(), msfsPluginIdentifier(), p3dPluginIdentifier(),
xplanePluginIdentifier(), fgPluginIdentifier() };
return QStringList {
fsxPluginIdentifier(), msfsPluginIdentifier(), p3dPluginIdentifier(),
xplanePluginIdentifier(), fgPluginIdentifier(), msfs2024PluginIdentifier(),
};
}
} // namespace swift::misc::simulation

View File

@@ -86,6 +86,9 @@ namespace swift::misc::simulation
//! Plugin identifier (MSFS 2020)
static const QString &msfsPluginIdentifier();
//! Plugin identifier (MSFS 2024)
static const QString &msfs2024PluginIdentifier();
//! Plugin identifier (emulated simulator plugin)
static const QString &emulatedPluginIdentifier();

View File

@@ -18,11 +18,11 @@ if(SWIFT_BUILD_XPLANE_PLUGIN)
add_subdirectory(xplaneconfig)
endif()
if(SWIFT_BUILD_FS9_PLUGIN OR SWIFT_BUILD_FSX_PLUGIN OR SWIFT_BUILD_P3D_PLUGIN OR SWIFT_BUILD_MSFS_PLUGIN)
if(SWIFT_BUILD_FS9_PLUGIN OR SWIFT_BUILD_FSX_PLUGIN OR SWIFT_BUILD_P3D_PLUGIN OR SWIFT_BUILD_MSFS_PLUGIN OR SWIFT_BUILD_MSFS2024_PLUGIN)
add_subdirectory(fscommon)
endif()
if(SWIFT_BUILD_FSX_PLUGIN OR SWIFT_BUILD_P3D_PLUGIN OR SWIFT_BUILD_MSFS_PLUGIN)
if(SWIFT_BUILD_FSX_PLUGIN OR SWIFT_BUILD_P3D_PLUGIN OR SWIFT_BUILD_MSFS_PLUGIN OR SWIFT_BUILD_MSFS2024_PLUGIN)
add_subdirectory(fsxcommon)
endif()
@@ -37,7 +37,10 @@ endif()
if(SWIFT_BUILD_MSFS_PLUGIN)
add_subdirectory(msfs)
add_subdirectory(msfsconfig)
endif()
if(SWIFT_BUILD_MSFS2024_PLUGIN)
add_subdirectory(msfs2024)
endif()
if(SWIFT_BUILD_FSX_PLUGIN)

View File

@@ -84,6 +84,7 @@ namespace swift::simplugin::fsxcommon
hr += initSimulatorEnvironment(hSimConnect);
hr += initSbDataArea(hSimConnect);
if (simInfo.isMSFS()) { hr += initMSFSTransponder(hSimConnect); }
if (simInfo.isMSFS2024()) { hr += initMSFS2024Transponder(hSimConnect); }
return hr;
}
@@ -424,6 +425,22 @@ namespace swift::simplugin::fsxcommon
return hr;
}
HRESULT CSimConnectDefinitions::initMSFS2024Transponder(const HANDLE hSimConnect)
{
HRESULT hr = s_ok();
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataTransponderModeMSFS,
"TRANSPONDER STATE:1", "Enum");
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataTransponderModeMSFS,
"TRANSPONDER IDENT:1", "Bool");
if (isFailure(hr))
{
CLogMessage(static_cast<CSimConnectDefinitions *>(nullptr))
.error(u"SimConnect error: MSFS2024 transponder data definitions %1")
<< hr;
}
return hr;
}
DataDefinitionRemoteAircraftPartsWithoutLights::DataDefinitionRemoteAircraftPartsWithoutLights()
{
this->resetToInvalid();

View File

@@ -271,6 +271,7 @@ namespace swift::simplugin::fsxcommon
ClientAreaSquawkBox
};
// TODO TZ: are there any changes in MSFS2024
//! Handles SimConnect data definitions
class FSXCOMMON_EXPORT CSimConnectDefinitions
{
@@ -354,6 +355,9 @@ namespace swift::simplugin::fsxcommon
//! Initialize data definition for MSFS transponder
static HRESULT initMSFSTransponder(const HANDLE hSimConnect);
//! Initialize data definition for MSFS transponder
static HRESULT initMSFS2024Transponder(const HANDLE hSimConnect);
};
} // namespace swift::simplugin::fsxcommon

View File

@@ -351,6 +351,37 @@ bool loadAndResolveMSFSimConnect()
}
}
bool loadAndResolveMSFS2024SimConnect()
{
// Check if already loaded
if (gSymbols.SimConnect_Open) { return true; }
QString simConnectFileName(QStringLiteral("SimConnect.MSFS2024"));
QLibrary simConnectDll(simConnectFileName);
simConnectDll.setLoadHints(QLibrary::PreventUnloadHint);
if (simConnectDll.load())
{
const bool resolvedCommon = resolveCommonSimConnectSymbols(simConnectDll);
if (!resolvedCommon)
{
CLogMessage(CLogCategories::driver()).error(u"Failed to resolve common symbols from SimConnect.dll: '%1'")
<< simConnectFileName;
return false;
}
CLogMessage(CLogCategories::driver()).info(u"Loaded and resolved MSFS2024 symbols from SimConnect.dll: '%1'")
<< simConnectFileName;
return resolvedCommon;
}
else
{
CLogMessage(CLogCategories::driver()).error(u"Failed to load SimConnect.dll: '%1' '%2'")
<< simConnectFileName << simConnectDll.errorString();
return false;
}
}
#else
bool loadAndResolveFsxSimConnect(bool manifestProbing)
{

View File

@@ -39,6 +39,8 @@ inline bool loadAndResolveP3DSimConnectByString(const QString &version)
FSXCOMMON_EXPORT bool loadAndResolveMSFSimConnect();
FSXCOMMON_EXPORT bool loadAndResolveMSFS2024SimConnect();
#else
//! Load and resolve FSX SimConnect.

View File

@@ -509,7 +509,8 @@ namespace swift::simplugin::fsxcommon
const CFsxP3DSettings settings = m_detailsSettings.getSettings(this->getSimulatorInfo());
m_useAddSimulatedObj = settings.isAddingAsSimulatedObjectEnabled();
m_useSbOffsets = settings.isSbOffsetsEnabled();
if (this->getSimulatorPluginInfo().getSimulatorInfo().isMSFS())
if (this->getSimulatorPluginInfo().getSimulatorInfo().isMSFS() ||
this->getSimulatorPluginInfo().getSimulatorInfo().isMSFS2024())
{
m_useSbOffsets = false; // Always disable SbOffsets for MSFS. Using new transponder mode property directly
}
@@ -533,7 +534,9 @@ namespace swift::simplugin::fsxcommon
SIMCONNECT_PERIOD_SECOND, SIMCONNECT_DATA_REQUEST_FLAG_CHANGED),
"Cannot request sim.env.", Q_FUNC_INFO, "SimConnect_RequestDataOnSimObject");
if (!this->getSimulatorPluginInfo().getSimulatorInfo().isMSFS())
// TODO TZ use MSFS2024 FSUIPC?
if (!this->getSimulatorPluginInfo().getSimulatorInfo().isMSFS() &&
!this->getSimulatorPluginInfo().getSimulatorInfo().isMSFS2024())
{
// Request the data from SB only when its changed and only ONCE so we don't have to run a 1sec event to
// get/set this info ;) there was a bug with SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET, see
@@ -3113,6 +3116,11 @@ namespace swift::simplugin::fsxcommon
// MSFS 2020 drivers only works with MSFS
return connectedSimName.contains("kittyhawk");
}
else if (pluginSim.isMSFS2024())
{
// MSFS2024 drivers only works with MSFS2024
return connectedSimName.contains("sunrise");
}
return false;
}

View File

@@ -0,0 +1,29 @@
# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors
# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
add_library(simulatormsfs2024 SHARED
simulatormsfs2024.cpp
simulatormsfs2024.h
simulatormsfs2024.json
simulatormsfs2024factory.cpp
simulatormsfs2024factory.h
)
set_target_properties(simulatormsfs2024 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/out/bin/plugins/simulator)
set_target_properties(simulatormsfs2024 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/out/bin/plugins/simulator)
target_include_directories(simulatormsfs2024 PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(simulatormsfs2024
PUBLIC
fscommon
fsxcommon
core
misc
Qt::Core
)
install(TARGETS simulatormsfs2024
LIBRARY DESTINATION bin/plugins/simulator
RUNTIME DESTINATION bin/plugins/simulator
)

View File

@@ -0,0 +1,50 @@
// SPDX-FileCopyrightText: Copyright (C) 2020 swift Project Community / Contributors
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
#include "simulatorMsFs2024.h"
#include "../fsxcommon/simconnectsymbols.h"
using namespace swift::misc;
using namespace swift::misc::aviation;
using namespace swift::misc::physical_quantities;
using namespace swift::misc::geo;
using namespace swift::misc::network;
using namespace swift::misc::simulation;
using namespace swift::misc::simulation::fscommon;
using namespace swift::core;
using namespace swift::simplugin::fsxcommon;
namespace swift::simplugin::msfs2024
{
CSimulatorMsFs2024::CSimulatorMsFs2024(const CSimulatorPluginInfo &info, IOwnAircraftProvider *ownAircraftProvider,
IRemoteAircraftProvider *remoteAircraftProvider,
IClientProvider *clientProvider, QObject *parent)
: CSimulatorFsxCommon(info, ownAircraftProvider, remoteAircraftProvider, clientProvider, parent)
{
this->setDefaultModel({ "Airbus A320 Neo Asobo", CAircraftModel::TypeModelMatchingDefaultModel,
"Airbus A320 default model", CAircraftIcaoCode("A320", "L2J") });
}
bool CSimulatorMsFs2024::connectTo()
{
if (!loadAndResolveMSFS2024SimConnect()) { return false; }
return CSimulatorFsxCommon::connectTo();
}
void CSimulatorMsFs2024::setTrueAltitude(CAircraftSituation &aircraftSituation,
const DataDefinitionOwnAircraft &simulatorOwnAircraft)
{
aircraftSituation.setAltitude(
CAltitude(simulatorOwnAircraft.altitudeCalibratedFt, CAltitude::MeanSeaLevel, CLengthUnit::ft()));
m_altitudeDelta = { simulatorOwnAircraft.altitudeFt - simulatorOwnAircraft.altitudeCalibratedFt,
CLengthUnit::ft() };
}
void CSimulatorMsFs2024Listener::startImpl()
{
if (!loadAndResolveMSFS2024SimConnect()) { return; }
CSimulatorFsxCommonListener::startImpl();
}
} // namespace swift::simplugin::msfs2024

View File

@@ -0,0 +1,49 @@
// SPDX-FileCopyrightText: Copyright (C) 2020 swift Project Community / Contributors
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
//! \file
#ifndef SWIFT_SIMPLUGIN_MSFS_SIMULATORMSFS2024_H
#define SWIFT_SIMPLUGIN_MSFS_SIMULATORMSFS2024_H
#include "../fsxcommon/simulatorfsxcommon.h"
namespace swift::simplugin::msfs2024
{
//! FSX simulator implementation
class CSimulatorMsFs2024 : public swift::simplugin::fsxcommon::CSimulatorFsxCommon
{
Q_OBJECT
public:
//! Constructor, parameters as in \sa swift::core::ISimulatorFactory::create
CSimulatorMsFs2024(const swift::misc::simulation::CSimulatorPluginInfo &info,
swift::misc::simulation::IOwnAircraftProvider *ownAircraftProvider,
swift::misc::simulation::IRemoteAircraftProvider *remoteAircraftProvider,
swift::misc::network::IClientProvider *clientProvider, QObject *parent = nullptr);
//! \name ISimulator implementations
//! @{
virtual bool connectTo() override;
//! @}
virtual void
setTrueAltitude(swift::misc::aviation::CAircraftSituation &aircraftSituation,
const swift::simplugin::fsxcommon::DataDefinitionOwnAircraft &simulatorOwnAircraft) override;
};
//! Listener for MSFS2024
class CSimulatorMsFs2024Listener : public fsxcommon::CSimulatorFsxCommonListener
{
Q_OBJECT
public:
//! Constructor
using CSimulatorFsxCommonListener::CSimulatorFsxCommonListener;
protected:
virtual void startImpl() override;
};
} // namespace swift::simplugin::msfs2024
#endif // guard

View File

@@ -0,0 +1,7 @@
{
"identifier" : "org.swift-project.plugins.simulator.msfs2024",
"name" : "Flight Simulator 2024",
"simulator" : "msfs2024",
"description" : "Microsoft Flight Simulator 2024",
"config" : "org.swift-project.plugins.simulator.msfs2024.config"
}

View File

@@ -0,0 +1,29 @@
// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
#include "simulatormsfs2024factory.h"
#include "simulatormsfs2024.h"
#include "misc/simulation/simulatorplugininfo.h"
using namespace swift::misc::network;
using namespace swift::misc::simulation;
using namespace swift::core;
namespace swift::simplugin::msfs2024
{
ISimulator *CSimulatorMsFs2024Factory::create(const CSimulatorPluginInfo &info,
IOwnAircraftProvider *ownAircraftProvider,
IRemoteAircraftProvider *remoteAircraftProvider,
IClientProvider *clientProvider)
{
Q_ASSERT(ownAircraftProvider);
return new CSimulatorMsFs2024(info, ownAircraftProvider, remoteAircraftProvider, clientProvider, this);
}
ISimulatorListener *CSimulatorMsFs2024Factory::createListener(const CSimulatorPluginInfo &info)
{
return new CSimulatorMsFs2024Listener(info);
}
} // namespace swift::simplugin::msfs2024

View File

@@ -0,0 +1,38 @@
// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
//! \file
#ifndef SWIFT_SIMPLUGIN_SIMULATOR_MSFS2024FACTORY_H
#define SWIFT_SIMPLUGIN_SIMULATOR_MSFS2024FACTORY_H
#include <QObject>
#include <QtPlugin>
#include "core/simulator.h"
#include "misc/simulation/simulatorplugininfo.h"
namespace swift::simplugin::msfs2024
{
//! Factory implementation to create CSimulatorFsx instances
class CSimulatorMsFs2024Factory : public QObject, public swift::core::ISimulatorFactory
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.swift-project.swift_core.simulatorinterface" FILE "simulatormsfs2024.json")
Q_INTERFACES(swift::core::ISimulatorFactory)
public:
//! \copydoc swift::core::ISimulatorFactory::create
virtual swift::core::ISimulator *
create(const swift::misc::simulation::CSimulatorPluginInfo &info,
swift::misc::simulation::IOwnAircraftProvider *ownAircraftProvider,
swift::misc::simulation::IRemoteAircraftProvider *remoteAircraftProvider,
swift::misc::network::IClientProvider *clientProvider) override;
//! \copydoc swift::core::ISimulatorFactory::createListener
virtual swift::core::ISimulatorListener *
createListener(const swift::misc::simulation::CSimulatorPluginInfo &info) override;
};
} // namespace swift::simplugin::msfs2024
#endif // guard

View File

@@ -1,27 +0,0 @@
# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors
# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
add_library(simulatormsfsconfig SHARED
simulatormsfsconfig.cpp
simulatormsfsconfig.h
simulatormsfsconfig.json
)
set_target_properties(simulatormsfsconfig PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/out/bin/plugins/simulator)
set_target_properties(simulatormsfsconfig PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/out/bin/plugins/simulator)
target_include_directories(simulatormsfsconfig PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(simulatormsfsconfig
PUBLIC
gui
misc
Qt::Core
PRIVATE
fsxcommon
)
install(TARGETS simulatormsfsconfig
LIBRARY DESTINATION bin/plugins/simulator
RUNTIME DESTINATION bin/plugins/simulator
)

View File

@@ -1,19 +0,0 @@
// SPDX-FileCopyrightText: Copyright (C) 2017 swift Project Community / Contributors
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
#include "simulatormsfsconfig.h"
#include "../fsxcommon/simulatorfsxconfigwindow.h"
namespace swift::simplugin::msfs
{
CSimulatorMsfsConfig::CSimulatorMsfsConfig(QObject *parent) : QObject(parent)
{
// void
}
swift::gui::CPluginConfigWindow *CSimulatorMsfsConfig::createConfigWindow(QWidget *parent)
{
return new fsxcommon::CSimulatorFsxConfigWindow("MSFS", parent);
}
} // namespace swift::simplugin::msfs

View File

@@ -1,34 +0,0 @@
// SPDX-FileCopyrightText: Copyright (C) 2017 swift Project Community / Contributors
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
//! \file
#ifndef SWIFT_SIMPLUGIN_MSFS_SIMULATORMSFSCONFIG_H
#define SWIFT_SIMPLUGIN_MSFS_SIMULATORMSFSCONFIG_H
#include "gui/pluginconfig.h"
namespace swift::simplugin::msfs
{
/*!
* Window for setting up the MSFS plugin.
*/
class CSimulatorMsfsConfig : public QObject, public swift::gui::IPluginConfig
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.swift-project.swiftgui.pluginconfiginterface" FILE "simulatormsfsconfig.json")
Q_INTERFACES(swift::gui::IPluginConfig)
public:
//! Ctor
CSimulatorMsfsConfig(QObject *parent = nullptr);
//! Dtor
virtual ~CSimulatorMsfsConfig() {}
//! \copydoc swift::gui::IPluginConfig::createConfigWindow()
swift::gui::CPluginConfigWindow *createConfigWindow(QWidget *parent) override;
};
} // namespace swift::simplugin::msfs
#endif // SWIFT_SIMPLUGIN_MSFS_SIMULATORMSFSCONFIG_H

View File

@@ -1,3 +0,0 @@
{
"identifier" : "org.swift-project.plugins.simulator.msfs.config"
}