Difference between revisions of "Introduction to PNDs"
(merged info from mount pnds) |
|||
Line 225: | Line 225: | ||
===How do I launch a PND application without putting it in a special location?=== | ===How do I launch a PND application without putting it in a special location?=== | ||
:If you open a PND file in your file manager, the first application in the PND will be launched without you having to move the PND file. | :If you open a PND file in your file manager, the first application in the PND will be launched without you having to move the PND file. | ||
+ | |||
+ | This guide describes how to mount a PND file, so you can browse the files within (to find documentation, or otherwise eat its brain and gain its knowledge.) | ||
+ | |||
+ | ''For now, the information is being compiled in [[http://www.gp32x.com/board/index.php?/topic/58937-how-to-mount-a-pnd-and-see-the-gooey-bits-inside this thread]] where I am fine tuning it with some expert help. When all the facts are straight, I will replicate the information here. -Gruso'' | ||
===How do I choose where the shortcut icons for a PND appear?=== | ===How do I choose where the shortcut icons for a PND appear?=== |
Revision as of 21:07, 25 October 2013
For developers: Libpnd hub
A .pnd ("pandora") file is an application (game, word processor, emulator, whatever.) More accurately, it is a full application bundled up into a single file; think of it like a zip, with a relatively well defined internal structure.
The pnd-file system was designed so you could use an application without the hassle of installation or uninstallation, or even having to organize it yourself if you don't want to. You just download or obtain the pnd-file, and use it.
If you remember classic computers such as the Amiga - where you inserted a disk and then launched the applications read by Workbench (the Amiga's operating system) - then this is similar:
When you insert an SD card into one of the two slots, the (Linux-based) Pandora OS will scan it for your PND program files. Any program it finds will either turn up on the desktop or the application menu (just like in Windows).
How do I run a PND-application?
Put your pnd-files on your SD card and insert the SD card into either slot of your Pandora.
Using the file browser, you can double-click on the pnd-file to run it. However, more normally pnd files are put in special folders so they get picked up by the Pandora's OS and are made easier to find and run.
Where do .PNDs Go?
Put .pnd-files into specific directories if you want them to show up in the Start menu or on your Pandora desktop, or in Minimenu.
You can put them anywhere you like in internal NAND or SD, if you wish to organize them yourself and launch them with taps.
Folder | Note |
---|---|
/pandora/desktop | pnd files show up on the desktop background |
/pandora/menu | show up in the Applications menu or in minimenu(under the categories suggested by the developer) |
/pandora/apps | show up in all places; the desktop, the apps menu and in Minimenu |
/pandora/mmenu | show up only in minimenu, ignored by other GUIs |
These locations are not written in stone. The libpnd config files are in /etc/pandora/conf in the NAND. Generally you will never need to alter these files, but you certainly can if you wish. In theory, obliterating the files will still leave the system working, and they are easily restored. One file, /etc/pandora/conf/desktop defines the "search paths" to look for .pnd files, and where to put ".desktop" files when they are found. The searchpaths says where to find them (such as /pandora/desktop), and where to put the application link - /usr/share/applications is where the menu items are pulled from. IF you wish to put pnd files somewhere not in the searchpath, just add the directory to the search-path and you're good to go.
NOTE: You can actually put subdirectories into those locations above, should you wish to organize your pnd-files somehow within those larger categories.
Where DON'T .PND files go?
- .pnd files are looked for in the directories mentioned above; that list can be tailored if you wish to edit config files.
- .pnd files are not looked for in the / (root) of the SD cards.. this is _on purpose_; consider, if your SD card is 32GB, or if you're using a 2TB USB drive even -- it could have tens of thousands of files on it; having the Pandora scan the entire device for pnd files would take forever. Instead, we made a well defined set of directories the system will use - /pandora for everything, with 'appdata' and 'menu' and 'desktop' and other special purpose directories.
Where does my data go? How do I make files visible to the applications?
An application normally will see what is contained within the pnd-file, or your personal data created with the tool; it can of course look anywhere on the SD or device internal memory. For example a Quake port might expect to see extra level files in /quake, or give you a way of selecting a path to put files in.. or it might just expect it to be in your personal data folders, or in the pnd-file itself. Its up to the application, with suggestions in the pnd-guidelines for developers.
The first time a pnd-application is run, an "app data" directory is created for it; anything that app data folder contains will be visible to the application as if it was in the pnd-file (and in fact, this lets you override files in the pnd-file without modifying the .pnd itself, which could be handy.) If your app creates a file "foo", it'll show up in /pandora/appdata/appname-id as "foo". The actual appdata folder name depends on the name used by the developer, but should generally look like application-name and some funny number afterwards. It should be easy to spot.
example: Quake 1 will probably put score or save data in /pandora/appdata/quake1-123/ or somesuch.
It will always be helpful to read the description or readme file included.
Example: Hatari
Hatari (Atari ST emulator) by default is set to look in "./disks" for the disk images (ROMs) to use. What this means is within the pnd-file (where no disks are supplied), and in the appdata directory. With Hatari, you can browse anywhere from the UI and pick a disk anywhere on your SD cards, but by default it'll look into the ./disks directory.
So you might put Hatari into the menu (/pandora/menu/Hatari131.pnd), or into the desktop (/pandora/desktop/Hatari131.pnd), or somewhere else. Regardless, the appdata will be (with the version I'm building now), /pandora/appdata/hatari.skeezix and thus you would put your .ST or .MSA disk images into /pandora/appdata/hatari.skeezix/disks to make them visible to the emulator. However, given it features its own UI, you can put them into /roms/atarist or /disks or whatever, and use them from there.
Advanced topics
I want to override the .PND icon, name, or other settings, how is this done?
The easiest way right now is via the "override" (or "overlay") system -- .ovr files.
An .ovr is just a text file you create, with the same name as the pnd-file and in the same location, but with a different file extension. Piece of cake.
If your pnd-file is Hatari.pnd, and you're putting it into /pandora/desktop, then you might create an ovr file for it as: /pandora/desktop/Hatari.ovr If you wish to provide your own icon, create it with the same location and filename, but as a .png file: /pandora/desktop/Hatari.png
.ovr files are automatically supported by the system so should work across all pnd-application aware applications and desktops. .png icon overrides have to be handled by the menus, but are already handled by minimenu and anything using the .desktop system (such as XFCE full desktop or other standard desktop environments.)
An ovr-file simply looks like this:
- The ovr file may (at this time) override the icon title, the CPU clock speed to set on launch, the main category, and the first subcategory for the main category. Additional fields will become overridable.
- The category list uses the existing desktop standard. See here for a list of categories and subcategories supported.
- Minimenu honors up to 3 lines of 'notes', pulled from the .ovr file. (Make sure they are in the right subapp group). note-1, note-2, note-3, see example below. The notes in minimenu are shown at the bottom of the detail text panel.
[Application-0]
title HatariHack0
maincategory Audio
maincategorysub1 Emulator
[Application-1]
title HatariHack1
clockspeed 200
note-1 My text for note line 1
Notice the Application-0 and Application-1 -- any given .pnd file may include multiple applications, so you need to assign your overrides to the correct "sub application". It can be tricky to figure out which subapp you wish to override, but there are some tricks. minimenu, for example, shows the subapp-number in the detail panel. When looking at a .desktop filename, you'll notice #0.desktop .. some number after the # is the subapp-number.
How Do I Make .PNDs?
The following is a work in progress, the instructions in here may or may not work for you. It was taken from PND quickstart.
The steps to produce a pnd file are as follows:
- create a directory to represent the application on SD card; i.e.: ./mame-app
- create a PXML.xml file and drop it into the dir (./mame-app/PXML.xml); genpxml script can be used, or do it by hand
- drop the executable and data files into this dir (say, ./mame-app/mame.bin, and ./mame-app/artwork/foo, etc.) <- note, with a PXML.xml and executable, your Pandora can now find and run your app without even bundling it into a .pnd!
- invoke /usr/pandora/scripts/pnd-make.sh (or on Windows, various commands in the command-line) to produce mame4all-pandora-1.0-arm.pnd or whatever you want to call it (foobearspanky.pnd, we don't care.)
- you're done, distribute it as you see fit
(alternate instructions)
For these instructions, you will first need to grab the example file, here.
- Edit ./pnds.sh. I use that script to handle multiple apps at once. Each line represents a command line for an app / game to turn the directory into a PND. If I change the app / game, I simply uncomment the line in pnds.sh so that I can easily create or update multiple PNDs by simply running one single script.
- Run ./pnds.sh
- Upload
Don't forget to check the license conditions for anything you re-distribute.
PXML.xml file?
The PXML.xml file is the pnd file's metadata file and specifies things like:
- A description of the software
- A link to the icon filename
- What version it is
- The author, and their website
- Whether it's a beta or release version
- The menu categories the pnd file should appear in
- The license the code is distributed under
- Preview pictures, for display in minimenu or on the [repo]
You can use genpxml.sh to generate a template PXML.xml file for you (in /usr/pandora/scripts/), but perhaps simplest way to make your first PXML.xml file is to look at an example one from a real pnd file, from the repo (where PXML.xml file are guaranteed to be valid). The PXML.xml file will be inside the pnd file's root folder, and you can look at it using a text editor.
How Do I Look Inside a .PND?
To open a PND, the easiest way is probably to use the PNDTools or PNDManager programs, which can browse and create PNDs. They're Windows-only, currently.
You could also install 7zip on your home PC, change the .pnd's file extension to .sfs, and 7zip should be able to open it. (This is a simple way to look into a .pnd on Ubuntu: unsquashfs FILE.pnd
needs squashfs-tools installed) [1] On the Pandora, you can run a PND and look at what's inside /mnt/tmp. To do this in a terminal (on PC or Pandora), see this tutorial.
The PND Cookbook contains recipes for common PND tasks, like setting up your application's environment and configuration, locating and copying files, etc.
All these commands are hard. Give me a GUI tool to do it
Okay:
- PNDbuilder by freedomdown. Discussion. Download v1.1 for Pandora.
How do I make .PNDs on Windows?
Command-line
For this command-line tutorial, I will assume you have already created a PXML.xml file.
Preparations
Get yourself mkisofs tools; for example, grab from here: http://www.student.tugraz.at/thomas.plank/ -- get cdrtools-2.01-win32-bin.zip and DLL version 1.5.25, and extract to somewhere. That lets you run 'mkisofs' to spit out .iso files
If you want to make a compressed image, use squashfs tools here: ftp://ftp.slax.org/useful-binaries/win32/squashfs-tools/
Generate the actual PND-file
Make yourself the iso; this step produces the iso, but to turn the iso into a pnd you need a couple last steps. You could also use some fancy iso-building tool.
mkisofs -o foo.iso -R /path/to/folder/myapp
Append PXML.xml to the .iso (yes, the PXML.xml is included in the iso, but we also want to append it for performance reasons.)
copy foo.iso+PXML.xml foo.step2
Append the icon PNG file to the .iso (if you have an icon; if not, you can leave this step out.)
copy foo.step2+myicon.png foo.pnd
Clean up:
del foo.step2 foo.iso
Profit!
GUI
You have a few choices here:
- PNDTools by foxblock. Discussion: OP, GP32X. Can browse and create PNDs. Two (simple and advanced) editors for PXML creation.
- PNDBuilder by StreaK. Discussion (old). Can create PNDs and edit PXML files.
- PNDManager by Speaker Ender. Discussion.
- PNDbuilder by freedomdown. Discussion.
Mac OSX
TBD
This is a list of frequently asked questions about using the Pandora PND package format. For factual and other kinds of questions, use the search box. If your question is not answered on this page, do some research and include it!
Contents
- 1 How do I run a PND-application?
- 2 Where do .PNDs Go?
- 3 Where DON'T .PND files go?
- 4 Where does my data go? How do I make files visible to the applications?
- 5 Advanced topics
- 5.1 I want to override the .PND icon, name, or other settings, how is this done?
- 5.2 How Do I Make .PNDs?
- 5.3 PXML.xml file?
- 5.4 How Do I Look Inside a .PND?
- 5.5 All these commands are hard. Give me a GUI tool to do it
- 5.6 How do I make .PNDs on Windows?
- 5.7 Mac OSX
- 5.8 The PND system
- 5.8.1 What is a PND file?
- 5.8.2 Why are PNDs useful?
- 5.8.3 Can I modify a PND file?
- 5.8.4 Can a PND file modify itself?
- 5.8.5 How does a PND store application data?
- 5.8.6 What desktop environments do pnd files work with?
- 5.8.7 Can a PND-file be unpacked and used?
- 5.8.8 Can the PND-file system be added to other Linux distributions?
- 5.9 Usage
- 5.10 Advanced Information
- 5.10.1 How is a PND file structured?
- 5.10.2 How does the PND discovery mechanism work?
- 5.10.3 How do I change the search paths for PND files?
- 5.10.4 How do I configure different locations for my PND shortcuts?
- 5.10.5 How can I open a PND file to see what's inside?
- 5.10.6 How do I set up a script to run before/after a specific PND runs?
The PND system
What is a PND file?
- A PND file is a compact file that contains one or more runnable applications for the Pandora. The file is basically an archive (like a ZIP, RAR or ISO) that contains all the data that the provided set of applications require, along with some meta data about the applications themselves.
Why are PNDs useful?
- Normally, on an ordinary computer, it is necessary to install an application in order to run it. This usually happens in one of many different ways; an installer might be run, or an archive might become extracted, etc.
- PND files are used to allow for applications to be executed without them being installed first. They are supposed to work in a way similar to game cartridges, in that they contain all of the necessary information in one tight package that can be executed independently.
- This system is inspired by similar systems such as the Apple OS 10 DMG file system, the Puppy Linux package format, or the Haiku Box package management system.
Can I modify a PND file?
- You can, but you need easily obtained open source freeware special tools to do so. (These tools are included by most Linux distributions by default, but are downloads for Windows and Mac OSX users.) It is advised that only developers modify or create PND files.
Can a PND file modify itself?
- No, not generally. A pnd-file, even after extended use may be copied anywhere and still be in its original state. Any changes the application has made will have been redirected to its appdata directory instead, so you have your self-contained directory of its changes.
How does a PND store application data?
- Since the PND cannot modify itself, there has to be a way for it to store runtime data, such as configuration files and user-added level files. This is achieved in the PND system by creating an application data directory for each application that is inside a PND. Since a PND can contain many applications, there can, and will, be multiple application data folders per PND, and each application declares its own application data folder name.
- The application data folders are located in "pandora/appdata/*" on the device that the PND is stored on.
What desktop environments do pnd files work with?
- As described below, the pnd-files will cause the system to spit out standard ".desktop" files for each application contained. The Pandora firmware includes several desktop environments (ie: menus) that understand those files (or operate with pnd-files directly.) The ".desktop" files are a standard however, so you are free to install other desktop environments and they should work fine out of the box with pnd-files, without any alteration whatsoever,
Can a PND-file be unpacked and used?
- A pnd-file may be unpacked into what is called a "PXML-application directory" if the packager of the pnd-file followed the specification. (ie: the icon and PXML.xml metadata are included in the contained filesystem and not just found at the end of the pnd-file.) An application directory may be auto-discovered and executed just like a pnd-file, but you can muck with the files in-place without a problem. When the application writes back to itself however, the changes will still be directed to the appdata directory as with a regular pnd-file.
- This is an advanced topic, noted here for completeness.
Can the PND-file system be added to other Linux distributions?
- It is very easy to add the PND system to other Linux distributions, be they Pandora oriented or not. As of 2010 the Pandora APIs are are a little Pandora-specific, but effort will be made to split off the PND-file support and Pandora-specific support into separate systems, so that non-Pandora Linux distributions can even more easily adopt the PND-file system should they wish to. Certainly however, if you're building a new distribution to run on the Pandora, it is absolutely trivial to include PND-file support (and other Pandora originated technologies), so please do, to help for a consistent user experience.
Usage
How do I use PND files?
- Using PND files on your Pandora is easy: You simply get hold of a PND file, presumably via a web page of some kind, and store it in a special folder on one of your SD cards. See the folder listing below. By default, both SD slots (and other mountable media) on the Pandora will be monitored for PND-files, though everything is configurable for advanced users.
- Once you've put your PND in a known location, the PND system will pick up the new PND, "activate" it, and create shortcut icons to the applications inside of the PND. You can then use these icons to launch the applications.
How do I launch a PND application without putting it in a special location?
- If you open a PND file in your file manager, the first application in the PND will be launched without you having to move the PND file.
This guide describes how to mount a PND file, so you can browse the files within (to find documentation, or otherwise eat its brain and gain its knowledge.)
For now, the information is being compiled in [this thread] where I am fine tuning it with some expert help. When all the facts are straight, I will replicate the information here. -Gruso
How do I choose where the shortcut icons for a PND appear?
- With the default configuration, there are four different folders you can put your PND files in to have their applications show up in different locations:
- "/media/*/pandora/menu" - These PND-files will only generate shortcut icons in the system's application menu. ("*.desktop" files will be written to "/usr/share/applications")
- "/media/*/pandora/desktop" - These PND files will only generate shortcut icons on the Desktop. ("*.desktop" files will be written to "~/Desktop")
- "/media/*/pandora/apps" - Deprecated to some extent, this directory is used to be _both_ menu and desktop, without having to copy the pnd-file into /menu and /desktop (avoiding duplication)
- "/usr/pandora/apps" This also extracts shortcut icons to the desktop. This path should not be touched, and is included to make an easy avenue for the Pandora firmware developers to include essential tools for the user, when bundled as pnd-files. (As of this writing early 2010, such tools are built into the firmware without being pnd-files, but the option exists still.)
Advanced Information
How is a PND file structured?
- The PND file is simply an archive or file system image (currently, ISO and SquashFS are supported) with a "PXML.xml" appended at the end. There can also be an accompanying icon that is appended as well.
How does the PND discovery mechanism work?
- There is an open source API for working with pnd-files and PXML-application directories (among other tasks); this API can be used by developers wishing to take advantage of the pnd auto-discovery system, such as when developing a new menu system say.
- There is a special process called "pndnotifyd" that uses this API to watch the PND search paths for file changes. Once it finds a new PND file, it uses the PXML.xml file to generate one or more "*.desktop" files for the PND. (A .desktop file is a open standard way of describing an application and how to execute it, and is supported across most popular desktop environments.)
How do I change the search paths for PND files?
- Simply edit the "/etc/pandora/conf/apps" file, and change the "searchpath" entry to include the paths you want to use. Paths are separated by colons (":") and may include wildcards (in the shape of "*") anywhere in the path.
How do I configure different locations for my PND shortcuts?
- Edit the file "/etc/pandora/conf/desktop" (The "desktop" refers to "*.desktop files"). It will look like this:
# Open Pandora # Desktop configuration [desktop] searchpath /media/*/pandora/desktop:/media/*/pandora/apps:/usr/pandora/apps dotdesktoppath ~/Desktop/ iconpath /tmp [menu] searchpath /media/*/pandora/menu dotdesktoppath /usr/share/applications iconpath /tmp
- You should leave the "iconpath" variables be, but you can change which paths are searched through and where "*.desktop" files are extracted with the "searchpath" and "dotdesktoppath" variables, respectively.
How can I open a PND file to see what's inside?
The simplest way is probably to use PNDTools or PNDManager, which currently only work in Windows. You can also use them to edit PNDs and create them.
How do I set up a script to run before/after a specific PND runs?
(Using pnd_run.sh or as of Zaxxon HF6 Alpha 1)
The pandora will look in the program's appdata folder for a bash script named PND_pre_script.sh to run before the PND is run, and PND_post_script.sh to run on the PND's closing.
All information pulled from [2] and may be subject to change due to updates.