DVD Player Emulator

One of the projects I worked on for several months a few years back is a DVD Player emulator meant to replace the physical DVD player in a Twinkle setup. Originally, there was a Victor XV-D701 DVD player that sat inside a Beatmania IIDX cabinet and provided the background video content for all mixes through 8th style. The player uses a proprietary serial format from JVC (JLIP) to communicate with the Twinkle stack for the purpose of video playback. The actual video comes out over composite and is mixed with the game video before being output to the game CRT. Recently, I've updated the code to not only emulate the Victor XV-D701 but also provide rudimentary emulation for the Toshiba SD-B100 DVD player as well. This enables this emulator to act as a demonstration kiosk for ParaParaPara 2nd Mix as well. The DVD player emulator is a Raspberry Pi 2 image that can be written to a 2GB SD card to emulate the original player hardware for both of these players, restoring video to a IIDX cabinets with a broken player and providing demonstration videos to a ParaParaParadise 2nd Mix cabinet with a broken or missing demonstration kiosk.

You can download the image for a Raspberry Pi 2 here (about 650MB). The source code for the player is available on github. If you want a copy of the old version which ran on Raspberry Pi Model B, see the bottom of the page.

A video of me testing an early prototype on my cabinet is available on youtube for the curious. Also, I have a few videos of the final product working, including the final test video, a video of the 3rd style attract sequence working, Brilliant 2U and finally Calcutta which demonstrates that the video is in sync with audio. Apologies for the terrible one-handed playing while I tried to film as well. A video of me getting the ParaParaParadise emulation working for the first time is here. A video of the player in action on PPP 2nd is here.

What it Requires

How to rip your DVD/VCD

For these steps, you will need ffmpeg.exe which can be downloaded from various sites. I've included a copy of it and the batch files I used for converting personal copies for download here. If you are on MacOS/Linux, you will need to source ffbmpeg yourself and tweak the batch files to use bash or another scripting language.

Ripping a VCD (1st-5th style) is easy, since VCD keeps a different file for each chapter. Just copy the files to your computer and run ffmpeg -i [input file] -c:v libx264 -crf 12 -an [chapter number].m4v on each file to convert. For chapters 1-9, make sure to include a leading zero! For DVD (6th-8th style, ParaParaParadise 2nd Mix), it is a little more complicated as you will need to separate the .vob files into one file per chapter. I used DVD Decryptor in IFO mode for separating DVDs into separate chapters. Once you get the .vob files separated out into individual files per chapter, run ffmpeg -i [input file] -c:v libx264 -crf 18 -an [chapter number].m4v on each file, remembering to include a leading zero much like the VCD conversion process.

Once you have a directory of files named 01.m4v through xx.m4v (xx being the highest chapter on the disc), create a file in the same directory called "disc.cfg". Open it in your favorite text editor and write in the DVD player that you will be emulating. For IIDX 1st-5th style, you will want to write "XV-D701-VCD" (without quotes) on a single line and save it. For IIDX 6th-8th style, you will want to write "XV-D701-DVD" (without quotes) on a single line and save it. For ParaParaParadise 2nd Mix, you will want to write "SD-B100-DVD" (without quotes) on a single line and save it. This file tells the emulator what type of disc to emulate, so it knows what kind of DVD player it should fill in for.

How to Use It

Write the image to the Micro SD card using your favorite image writing program (dd works perfectly on Linux, selfimage should work on Windows). If the image is slightly too big for the card, don't worry. It's padded with several hundred megs of empty space after the last partition just in case. After its finished copying, put it in your Raspberry Pi 2. Take the .m4v files and the disc.cfg file and copy it to your USB stick. Make sure they are not put in any folder (they should be on the root of the drive) and make sure there are no other files or folders on the drive (it should be empty except for the .m4v files and disc.cfg file). Plug this into the Raspberry Pi 2 on any USB port. After you've copied all of the files and put them into the Raspberry Pi 2, plug the USB to Serial into the RasPi (any USB port).

Twinkle Setup

For Twinkle, connect the serial cable from the USB to Serial converter to the serial port on the back of the twinkle. Connect the composite out from the RasPi to the left composite jack on the back of the Twinkle (almost under the serial port). Plug the USB wall wart into the USB power slot on the RasPi and plug the wall wart itself into the internal socket of the IIDX cabinet where the original DVD player would have plugged in. Now, assuming you have copied the correct style to match what you have installed in your Twinkle, power on your IIDX cabinet and play. See GameRepair.info for photos of correct setup.

You can test that everything is working by heading to the DVD test menu. When there is no video playing, you will see a blank screen. If you see any text on the screen then it is not emulating properly (you may have forgotten to place the files in the right spot or plugged the USB stick in). If you see a blank screen, try playing, fast forwarding, stopping, etc. It should be plug and play, however, and the videos will just work if you boot into the game without testing.

ParaParaParadise Setup

For PPP 2nd, connect the serial to mini din-8 cable from the USB to Serial converter to the mini din-8 connection on the back of the PPP cabinet. Plug the USB wall wart into a free outlet. Connect a TV or computer monitor to the Raspberry Pi using HDMI or composite. If everything is connected correctly, you should be able to turn on the DVD demo functionality in the DVD check menu. If this is successful, then rebooting the cabinet should pass the DVD check and start playing videos. If it is not connected properly, the game will error out and tell you that there was a DVD error.

How to Tinker

Sources are all on github. The image is based off of Raspbian Jessie with some minor tweaks. The config.txt file in the boot partition has been modified to allow for fast booting and ignoring under voltage. A few utilities have been installed. The DVD player will boot automatically, but you can connect a keyboard and hit Ctrl-C to kill it. Everything runs out of /home/pi. If /home/pi/autostart is present, then /home/pi/start.sh (invoked by /home/pi/.profile) will mount the USB stick to /home/pi/videos/ and start the emulator. To force it to not start, remove /home/pi/autostart. The emulator source should hopefully be self-explanatory and matches the JLIP documentation provided.

What's Been Tested

I've tested on my own Twinkle stack using 3rd Style, 5th Style, 6th Style and 8th Style, all with perfect results. I've also tested with 8th style on a friend's IIDX cabinet running with his Twinkle. I've also run this at CAX for a few years without an issue the entire weekend. Other styles should exhibit the same behavior since both DVD and VCD modes have been tested and all video files were converted using the same settings. I haven't had much luck with unmodified 1st, Substream or 2nd Style. They don't seem to pass the DVD check with a real Twinkle DVD player connected either, so I'm not sure what's up. I've also tested on my own ParaParaParadise 2nd Mix cabinet as well as a friend's cabinet.

It goes without saying that this comes with no warranty whatsoever. You are on your own for using this or modifying this. Great care has been taken to make this as easy as possible but I can't think of all the scenarios in which one might screw up.

Who to Thank

Thank billyjr82 for initial Victor packet dumps and inspiration. Thank waxingandwanding for some discs that I was missing. Thank ICNH for providing me a copy of the ParaParaParadise 2nd Mix DVD. Thank me for information on ripping the videos, reverse engineering and emulator writing/testing. Thank pkgingo for the RasPi wizardry, the framebuffer video player compile and integrating the emulator with the video player on the original Raspberry Pi.

Old Version

CootiePi Beta 1 was meaint for a Raspberry Pi Model B board and had a custom compile of omxplayer which was designed to keep up with video playback. It only supported the Victor XV-D701. You can download the old image here. Note that when using this, please only write "VCD" or "DVD" in the "disc.cfg" file instead of "XV-D701-VCD" or "XV-D701-DVD". This version is no longer supported as it is difficult to purchase a Model B and the new version includes all of the features of this old version.

How to Tinker

Sources are all included in the image itself. If you open the ext3 partition and navigate to /home/root, you will see the emulator folder and the sources folder. The emulator folder contains the emulator binary and source as well as the control script to talk to the video stuff. The VID partition is automounted on /home/root/part3 by the /etc/rc3.d and /etc/rc5.d folders using S99Twinkle.sh and the emulator is started using /etc/profile.d/profile just at the time of login. To get onto the RasPi console, delete the file /home/root/autostart when browsing the SD card on a Linux computer. To make it start automatically again, touch that file (can even be done from the RasPi console). The emulator source should be self-explanatory and matches the JLIP documentation provided.