• 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 WASM - Setting Simvars

IMHO if your gauge can be written in html/js, you'll be better off getting up to speed with the new framework the clinging to C++.
As long as you're ok with people being able to take your code without permission. Sure.
 
With the developer mode activated, open this widnow that lists the packages, you will see some of them are encrypted (see the "encrypted content" column) :

1619122095410.png


For example, the Baron G58 is encrypted. If you look into its directory, you will see everything is packed into .fsarchive and .spb files, nothing is accessible.
It shows content can be encrypted to protect intellectual property, but I don't know how to do this.
Does anyone know?

Eric
 
I can reverse an .spb file and it will be a mere matter of time before the content of an .fsarchive is decoded.

The nice thing about C/C++, it compiles to machine language. There are a great deal of ways to obfuscate in C/C++.
 
Thank you for the detailed example & walkthrough! This is fantastic & answers my question about overriding events.

Sorry to go back to event triggers, another useage issue - In my test I'm just working with the gauge API, here is a simple extract of my useage (so far MYEVENT_DOOR is called succesfully upon clicking the door handle). As you can see sim events work fine but no luck passing in my custom event ID

Code:
const int MYEVENT_DOOR{ 0x11011 };
const int MYEVENT_TEST{ 0x11010 };

static void FSAPI EventHandler(ID32 event, UINT32 evdata, PVOID userdata)
{
    printf("Event Handler called\n");
    switch (event)
    {
    case MYEVENT_TEST:
        printf("Test event called\n");
    case MYEVENT_DOOR:
        printf("Success! Door event called \n");
        //trigger_key_event(KEY_TOGGLE_NAV_LIGHTS, 1);                //This works, toggles the nav lights on/off
        //trigger_key_event(MYEVENT_TEST, 1);                                //This does not work
        break;
    default:
        printf("Default called\n");
        break;
    }
}

Is this invalid? I thought maybe calling a custom event inside the handler might not be allowed, however putting the trigger_key_event call inside the pre_update loop also did not work. Once I resolve this I will begin exploring SimConnect more thoroughly with your example

Cheers
you need to change accordingly to get FSX work in MSFS, see careful in SDK sample, you will notice slight different on "EventHandler" between FSX and MSFS. the code inside Eventhandler still same schema as FSX
I do it on my project aircraft and have no issue.
 
Thanks guys for all the clarifications; after studying the Simconnect samples it's all making sense now.

One final question I have; in the docs it says I can build SimConnect modules as a Web Assembly Module by simply including SimConnect.h in the WASM project. In practice however, if I make a new project configured as a WASM project, my VS does not find or recognize the <windows.h> include, breaking most of the SimConnect functionality. If I follow the steps to make a new SimConnect project however (using the provided property sheet) it of course works fine, but obviously there's no access to the panel SDK.

Could I make this work by tweaking the includes/dependencies or are they simply not designed to be used together in the same solution/project?

In the docs it states "WebAssembly modules can use SimConnect internally, provided as part of the SDK. It is only required to inlcude "simconnect.h"." But I've seen threads about how to access LVARS from SimConnect, and it didn't look as simple as being able to call from both API in the same project. Can anyone confirm?

Hi Mike ive read this post of yours from past april 2021 ... it seems that by then, nobody was able to answer your well said and clear questions.

I am doing now some research on fsdeveloper forums to know if somebody has had the experience of coding a WASM gauge which is at the same time (same VS project) a SimConnect client to be able to pass local variables by means of the MSFS SimConnect sever into another SimConnect client in a .exe program (C#, C++ or other).

So, did you managed to code such a WASM gauge??, if so, would you be so kind to share experience, and/or example code, on how did you managed to pass local variables into an external SimConnect . exe program??

Thank you very much in advance for any reply.
Kind regards
Jaguair.
 
Hello
this page talk about how to access different vars from the sim, using their character index
I read that the Z char is used for custom variables.
however, I don't seem to find anything about how to create those variables, how to register them, or just let the sim know that they exist; I would like to use a custom var for a simobject that doesn't have any gauges and is not controlled by the user
would you please tell me how custom simvars are actually created?

PS. P3D used the PDK to register custom vars through a C++ DLL
 
Back
Top