Difference between revisions of "Raspberry Pi Setup Guide"

From Sinden Lightgun
Jump to navigation Jump to search
m (Moved Overscan and Overclocking to the FAQ)
Line 115: Line 115:
 
[[File:Pi4 overscan bad.png|thumb|Example of a display with bad overscan settings. Note that you cannot see the white border and part of the image, including the game's title is cut off.]]
 
[[File:Pi4 overscan bad.png|thumb|Example of a display with bad overscan settings. Note that you cannot see the white border and part of the image, including the game's title is cut off.]]
 
[[File:Pi4 overscan good.png|thumb|Example of a display with good overscan settings. The white border is clearly visible around the edges and fits neatly within the TV's frame.]]
 
[[File:Pi4 overscan good.png|thumb|Example of a display with good overscan settings. The white border is clearly visible around the edges and fits neatly within the TV's frame.]]
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.
+
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. If you start a game and you can see bezels but no border then your TV is not displaying the whole image, but actually cropping off the edgesFollow the advice in the [[Barebones FAQ|FAQ]] to resolve this.
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 TVs 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 TVs 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 <code>/boot/config.txt</code> find the section near the top with the four overscan settings. It looks like this:
 
  # uncomment the following to adjust overscan. Use positive numbers if console
 
# 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 '''<code>16</code>''' 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 <code>/boot/config.txt</code> and restart the Pi for it to take effect.
 
  
 
=== Overclocking ===
 
=== Overclocking ===
Whilst your Pi, as it is can run many games, there are a few games that would benefit from the extra performance that can be gained from overclocking the CPU and GPU. 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.
+
Whilst your Pi, as it is, can run many games, there are a few games that would benefit from the extra performance that can be gained from overclocking the CPU and GPU. 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.
 
 
As overclocking will void the warranty on your Pi, we've taken the view that the decision to overclock should not be made for you and will leave it to you to decide to implement it. So we have shipped Barebones with stock clock settings. However, should you choose to overclock, it is easy for you to do.
 
 
 
We have provided some suggested settings to use, so should you choose to overclock your Pi, it is a relatively straightforward process.
 
 
 
'''Please note that overclocking your Pi will invalidate any warranty that you may have. You do so at your own risk. We will not be held accountable for any damage caused by overclocking, so please make sure you are comfortable with the risk before proceeding.'''
 
 
 
The overclock settings can be found in <code>/boot/config.txt</code>. Open the file up in a text editor and scroll down near the bottom of the file where you will see the following section:
 
# Uncomment to overclock the arm. 700 MHz is the default.
 
# Be advised that overclocking your Pi is done at your
 
# own risk and will invalidate your warranty.
 
#over_voltage=6
 
#arm_freq=2000
 
#gpu_freq=700
 
#force_turbo=1
 
#gpu_mem=256
 
<blockquote></blockquote>The hash <code>#</code> at the start of each line means that the line is considered a "comment" for annotation purposes so will be ignored by the system. Remove the <code>#</code> from the beginning of the five lines of settings to "uncomment" them, ensuring that you leave the <code>#</code> in place for the three lines above that form the description.  The result should look like this:
 
 
 
# Uncomment to overclock the arm. 700 MHz is the default.
 
# Be advised that overclocking your Pi is done at your
 
# own risk and will invalidate your warranty.
 
over_voltage=6
 
arm_freq=2000
 
gpu_freq=700
 
force_turbo=1
 
gpu_mem=256
 
Once done, save and exit the file. When you next reboot your Pi the overclock will be in place.
 
 
 
We should note that not all Pi4 boards are created equal so some Pis might be able to stand up to more aggressive settings, and others might require a little dialling back.  The settings we provide should be good for most Pis, but are provided as an example only. Please do some research into overclocking to find your ideal settings.  Some users have reported some crashes with the provided settings, if you do then consider changing the gpufreq to <code>gpufreq=650</code> which might be more universally reliable.  
 
  
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.
+
For advice on overclocking your Pi, please read the detailed section in the [[Barebones FAQ|FAQ]].
 
===What if I do something wrong!?===
 
===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 [https://github.com/Widge-5/sinden-barebones-configs '''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
 
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 [https://github.com/Widge-5/sinden-barebones-configs '''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
Line 201: Line 160:
 
Be aware that not all SSH terminal utilities are created equally and we can only really vouch for PuTTY as being reliable.  Some SSH utilities cause the install script to fail when downloading the new files (Windows Terminal is a known culprit), so please either use the command line on the pi itself or SSH with PuTTY.
 
Be aware that not all SSH terminal utilities are created equally and we can only really vouch for PuTTY as being reliable.  Some SSH utilities cause the install script to fail when downloading the new files (Windows Terminal is a known culprit), so please either use the command line on the pi itself or SSH with PuTTY.
  
'''It would be very wise to make a backup of your image beforehand in case of unexpected side effects'''.  The update script has been thoroughly tested, but it is possible that some customisations you may have made to your image might be undone, cause conflict or have a random unknowable effect.  The update is, first and foremost, an update from a standard BB9.0 image and it isn't possible to account for every personal choices and preference made so keep that in mind if you have made some significant personalisation to your barebones image.
+
'''It would be very wise to make a backup of your image beforehand in case of unexpected side effects'''.  The update script has been thoroughly tested, but it is possible that some customisations you may have made to your image might be undone, cause conflict or have a random unknowable effect.  The update is, first and foremost, an update from a standard BB9.0 image and it isn't possible to account for every personal choice and preference made so keep that in mind if you have made some significant personalisation to your barebones image.
  
 
=== How to run the update ===
 
=== How to run the update ===
Line 214: Line 173:
 
  sudo ./bb91update.sh
 
  sudo ./bb91update.sh
  
You will be asked to confirm that you wish to proceed, then script will check to ensure that you are running it on a BB9.x system before proceeding.
+
You will be asked to confirm that you wish to proceed, the script will then check to ensure that you are running it on a BB9.x system before proceeding.
  
 
The script can take around 15minutes to complete but this may vary depending on your internet connection.
 
The script can take around 15minutes to complete but this may vary depending on your internet connection.

Revision as of 23:15, 11 January 2023

Setting up your Raspberry Pi to run BareBones 9

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.

Version 9 also has the following additional features:

  • RetroArch 1.10’s fullscreen 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 that the following guide is a work in progress.

Requirements

Sinden Lightguns
Sinden Lightguns

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
  • 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

Raspberry Pi4 Sinden Lightgun image -  BareBones v9 install, setup and calibration with demos

Installation

Download the latest BareBones 9.1 image from Mediafire or OneDrive. Filename bb9.1.img.xz md5 checksum b1402b6f62e565e0e575c7d278ccdfe9 

(The older BB9.0 can still be downloaded from Mediafire or OneDrive, however we strongly recommend using the newer 9.1 image which includes bug fixes and improvements).

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 compressed .xz file, 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

Make sure you connect the micro-HDMI cable to the port closest to the USB-C power socket on the board

Once you have your freshly flashed card, carefully slot it into the Micro-SD slot in your pi.

Connect the TV to your pi using ensuring that you plug the cable into the micro-HDMI port that is nearest to the USB-C port on the pi. Be mindful that some cases (notably Argon cases) might rearrange the order of the ports, if your pi boots up to a blank screen, or just some plain text, try the other HDMI port.

The USB boot order on a Raspberry Pi

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 images 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 EmulationStation 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.

We strongly advise you not to update RetroPie or Retroarch, as doing so may break the functionality of BareBones.

Calibrating your gun(s)

The calibration screen in Barebones 9

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

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 gameROMs 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 (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). Lightgun games for those systems should be placed in the Lightgun_Games subfolders.

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.

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 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 Tic-80 doesn't follow no-intro naming, so we didn't deviate from the filenames as they are named on the Tic-80 site from where they can be downloaded. 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 EmulationStation 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 EmulationStation.

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, that game 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 EmulationStation. 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

Example of a display with bad overscan settings. Note that you cannot see the white border and part of the image, including the game's title is cut off.
Example of a display with good overscan settings. The white border is clearly visible around the edges and fits neatly within the TV's frame.

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. If you start a game and you can see bezels but no border then your TV is not displaying the whole image, but actually cropping off the edges. Follow the advice in the FAQ to resolve this.

Overclocking

Whilst your Pi, as it is, can run many games, there are a few games that would benefit from the extra performance that can be gained from overclocking the CPU and GPU. 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.

For advice on overclocking your Pi, please read the detailed section in the FAQ.

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

Upgrading from BB9.0 to BB9.1

What changes are applied in the update?

  • Fix to Player 2 button configurations on recoil scripts;
  • Functionality to change border thickness of retroarch-games in-game, with hotkey+GunBackRight button combo;
  • Fix to rom folder ownership permissions which prevented the addition of roms in some folders;
  • Reinstall of usbromservice, to fix the non-functioning auto-mounting USB drives feature;
  • Updated lr-mame2003-plus which fixes alignment in Maximum Force;
  • Updated StormedBubbles versions of the mame cores which introduces support for following ARCADE games:
    • Avalanche, Bomb Bee, Battle Shark, Cutie Q, Destroyer, Gee Bee, Lock On, Monkey Magic, Seawolf, Seawolf 2, Space Harrier, Sky Raider, Tail Gunner, Top Gunner, Wild Pilot;
  • lr-mame-StormedBubbles pre-assigned as the emulator to run the above newly supported games.;
  • Corrections to emulators designated to run the following ARCADE games:
    • Firefox (lr-mame2010-StormedBubbles), Point Blank 2 (lr-mame2010-StormedBubbles), Sports Shooting USA (lr-flycast);
  • An update script at /home/pi/SBupdater.sh which you can run at any time in the future to ensure you are using the latest StormedBubbles MAME versions.
  • A readme.txt file in the daphne rom folder with advice on how to set up the actionmax symbolic links.
  • Updated hypseus, actionmax and supermodel ini files with universal exit commands set
    • Depending on the controller you use, this might be start+select, L1+R1 or L2+R2 (the button code system is completely different from one controller to the next, this was the best compromise to ensure all controller types are covered)
    • Actionmax and Hypseus can also be exited by pressing the gun's d-pad right arrow. Keyboard Escape also still exits.
    • Supermodel can also be exited by pressing both gun-right-side buttons together. Keyboard Escape also still exits.
  • New precise gun calibrations applied to the following ARCADE games:
    • Sports Shooting USA, Golly Ghost, Point Blank 2, Area 51, Maximum Force, Area 51 / Maximum Force Duo, Police Trainer, Sharpshooter;
  • Corrections to button configs for a few games (e.g. Alien 3 which previously launched grenades when a coin was inserted)
  • New bezel overlays for all newly supported games and some already-supported games that were missing overlays before. (If you are using a 4:3 display and have taken steps to remove the bezels, you will need to repeat the process for the new games listed);
  • System launching images.
  • Change of colour for the barebones custom theme improving clarity of the EmulationStation front end. (If you have changed your theme to another, then you will be unaffected by this change)
  • Support for C64 port of Duck Hunt
  • Updated C64 config files which correct accuracy for most C64 games.

Before you start

In order to download and run the update, your pi needs to be connected to the internet.

Just a few commands is all it takes to update from BB9.0 to BB9.1. Ideally you should run these commands from the command line directly on the Raspberry Pi, or via SSH using PuTTY.

Be aware that not all SSH terminal utilities are created equally and we can only really vouch for PuTTY as being reliable. Some SSH utilities cause the install script to fail when downloading the new files (Windows Terminal is a known culprit), so please either use the command line on the pi itself or SSH with PuTTY.

It would be very wise to make a backup of your image beforehand in case of unexpected side effects. The update script has been thoroughly tested, but it is possible that some customisations you may have made to your image might be undone, cause conflict or have a random unknowable effect. The update is, first and foremost, an update from a standard BB9.0 image and it isn't possible to account for every personal choice and preference made so keep that in mind if you have made some significant personalisation to your barebones image.

How to run the update

If you intend to run the update form the command line interface directly on the Pi, press F4 on your keyboard to exit EmulationStation.

Or, if you plan to run it via SSH using PuTTY, log into your Pi as normal.

Then enter the following commands :

cd /home/pi/
wget https://github.com/Widge-5/sinden-barebones-configs/raw/BB-9.1/home/pi/bb91update.sh
chmod +x bb91update.sh
sudo ./bb91update.sh

You will be asked to confirm that you wish to proceed, the script will then check to ensure that you are running it on a BB9.x system before proceeding.

The script can take around 15minutes to complete but this may vary depending on your internet connection.

Upgrading from BB8 to BB9

RECOMMENDED BB9 UPGRADE INSTRUCTIONS: It's almost as simple as copying all your ROMs, media & BIOS files to a fresh BB9 image:

  1. First, back up your existing image using Win32DiskImager or equivalent backup software just in case something goes wrong during the upgrade.
  2. Before deleting your old image, copy all BIOS files, ROMs, media (if you've scraped videos, etc) and gameslist.xml file from your existing image for each of the various systems to a temporary location. Basically, you need all the files in your ../roms/[GAMESYSTEM] for each system. Ideally if you scraped videos and marquees on your old image, you selected to have the files saved in /roms/[GAMESYSTEM] within a media subfolder. If not, you'll have to locate the video/marquee files and transfer them to your new image using WinSCP, FileZilla or equivalent. If you look in the "gameslist.xml" file within a given system you should be able to tell where the scraped videos are stored and transfer them over to the new image. Worst case scenario, if you can't locate the media files, you'll have to rescrape your new BB9 image.
  3. Reflash your SD Card with the BB9 image.
  4. Boot the new BB9 image, set up wifi/LAN networking and transfer all of your BIOS files, ROMs and media to the new image, taking care to place them in the correct rom folders - take note of the advice above regarding the filenames and locations of your roms.
  5. Restart and you should be up and running.

Note: BB9 is preconfigured for some of the arcade games to work on different emulators from BB8 (e.g. lr-stormed-bubbles, lr-mame-2010,etc.);

Check the compatibility list to see what files and ROMsets are recommended for the new emulators.

As always, if you have any troubles please hit us up on the Sinden discord for help!

Some Notes on Configuring Emulators for non-BareBones builds

Nintendo DS:

  • Set core option pointer type to "touch"

Playstation:

  • Gun Calibration: If you only have one gun and the game requires you to calibrate both guns you can cheat by switching the port 2 mouse index to 0 when the time comes to calibrate the 2p gun. Once complete just remember to switch it back. You can also create a save state once you calibrate your guns so that way the next time you start the game, just restore the save state and you're past calibration!
  • Nuvee Guncon Patch: See instructions on the Justifier Patching page

TIC-80

In core options:

  • Set pointer device to touchscreen
  • Enable crop border
  • Add mouse pointer