Jump to content
The simFlight Network Forums

WASM Module + Client API for MSFS / FSUIPC7 now available (for developers and advanced users only!)


John Dowson
 Share

Recommended Posts

The first release of the WASM module for MSFS / FSUIPC7 is now ready for testing.

Note that this is initially for MSFS developers to use for access to MSFS lvars and hvars, and for advanced FSUIPC users (i.e. those familiar with lvars) who would like to start investigating the possible use of lvars and hvars (by using the provided WASMClient test application). Please note, that this WASM module has NOT YET been integrated into FSUIPC7, so there is still no direct access to lvars or hvars from FSUIPC7. This is the next stage of the development process.

The FSUIPC WASM module is available from the following location: FSUIPC-WASMv0.4.10.zip

(NB: I have not released the source of the WASM module itself yet - I will probably release at some point in the future, once I have integrated into FSUIPC7).

The downloadable zip file contains the following:
    fsuipc-lvar-module.zip: this is the WASM module. Copy this to your MSFS Community folder, extract the contents and then delete.
    FSUIPC_WAPI.zip: this is the developers API, and contains a static library + header files. For developers only.
    WASMClient.zip: this zip contains a demo test client built using the FSUIPC_WAPI, together with an ini file. This is an example of how to use the API, and also a tool that can be used to explore the lvars/hvars available for each aircraft. Allows you to list/set/get lvars, and to list/activate hvars.

WASM Module ini files

A FSUIPC_WASM.ini is provided under the WASM top-level folder. It is suggested to leave this as it is.
To make changes to the ini file, copy that file to the following location and edit from there:
     For Steam installs: <USER>\AppData\Roaming\Microsoft Flight Simulator\Packages\fsuipc-lvar-module
     For MS Store installs: <?>\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\packages\fsuipc-lvar-module\

The parameters set in this location will take precedence over those located in the ini file in the WASM folder.

WASMClient ini file

An ini file can also be used by the WASMClient, and an an example WASMCloent.ini  is provided. This just contains the default values (i.e. the WASMClient will run the same if this file is removed) but is provided if you need to adjust for any reason.

Log Files

The WASM log file can be found under:
    For Steam installs: <USER>\AppData\Roaming\Microsoft Flight Simulator\Packages\fsuipc-lvar-module\work\
    For MS Store installs:  <?>\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\packages\fsuipc-lvar-module\work

The logfile for the WASMClien.exe is created in the folder from which it is ran.

Lvar Values Update Frequency Configuration

By default, lvars are updated automatically by the WASM on each simconnect Frame. This can be changed by editing the WASM ini file, to one of Off, Second, Frame, VisualFrame.

You can also update lvar values upon request from the WASMClient. This has the advantage of allowing a finer update rate as you can specify the rate in Hz (*number of updates per second). To do this, you need to disable updates in the WASM (by setting LvarUpdateFrequency=Off), and then activate updates in the client by setting, e.g. for 6 updates per second:
   LvarUpdateFrequency=6

WASM Event Numbers Used

If you are using multiple WASM modules, you should check that the custom events being used are not conflicting.
The FSUIPC WASM module uses, by default, uses 6 consecutive event numbers starting at 0x1FFF0. You can change this if needed by setting the FSUIPC_WASM.ini file parameter StartEventNo. Note that if you change this in the WASM module, you must also change in any/all of the WASM clients.

Notes on LVAR access

Lvars are scanned by the WASM module and made available to the Client API.
In general, this seems to work ok, but there are issues.

1. LVARS can be created at any point after an aircraft is loaded, so there may be additional ones created after the initial scan and during the lifetime of the aircraft session. I have delayed the initial lvar scan to hopefully pick-up most lvars that are initially created.
There is also a 'Reload' facility (in the API and implemented in the WASMClient) that you can manually call to re-scan for lvars (and hvars), although I'm not sure how useful this is yet.

2. Many LVARS don't seem to relate to the loaded aircraft. This is especially the case when changing aircraft, is it seems many of the lvars used by the previous aircraft are not cleared.
I'm not sure what to do about this at the moment, or if this is an  issue.
One thing I could do is to introduce the concept of lvar files (as we have hvar files - see later). Lvars would still be detected via scanning, but then the list of scanned lvars would be filtered using this list, and so only lvars found by scanning AND that are in the aircraft-specific lvar file would be made available to the client. Of course, the files would be optional and would only be used if present, otherwise all lvars would be loaded.

Notes on HVARS access

Currently, HVARS for aircraft are loaded by using files, located in the WASM module folder, and loaded on a substring match on the filename to the current loaded aircraft.

The current release contains a hvar file for the A320Neo only, so hvars are only available for this aircraft.
If you want to use hvars with other aircraft, you will have to discover what they are and create a aircraft hvar file containing these (with the filename being a substring of the aircraft TITLE that uniquely identifies the aircraft, and the extension being .hvar).

If people could post the hvars they find (or the hvar files they create) then I will add them an include in future releases. Please use the topic created in the FSUIPC7 support forum for this (see below).

Reporting Issues

This topic is locked for comments. For any issues or questions, please use the following topic: 

Source Code (for developers)

The source for the API and the WASMClient test application are available from github:
    https://github.com/jldowson/FSUIPC_WAPI
    https://github.com/jldowson/WASMClient

This is an initial release and the code reflects that. Still needs a lot of work, especially in error/exception handling.

Sorry also for the code formatting - its a bit of a mess! I've been doing mainly Java for the past 25 years, and the formatting/naming convention is a mixture of java style, original K&R style and default windows/VS styling. I'll harmonize this at some point, maybe, if I ever get time.... 

I'm also new to Github, although I'm familiar with Git, so haven't really explored its possibilities. I'm happy to add improvements/updates from others who would like to contribute, but I've yet to work out how to do this, although I'm also sure its relatively straight-forward....

I'm not really interested in the Client any more, as that is just a simple test utility for the API, as well as being a useful tool for folks to start investigating lvars & hvars, and what they can do for each aircraft. I am not planning to update this further, but I'm happy to add updates from others if they wish to add new functionality.

Updates

I will post a comment in this topic when I have released a new version, so please follow this topic if interesting in receiving notifications of updates.

 

John
9th March 2021

Edited by John Dowson
v0.4.10 released
Link to comment
Share on other sites

Updated to v0.2:  FSUIPC-WASMv0.2.zip

Changes include:
    - default simconnect connection used now the defaul local connection (-1, was 0). Also both WASM module and Client allow for another connection to be used via a new ini parameter UseSimConnection.

   - WASMClient code re-organised to use FSUIPC_WAPI correctly.

Still not much documentation unfortunately. It should be relatively straightforward to use, but please ask if anything is not clear.

John

 

Link to comment
Share on other sites

Updated to v0.3: FSUIPC-WASMv0.3.zip

Changes include:
    - max number of lvar name CDAs increased from 4 to 6 (to allow up to 876 lvars)
    - improved limit checking: if more lvars are found thanthe configured available space, the remaining lvars will be ignored
    - changed to dynamic allocation of the buffer used to show lvar values (was fixed - and too small!)

John

Link to comment
Share on other sites

  • 2 weeks later...

Updated to v0.4.3: FSUIPC-WASMv0.4.3.zip
  - increased number of lvar CDAs to 7, to hold a maximum of 1022 lvars
  - new WAPI function added to allow lvar creation (using calculator code CDA)
  - added a namespace around the WASM.h defintions. CDAType enum literals also updated as this clashed with some FSUIPC #defines (*)

(*) This change could break existing code

 

Link to comment
Share on other sites

Please find attached v7.1.0d of FSUIPC7 that has lvar support via macros and lua scripts. (i.e. as in FSUIPC5/6).
This is an early 'pre-release' for testing. I am planning on updating the installer (to add the WASM) + the documentation this week, and when that is done I will release as a full beta later this week (or early next week)..

To use, you must have the FSUIPC WASM module installed. When FSUIPC7 is started, if the WASM is detected there will be a new LVAR menu under the Add-ons menu. To activate lvar functionality, you need to Enable through this menu (you only need to do this once!).

Once I have updated the installer + documentation (and released officially as a beta), I am planning in adding the following new FSUIPC controls to allow direct assignments to lvars/hvars:
     L:var Set
     L:var Toggle
     L:var Increment
     L:var Decrement
     H:var Activate
     Execute Calc. Code

I will also add access to hvars via lua and macros.

John

FSUIPC7.exe

  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...
  • John Dowson unfeatured and unpinned this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.