PSF Tag Format
The tag in a
PSF file is a raw block of 8-bit text consisting of a series of lines of the format variable=value, as in the following example:
title=Earth Painting
artist=Yoko Shimomura
game=Legend of Mana
year=1999
Parsing details
The tag is to be parsed as follows:
- Lines of the form "variable=value" are parsed as variables.
- Multiple-line variables must appear as consecutive lines using the same variable name. For instance:
comment=This is a
comment=multiple-line
comment=comment.
- Blank lines, or lines not of the form "variable=value", are ignored.
- Variable names are case-insensitive, must be valid C identifiers, and must be plain ASCII (must not use characters above 0x7F).
- Whitespace at the beginning/end of the line and before/after the = are ignored.
- All characters 0x01-0x20 are considered whitespace.
- 0x0A is the newline character (use of 0x0D 0x0A is discouraged).
- There must be no null (0x00) characters; behavior is undefined if a null byte is present.
- Behavior is undefined if a variable name appears more than once, except in the case of a multiple-line variable.
- Behavior is undefined if a multiple-line variable is broken apart by an unrelated, non-blank line.
Predefined variables
The following variable names are predefined:
title, artist, game, year, genre, comment, copyright
(These are self-explanatory.)
psfby, ssfby, dsfby, usfby, qsfby
The name of the person responsible for creating the file. This does not imply that said person wrote the music driver code.
volume
Relative volume of the PSF as a simple scale coefficient. 1.0 is the default. It can by any real number, even negative.
length
fade
Length of the song, and the length of the ending fadeout. These may be in one of three formats:
- seconds.decimal
- minutes:seconds.decimal
- hours:minutes:seconds.decimal
The decmial portion may be omitted. Commas are also recognized as decimal separators.
utf8
If the tag contains a variable named "utf8" (it may be set to any non-empty value), then all strings in the tag must be decoded as UTF-8. If this variable is not present, strings may be decoded using the default system code page, or a heuristic may be used to autodetect the code page.
New applications should always encode tags as UTF-8, and should always include a utf8 variable to mark that the tag was encoded as UTF-8.
Reserved variables
The following variables are reserved and should not be used:
- Anything starting with an underscore (_) character
These are reserved for information crucial to playing, i.e. the _lib tags in
MiniPSF files.
- filedir, filename, and fileext have special meanings in Highly Experimental. While these variables may exist, they won't be usable in title format strings.
CategoryPSF