How to build a pixel-perfect arcade gaming machine for free using GNU/Linux

I’ve just finished a very small project to build an arcade gaming system. You remember arcade games? Pac Man? Missile Command? Super Off-Road? Street Fighter II? The ones that you usually played at.. err.. arcades. I only mention all this because most people I talk to just get big question marks in their eyes when I talk about “arcade games”, but once I mention a few titles and the fact that they’re usually played in smoke-filled, darkened rooms next to billiards and darts, the memory returns. Arcades have been all but dead in this country for at least eight years now.

Check out this mobile phone picture of the perfect pixels we’re enjoying:

2010-01-07 12.07.26

Prerequisites

But back to topic. You’re going to need:

  1. An old PC, which can often be found for free from companies dumping them into their recycling system. The speed you need depends on the age and complexity of the games you want to play. For anything released before 1998, anything up to 1.4 GHz should do just fine. You don’t need a dual-core processor or anything.
  2. An old PC multisync monitor. I mean a real, large, heavy CRT screen. These can often be picked up for free as well. The more resolutions it supports, the better. If you don’t need your arcade experience to be pixel-perfect, a flatscreen might do as well, but I wouldn’t recommend it because of the crazy modelines we are going to use. A flatscreen might just not support them.
  3. An old graphics card that supports many modes. I tried it with an Nvidia GeForce 6200 and it worked just fine. The configuration below is for Nvidia as well. I wouldn’t recommend onboard graphics cards by Intel, because those were usually very picky about the modes they support.
  4. A GNU/Linux system. I recommend Ubuntu since it’s easy to install and because the other software we will need is easily available for it.
  5. SDLMAME, the arcade emulator we’re going to use. There are Ubuntu packages that are easy to install.

Initial setup

Install Ubuntu on your shabby old PC.

Install the very latest version of SDLMAME from the SDLMAME download page. Downloading the package should automatically prompt you to install the software using the Gdebi graphical Debian package installer. Do so.

In order to stop SDLMAME from freezing on exit, install the following package by typing this in a terminal (thanks Silas (Son of Silas)):

sudo apt-get install libsdl1.2debian-pulseaudio

Copy your arcade game ROM files to some suitable ROMs directory. You might want to have them in /home/youruser/mame/roms for example.

Next, we’re going to set that ROM path in the global SDLMAME configuration file. We won’t bother with per-user configuration in this example. If you’re advanced enough to need/want per-user configuration, you probably know how to set that up already. Open your configuration file by typing the following in a terminal and hitting enter:

gksudo gedit /etc/sdlmame/mame.ini

Find the line that starts with “rompath” (usually line no. 9) and change it to the following:

rompath                   $HOME/mame/roms;$HOME/.mame/roms;/usr/local/share/games/sdlmame/roms

Hit Ctrl-S or choose “File -> Save” to save. While you have this file open, you can also start on the customizations described in the next section.

Configuration file customization

Our setup sounds very normal and banal so far, but the devil is in the details. What we need to do to get pixel-perfect arcade gaming from this ordinary rig is customize the X.org configuration and set a few SDLMAME options that would otherwise get in our way.

While you still have your mame.ini file open, find the “VIDEO OPTIONS” and the “FULL SCREEN OPTIONS” sections and change them to this:

#
# VIDEO OPTIONS
#
video                     soft
numscreens                1
window                    0
keepaspect                0
unevenstretch             0
effect                    none
centerh                   1
centerv                   1
waitvsync                 1

#
# FULL SCREEN OPTIONS
#
switchres                 1
useallheads               0

This will prevent SDLMAME from applying image stretching and scaling to your games. We won’t need any of that stretching because we’ll be running them in pixel-perfect shape exactly as they were intended to be run!

Open a terminal and type “sdlmame” and hit enter to see if anything happens at all at this point. If you’ve copied ROMs to your ROM directory, you should see them available for selection in SDLMAME’s menu now.

Next, we are going to add all sorts of modelines to your X.org configuration file. These lines determine what frequencies and resolutions your monitor will be run at. The given frequencies should all be safe to use on a good multisync monitor, but I take absolutely no responsibility should you break anything running these modes. That’s why I recommend getting a free or cheap monitor somewhere from an office sale or off an auction site.

Type the following in a terminal:

gksudo gedit /etc/X11/xorg.conf

Scroll to the very bottom of the file and copy/paste the following lines into it:

Section "Monitor"
    Identifier "MyMonitor" 

# 240x528x60.00 34.680 kHz
Modeline "480x528x60.00" 20.808000 480 496 568 600 528 531 535 578 -HSync +VSync

# 256x552x60.00 36.240 kHz
Modeline "512x552x60.00" 23.193600 512 528 608 640 552 555 559 604 -HSync +VSync

# 320x570x60.00 37.380 kHz
Modeline "320x570x60.00" 14.952000 320 328 384 400 570 573 577 623 -HSync +VSync

# 240x384x60.00 50.400 kHz
Modeline "240x384x120.00" 15.321600 240 248 288 304 384 386 390 420 -HSync +VSync

# 256x384x60.00 50.400 kHz
Modeline "256x384x120.00" 16.128000 256 264 304 320 384 386 390 420 -HSync +VSync

# 160x400x60.00 52.560 kHz
Modeline "320x400x120.00" 21.024000 320 328 384 400 400 403 407 438 -HSync +VSync

# 320x408x60.00 53.520 kHz
Modeline "320x408x120.00" 21.408000 320 328 384 400 408 410 414 446 -HSync +VSync

# 256x416x60.00 54.600 kHz
Modeline "256x416x120.00" 17.472000 256 264 304 320 416 418 422 455 -HSync +VSync

# 288x416x60.00 54.600 kHz
Modeline "288x416x120.00" 19.656000 288 296 344 360 416 418 422 455 -HSync +VSync

# 280x420x60.00 55.080 kHz
Modeline "280x420x120.00" 19.388160 280 288 336 352 420 422 426 459 -HSync +VSync

# 240x432x60.00 56.760 kHz
Modeline "240x432x120.00" 17.255040 240 248 288 304 432 435 439 473 -HSync +VSync

# 256x432x60.00 56.760 kHz
Modeline "256x432x120.00" 18.163200 256 264 304 320 432 435 439 473 -HSync +VSync

# 272x432x60.00 56.760 kHz
Modeline "272x432x120.00" 19.525440 272 280 328 344 432 435 439 473 -HSync +VSync

# 288x432x60.00 56.760 kHz
Modeline "288x432x120.00" 20.433600 288 296 344 360 432 435 439 473 -HSync +VSync

# 256x444x60.00 58.320 kHz
Modeline "256x444x120.00" 18.662400 256 264 304 320 444 447 451 486 -HSync +VSync

# 319x446x60.00 58.560 kHz
Modeline "320x446x120.00" 23.424000 320 328 384 400 446 449 453 488 -HSync +VSync

# 224x448x60.00 58.800 kHz
Modeline "224x448x120.00" 16.464000 224 232 264 280 448 450 454 490 -HSync +VSync

# 240x448x60.00 58.800 kHz
Modeline "240x448x120.00" 17.875200 240 248 288 304 448 450 454 490 -HSync +VSync

# 248x448x60.00 58.800 kHz
Modeline "248x448x120.00" 18.345600 248 256 296 312 448 450 454 490 -HSync +VSync

# 256x448x60.00 58.800 kHz
Modeline "256x448x120.00" 18.816000 256 264 304 320 448 450 454 490 -HSync +VSync

# 272x448x60.00 58.800 kHz
Modeline "272x448x120.00" 20.227200 272 280 328 344 448 450 454 490 -HSync +VSync

# 288x448x60.00 58.800 kHz
Modeline "288x448x120.00" 21.168000 288 296 344 360 448 450 454 490 -HSync +VSync

# 296x448x60.00 58.800 kHz
Modeline "296x448x120.00" 21.638400 296 304 352 368 448 450 454 490 -HSync +VSync

# 304x448x60.00 58.800 kHz
Modeline "304x448x120.00" 22.579200 304 312 368 384 448 450 454 490 -HSync +VSync

# 312x448x60.00 58.800 kHz
Modeline "312x448x120.00" 23.049600 312 320 376 392 448 450 454 490 -HSync +VSync

# 320x448x60.00 58.800 kHz
Modeline "320x448x120.00" 23.520000 320 328 384 400 448 450 454 490 -HSync +VSync

# 360x448x60.00 58.800 kHz
Modeline "360x448x120.00" 26.342400 360 368 424 448 448 450 454 490 -HSync +VSync

# 368x448x60.00 58.800 kHz
Modeline "368x448x120.00" 27.283200 368 384 440 464 448 450 454 490 -HSync +VSync

# 380x448x60.00 58.800 kHz
Modeline "384x448x120.00" 28.224000 384 392 456 480 448 450 454 490 -HSync +VSync

# 416x448x60.00 58.800 kHz
Modeline "416x448x120.00" 30.576000 416 424 496 520 448 450 454 490 -HSync +VSync

# 432x448x60.00 58.800 kHz
Modeline "432x448x120.00" 31.987200 432 448 512 544 448 450 454 490 -HSync +VSync

# 448x448x60.00 58.800 kHz
Modeline "448x448x120.00" 32.928000 448 456 528 560 448 450 454 490 -HSync +VSync

# 464x448x60.00 58.800 kHz
Modeline "464x448x120.00" 34.339200 464 480 552 584 448 450 454 490 -HSync +VSync

# 480x448x60.00 58.800 kHz
Modeline "480x448x120.00" 35.280000 480 496 568 600 448 450 454 490 -HSync +VSync

# 512x448x60.00 58.800 kHz
Modeline "512x448x120.00" 37.632000 512 528 608 640 448 450 454 490 -HSync +VSync

# 336x450x60.00 59.040 kHz
Modeline "336x450x120.00" 25.032960 336 352 400 424 450 452 456 492 -HSync +VSync

# 256x460x60.00 60.360 kHz
Modeline "256x460x120.00" 19.315200 256 264 304 320 460 462 466 503 -HSync +VSync

# 336x460x60.00 60.360 kHz
Modeline "336x460x120.00" 25.592640 336 352 400 424 460 462 466 503 -HSync +VSync

# 256x462x60.00 60.600 kHz
Modeline "256x462x120.00" 19.392000 256 264 304 320 462 464 468 505 -HSync +VSync

# 208x464x60.00 60.960 kHz
Modeline "208x464x120.00" 16.093440 208 216 256 264 464 467 471 508 -HSync +VSync

# 240x464x60.00 60.960 kHz
Modeline "240x464x120.00" 18.531840 240 248 288 304 464 467 471 508 -HSync +VSync

# 255x464x60.00 60.960 kHz
Modeline "256x464x120.00" 19.507200 256 264 304 320 464 467 471 508 -HSync +VSync

# 272x464x60.00 60.960 kHz
Modeline "272x464x120.00" 20.970240 272 280 328 344 464 467 471 508 -HSync +VSync

# 280x464x60.00 60.960 kHz
Modeline "280x464x120.00" 21.457920 280 288 336 352 464 467 471 508 -HSync +VSync

# 304x464x60.00 60.960 kHz
Modeline "304x464x120.00" 23.408640 304 312 368 384 464 467 471 508 -HSync +VSync

# 320x464x60.00 60.960 kHz
Modeline "320x464x120.00" 24.384000 320 328 384 400 464 467 471 508 -HSync +VSync

# 352x464x60.00 60.960 kHz
Modeline "352x464x120.00" 26.822400 352 360 416 440 464 467 471 508 -HSync +VSync

# 368x464x60.00 60.960 kHz
Modeline "368x464x120.00" 28.285440 368 384 440 464 464 467 471 508 -HSync +VSync

# 496x464x60.00 60.960 kHz
Modeline "496x464x120.00" 38.039040 496 512 592 624 464 467 471 508 -HSync +VSync

# 512x464x60.00 60.960 kHz
Modeline "512x464x120.00" 39.014400 512 528 608 640 464 467 471 508 -HSync +VSync

# 336x472x60.00 61.920 kHz
Modeline "336x472x120.00" 26.254080 336 352 400 424 472 474 478 516 -HSync +VSync

# 512x472x60.00 61.920 kHz
Modeline "512x472x120.00" 39.628800 512 528 608 640 472 474 478 516 -HSync +VSync

# 336x478x60.00 31.380 kHz
Modeline "336x478x60.00" 13.305120 336 352 400 424 478 481 485 523 -HSync +VSync

# 224x480x60.00 31.500 kHz
Modeline "448x480x60.00" 17.640000 448 456 528 560 480 483 487 525 -HSync +VSync

# 240x480x60.00 31.500 kHz
Modeline "480x480x60.00" 18.900000 480 496 568 600 480 483 487 525 -HSync +VSync

# 248x480x60.00 31.500 kHz
Modeline "496x480x60.00" 19.656000 496 512 592 624 480 483 487 525 -HSync +VSync

# 256x480x60.00 31.500 kHz
Modeline "512x480x60.00" 20.160000 512 528 608 640 480 483 487 525 -HSync +VSync

# 260x480x60.00 31.500 kHz
Modeline "520x480x60.00" 20.412000 520 528 616 648 480 483 487 525 -HSync +VSync

# 280x480x60.00 31.500 kHz
Modeline "560x480x60.00" 22.176000 560 576 664 704 480 483 487 525 -HSync +VSync

# 284x480x60.00 31.500 kHz
Modeline "568x480x60.00" 22.428000 568 584 672 712 480 483 487 525 -HSync +VSync

# 292x480x60.00 31.500 kHz
Modeline "584x480x60.00" 22.932000 584 600 688 728 480 483 487 525 -HSync +VSync

# 296x480x60.00 31.500 kHz
Modeline "592x480x60.00" 23.436000 592 608 704 744 480 483 487 525 -HSync +VSync

# 304x480x60.00 31.500 kHz
Modeline "304x480x60.00" 12.096000 304 312 368 384 480 483 487 525 -HSync +VSync

# 318x480x60.00 31.500 kHz
Modeline "320x480x60.00" 12.600000 320 328 384 400 480 483 487 525 -HSync +VSync

# 336x480x60.00 31.500 kHz
Modeline "336x480x60.00" 13.356000 336 352 400 424 480 483 487 525 -HSync +VSync

# 352x480x60.00 31.500 kHz
Modeline "352x480x60.00" 13.860000 352 360 416 440 480 483 487 525 -HSync +VSync

# 360x480x60.00 31.500 kHz
Modeline "360x480x60.00" 14.112000 360 368 424 448 480 483 487 525 -HSync +VSync

# 366x480x60.00 31.500 kHz
Modeline "368x480x60.00" 14.616000 368 384 440 464 480 483 487 525 -HSync +VSync

# 374x480x60.00 31.500 kHz
Modeline "376x480x60.00" 14.868000 376 384 448 472 480 483 487 525 -HSync +VSync

# 384x480x60.00 31.500 kHz
Modeline "384x480x60.00" 15.120000 384 392 456 480 480 483 487 525 -HSync +VSync

# 394x480x60.00 31.500 kHz
Modeline "400x480x60.00" 15.876000 400 416 480 504 480 483 487 525 -HSync +VSync

# 640x480x60.00 31.500 kHz
Modeline "640x480x60.00" 25.200000 640 656 760 800 480 483 487 525 -HSync +VSync

# 672x480x60.00 31.500 kHz
Modeline "672x480x60.00" 26.460000 672 688 792 840 480 483 487 525 -HSync +VSync

# 240x496x60.00 32.580 kHz
Modeline "480x496x60.00" 19.548000 480 496 568 600 496 499 503 543 -HSync +VSync

# 304x496x60.00 32.580 kHz
Modeline "304x496x60.00" 12.510720 304 312 368 384 496 499 503 543 -HSync +VSync

# 400x496x60.00 32.580 kHz
Modeline "400x496x60.00" 16.420320 400 416 480 504 496 499 503 543 -HSync +VSync

# 400x508x60.00 33.360 kHz
Modeline "400x508x60.00" 16.813440 400 416 480 504 508 511 515 556 -HSync +VSync

# 384x510x60.00 33.480 kHz
Modeline "384x510x60.00" 16.070400 384 392 456 480 510 513 517 558 -HSync +VSync

# 400x510x60.00 33.480 kHz
Modeline "400x510x60.00" 16.873920 400 416 480 504 510 513 517 558 -HSync +VSync

# 240x512x60.00 33.600 kHz
Modeline "480x512x60.00" 20.160000 480 496 568 600 512 515 519 560 -HSync +VSync

# 248x512x60.00 33.600 kHz
Modeline "496x512x60.00" 20.966400 496 512 592 624 512 515 519 560 -HSync +VSync

# 256x512x60.00 33.600 kHz
Modeline "512x512x60.00" 21.504000 512 528 608 640 512 515 519 560 -HSync +VSync

# 272x512x60.00 33.600 kHz
Modeline "544x512x60.00" 22.848000 544 560 640 680 512 515 519 560 -HSync +VSync

# 304x512x60.00 33.600 kHz
Modeline "304x512x60.00" 12.902400 304 312 368 384 512 515 519 560 -HSync +VSync

# 320x512x60.00 33.600 kHz
Modeline "320x512x60.00" 13.440000 320 328 384 400 512 515 519 560 -HSync +VSync

# 336x512x60.00 33.600 kHz
Modeline "336x512x60.00" 14.246400 336 352 400 424 512 515 519 560 -HSync +VSync

# 352x512x60.00 33.600 kHz
Modeline "352x512x60.00" 14.784000 352 360 416 440 512 515 519 560 -HSync +VSync

# 384x512x60.00 33.600 kHz
Modeline "384x512x60.00" 16.128000 384 392 456 480 512 515 519 560 -HSync +VSync

# 396x512x60.00 33.600 kHz
Modeline "400x512x60.00" 16.934400 400 416 480 504 512 515 519 560 -HSync +VSync

# 410x512x60.00 33.600 kHz
Modeline "416x512x60.00" 17.472000 416 424 496 520 512 515 519 560 -HSync +VSync

# 272x544x60.00 35.700 kHz
Modeline "272x544x60.00" 12.280800 272 280 328 344 544 547 551 595 -HSync +VSync

# 384x560x60.00 36.780 kHz
Modeline "384x560x60.00" 17.654400 384 392 456 480 560 564 568 613 -HSync +VSync

# 256x576x60.00 37.800 kHz
Modeline "256x576x60.00" 12.096000 256 264 304 320 576 579 583 630 -HSync +VSync

# 512x576x60.00 37.800 kHz
Modeline "512x576x60.00" 24.192000 512 528 608 640 576 579 583 630 -HSync +VSync

# 384x384x60.00 50.400 kHz
Modeline "384x384x120.00" 24.192000 384 392 456 480 384 386 390 420 -HSync +VSync

# 488x384x60.00 50.400 kHz
Modeline "488x384x120.00" 30.643200 488 496 576 608 384 386 390 420 -HSync +VSync

# 496x384x60.00 50.400 kHz
Modeline "496x384x120.00" 31.449600 496 512 592 624 384 386 390 420 -HSync +VSync

# 500x384x60.00 50.400 kHz
Modeline "504x384x120.00" 31.852800 504 520 600 632 384 386 390 420 -HSync +VSync

# 508x384x60.00 50.400 kHz
Modeline "512x384x120.00" 32.256000 512 528 608 640 384 386 390 420 -HSync +VSync

# 512x400x60.00 52.560 kHz
Modeline "512x400x120.00" 33.638400 512 528 608 640 400 403 407 438 -HSync +VSync

# 576x400x60.00 52.560 kHz
Modeline "576x400x120.00" 37.843200 576 592 680 720 400 403 407 438 -HSync +VSync

# 512x432x60.00 56.760 kHz
Modeline "512x432x120.00" 36.326400 512 528 608 640 432 435 439 473 -HSync +VSync

# 576x432x60.00 56.760 kHz
Modeline "576x432x120.00" 40.867200 576 592 680 720 432 435 439 473 -HSync +VSync

# 480x464x60.00 60.960 kHz
Modeline "480x464x120.00" 36.576000 480 496 568 600 464 467 471 508 -HSync +VSync

# 512x496x60.00 32.580 kHz
Modeline "512x496x60.00" 20.851200 512 528 608 640 496 499 503 543 -HSync +VSync

# 1024x512x60.00 33.600 kHz
Modeline "1024x512x60.00" 43.008000 1024 1048 1208 1280 512 515 519 560 -HSync +VSync

# 240x446x60.00 58.560 kHz
Modeline "432x446x120.00" 31.856640 432 448 512 544 446 449 453 488 -HSync +VSync

# 224x464x60.00 60.960 kHz
Modeline "400x464x120.00" 30.723840 400 416 480 504 464 467 471 508 -HSync +VSync

# 192x480x60.00 31.500 kHz
Modeline "344x480x60.00" 13.608000 344 352 408 432 480 483 487 525 -HSync +VSync

# 232x480x60.00 31.500 kHz
Modeline "416x480x60.00" 16.380000 416 424 496 520 480 483 487 525 -HSync +VSync

# 240x480x60.00 31.500 kHz
Modeline "432x480x60.00" 17.136000 432 448 512 544 480 483 487 525 -HSync +VSync

# 248x480x60.00 31.500 kHz
Modeline "440x480x60.00" 17.388000 440 456 520 552 480 483 487 525 -HSync +VSync

# 256x480x60.00 31.500 kHz
Modeline "456x480x60.00" 17.892000 456 464 536 568 480 483 487 525 -HSync +VSync

# 208x496x60.00 32.580 kHz
Modeline "368x496x60.00" 15.117120 368 384 440 464 496 499 503 543 -HSync +VSync

# 240x496x60.00 32.580 kHz
Modeline "432x496x60.00" 17.723520 432 448 512 544 496 499 503 543 -HSync +VSync

# 192x512x60.00 33.600 kHz
Modeline "344x512x60.00" 14.515200 344 352 408 432 512 515 519 560 -HSync +VSync

# 200x512x60.00 33.600 kHz
Modeline "360x512x60.00" 15.052800 360 368 424 448 512 515 519 560 -HSync +VSync

# 208x512x60.00 33.600 kHz
Modeline "368x512x60.00" 15.590400 368 384 440 464 512 515 519 560 -HSync +VSync

# 240x512x60.00 33.600 kHz
Modeline "432x512x60.00" 18.278400 432 448 512 544 512 515 519 560 -HSync +VSync

# 248x512x60.00 33.600 kHz
Modeline "440x512x60.00" 18.547200 440 456 520 552 512 515 519 560 -HSync +VSync

# 256x512x60.00 33.600 kHz
Modeline "456x512x60.00" 19.084800 456 464 536 568 512 515 519 560 -HSync +VSync

# 224x528x60.00 34.680 kHz
Modeline "400x528x60.00" 17.478720 400 416 480 504 528 531 535 578 -HSync +VSync

# 232x528x60.00 34.680 kHz
Modeline "416x528x60.00" 18.033600 416 424 496 520 528 531 535 578 -HSync +VSync

# 240x528x60.00 34.680 kHz
Modeline "432x528x60.00" 18.865920 432 448 512 544 528 531 535 578 -HSync +VSync

# 200x544x60.00 35.700 kHz
Modeline "360x544x60.00" 15.993600 360 368 424 448 544 547 551 595 -HSync +VSync

# 224x544x60.00 35.700 kHz
Modeline "400x544x60.00" 17.992800 400 416 480 504 544 547 551 595 -HSync +VSync

# 236x544x60.00 35.700 kHz
Modeline "424x544x60.00" 18.849600 424 432 504 528 544 547 551 595 -HSync +VSync

# 224x560x60.00 36.780 kHz
Modeline "400x560x60.00" 18.537120 400 416 480 504 560 564 568 613 -HSync +VSync

# 240x560x60.00 36.780 kHz
Modeline "432x560x60.00" 20.008320 432 448 512 544 560 564 568 613 -HSync +VSync

# 240x568x60.00 37.260 kHz
Modeline "432x568x60.00" 20.269440 432 448 512 544 568 571 575 621 -HSync +VSync

# 216x576x60.00 37.800 kHz
Modeline "384x576x60.00" 18.144000 384 392 456 480 576 579 583 630 -HSync +VSync

# 224x576x60.00 37.800 kHz
Modeline "400x576x60.00" 19.051200 400 416 480 504 576 579 583 630 -HSync +VSync

# 231x584x60.00 38.340 kHz
Modeline "416x584x60.00" 19.936800 416 424 496 520 584 588 592 639 -HSync +VSync

# 240x584x60.00 38.340 kHz
Modeline "432x584x60.00" 20.856960 432 448 512 544 584 588 592 639 -HSync +VSync

# 224x608x60.00 39.900 kHz
Modeline "400x608x60.00" 20.109600 400 416 480 504 608 611 615 665 -HSync +VSync

# 240x608x60.00 39.900 kHz
Modeline "432x608x60.00" 21.705600 432 448 512 544 608 611 615 665 -HSync +VSync

# 256x608x60.00 39.900 kHz
Modeline "456x608x60.00" 22.663200 456 464 536 568 608 611 615 665 -HSync +VSync

# 204x640x60.00 42.000 kHz
Modeline "368x640x60.00" 19.488000 368 384 440 464 640 644 648 700 -HSync +VSync

# 224x640x60.00 42.000 kHz
Modeline "400x640x60.00" 21.168000 400 416 480 504 640 644 648 700 -HSync +VSync

# 232x640x60.00 42.000 kHz
Modeline "416x640x60.00" 21.840000 416 424 496 520 640 644 648 700 -HSync +VSync

# 240x640x60.00 42.000 kHz
Modeline "432x640x60.00" 22.848000 432 448 512 544 640 644 648 700 -HSync +VSync

# 256x640x60.00 42.000 kHz
Modeline "456x640x60.00" 23.856000 456 464 536 568 640 644 648 700 -HSync +VSync

# 240x672x60.00 44.100 kHz
Modeline "432x672x60.00" 23.990400 432 448 512 544 672 676 680 735 -HSync +VSync

# 240x688x60.00 45.180 kHz
Modeline "432x688x60.00" 24.577920 432 448 512 544 688 692 696 753 -HSync +VSync

# 240x700x60.00 45.960 kHz
Modeline "432x700x60.00" 25.002240 432 448 512 544 700 704 708 766 -HSync +VSync

# 240x704x60.00 46.200 kHz
Modeline "432x704x60.00" 25.132800 432 448 512 544 704 708 712 770 -HSync +VSync

# 256x704x60.00 46.200 kHz
Modeline "456x704x60.00" 26.241600 456 464 536 568 704 708 712 770 -HSync +VSync

# 224x720x60.00 47.280 kHz
Modeline "400x720x60.00" 23.829120 400 416 480 504 720 725 729 788 -HSync +VSync

# 240x720x60.00 47.280 kHz
Modeline "432x720x60.00" 25.720320 432 448 512 544 720 725 729 788 -HSync +VSync

# 245x720x60.00 47.280 kHz
Modeline "440x720x60.00" 26.098560 440 456 520 552 720 725 729 788 -HSync +VSync

# 224x752x60.00 49.380 kHz
Modeline "400x752x60.00" 24.887520 400 416 480 504 752 757 761 823 -HSync +VSync

# 240x752x60.00 49.380 kHz
Modeline "432x752x60.00" 26.862720 432 448 512 544 752 757 761 823 -HSync +VSync

# 248x752x60.00 49.380 kHz
Modeline "440x752x60.00" 27.257760 440 456 520 552 752 757 761 823 -HSync +VSync

# 224x384x60.00 50.400 kHz
Modeline "400x384x120.00" 25.401600 400 416 480 504 384 386 390 420 -HSync +VSync

# 240x384x60.00 50.400 kHz
Modeline "432x384x120.00" 27.417600 432 448 512 544 384 386 390 420 -HSync +VSync

# 256x384x60.00 50.400 kHz
Modeline "456x384x120.00" 28.627200 456 464 536 568 384 386 390 420 -HSync +VSync

# 240x400x60.00 52.560 kHz
Modeline "432x400x120.00" 28.592640 432 448 512 544 400 403 407 438 -HSync +VSync

# 240x416x60.00 54.600 kHz
Modeline "432x416x120.00" 29.702400 432 448 512 544 416 418 422 455 -HSync +VSync

# 320x432x60.00 56.760 kHz
Modeline "568x432x120.00" 40.413120 568 584 672 712 432 435 439 473 -HSync +VSync

# 224x448x60.00 58.800 kHz
Modeline "400x448x120.00" 29.635200 400 416 480 504 448 450 454 490 -HSync +VSync

# 480x480x60.00 31.500 kHz
Modeline "856x480x60.00" 33.768000 856 880 1016 1072 480 483 487 525 -HSync +VSync

# 384x496x60.00 32.580 kHz
Modeline "688x496x60.00" 28.149120 688 712 816 864 496 499 503 543 -HSync +VSync

# 384x512x60.00 33.600 kHz
Modeline "688x512x60.00" 29.030400 688 712 816 864 512 515 519 560 -HSync +VSync

# 480x512x60.00 33.600 kHz
Modeline "856x512x60.00" 36.019200 856 880 1016 1072 512 515 519 560 -HSync +VSync

# 768x720x60.00 47.280 kHz
Modeline "1368x720x60.00" 80.943360 1368 1408 1616 1712 720 725 729 788 -HSync +VSync

Modeline "256x448x115.20" 18.063361 256 264 304 320  224 226 228 245  -HSync +VSync doublescan

Modeline "384x448x120.00" 28.224000 384 392 448 480  448 452 456 490 -HSync +VSync


EndSection

These modelines are based on the excellent ones available at EasyMameCab. I’ve just added some lines for specific games that are missing there.

At the top of your xorg.conf, we will now need a Screen section in order to hook these modelines up with your graphics card. Try this here for example:


Section "Screen"
	Identifier	"Default Screen"
	DefaultDepth	24
        Device "Default Device"
        Monitor "MyMonitor"
        SubSection "Display"
           Depth  24
        EndSubSection
EndSection

Log out and back in or reboot your machine (or restart X with “sudo service gdm restart”) and that should do the trick. For reference, here is a copy of my own entire xorg.conf file after all these modifications.

After all that work, you can fire up sdlmame from a terminal and see how things are looking. If it switches resolutions on your monitor the first time you start some game, great! You will probably be running it at its very own native resolution on your cheap or free CRT screen! Things should look perfect to the very last pixel 🙂 Now you could think of adding an emulator frontend such as Wah!Cade to make managing your various emulators easier. This setup also lets you run Sega Mega Drive and Super Famicom/Super NES games at their native resolution through an emulator that supports it, so Wah!Cade is a good idea.

If anything doesn’t work, feel free to comment here and I will update the guide.

The only proper joysticks to use with this sort of setup come from Xgaming. I’ve been using their Tank Stick for about 10 years now with no issues except for some microswitch failure.

5 thoughts on “How to build a pixel-perfect arcade gaming machine for free using GNU/Linux”

    1. Oooh! I didn’t even notice you’re in there. How would you like your anonymization to take place? Pixels or black bars? 🙂

      Like

  1. Oh, that should work easily 🙂 The setup doesn’t even Nvidia’s proprietary drivers, it works with the Free Software ones. The only differences you’re likely to see come later, joystick devices are treated differently between the FBSD kernel and Linux for example.

    But the rest should all be portable. X.org and SDL are available on FBSD as well, and there’s even an sdlmame port, but I think it only has an older version. At any rate, FBSD is an official target for SDLMAME, so it should work even if you do have to compile from the source tarballs.

    If you end up doing that, let’s add a FBSD section to this post 🙂

    Like

  2. It’s an interesting thought.. I’ve got an old crap PC that might find itself repurposed as an arcade machine instead of a watchdog (though hey, it might be able to double as both arcade machine *and* IDS.. wonder if there’s room in the world for arcade-style interactive network attack battles..?).

    I’ll kick ya if I do ever get round to it.. 😉

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s