Skip to content

MSFS2024 new plugin and modelloader#392

Open
ltoenning wants to merge 3 commits intomainfrom
msfs2024_new_plugin_and_modelloader
Open

MSFS2024 new plugin and modelloader#392
ltoenning wants to merge 3 commits intomainfrom
msfs2024_new_plugin_and_modelloader

Conversation

@ltoenning
Copy link
Member

This PR is stacked with #391 which should be merged first.

@ltoenning ltoenning requested a review from oktal3700 January 31, 2026 11:53
@ltoenning ltoenning force-pushed the msfs2024_new_plugin_and_modelloader branch from a3bce29 to 01a0668 Compare February 1, 2026 12:28
@ltoenning ltoenning force-pushed the msfs2024_new_plugin_and_modelloader branch from 4091541 to 156bacb Compare February 3, 2026 20:31
Copy link
Contributor

@oktal3700 oktal3700 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are just some cppcheck warnings

Copy link
Member Author

@ltoenning ltoenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tzobler Thanks for this PR! The new model loading approach looks very promising.

One potential concern: introducing a separate MSFS24 plugin seems to create a lot of duplication. Could some of this code be reused, perhaps by refactoring fsxcommon? Happy to discuss options for this in a quick chat if you like.

{
// error to force popup
CLogMessage(this).error(u"No models for matching ('%1'), swift without a model set will not work!")
// TODO TZ extend commend
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can TODO be removed?

@@ -0,0 +1,26 @@
// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
// SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors

Avoid misleading/wrong year

Comment on lines +20 to +21
//#include <SimConnect.h>
#include "../third_party/externals/common/include/simconnect/MSFS2024/SimConnect.h"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed to not be such a relative path

using DWORD = unsigned long; //!< Fake Windows DWORD
#endif

namespace swift::misc::simulation::msfs2024
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO Check and avoid duplication

Comment on lines -20 to +22
#include <SimConnect.h>
//#include <SimConnect.h>
#include "../third_party/externals/common/include/simconnect/P3D-v4/SimConnect.h"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relative include path should be fixed

Comment on lines +2369 to +2378
// TODO TZ handle flaps more precisely
// is already handled in parts definition above
// Sets flap handle to closest increment (0 to 16383)
// const DWORD flapsDw = static_cast<DWORD>(qMin(16383, qRound((parts.getFlapsPercent() / 100.0) * 16383)));
const HRESULT hr2 = S_OK;
// const HRESULT hr2 = this->logAndTraceSendId(
// SimConnect_TransmitClientEvent(m_hSimConnect, objectId, EventFlapsSet, flapsDw,
// SIMCONNECT_GROUP_PRIORITY_HIGHEST,
// SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
// traceId, simObject, "Failed so set flaps", Q_FUNC_INFO, "SimConnect_TransmitClientEvent::EventFlapsSet");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outstanding TODO

SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY),
traceId, simObject, "Failed to set wing lights", Q_FUNC_INFO,
"SimConnect_TransmitClientEvent::EventWingLightsSet");

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fsxcommon, setting lights is handled in a separate function (sendToggledLightsToSimulation).
If possible, refactor this also into a separate function.

return this->getSimObjectForObjectId(objectId).getCallsign();
}

// TODO TZ optimize?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outstanding TODO

return callsigns;
}

// TODO TZ optimize?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outstanding TODO

Comment on lines +387 to +398
bool cont = false;
for (const CSimConnectObject &simObject : *this)
{
if (simObject.isPendingAdded())
{

CLogMessage(this).info(u"containsPendingAdded %1 ") << simObject.getCallsign();
cont = true;
}
}
if (cont) return true;
return false;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fsxcommon directly returns true here, if one simObject is pending to be added. Do we actually need to loop about all? Or was just done for logging?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants