MSFS2024 has a new IO API to handle files from the package contents.
But is it still safe to use the old functions (fopen, opendir, ofstream) for files in the /work
folder, or should we also use the IO API there?
MSFS2024 has a new IO API to handle files from the package contents.
But is it still safe to use the old functions (fopen, opendir, ofstream) for files in the /work
folder, or should we also use the IO API there?
Hi @Jayshrike
You can safely keep using the old functions, especially when accessing files in the “work” folder.
The main reason we added the async API is that, in the case of files being read from the package itself, we may have to stream these files first prior to being able to open & read them.
Unfortunately we cannot start the streaming in the middle of executing the WASM module, so what happens is that we pause the sim, trigger the streaming and then unpause the sim (usually at the next frame but it can take longer) when the operation is completed.
This introduces a lag of (at least) one frame which can create stutters and requires complex synchronization mechanisms in the backend.
Using the async API means that you are told when the data you want to read is really available, which can avoid these unnecessary delays.
Best regards,
Eric / Asobo