• 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.

MSFS20 Linking SimConnect into a WASM gauges module

Messages
19
Country
colombia
Hello everyone,
I hope you are all doing very well!

As the thread's subject says, I would like to link SimConnect into a MSFS WebAssembly gauge module. This is because I plan to work on TCAS functionality for a digital VSI that I developed in WASM for the currently available EMB110, and also for a future aircraft that I am developing, and AFAIK SimConnect features some calls for that purpose.

When I tried calling the SimConnect dependencies (SimConnect.h and other includes and libs), building the project throws an error, where it says 'unknown definition DWORD', and some other errors regarding unknown types definitions. What I did first was to create a WASM gauge project, then linking SimConnect dependencies by manually editing the project properties. Do I have to create a WASM module project instead, and then link the gauge CPP and graphics dependencies on it?

I look forward to a further reply on this topic.
Thank you very much!
 
Hello Carlos

What I have done is to create a WASM module and then have a 'central' cpp file that links to all other cpp files for the project. The simconnect.cpp file then deals with all the SimConnect setup and events etc.. Your 'unknown definitions' most likely come from having a double include for one or more cpp files e.g. you have the file listed in the Solution Explorer but have forgotten to mark is as Excluded From Build. Here's a link to the project I created when first figuring out how to attach SimConnect to MSFS:


The solution is in SimConnect Testbed. As the SimConnect part is effectively a standalone gauge you willl need an entry in the panel.cfg file for it. Main.cpp is used as an entry point which links to all other gauges in the WASM project. Apart from the SimConnect gauge there is only one other in the project - it is called aircraft.cpp and has nothing in it except a comment. The SimConnect part of the project is effectively set up as a 'black box' so may not apply to you. If you look at the flags.h header file, that defines which parts of simconnect are required for the current project. I was also experimenting with SimConnect-to-SimConnect communication using custom events. All in all, I would use the code and setup as a guide rather than trying to get it to work because I suspect that being a testbed project, it is not complete any longer.

Finally, the reason for dfd_msfs_gauges.h rather than using the default gauges.h file is that I have removed all of the FS610 macros that cause warnings to be thrown.

-Dai
 
What I have done is to create a WASM module and then have a 'central' cpp file that links to all other cpp files for the project. The simconnect.cpp file then deals with all the SimConnect setup and events etc.. Your 'unknown definitions' most likely come from having a double include for one or more cpp files e.g. you have the file listed in the Solution Explorer but have forgotten to mark is as Excluded From Build. Here's a link to the project I created when first figuring out how to attach SimConnect to MSFS:

The solution is in SimConnect Testbed. As the SimConnect part is effectively a standalone gauge you willl need an entry in the panel.cfg file for it. Main.cpp is used as an entry point which links to all other gauges in the WASM project. Apart from the SimConnect gauge there is only one other in the project - it is called aircraft.cpp and has nothing in it except a comment. The SimConnect part of the project is effectively set up as a 'black box' so may not apply to you. If you look at the flags.h header file, that defines which parts of simconnect are required for the current project. I was also experimenting with SimConnect-to-SimConnect communication using custom events. All in all, I would use the code and setup as a guide rather than trying to get it to work because I suspect that being a testbed project, it is not complete any longer.

Finally, the reason for dfd_msfs_gauges.h rather than using the default gauges.h file is that I have removed all of the FS610 macros that cause warnings to be thrown.


-Dai

Hello Dai,

Thank you very much for your answer. I am going to take a look to the source files, so I can see how to make the correct arrangement on my own solution. Thank you for sharing!

BTW, regarding the gauges.h, I never thought it was due to those old macros, thankfully they are not actual build errors but just warnings 😅
That's why I had those when I built my initial VSI gauge.

If I have any doubts, I will let you know.
Thanks a lot!
 
Back
Top