NAME

espxmlc.pl - convert .esp files to an XML-based text representation


SYNOPSIS

  perl espxmlc.pl [-exactfp] <file.esp> <file.xml>


DESCRIPTION

Converts a .esp file to XML (possibly XML-like, I'm not an expert!).

Designed for use with a version control system such as CVS, to make it easy to handle versions and see differences between versions. It is also useful to browse the contents of a .esp file.

See also xmlespc to convert back again.

The decoding is based on Jim Adam's discussion at http://home.cinci.rr.com/jimadam/MorrowindESPFormat.html, but with a few differences. Still, see that site for some interpretation of this data.

Some parts of the file can be safely edited in XML form, but be careful, as there are no checks on consistency! In particular, you can edit:

and you (probably?) cannot edit:

The conversion is not screamingly fast: on my 2Ghz pentium, it takes about 7 minutes to convert Morrowind.esp to XML, and about 5 minutes to convert it back again. On the other hand, all the mods I have installed convert in less than a second, and save games (completed Morrowind, most of the way through Tribunal, finished 2.5 other faction quests) take about 30s.


AUTHOR

Andy Mortimer, andy.mortimer@zetnet.co.uk


VERSION

  $Id: espxmlc.pl,v 1.2 2003/05/29 17:11:47 andy Exp $


BUGS

floating point numbers
The representation of a floating-point number as ASCII can never be exact. I've chosen to record them to 3 decimal places, under the assumption that that's all that will be required in a game like this! However, this may be untrue.

To record the original hex representation of floating point numbers, use the ``-exactfp'' switch, but then of course it's harder to view and edit them!

inconsistent handling of newlines in strings
Some of the strings in the file contain ``UNIX-style'' (LF) line endings, and some contain ``DOS-style'' (CRLF) line endings. In particular, it looks like script text contains CRs, but string variables don't, or something.

For now, any text containing UNIX-style line endings will be stored as hex, which makes it hard to read and edit. It would be nice to handle this properly. When this happens, you will get a warning like

  Warning: Error with guessed pretty coding of GMST/STRV: Coding error: non-CRLF "string" 'Do you wish to quit your current game?
  All unsaved progress will be lost.' at espxmlc.pl line 326.

lack of testing
This isn't terribly thoroughly tested! I've tested it by converting all the mods I currently have installed, including the master esm files, to XML and back using -exactfp: apart from some cases where it threw away what looks like junk after the end of the description in the header (which isn't a bug, it's a feature!), I found no differences between the initial and final files.

However, I'm sure there are bugs out there waiting to be found.

decoding not complete
The XML written out will reassemble into an (almost!) identical .esp file. However, it would be nice to decode more of the data into its actual meaning; at the moment, a lot of the data is simply rendered into hex.