The MiSTer RT4K DV1 Profiles Generator is a Bash script designed to automate the replication of profile files (.rt4
) for the RetroTINK 4K device, specifically for use with the MiSTer FPGA system. This script simplifies the process of generating profiles for various MiSTer cores, ensuring that your RetroTINK 4K is correctly configured to display them.
By scanning your MiSTer directories—either locally or remotely via SSH—for console, arcade, computer, and utility cores, the script creates corresponding profile files in the profiles/DV1/
directory on your RetroTINK 4K SD card. It handles special cases, allows for additional custom profiles, and includes options for customization and verbose output.
- Automated Profile Generation: Scans MiSTer core directories and creates corresponding
.rt4
profiles. - Supports Multiple Core Types: Handles console, arcade, computer, and utility cores.
- SSH Remote Retrieval: Optionally retrieves core names from a remote MiSTer device via SSH, eliminating the need to remove the SD card.
- Default MiSTer Path and SSH User: Assumes default MiSTer path
/media/fat/
and SSH userroot
if not specified. - Customizable Base Profiles: Allows you to specify base profiles for different core types.
- Per-Core Profile Overrides: Supports custom per-core profiles through an override script (
profiles_config.sh
). The script includes predefined entries for all available MiSTer cores, making it easy to customize profiles by uncommenting the respective lines. - Profile HDMI Input Override: Allows setting the HDMI input for all DV1 profiles to ensure compatibility with the RetroTINK 4K. This feature can be enabled with the
--set-hdmi-input
option. If Python3 is installed, the HDMI input override is performed using a Python script for faster execution; otherwise, it falls back to a slower Bash implementation. - Additional Arcade Profiles: Processes additional arcade profiles listed in a text file.
- Force Overwrite: Option to forcefully recreate and overwrite existing profiles with the
--force
flag. - Special Case Handling: Includes specific handling for certain cores like GBA, GBC, and menu cores.
- User-Friendly Options: Command-line arguments and environment variables for easy customization.
- Verbose Output: Optional verbose mode for detailed logging.
- Error Handling: Checks for missing files and directories, providing meaningful error messages.
The RetroTINK-4K is compatible with the MiSTer's DirectVideo (aka DV1) video output mode. Compatible cores can output DV1 video over HDMI, which aims to preserve the original content's pixel-accurate video. To work within the HDMI standard, DV1 can often require resolution padding (black bars) and pixel multiplication. By including the padding and multiplication info in the HDMI transmission itself (via the HDMI SPD Infoframe), compatible devices can recreate a pixel-accurate image by cropping the frame and decimating any pixel duplication.
Auto-Decimate: When set to "Infoframe" (recommended when using DV1), the RetroTINK-4K will use the DV1 infoframe data to set the correct decimation factor. "Measure" will try to guess the best decimation setting based on the characteristics of the image. Auto-Decimate can be disabled by selecting "Off".
Auto-Crop: When set to "On", the RetroTINK-4K will use the DV1 infoframe data to automatically crop any black borders. Auto-Crop can be disabled by choosing "Off".
Note that DV1 input can also automatically trigger profile changes, using the Auto Load DV1 Profile function:
- Auto Load DV1: Will automatically load a DV1 profile, based on the detected DV1-compatible MiSTer core. Requires the name of the profile to match the core name, and for the profile to be located in the DV1 folder. Example:
sdcard/profile/dv1/core-name.rt4
.
-
Automatic Profile Loading per Core: By utilizing the Auto Load DV1 feature, the RetroTINK-4K can automatically load specific profiles per core. This is especially useful when combined with Scanlines (CRT Simulation) profiles for each machine, ensuring the correct display configuration with pixel-accurate representation through the auto-decimation and auto-crop features.
-
Vertical (Tate) Mode for Arcade Cores: Another use case is to automatically switch and activate Tate mode (vertical orientation) for specific arcade cores. This ensures the correct display format without manual intervention.
-
Profile Overrides for Specific Display Needs: You can always force a certain profile for a console or core if needed. For example, if you want to use a zoomed-in display or have a different preferred display configuration, the override function allows for complete flexibility.
- Requirements
- Installation
- Backup
- Usage
- Configuration
- Additional Arcade Profiles
- Output
- Logging and Verbose Mode
- SSH Key-Based Authentication Setup on MiSTer
- Troubleshooting
- Contributing
- Todo
- License
- Acknowledgements
- Contact
- Operating System: Linux or any Unix-like system with Bash.
- Bash Version: Bash 3.0 or higher.
- Dependencies: None (uses standard Unix utilities like
cp
,mv
, etc.). - SSH Access (optional): For remote retrieval of core names, SSH access to the MiSTer device is required.
- SSH Keys: Recommended for password-less authentication.
- RetroTINK 4K: Up-to-date SD card with the latest profiles installed:
- Kuro Houou Profiles: Google Drive Link
- Wobbling Pixels Profiles: Google Drive Link
- MiSTer FPGA: Up-to-date SD card with the latest core updates.
- Python 3: Optional, recommended for faster execution of the HDMI input override feature.
- Clone the Repository:
git clone https://github.com/Matt-Retrogamer/mister-rt4k-dv1-profiles-generator.git
- Navigate to the Directory:
cd mister-rt4k-dv1-profiles-generator
- Make the Script Executable:
chmod +x generate_rt4k_mister_dv1_profiles.sh
- Backup your SD cards before running the script(s).
./generate_rt4k_mister_dv1_profiles.sh [options]
-h
,--help
: Show help message and exit.-v
,--verbose
: Enable verbose output.-r
,--rt4k PATH
: Set RetroTINK 4K SD card root path.-m
,--mister PATH
: Set MiSTer root path (local path or SSH URL).-f
,--force
: Force overwrite of existing profiles.-i
,--set-hdmi-input
: Enable HDMI input override in profiles.
-
Basic Usage with Default Paths:
./generate_rt4k_mister_dv1_profiles.sh
-
Specify Paths via Command-Line Arguments:
./generate_rt4k_mister_dv1_profiles.sh --rt4k /path/to/rt4k/ --mister /path/to/mister/
-
Enable Verbose Output:
./generate_rt4k_mister_dv1_profiles.sh --verbose
-
Specify Remote MiSTer via SSH (using defaults):
./generate_rt4k_mister_dv1_profiles.sh --rt4k /media/rt4k/ --mister ssh://192.168.1.100
- SSH user defaults to root.
- MiSTer path defaults to /media/fat/.
-
Specify SSH User and Host:
./generate_rt4k_mister_dv1_profiles.sh --rt4k /media/rt4k/ --mister ssh://user@hostname
-
Specify SSH User, Host, and Custom MiSTer Path:
./generate_rt4k_mister_dv1_profiles.sh --rt4k /media/rt4k/ --mister ssh://user@hostname:/custom/path --verbose
-
Force Overwrite of Existing Profiles:
./generate_rt4k_mister_dv1_profiles.sh --force
-
Set HDMI Input for All Profiles:
./generate_rt4k_mister_dv1_profiles.sh --set-hdmi-input
Note: If Python3 is available, this operation will be executed using Python (fast). If Python3 is not installed, a Bash implementation (slow) will be used.
-
Display Help Message:
./generate_rt4k_mister_dv1_profiles.sh --help
Alternatively, you can set the following environment variables to specify paths:
export RT4K=/media/rt4k/
export MISTER=/media/mister/
./generate_rt4k_mister_dv1_profiles.sh
Ensure that the base profile files exist at the specified locations on your RetroTINK 4K SD card:
- Console Base Profile:
${RT4K}profile/_CRT Emulation/Kuro Houou - CRT Model Emulation/JVC D-Series-D200 - 4K HDR.rt4
- Arcade Base Profile:
${RT4K}profile/_CRT Emulation/Kuro Houou - CRT Model Emulation/JVC D-Series-D200 - 4K HDR.rt4
- GBA Base Profile:
${RT4K}profile/Nintendo Switch/Billgonzo's GBC-GBA Profiles/Switch_GBA_13x.rt4
- GBC Base Profile:
${RT4K}profile/Nintendo Switch/Billgonzo's GBC-GBA Profiles/Switch_GBC_15x.rt4
To create per-core profile overrides, edit profiles_config.sh
and add or uncomment entries like the examples below:
# profiles_config.sh
# Define per-core profiles override
PRF_NES="${RT4K}profile/Nintendo NES + FC/FirebrandX HDRV-Low NTSC/NES DAR 09x.rt4"
PRF_SNES="${RT4K}profile/Nintendo SNES + SFC/Wobbling Pixels NTSC & PAL RGBL - Sharp/SNES & SFC DAR - Sharp.rt4"
PRF_MEGADRIVE="${RT4K}profile/Sega Genesis & Mega Drive/Wobbling Pixels NTSC & PAL RGBL - Sharp/Genesis & MD DAR - Sharp.rt4"
# Predefined cores (initially commented out for easy customization)
# Uncomment and specify the desired profile
# PRF_ATARI_2600="${RT4K}path/to/atari_2600_profile.rt4"
The profiles_config.sh
file now includes predefined entries for each MiSTer core. These entries are initially commented out, allowing you to easily customize profiles for each core by simply uncommenting the lines and specifying the desired .rt4
profile path.
Example of customization:
# Uncomment and specify the profile to use for the NES core
PRF_NES="${RT4K}profile/Nintendo NES + FC/FirebrandX HDRV-Low NTSC/NES DAR 09x.rt4"
This makes it easy to add or change the profile for any available core without needing to add the core name manually.
If you have additional arcade profiles to generate, create a text file named DV1_ARCADE.txt
in the same directory as the script. List the names of the arcade ROMs (without paths) you wish to generate profiles for, one per line.
Example DV1_ARCADE.txt
:
sfa2.zip
msh.zip
ssf2t.zip
The script will generate .rt4
profile files in the following directory:
${RT4K}profile/DV1/
- Verbose Mode: Use the
--verbose
or-v
option to enable detailed output of the script’s actions. - Error Messages: Any errors encountered will be displayed in the console, regardless of the verbosity setting.
The HDMI Input Override feature is used to set the HDMI input in the generated .rt4
profiles, ensuring compatibility with the RetroTINK 4K device. You can enable this feature by using the --set-hdmi-input
or -i
option when running the script. When enabled, the script will modify each profile to specify HDMI as the input source.
If Python3 is installed, the HDMI input override will be executed using a Python script, providing a faster and more efficient method of modification. If Python3 is not available, the script will fall back to a Bash implementation, which is slower but still effective.
This feature is particularly useful if your RetroTINK 4K setup requires all profiles to default to HDMI input for seamless operation with the MiSTer FPGA.
Example:
./generate_rt4k_mister_dv1_profiles.sh --set-hdmi-input
Below is a step-by-step guide on setting up SSH key-based authentication between your local machine and your MiSTer device. This will allow you to SSH into your MiSTer without typing a password each time.
For better security, it’s recommended to generate the SSH key pair on your local machine and copy the public key to the MiSTer device. If you are familiar with ssh, please also define a passphrase to be more secure.
- MiSTer IP Address: For this example, we’ll use
192.168.0.119
. - Root Access: You have root access to the MiSTer device.
- Local Machine: The computer from which you will SSH into the MiSTer.
-
Generate SSH Key Pair on Local Machine
ssh-keygen -t rsa -b 4096 -C "[email protected]"
-
When prompted, write it to a specific path and let the passphrase empty
ssh-keygen -t rsa -b 4096 -C "[email protected]" Generating public/private rsa key pair. Enter file in which to save the key (~/.ssh/id_rsa): ~/.ssh/id_rsa_mister Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in ~/.ssh/id_rsa_mister Your public key has been saved in ~/.ssh/id_rsa_mister
-
Copy the Public Key to MiSTer (default root password is '1')
ssh-copy-id -i ~/.ssh/id_rsa_mister.pub [email protected]
-
Configure SSH to Use the Private Key (If Not Using Default Key)
nano ~/.ssh/config
Host mister HostName 192.168.0.119 User root IdentityFile ~/.ssh/id_rsa_mister
-
Test the SSH Connection
ssh mister
-
Now you can run the tool simply like this (assuming the IP of your MiSTer does not change ;))
./generate_rt4k_mister_dv1_profiles.sh --verbose -m ssh://mister
Note: This method is secure because the private key remains on your local machine and is never exposed or transferred.
-
SSH Connectivity Issues:
- Ensure you can SSH into your MiSTer device without password prompts.
- Set up SSH keys for password-less authentication.
-
Base Profile Not Found:
- Verify that the path to the base profile is correct and that the file exists.
-
Permission Denied:
- Ensure that you have the necessary permissions to read from the source directories and write to the destination directory.
-
No Profiles Generated:
- Check that the source directories contain the expected
.rbf
or.zip
files.
- Check that the source directories contain the expected
-
Script Exits Immediately:
- Ensure you are using Bash 3.0 or higher.
Contributions are welcome! Please open an issue or submit a pull request if you have suggestions for improvements or find a bug.
- Fork the Repository
- Create a Feature Branch:
git checkout -b feature/your-feature-name
- Commit Your Changes:
git commit -am 'Add new feature'
- Push to the Branch:
git push origin feature/your-feature-name
- Open a Pull Request
- Fix script execution on Linux Bash
- Feature: add SSH remote retrieval of the core names on the MiSTer (allows execution without removing the SD card from the MiSTer)
- Feature: Add DV1 Arcade profiles management. Read MiSTer MRA file and create DV1 Arcade list based on
<setname>
(e.g.,sfa2.zip
>sfa2.rt4
) - Feature: Add override profiles option
- Feature: Add automatic DV1 profile input set to HDMI
This project is licensed under the MIT License. See the LICENSE file for details.
- MiSTer FPGA Community: For their work on open-source FPGA implementations.
- RetroTINK 4K Team: For providing a versatile upscaler.
- Contributors: Thanks to everyone who has contributed to this project.
For questions, suggestions, or support, please open an issue on the GitHub repository.