A simple command-line tool for Windows used to change the display monitor that Terraria renders the game on.
The Terraria Monitor Tool is a command-line program written in C++ and utilizing the Windows API to edit the display monitor that Terraria will render the game on by modifying the configuration file that Terraria uses to store user settings.
- Lightweight and Portable
- Stateless Mode and Support for Clearing Program Data
- Support for Custom Game Directories
- Support for Multiple Configuration Files
- Automatic Configuration File Backups (Coming Soon!)
- Default Configuration File / Display Monitor Preferences (Coming Soon!)
- Support for Custom Display Resolutions (Coming Soon!)
- Non-Interactive Mode (Coming Soon!)
Terraria stores the monitor it renders the game on within the Display and DisplayScreen properties of the config.json file where most user settings and preferences are stored. E.g.,
{
"Display": "\\\\.\\Display1",
"DisplayScreen": "\\\\.\\Display1",
}By changing the value of these properties in the config.json file, Terraria will launch the game on the correct monitor instead of the monitor it was previously being launched on.
The config.json file is located in the Terraria Game Data Directory in the User Documents folder, which can generally be found in one of two default locations:
C:\Users\YOUR_USERNAME\Documents\My Games\Terraria
or
C:\Users\YOUR_USERNAME\OneDrive\Documents\My Games\Terraria
From time to time, when playing Terraria on my multi-monitor setup, the game would launch on the wrong monitor with no in-game solution available. It turns out that Terraria records the monitor to render the game on in the config.json file using its generic display identifier, which looks something like \\.\Display1. Because Windows is free to assign these identifiers however it chooses, the monitors associated with each identifier sometimes change, causing Terraria to render the game on a different monitor.
For example, suppose we have two monitors:
- Monitor A, which has a generic display identifier of
\\.\Display1- Monitor B, which has a generic display identifier of
\\.\Display2Now, suppose that when you launch Terraria for the first time, it uses the Main Monitor, which happens to be Monitor A. Terraria will save
\\.\Display1to theconfig.jsonfile and launch on Monitor A.However, at any point in time, Windows may decide to reassign the connected monitors in the system to different idenfiers, at which point:
- Monitor A, now has a generic display identifier of
\\.\Display2- Monitor B, now has a generic display identifier of
\\.\Display1Maybe you can see where this is going? Because Terraria only knows that the monitor it should render the game on by the identifier
\\.\Display1, the game will be launched on Monitor B, rather than on Monitor A.
As a result, there are generally two solutions to getting Terraria to render the game on the correct monitor:
- Modify the
config.jsonfile to reflect the new generic display identifier of the desired monitor. - Sign out or restart your computer, or physically reseat your display cables and hope that Windows decides give the monitors the correct identifiers.
TerrariaMonitorTool [ /?|--help|--usage [<Option or Switch>] ] [ -v | --version ]
[ -d|--dry-run ] [ -s|--stateless ] [ -y|--yes ]
[ -b|--disable-custom-buffer-behavior ]
[ --clear-program-data ] [ --debug ]
The program can be launched directly from the program executable or via the command line. Command-Line Flags can be added when launched via the command line or by creating a Windows Shortcut and adding them to the end of the target.
| Flag(s) | Description |
|---|---|
/?. --help, --usage |
Get help and usage information |
-v, --version |
Display Version Information |
-d, --dry-run |
Don't write changes to the Configuration File |
-s, --stateless |
Skips reading from or writing to any program files |
-y, --yes |
Automatically answer "yes" to all Confirmation Prompts |
-b, --disable-custom-buffer-behavior |
Disable custom behavior for Console Output Buffers |
--clear-program-data |
Clear existing Program Data before launch |
--debug |
Enable functionality useful for debugging |
TerrariaMonitorTool [ -v | --version ]
Displays Version Information about the Program.
TerrariaMonitorTool [ -d | --dry-run ]
Writes the contents of the modified Terraria Configuration File to the Console instead of saving them to the Configuration File.
TerrariaMonitorTool [ -s | --stateless ]
Skips any optional reading from or writing to any program files.
As a result, no changes to any existing program data will be made by the program, even if changes are made to the Program Settings.
This option does not effect whether or not changes are made to the Terraria Configuration File or any Backup Files (see --dry-run instead).
TerrariaMonitorTool [ -y | --yes ]
Automatically confirms or answers "yes" to any Confirmation Prompts.
This flag should be used with caution, as it permits for potentially dangerous actions to proceed without any further confirmation.
This flag applies to Confirmation Prompts triggered in response to both Comamnd-Line Arguments, as well as Interactive Menu Selections.
TerrariaMonitorTool [ -b | --disable-custom-buffer-behavior ]
Disables custom behavior for the Console Output Buffers, including tweaking how the Console is Cleared and the way Alternate Output Buffers Work.
If you are encountering issues with how the program is rendered when switching between screens or clearing the console, you can try running the program with this flag.
TerrariaMonitorTool [ --clear-program-data [ -y | --yes ] ]
Clear any existing Program Data before launching the program.
Applies to files used internally by the program, as well as any existing Backup Configuration Files. This does not apply to any Terraria Configuration Files that are not being used as backups.
This action requires confirmation before proceeding. To proceed automatically when launching the program, you can use the --yes flag.
TerrariaMonitorTool [ --debug ]
Enables functionality useful for debugging, including enabling additional logging and adding a delay at the start of the program for debuggers to be attached.
While every effort has been reasonably made to ensure this program never leaves any Terraria Configuration Files or other user data in a corrupt or invalid state, the author of the program is not responsible or liable for any destroyed, lost, or malformed data as a result of using this program, especially if you choose to use the program in a way for which it was not explicitly intended.