ToolsPR resource editor
PR Resource Editor: Edit Prince of Persia Graphics and Sound
PR turns the packed DAT files of the DOS games into ordinary image, palette, sound and music files, and packs edited versions back in. This page covers what it does and how modders use it.
What the PR resource editor is
PR is a fan-made tool for the resource containers of the classic Prince of Persia games. Its full name is the Princed Resource editor, and it is one of the programs that grew out of the fan community around the games. On the popot.org tools page it is listed among the utilities for the original trilogy. It reads DAT files, the packed containers the DOS releases use for graphics, palettes, sound effects and music, and it works in two directions: it exports each entry to a normal file and it imports a changed file back into the container.
The file types on the outside are BMP for images, PAL for palettes, WAV for sound effects and MID for music. These are formats that any paint program, audio editor or music tool can open, which is the whole point. The game itself cannot read a BMP or a WAV directly. It reads numbered entries from PRINCE.DAT, KID.DAT and the other DAT files, and PR is the bridge between the two worlds. The layout of the containers is described on the DAT files page.
PR comes from the same fan community that maintains the format documentation on popot.org, where the program is distributed as binaries and as source code. An older graphical front end named PRM, short for Princed Resource Manager, wraps the program for users who prefer a window to a command line. The other tools in this family are on the modding tools overview.
How PR reads and writes DAT files
The program runs from the command line, and the project documentation shows export and import commands given against a DAT file. A typical session has two halves. In the first, the PR resource editor extracts the entries of a container into a folder, one file per resource, using the formats above. In the second, after the files have been changed, an import command takes the edited files and writes them into the DAT file. The exact options are listed in the documentation that comes with the program.
The game finds its resources by number, so a replacement has to end up in the slot of the entry it overrides. The simplest habit is to keep the exported file names as they are and change the contents only.
Images and palettes belong together, which is why the tool exports palettes as PAL files of their own. The DOS games draw in a small palette, so an artist who recolours a sprite works within those limits and checks the result in the game. Sound effects travel as WAV files and music as MIDI, and a replacement is best compared with the original it stands in for.
Platforms, versions and where the project lives
The Princed project on SourceForge lists Linux and Windows as platforms and carries the program under the GNU GPL version 2 and LGPL version 2. The project was registered there in October 2003, the page shows its last update in April 2013, and it offers a source archive of version 1.2. The popot.org tools page offers the latest binaries and source, and the figure in the tools overview comes from that page. A separate, community-maintained variant of PR is described on popuw.com as fixing bugs for the first game and adding support for the second.
Two practical consequences follow. The first is that a version number on one site does not have to match the number on another, so the version printed by the program itself is the reliable one. The second is that the source is available: anyone with a C and C++ compiler can build the program, which has kept it usable on newer systems than the original binaries were made for.
Using the PR resource editor in a mod
Most modding work that needs the PR resource editor falls into a few kinds. Some players replace the prince’s sprites to give the hero a new look. Others redraw tiles and backgrounds for a total conversion, and some swap sound effects or music for something of their own. Changing the level layouts is a different job, one that belongs to a level editor such as the one on the Apoplexy page.
A workable routine keeps the original files safe. Copy the game folder first and work on the copy. Export the entries that need changing, edit them in a paint or audio program, and import them. Then start the game from the copy and look at the result before changing anything else. Small steps make a mistake easy to find.
The testing step has a convenient home in SDLPoP. According to its readme, the open-source port can use modified DAT files placed in the game folder and, since version 1.17, whole mods from a mods folder that only need to hold the files that differ from the original data. That means a modified PRINCE.DAT can be tried in a mod folder without touching the main installation. The port is described on the SDLPoP page, and the broader question of which program to run the game with is on the play page.
What PR does not hold
The program is an editor, and it carries no game content of its own. The graphics and sounds it works on come from a copy of the game that the user already has, which is why this site links to none of them. A DAT file that arrives from some unknown source is a separate question. The DAT file opener can show what such a file starts with, although it names the container only if the signature is on its list, and the Prince of Persia containers are not.
For background on the game these containers belong to, the 1989 game page covers the DOS release and how it differs from the other versions.
Frequently asked questions
Does PR work on the sequel's files as well as the first game's?
The listings describe PR as a tool for the Prince of Persia series' DAT files, and a community-maintained variant is described as adding Prince of Persia 2 support on top of bug fixes for the first game. Which exact files a given build accepts is spelled out in the documentation that comes with that build.
Can PR be built from source?
Yes. The Princed project on SourceForge lists a source archive of PR 1.2 under the GPL and LGPL, written in C and C++ among other languages, and the popot.org tools page offers current binaries and source code. The older graphical wrapper PRM sits on top of the command-line program.
What happens to the original DAT file when something is imported?
That depends on how the command is given, so keep an untouched copy of the original before running any import. A copy is the simplest way to return to the stock graphics, and it costs nothing.
Where do the edited files get tested?
In a program that loads the modified DAT, such as SDLPoP, which accepts replaced DAT files in its game folder and loads whole mods from a mods folder. DOS emulators run the same files with the original executable.