PND That Auto-Launches an emulator with a specific game...


MooTheKow

Member
Joined
Oct 8, 2008
Messages
182
So - I have a 2.5 year old daughter that loves my Pandora and has a couple favorite emulator games (Mario Kart for SNES, Sonic and MIckey's Timeless Adventure for the Genesis). She is actually pretty good at navigating/launching things from minimenu and can actually find/start games she wants if it just goes into the games - but she obviously has no chance in getting to what she wants by navigating inside the actual emulators (hard to select from a list of roms when you can't particularly read yet :)).


My question is - is there any reasonably easy way to create a .PND or something that will just automatically start an emulator (in picodrive or Snes9X4p) and load up a specific game?


Thanks in advance for any advice/help.
 
Last edited by a moderator:
I think Snes9X4p should not be to hard, there is a script that is run on start, and ./picklelauncher is in there, someone can chime in and tell you what ./picklelauncher outputs when you select a game, then just replace the line with what ./picklelauncher would normally output.


Once you find that out, I believe you can create the file in snes9x4p's appdata folder and it will override the original.
 
Last edited by a moderator:
I'm not sure how well you are into linux-commandline stuff, but I modified several emulator-pnds (and their scripts) to be able to pass a romname to the emulator. However it depends on the emulator and it's start-script if you can achieve something like this. My way of doing something like that (and maybe there are easier ways) would be to


- mount the emulator-pnd manually in a terminal and test if the binary-file of the emulator takes a romname as command-line-parameter


- if it does, then copy the startscript to some other place and modify it in order to pass a file-name to the emulator-binary


The above two steps only need to be done once for every emulator


- create a desktop-file, with a suiting icon, which runs the modified start-script with a rom-name as parameter. This desktop-file can be either placed into the start-menu or directly on the desktop.


If you think that this would be a suiting way of doing this, then let me know, together with your favorite emulator for snes and genesis (I'm not sure how many are out there and which is the best). Then i can test if the emulator works that way, write a detailed howto as an example which you can try to use. I can even pre-modify the needed bash-scripts for copy/paste-usage.
 
Last edited by a moderator:
That is totaly awsome your nipper loves playing on your pandora. I am amazed she has never abliterated the screen by hyperextending it.
 
Lomaxx-


Thanks for the recommendation. I've been using Picodrive and Snes9X4p. That sounds like a reasonable way of doing it - though you mentioned putting the file on the desktop or the desktop menu. I've been using minimenu as my primary interface. Will minimenu pick up the file?


Phelsumania -


It is pretty fantastic. Her favorite is 'sonic the hedgefood' (or 'sonic the hedgefrog'). Conversation about the title goes like this:


Me: "Ellie - say 'hedge'


Ellie: 'hedge'.


Me: 'Ellie - say 'hog'"


Ellie: 'hog'"


Me: 'Ellie - say 'hedgehog'"


Ellie: "Hedgefood" (or "hedgefrog" depending on the day).


She is surprisingly good with it. I only generally let her play it nearish bedtime when she's just chilling and laying down in my bed next to me so she's not running around with it. I showed her Sonic Generations on my xbox360 - so now she always wants me to play that on the tv while she plays on the Pandora. It's pretty funny. Started her off playing some random games on my wife's tablet (a cheapy Viewsonic gTablet) - so she learned to be careful with electronics on that.
 
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:





Code:
cd ~



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:





Code:
mount



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:





Code:
pnd_run.sh



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





Code:
ls





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:





Code:
sudo su



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.
 
Last edited by a moderator:
Wow... very detailed how-to -- thanks!. I'll let you know how it goes after I get some time (hopefully!) later tonight to try things out.
 
yes I was just thinking you could make a pnd that doesnt contain anything but a run script (one that launches a game using the commnds that you found per emulator) :) that would be a quick and dirty method that would be detected when you add / remove the sd cards.


the only requirements I guess would be that you had the emulator PNDs on the same card or at least available on the nand or one of the sd cards.
 
That is one awesome how-to - many thanks, as I was hoping for something like this, too.


We totally need a thread for how-tos like this (these being distinct from the tweaks available in the Support section).
grin.gif
 
Last edited by a moderator:
quick someone post a plain old example PXML :p I cant access the pandorawiki from work.

i mean the latest version of course not an "old" PXML spec version
 
Lomaxx-


She is surprisingly good with it. I only generally let her play it nearish bedtime when she's just chilling and laying down in my bed next to me so she's not running around with it. I showed her Sonic Generations on my xbox360 - so now she always wants me to play that on the tv while she plays on the Pandora. It's pretty funny. Started her off playing some random games on my wife's tablet (a cheapy Viewsonic gTablet) - so she learned to be careful with electronics on that.

That's great, try to limit her access to high end hardware somewhat, it's probably the best way to coax someone into self learning technical skills, I think it is probably the most popular way people get into computers, "My computer was too slow years ago, so I tried everything to squeeze 1% more performance from it". At the very least if she tries to make the device better with hacks, she will have mountains of knowledge about the system from tweaking (and breaking) it.


This? (Stolen from a thread on here)



Code:
<?xml version="1.0" encoding="UTF-8"?>

<PXML xmlns="http://openpandora.org/namespaces/PXML">

  <package id="syobonaction">

	<version major="1" minor="0" release="1" build="2"/>

	<author name="DannyBoyJaros" website="http://www.openpandora.org"/>

	<titles>

  	<title lang="en_US">Syobon Action</title>

	</titles>

	<descriptions>

  	<description lang="en_US">Challenging version of Mario in which you play as a cat and there are crazy traps all around you.</description>

	</descriptions>

	<icon src="icon.png"/>

  </package>


  <application id="syobonaction">

	<exec command="run.sh" x11="req"/>

	<version major="1" minor="0" release="1" build="2"/>

	<author name="DannyBoyJaros" website="http://www.openpandora.org"/>

	<titles>

  	<title lang="en_US">Syobon Action</title>

	</titles>

	<title lang="en_US">Syobon Action</title> <!--Extra block for compatibility with OS versions before HF6-->

	<descriptions>

  	<description lang="en_US">Challenging version of Mario in which you play as a cat and there are crazy traps all around you.</description>

	</descriptions>

	<description lang="en_US">Challenging version of Mario in which you play as a cat and there are crazy traps all around you.</description> <!--Extra block for compatibility with OS versions before HF6-->

	<icon src="icon.png"/>

	<licenses>

  	<license name="I Do What I Want" url="http://www.google.com" sourcecodeurl="http://www.google.com"/>

	</licenses>

	<previewpics>

  	<pic src="icon.png"/>

	</previewpics>

	<info name="Syobon-Readme" type="text/html" src="readme.txt"/>

	<categories>

  	<category name="Game">

    	<subcategory name="Arcade"/>

  	</category>

	</categories>

  </application>

</PXML>
 
Last edited by a moderator:
For PCSX reARMed you can just do a launcher script with something like:



Code:
/usr/pandora/scripts/pnd_run.sh -p /media/mmcblk1p2/pandora/desktop/pcsx_rearmed_r11.pnd -e pcsx.sh -a '-cdfile /media/mmcblk1p2/pandora/psx/crash2/EBOOT.PBP'

then place it on desktop or somewhere, or even add a launcher on the panel or something.


PicoDrive should allow this too, you just don't need '-cdfile' part.


EDIT: whoops missed the minimenu part, maybe skeezix could add gmenu2x-style command line launchers for this..
 
Last edited by a moderator:
ok Here is just an example of what you could do with a pnd


first of all create your basic all purpose run bash script


please correct any errors as I have not tested this!!!!



Code:
#!/bin/bash


#lets just call this script run.sh for example purposes


EMULATOR=$1;

GAME=$2;



IF [ "$EMULATOR" == "snes" ]; then


    choice[1]="/media/trans8/multimedia-data/snes/SuperMarioWorldEurope.zip"

    choice[2]="/media/trans8/multimedia-data/snes/SomeOtherGame.zip"

    choice[3]="/media/trans8/multimedia-data/snes/SomeOtherOtherGame.zip"


    pnd_run.sh -p /media/trans8/pandora/menu/snes9x4p_20111010.pnd  -e "snes.sh" -a "${choice["$GAME"]}" -s . -b snes9x.skeezix.alpha

    exit


FI



#this one is just made up but of course it would follow the same rules as above

IF [ "$EMULATOR" == "megadrive" ]; then


    choice[1]="/media/trans8/multimedia-data/sega-genesis/SonicTheHedgeHogJUE.zip"

    choice[2]="/media/trans8/multimedia-data/sega-genesis/SomeOtherMegaDriveGame.zip"

    choice[3]="/media/trans8/multimedia-data/sega-genesis/SomeOtherOtherMegaDriveGame.zip"


    pnd_run.sh -p /media/trans8/pandora/menu/PicoDrive_180_beta1.pnd -e "PicoDrive.run" -a "${choice["$GAME"]}" -s . -b picodrive

    exit

FI

stick that inside your PND!

then the PXML for the PND could look like this:



Code:
<?xml version="1.0" encoding="UTF-8"?>

<PXML xmlns="http://openpandora.org/namespaces/PXML">

  <package id="emulator.game.lanchers">

        <version major="1" minor="0" release="1" build="2" release="alpha"/>

        <author name="milkshake" website="http://repo.openpandora.org"/>

        <titles>

        <title lang="en_US">Emulator Game Launcher</title>

        </titles>

        <descriptions>

        <description lang="en_US">places individual emulated game launchers into the desktop/menu/minimenu</description>

        </descriptions>

        <icon src="icon.png"/>

  </package>


  <application id="supermarioworld">

        <exec command="run.sh snes 1" x11="req"/>

        <version major="1" minor="0" release="1" build="2" release="alpha"/>

        <author name="milkshake" website="http://repo.openpandora.org"/>

        <titles>

        <title lang="en_US">Super Mario World</title>

        </titles>

        <title lang="en_US">Super Mario World</title> <!--Extra block for compatibility with OS versions before HF6-->

        <descriptions>

        <description lang="en_US">Super Mario World for the super nintendo/famicom no description really needed.</description>

        </descriptions>

        <description lang="en_US">Super Mario World for the super nintendo/famicom no description really needed.</description> <!--Extra block for compatibility with OS versions before HF6-->

        <icon src="icon.png"/>

        <previewpics>

            <pic src="icon.png"/>

        </previewpics>

        <categories>

        <category name="Game">

        <subcategory name="Arcade"/>

        </category>

        </categories>

  </application>

  <application id="someothergame">

        <exec command="run.sh snes 2" x11="req"/>

        <version major="1" minor="0" release="1" build="2" release="alpha"/>

        <author name="milkshake" website="http://repo.openpandora.org"/>

        <titles>

        <title lang="en_US">Some Other Game</title>

        </titles>

        <title lang="en_US">Some Other Game</title> <!--Extra block for compatibility with OS versions before HF6-->

        <descriptions>

        <description lang="en_US">Some Other Game for the super nintendo/famicom.</description>

        </descriptions>

        <description lang="en_US">Some Other Game for the super nintendo/famicom.</description> <!--Extra block for compatibility with OS versions before HF6-->

        <icon src="icon.png"/>

        <previewpics>

            <pic src="icon.png"/>

        </previewpics>

        <categories>

        <category name="Game">

        <subcategory name="Arcade"/>

        </category>

        </categories>

  </application>

</PXML>

append the PXML and the ICON and you should be good to go.


baring in mind if you did it this way all the launchers would have the same icon, so you could always do a seperate PND for each game.
 
Last edited by a moderator:
Hmm, I don't know if making PND's for each emulator + rom would be a good design thing.


As I understand it, the Minumenu parses the PND's and makes .desktop files out of them, yes?. Wouldn't it be better to just have a program that generates additional .desktop files out of, say, a directory of roms? Or roms with a configuration file to tell how to run the game? Or a program that just makes .desktop files once, and adds those to the minimenu? It would take a bit of scripting, and doesn't currently fit in with the design, but may be a more elegant solution in the long run.
 
it would need to be something that can happen on insert of SD card though so I only plausable way I can think of (appart from accosiating rom files with PND's) is to use PNDs and specify the roms you want as apps, that way they are added and removed just like any normal PND.
 
pnd_run.sh support PND as directory, so you dont have to create an actuall pnd file ;)


just create a directory in your prefered location (be it menu, desktop or apps), drop your PXML there with requiered launchs scripts and you're good to go.


Also the PND system support up to 50 apps per PND, so you can create up to 50 launchers with your PMXL file ;)
 
has anyone tested that little launch bash script? have I made any errors with it?


ok so what sebt is saying is that you dont have to create a PND just create a folder (in the correct location) add the PXML like my example, add the launcher script like my example and you should be good to go without messing around trying to package up a PND.
 
@sebt3: Thanks for the hint. The currently remaining question for me is: Will such a directory (as pnd-replacement) also be recognized in mini-menu and by pndnotifyd, which fills the start-menu? As mini-menu is what Moo wants to use.


@milkshake: I didn't test your script yet. I only installed picodrive and ran it to see what the mountpoint/appdata-folder is named. It's actually just "picodrive" not "pico.notez.alpha" as you used in your script. Also there is no "pico.sh". By default "PicoDrive.run" is launched and i have yet to test if it takes a rom-image as parameter.


Edit: Just read that the picodrive-section it just an example. Yet I'm note sure if it's helpful to create a separate script, instead of just calling "pnd_run.sh" with the related parameters in the PXML-file for every entry.
 
Last edited by a moderator:
@sebt3: Thanks for the hint. The currently remaining question for me is: Will such a directory (as pnd-replacement) also be recognized in mini-menu and by pndnotifyd, which fills the start-menu? As mini-menu is what Moo wants to use.
minimenu depend on libpnd for pnd discovery (like pndnotifyd) and libpnd seems to have code for PND directory discovery (just verified) so it should just works ;)
 
@sebt3: Excellent. I will try tomorrow.


Last thing for today -> a working example-commandline for picodrive:



Code:
pnd_run.sh -p /media/trans8/pandora/menu/PicoDrive_180_beta1.pnd -e "PicoDrive.run" -a "/media/trans8/multimedia-data/sega-genesis/SonicTheHedgeHogJUE.zip" -s . -b picodrive
 
Back
Top