• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

[Solved] XMLKeys for a joystick axis - proper usage?

taguilo

Resource contributor
Roman,

Thanks.
After doing some tests in P3Dv4 with XMLTools and other gauges that use Simconnect, I think I am right.

-When reloading aircraft with Simconnect panel gauges, plus XMLTools gauges, sim failed after 26 attempts
-When reloading aircraft with XMLTools gauges only, I stopped at 190 without any failure and refresh was immediate.

Besides, XMLTools never gave an exception, something that happens with other gauges.
I believe the problem is that some gauges do not close Simconnect properly, therefore reducing the number of concurrent slots availables.

Bear in mind XMLTools is a module, not a gauge. I believe that, when reloading an aircraft, gauges are not completely unloaded, and behave different being XML or C++

-In C++ gauges, it seems the .dll is not unloaded from memory but the macro classes are.
-In XML gauges seems to be similar, but the .dll that process all of them is only one (panels.dll)

So, we have for each C++ gauge an independent dll, and only one dll for all of XML gauges IMO.

When an XML gauge linked to any XMLTools class is "reloaded", it sends a command to XMLTools module to close the link to that class (object), delete it and release the pointer involved.
And that is what happens with Simconnect classes (SIMVARS and XMLKEYS), the connection is clean closed and open again when the gauge is initialized again.

Perhaps, and I might be wrong, some C++ gauges using Simconnect are doing the open/close process in wrong section(s); the link is not closed on reload then the "slot" is not released as it should.

Attached is the XMLTools only example so you can check. No errors or exceptions of any kind.
 

Attachments

  • SimConnect019.zip
    385.3 KB · Views: 141

Heretic

Resource contributor
Most of my projects have at least one C++ gauge running alongside XML gauges interacting with XMLTools, namely Doug D.'s XMLSound gauge. I'm not sure if it uses SimConnect when installed in FSX aircraft (it's cross compatible to FS9 after all), but if it does,it would explain why the C++ gauge does not fail after a couple of reloads while the XMLTools connection does.
Maybe FSX starts to use memory reserved for SimConnect or other modules for C++ gauges at some point, preventing their use.
 

ddawson

Resource contributor
Yes, the xml sound gauge uses SimConnect in FSX.
Sadly, there is no "right" way to close a SimConnect connection in a gauge. Whether you use PANEL_SERVICE_DISCONNECT or module_deinit, FS will have moved on to do other things (including re-loading the gauge) before the call to SimConnect_Close has been completed.
It would certainly be possible to build a user triggered disconnect function into any gauge, but to be effective it would have to be triggered manually, before the aircraft reload event was triggered.
I think a better approach may be to delay opening SimConnect as long as possible. Experimentation will tell.
 
Top