@@ -390,7 +390,7 @@ namespace swift::simplugin::msfs2024common
390390 sSimmobjectLoadedState .bLoadStarted = true ;
391391 CLogMessage (this ).info (u" Start loading SimObjects and liverys from simulator" );
392392
393- // TODO TZ a message should be displayed here because the gui freezes during loading
393+ // TODO TZ a message should be displayed here because the gui freezes during loading large amounts of data
394394 const CStatusMessage m = CStatusMessage (this , CStatusMessage::SeverityInfo,
395395 u" Start loading SimObjects and liverys from simulator" );
396396 }
@@ -411,24 +411,25 @@ namespace swift::simplugin::msfs2024common
411411 default : break ;
412412 }
413413
414- // if (sSimmobjectLoadedState.bAirplaneLoaded && sSimmobjectLoadedState.bHelicopterLoaded &&
415- // sSimmobjectLoadedState.bHotAirLoaded)
416- // {
414+ // sSimmobjectLoadedState.bHotAirLoaded
417415 if (sSimmobjectLoadedState .bAirplaneLoaded && sSimmobjectLoadedState .bHelicopterLoaded )
418416 {
419417 sSimmobjectLoadedState .bLoadStarted = false ;
420418 size_t countmodels = vSimObjectsAndLiveries.size ();
421419 CLogMessage (this ).info (u" %1 SimObjects and Liveries loaded from SimConnect" ) << countmodels;
422420
423421 // now we try to create a new temporary model list
424- createNewModelList ();
422+ setSimObjectAndLiveries ();
425423
426424 CLogMessage (this ).info (u" finished new model set" );
427425 }
428426 }
429427
430428 void CSimulatorMsfs2024::setSimObjectAndLiveries ()
431429 {
430+ // TODO TZ a message should be displayed here because the gui freezes during loading
431+ // better: move to the background (e.g., use CWorker::fromTask(...)), avoid GUI freeze.
432+
432433 CLogMessage (this ).info (u" %1 SimObjects and Liveries in vSimObjectsAndLiveries" )
433434 << vSimObjectsAndLiveries.size ();
434435 // owner = this (QObject in main thread)
@@ -441,11 +442,8 @@ namespace swift::simplugin::msfs2024common
441442 worker->then (this , [=] { CLogMessage (this ).info (u" SimObjects and Liveries in vSimObjectsAndLiveries ready" ); });
442443 }
443444
444- // TODO TZ under construction
445445 void CSimulatorMsfs2024::createNewModelList ()
446446 {
447- // TODO TZ a message should be displayed here because the gui freezes during loading
448- // better: move to the background (e.g., use CWorker::fromTask(...)), avoid GUI freeze.
449447
450448 const CSpecializedSimulatorSettings settings = this ->getSimulatorSettings ();
451449 CSimulatorSettings m_generic = settings.getGenericSettings ();
@@ -456,8 +454,6 @@ namespace swift::simplugin::msfs2024common
456454 if (guiName.contains (" mapping" )) gui_application = false ;
457455
458456 CAircraftModelList newModels;
459- // CAircraftModelList validModels;
460- // CAircraftModelList invalidModels;
461457
462458 for (int i = 0 ; i < static_cast <int >(vSimObjectsAndLiveries.size ()); ++i)
463459 {
@@ -477,9 +473,6 @@ namespace swift::simplugin::msfs2024common
477473 model.setModelType (CAircraftModel::TypeOwnSimulatorModel);
478474 model.setSimulator (this ->getSimulatorInfo ());
479475
480- // if (gui_application)
481- // {
482- // filter certain models if needed with settings from settingssimulatormsfs2024.json
483476 bool excluded = false ;
484477 for (const QString &rawPattern : excludePatterns)
485478 {
@@ -492,11 +485,8 @@ namespace swift::simplugin::msfs2024common
492485 }
493486 }
494487 if (excluded) continue ; // skip adding this model
495- // }
496- newModels.replaceOrAddModelWithString (model, Qt::CaseInsensitive);
497488
498- // TODO TZ do we need valid/invalid models here? I think not
499- // newModels.addAsValidOrInvalidModel(model, true, validModels, invalidModels);
489+ newModels.replaceOrAddModelWithString (model, Qt::CaseInsensitive);
500490 }
501491
502492 CAircraftModelList newModelList;
@@ -520,25 +510,16 @@ namespace swift::simplugin::msfs2024common
520510 bool sortByDistributor = true ;
521511 bool consolidateWithDb = false ;
522512 bool ShowAllInstalledModells = true ;
523- // const CAircraftModelList models = this->getMappingComponent()->getOwnModels();
524- // const CDistributorList distributors = ui->form_OwnModelSet->getDistributorsBasedOnOptions();
525- // const QStringList distributorNames = { "ASOBO", "FSLTL", "CARENADO", "FS9", "PMDG", "FBW", "AIG" };
526- // const QStringList distributorNames = { "ASOBO" };
527513
528514 if (gui_application)
529515 {
530516 givenDistributorsOnly = m_generic.getPropertyDistributorFiltered ();
531517 dbDataOnly = m_generic.getPropertyWithDbEntry ();
532- // optionDbIcaoCodesOnly
533518 dbIcaoOnly = false ;
534- // optionIncrementalBuild
535519 incremnental = false ;
536- // optionSortByDistributorPreferences
537520 sortByDistributor = true ;
538- // optionConsolidateModelSetWithDbData
539521 consolidateWithDb = true ;
540-
541- ShowAllInstalledModells = true ;
522+ ShowAllInstalledModells = true ; // msfs20424 always show all installed models
542523 }
543524
544525 // CDistributorList distributorList;
@@ -555,16 +536,12 @@ namespace swift::simplugin::msfs2024common
555536 if (consolidateWithDb) { options |= CModelSetBuilder::ConsolidateWithDb; }
556537 if (ShowAllInstalledModells) { options |= CModelSetBuilder::ShowAllInstalledModells; }
557538 const CSimulatorInfo &simulator = this ->getSimulatorInfo ();
558- // return
559539
560540 CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance ().synchronizeCache (simulator);
561- // for swiftgui it is enough to set the cache here
562-
563541 currentSet = CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance ().getCachedModels (simulator);
564542
565543 NewSet = builder.buildModelSet (simulator, newModelList, currentSet, options, distributorList);
566544
567- // TODO TZ cache the new model set for further usage
568545 CAircraftMatcher matcher;
569546 swift::misc::simulation::CAircraftMatcherSetup mSetup = matcher.getSetup ();
570547
@@ -576,21 +553,13 @@ namespace swift::simplugin::msfs2024common
576553 NewSet.latestTimestamp ();
577554 if (!latestDbModelsTs.isValid ()) { return ; }
578555
556+ // for swiftgui it is enough to set the cache here
579557 if (gui_application)
580- {
581- // for swiftgui it is enough to set the cache here
582558 CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance ().setCachedModels (NewSet, simulator);
583- CCentralMultiSimulatorModelCachesProvider::modelCachesInstance ().setModelsForSimulator (NewSet,
584- simulator);
585- }
586- else
587- {
588- // for swiftdata we set the installed model here
589- CCentralMultiSimulatorModelCachesProvider::modelCachesInstance ().setModelsForSimulator (NewSet,
590- simulator);
591- }
559+
592560 CCentralMultiSimulatorModelCachesProvider::modelCachesInstance ().updateModelsForSimulator (NewSet,
593561 simulator);
562+
594563 // CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().getSynchronizedCachedModels(simulator);
595564
596565 const CStatusMessage m = CStatusMessage (this , CStatusMessage::SeverityInfo,
@@ -600,7 +569,6 @@ namespace swift::simplugin::msfs2024common
600569
601570 // TODO TZ only for debugging
602571 // int cstoremodels = writeSimObjectsAndLiveriesToFile(NewSet);
603- // CLogMessage(this).info(u"%1 SimObjects and Liveries stored to aircraftlist.txt") << cstoremodels;
604572 }
605573 }
606574
@@ -613,28 +581,12 @@ namespace swift::simplugin::msfs2024common
613581 if (!datei) return 0 ;
614582 for (int i = 0 ; i < static_cast <int >(Modelset.size ()); ++i)
615583 {
616- datei << Modelset[i].getModelString (). toStdString () << " :: " << Modelset[i]. getModelLivery ().toStdString ()
617- << " ::" << Modelset[i].getDbKey () << std::endl;
584+ datei << Modelset[i].getShortModelString ().toStdString ()
585+ << " ::" << Modelset[i].getModelLivery (). toStdString () << " :: " << Modelset[i]. getDbKey () << std::endl;
618586 ++counter;
619587 }
620588 datei.close ();
621589 return counter;
622-
623- // // datei << element.AircraftTitle // PMDG DC-6A PMDG House (N6PA | 2021)
624- // // << "::" << element.LiveryName // ''
625- // // << "::" << model.getName().toStdString() // DC-6A_v1
626- // // << "::" << model.getAircraftIcaoCode().getDbKeyAsString().toStdString() // 3198
627- // // << "::" << model.getDbKey() // 53714
628- // // << "::"
629- // // << model.getAirlineIcaoCode().getDbKeyAsString().toStdString() // 6809
630- // // //<< "::" << model.getAirlineIcaoCode().toStdString()
631- // // << "::" << model.getDescription().toStdString() // Douglas DC-6A PMDG House (N6PA | 2021)
632- // // << "::" << model.getDistributor().getDbKeyAsJsonValue().toString().toStdString() // PMDG
633- // // << "::" << model.getSimulator().toStdString() // FSX P3D MSFS MSFS2024
634- // // << "::" << model.getAircraftIcaoCode().toStdString() // DC6 (3198) L4P M
635- // // << "::" << model.getModelStringAndDbKey().toStdString() // PMDG DC-6A PMDG HOUSE (N6PA | 2021)
636- // // (53714)
637- // // << std::endl;
638590 }
639591
640592 bool CSimulatorMsfs2024::isTracingSendId () const
@@ -2043,23 +1995,9 @@ namespace swift::simplugin::msfs2024common
20431995 const SIMCONNECT_DATA_INITPOSITION initialPosition =
20441996 CSimulatorMsfs2024::aircraftSituationToFsxPosition (initialSituation, sendGround, true , &underflowStatus);
20451997
2046- QString modelString (newRemoteAircraft.getModelString ());
1998+ QString modelString (newRemoteAircraft.getShortModelString ());
20471999 const QString modelLiveryString (newRemoteAircraft.getLiveryString ());
20482000
2049- // For msfs2024, the model and livery must be passed separately. The livery string is already linked to the
2050- // model string in the database to maintain compatibility with other simulators.. Therefore, we need to separate
2051- // it here.
2052- if (modelString.contains (modelLiveryString))
2053- {
2054- int lastIndex = modelString.lastIndexOf (modelLiveryString);
2055-
2056- if (lastIndex != -1 )
2057- {
2058- const QString newModelString = modelString.left (lastIndex);
2059- modelString = newModelString;
2060- }
2061- }
2062-
20632001 if (this ->showDebugLogMessage ())
20642002 {
20652003 this ->debugLogMessage (Q_FUNC_INFO,
@@ -2076,20 +2014,12 @@ namespace swift::simplugin::msfs2024common
20762014 CSimConnectObject::SimObjectType type = CSimConnectObject::AircraftNonAtc;
20772015 HRESULT hr = S_OK;
20782016
2079- // TODO TZ DEBUG the index 10 is just for testing liveries
2080- // sSimObjectLivery &simObjectToSpawn = vSimObjectsAndLiveries[1];
2081- // simObjectToSpawn.szSimObjectTitle = "A320neo V2";
2082- // simObjectToSpawn.szLiveryName = "";
2083-
20842017 if (probe)
20852018 {
2086- hr = SimConnect_AICreateNonATCAircraft_EX1 (
2087- m_hSimConnect, modelStringBa .constData (), // simObjectToSpawn.szSimObjectTitle.c_str() ,
2088- modelLiveryBa. constData (), csBa. constData (), initialPosition, requestId);
2019+ hr = SimConnect_AICreateNonATCAircraft_EX1 (m_hSimConnect, modelStringBa. constData (),
2020+ modelLiveryBa .constData (), csBa. constData (), initialPosition ,
2021+ requestId);
20892022
2090- // TODO TZ remove later
2091- // hr = SimConnect_AICreateSimulatedObject(m_hSimConnect, modelStringBa.constData(), initialPosition,
2092- // requestId);
20932023 type = CSimConnectObject::TerrainProbe;
20942024 }
20952025 else
@@ -2102,14 +2032,9 @@ namespace swift::simplugin::msfs2024common
21022032 u" Model '%1' for '%2' failed %1 time(s) before, using AICreateSimulatedObject now" )
21032033 << newRemoteAircraft.getModelString () << callsign.toQString ();
21042034
2105- hr = SimConnect_AICreateNonATCAircraft_EX1 (
2106- m_hSimConnect,
2107- modelStringBa.constData (), // simObjectToSpawn.szSimObjectTitle.c_str(),
2108- modelLiveryBa.constData (), csBa.constData (), initialPosition, requestId);
2109-
2110- // TODO TZ remove later
2111- // hr = SimConnect_AICreateSimulatedObject(m_hSimConnect, modelStringBa.constData(), initialPosition,
2112- // requestId);
2035+ hr = SimConnect_AICreateNonATCAircraft_EX1 (m_hSimConnect, modelStringBa.constData (),
2036+ modelLiveryBa.constData (), csBa.constData (), initialPosition,
2037+ requestId);
21132038
21142039 type = CSimConnectObject::AircraftSimulatedObject;
21152040 }
@@ -2118,9 +2043,7 @@ namespace swift::simplugin::msfs2024common
21182043 hr = SimConnect_AICreateNonATCAircraft_EX1 (m_hSimConnect, modelStringBa.constData (),
21192044 modelLiveryBa.constData (), csBa.constData (), initialPosition,
21202045 requestId);
2121- // TODO TZ remove later
2122- // hr = SimConnect_AICreateNonATCAircraft(m_hSimConnect, modelStringBa.constData(), csBa.constData(),
2123- // initialPosition, requestId);
2046+
21242047 type = CSimConnectObject::AircraftNonAtc;
21252048 }
21262049 }
@@ -2522,7 +2445,7 @@ namespace swift::simplugin::msfs2024common
25222445 return ok;
25232446 }
25242447
2525- // TODO TZ DEBUG only
2448+ // TODO TZ under investigation, flaps retracting to 0 again and other issues
25262449 bool CSimulatorMsfs2024::sendRemoteAircraftPartsToSimulator (const CSimConnectObject &simObject,
25272450 const CAircraftParts &parts)
25282451 {
0 commit comments