Script for execution of FreeDesktop.org shortcuts

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

Moderator: battlecat

Script for execution of FreeDesktop.org shortcuts

Postby Zombie » Wed Feb 09, 2011 7:32 am

This script is absolutely essential in the execution of DOS, Wine, and Linux games on a given Mame Cabinet,

Code: Select all
#!/bin/bash -
# workdir=$(cat "$1" | awk -F'=' '/^Path=/ {print $2}')
# workdir=$(sed -n 's,^Path[^/]*,,p' < "$1")
# runapp=$(cat "$1" | awk -F'=' '/^Exec=/ {print $3}')
# runapp=$(sed -n 's,^Exec[^/]*,,p' < "$1")
# pushd $workdir
# $runapp

unset runapp workdir
while read -r line
do case $line in Exec*) runapp=${line#*=};; Path*) workdir=${line#*=};; esac

done < "$1"
# runapp=$(sed -n '/^Exec/s,^[^=]*=,,p' $1);
# workdir=$(sed -n '/^Path/s,^[^=]*=,,p' $1);
cd "$workdir";
$runapp;
User avatar
Zombie
 
Posts: 791
Joined: Mon Oct 06, 2008 2:52 pm

Re: Script for execution of FreeDesktop.org shortcuts

Postby sairuk » Wed Feb 09, 2011 11:43 am

Nice, i'll have to give it a go at some point.
mameau - My random bits | Wah!Ki - A Wah!Cade wiki | Mah!Cade - Experimental Wah!cade Branch | ListGen | Lazarus
User avatar
sairuk
 
Posts: 432
Joined: Sat May 22, 2010 12:37 am

Re: Script for execution of FreeDesktop.org shortcuts

Postby codefenix » Wed Feb 09, 2011 3:56 pm

I can attest that it is most assuredly not "absolutely essential" for DOS games, as I have been playing DOS games directly through DOSBox on my cabinet without any such script.

Care to go into detail on its usage? Then let the group come to a consensus on its essentiality.
User avatar
codefenix
 
Posts: 219
Joined: Fri Sep 25, 2009 3:45 pm
Location: USA

Re: Script for execution of FreeDesktop.org shortcuts

Postby Zombie » Wed Feb 09, 2011 7:04 pm

I've covered this topic in the past but here goes. Whenever a Linux Application, or a Wine app installs, they create a FreeDesktop.org style shortcut that looks like this under Wine:

Code: Select all
[Desktop Entry]
Comment=
Comment[en_US]=
Encoding=UTF-8
Exec=wine /opt/var/public/Windows/Games/DDX/OpenBOR/OpenBOR.exe
GenericName=Open Beats of Rage
GenericName[en_US]=Open Beats of Rage
Icon=wine
MimeType=
Name=Open Beats of Rage
Name[en_US]=Open Beats of Rage
Path=/opt/var/public/Windows/Games/DDX/OpenBOR/
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DCOP-ServiceType=
X-KDE-SubstituteUID=false
X-KDE-Username=


And like this under normal Linux apps.
Code: Select all
[Desktop Entry]
Name=Kobo Deluxe
Comment=Arcade video game
Exec=/usr/games/kobodl
Icon=skobo
Terminal=false
Type=Application
Categories=Game;ArcadeGame;X-MandrivaLinux-MoreApplications-Games-Arcade;


The basic idea is that unlike with Linux, DOS and Wine games, every single program has its own parameters, format execution, and current working directory. Console Roms do not do this. So, this becomes necessary. Also there is the fact that package managers such as yast, urpmi, yum, and aptitude can download and populate your directory *for you* (the only problem is that I have to rename them because WahCade does not parse the Name field.

This save shitloads of time and trouble. Because you don't have to hand script each one. Drop the shortcut in the rom directory, and there you are.

The main rationale is that kioclient, gnome-open, and xdg-open would allow WahCade to resume and take over in the foreground.
User avatar
Zombie
 
Posts: 791
Joined: Mon Oct 06, 2008 2:52 pm

Re: Script for execution of FreeDesktop.org shortcuts

Postby codefenix » Wed Feb 09, 2011 7:29 pm

Ok. After seeing those examples, that makes sense for Windows and Linux. I'm still wondering about the claim that it is essential for DOS. All that is necessary for DOS games is to directly execute dosbox with the specified executable file or batch file that changes to the current working directory and calls the executable file. The FreeDesktop.org links to which you're referring don't seem to apply here.
User avatar
codefenix
 
Posts: 219
Joined: Fri Sep 25, 2009 3:45 pm
Location: USA

Re: Script for execution of FreeDesktop.org shortcuts

Postby Zombie » Wed Feb 09, 2011 9:36 pm

Give me an example of a DOS Batch file you use.
User avatar
Zombie
 
Posts: 791
Joined: Mon Oct 06, 2008 2:52 pm

Re: Script for execution of FreeDesktop.org shortcuts

Postby codefenix » Wed Feb 09, 2011 9:49 pm

Sure, see the DOSBox configuration guide I wrote on Wah!Ki for an example of a typical BAT file.
User avatar
codefenix
 
Posts: 219
Joined: Fri Sep 25, 2009 3:45 pm
Location: USA

Re: Script for execution of FreeDesktop.org shortcuts

Postby Zombie » Thu Feb 10, 2011 10:46 am

After careful consideration, I have determined both methods to be equal and valid.
User avatar
Zombie
 
Posts: 791
Joined: Mon Oct 06, 2008 2:52 pm

Re: Script for execution of FreeDesktop.org shortcuts

Postby codefenix » Thu Feb 10, 2011 1:45 pm

Again, please let the group come to a consensus on this. You still haven't demonstrated an example that shows how your method applies to DOS games. If it supports per-game configuration and key reassignment, then we can consider it equal.
User avatar
codefenix
 
Posts: 219
Joined: Fri Sep 25, 2009 3:45 pm
Location: USA

Re: Script for execution of FreeDesktop.org shortcuts

Postby Zombie » Thu Feb 10, 2011 2:32 pm

It can, its just that per-game configuration is not something that *I* considered. A key difference being, that it would actually be the FreeDesktop.org's shortcut responsibility to specify a custom configuration. The shortcuts don't have a parameter like [name] and I am not sure yet if you can pass a freedesktop.org shortcut a parameter. I could alter the script so that $2 (second parameter) specifies such a thing.
User avatar
Zombie
 
Posts: 791
Joined: Mon Oct 06, 2008 2:52 pm

Re: Script for execution of FreeDesktop.org shortcuts

Postby codefenix » Thu Feb 10, 2011 3:44 pm

Zombie wrote:it would actually be the FreeDesktop.org's shortcut responsibility to specify a custom configuration


There's the rub. Because the commandline format in the dosbox.ini file of my method dynamically calls the appropriate DOSBox conf file, there's less hard-coding necessary.

And even if you specify a second parameter, BAT files use significantly less lines of code than a FreeDesktop.org shortcut. I don't know about you, but I like doing less work to achieve the same result.

Both of our methods share a common premise -- that there is not a DOS game solution that doesn't involve the need for a file that calls another file, whether it's a script or a BAT. As long as you're creating one for each game, you may as well utilize the one that uses less code. So BATs are the clear winner here.

Please don't take any of this the wrong way. I'm not knocking the time and effort you put into this. In fact, what you have come up with seems perfectly viable for Windows and Linux games. Now if you can just find a way to make it support key redefinition, then I think you nailed it.
User avatar
codefenix
 
Posts: 219
Joined: Fri Sep 25, 2009 3:45 pm
Location: USA

Re: Script for execution of FreeDesktop.org shortcuts

Postby Zombie » Thu Feb 10, 2011 11:14 pm

I'll work on that.
User avatar
Zombie
 
Posts: 791
Joined: Mon Oct 06, 2008 2:52 pm


Return to Wah!Cade

Who is online

Users browsing this forum: No registered users and 3 guests

cron