Skip to content
tbrecklePublic

About

Plug in your lightguns, run one command, play. smgun finds your USB lightguns by VID:PID and writes the right MOUSE1/MOUSE2 into the Supermodel (Sega Model 3) config. No more swapped players after a reboot.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

  ______ _____    ____  __ __  ____
 /  ___//     \  / ___\|  |  \/    \
 \___ \|  Y Y  \/ /_/  >  |  /   |  \
/____  >__|_|  /\___  /|____/|___|  /
     \/      \//_____/            \/

🎯 Plug in your lightguns. Run one command. Play.

smgun assigns your USB lightguns to Player 1 and Player 2 in the Supermodel Sega Model 3 emulator automatically, so you never have to work out MOUSE1 and MOUSE2 by hand again.

CI Release License: MIT Platforms Built with Rust

Download · Quick Start · How It Works · Usage · FAQ · Development


🤔 The Problem

Supermodel numbers mice as MOUSE1, MOUSE2, … in the order the operating system reports them. That order changes when you plug devices into different ports, add a new mouse or just reboot. One day Player 1's gun controls Player 2's crosshair, and you're back to editing Supermodel.ini by hand.

✨ The Fix

Tell smgun your guns' USB VID:PID once. Every time you run it, it finds the guns, works out which MOUSEx numbers Supermodel will give them, and writes those into your INI file.

$ smgun --gun1 046D:C05A --gun2 046D:C05B
[INFO  smgun] Found 3 device(s):
[INFO  smgun]   Mouse 1: USB Optical Mouse (VID:046D PID:C077)
[INFO  smgun]   Mouse 2: Lightgun A (VID:046D PID:C05A)
[INFO  smgun]   Mouse 3: Lightgun B (VID:046D PID:C05B)
[INFO  smgun]
[INFO  smgun] Player 1: Device 2 (VID:046D PID:C05A)
[INFO  smgun] Player 2: Device 3 (VID:046D PID:C05B)
[INFO  smgun]
[INFO  smgun] Successfully updated Supermodel configuration: Config/Supermodel.ini

🚀 Features

🔍 VID:PID matching Finds your guns by USB vendor and product ID, whatever port they're in
🪟 Matches Supermodel on Windows Lists mice through Raw Input in the same order as Supermodel, so the MOUSEx numbers are right
👯 Identical guns work Two guns with the same VID:PID are assigned in device order, and the same device is never given to both players
📝 Leaves your INI alone Only the gun settings change; comments, layout and all other settings stay as they are
🎮 Digital and analog guns --use-analog writes the analog gun settings used by Ocean Hunter and L.A. Machineguns
🧩 Per-game sections too Gun settings in game sections are updated as well, so they can't override the new values
🔓 No admin rights Runs as a normal user on Windows and Linux
⚡ One small binary No runtime, no installer, just a single executable

⚡ Quick Start

1. Download the archive for your platform from the latest release and extract it into your Supermodel folder.

2. Find your guns' VID:PID:

smgun --list

3. Configure Supermodel:

smgun --gun1 046D:C05A --gun2 046D:C05B

That's it. Start Supermodel and shoot. 🔫

Important

On Windows, Supermodel has to use Raw Input to tell several mice apart. Set it in your INI file or start Supermodel with -input-system=rawinput:

InputSystem = "rawinput"

⚙️ How It Works

flowchart LR
    A["🔌 USB devices"] --> B["📋 List mice<br/>(Supermodel's order)"]
    B --> C["🔍 Match VID:PID<br/>--gun1 / --gun2"]
    C --> D["🔢 MOUSEx index"]
    D --> E["📝 Supermodel.ini"]
    E --> F["🎮 Supermodel"]
Loading

smgun writes these settings for Player 1:

InputGunX      = "MOUSE1_XAXIS"         ; horizontal aim
InputGunY      = "MOUSE1_YAXIS"         ; vertical aim
InputTrigger   = "MOUSE1_LEFT_BUTTON"   ; trigger
InputOffscreen = "MOUSE1_RIGHT_BUTTON"  ; point off-screen (reload)

Player 2 gets the same settings with a 2 suffix (InputGunX2, InputTrigger2, …), and with --use-analog smgun writes InputAnalogGunX, InputAnalogGunY, InputAnalogTriggerLeft and InputAnalogTriggerRight instead.

Settings are updated wherever they appear. Settings missing from [ Global ] are added there.

📖 Usage

smgun [OPTIONS] --gun1 <VID:PID>
smgun --list
Option Description
-l, --list List all mice with their index and VID:PID, then exit
-1, --gun1 <VID:PID> Player 1's lightgun, e.g. 046D:C05A (required unless --list)
-2, --gun2 <VID:PID> Player 2's lightgun (optional)
-i, --ini <FILE> Supermodel INI file to update (default: Config/Supermodel.ini)
--use-analog Write the analog gun settings instead of the digital ones
-h, --help Show help

Set RUST_LOG=debug for detailed logging.

🕹️ Run it from your frontend

smgun exits with a non-zero status when a gun is missing, so you can put it in front of Supermodel in a launcher script (LaunchBox, RetroBat, a desktop shortcut, …):

@echo off
cd /d "%~dp0"
smgun.exe --gun1 046D:C05A --gun2 046D:C05B || (pause & exit /b 1)
Supermodel.exe %*

Every launch picks up the current device order, even after replugging or a reboot.

💻 Platforms

Platform Status Mouse order from
🪟 Windows ✅ Main target, pre-built Raw Input, in the same order as Supermodel
🐧 Linux ✅ Pre-built libusb, sorted by bus; names from sysfs
🍎 macOS 🛠️ Build from source libusb

Every mouse counts towards the index on Windows, including touchpads and other non-USB pointing devices (shown as VID:0000 PID:0000).

📦 Installation

Pre-built binaries

Get them from GitHub Releases:

File Contents
smgun-<version>-windows-x86_64.zip smgun.exe, README, LICENSE
smgun-<version>-linux-x86_64.tar.gz smgun, README, LICENSE
SHA256SUMS Checksums of the archives

Want the latest development build? Every CI run attaches unofficial builds (0.0.0+<commit>) as artifacts.

From source

git clone https://github.com/tbreckle/smgun.git
cd smgun
cargo build --release   # Linux needs libusb-1.0-0-dev and pkg-config

See the Development Guide for details.

❓ FAQ

How do I find my gun's VID:PID?

Run smgun --list with the gun plugged in. Unplug it and run the command again if you're not sure which entry it is: the one that disappeared is your gun.

I have two identical guns. Does that work?

Yes. Pass the same VID:PID for both players. The first matching device goes to Player 1, the next one to Player 2. Swap the USB ports if they end up the wrong way round.

Player 1 and 2 still control the same crosshair on Windows.

Supermodel isn't using Raw Input. Set InputSystem = "rawinput" in Supermodel.ini or start it with -input-system=rawinput.

"Player 1 lightgun with VID:… PID:… not found"

The gun isn't connected, or it reports a different VID:PID than the one you passed. Check with smgun --list.

Will it mess up my Supermodel.ini?

No. Only the gun input settings are changed; everything else, including comments and layout, stays as it is.

🤝 Contributing

Issues and pull requests are welcome! The project uses GitFlow: branch off develop and open your PR against it. See DEV.md for building and checks, GITFLOW.md for branches and releases, and CHANGELOG.md for what's new.

📄 License

MIT © Supermodel Lightgun Auto-Configurator Contributors

Made with 🦀 for everyone who wants to shoot instead of editing INI files.

⚖️ Legal Disclaimer

USE AT YOUR OWN RISK

This software and firmware are provided "AS IS" without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement.

Important Notes:

  • The developers and contributors of this project assume no liability for any damages, losses, or issues arising from the use, misuse, or inability to use this software or hardware
  • This includes, but is not limited to: hardware damage, data loss, system malfunction, or any other direct or indirect consequences
  • By using this software, you acknowledge that you do so at your own risk
  • Users are responsible for ensuring compatibility with their systems and compliance with local regulations
  • This project is an independent effort and is not affiliated with or endorsed by any hardware manufacturer unless explicitly stated

For Hobbyist and Educational Use:

This project is intended for personal, educational, and hobbyist use. Users modifying firmware or hardware configurations should have appropriate technical knowledge and accept full responsibility for their modifications.

If you're unsure about any aspect of installation or use, please consult the documentation or seek assistance from knowledgeable individuals before proceeding.

About

Plug in your lightguns, run one command, play. smgun finds your USB lightguns by VID:PID and writes the right MOUSE1/MOUSE2 into the Supermodel (Sega Model 3) config. No more swapped players after a reboot.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages