[mythtv-users] mythgame: exiting emulators

Jason Kraftcheck jkraftch at facstaff.wisc.edu
Thu Mar 16 19:30:34 UTC 2006


Most emulators are not lirc-aware, so I wrote the attached utility
program so that I could exit emulators using my remote.  The program
accepts the name of an emulator to run and a list of arguments for that
emulator.  It starts the emulator and waits for a LIRC event indicating
that it should terminate.  When it receives that event, it kills the
emulator and exits.

I recall seeing messages on this list in the past asking for a similar
functionality and don't recall seeing any solutions, so I'm posting my
solution.  Apologies for the wasted bandwidth if there's a known
solution for this that I'm not aware of.

To compile the utility, do:
   gcc -o gamelaunch gamelaunch.c -llirc_client
I'm assuming you have the header and library for lirc_client installed
in a typical place (/usr or /usr/local).  If not, you may need to
specify some -I and -L options.

Then add an entry similar to the following to your ~/.lircrc file:
   begin
     remote = hauppaugegrey
     button = Back/Exit
     prog = gamelaunch
     config = Exit
   end
The "prog" and "config" values must be exactly as shown.  The "remote"
and "button" values should be modified as appropriate for your
configuration.

To test the utility, try a simple command like the following and verify
that it terminates when the remote button is pressed:
   ./gamelaunch cat

To "install" the utility, just copy it to somewhere in your $PATH.  E.g.:
   su -c "cp gamelaunch /usr/local/bin/"

Finally, configure mythgame to use the utility when launching emulators
by specifying the utility first in the "command:" field for each
emulator.  For example, change:
   fceu-sdl -fs 1
to:
   gamelaunch fceu-sdl -fs 1



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gamelaunch.c
Url: http://mythtv.org/pipermail/mythtv-users/attachments/20060316/accb74bb/attachment.diff 


More information about the mythtv-users mailing list