Raspberry Pi Setup Guide

This page uses content or is imported from the Pi Setup Guide abandoned Miraheze counterpart of this page. You can view the original authors of this page Pi Setup Guide?action=history here.

== The Sinden Lightgun Wiki Has Moved ==

## **Introduction**

To get started with Sinden setup on RPi it is recommended you use a fresh, Lightgun dedicated image, but Barebones v9 is created with a mixed setup in mind.

### BareBones - The Recommended Image

A Pre Configured Retropie Image for the Sinden Lightgun on the Raspberry Pi4

```
BareBones Website

```

### Game Compatibility

```
Compatibility List

```

## **Setting up your Raspberry Pi to run BareBones 9**

### Introduction

BareBones 9 is the community-made image that is pre-configured to let you get you up, running and ready to play your favourite Lightgun games on the Rasperry Pi 4.

Version 9 has been designed with the idea that most people would like to have a mixed bag of lightgun and non-lightgun games on their system so particular attention needs to be given to the way that your games are named and the locations where they are placed on your SD card.

 File:SINDEN ICON TRANSPARENCY LUMINAR BLACK.png
Version 9 also has the following additional features:

* Retroarch 1.10’s full-screen border;
* A fix to a bug in Retroarch 1.10 whereby the Y-axis is not treated correctly;
* Bezels for the majority of lightgun games;
* Generic bezels for non-lightgun games, including some dynamic bezels.
* Pre-set and applied configurations and settings for all known-working games;
* StormedBubbles versions of MAME emulators featuring quality-of-life hacks and fixes for many games;
* Version 1.8 Sinden Lightgun drivers;
* Exclusive Golly Ghost scoreboard for 16:9 screens;
* A brand new Sinden Lightgun menu and calibration screen;
* A category for plug-n-play games;
* And much more!

**Please note the following guide is a work in progress**

### Requirements

 File:Raspberry Pi 4 Computer.jpg
You will need:

* a Raspberry Pi 4 (any of the variants will do, the amount of RAM will make no difference)
* adequate cooling (a fan and heatsinks should do)
* A suitable power supply for your Pi that is capable of delivering 5V @ 3A, preferably the official Raspberry Pi power supply an SD card
* A micro-SD card, minimum 16GB capacity, but the more space you have, the more games you can install.
* An HDMI to micro-HDMI cable for connecting to your TV.
* A USB game controller
* A Sinden Lightgun

### Video guide for visual people

A great video to getting started with BB9 is available on the **OleSchool Gamers** YouTube channel here : https://youtu.be/CD1Khk8HESw

### Installation

Download the latest BareBones image from lightgun.tech. it’s a .img.gz file.

Extract the .img file from the .gz using software such as 7zip or WinRar.

Use software such as BalenaEtcher or Raspberry Pi Imager to then flash the image to your micro-SD card. The two programs mentioned are capable of writing the image without extracting from the .gz, but it can be more reliable to extract the image first. If your image fails to work then reflash the image after extraction.

### Running for the first time

 File:Pi4 HDMI port.png   File:Pi4 USB order.png
Once you have your freshly flashed card, carefully slot it into the Micro-SD slot in your pi.

Connect the TV to your pi ensuring that you plug the cable into the micro-HDMI port that is nearest to the USB-C port on the pi board. *Be aware that some cases, such as the Argon One, rearrange the HDMI ports on the case so they may appear to be the other way around.*

Connect your Sinden Lightgun(s) to the pi. The player order is determined by the USB port so connect them in this order – 1. top-right (blue), 2. bottom-right (blue), 3. top left (black), 4. bottom-left (black).

Connect the USB controller into any other USB port.

Plug the power supply into the USB-C port.

Once the power supply is connected, the raspberry pi will boot up. On first boot, the image’s filesystem will self-expand to fill the whole SD card so it may take a little longer than usual to boot the first time.

When the pi has finished booting you will be asked to configure your game controller. Hold any button on your controller to start configuring the buttons then follow the prompts on-screen. **Do not attempt to configure your Sinden Lightgun as a controller!**

Once that’s done, you’ll be presented with the Emulation Station front end, and you will see the Sinden Lightgun collection available.

At this point we recommend that you then connect your Raspberry Pi to your local Wi-Fi as this will likely be the primary way you will transfer games onto your system. You can do this by going to the RetroPie group and the Wi-Fi settings option in the list.

**But don't do anything to update RetroPie or Retroarch!** Running an update can have undesired effects. Remember a lot of time, effort and energy has been put in to making Barebones ready to use so an update shouldn't be needed. In fact, if you update Retroarch you will introduce a bug that (at the time of writing) has yet to fixed in mainstream RetroArch.

### Calibrating your gun(s)

 File:Pi calibration view.png
In the Sinden Lightgun menu you will see a “Test and Calibration” sub-menu. Enter it then select the test for the port number (as specified above) for the gun you want to calibrate. If a gun is connected, it will load the calibration screen.

Look down the iron sights to see if the mouse cursor lines up with the sights. If not, follow the advice on screen to calibrate the gun. The gun’s X and Y offset calibration will be saved to the gun when you exit the utility.

If the cursor dances around the screen apparently randomly, then this probably means that your gun’s camera is having difficulty seeing the on-screen border. Follow the advice in the Troubleshooting section of the wiki to remedy this.

### Installing BIOS and Games

*`(Putting flesh on those bare bones...)`*

We wish we could provide you with the complete package all ready to go, but unfortunately we cannot legally provide you with the BIOS files and game ROMs you need. So you’ll need to find these on your own.

Some systems require BIOS files to run games properly. Refer to the **RetroPie documentation** at https://retropie.org.uk/docs/ to find out what BIOS files are expected by each emulator and exactly where to place them. Most console BIOS files go directly in the `/home/pi/RetroPie/BIOS` folder with few exceptions.

In order for the preset BareBones configuration files to be effective you need to follow two rules :

* the games need to be named correctly according to the no-intro naming convention, and;
* they need to be placed in the correct locations.

First, we’ll deal with the location. In the `/home/pi/RetroPie/roms` folder you will find the subfolders for each system supported (and many others). Some of those system folders have a subfolder called `Lightgun_Games` or similar. Lightgun games for those systems should be placed in the `Lightgun_Games` subfolders. Most of the Sega systems have slight differences to the name which is important for the configurations to distinguish between them as they use the same emulator.

All systems that require it will have this folder already in place for you. Daphne is an exception to this which uses Actionmax and Hypseus emulators which do not play nicely with subfolders, so daphne games should be set up as per the existing guidance in the wiki.

Also, there are a lot of systems folders within the roms directory and it may be overwhelming if you're new to RetroPie. Just try to use some logic and apply what you know about the games you are installing to the names of the folders available. For example, NES games will go under the "*nes"* system ,, Arcade games go in the "*arcade*" system, and so on. If you're unsure then please do ask on the discord channel.

Secondly, the filenames must match what the config files are expecting. We’ve decided to go with the no-intro naming scheme here as a widely recognised standard. Check the **compatibility list** at https://lightgun.tech/game-compatibility-list/
for the filenames expected. The only Retroarch-based exceptions here are the **C64** system and **Tic-80**. As far as we know there is one online source that provides a working set of C64 lightgun games and we decided to match the filenames from that set for simplicity’s sake, and we have followed the naming of the original Tic-80 files from the Tic-80 website. Daphne also doesn’t require this rule to be adhered to as it is not a Retroarch-based system.

BareBones has been pre-configured to use the most appropriate and best-performing emulator for MAME-based arcade games, and as different arcade emulators require ROMs from different romsets it is important to make sure you use the correct ROMs. Using a ROM from a mismatched set may result in poor performance or a non-working game. Check the **compatibility list** for the correct romset versions needed for each game and any additional files that arcade games might require.

Any non-lightgun games you’d like to add can go in the main folder for the system.

After you add games, restart Emulation Station so it will refresh the games lists and you will find any systems that you’ve added games to will now be visible and selectable in Emulation Station.

When you launch a Lightgun Game, if it has a game-specific config file, that games configuration will be loaded up, along with its bezel and border. If the game doesn’t have a specific config file then it will load the generic config, bezel and border for Lightgun Games of that system. And if you load a non-lightgun game it will load with a borderless generic bezel for that system.

### Playing Games

Before you start playing any lightgun games you must first “start” the guns. Go into the Sinden Lightgun category of Emulation Station. You can choose to Start all connected guns at once using any of the “Start All…” options for either no-recoil, single-shot-recoil or automatic-recoil.

If you have multiple guns connected and each player wants a different recoil option, perhaps one of you prefers not to have recoil while the other does, then you can go into the “Start Guns Individually” subfolder and start the appropriate configuration for each gun individually.

If you make a mistake and start the wrong process, you will need to stop the gun process you started before starting the correct one. So run the Stop script to stop all processes, then “Start” your guns again.

Once your guns are started, now you can launch the game you want to play. If everything went to plan, when the game launches you should be able to get straight into playing a game.

If you find your guns don’t respond at all try and exit the game, run the Stop guns script then run a Start All script. Restart the game – If your guns work then perhaps you started the wrong script before. Otherwise, if your guns still don’t work, explore the troubleshooting section for further advice.

If your guns do work but they don’t respond very well, you may need to refine your gun cameras settings, and/or the brightness/contrast settings of your TV. Refer to the troubleshooting section of the wiki for further advice.

### Overscan

 File:Pi4 overscan bad.png
 File:Pi4 overscan good.png
Overscan is a behaviour in certain television sets, in which part of the input picture is shown outside of the visible bounds of the screen. It exists because cathode-ray tube (CRT) television sets from the 1930s through to the early 2000s were highly variable in how the video image was positioned within the borders of the screen. It then became common practice to have video signals with black edges around the picture, which the television was meant to discard in this way. Today's displays, being driven by digital signals (such as DVI, HDMI and DisplayPort), and based on newer fixed-pixel digital flat panel technology (such as liquid crystal displays), can safely assume that all pixels are visible to the viewer, but this is not always the case and often a TV will cut the edges off an image in a mistaken effort to remove the "unneeded" edges of the image.

You might not realise that your display is doing this until you start a game and notice that you can't see the white border around the edge of the frame necessary for the Sinden Lightgun to work. This might be because your display is positioning the image in such a way that the border is outside of the frame. If you find that the edges of your image are missing, this might be an issue with the way your display handles overscan.

As all TV's and monitors are widely different and handle this in different ways, there are several courses of action that you can take. Your TV might have an option to disable/enable overscan. If it does, try toggling it to see if it makes a difference. Some TV's might name this setting clearly with the word "Overscan", but others may not - for example, some Samsung TV's have a picture size option called "Screen Fit", which solves this problem if selected.

If you can't resolve an overscan issue with your TV/monitor settings, then there are settings on the Raspberry Pi which will take care of it. In `/boot/config.txt` find the section near the top with the four overscan settings. It looks like this:

```
# goes off screen, and negative if there is too much border
overscan_left=2
overscan_right=2
overscan_top=2
overscan_bottom=2

```

Now, just make those numbers bigger to bring that picture back into frame. A good place to start might be with **`16`** then adjust up or down as necessary. The desired result is to have the image fit neatly inside the frame of your set without cropping out any of it and without creating a new black border around it. It is possible that each of your edges might need different values to achieve it, but this is rare. Remember that each time you make a change you will need to save `/boot/config.txt` and restart the Pi for it to take effect.

### Overclocking

Some games may require an overclock to get a reasonable performance. Bear in mind that the Raspberry Pi is a low-cost computer with limited capability, we've tried our best to get as much working as possible, but an overclock may be necessary for some of those outliers.

We've taken the view that the decision to overclock your pi is one that you should make yourself, so we have shipped Barebones with stock clock settings. However, should you choose to overclock, it is easy for you to do so.

**Just remember that you do so at your own risk, and overclocking will invalidate your warranty**.

If you choose to proceed, you can find some predetermined overclock settings available and commented out in `/boot/config.txt`. Find the section with the overclock settings, and remove the hash (**`#`**) from the beginning of each of the relevant lines. It'll end up looking something like this:

```
# own risk and will invalidate your warranty.
over_voltage=6
arm_freq=2000
gpu_freq=700
force_turbo=1
gpu_mem=256

```

Note that the hashes remain for the information lines, but have been removed for each of the settings.

***Due to some inconsistencies between Pis manufactured at different times, some users have reported occasional crashes with these overclock settings. If you have any problems after overclocking, or you just want to play it safe, you can dial back the*** `gpu_freq` ***to*** `650` ***which should be more universally reliable.***

Save the change and reboot your pi. It will then boot up with overclock settings enabled and some games will run a little better.

This isn't a magic fix for *all* games however. Some games just don't run well on the pi no matter what we do.

### What if I do something wrong!?

If you accidentally delete or change one of the config files and want to restore it to its original state, backups of the config files are available an **Widge's github repository**.
You can also download a zip of the whole repo using this link: https://github.com/Widge-5/sinden-barebones-configs/archive/refs/heads/main.zip