XPLM_MSG_WILL_WRITE_PREFS

#define XPLM_MSG_WILL_WRITE_PREFS 107

This message is sent to your plugin right before X-Plane writes its preferences file. You can use this for two purposes: to write your own preferences, and to modify any datarefs to influence preferences output. For example, if your plugin temporarily modifies saved preferences, you can put them back to their default values here to avoid having the tweaks be persisted if your plugin is not loaded on the next invocation of X-Plane. The parameter is ignored.