TNI Controls Interface

From TrainzOnline
Revision as of 13:52, 22 November 2017 by Pw3r (Talk | contribs)

Jump to: navigation, search

TNIControls is a builtin TNILibrary within Trainz which allows controls plugin assets to communicate their control input to Trainz. These commands can then be bound to in-game functions by the player, via the standard control settings UI.

Before continuing, it is recommended you first familiarise yourself with the following pages:

* TrainzNativeInterface - For an overview of TNI and the associated licensing requirements
* TNI Core Interface - For details of the core TNI functionality, object types, etc.
* KIND tni-controls-plugin - For the specification of the controls plugin asset kind.

NOTE: This page is a work in progress, and reflects technologies which are not yet present in retail versions of Trainz.


TNIControls is a singleton system within Trainz native code. It is initialised at game startup (if supported by the install, and enabled by the player), and will automatically locate and load any installed TNI controls plugin assets. Such assets will then have their plugin DLLs loaded into the same TNIContext as TNIControls itself, where the plugins can locate hardware devices, register them, and provide control inputs.

TNIControls itself is entirely thread safe, and may be loaded and called at any time from within a controls plugin DLL, using the TNIGetContextLibrary function. The specific function calls supported by TNIControls are detailed in the next section.

TNIControls Library Calls

Personal tools