Tutorial: Exit ANY emulator with one key

A nice (keyboard based) front end for Arcade / Console game emulators.

Moderator: battlecat

Tutorial: Exit ANY emulator with one key

Postby zagadka » Fri Feb 03, 2012 4:11 pm

Wah!Cade: Exit ANY emulator with any key you like!

Most emulators will exit with the escape key or can be configured that way. But there are a few with other exit key configurations which can't be changed.

With these scripts and two additional applications you can exit any emulator with one key. This will work with any input device - keyboard/joystick/mouse/ipac/arcaze etc.

How this works:

-> press your selected key

-> evrouter will notice the pressed key and should execute the wahcade-emu-exit-keys.sh script.

-> this script simulates a pressed key or a key combination (e.g. ESC Key or ALT_L+F4 etc.) to the X-Server (even in fullscreen) and the emulator will exit.

wahcade-emu-exit-keys.sh is actually a link to a script. This link will be created when you run a "starter"-script (from ~/.wahcade/scripts) which is needed for emulators who won't exit with "ESC". E.g. pcsx2 needs ALT_L+F4 to quit. When you leave the emulator a new link will be created to the wahcade-emu-exit-keys-standard.sh script (exit with ESC).


Here's the tutorial ...

- Download and extract: wahcade-exit-key.tar.gz


- scripts I

root@linux > mkdir -p ~/.wahcade/scripts

# copy files from exit-key-scripts.tar.gz to ~/.wahcade/scripts

root@linux > chmod 755 ~/.wahcade/scripts/*


- install

evrouter:

http://www.bedroomlan.org/projects/evrouter

xdotool:

root@linux > apt-get install xdotool # or

http://www.semicomplete.com/projects/xdotool/

http://www.semicomplete.com/projects/xd ... tool.xhtml


- evrouter configuration:

Select a key for exiting the emulators. Choose a key you usualy don't use with your emulators or wahcade. e.g. ` = key 13 on a german keyboard. I wouldn't use ESC for this.

root@linux > evrouter -d /dev/input/by-id/* # and press your selected key

Window "(null)": # Window title

# Window "(null)": # Resource name

# Window "(null)": # Class name

"HID 046a:0011" "/dev/input/by-id/usb-046a_0011-event-kbd" none key/13 "fill this in!"

# quit evrouter -d ... with CTRL+C


- create a configuration file (/etc/evrouter.conf) and paste the last line in. "fill this in" = "script/scriptpath and name"

# /etc/evrouter.conf

# Use your device instead of this "HID 046a:0011" "/dev/input/by-id/usb-046a_0011-event-kbd"

# "HID 046a:0011" "/dev/input/by-id/usb-046a_0011-event-kbd" none key/13 "fill this in!"

"HID 046a:0011" "/dev/input/by-id/usb-046a_0011-event-kbd" none key/13 "Shell//home/mame/.wahcade/scripts/wahcade-emu-exit-keys.sh"


- start evrouter

# Use your device instead of this /dev/input/by-id/usb-046a_0011-event-kbd

root@linux > evrouter -v -c /etc/evrouter.conf /dev/input/by-id/usb-046a_0011-event-kbd

- test (press your selected key)

"root@linux > `Executed shell command "/home/mame/.wahcade/scripts/wahcade-emu-exit-keys.sh", exit code 0"


- kill evrouter

root@linux > /usr/bin/evrouter --quit

root@linux > /bin/rm -r /tmp/.evrouter\:0 # or /tmp/.evrouter\:0.xyz


- automatic start with lxdm

edit /etc/lxdm/PreLogin and add

/usr/bin/evrouter --quit

/bin/rm -r /tmp/.evrouter\:0

/bin/chmod -R 755 /dev/input/

# Use your device instead of this /dev/input/by-id/usb-046a_0011-event-kbd

evrouter -v -c /etc/evrouter.conf /dev/input/by-id/usb-046a_0011-event-kbd


- xdotool syntax

examples:

# e.g .wahcade-emu-exit-keys-model2.sh

xdotool key "Alt_L+F4" # change key(s) here

# wahcade-emu-exit-keys-standard.sh

/usr/bin/xdotool key "Escape"

http://www.semicomplete.com/projects/xd ... tool.xhtml


- Wah!Cade

root@linux > which wahcade

wahcade: /usr/local/bin/wahcade

root@linux > joe pathto/wahcade # edit or create

# /usr/local/bin/wahcade

#!/bin/bash

scriptpath="/home/mame/.wahcade/scripts"

# for a clean start

/bin/ln -sf $scriptpath/wahcade-emu-exit-keys-standard.sh $scriptpath/wahcade-emu-exit-keys.sh

cd /usr/local/share/wahcade

python wahcade.py $*


- scripts II

# emunamehere = name of the emulator

root@linux > cd ~/.wahcade/scripts

root@linux > cp wahcade-emu-starter.sh.example wahcade-emunamehere-starter.sh

root@linux > cp wahcade-emu-exit-keys-emu.sh.example wahcade-emunamehere-exit-keys-emu.sh

edit wahcade-emunamehere-starter.sh

edit wahcade-emunamehere-exit-keys-emu.sh


-Wah!Cade setup

Examples:

wahcade-setup

-> Emulators

Title: Playstation 2

Application: ~/.wahcade/scripts/wahcade-pcsx2-starter.sh

Command Line: "[rompath]/[name].[romext]"

or

Title: Sega Model 2

Application: ~/.wahcade/scripts/wahcade-model2-starter.sh

Command Line: [name]


- todo: include $2, install-script
Last edited by zagadka on Sat Feb 04, 2012 5:05 pm, edited 4 times in total.
User avatar
zagadka
 
Posts: 6
Joined: Tue Jan 24, 2012 8:41 pm

Re: Tutorial: Exit ANY emulator with one key

Postby codefenix » Fri Feb 03, 2012 5:33 pm

Aces. 8)

I'll give it a try sometime.
User avatar
codefenix
 
Posts: 219
Joined: Fri Sep 25, 2009 3:45 pm
Location: USA


Return to Wah!Cade

Who is online

Users browsing this forum: No registered users and 3 guests

cron