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


Yeah. maybe it is. I still am thinking about the whole thing. By now it came to my mind, that your solution would enable the user to e.g. change a pnd-name of an emulator in an easier way, if that should be necessary.
 
Last edited by a moderator:
well make sure when you crack it you show us how you did it in the end :)

wisdom_of_the_ancients.png
 
Last edited by a moderator:
I'm currently working on this. Most things work already, but I am still struggling with smaller issues like with the PXML as a whole or getting different icons for each game. But it really works to just put a directory in a pnd-search-path. The only strange thing is - and i will try to work this out as well - why the games are sorted in alphabetical order when i build a PND, but instead appear at the beginning of the mini-menu-category when i use a plain directory.


We'll see ....


For now i can already post a (heavily) modified version of milkshakes' run.sh-script, which seems to work nicely. Yours was good too, milkshake. I just tried to make things a bit simpler.



Code:
#!/bin/bash


# Configuration for the emulator-specific paramters that are passed to "pnd_run.sh"


SNES_EMU_CFG="-p /media/trans8/pandora/menu/snes9x4p_20111010.pnd -e snes.sh -b snes9x.skeezix.alpha"

GENESIS_EMU_CFG="-p /media/trans8/pandora/menu/PicoDrive_180_beta1.pnd -e PicoDrive.run -b picodrive"



# Specify the emulator and game-file here. Must beginn with a emulator-definition followed by a ":"

# and the filename without any further ":", or spaces or special characters like "(", ")" , "[", "]"

# Rename the filename if necessary to remove such characters


ROM[01]="SNES:/media/trans8/multimedia-data/snes/SuperMarioWorldEurope.zip"

ROM[02]="GENESIS:/media/trans8/multimedia-data/sega-genesis/SonicTheHedgeHogJUE.zip"



GAME=$1;

EMULATOR=${ROM[$GAME]%:*}

FULL_ROM_PATH=${ROM[$GAME]_02#*:}


if ! [[ -f "$FULL_ROM_PATH" ]]; then

  echo "The file specified in ROM[$GAME] does not exist. Please check the configuration in \"run.sh\"."

  exit 1

fi


case $EMULATOR in

  SNES) pnd_run.sh $SNES_EMU_CFG -s . -a "$FULL_ROM_PATH"

  ;;

  GENESIS) pnd_run.sh $GENESIS_EMU_CFG  -s . -a "$FULL_ROM_PATH"

  ;;

  *) echo "Unknown emulator specified. Please check configuration of ROM[$GAME] in \"run.sh\"."

  exit 1

  ;;

esac
 
Last edited by a moderator:
Gnah, posted too early. The entries show up in minimenu, but they do not start. For the curious, this is the related extract from the errorlog:



Code:
=======================================================================================

PND     		: /media/trans8/pandora/desktop/pnddir/PXML.xml

PND_FSTYPE  	: XML

APPDATADIR  	: /media/trans8/pandora/appdata/supermarioworld

APPDD_FSTYPE	: ext2

PND_CPUSPEED	: <unset>

EXENAME 		: run.sh

ARGUMENTS   	: 01

=======================================================================================

[ START ]--- Mount the PND ----------

ERROR Unknown filesystem type : XML

ERROR: The Union File-system is not mounted !

+++++++



Also I am having a strange issue with minimenu in general. It creates lots of loop-devices and mounts for games that i didn't start. I assume for those that i rest the cursor on for a while and for which then a screenshot is shown if possible. So with mini-menu running, i get the following "mount"-output from an ssh-connection:





Code:
mount

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)

/dev/loop0 on /mnt/utmp/cdevtools type squashfs (ro)

none on /mnt/utmp/cdevtools type aufs (rw,si=671af137)

/dev/loop1 on /mnt/utmp/xboard type squashfs (ro)

none on /mnt/utmp/xboard type aufs (rw,si=671af537)

/dev/loop2 on /mnt/utmp/worminator3 type squashfs (ro)

none on /mnt/utmp/worminator3 type aufs (rw,si=671af237)

/dev/loop3 on /mnt/utmp/alex type squashfs (ro)

none on /mnt/utmp/alex type aufs (rw,si=671af337)

/dev/loop4 on /mnt/utmp/handy type squashfs (ro)

none on /mnt/utmp/handy type aufs (rw,si=671af637)

/dev/loop5 on /mnt/utmp/barrage type squashfs (ro)

none on /mnt/utmp/barrage type aufs (rw,si=671af437)

/dev/loop6 on /mnt/utmp/vektar type squashfs (ro)

none on /mnt/utmp/vektar type aufs (rw,si=671af037)


Is this normal behaviour? IMHO this is pretty unclean.
 
Last edited by a moderator:
Seems like the behaviour is not normal. As far as i can tell the above mount-problem only occurs when there is one of this pnd-replacement-directories in a pnd-search-path. At least it currently does not occur after i removed my testing-directory. Didn't do detailed testing though.


Anyway, since i ran into several problems as mentioned above, I decided to keep things simple for now and build a pnd that just launches one, single, existing rom-file with an available emulator. Right now everything works smooth there, also in minimenu. I will write a Howto tomorrow so we at least have a solution for MooTheKow and the little, female FooTheKalf (femal Moo -> foo).
 
How to create a PND, that launches an emulator with a specific game starting:


In this thread I described how to set up a command-line that starts an emulator from a pnd and directly launches a game-image. Now we will use such a line to build a PND that does the same and that shows an icon of your own choice along with a screenshot in mini-menu. We will


- create the needed directories


- copy over and create/modify the needed files


- set up the validation-process for baking the pnd


This will be done in a terminal and involves a little more usage of the keyboard. With a little patience you can do all this with the Pandora-keyboard, but it's a bit more comfortable to do this either from a PC (ssh-connection or synergy-setup) or a USB-keyboard connected to the Pandora. As often, the first time is the more complex one. Once you managed to bake one pnd you can do another one much faster by copying the whole working-directory and do quick modifications. So don't be discouraged if you think this is a quite some work. Now let's start.


First we need a working-directory somewhere on an SD-card with at least little free space. I'll create one in the base-directory of that card which is "/media/trans8/" on my system. Your card should be accessible through a similar directory in "/media/" as well. You can use the command "ls /media/" to search for it.


Open the spoiler for a side-note about bash-completion:

Another way to search for it is to use what is called tab-completion. I'll take the time to explain what this is, as it's very handy. Tab-completion is a function where directory- and file-names (also commands) are automatically completed in the command-line when you press TAB. You just need to typed the beginning of the commands/names.


Try typing "mp" and press TAB (hold "Fn" and press "Space"). If you did it right, then "mp" will be completed into "mplayer" as that is the only known command that starts with "ml". If there are multiple completion possible, then the completion will only be done up to the part that all commands have in common and stop there. If you now press TAB two times more, then you will see a list of commands that remain as possible choice. An example: Delete "mplayer" from the command-line again, type "gno", press TAB, completion will be done to "gnome" and stop. Now press TAB two more times (you can hold "Fn" and press "Space" twice for this). You will see a list of all commands that start with "gnome".


As already mentioned, this also works for directories and file-names. So in order to search for the path to your SD-card you could type "ls /med" and press TAB (which will complete "/med" into "/media/"). Now press TAB two times more and you will get a list of all directories in "/media/". Among them the directory for your SD-card should be mentioned. If you labeled your card when formatting it, then that label-name should be shown. Otherwise it will have some automatically generated directory-name.


Once you know the path to your SD-card, then "cd" into that directory. I use:



Code:
cd /media/trans8



Now create the working-directory and enter that directory:





Code:
mkdir rom-launcher

cd rom-launcher



Create an empty file named "makepnd.sh" and set the executable flag so we can run it later:





Code:
touch makepnd.sh

chmod +x makepnd.sh



We will use this empty "makepnd.sh" to build a two-line-script that builds the pnd for us later. To edit the file you can use "mousepad" if you are working on the the xfce-desktop. If you are using an ssh-connection (and thus can not run "mousepad"), you can instead use "nano -w". Be sure to use the "-w"-switch, if you use nano, otherwise pasting long lines will automatically wrap them into several short ones and the scripts/configuration-files will not work.





Code:
mousepad makepnd.sh



Mousepads usage is self-explaining. In Nano the command shown at the bottom of it's screen can be executed by using the CTRL-key ("Select/CTRL" on the Pandora-keyboard). For example use CTRL+o to save the file or CTRL+x to exit nano. Of course you can use some other editor instead. Anyway, with "makepnd.sh" opened in an editor, either type the following or copy/paste it:





Code:
#!/bin/bash

/usr/pandora/scripts/pnd_make.sh -c -p l4_SuperMarioWorld_Snes9x.pnd -d pnddir/ -i pnddir/icon.png -x pnddir/PXML.xml



Here's what the script does: The first line tells the system, that "makepnd.sh" is a bash-script. While it's sort of basic knowledge for a Linux-user to know what bash is and does, I will not go into detail here. Search the web for more info. The second line runs the command "/usr/pandora/scripts/pnd_make.sh" that does validation and creation of the pnd-file. The parameters of pnd_make.sh that are shown have the following purpose:





Code:
-c -> compress the pnd-file

-p -> the name of the pnd-file that will be created

-d -> the name of the directory that contains all the data we want to provide with the pnd-file

-i -> the location of the png-file that will be used as an icon

-x -> the location of the configuration-file of the pnd (PXML.xml-file) that will be used



As you can see I chose the name "l4_SuperMarioWorld_Snes9x.pnd" as pnd-name. The "l4" stands for "launcher for". The idea behind this was to use it as a short prefix, that is unlikely to be used by other pnd-files, so in future I can easily find all launcher-pnds that i created. Also i decided to specify the emulator-name at the end. It's not the name that will be shown as menu-entry in minimenu or the startmenu. You should modify this name depening on your personal taste and on the game you want to launch. But you can also simply rename the file later. The rest of the script does not need to be changed.



Save the content and exit the editor.





Creating the content for the PND



The next step will be to create the "pnddir"-directory that is mentioned in the script and jump into it:





Code:
mkdir pnddir

cd pnddir



In this directory we will need to have 3 files ( + an optional one):



- icon.png

- run.sh

- PXML.xml

- preview.png (optional)



"icon.png" is the png-file that will be used as icon (surprise, surprise). You will probably want to search for a small suiting png-image (e.g. image of the game-character) on the web download it, rename it to "icon.png" and put it in here. I'm not sure if other image-formats like jpg/jpeg will work. You can try, but if you want to be on the safe side, then use a png.

In the same way you can provide a preview.png. For example you could run the emulator, start the game manually, make a screenshot, convert it into a png if necessary and copy it into the "pnddir"-directory with "preview.png" as filename. I will leave this out for now. For testing you can just use some existing icon like "/usr/share/icons/gnome/32x32/emotes/face-devilish.png"



"run.sh" will be a two-line-script very similar to the "makepnd.sh"-script that we created before. It's the script that will be launched when the pnd is run and will contain the command-line that will execute the emulator with the desired game-image starting up. It's the line that we setup in the HowTo that is mentioned right at the start of this one . Almost like before enter the following:





Code:
touch run.sh

chmod +x run.sh

mousepad run.sh



Now enter or copy/paste the following two lines and modify the second line to what is needed to launch the emulator and game-image that you want to be launched:





Code:
#!/bin/bash

/usr/pandora/scripts/pnd_run.sh -p /media/trans8/pandora/menu/snes9x4p_20111010.pnd -e snes.sh -b snes9x.skeezix.alpha -s . -a /media/trans8/multimedia-data/snes/SuperMarioWorldEurope.zip



Alternatively you can copy the game-image-file to the "pndrun"-directory and specify that location to be used (for example "-a ./SuperMarioWorldEurope.zip"). Then the image will be packed into the pnd. I started it from a different directory.





The last file we need is the "PXML.xml"-file. That file does not need to be executable, so you can skip the "touch"- and "chmod +x"-command we used before. Actually "touch" was only used, because i prefer to make files executable before i edit them, as i tend to forget it afterwards. Here in this situation you can directly run



mousepad PXML.xml



Copy/paste the following PXML-file-example and take some time to understand the basic concept:



Open the spoiler for the the PXML-file:


related section in the Pandora-Wiki.



- package-id/application-id: This is supposed to be a uniq ID, which no other pnd or application uses. I sticked to the naming scheme that i used for the pnd and added a small random number. Package-id and application-id can both be the same.



- all title- and description-specifications should be adjusted to suit the game you want to launch.



- category will probably always be "Game",but the subcategory should be adjusted. The full list of possible categories can be found here. For game-subcategories they are: ActionGame, AdventureGame, ArcadeGame, BoardGame, BlocksGame, CardGame, KidsGame, LogicGame, RolePlaying, Simulation, SportsGame, StrategyGame)



Note: I didn't specify any author, website or liscence as we will only build sort of fake launcher-pnds. These specifications should be set if you ever decide to build a real pnd.



Once you edit everything you can save the file and exit the editor.



This is pretty much all we need to build the pnd. So let's leave the "pnddir", by going one level higher in the directory-hirarchy back into our working-directory.





Code:
cd ..





Validation and baking the pnd



The only thing left before baking the pnd is to get a file that is need for pnd_make.sh to validate the PXML-file. If you run "pnd_make.sh", it will show you a short description and in the section of "--schema / -s" you will read that by default the command search for the validation-file at "/usr/pandora/scripts/PXML_schema.xsd". Download the file like described in the Validation-section at the very end of the PXML-page in the PandoraWiki and copy/rename the file to the mentioned position.

Now - while still being in the working-directory - try to bake the pnd:





Code:
./makepnd.sh



Hopefully everything went right and a pnd-file was created in the same directory. If you can some warning- or errormessages regarding the PXML-file, then edit the file "pnddir/PXML.xml" again and look for mistakes you made.





Testing, Installing, Final Notes



Finally let's test the pnd. I recommend to copy it over to the "apps"-directory of pnd-search-path on your sd-card, because that way you can quickly see if the icon will be show up on you desktop and try to start the launcher. Then you can test if the game is shown in the right subcategory of the start-menu. As an example, here is the copy-command that i used on my system:





Code:
cp l4_SuperMarioWorld_Snes9x.pnd /media/trans8/pandora/apps/



Once everything works, you can move it to some other sub-directory in a pnd-search-path of your choice and/or try it in minemenu. Congratulations on building your first pnd (if you succeeded). If you want to make another pnd, but keep the existing working-directory then just copy over the existing one (better use more meaningful names than i did in the example) and start editing the files :





Code:
cp -ar /media/trans8/rom-launcher /media/trans8/new_rom-launcher


One last side-note: Every pnd that is started will create an appdata-folder - also for every launcher-pnd that you write and start. This might litter your appdata-folder a little. And that's also why i chose the prefix "l4_" as application-id. This way i can rather quickly remove all of these directories if i want to. In theory you can specify the same appdata-folder for all your launcher-pnds (see the PXML-page of the PandoraWiki), but I'm not sure if this is a recommended, clean way. It might cause problems in some situation.


One more last side-note: Remeber these are fake-pnds that will only work on your system because of the specified paths. Don't upload them to any pnd-repository. Especially if you put a gamedata-image into the pnd-file, as this will put you into conflict with copyright law.


Ps: Please let me know of any mistakes I did, so i can correct them.

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

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

  <package id="l4_SuperMarioWorld_Snes9x_0918234">

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

    	<author name="unspecified" website="unspecified"/>

    	<titles>

    	<title lang="en_US">Super Mario World (Snes9x)</title>

    	</titles>

    	<descriptions>

    	<description lang="en_US">Runs Super Mario World with the help of Snes9x</description>

    	</descriptions>

  </package>


  <application id="l4_SuperMarioWorld_Snes9x_0918234">

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

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

    	<author name="unspecified" website="unspecified"/>

    	<osversion major="1" minor="0" release="0" build="0"/>

    	<titles>

      	<title lang="en_US">Super Mario World (Snes9x)</title>

    	</titles>

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

    	<descriptions>

    	<description lang="en_US">Runs Super Mario World with the help of Snes9x</description>

    	</descriptions>

    	<description lang="en_US">Runs Super Mario World with the help of Snes9x</description> <!--Extra block for compatibility with OS versions before HF6-->

    	<icon src="./icon.png"/>

    	<previewpics>

        	<pic src="./preview.png"/>

    	</previewpics>

    	<categories>

    	<category name="Game">

    	<subcategory name="ArcadeGame"/>

    	</category>

    </categories>

    <licenses>

      <license name="other"/>

    </licenses>

  </application>


</PXML>




I won't explain every point of the PXML-file, but will stick to the specifications that you need or might want to change. For a full explanation head over to the
 
Last edited by a moderator:
Oh, btw Moo: You could edit the title and correct that ugly "PDN" into "PND". ;)
 
Oh, btw Moo: You could edit the title and correct that ugly "PDN" into "PND". ;)

Cool. .. man.. get busy for the weekend and don't get a chance to check out this thread and it's full of awesome. Thank you so much for all your time and help on this - you've gone above and beyond and it is greatly appreciated.
 
Great, that others also think about a solution to make emulated games first-class menu-citizens!


I have a concept which I will present some day later.


For now, I am very glad, that I found this thread, which is a good resource and starting point for it.


One quick thought, which I want to share with you, already now:


Jey123456 offers the PND_utils, among them "pqr".


Your command:


/usr/pandora/scripts/pnd_run.sh -p /media/trans8/pandora/menu/snes9x4p_20111010.pnd


Could be abbreviated to:


pqr "snes9x4p"


The advantages being:

  • Your PND will be found anywhere within the default PND search paths. Freedom to switch SD cards, PND dir location, etc.
  • You just have to state the "PND application name". You do not not necessarily need to know the possibly differing filename, i.e. "pname-v2.pnd"
  • Update failsafe! Also if you update the PND, and it is one of those, which has the version number encoded within the filename, pqr will still find the newest version's filepath!


But I do not know whether pqr also supports passing the other necessary arguments:


-e snes.sh -b snes9x.skeezix.alpha -s . -a /media/trans8/multimedia-data/snes/SuperMarioWorldEurope.zip


But as all this is open source, one can simply splice together all the necessary bits :)
 
Last edited by a moderator:
Good to know that. I haven't tried it yet, but it for sure can get handy. Thanks for the hint.
 
Back
Top