{"id":36,"date":"2009-12-13T03:21:00","date_gmt":"2009-12-13T11:21:00","guid":{"rendered":"http:\/\/lukerymarz.com\/ratingpending\/2009\/12\/cocktail-arcade-cabinet-software.html"},"modified":"2010-04-03T10:44:25","modified_gmt":"2010-04-03T18:44:25","slug":"cocktail-arcade-cabinet-software","status":"publish","type":"post","link":"http:\/\/lukerymarz.com\/ratingpending\/2009\/12\/cocktail-arcade-cabinet-software.html","title":{"rendered":"Cocktail Arcade Cabinet: Software"},"content":{"rendered":"<p>I recently built a cocktail arcade cabinet from scratch. \u00a0I talked about <a href=\"http:\/\/ratingpending.blogspot.com\/2009\/11\/its-made-of-wood.html\">fabrication<\/a> previously, and I&#8217;d like to outline the software I&#8217;ve got on it for those who are interested. \u00a0It wasn&#8217;t an dead-simple setup since emulators all have different interfaces, but I ended up with a setup that&#8217;s relatively streamlined.<span style=\"font-family: inherit;\"> <\/span><\/p>\n<h2>Goals<\/h2>\n<p>It&#8217;s important to figure out what emulators you want. \u00a0I had decided that I wanted the 8-bit and 16-bit consoles, as well as MAME. \u00a0I don&#8217;t have any analog controls, so anything requiring that was out of the question. \u00a0My <em>primary<\/em> goal was a cabinet that would play Donkey Kong, but I wanted the ability to play other things as well. \u00a0My final list of emulators was as follows:<\/p>\n<ul>\n<li>MAME &#8211; <a href=\"http:\/\/www.mameui.info\/\">MameUI<\/a><\/li>\n<li>SNES &#8211; <a href=\"http:\/\/www.zsnes.com\/\">ZSNES<\/a><\/li>\n<li>NES &#8211; <a href=\"http:\/\/fceux.com\/web\/home.html\">FCEUX<\/a><\/li>\n<li>Genesis \/ Megadrive &#8211; <a href=\"http:\/\/www.eidolons-inn.net\/tiki-index.php?page=Kega\">Kega Fusion<\/a><\/li>\n<li>Atari 2600 &#8211; <a href=\"http:\/\/stella.sourceforge.net\/\">Stella<\/a><!--more--><\/li>\n<\/ul>\n<h2>Hurdles<\/h2>\n<p>I ran into a number of problems, but figured out hacks to solve them all. \u00a0The big problems I faced were:<\/p>\n<ol>\n<li>Running emulators on a vertical monitor. \u00a0Mame is good about this, since a lot of classic games were designed for vertical monitors. \u00a0However, almost all the other emulators encounter a DirectDraw error when you try to go into fullscreen mode on a vertical monitor. \u00a0Whatever could the solution be?<\/li>\n<li>Hiding menus. This is a result of not being able to run in full screen mode. \u00a0I wanted to make sure it wasn&#8217;t obvious I was using Windows. \u00a0This meant no title bars, no Windows sounds, no Windows boot stuff, and no Windows menus.<\/li>\n<li>Doing everything from the arcade controller. \u00a0It was most helpful to have a shift key built into the controller I bought. \u00a0If you&#8217;re hacking a keyboard to make your controllers, keep in mind that a shift, control, or alt key could be very useful. \u00a0Barring that, key combinations can be used, but you&#8217;ll have to be sneaky since you&#8217;ll be pressing all kinds of buttons while you&#8217;re playing and you don&#8217;t want to accidentally run a script or something. \u00a0For my setup, all my hotkeys use the Shazam (shift) feature of the KeyWiz controller. \u00a0I have a magic Shazam key that is only used when hotkeying (see a photo <a href=\"http:\/\/www.lukerymarz.com\/galleries\/cabinetproduction\/index.files\/DSC_4862_image.JPG\">here<\/a>).<\/li>\n<li>Quick startup. \u00a0I didn&#8217;t want to wait for my cabinet to boot every time I decided to play. \u00a0System standby is quick to shut down and quick to start up, but Windows doesn&#8217;t have any good built-in &#8220;do this when coming out of standby&#8221; functionality. \u00a0I found a solution for that, though.<\/li>\n<\/ol>\n<h2>Support Software<\/h2>\n<p>When all was said an done, I had installed the following software on my cabinet:<\/p>\n<ol>\n<li><a href=\"http:\/\/www.atomicfe.com\/EN2\/ladite.php\">Atomic FE Ultimate<\/a> &#8211; for my main menu. \u00a0Atomic FE is really quite slick, but a little touchy. \u00a0I tried to set it up from scratch, but ran into too many problems. \u00a0Luckily, LaDite over at the Atomic FE site has put together Atomic FE Ultimate, a pre-configured version of Atomic FE with everything you need to build out an arcade menu.<\/li>\n<li><a href=\"http:\/\/www.autohotkey.com\/\">AutoHotKey <\/a>&#8211; Simply the most awesome piece of software you can get for making magic happen at the press of a key.<\/li>\n<li><a href=\"https:\/\/www.dropbox.com\/\">DropBox <\/a>&#8211; If you don&#8217;t know about it, get it immediately. \u00a0It takes a folder on your computer and syncs it with all your other computers. \u00a0I configured MAME to save screenshots in my DropBox folder. \u00a0I&#8217;ve been having a Kong-Off with a friend, and we email screenshots of our latest high score to each other. \u00a0DropBox is really useful for this since all I do is press the screenshot button and a screenshot is essentially sent to my other PC.<\/li>\n<li><a href=\"http:\/\/groovygamegear.com\/webstore\/index.php?main_page=product_info&amp;cPath=76_80&amp;products_id=199\">KeyWiz Uploader<\/a> &#8211; for setting my arcade controller config. \u00a0I use the &#8220;B&#8221; configuration.<\/li>\n<li>ATI Catalyst Configurator. \u00a0I use this to rotate my display in cases where I can&#8217;t do it with other software. \u00a0It gives you the ability to rotate using hotkeys, and this was very handy. \u00a0I used CTRL+ALT+[0,1,2] to rotate between landscape mode, facing 1st-player vertical, and facing 2nd-player vertical. \u00a0More on that below.<\/li>\n<\/ol>\n<h2>The Configuration<\/h2>\n<p>The first step is to get Atomic FE running. \u00a0Working with Atomic FE can take a little getting used to, so I ended up configuring a single emulator completely to learn about Atomic FEs idiosyncrasies, and then I configured the rest of my emulators. \u00a0I suggest starting with MAME since it doesn&#8217;t require any tweaks to get working. \u00a0It &#8220;just works&#8221;. \u00a0At least, compared to the rest of the emulators I used.<\/p>\n<h3>Configuring MAME<\/h3>\n<ol>\n<li>Run MameUI from windows. \u00a0Play around in the menus until is is configured such that when you run a game you can just play (no menu navigation required). \u00a0I had to set the following:\n<ol>\n<li>Monitor rotation by 90 degrees.<\/li>\n<li>Automatically save state on exit (this also automatically loads it).<\/li>\n<li>screenshots saved to my DropBox folder.<\/li>\n<li><strong>Cocktail mode dip-switches for two-player mode.<\/strong> I didn&#8217;t know about this until I started this project, but most older arcade games have a cocktail mode that will automatically rotate the display for the second player when it&#8217;s their turn. \u00a0You can set this in the dip-switches section of each game, accessible while you&#8217;re running the game.<\/li>\n<li>Configure a proper exit button. \u00a0I didn&#8217;t use escape because it is too generic (more on that later). \u00a0My MAME installation is configured to exit when I press F10, which happens to be the Shift-COIN button on my arcade controller.<\/li>\n<\/ol>\n<\/li>\n<li>Create a main menu in Atomic FE. \u00a0This is where I list each emulator.<\/li>\n<li>Create a MAME option in the main menu you just created. \u00a0Selecting this option displays a list of MAME games on my system. \u00a0You can devise any arbitrary menu tree through Atomic FE, but I chose to go with a simple list of games for each emulator. \u00a0It&#8217;s easy enough to change later if needed. \u00a0I think a lot of people end up sorting by genre.<\/li>\n<li>Make sure Atomic FE displays vertically, and your controller buttons are configured to step into and out of the Atomic FE menus.<\/li>\n<li>Try it out. Play with it. Tweak til it&#8217;s perfect.<\/li>\n<\/ol>\n<h3>Dealing with Windows<\/h3>\n<p>After I got my MAME set up, I dug into hiding windows and working out how to put the system to sleep and have it start up Atomic FE when it woke up. \u00a0Hiding Windows is relatively easy, and there&#8217;s a very nice &#8220;<a href=\"http:\/\/wiki.arcadecontrols.com\/wiki\/Hiding_Windows\">Hiding Windows<\/a>&#8221; document over at <a href=\"http:\/\/wiki.arcadecontrols.com\/wiki\/Main_Page\">BYOACWiki<\/a>. \u00a0Now that I&#8217;m thinking of it, this information might be useful over there. \u00a0Another time, I suppose. \u00a0Anyways, I went with the following tweaks to hide Windows, and it took me less than an hour to do it all:<\/p>\n<ol>\n<li>Change the &#8220;Microsoft Windows&#8221; loading screen to a black image that says &#8220;Loading Arcade&#8230;&#8221; in retro text.<\/li>\n<li>Hide the desktop so no icons are shown.<\/li>\n<li>Turn off ALL sounds. \u00a0The windows startup sound was my specific issue, but I figured I&#8217;d shut everything off while I was in there.<\/li>\n<li>Make the taskbar auto hide.<\/li>\n<li>Configure Windows to automatically log in to my main user account.<\/li>\n<\/ol>\n<p>Now for the hard part. \u00a0How do you get Atomic FE to automatically start up when the PC comes out of standby?\u00a0<a href=\"http:\/\/www.autohotkey.com\/\">AutoHotKey <\/a>is the answer. \u00a0You can script ANY user actions with AutoHotKey. \u00a0The key, though, is that you can have it listen for a &#8220;coming out of standby&#8221; event. \u00a0AutoHotKey runs a master script when my system starts, and that listens for standby events. \u00a0When the PC comes out of standby, I do a few things:<\/p>\n<ol>\n<li>WAIT a little bit. \u00a0I have my script wait 5 seconds before doing anything. \u00a0When the system comes out of stand by, it takes a bit for everything to settle down. \u00a0this was particularly problematic with the next item&#8230;<\/li>\n<li>Write the key configuration to the KeyWiz controller. \u00a0If I didn&#8217;t have the 5 second wait, sometimes KeyWiz Uploader would choke. \u00a0Also, you might expect that the KeyWiz would be able to preserve its configuration through shutdown and standby, since the documentation indicates that this is possible. \u00a0In my experience, though, I wasn&#8217;t able to get it to save itself. \u00a0Instead, I have AutoHotKey run KeyWiz Uploader in silent mode (no menu is displayed) and it&#8217;s all the same to me.<\/li>\n<li>Finally, start up Atomic FE, which DOES remember its configuration. All you have to do is run it.<\/li>\n<\/ol>\n<p>The script that does this is <a href=\"http:\/\/www.lukerymarz.com\/files\/arcadecabinet\/main.ahk\">here<\/a>. \u00a0You&#8217;ll most definitely have to tweak it to get it to work with your system, but it&#8217;s a good starting point at least. \u00a0The actual script looks like this, though<\/p>\n<blockquote>\n<pre style=\"white-space: pre-wrap; word-wrap: break-word;\">OnMessage(0x218, \"func_WM_POWERBROADCAST\")<\/pre>\n<pre style=\"white-space: pre-wrap; word-wrap: break-word;\">\/*   http:\/\/www.autohotkey.com\/forum\/topic21697.html   Source: http:\/\/weblogs.asp.net\/ralfw\/archive\/2003\/09\/09\/26908.aspx*\/<\/pre>\n<pre style=\"white-space: pre-wrap; word-wrap: break-word;\">func_WM_POWERBROADCAST(wParam, lParam)<\/pre>\n<pre style=\"white-space: pre-wrap; word-wrap: break-word;\">{<\/pre>\n<pre style=\"white-space: pre-wrap; word-wrap: break-word;\">      ; wake up event<\/pre>\n<pre style=\"white-space: pre-wrap; word-wrap: break-word;\">      If (lParam = 0 &amp;&amp; wParam = 18)<\/pre>\n<pre style=\"white-space: pre-wrap; word-wrap: break-word;\">      {<\/pre>\n<pre style=\"white-space: pre-wrap; word-wrap: break-word;\">      Sleep, 5000      ; run keyWiz to write default key setup to arcade controller<\/pre>\n<pre style=\"white-space: pre-wrap; word-wrap: break-word;\">      Run \"C:\\Program Files\\KeyWiz Uploader3\\KeyWiz_Uploader3.exe\" \/A \/S \/P B, C:\\Program Files\\KeyWiz Uploader3<\/pre>\n<pre style=\"white-space: pre-wrap; word-wrap: break-word;\">      Sleep, 2000      Run \"E:\\AtomicFE_v020Ult\\AtoMic.exe\"<\/pre>\n<pre style=\"white-space: pre-wrap; word-wrap: break-word;\">      }<\/pre>\n<pre style=\"white-space: pre-wrap; word-wrap: break-word;\">      Return<\/pre>\n<pre style=\"white-space: pre-wrap; word-wrap: break-word;\">}<\/pre>\n<\/blockquote>\n<p>I determined the \u00a0lParam = 0 &amp;&amp; wParam = 18 part empirically on my system.  You&#8217;ll note if you go to the link the my script that the original script watches for wParam = 8.  This didn&#8217;t work on my system for some reason (I&#8217;m running Windows XP 32-bit&#8230; I dunno).<br \/>\nThe script I linked to above includes the rest of my tricks, except for how I get all my emulators to run on a vertical monitor in full screen mode.  Each one is different and I had to configure them all manually.  All the emulators I&#8217;ve worked with restore their state when they load though, so once you&#8217;ve got it configured, it should stay that way.The only problem is that Atomic FE bugs out when the monitor is in vertical mode.  If you run it when the monitor is in vertical mode, Atomic FE enters an infinite loop and all you get is a black screen.  So you have to run Atomic FE in landscape mode, and then switch to vertical mode when you run your emulators (none of the ones I used had an video rotation feature.  That would have been a better and easier solution).<\/p>\n<p>I rotate my display by having Atomic FE run a batch script for each emulator instead of the actual emulator.  In the main folder for each emulator I used, I create a file called &#8220;run.bat&#8221; that contained the command to rotate the monitor, the command to run that emulator (with command line arguments, as Atomic FE does), and after the emulator exits, a command to rotate the monitor back to landscape mode.  For example, this is what my SNES script looks like:<\/p>\n<blockquote><p><span style=\"white-space: pre-wrap;\">@ECHO offE:\\scripts\\rotate1p.ahkcall zsnesw.exe %*E:\\scripts\\rotatenormal.ahkexit<\/span><\/p><\/blockquote>\n<p>The &#8220;@ECHO off&#8221; line makes the commands execute silently in the command line (where the .bat file gets run). \u00a0&#8220;rotate1p.ahk&#8221; and rotatenormal.ahk&#8221; are scripts I wrote for AutoHotKey that handle rotating the display. \u00a0On my system, all those scripts do is send Ctrl+Alt+[0,1, or 2]. \u00a0You can get them at the bottom in the master zip file. \u00a0The part that runs the emulator is the &#8220;call zsnesw.exe %*&#8221; line.  &#8220;call&#8221; is used so the batch file waits for zsnesw.exe to finish executing before continuing, and the &#8220;%*&#8221; business is used to pass whatever parameters Atomic FE gives to zsnes.  Finally, after everything is done, &#8220;exit&#8221; makes sure the command prompt window gets closed.<\/p>\n<p>It&#8217;s pretty complicated and a bit goofy, but it gets the job done.<\/p>\n<h3>How to Exit Anything<\/h3>\n<p>Ok, so I&#8217;ve explained how to get Atomic FE to <em>run<\/em> things, but having the emulators <em>exit<\/em> is a bit of a different matter.  Some of them can be closed with Alt+F4, some require you to use Escape, others require something completely different (like Stella&#8230; Ctrl+Q? Seriously?).  My solution for dealing with that is one master hotkey defined in my main AutoHotKey <a href=\"http:\/\/www.lukerymarz.com\/files\/arcadecabinet\/main.ahk\">script<\/a>.  In my script, F10 is the master hotkey (look for the &#8220;~F10::&#8221; line).  I do a quick check of which processes are running, and that determines with keypress to send.  Atari running?  Send CTRL+Q.  Other things besides MAME running? Send Alt+F4.  MAME running? Don nothing and let the key pass through the script (I configured MAME and zsnes to close on F10).<\/p>\n<p>The really cool part of the script is that I can also check if Atomic FE is running.  If it isn&#8217;t running, the script will run it.  If it IS running, and no other emulator is running, then the script will put the system to sleep.  Pretty amazing stuff, and one of the many reasons AutoHotKey is so awesome.<\/p>\n<p>In the end, the software all flows like the following state diagram:<\/p>\n<div class=\"separator\" style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"http:\/\/www.lukerymarz.com\/files\/arcadecabinet\/cab.jpg\"><span style=\"font-family: inherit;\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.lukerymarz.com\/files\/arcadecabinet\/cab.jpg\" border=\"0\" alt=\"\" width=\"320\" height=\"287\" \/><\/span><\/a><\/div>\n<h2>Finishing Touches<\/h2>\n<p>So things can be run, things can be exited, and <em>things can be played.<\/em> But I ran into a couple errors here and there and added some hotkeys to my main script to handle them.<\/p>\n<p>I added to my main AutoHotKey script the ability to trigger the KeyWiz command to write the arcade controller configuration.  Once in a while KeyWiz fails to write the &#8220;B&#8221; configuration, and I&#8217;m left with an unconfigured arcade controller.  It just so happens that the first three buttons of my controller are Alt+Ctrl+Space in this default mode.  So I added a hotkey to my script that manually runs KeyWiz and uploads the &#8220;B&#8221; configuration when Ctrl+Alt+Space is pressed.  The &#8220;B&#8221; configuration doesn&#8217;t use these keys, so it can only be run when the controller is in its default mode.<\/p>\n<p>Additionally, I added two hotkeys that send Alt+Tab and Alt+Tab+Tab for any cases where Atomic FE starts up, but doesn&#8217;t have focus.  This happened a lot while I was configuring it, but doesn&#8217;t seem to any more.  I think it was because I had other things running while I was testing.  If only Atomic FE is running, it always seems to get focus.<\/p>\n<p>And that&#8217;s it!  I&#8217;m sure I missed something, so feel free to comment here if you have questions (best for everyone), or email me at lukerymarz-at-gmail.com.<\/p>\n<p>If you&#8217;re interested, you can grab all the AutoHotKey scripts and batch files I used <a href=\"http:\/\/www.lukerymarz.com\/files\/arcadecabinet\/cabscripts.zip\">here<\/a> (50 KB).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently built a cocktail arcade cabinet from scratch. \u00a0I talked about fabrication previously, and I&#8217;d like to outline the software I&#8217;ve got on it for those who are interested. \u00a0It wasn&#8217;t an dead-simple setup since emulators all have different interfaces, but I ended up with a setup that&#8217;s relatively streamlined. Goals It&#8217;s important to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[],"class_list":["post-36","post","type-post","status-publish","format-standard","hentry","category-gaming","category-video-games"],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/lukerymarz.com\/ratingpending\/wp-json\/wp\/v2\/posts\/36","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/lukerymarz.com\/ratingpending\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/lukerymarz.com\/ratingpending\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/lukerymarz.com\/ratingpending\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/lukerymarz.com\/ratingpending\/wp-json\/wp\/v2\/comments?post=36"}],"version-history":[{"count":13,"href":"http:\/\/lukerymarz.com\/ratingpending\/wp-json\/wp\/v2\/posts\/36\/revisions"}],"predecessor-version":[{"id":83,"href":"http:\/\/lukerymarz.com\/ratingpending\/wp-json\/wp\/v2\/posts\/36\/revisions\/83"}],"wp:attachment":[{"href":"http:\/\/lukerymarz.com\/ratingpending\/wp-json\/wp\/v2\/media?parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/lukerymarz.com\/ratingpending\/wp-json\/wp\/v2\/categories?post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/lukerymarz.com\/ratingpending\/wp-json\/wp\/v2\/tags?post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}