Pandora Frontends and PNDs


Aimless E

Still Fresh
Joined
Dec 28, 2010
Messages
56
PEF is reaching a good release point and since my Pandora is in the mail I need to make sure that my current solution will work with the emulators that are presently available. Does the drag and drop nature of the .pnds make it harder for front ends like PEF to call the programs and their options? Are the emulator porters/creators concerned about commandline options? I know the best solution would be to integrate libpnd into my program but if I don't have to then I would like to hold off on that for the next release.


Any info would be appreciated.


Thanks,


Ben
 
PEF is reaching a good release point and since my Pandora is in the mail I need to make sure that my current solution will work with the emulators that are presently available. Does the drag and drop nature of the .pnds make it harder for front ends like PEF to call the programs and their options? Are the emulator porters/creators concerned about commandline options? I know the best solution would be to integrate libpnd into my program but if I don't have to then I would like to hold off on that for the next release.


Any info would be appreciated.


Thanks,


Ben
I think that pnd_run takes care of the commandline arguments and passes them onto the application


e.g


pnd_run.sh -p /media/Sdname/pandora/menu/snes9x.pnd -e snes9x -a "/media/Sdname/roms/snes/game.smc"


Should work
 
PEF is reaching a good release point and since my Pandora is in the mail I need to make sure that my current solution will work with the emulators that are presently available. Does the drag and drop nature of the .pnds make it harder for front ends like PEF to call the programs and their options? Are the emulator porters/creators concerned about commandline options? I know the best solution would be to integrate libpnd into my program but if I don't have to then I would like to hold off on that for the next release.


Any info would be appreciated.


Thanks,


Ben
I think that pnd_run takes care of the commandline arguments and passes them onto the application


e.g


pnd_run.sh -p /media/Sdname/pandora/menu/snes9x.pnd -e snes9x -a "/media/Sdname/roms/snes/game.smc"


Should work

Beautiful. I love helper scripts.
 
Be aware that in the general case you need to parse the PXML embedded in the PND file to know the value of the -e option.
 
Be aware that in the general case you need to parse the PXML embedded in the PND file to know the value of the -e option.

Ah, is the convention basically the same as it would be for non pnd apps -h --help to show usage and what not?
 
Ah, is the convention basically the same as it would be for non pnd apps -h --help to show usage and what not?
Huh? I'm not sure I understand.


meandu229 mentioned that you can launch PND files through the use of the pnd_run.sh scripts like shown here:



Code:
pnd_run.sh -p /media/Sdname/pandora/menu/snes9x.pnd -e snes9x -a "/media/Sdname/roms/snes/game.smc"

This is required as PND files are not executables but ISO or squashfs images containing both data and executables.



pnd_run.sh is located in /usr/pandora/scripts and requires the parameter -p <full-path-to-pnd> and -e <executable-to-launch> other parameters such as -a <parameters-to-pass-to-executable> are optional. pnd_run.sh prints usage info whenever its input is incorrect. It does not recognize -h or --help.



My remark was basically that you cannot easily guess the <executable-to-launch>.

For example, vlc requires the following option to be passed to pnd_run.sh:



Code:
-e scripts/vlc.sh

The value which you need to pass is stored in an xml file in the root of the PND (which is an ISO or squashfs image).

You can mount the image and print the xml file. I have no idea if there is any tool available to automatically extract that info (aside from libpnd, I assume).



Note that there is also a binary pnd_run in /usr/bin which is easier to invoke, e.g.



Code:
pnd_run /media/Sdname/pandora/menu/snes9x.pnd

However, this option does not allow you to pass parameters to the application.
 
Last edited by a moderator:
the pxml appened to the end of the binary so u dont really have to mount and extract the pnd to get it, I think you can use grep to get that info, but libpnd should be able to get it anyway.
 
Yeah I think it will be best to integrate libpnd into the package, to do it right. But since I want this program to be cross platform ( in the long run) I need to make sure my dependences are kept to a minimum.


Thats for all the info, I now know how to proceed.
 
So I think I found a bug in the current run_pnd.sh script. I can send any number of options using -a but when a filename has a space in it the command believes it is complete and executes. I've tried placing the filename in quotes and using \ before every none standard character and space in the standard unix/linux shell style, but still nothing. This happens when trying to execute from a C program, a bash script, or directly from the command line. I have deduced this by going to /tmp/nameofprogram.out.


Edit: I just removed the executable from the pnd and re-ran my tests both quotes and common wild cards work.
 
Last edited by a moderator:
So I think I found a bug in the current run_pnd.sh script. I can send any number of options using -a but when a filename has a space in it the command believes it is complete and executes. I've tried placing the filename in quotes and using \ before every none standard character and space in the standard unix/linux shell style, but still nothing. This happens when trying to execute from a C program, a bash script, or directly from the command line. I have deduced this by going to /tmp/nameofprogram.out.
AFAIR that issue surfaced before, but I thought it was fixed. The reason is, as far as I remember, that bash "eats" the escape when it goes to the script, but since the script gives the parameter to the end program, and the escape isn't there anymore, it fails again. A possible workaround could be to put the param in like "the\\ space" (doubly escaped)


EDIT: ah, here it was:


But it seems it wasn't fixed - try the double-escape anyway
 
Last edited by a moderator:
So I think I found a bug in the current run_pnd.sh script. I can send any number of options using -a but when a filename has a space in it the command believes it is complete and executes. I've tried placing the filename in quotes and using \ before every none standard character and space in the standard unix/linux shell style, but still nothing. This happens when trying to execute from a C program, a bash script, or directly from the command line. I have deduced this by going to /tmp/nameofprogram.out.
AFAIR that issue surfaced before, but I thought it was fixed. The reason is, as far as I remember, that bash "eats" the escape when it goes to the script, but since the script gives the parameter to the end program, and the escape isn't there anymore, it fails again. A possible workaround could be to put the param in like "the\\ space" (doubly escaped)


EDIT: ah, here it was:


But it seems it wasn't fixed - try the double-escape anyway

Thanks for the suggestion but no dice. For testing sake I'm going to remove all the spaces and special characters from the filenames manually. My program doesn't care about filenames so it shouldn't cause an issue.
 
Remember also there is..


pnd_run


pnd_run.sh


libpnd stuff eventualyl ends up calling pnd_run.sh to actually run the pnd-files.


pnd_run is a convenience binary that fetches the PXML and figures out where pnd_run.sh is (based on configs etc), and then runs the named pnd. It also knows how to run subapps and such. (since a pnd can have multiple apps in it.)


So you can use pnd_run.sh to run the pnd, but you have to know some of the details.


Most people can just use pnd_run (binary, not sh) to run things a lot easier.


pnd_run binary doens't suppoet passing args to the pnd executables yet though .. doh :)


jeff
 
Remember also there is..


pnd_run


pnd_run.sh


libpnd stuff eventualyl ends up calling pnd_run.sh to actually run the pnd-files.


pnd_run is a convenience binary that fetches the PXML and figures out where pnd_run.sh is (based on configs etc), and then runs the named pnd. It also knows how to run subapps and such. (since a pnd can have multiple apps in it.)


So you can use pnd_run.sh to run the pnd, but you have to know some of the details.


Most people can just use pnd_run (binary, not sh) to run things a lot easier.


pnd_run binary doens't suppoet passing args to the pnd executables yet though .. doh :)


jeff

If I was just making a launcher for the app that would be great, but I'm needing to send a file and options to the program within the pnd. PND is an awesome "container" file and I know that these problems get worked out over time. I wrote a script to rename the files so that pnd_run.sh works correctly. I have bigger fish to fry then worrying about spaces currently. And I could simply add a disclaimer and an option to rename the files during the initial scan if I have to. So no worries.
 
Ah, is the convention basically the same as it would be for non pnd apps -h --help to show usage and what not?
Huh? I'm not sure I understand.


meandu229 mentioned that you can launch PND files through the use of the pnd_run.sh scripts like shown here:



Code:
pnd_run.sh -p /media/Sdname/pandora/menu/snes9x.pnd -e snes9x -a "/media/Sdname/roms/snes/game.smc"

This is required as PND files are not executables but ISO or squashfs images containing both data and executables.



pnd_run.sh is located in /usr/pandora/scripts and requires the parameter -p <full-path-to-pnd> and -e <executable-to-launch> other parameters such as -a <parameters-to-pass-to-executable> are optional. pnd_run.sh prints usage info whenever its input is incorrect. It does not recognize -h or --help.



My remark was basically that you cannot easily guess the <executable-to-launch>.

For example, vlc requires the following option to be passed to pnd_run.sh:



Code:
-e scripts/vlc.sh

The value which you need to pass is stored in an xml file in the root of the PND (which is an ISO or squashfs image).

You can mount the image and print the xml file. I have no idea if there is any tool available to automatically extract that info (aside from libpnd, I assume).



Note that there is also a binary pnd_run in /usr/bin which is easier to invoke, e.g.



Code:
pnd_run /media/Sdname/pandora/menu/snes9x.pnd

However, this option does not allow you to pass parameters to the application.
How do I mount a PND?
 
If you just want to print the xml file from the PND, I wrote a quick and dirty script to do so some time ago. Feel free to use it.


showpxml.py:



Code:
#!/usr/bin/python

import os

import sys


USAGE = """Usage: showpxml <PND-file>"""

MAX_PXML_SIZE = 1024**2    # to speed up script

# TODO: fix case where PXML is not in the last MB.


def PrintPXML(filename):

    with open(filename) as f:

        f.seek(-MAX_PXML_SIZE, os.SEEK_END)

        ispxml = False

        for line in f:

          temp = line.lower()

          ispxml |= 'pxml' in temp

          if ispxml: print line,

          ispxml &= '</pxml>' not in temp


def main(argv):

    if len(argv) != 2:

        sys.exit(USAGE)

    else:

        try:

            PrintPXML(argv[1])

        except Exception, e:

            sys.exit(e)

        else:

            sys.exit()


if __name__ == '__main__':

    main(sys.argv)
 
Found a work around for my problem. If I make a symbolic link to the file in the tmp directory it doesn't mater what the name of the file is and the emulators tested so far have no problem with it and since the tmp directory is in memory it doesn't hurt the nand.


Good stuff.
 
Back
Top