# Le Mans Ultimate

## Connection Method

**Shared Memory (Plugin)** — Le Mans Ultimate uses the rFactor2SharedMemoryMapPlugin to write telemetry data to shared memory. The plugin DLL must be installed into the game's Plugins folder and enabled in the configuration file.

## Automatic Setup

1. Launch Le Mans Ultimate at least once, then exit the game.
2. Select **Le Mans Ultimate** as your source in DR Sim Manager.
3. Click the **Settings** icon (⚙) next to the source.
4. Click **Install LMU Telemetry Plugin** — this will automatically:
   * Copy the plugin DLL to the Le Mans Ultimate Plugins folder
   * Create or update the `CustomPluginVariables.JSON` file with the correct settings
5. Click **Check Installation** to verify everything is configured correctly.
6. Restart Le Mans Ultimate.

## Manual Setup

DR Sim Manager uses the rF2SharedMemoryMapPlugin developed by [The Iron Wolf](https://github.com/TheIronWolfModding/rF2SharedMemoryMapPlugin). The rFactor2 plugin is compatible with **Le Mans Ultimate**.

### Steps to Enable Telemetry Output

1. **Copy the Plugin DLL**\
   The required plugin DLL is already packaged with **DR Sim Manager**.
   * Navigate to:\
     `C:\Users\UserName\AppData\Local\DRSimManager\Plugins\rFactor2\`
   * Copy:\
     `rFactor2SharedMemoryMapPlugin64.dll`
   * Paste it into:\
     `C:\Program Files (x86)\Steam\steamapps\common\Le Mans Ultimate\Plugins\`
2. **Launch and Close Le Mans Ultimate**
   * Start **Le Mans Ultimate** once to allow the game to initialize the plugin settings.
   * Shut down the game.
3. **Edit Custom Plugin Settings**
   * Open the file in a text editor:\
     `C:\Program Files (x86)\Steam\steamapps\common\Le Mans Ultimate\UserData\player\CustomPluginVariables.JSON`
   * Locate the entry for `rFactor2SharedMemoryMapPlugin64.dll`.
   * Change the `" Enabled"` key from `0` to `1`:

     ```json
     "rFactor2SharedMemoryMapPlugin64.dll":{
         " Enabled":1
     }
     ```
   * Save and close the file.
4. **Relaunch Le Mans Ultimate**
   * Start **Le Mans Ultimate** again, and telemetry data should now be available for **DR Sim Manager**.

## Available Telemetry

Le Mans Ultimate provides comprehensive telemetry through the rFactor2 shared memory plugin:

* **Orientation**: Pitch, Roll, Yaw
* **Acceleration**: Full 3-axis acceleration
* **Velocity**: Full 3-axis local velocity
* **Angular Velocity**: Full 3-axis rotation rates
* **Speed**: Vehicle speed
* **RPM**: Engine RPM
* **Gear**: Current gear
* **Suspension**: Multi-wheel suspension data
* **Vehicle Name**: Car name and class

### Telemetry Quality: ★★★★★

Uses the well-proven rFactor2 shared memory plugin, providing high-quality, low-latency data.

## Recommended Starting Settings

* **Primary Cue Gain**: 70–100%
* **Smoothing**: Low to medium
* **Washout**: Medium

## Known Quirks

* **Space in "Enabled" key**: The `CustomPluginVariables.JSON` file uses `" Enabled"` (with a space before "Enabled"). This is not a typo — the space is required by the game.
* **Same plugin as rFactor 2**: Le Mans Ultimate uses the same rFactor2SharedMemoryMapPlugin as rFactor 2. If you play both games, each needs its own copy of the plugin.
* **Plugin not enabled by default**: After copying the DLL, you must manually enable it in `CustomPluginVariables.JSON` (or use the automatic installer).

## Troubleshooting

### No telemetry data

1. Verify the plugin DLL exists in `Le Mans Ultimate\Plugins\`.
2. Check that `CustomPluginVariables.JSON` has `" Enabled":1` for the plugin (note the space before "Enabled").
3. Make sure you are driving on track (not in menus).
4. Use **Check Installation** in DR Sim Manager's settings to diagnose issues.
5. Restart both Le Mans Ultimate and DR Sim Manager.

### Plugin was working but stopped after an LMU update

* Game updates may reset the `CustomPluginVariables.JSON` file. Re-run the automatic installer or manually re-enable the plugin.
* Some updates may change the game's plugin folder structure. Verify the DLL is still in the correct location.

## Debugging the rFactor‑2/Le Mans Ultimate telemetry plug‑in

The *rFactor2SharedMemoryMap* plug‑in used by Le Mans Ultimate exposes a number of debugging switches via the `CustomPluginVariables.json` file (usually in `<SteamRoot>\steamapps\common\Le Mans Ultimate\UserData\player`). These control the amount of logging the plug‑in does and which parts of the game’s API it uses. The important flags are summarised below.

### Debug flags

* **`DebugOutputLevel`** – a bit‑mask specifying which severities are written to `UserData\Log\RF2SMMP_DebugOutput.txt`. The header defines the values: `Errors` (1), `CriticalInfo` (2), `DevInfo` (4), `Warnings` (8), `Synchronization` (16), `Perf` (32), `Timing` (64) and `Verbose` (128):contentReference\[oaicite:0]{index=0}. For example, a value of **15** (1 + 2 + 4 + 8) enables errors, critical info, developer info and warnings:contentReference\[oaicite:1]{index=1}. To capture only errors and warnings use **9** (1 + 8).
* **`DebugOutputSource`** – filters messages by origin. Each subsystem has a bit value: `General` = 1, `DMR` = 2, `Telemetry`/`MappedBuffer` = 4, `Scoring` = 8, `Rules` = 16, `MultiRules` = 32, `ForceFeedback` = 64, `Graphics` = 128, `Weather` = 256, `Extended` = 512, and input buffers (`HWControlInput` = 1024, `WeatherControlInput` = 2048, `RulesControlInput` = 4096, `PluginControlInput` = 8192):contentReference\[oaicite:2]{index=2}. Set this to the sum of the sources you need; `32767` enables all of them:contentReference\[oaicite:3]{index=3}.
* **`DebugISIInternals`** – when enabled, the plug‑in writes the raw `TelemInfoV01` and `ScoringInfoV01` structures to `UserData\Log\RF2SMMP_InternalsTelemetryOutput.txt` and `RF2SMMP_InternalsScoringOutput.txt`:contentReference\[oaicite:4]{index=4}. Useful for development, but the log files can be large.
* **`DedicatedServerMapGlobally`** – normally, shared‑memory buffers created on a dedicated server include the server process ID. Setting this to 1 causes the plug‑in to create its buffers in the global namespace so that clients running under other Windows accounts can access them. The server’s user account must have the “Create Global Objects” permission:contentReference\[oaicite:5]{index=5}.
* **`EnableDirectMemoryAccess`** – turns on the plug‑in’s *DMA* mode. When enabled the plug‑in reads additional state (message‑centre messages, global status, pit‑lane speed, etc.) directly from the game’s memory via `DirectMemoryReader`:contentReference\[oaicite:6]{index=6}:contentReference\[oaicite:7]{index=7}. It is off by default because memory scanning can be brittle; enable only if you need those extra fields.
* **`EnableHWControlInput`**, **`EnableWeatherControlInput`** and **`EnableRulesControlInput`** – these flags enable the corresponding input buffers.
  * `HWControl` lets external apps send limited control commands to the game (useful for pit‑menu interaction):contentReference\[oaicite:8]{index=8}.
  * `WeatherControl` allows an app to adjust the in‑game weather:contentReference\[oaicite:9]{index=9}.
  * `RulesControl` is experimental; it lets a client send rules inputs but may introduce timing issues:contentReference\[oaicite:10]{index=10}.\
    Only `HWControl` is enabled by default; the others must be set to 1 in the JSON file:contentReference\[oaicite:11]{index=11}.
* **`UnsubscribedBuffersMask`** – a bit‑mask that tells the plug‑in not to update certain output buffers. The values correspond to `Telemetry` = 1, `Scoring` = 2, `Rules` = 4, `MultiRules` = 8, `ForceFeedback` = 16, `Graphics` = 32, `PitInfo` = 64 and `Weather` = 128:contentReference\[oaicite:12]{index=12}. The default value of **160** (32 + 128) unsubscribes the Graphics and Weather buffers. Note that unsubscribing from `Scoring` disables the `PluginControl` input buffer:contentReference\[oaicite:13]{index=13}.

#### Recommended settings

For most users wanting to see **errors and warnings**, set:

```json
{
  "DebugOutputLevel": 9,
  "DebugOutputSource": 32767
}
```

This will log error and warning messages from all plug‑in components while avoiding verbose timing or performance data. Leave the other debug flags at their defaults unless you need the specialized functionality described above.

## Notes

* Ensure **Le Mans Ultimate** is fully closed before modifying `CustomPluginVariables.JSON`.
* If the file does not exist, launch the game once and exit to generate it.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.departedreality.com/dr-sim-manager/general/sources/le-mans-ultimate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
