---
title: Command Parsing
---

Drop uses a cross-platform, POSIX inspired command parsing for a consistent way to define launch commands in a single string.

The basic format is:

```bash
MY_ENV_KEY=myvalue MY_OTHER_ENV_KEY=myothervalue mycommand --myargs --myotherargs "other string"
```

Drop will split this into three parts:
| | |
| -- | -- |
| Environment variables | Collects anything that has a `=` at the start. (`MY_ENV_KEY=myvalue MY_OTHER_ENV_KEY=myothervalue`) |
| Command | The next value (`mycommand`) |
| Arguments | Everything else (`--myargs --myotherargs "other string"`) |

Then, what happens with this, depends on the type of game we're launching:

## Normal (no emulator)

Drop reconstructs the original shell string, and passes it into platform-specific command wrappers. For Windows, this means nothing. For Linux, it gets wrapped in `umu-run`.

It is then parsed again, and then passed into process creation, mapping the environment variable, command, and arguments into their respective platform-dependent places.

Drop logs out it's final parsed command, if you want to look at it in the client logs.

## Emulators
For emulators, we have the "emulator version" (version containing the emulator), and the "emulated version" (version containing the ROM). 

Drop takes the environment variable passed to the ROM, and appends it to the emulator version's environment variables. It then makes the emulator's command **absolute** (relative to the install directory), and replaces all instances of `{rom}` in the emulator's **arguments** with the **absolute** path to the **command** from the ROM.

Then, it reconstructs this command, and runs it through the platform-specific command wrappers, and passes it to process creation. See above for information about that.

## Format args

Format args are applied, twice over, after the above processes are done

| Key         | Value description                                                                  |
| ----------- | ---------------------------------------------------------------------------------- |
| `{dir}`     | The current working directory/install directory.                                   |
| `{exe}`     | The relative name of the executable. The command from above parsing.               |
| `{abs_exe}` | The absolute path of the executable, the command appended to the install directory |
| `{rom}`     | Emulator-specific, the absolute path to the command passed in the ROM version      |
