This repository contains all the necessary files to enable the Sinden Lightgun functionality on the MiSTer platform.
This guide is intended for individuals with technical expertise until we refine the details and provide more comprehensive scripts, documentation, and additional resources.
The Sinden Lightgun is a lightgun controller compatible with modern LCD displays. Unlike other lightguns, the Sinden Lightgun works by processing the data from a video camera onboard the gun. This allows it to work without needing to attach any external IR emitters or other devices to your display. However, processing the camera data into a gun tracking position requires specialized software and a good amount of processing power.
It is well known that the Sinden Lightgun performs its video crunching on the target computer device. This initially looked like it would not be possible to run on the MiSTer as the onboard ARM CPU (800Mhz) is quite underpowered and the Linux operating system is barebones. However, I have spent a lot of time developing a low-resource driver that can comfortably run on the MiSTer and also removed many required components so it can run on the streamlined Linux OS.
The driver offers three modes: low resource, medium resource, and normal. When running in low resource mode, the driver only processes video when the trigger is pulled, resulting in high efficiency with only 4% CPU core usage. This mode works well for most 16-bit and under games that have a slow screen flash. Even games like T2 on the Genesis, which require continuous cursor movement, can be played by simply holding down the trigger.
For slightly better lightgun performance, the default (medium resource) mode continuously crunches video, providing ready coordinates when the trigger is pulled. This mode has a larger footprint but still doesn't interfere with MiSTer processing. It doesn't crunch every video frame to save resources.
Running the driver without the low resource and medium resource flags is considered normal mode, which consumes more resources than medium, and is generally fine but may potentially affect games like PSX that also rely on the ARM CPU.
I recommend starting with medium resource (default) mode, but you can switch to low resource if needed. Overclocking may improve performance, but it is not required and hasn't been tested yet.
Expect further improvements to the driver in the future.
Note: For reference my setup is a MiSTer Multisystem games console as seen here: MiSTer Multisystem games console.
Having a joypad and a keyboard connected to your MiSTer is recommended during the configuration process, as well as the Sinden Lightgun.
Your Sinden Lightgun needs v1.09 firmware. To update the firmware or check the current firmware version, follow these steps:
Your MiSTer needs to be connected to the internet; with ethernet, it is the simplest way.
We recommend using a fresh SD card.
This guide assumes the user has set up a MiSTer before and can get MiSTer working. If you haven't done this yet, we recommend using MrFusion and following some guides to get a general idea of how everything works before following this guide.
The following configuration has been tested and confirmed to work:
There are two options to install the Install_SindenLightgunDriver.sh
script:
Install_SindenLightgunDriver.sh
script from the repository to your computer.Install_SindenLightgunDriver.sh
script to the Scripts
folder at the root of your MiSTer SD card.root
and the password is 1
on MiSTer mainline.Scripts
directory:
cd /media/fat/Scripts
Install_SindenLightgunDriver.sh
script directly to your MiSTer using wget
:
wget https://raw.githubusercontent.com/MrLightgun/MiSTerSindenDriver/main/Install_SindenLightgunDriver.sh
Install_SindenLightgunDriver.sh
. This will execute the script and install the necessary files.To update your existing MiSTerSindenDriver setup to the latest version, follow these steps:
Scripts
./media/fat/Scripts/Sinden/MiSTerSindenDriver-main
.Install_SindenLightgunDriver.sh
and execute it. This script will download the latest files and re-run the installation, ensuring your setup is up-to-date.To remove the Sinden Lightgun driver and associated files from your MiSTer setup, follow these steps:
Scripts
./media/fat/Scripts/Sinden/MiSTerSindenDriver-main
.Uninstall_SindenLightgunDriver.sh
and execute it.There are multiple steps for getting lightguns to work in MiSTer, make sure to follow the steps in order:
Go to scripts on the MiSTer main menu, navigate to /media/fat/Scripts
and select SindenLightgunStart_Default.sh
. Click a button on your gamepad after it has started up.
Or, if you prefer to run it manually from the shell console, use the following commands:
For medium resource:
/media/fat/Scripts/SindenLightgunStart_Default.sh
For low resource:
/media/fat/Scripts/SindenLightgunStart_LowResource.sh
For max resource:
/media/fat/Scripts/SindenLightgunStart_MaxResource.sh
Setting up the lightgun as a MiSTer menu device enables the cores to see it.
Important : THIS STEP IS NOW HANDLED BY THE SETUP SCRIPT, THESE NOTES ARE HERE FOR REFERENCE
DPAD Test: Press Right
, push right on Sinden Lightgun directional pad.Important: Don't wave the lightgun around while doing the above, as the movement of the lightgun can be assigned as actions.
You can now navigate the menus using the lightgun alone.
Add NES Duck Hunt to your MiSTer.
Load the NES_Sinden
core
Important: The MiSTer loads the first joystick used in a core as Player1. When you first load a core, make sure to use the dpad on the lightgun first. If you use your gamepad first, then the lightgun will become player 2, which can cause problems. For example, the settings don't save correctly in the NES core and in PS1 you can't play Time Crisis because it wants a Player1 lightgun, but Player1 is assigned to the gamepad.
Load Duck Hunt in the core.
Optional if you want to change your buttons. Initial configuration is handled by the script: Open the MiSTer menu; under System, find Define NES buttons
, assign these buttons to the lightgun: A to front left, B to back left, Select to back right, Start to front right. Use the spacebar to skip the rest. Assign the Zapper/Vaus Btn to the lightgun trigger while pointing at the screen, you may need to trigger twice if you have just loaded the driver. Use space bar to skip the rest. Answer No to the question, then "Save Settings."
Optional, change the core-specific lightgun settings:
In the NES do Input Options:
Tip: If your border is not showing clearly because the edges are cut off, change the video settings in the core. It probably changes depending on your resolution and display, but I find setting scale to "Wider HV-Integer" helps in most cases. Having black around the outside of the white border helps lightgun performance anyway.
Tip: I find if the lightgun is not the Player1 joystick, the part where you do "Define NES buttons" doesn't save for me when I reload the core.
Duck hunt should now be working with the Sinden Lightgun.
So far these are the working cores with a couple of highlights:
Core | Game |
---|---|
NES_Sinden | Duck Hunt |
PSX_Sinden | Time Crisis, Point Blank |
Genesis_Sinden | Terminator 2 The Arcade Game |
SNES_Sinden | Battle Clash |
MegaCD_Sinden | Mad Dog McCree |
MegaDrive_Sinden | Terminator 2 The Arcade Game |
SMS_Sinden | Gangster Town |
Atari7800_Sinden | Alien Brigade, Crossbow? |
InputTest_Sinden | Testing |
https://github.com/MrLightgun/NES_MiSTer
NES settings are detailed further up in the guide as NES is used as the example core.
https://github.com/MrLightgun/PSX_MiSTer
Note: Some of these steps have been done by the setup script.
Remember to use the lightgun dpad when you first load the core.
The PSX is a slightly more demanding core, and when reading sounds and video of the CD, you can see slowdown if the lightgun driver is using too many resources, so I recommend running the driver with the medium resource
option for most scenarios. If you don't see any slowdown, then you can try the low resource
option.
If you tweak the "Fixed HBlank" setting, then you can normally get the game window to perfectly match the white border, which helps accuracy.
I've only noticed this in Point Blank 2, but on the menu, there is a bit where you shoot the arcade option. The game actually shoots where the gun last was; basically, the game is updating the lightgun position all the time on this screen. So if using the low resource driver, you shoot arcade, the bullet shows on arcade, but it selects the center option instead where the gun was located on the previous shot. To avoid this, when it is loading the screen, hold the trigger, and when the options appear, you can point towards arcade and it will highlight, then you can shoot it. After writing this, I have a hazy memory that something similar might happen in Area51, but not sure as my ROM is not currently working on the MiSTer.
The 2nd player does work. When you load the PSX core, remember to do dpad on Lightgun1, then dpad on Lightgun2. Point Blank is a good game for testing 2 Player. You need to set Player1 and Player2 to GunCon. If you add a new lightgun, probably best to do a hard reboot. You also need to define buttons for the 2nd Lightgun. As 2 players use more resources and Point Blank does a lot of reading off the CD, this is probably a good example where you need to use the low resource lightgun driver option.
Tip: Remember to add a PS1 BIOS for the PS1 core.
https://github.com/MrLightgun/Genesis_MiSTer
Note: Some of these steps have been done by the setup script.
I found I could only get Terminator 2 to work when I also had a joypad connected to the MiSTer.
Make sure to use the lightgun dpad when you first load the core, then use the gamepad dpad so it becomes Player2, which seems to be required.
When assigning lightgun controls to the core, A button is a trigger, so assign A to the trigger. B and C to the left side buttons and Start and Select to the right side buttons. The rest of the buttons do not seem to be used.
On the input settings, set:
https://github.com/MrLightgun/MegaDrive_MiSTer
Core with Sinden border just added, initial testing seems to show the crosshair doesn't match game aiming as accurately as the Genesis_Sinden core. Maybe MiSTer lightgun calibration option will fix this? Core supports Mastersystem, although haven't proven lightgun to work with this yet.
Settings are likely to be:
https://github.com/MrLightgun/MegaCD_MiSTer
Core with Sinden border just added, now working with the updated MiSTer binary.
Mad Dog McCree working, Justifier works so much better than Menacer.
Settings are likely to be:
https://github.com/MrLightgun/SNES_MiSTer
Note: Some of these steps have been done by the setup script.
Same as all the above, remember there was Superscope and Justifier too. Remember to assign turbo to the lightgun properly as a lot of games need it. Some games like Terminator 2 have a superscope button as a trigger for some strange reason, so you may want to switch it, but I prefer the Genesis version anyway.
On the input settings, set:
https://github.com/MrLightgun/SMS_MiSTer
Input:
https://github.com/MrLightgun/Atari7800_MiSTer
Peripherals:
https://github.com/MrLightgun/InputTest_MiSTer
Source code not built and tested, but the existing built core is confirmed to work.
To come, hopefully:
There will be some scripts to assist with updating a current build coming soon.
Recoil should work by holding down "up" on the Dpad for 5 seconds. This should toggle between Off/Single Shot/Automatic. To change Sinden Lightgun settings, you can run:
nano /media/fat/Scripts/Sinden/MiSTerSindenDriver-main/LightgunDriver/LightgunMono.exe.config
To save: ctrl+o To exit: ctrl+x
Recommend beginners only changing lightgun camera exposure, brightness, and contrast.
Load a core (suggest NES_Sinden), enable crosshair, then in game, hold down dpad left for a few seconds on the Sinden Lightgun, till the crosshair goes to the centre of the screen. Carefully shoot the crosshair with as much accuracy as you can. Then the lightgun should be nicely calibrated.
You shouldn't need to use the MiSTer lightgun calibration tool.
Custom kernel had an issue with some (or all) wifi/BT adapters, fixed kernel added 5th July 2024.
An conflict with TapTo was identified due to TapTo and Sinden Lightgun both using serial ports. The author of TapTo, Wizzo has kindly added an exclusion so that TapTo no longer polls a serial port if it is a Sinden Lightgun in the latest version. I'm not sure how long this will take to fully propogate to if you have an issue with the lightgun driver not starting properly and have TapTo installed, it would be worth disabling TapTo to make sure that isn't the conflict. This is probably more likely to affect people that download complete SD cards. If it is the cause then please download the latest version of TapTo.
If you find that the lightgun is only moving on the X-axis, this is probably because you have updated the MiSTer binary after installing the Sinden driver. To fix, re-run Setup_SindenLightgunDriver.sh, you can find this in the Sinden folder within Scripts. You may need to manually reboot afterwards.
This project to add Sinden Lightgun support owes a huge debt of gratitude to Nolan Nicholson, who assisted with the development and setup, and Wiggy from the Sinden Lightgun Discord, who helped push to make it happen and assisted with the scripts and testing. Additional thanks to Matt_RetroGamer from the Sinden Lightgun discord who helped make the scripts run so much better for easier installation.
If any script fails to be executable, check that the execution permission is set and perform a chmod +x
on it if needed.