Mednafen configuration for Logitech Precision

October 29, 2008 by
Filed under: Linux, Ubuntu 

As I’ve already stated partially, I got an HTPC at home running MythTV on ubuntu. One of the things I’ve wanted to do for a long time was to get some games running on it. Supertuxkart was simple and was installed in less than 3-4 minutes once I understood the basics of the MythGames plugin (typing with a on-screen keyboard and a remote control is slow).

Anyways, I did have some problems getting a NES emulator, or any emulator at all as a matter of fact, running on it, and I also had some problems getting input from the right devices to them properly. I finally decided on mednafen as it seemed the easiest to understand.

Let’s understand the structure. NES and other games are usually downloaded in some image file. Mednafen is installed as a binary. MythGames needs to know about the binary used to launch a NES image, and where the NES images are located. I downloaded mednafen using apt-get install mednafen. Secondly, MythGames needs to know where you will put the images, personally I put them in /var/games/nes/. This is entered into the mythtv configuration using the Setup -> Game Settings -> Game Players. Choose New Game Player and enter

Player name: mednafen (for example)
Type: Other
command: mednafen -nes.stretch 1 -fs 1 -vdriver 0 %s
Rom Path: /var/games/nes

Having a keyboard around when doing this is prefered, using the on-screen keyboard takes ages.

Once this is done, go to Setup -> Game Settings -> Scan for games. This will scan the /var/games/nes directory for all images and add them to the list. To start a game, go to Games. Then get into the “All Games” -> “mednafen” and you should find all the games from /var/games/nes there.

Click one, and the game should hopefully start. The first time mednafen is run, it creates a directory ~/.mednafen/ containing a basic configuration. The following is an example to get my Logitech Precision gamepad running with it:

nes.input.port1.gamepad.a joystick 42190af389429475 00000002
nes.input.port1.gamepad.rapid_a joystick 42190af389429475 00000003
nes.input.port1.gamepad.b joystick 42190af389429475 00000000
nes.input.port1.gamepad.rapid_b joystick 42190af389429475 00000001
nes.input.port1.gamepad.select joystick 42190af389429475 00000008
nes.input.port1.gamepad.start joystick 42190af389429475 00000009
nes.input.port1.gamepad.up joystick 42190af389429475 0000c001
nes.input.port1.gamepad.down joystick 42190af389429475 00008001
nes.input.port1.gamepad.left joystick 42190af389429475 0000c000
nes.input.port1.gamepad.right joystick 42190af389429475 00008000

nes.input.port2.gamepad.a joystick 42190af389429476 00000002
nes.input.port2.gamepad.rapid_a joystick 42190af389429476 00000003
nes.input.port2.gamepad.b joystick 42190af389429476 00000000
nes.input.port2.gamepad.rapid_b joystick 42190af389429476 00000001
nes.input.port2.gamepad.select joystick 42190af389429476 00000008
nes.input.port2.gamepad.start joystick 42190af389429476 00000009
nes.input.port2.gamepad.up joystick 42190af389429476 0000c001
nes.input.port2.gamepad.down joystick 42190af389429476 00008001
nes.input.port2.gamepad.left joystick 42190af389429476 0000c000
nes.input.port2.gamepad.right joystick 42190af389429476 00008000

command.exit joystick 42190af389429475 00000006&joystick 42190af389429475 00000007
command.exit joystick 42190af389429476 00000006&joystick 42190af389429476 00000007

Unfortunately, the above changes around a bit from device to device and atm i’m not even sure the i’d will survive from disconnect/connect of the gamepads.

The proper way of doing this is to:

1. Start a game.
2. Press Alt+Shift+1
3. Push the correct buttons asked for on screen to do specified command. (First time you push a button adds it to the command, second time you push the same button marks it “final” for the command sequence. Peculiar, I know. So, to make the game use button 2 and 3 in conjunction to be button A, you’d first press button 2 once, then button 3 twice.
4. hit esc on the keyboard to leave mednafen. The config should now be saved.

I haven’t found a way to create the “command.exit” commands yet. I’ll have to work some more on that.

Comments

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

You must be logged in to post a comment.