MSFS2020 Developer Mode, Model Behavior dialog and Console window - MobiFlight/MobiFlight-Connector GitHub Wiki

This section is a very brief discussion of the Developer Mode of MSFS2020 and the parts of it that we use in searching and testing events. The simulator provides a special user interface for add-on content development called Developer Mode. It is activated from the Options menu of the simulator. Once activated, a new menu will appear at the top bar of the simulator window. Developer Mode gives you access to tools that allow you to see the inner workings of the simulator. The Model Behavior and the Console windows are two important components of Developer mode and are opened from the Windows menu of the Developer Mode menu.

image

First, the Console screen displays all the errors, warnings and messages generated internally by the simulator. This window allows you to monitor what is being executed by MSFS. The code sent by the Mobiflight wasm module to the simulator will appear as part of the error messages in the Console. This can be very helpful in confirming that the instructions are well received by MSFS. Also, the console will display any error messages related to problems encountered with the code received.

UPDATE. As of SU5 the console error messages do not show the mobiflight code to be executed, only actual errors encountered like invalid variables or events.

image

Behaviors Debug dialog tab The name was changed from Model Behaviors in SU5. This is probably the most used tool in our search for simulator events and their respective code. It is a window that allows the user to deconstruct the inner structure of all the models being run by the simulator. Once a particular component of an airplane is selected, this tool can display all the details and the code being executed for every component of the airplane simulation, allowing us to extract these instructions for use in our panels connected to Mobiflight.

The first level of the simulator structure deals with the various models used. This information is stored in several xml files. You need to search and select the appropriate xml file for your chosen airplane operation from the many options presented. The file name will usually contain the name of the airplane and the word "interior" or "cockpit". In the image below we show the xml selection for the Citation CJ4 Cockpit.

image

The Component Search feature is used to find any component that has the search keyword in its name. For example, entering the word “engine” will show as result all the components related to the airplane’s engines. Additionally, a Templates filter can also be used to narrow down the search for particular templates. For example, I like to enter the word “code” in the templates filter, so that all of the templates that contain this word will be highlighted in yellow, and all of the sections containing “code” in their name will show in red color, including the code.

The Mouserect section displays all the mouse interactions that the simulator does for a particular component selected. It is located at the very bottom of the Model Behaviors window and it can be essential in tracking what code is being executed by MSFS. In this example we have selected the Citation CJ4 cockpit XML to begin with, and have narrowed our selection to Autopilot panel and the Heading select button. Scrolling to the very bottom we can see the button emits a "H" event called WT_CJ4_AP_HDG_PRESSED.

image

Within the Mouserect section there is another subsection called Logger. The Logger can display the status of any variables and events involved in the component selected. It is very useful when tracking how variables behave in the simulator. One mouse click on the in-sim control will immediately show in the Logger, confirming that you have selected the desired configuration.

A great new feature introduced in SU6 allows us to display a control in the Behavior Debug window by hovering the mouse over the control in the virtual cockpit. When the control turns blue, press Ctrl-G in your keyboard. The selected control will be shown in the Behavior Debug window immediately.

B: Events With SU5, a new class of events was created, the B: type events. These new events are now used to simplify some of the RPN code previously used in MSFS2020. Unfortunately, we do not yet have access to them for use in Mobiflight, even though the SDK documentation appears to indicate that these B events should be available. Nonetheless, the underlying code used by these B: events can be seen in the "Input Events" tab.

New Input Events Tab Also with SU5, the Model Behaviors window was modified to include a new tab called "Input Events". This new section shows the code for the new B: events. To see the code, select an event from the menus on the left side of the window and press Open in Control Panel. This Control Panel within this page that allows the user to place an event here for monitoring its behavior and also trigger events. There are several tabs on the Control Panel, but you will most likely find the code you need in the "Set" tab. One of the nicer features of this control panel is that the code can now be selected and copy/pasted. This is something that is still missing in the main Behaviors Debug tab.

image

In many cases, the code presented in the Control Panel is intermixed with O: variables, to which we don't have access. You will need to analyze the code and pick and choose the relevant parts that send the instructions to the simulator.

Important: in order to see the code, you need to deselect the "Minimize data load" checkbox and press the "Reload User Container" button. This will cause MSFS to reload the airplane files. After this, the code will be visible in the control panel section by pressing the "Monitor in Control Panel" button. In most cases, the interesting code is contained in the Set tab.

Local Variables Tab All the local variables or Lvars currently used by MSFS2020 are listed in this tab. Airplane, airport, land equipment, as well as user defined local variables are shown along with their current value. It is a helpful tool to check what the simulator is doing with the Lvars, what their value ranges are, as well as checking if Mobiflight controls are changing the corresponding variables in the simulator as expected. The search field can be used to narrow down the list of variables. A nice new feature of the Local Variables windows is that you can now change the values of the variables directly by just clicking on the variable line and entering a new value. The sim will respond to this change. For example, the search feature is useful to monitor your own L-vars from the simulator side. You can also click on any variable value and change it. The sim will react according to the new value, just as if the control had been pressed in the virtual cockpit.

Certain types of Variables Remain Inaccessible As of SU9, users are able to access A:, E: and L: type variables; H: and K: type of events. All others, such as O:, I: variables, and most notably B: events remain inaccessible to the users.