Finger updates from finger digest Thu, 6 Aug 2020 17:39:29 -0400 Finger updates from Bugzilla 5.0.6 vs MySQL 8 Mon, 18 May 2020 12:16:35 -0400 <p>Irritatingly, MySQL 8 reserves (but does not use) the keyword "groups," so if you happened to have something like this:</p> <pre><code>SELECT name FROM groups where user=5; </code></pre> <p>Then as soon as you upgraded to MySQL 8, your query would be a syntax error.</p> <p>This will work, though:</p> <pre><code>SELECT name FROM `groups` where user=5; </code></pre> <p>Naturally, Bugzilla has a table named "groups", so this broke.</p> <p>Ubuntu started shipping MySQL 8 in 2019, and there was never a Bugzilla 5.0.7 release to fix this (the unreleased 5.2 branch supposedly has this fixed, but I'm not sure).</p> <p>If you, like me, just updated your old Ubuntu server and found--surprise!--that the stable Bugzilla release no longer works, here's <a href="">a patch to 5.0.6 to fix it</a>.</p> <p>I can't say this is correct, complete, or sane, but it got the bug tracker up and running again here.</p> <p>--ryan.</p> <br/> The Eternal Castle for Nintendo Switch! Wed, 6 May 2020 14:44:34 -0400 <p>The Eternal Castle is coming to Nintendo Switch! I wrote about it over <a href="">on my Patreon</a>.</p> <p>You can preorder it <em>RIGHT NOW</em> from Nintendo's website, to be released on May 15th.</p> <p></p> <p>--ryan.</p> <br/> Descent 3 returns! Fri, 31 Jan 2020 21:43:42 -0500 <p>Holy moly, Descent 3 is back on Linux and macOS! Come take a look at my Patreon page about it. And accidentally drop some dollars on it as you roll on by.</p> <p><a href="">Read about it here!</a></p> <p>--ryan.</p> <br/> Arcade1up kill switches Fri, 27 Dec 2019 02:04:18 -0500 <h1>Hey you:</h1> <p>Did you know that I drill holes in this arcade cabinet because people subscribe to my Patreon? I also make fun software, tools to build games, and port games to Linux. If you like those things, <a href="">give up the dough</a>.</p> <h1>Previously:</h1> <p>If you missed them, I previously wrote up these other Arcade1Up cabinet mods:</p> <ul> <li><a href="">Wire up stock volume and power switches to the Raspberry Pi</a></li> <li><a href="">Run stereo speakers into the marquee</a></li> <li><a href="">Trim down a massive rom set to exactly what you want</a></li> <li><a href="">Run the amp's volume knob to the control panel</a></li> <li><a href="">Quickies: Power relay, HDMI resolution...and Sharpies!</a></li> <li><a href="">Put an LCD display in your marquee</a></li> </ul> <h1>Arcade1Up kill switches</h1> <p>I was looking back at old blog entries and noticed that by the time I did the LCD marquee, I had already replaced the stock power switch, but never wrote about it.</p> <p>This happened because I was tired of having an on/off switch for a mechanism that actually wants a <a href="">momentary switch</a>. So I removed the stock power switch, drilled a hole in the case with the usual step bit, and fit one of the stock arcade buttons into the spot (white, so it wouldn't look like the red or blue buttons). Once in place, I just had to run the wires to the same place I had the original switch wired up on the GPIO pins.</p> <p>And then, I let a bunch of six-year olds play Street Fighter 2.</p> <p>Kids take the button-mashing strategy to a new level. They kept slapping the white button, along with all the others, promptly turning off the arcade machine in the middle of a fight. So this had to change.</p> <p>There was one other problem I wanted to solve: if you initiate a formal shutdown, Emulation Station might not save changes you've made (favorite games you marked, last played, etc), so I wanted a way to formally quit ES before the rest of the system shutdown.</p> <p>So I took this line out of /boot/config ...</p> <pre><code>dtoverlay=gpio-shutdown </code></pre> <p>...which tells the system to listen for that button on GPIO3 and trigger a shutdown when the button is pressed. I had added this when I wired the stock power switch to the GPIO pins, it won't be there by default.</p> <p>Then I wrote some C code to listen on that pin but only trigger a shutdown when the button is pressed for at least 2 full seconds. That code is <a href="">arcade1up-power-gpio.c</a>, which you can download to your Pi and compile:</p> <pre><code>cd /home/pi sudo apt-get install wiringpi wget gcc -Wall -Os -s -o arcade1up-power-gpio arcade1up-power-gpio.c -lwiringPi </code></pre> <p>Once that's compiled, stick it in /etc/rc.local so it runs on startup:</p> <pre><code>/home/pi/arcade1up-power-gpio & </code></pre> <p>...and now you can hold down your power button for 2 seconds to initiate a clean shutdown. Before the shutdown begins, a SIGINT signal is sent to Emulation Station, which it treats by writing out favorites and such and cleanly terminating.</p> <p>As for starting back up, this is hardware magic that happens on the Pi itself when it sees that button press on GPIO3, so our software changes won't affect our ability to restart from the power switch.</p> <h1>Exiting any game with a kill switch.</h1> <p>We know that not all emulators were created equal. Some use RetroArch, so your joysticks magically work across all of them, including the magic hotkeys, but outside of there, it's the wild west. Each emulator and game have their own configs, bindings, etc. It's not uncommon to find yourself trying to quit out of a game without access to a keyboard, and it's also not uncommon to find yourself <em>unable to do it</em>. More than once I've had to reboot the Pi to get out of something.</p> <p>People have talked about tweaking xboxdrv and how to configure each and every game to cooperate, but I took a much more aggressive approach. I added a physical button to act as a kill switch that isn't part of the USB joysticks.</p> <p>First: find a place on the cabinet to drill a hole. Yes, this is my solution to <em>everything</em>. We're going to use another one of the stock arcade buttons we replaced when doing the initial ETAPrime mod. I decided to put this on the top back panel (it was panel 'H' in the Street Fighter II unit), and run some extra wire length, but arguments could be made for putting it on the side or back, or even next to the power switch on the control console. I wanted it out of view, to be used as a panic button in emergencies.</p> <p><img alt="the target panel" width="50%" src="" /></p> <p>(I flipped this panel over because I like all the disgusting fingerprints more than the giant Arcade1Up legal disclaimer sticker.)</p> <p>You know the drill: go get the drill. And the step bit.</p> <p><img alt="groovy." width="50%" src="" /></p> <p>Go slow until the button just fits. If you put speakers in the marquee like me, be careful that the button has room in this panel when installed.</p> <p><img alt="the hole I made" width="50%" src="" /></p> <p>Then take that button and wire it up to a GPIO pin and a ground pin. I used pins 39 and 40 (the bottom most pins, the two closest to the USB ports. It doesn't matter which wire is connected to which of those two pins, since all you need is the button to complete the circuit when pressed. If you are putting this button close enough that you can use the original wire, the original plug will fit on these pins and you don't have to cut it off.</p> <p><img alt="the wired connected to GPIO pins" width="50%" src="" /></p> <p>Now, reassemble everything, and get this program on your Pi, and compile it the same as the other one I mentioned: <a href="">arcade1up-killswitch-gpio.c</a></p> <pre><code>cd /home/pi sudo apt-get install wiringpi wget gcc -Wall -Os -s -o arcade1up-killswitch-gpio arcade1up-killswitch-gpio.c -lwiringPi </code></pre> <p>This <em>also</em> goes in /etc/rc.local so it runs on startup:</p> <pre><code>/home/pi/arcade1up-killswitch-gpio & </code></pre> <p>Both this and the power switch program from before can both be used at the same time without problems.</p> <p>This program works roughly the same, but when the killswitch is pressed for 2 full seconds, it'll look for children of the Emulation Station process and kill them. When they die, Emulation Station carries on as if you had cleanly exited the game, and comes back up and all is right in the world. In theory, this should Just Work for any scenario you run into.</p> <p><img alt="the final product" width="50%" src="" /></p> <p>--ryan.</p> <br/> Arcade1up LCD Marquee Sun, 3 Mar 2019 15:54:21 -0500 <h1>Hey you:</h1> <p>Did you know that fun things like this are funded by my Patreon? I also make fun software, tools to build games, and port games to Linux. If you like those things, feel free to promptly <a href="">make it rain</a>.</p> <h1>Previously:</h1> <p>If you missed them, I previously wrote up these other Arcade1Up cabinet mods:</p> <ul> <li><a href="">Wire up stock volume and power switches to the Raspberry Pi</a></li> <li><a href="">Run stereo speakers into the marquee</a></li> <li><a href="">Trim down a massive rom set to exactly what you want</a></li> <li><a href="">Run the amp's volume knob to the control panel</a></li> <li><a href="">Quickies: Power relay, HDMI resolution...and Sharpies!</a></li> </ul> <h1>Pimp my Arcade1Up marquee!</h1> <p><a href="">/r/Arcade1Up</a> is kind of funny. Someone comes up with a smart idea for a mod, then a dozen YouTube videos pop up of people doing it, confidence grows, and then you get a million photos of everyone's, I don't know, cabinet with blue electrical tape trimming.</p> <p>Don't get me wrong, I'm no different. I sat here for a few weeks thinking, "I should really make a lighted marquee for this cabinet, like I remember on the real machines of my youth," and then someone <em>did it</em>, and now, it's just a thing you see all over.</p> <p>I decided to go in a different direction.</p> <p>I wanted a lighted marquee because I thought it might look nice, but it sort of bothered me that it would always say "GALAGA" or "SPACE INVADERS" or some other game that is legit "classic" but not my personal style. Even something I love--bring me a Dragon's Lair marquee!--doesn't really make much sense to be in my peripheral vision when I'm playing Marvel vs Street Fighter.</p> <p>Also, eternal tinkerer that I am, I'm constantly reaching for a USB keyboard, to mess around at a command prompt, or even just play King's Quest or whatever, and it was becoming a pain, so I decided to kill a few birds with one liquid crystal display.</p> <p>And that display is this one right here:</p> <p><img alt="Pi Foundation 7 inch touchscreen package" width="50%" src="" /></p> <p>I got this <a href="">from Adafruit</a>, as I tend to, but this is the touchscreen from the people that make the Raspberry Pi itself, so you can get them just about anywhere that Pi accessories are sold. Amazon has it for a few dollars cheaper and with Prime shipping, but Adafruit has something very important to this endeavor: while you're shopping, also get <a href="">one of these cables</a>.</p> <p><img alt="one of these cables" width="50%" src="" /></p> <p>If you <a href="">built a little 4-dollar shelf</a>, then you can use a 1 meter cable, but if your Pi is on the floor of the cabinet, you'll need the 2 meter one, which is loooooooong.</p> <p><img alt="looooooooong cable" width="50%" src="" /></p> <p>The cable that comes with the screen is like three inches long. Amazingly, it still works across six feet! You'll also need a second micro-USB cable to power the screen. You can use the Pi's power source and run power from the screen to the Pi in a few different ways, but you are going to need to get a USB cable from a power source to the marquee no matter what, so plan ahead.</p> <p>This display has a few interesting qualities that I liked:</p> <ul> <li>It's a known quantity, well-supported, coming from the Pi Foundation itself.</li> <li>It embeds really well, so your marquee footprint is paper-thin. It's not like we're velcroing an iPad to the front of the cabinet here.</li> <li>It uses the Pi's DSI port, which you probably never even knew you had. Which means connecting it is trivial and doesn't eat otherwise-valuable ports, and</li> <li>...It can be driven by the Pi's GPU with OpenGL ES.</li> <li>Oh, and: it's a touchscreen, too!</li> </ul> <p>The downside is that while it fits <em>super</em> nicely into the space of the stock Arcade1Up marquee, it's not going to be a thing that covers the entire area, if you were hoping to have a legit competitor to all those light-up marquee mods out there. But what we lack in width, we'll make up in speakers.</p> <p>You might recall that <a href="">I had done this to the marquee previously</a>:</p> <p><img alt="speakers mounted to back of marquee" width="50%" src="" /></p> <p>I've been pretty happy with the stereo speakers there, but I did a <em>terrible</em> job of drilling holes for them, and since we have all this marquee real estate not covered by the display, I took the time to clean that up. I drilled a big hole, so there's no wood blocking the sound now, and put speaker grills over it to make it look clean and professional, as a testament to the lofty idea that no matter how bad you fuck something up, you can usually cover your failures later with a little extra effort.</p> <p>I'm going to document this here so you learn from my mistakes.</p> <p>Say hello to my little friend:</p> <p><img alt="hole saw on a drill" width="50%" src="" /></p> <p>This is a hole saw. You put it on a drill and it makes big, beautiful, perfectly circular holes. Walk into a Home Depot and pay about ten bucks for a 2.5 inch unit. The price on these vary wildly, but aim for cheap here since you'll use it exactly twice in your life. Three times when you realize your desk could use a hole to feed all the cables from your computer through.</p> <p>Take that thing and drill through the marquee. You want to go as close to the sides as you can, but be aware that there's a piece of metal in there if you go too far: not only do you not want the hole saw to hit that, you 100% don't want to accidentally cut it out, since that metal holds the screw that binds the marquee to the side of the cabinet. You can see where it is clearly from the back of the marquee, and I cut the hole right up against it, successfully removing my crappy little drill holes from before.</p> <p><img alt="perfectly round circles" width="50%" src="" /></p> <p>Next, I did something stupid.</p> <p>My thinking is that I would mount the speakers on the front of the marquee, with the backs going through the holes I just cut, and then mount the grills on top of them using the same screw to hold both things. This was dumb. First: the holes were too small for that, so I took a jigsaw to them to roughly enlarge them, so even though no one but me knows: now they're ugly.</p> <p><img alt="not so perfectly round circles" width="50%" src="" /></p> <p>But also: mounting the speakers on the front ended up not looking too nice. The grills didn't lay as flat. So I ended up trying to mount the speakers behind the holes--probably how it was always meant to be anyhow--wherever I could find some wood to hold screws.</p> <p>The nice thing about all this is you can usually cover your mistakes and misdeeds by the time you're done.</p> <p>I got the grills off eBay, the 3 inch size, and despite the sticker on the packaging...</p> <p><img alt="'Better prices are available on our website'" width="50%" src="" /></p> <p>...the shipping was more expensive from diyretroarcade. But you're looking at just a few bucks for these no matter where you get them.</p> <p>After Olive modelled them for me, they just screw on over the holes we cut.</p> <p><img alt="BUG GIRL" width="50%" src="" /></p> <p>Put these on with a manual screwdriver; go too fast with a drill and you'll probably crack the plastic I did. Back to eBay for another one...</p> <p>Okay, so now that mess is cleaned up, we could start on the screen. Take it out of the box and plug it in to your Pi per the instructions. The first display I ordered had a busted circuit board, and that would have been frustrating to discover at the end of this project, so better to test this up front. You'll hopefully see RetroPie correctly on the touchscreen. HDMI won't work if you still have that plugged in (we'll deal with that later).</p> <p>Once it's good to go, take it apart. If there's a circuit board attached to the back, take out the four poster screws and disconnect the two ribbon cables that attach it to the screen. Put all this aside for later.</p> <p>The display has a metal back that houses the guts and some mounting brackets, and a very thin piece of glass that extends out past the edge of the metal part. We want to cut out space in the marquee for the metal, so the glass lays flat on the wood and covers any imperfections in our cutting.</p> <p>We also want to leave some wood so we have something to mount to, which is to say we want to carve out a rectangle but not cut all the way through.</p> <p>Which is to say: we need a dremel with a router attachment.</p> <p>I ended up getting a Dremel 4300 off Amazon for about 100 bucks. This was probably overkill for the job, but I suspect I'll find other uses for this over time. I'm already walking around the house thinking, "what could I carve into with this?!". This model comes with lots of stuff, but nothing I would qualify as a router bit, so I ended up getting robbed for a set of six at a local Lowe's hardware store. I have never used a Dremel before and having spent maybe seven minutes on YouTube learning how not to hurt myself, I can't say if this was the <em>best</em> approach, but it definitely got the job done.</p> <p>The Arcade1Up cabinet is made of something called MDF, I think, which is like particle board on steroids. MDF stands for <a href="">"Medium Density Fibreboard"</a>, but it might as well mean Motherfuckin' Dust Forever. This is going to make a <em>ton</em> of sawdust. Do this outside if you can, wear safety goggles and a facemask, and <em>DO NOT BRING THE TOUCHSCREEN NEAR THIS</em>. Dust can get between the touchscreen glass and the LCD under it, and it's basically going to be there forever once it happens, so don't invite the display to the dust party. Clean the marquee thoroughly when you're done.</p> <p>You should measure carefully to center your cut, but the hole you're making just has to <em>fit</em> the hardware, it doesn't have to hold it tight, so as long as you aren't wildly off, the glass will cover any inexactness. Horizontally, you have reasonable clearance for mistakes. Vertically, there's much less wiggle room, though, so don't go hog wild. Also good news: the street figher logo is almost exactly the area to cut, so you can use that as a guideline. You can see where I carefully measured a slightly too-small rectangle here:</p> <p><img alt="Marked for cutting" width="50%" src="" /></p> <p>Now route the shit out of that area.</p> <p><img alt="Routing" width="50%" src="" /></p> <p>This took a <em>long</em> time. There's a lot of material to get through. Don't push hard through it, or you'll start a fire. Go slow and let the bit do the work. If you get tired, let your 7-year-old daughter take over:</p> <p><img alt="Olive takes control (she was wearing safety goggles, I promise)" width="50%" src="" /></p> <p>Be careful near the edges; I had the dremel jump on me and scratch the marquee right above the rectangle, and it's <em>very</em> easy to cut past the edge of your area to a place the glass won't cover.</p> <p>I had the Dremel router attachment on the tool, with the theory that you'll have a nice smooth and even area at the end, but I managed to not cut deep enough--stupid mistakes piling up--so when I went back I didn't have any edge for the attachment to sit on and had to freehand it. No one is going to see your mistakes here, though, so everyone survived this.</p> <p>The original artwork on the marquee is a piece of paper glued on, not like whatever that wierd paint on the control panel is that rubs off when you play a game. If you're planning to keep the art, you might want to gently take the dremel over the surface of the rectangle before you start cutting into the wood. It'll scrape the paper off pretty efficiently, which means it won't be flaying off unpredictably while you are routing. It looks like this scaped off, partway through routing:</p> <p><img alt="Rorschach test!" width="50%" src="" /></p> <p>If you aren't keeping the art, just peel the whole thing off, which I ended up doing later anyhow. If you didn't do the speaker grills, it could be worth keeping, but oh man, that Capcom logo you can't quite cover is <em>the worst</em> otherwise.</p> <p>Since I had already cracked a grill ring and was waiting on a replacement in the mail, I didn't bother taking them off to route, but you <em>should</em>, to avoid getting dust in them.</p> <p>Note that in cutting this, you're going to cut clear through to the slot where piece 'H' (the top panel of the cabinet) slides in. Don't panic, this is exactly what you want, because we're going to feed a cable through it later. You won't be able to see this hole when the cabinet is reassembled.</p> <p>When you're finally done, it'll look like this, although hopefully better than my attempt:</p> <p><img alt="Completed routed marquee" width="50%" src="" /></p> <p>Thoroughly clean all the dust off it and make sure your screen fits in the hole and lays flat against the marquee. The screen's ribbon cable goes through the slot at the top.</p> <p><img alt="If it fits, it ships" width="50%" src="" /></p> <p>Now we're getting somewhere! Next up is to drill a few holes through the back of our rectangle, which line up with the outer mounting brackets of the screen. I didn't bother to measure this, instead eyeballing it and making the holes bigger until it matched, using a little drill bit on the dremel. (Watch out for dust on the screen while messing with this.) I was just going to put washers over the too-large holes anyhow.</p> <p><img alt="too-large holes in action" width="50%" src="" /></p> <p>This is probably a good time to replace the front artwork, if you want, now that we're done doing damage to the wood. The original art just peels off pretty cleanly if you lift up a corner of the paper...</p> <p><img alt="peeling off the paper." width="50%" src="" /></p> <p>...but it <em>will</em> leave a layer of paper still glued on. You can go wild sanding this off, but honestly, it's fine, leave it on there.</p> <p><img alt="totally peeled" width="50%" src="" /></p> <p>I got some <a href="">black vinyl from Michael's for a few bucks</a> and cut it to size:</p> <p><img alt="vinyl cut to size" width="50%" src="" /></p> <p>Peel off the backing and get it on the marquee. Take an exacto-knife to cut out the speaker holes and LCD slot, and smooth it out best you can. Since we didn't sand off the paper, it'll have minor imperfections if you look closely, but I think it gives it character!</p> <p>Now you can install your speakers, grills, and the touchscreen.</p> <p>The bolt you need for the touchscreen mounting brackets are "M3" size, and you get a bunch of them for a buck or two at Home Depot. I got ones that were 10mm long, which was just about perfect.</p> <p><img alt="Just about perfect bolts" width="50%" src="" /></p> <p>Note that there is nothing that will stop you from putting a long bolt through the screen, so screw them in carefully and slowly, maybe adding a nut if the screw is too long. Use washers to manage the giant holes you drilled. Just roll out of Home Depot with a wide variety of options, like I did:</p> <p><img alt="some of these will probably work." width="50%" src="" /></p> <p>Once your screen is attached to the marquee, reconnect its circuit board. Big ribbon cable on the back, small ribbon on the front. Tiny tiny wood screws to hold the board on the back of the marquee, or maybe just a command strip thing.</p> <p><img alt="circuit board and bolts" width="50%" src="" /></p> <p>You're going to want to cut a notch in the 'H' panel of the cabinet, to prevent it squashing the ribbon cable. Just a little notch will do, and maybe some black sharpie on the cut so it isn't visible. This notch is way too big:</p> <p><img alt="too large notch" width="50%" src="" /></p> <p>I ended up putting some leftover black vinyl over it to cover it up. A tiny little cut will do the job here.</p> <p>Now you need some power to this circuit board. I ran a separate USB cable to it, leaving the Pi powered separately (but you can also run a single USB cable to the screen and then run two wires from there to the Pi's GPIO to power the Pi, or use that second USB port on the screen's board to run juice to the Pi's micro-USB port. There are options, but all of them need you to use the screen's micro-USB port as a starting point. There's just one problem with that...</p> <p><img alt="...the cable sticks out." width="50%" src="" /></p> <p>...every USB cable I tried wouldn't fit, because they run into the space where the 'H' board is meant to slot into the marquee. I ended up buying a "90 degree USB cable" off the Internet:</p> <p><img alt="90 degree cable" width="50%" src="" /></p> <p>But as my luck had it, it would charge a phone but not power the screen! :(</p> <p>I went and found a USB cable that I knew worked and cut off the plastic reinforcement by the connector with an exacto-knife and pried off the metal shielding. I assume these things are there to make the cable more sturdy at an obvious stress point, but I need this thing to <em>bend</em>.</p> <p><img alt="stripped USB wire" width="50%" src="" /></p> <p>Then I put some electrical tape on it, and was able to use it with the screen within the small clearance I had. I also ran that crazy six-foot ribbon cable from the circuit board to the weird port on the Pi you always wondered about.</p> <p><img alt="installed USB power wire" width="50%" src="" /></p> <p>That port is a "DSI" port and it basically exists to drive this exact screen. Use the right one; the other port is for the official Raspberry Pi camera. Just gently slide the ribbon cable in. It will fight you a little, but you shouldn't have to--and shouldn't--aggressively force the cable in. If you have a Pi3, you don't need to hook up anything else: video output and touchscreen input both run over the DSI ribbon. On older Pi's you might need to run wires to the GPIO pins for touchscreen input, but if you could spend 80 bucks on a little screen, you can pay 35 for a newer Pi.</p> <p>Ok, now power everything up and see if you get RetroPie on a tiny screen.</p> <p>Hooray, we're done with the hardware work for now! Next up: <em>software</em>.</p> <p>First things first. If you haven't figured it out yet: we installed the screen upside down, so the cable could fit through that slot in the marquee. Fortunately, you can rotate the output to be right-side-up in hardware by adding a line to /boot/config.txt. More magic: we can also tell the Pi to not favor a connected touchscreen over the HDMI port for the main screen.</p> <p>Add these lines to the end of /boot/config.txt:</p> <pre><code>display_default_lcd=0 lcd_rotate=2 </code></pre> <p> and reboot. RetroPie should be back on the cabinet's usual monitor.</p> <p>Now, everywhere I looked on the Google machine seemed to believe you can't drive both these displays at once, unless you had "custom software," like omxplayer, which can render videos on the touchscreen even if you're using an HDMI monitor for everything else.</p> <p>When they say "custom software," they mean something that talks to the "dispmanx" API, which I guess means "DISPlay MANager X" or something. It's a Pi (or at least Broadcom) specific API that controls some basic truths about the Pi's GPU. It also happens to be what SDL already uses at the lowest level for configuring output on a Raspberry Pi.</p> <p><a href="">So here you go, now everyone has "custom software."</a> The latest in SDL's revision control now reports two displays on the Pi, and both can have separate windows and both can use OpenGL ES for accelerated 3D rendering at the same time, using the existing SDL application interfaces.</p> <p>As an added benefit, creating an SDL window on the LCD will give you touch events. More on that in a moment.</p> <p>My original thinking was to have a simple program that blasts a .png file to the display and quit, leaving the image on the screen, but it turns out that the Pi will power down the screen when no process is using it. It leaves the backlight on, so you can watch the liquid crystals fail in slow motion. It's actually kind of cool, but not useful for our needs. Now I had to keep a process running all the time just to keep the screen alive, and then I needed a way to tell that process to change the picture, and now we're into some crazy interprocess communication nonsense.</p> <p>So I wrote a daemon that sits there and takes requests over D-Bus to change the image, complete with crossfade, and a bunch of file formats supported, including SVG, which will be helpful a little later. There's a simple command line program to tell the daemon to change pictures.</p> <p>That work is sitting in <a href="">revision control</a>.</p> <p>So now we have a way to show an image on the display, and a way to tell it to change to a new image...what images do we show? By default, it shows a "NEO-GEO SYSTEM" logo, a little nod to a <a href="">mod that I love</a>. But all this work was so I wouldn't have a Street Fighter logo when playing Pac-Man, so the next step was to make some changes to EmulationStation to run a script before launching a game.</p> <p>...but after some research, it turns out it already does this! Runcommand, the thing that actually launches games for EmulationStation, will already look for a script at /opt/retropie/configs/all/ (and and run it before the game itself starts. So cool, we can hook in. About 100 lines of Perl can find the game's metadata in a core's gamelist.xml, so we can pull out the images from there. Failing that, we can render the SVG file for the emulated system itself from the EmulationStation theme.</p> <p>Already this was looking pretty sweet, but I wanted to take this further. It's been bothering me that sometimes I need to hunt down a USB mouse...maybe I'm running Basilisk II...</p> <p><img alt="Welcome to Mac OS 8!" width="50%" src="" /></p> <p>...or maybe I'm just running ScummVM and want to move the mouse cursor better than I can with a Sanwa joystick.</p> <p>Since we have a touchscreen in the marquee, and a program that always needs to be running to drive the touchscreen, why not have that program also listen for touch input and make it look like a mouse to the rest of the system?</p> <p>Hooray for Linux, this is actually easy to do. Linux offers something called "/dev/uinput" for creating virtual mice. Your program says "this fake mouse just moved three mickeys to the left" and as far as every other program on the system is concern, a real mouse is getting slid around. So now the program sees a finger on the screen, it'll move the "mouse," and if a second finger touches, it'll report that as a mouse button being pressed. While I didn't mess around with multiple buttons or scrollwheels, this is more than enough to play Space Quest 4.</p> <p>It isn't enough, however, to play Space Quest <em>3</em>, which wants you to type in commands like "press button" and "buy underwear."</p> <p>For that, I made a virtual keyboard to match the virtual mouse. It slides in or out when you touch four fingers to the screen at the same time, and gives you a basic keyboard where you can tap keys and the system thinks you plugged in a USB thing...<a href="">but you didn't</a>!</p> <p>None of this is going to be a pleasant way to play Quake, but it's been working quite well for LucasArts and Sierra games, not to mention the occasional emergency commands typed in at the terminal without finding a real keyboard.</p> <p>To get all this to work, you have to build a bunch of stuff, make a patch to the system-installed SDL2, install a D-Bus config file and a systemd service and add some scripts to your RetroPie install.</p> <p>I know what you're thinking. First, you're thinking Jesus Christ, this blog post goes on FOREVER, and trust me, I'm right there with you because you can skim it but I had to write this whole thing out and take pictures! Also, you're thinking that setting up the software for this is totally intimidating, and if you aren't a Linux command line nerd like me, that's a totally reasonable way to feel. So I've reduced this down to exactly one command for you. Connect the touchscreen, boot, and then either quit out of EmulationStation so you're at a command prompt and plug in a USB keyboard, or connect over the network with ssh or <a href="">PuTTY</a> and punch in this magic:</p> <pre><code>curl -L |sudo bash </code></pre> <p>That will download an installation script and run it (as an administrator). Unless something goes wrong, you can just watch it spin a little and wait until it reports success. Maybe reboot to get the screen right-side-up. If something <em>does</em> go wrong, you're not on your own; ask for help!</p> <p>And then, you're good to go. What a ride! I'm so happy with how the final product came out. It's totally unique and useful. It's form <em>and</em> function. :)</p> <p>But I think next time I'll do something easier, like replace the HDMI monitor completely or <a href="">beat Dragon's Lair without dying</a>.</p> <p><img alt="...maybe someday..." width="50%" src="" /></p> <p>--ryan.</p> <br/>