I'm not fully pleased. First: The HowTo got longer than i wanted it to get. Second: As i discovered in the end, ".desktop"-files do not work with minimenu. Read the end for more details on this. Anyway - maybe you or someone else find this helpful. So let's start an example of how I tested the emulator and created a launcher-mechanism:
The first thing I want to do is to mount the pnd of the emulator in order to access the pnd-directory from a terminal. If the emulator runs in a window (e.g. not in fullscreen-mode), then you can simply start the emulator from the entry in the start-menu, leave it running, open a terminal and proceed.
Unfortunately some emulators (like snes9x) directly go into a fullscreen-mode, which doesn't let you open a terminal afterwards. If your Pandora is access-able through a local network (by wLan or usb-ethernet), you can work around this problem by making a ssh-connection from a connected PC instead of running a terminal on the Pandora. Without a local network you can still manually mount the pnd, which is what I will describe next.
Open a terminal as normal user. The script which let you manually mount a pnd is called "pnd_run.sh" (not to be mixed up with "pnd_run" without ".sh"), which is a different command). Enter "pnd_run.sh" and you will get a short description of the parameters this command takes.
"pnd_run.sh" by default uses the pnd-filename as mountpoint and for the appdata-folder. This might differ from the actual appdata-folder, that is used when you run the pnd from the start-menu. Because this would create a different, unneeded appdata-folder, I prefer to find out what the pnd-filename and existing appdata-directoryname is. With the use of either the terimnal or the filemanager (Thunar) I browse through the directories "/media/trans8/pandora/menu/" and "/media/trans8/pandora/appdata", which are the related directories on my Pandora. These differ for your system. In this example I search these directories for anything related to "snes9x" and after a while stumble upon a file named "snes9x4p_20111010.pnd" in the menu-folder and a directory named "snes9x.skeezix.alpha" in the appdata-folder.
With this information I now can use "pnd_run.sh" in the terminal we opened before to mount the pnd with the correct appdata-folder.
Code:
pnd_run.sh -p /media/trans8/pandora/menu/snes9x4p_20111010.pnd -b snes9x.skeezix.alpha -m
If that worked (see output of pnd_run.sh), then I'm able to change into the now mounted pnd-directory and take a look at it's content:
Code:
cd /mnt/utmp/snes9x.skeezix.alpha/
ls
At this point I would start to analyze which is the emulator-binary that needs to run and take a look at any start-script (".sh") with my favorite text-editor to see if something needs to be set before the emulator is run. In this example (snes9x) normally (when you start the pnd from startmenu) "run.sh" would be launched, which brings up the pickle-launcher-menu, which then passes on a pathname+filename to "snes.sh" which in the end launches the specified game.
So for snes9x things are easy. All I need to do is to run "snes.sh" followed by a pathname+filename of a snes-game-image. I strongly recommend to remove any spaces and special-characters from the directory- and filenames of the rom-image-file. There are ways to make it work without removing them, but they are more complicated. Let's keep it more simple and rename them. For example:
"/media/trans8/multimedia-data/snes/Super Mario World (USA).zip"
into
"/media/trans8/multimedia-data/snes/SuperMarioWorldUSA.zip"
Now I tried to run
Code:
./snes.sh /media/trans8/multimedia-data/snes/SuperMarioWorldUSA.zip
The "./" at the beginning of the line is needed. The emulator started directly into the game. Back to the terminal (left-shoulder-button+q to quit snes9x).
The next thing I want to try is to automate the process. I want "pnd_run.sh" to mount the pnd and directly execute the above mentioned command-line that runs the game. For testing that i first need to unmount the pnd and in order to do that in a clean way, I must not access the mountpoint-directory in any way (no access to the directory in a terminal or any running application which is located in the mount-directory). So after the emulator has quit, i jump out of the pnd-directory to somewhere else like my home-directory:
The following line should then unmount the pnd:
Code:
pnd_run.sh -p /media/trans8/pandora/menu/snes9x4p_20111010.pnd -b snes9x.skeezix.alpha -u
You can use the "mount"-command to verify that all mount-points and loop-devices have been removed. The commands output should not list anything containing "snes9x.skeezix" in one of the names. Example:
Output after a clean unmount:
Code:
rootfs on / type rootfs (rw)
/dev/root on / type ext2 (rw,noatime,errors=continue)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
none on /dev type tmpfs (rw,mode=755)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
usbfs on /proc/bus/usb type usbfs (rw)
tmpfs on /var/volatile type tmpfs (rw)
tmpfs on /dev/shm type tmpfs (rw,mode=777)
tmpfs on /media/ram type tmpfs (rw)
gvfs-fuse-daemon on /home/lomaxx/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user_id=1000,group_id=1001)
/dev/mmcblk1p1 on /media/trans8 type ext2 (rw,dirsync,noatime,errors=continue)
Onward with the testing. Take a look at the short description of "pnd_run.sh" again by entering the command without any argument:
You will see a parameter named "-e" which let's you specify a command to be run after the pnd was mounted. Also you can pass parameters to that command by the use of "-a". So let's construct the proper command-line. It's maybe a bit long, but not that complicated. Take your time to understand what it does:
Code:
pnd_run.sh -p /media/trans8/pandora/menu/snes9x4p_20111010.pnd -e "snes.sh" -a "/media/trans8/multimedia-data/snes/SuperMarioWorldEurope.zip" -s . -b snes9x.skeezix.alpha
If you enter a similar command-line (modified with parameters for your pnd and rom-image) and everything went well, the pnd should be mounted, the emulator run with the game starting directly, and after quitting the emulator, the pnd-should be unmounted once again.
Now we have the final command-line that we can use in several ways. I will continue by describing, how to setup a desktop-file. These files are for example used for creating an icon on the desktop or also used by the automatic process which fills the start-menu with entries of the pnds. This should also work for items in the mini-menu. The location of the desktop-files is in "/usr/share/applications". So we head there to take a look at such a file. In a terminal type:
Code:
cd /usr/share/applications
followed by
Depending on how many pnds you have got installed, you will see more or less of the mentioned files with ".desktop" at the end of their name. Let's take a look at one of them. I chose "op_bluetooth.desktop" because it's a short one. Either use your favorite text-editor to open "/usr/share/applications/op_bluetooth.desktop" or type
Code:
cat op_bluetooth.desktop | less
You will see the content of that file:
Code:
[Desktop Entry]
Name=Toggle Bluetooth Status
Comment=Toggle the status of your Bluetooth device.
StartupNotify=false
Exec=/usr/pandora/scripts/op_bluetooth.sh
Icon=bluetooth
Terminal=false
Type=Application
Categories=System;
Press "q" if you want to return to the terminal-input.
We will copy the file and modify it with a text-editor. For that we need to become root. Type the following and enter your user-password to proceed:
Now - while still being in the /usr/share/applications-directory - you can type the command to copy the file:
Code:
cp op_bluetooth.desktop launcher4SMarioWorld.desktop
Of course you can use a different, more suiting name than "launcher4SMarioWorld" for a different game.
Open the new file in your favorite text-editor and modify the entrys in a similar way like below. "Name" and "Comment" are pretty much up to your choice. For the "Exec="-entry we use the command-line for "pnd_run.sh" that we built before. As icon you can use a small png of your choice, a svg-files (scaleable vector graphic) worky too. You should even be able to ceate a directory in your home-folder, download small png-images of the game-characters and use these as icon. However the desktop-file-mechanism might be a little bit picky about the size of the image. Try around there. There are many icon already on the pandora. For example in "/usr/share/icons" or "/usr/share/pixmaps". It might be a bit of struggle to find a suiting one. Maybe the easiest way of browsing through the icons is to use the filemanager of xfce ("File System") on the desktop and go to one of the above mentioned directories. Once you found a suiting icon, then memorize the path and enter the pathname+filename as "Icon="-paramater in the desktop-file.
"Categeries=" will most likely always be set to "Game;" followed by one of the following subcategories:
ActionGame
AdventureGame
ArcadeGame
BoardGame
BlocksGame
CardGame
KidsGame
LogicGame
RolePlaying
Simulation
SportsGame
StrategyGame
After all this - here is of how my test-file looked after modifying it:
Code:
[Desktop Entry]
Name=SuperMarioWorld Launcher
Comment=Launch Super Mario World in Snes9x
StartupNotify=false
Exec=pnd_run.sh -p /media/trans8/pandora/menu/snes9x4p_20111010.pnd -e "snes.sh" -a "/media/trans8/multimedia-data/snes/SuperMarioWorldEurope.zip" -s . -b snes9x.skeezix.alpha
Icon=/usr/share/icons/gnome/scalable/emotes/face-devilish.svg
Terminal=false
Type=Application
Categories=Game;ArcadeGame
Try to find the entry in your start-menu in the given Category. For me this worked on the first go. I hope it will do for you too. One side-note: The desktop-file will not be removed if you eject the SD-card with the emulator or the rom-image on it. Normally this is done by a background-process that monitors SD-cards. But since our desktop-file is not connected to a PND, but was created manually, it will stay until it is removed manually.
If you prefer to have the launcher on your desktop, then you can also copy or move the desktop-file to the Desktop-directory in your home-directory (for me this is "/home/lomaxx/Desktop"):
Code:
mv launcher4SMarioWorld.desktop /home/lomaxx/Desktop/
I also tried to find out if a similar solution is possible in mini-menu, but so far it seems to me like you really have to build a PND in order to make it work there. The advantage of this would be that the menu entries would be removed automatically when the sd-card is being removed. Also you could pack an icon, a screenshot and the rom itself into the PND. But since this is a task of it's own, I will stop the already long description here for now ... and maybe write another one later. Or even someone comes up with a script to semi-automate the process of creating such a PND.