Categories: MobiFlight, MSFS2020

Adding workarounds to MSFS2020 for MobiFlight

Update 2024-02-10: If you are trying to access the inaccessible switches on the TBM930 there’s an add-on available that exposes them as Lvars. You can use that add-on to implement the below workaround without having to edit the file yourself.

With the release of Sim Update 5, Asobo and Microsoft dramatically changed how sim events work to manipulate airplane controls. Unfortunately this broke the experience for many switches when trying to set them via MobiFlight.

Wish you didn’t have to apply this workaround? Me too. Help change this by upvoting the feature request for better access!

What happens without a workaround is you can control the switches via MobiFlight but the in-sim switch doesn’t update to reflect the current state. For example you can turn the inertial separator of the TBM930 on with MobiFlight and the MFD will show the “Inert sep” warning correctly but the switch on the in-sim de-ice panel will still be in the off position.

Luckily there’s a workaround. In this post I’ll walk through the steps to apply the workaround for two switches in the TBM 930: propeller de-ice and inertial separator.

Step 1: Download and install the TBM930 improvement mod

Technically you can make this change to the sim files directly but since the TBM930 improvement mod is a must-have if you fly the TBM930 we’ll be applying the workaround to its files instead.

Download and install the mod.

Step 2: Open the tbm930_interior.xml file in a text editor

The file to edit is located in the aircraft-tbm930-improvement\SimObjects\Airplanes\Asobo_TBM930\model folder, inside the MSFS2020 Community folder. Open the tbm930_interior.xml in the text editor of your choice. I prefer Visual Studio Code but it can be any text editor like Notepad, Notepad++, etc.

Step 3: Add the workaround to the file

Locate the following section near the top of the tbm930_interior.xml file:

    <!-- INSTRUMENT ################################# -->
    <Component ID="INSTRUMENT">

Above that section paste the workaround in:

    <!-- ############################################### -->
    <Component ID="MobiFlight_External_Control">
      <UseTemplate Name="ASOBO_GT_Update">
        <UPDATE_CODE>
            (L:MF_TBM930_DEICE_Engine_1_Set, Number) s0 0 &gt; if{ l0 1 - (&gt;B:DEICE_Engine_1_Set) 0 (&gt;L:MF_TBM930_DEICE_Engine_1_Set) }
        </UPDATE_CODE>
        <FREQUENCY>1</FREQUENCY>
      </UseTemplate>
    </Component>

The resulting file should look like this:

Screenshot of the workaround applied to the TBM930_interior.xml file.

Save the file, close it, and restart Microsoft Flight Simulator.

Step 4: Update your MobiFlight switch configurations

For the On Press and On Release actions of each switch you’ll need to update the configuration to use the MSFS2020 – Custom Input option and add the correct custom event. They are:

SwitchEventCustom input
Prop de-iceOn Press2 (>L:MF_TBM930_DEICE_Propeller_1_Set)
Prop de-iceOn Release1 (>L:MF_TBM930_DEICE_Propeller_1_Set)
Inertial separatorOn Press2 (L:>MF_TBM930_DEICE_Engine_1_Set)
Inertial separatorOn Release1 (L:>MF_TBM930_DEICE_Engine_1_Set)
Custom inputs to use in MobiFlight with the workaround.

For example the On Press event for the prop de-ice switch should look like this:

Screenshot of a properly configured prop de-ice switch On Press event in MobiFlight using the workaround.

Step 5: Fly!

That’s all there is to it! Now you’re ready to fly and enjoy the physical switches working as they should with the sim.

Using this technique on other planes

While this post focused on modifying the TBM930 the same technique works on other planes as well. For other planes you’ll edit the *_interior.xml file for that plane, likely in the Asobo official file, and insert a similar block of XML that defines new events to wrap the Bvars in the sim.

When creating your custom event it’s important to offset the value by one from 0. This ensures the event only takes effect if the value is explicitly set by MobiFlight. For example if the sim expects a value of 0 to turn something off and 1 to turn something on the custom event should instead take a value of 1 for off, 2 for on, and then subtract 1 from the provided value before passing it to the sim.

You can see this in action with any of the above custom events, for example:

(L:MF_TBM930_FUEL_Selection_Set, Number) s0 0 &gt; if{ l0 1 - (&gt;B:FUEL_Selection_set) 0 (&gt;L:MF_TBM930_FUEL_Selection_Set) }

The custom event checks to see if the value is greater than 0 before doing anything. If it’s 0 nothing happens and the sim will function as if the workaround isn’t applied at all. If it’s greater than 0 then 1 is subtracted from the specified value (to turn it into what the sim expects), then it is passed to the sim.

A few closing notes

The workaround will get overwritten every time a new version of the TBM930 improvement mod is released. You’ll need to go back to step 3 and apply the change after every improvement mod update.

There are other switches in the TBM930 that need these changes, such as the fuel selector switch. You can find them documented on HubHop, the unofficial repository of all MSFS2020 events. When adding additional workarounds you only need to insert the new Lvar from hubhop into the existing workaround block applied in step 3. For example to apply the workaround for the fuel selector switch the workaround block winds up looking like this:

Screenshot showing multiple workarounds applied to the TBM930_interior.xml file.

The MobiFlight wiki is a wealth of knowledge for how to do things like this. Check out the article on how to use custom input page or how to use the developer tools to uncover events.

2021-10-14: Updated RPN to use registers instead of duplicating on the stack. Corrected a > to &gt;.

Article info