What's new

wilycoldcuts

Student
Joined
Oct 30, 2017
Messages
19
Reaction score
49
Location
San Jose, CA
Hi everyone!

Context:
twistedsymphony posted an awesome tutorial for how to get started with Net-booting using Piforcetools (link to thread). This info was super helpful, but I didn't have an Adafruit character LCD screen handy so I went looking for other options and saw user thejew's post on the Project Ideas forum (link to thread) to use Attract Mode instead. My results are still a work in progress, but so far I like it! I'm posting instructions for what I did below in case this is helpful to anyone else.

Preview:
(apologies for the shaky cellphone footage)

Credits and Thanks:
This is built upon the work of the following people:
debugmode's triforcetools
travistyoj's piforcetools
dev-tty0's Piforce-Web
ShaneMC's naomipi
darksoft's Atomiswave conversions
twistedsymphony for the net-boot tutorial
And thejew for the idea!
 
Instructions:

Set up your arcade system for net-booting
I followed twistedsymphony's tutorial, except that I don't have a Zero-key yet. For my NAOMI IP address, I used 192.168.0.2. You can stop when you get to the section "Setting Up The Raspberry-Pi with Pi-Force Tools."

Set up your Raspberry Pi
I'm using the following components:
  • Raspberry Pi 2
  • 3.5" LCD screen with HDMI input (I bought mine from AliExpress about a year ago, but it looks like these are now on Amazon (sample link). Make sure to buy one that comes with a case, since that makes things easier.)
*Any Linux-based SBC should work as long as it supports whatever screen you decide to use. You may need to modify these steps a bit depending on your Linux distro, though. Any other screen should work fine too, but I prefer HDMI because it drives faster than the usual SPI displays and is simpler to use because there's no driver required.
  1. Install Linux. In my case I'm using the latest "Raspbian Stretch Lite" image. I extracted the .zip archive and then copied the .img file to my SD card with Etcher.
  2. Boot the system with a connected keyboard and Ethernet connection to your local network. When it's finished booting, you should see a line in the log that reads "My IP address is:" and its network address (you may need to squint or connect a larger display).
  3. Now that it's on your network, most of the following steps can be completed from another computer via an SSH connection. I'm on Windows, so I use Bitvise SSH Client.
Install Attract Mode
Attract Mode doesn't provide any pre-compiled binaries for arm platforms, so you'll have to download the source and build it yourself. It's pretty easy though - I just followed the instructions on their GitHub page. I selected "Method 2" to also build ffmpeg for hardware acceleration, and didn't need any additional parameters beyond that. I have no idea how long this takes - I just let the build run overnight.

From the keyboard that’s attached to the Raspberry Pi, try starting Attract Mode to make sure it works:
$ attract

You can exit Attract Mode by pressing the Escape key and selecting “Yes” to confirm, then switch back to your SSH session on another computer to continue.

Configure Raspbian to Autostart Attract Mode
Set Raspbian to autologin:
$ sudo raspi-config
Select 3 Boot Options
Select B1 Desktop / CLI
Select B2 Console Autologin
Select Finish and Yes to reboot and verify that the change worked.

Create a one-line shell script that launches Attract Mode:
$ echo attract > /home/pi/attract.sh

Add this shell script to the default login routine:
$ sudo nano /etc/profile
Add a line at the bottom that says:
. /home/pi/attract.sh
Press CTRL-X to exit, press Y to save, and ENTER to confirm.

Note: From now on, Attract Mode will start every time a user logs in, even if it’s through SSH. Remember that you can use CTRL-C to kill the Attract Mode process if you don’t want it running in your SSH session. (Suggestions to make this better are welcome!)

Configure Network Settings
This section basically defines a profile called “static_eth0” and gives it the IP address 192.168.0.1. If DHCP fails, then it’ll fallback to this address instead. With this configuration, I can disconnect the Pi from the NAOMI system and plug it into my normal home network to make changes/updates, then reconnect it when I’m done.

$ sudo nano /etc/dhcpcd.conf
Scroll down towards the bottom and you should find a section to define a static IP if DHCP fails. Mine looks like this:
Code:
# It is possible to fall back to a static IP if DHCP fails:
# define static profile
profile static_eth0
static ip_address=192.168.0.1/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

# fallback to static profile on eth0
interface eth0
fallback static_eth0

Press CTRL-X to exit, press Y to save, and ENTER to confirm.
 
Last edited:
Set up Triforcetools
To make this easier, I made a new GitHub repo called piforce-attract. Because of the way that Attract Mode treats different game systems, you’ll probably want to repeat these steps for each system you want to support. (For example, I set up “NAOMI” to be separate from “Atomiswave” so they could use different skins in the front-end if desired.)

$ cd ~/
$ git clone https://github.com/wilycoldcuts/piforce-attract.git

Rename the downloaded folder to match your arcade system (in this example I use “naomi”)
$ mv piforce-attract/ naomi/

Optional: Move the Game list to the correct Attract Mode directory:
$ cd ~/naomi
$ mv romlists/NAOMI.txt /home/pi/.attract/romlists/NAOMI.txt

A note about game lists:
I’m using Gakman's list of roms, so the game lists in my repo assume that your folders and filenames match mine. I renamed a couple of Atomiswave files because I didn’t want to deal with spaces in the filenames. I think this is a complete list of the filenames I changed:
CRAZY_TAXI_CHIHIRO_3-ZEROKEY.bin

Demolish_Fist.bin
Kofxiallfighters.bin
AW_GuiltyGearIsuka.bin
AW_KnightsofValour.bin
AW_MetalSlug6.bin
AW_TheKingOfFightersNeowave.bin
AW_TheRumbleFish.bin
AW_ViolentMetalSlug6.bin


Optional: Copy the custom theme to the proper Attract Mode directory:
$ cd ~/naomi
$ cp -r layouts/* /home/pi/.attract/layouts/

Configure Attract Mode
Switch back over to the keyboard connected to your Raspberry Pi and run Attract Mode
$ attract

Press the TAB key to open the “Configure” menu
Select Emulators, then Add Emulator
Create a new emulator with the following settings:
Emulator Name: NAOMI
Executable: python
Command Arguments: ./loader.py [romfilename]
Working Directory: $HOME/naomi/
Rom Path(s): $HOME/naomi/roms/
Rom Extension(s): .bin
..
Exit Hotkey: [connect your USB device and press a button, or press a keyboard button]
snap: /home/pi/naomi/videos

Select Back when finished, and repeat again for Atomiswave or other systems if desired.

Select Displays, then NAOMI
Layout: Arcade Station
Select Back when finished, and repeat again for Atomiswave or other systems if desired.

Optional: Configure Shut Down on Exit
Select General
Exit Command: sudo shutdown now -P
Select Back when finished
Select Back again to exit the Configuration menu.

Finished! Press the Escape key to exit Attract Mode and shut down, then connect your Raspberry Pi to your NAOMI system with a crossover cable, start it up and enjoy!
 
Last edited:
So I attempted to recreate this, and figured I'd leave some notes here in case anyone tries to do this and gets stuck:

  • If you buy this screen and case from Amazon, it will work, but don't listen to the included instructions. Instead, use the instructions from waveshare and save yourself the headache.
  • You need to use Stretch Lite, it won't work if you use the latest Raspbian. I went with this build here.
Those two were the biggest things that had me up all night scratching my head. Today I got into Attract Mode some more and found a couple holes that needed crossing:
  • In the Displays step, you also need to specify the romlist you copied over. If you leave it blank, you'll be looking at blank screens like I was.
  • I don't think my ffmpeg is working properly, since SQ videos from EmuMovies play like 2 FPS. Oh well, at least they play.
I don't have my NAOMI ready yet to test, but so far this seems promising! Thanks for putting this together!

WhatsApp Image 2020-09-02 at 15.04.27.jpeg
 
So I attempted to recreate this, and figured I'd leave some notes here in case anyone tries to do this and gets stuck:

  • If you buy this screen and case from Amazon, it will work, but don't listen to the included instructions. Instead, use the instructions from waveshare and save yourself the headache.
  • You need to use Stretch Lite, it won't work if you use the latest Raspbian. I went with this build here.
Those two were the biggest things that had me up all night scratching my head. Today I got into Attract Mode some more and found a couple holes that needed crossing:
  • In the Displays step, you also need to specify the romlist you copied over. If you leave it blank, you'll be looking at blank screens like I was.
  • I don't think my ffmpeg is working properly, since SQ videos from EmuMovies play like 2 FPS. Oh well, at least they play.
I don't have my NAOMI ready yet to test, but so far this seems promising! Thanks for putting this together!

WhatsApp Image 2020-09-02 at 15.04.27.jpeg
Oh hey! It's cool that you gave it a try! I haven't touched this in a couple of years, but I can dust it off over the long weekend and try to update it to see if I can make it work with newer boards (Pi 3B+ & Pi 4) and Raspberry Pi OS.
  • That display you linked looks like it's driven via the SPI bus (using the Raspberry Pi's IO pins), which can definitely be tricky to get running smoothly. Most driver installers (including Waveshare's) set up rpi-fbcp, which basically takes the image frames going to the HDMI interface and makes a copy of each one and sends it to the secondary serial interface. I've never gotten this to work reliably, but things may have improved since I last tried. As alternatives, you could also try the following:
    • https://github.com/juj/fbcp-ili9341 - This is an alternate driver that only sends changed pixels instead of entire frames to save bandwidth. It won't work with every screen out there, but most of the cheap ones I've found on Amazon use the same ILI9341 controller or a clone and should be supported. Maybe try setting this up using a separate MicroSD card, so in case you don't like it you can easily switch back to your working config.
    • Swap the entire screen for an easier one that uses just a plain HDMI input (example) or DSI "ribbon cable" interface (example). This is what I ended up doing for mine. These avoid the use of the serial bus or extra video interfaces and just accept the fully GPU-accelerated signal from the Pi's primary display output. No extra drivers required. The cheap DSI screens didn't really exist two years ago, but they do now and they're great.
  • Good catch on the Displays step! I'll review that and update the post above. (I don't remember doing any of this stuff, so I'm glad I wrote it down!)
  • ffmpeg should definitely play faster than 2 FPS. My guess would either be a problem during the compilation step or the SPI bus getting overloaded. Which Raspberry Pi are you using? I might be able to reproduce the issue.

Once I got mine working, I just stuffed it underneath the control panel in my Blast City cab and haven't had to think about it. (Since it doesn't need internet access and the games aren't changing any time soon...) However, my longer term goal for when I revisited this project was to find a widescreen rectangular LCD (example) to make into a digital marquee. If anyone has any ideas here, let me know!
 
Back
Top