I have for some time been looking for a way to restart my WASM dynamically with the MSFS running.
Now I have to reload MSFS every time I change my WASM code during development testing.
In the official WASM documentation it is stated:
In both cases the game will look for and execute the following module functions if they exist:
-
extern "C" MSFS_CALLBACK void module_init(void)
: upon loading or after sign-in.
-
extern "C" MSFS_CALLBACK void module_deinit(void)
: upon closing the game or after sign-out.
How to you make a sign-in sign-out as stated?
What I do to quickly test my WASM gauge is to modify an aircraft’s panel.cfg (like the stock C172 G1000) to load the gauge in. Every time I replace the WASM file with new changes, I go to the aircraft selector and reload the aircraft from there which rebuilds and initializes the module. The module_init
will be called when the aircraft loads the gauge in.
Example panel.cfg entry:
[Vcockpit04]
size_mm=0,0
pixel_size=0,0
texture=$SCREEN_3
htmlgauge00=WasmInstrument/WasmInstrument.html?wasm_module=VFS/Path/To/Module/MyWasmModule.wasm&wasm_gauge=Test, 0,0,0,0
Hi,
you can simply recompile your wasm, attach your debugger to MSFS, if you need to, and rebuild the package within MSFS. This will cause MSFS to decompile your wasm into a .dll and reload it into memory.
Greets,
Ben
1 Like