MiniPSF files are regular
PSF files which import data from one or more PSFLib files residing in the same directory. This lets us save space by sharing driver code, sound banks, etc. across multiple PSF files.
PSFLib files are also regular PSF files. They can also recursively import data from other PSFLib files.
This is done via
tag variables called _lib, _lib2, _lib3, etc.
Loading Procedure
The proper way to load a minipsf is as follows:
- Load the executable data from the minipsf - this becomes the current executable.
- Check for the presence of a "_lib" tag. If present:
- RECURSIVELY load the executable data from the given library file. (Make sure to limit recursion to avoid crashing - I usually limit it to 10 levels)
- Make the _lib executable the current one.
- If applicable, we will use the initial program counter/stack pointer from the _lib executable.
- Superimpose the originally loaded minipsf executable on top of the current executable. If applicable, use the start address and size to determine where to .
- Check for the presence of "_libN" tags for N=2 and up (use "_lib%d")
- RECURSIVELY load and superimpose all these EXEs on top of the current EXE. Do not modify the current program counter or stack pointer.
- Start at N=2. Stop at the first tag name that doesn't exist.
Executables must always be contiguous. When superimposing one executable on top of another, grow the target executable start/end points as necessary, and fill the unused space with zeroes.
Path
Filenames given in any _lib* tag are relative to the directory in which the PSF file itself resides. Both forward and backward slashes should be interpreted as path separators. For instance:
- If C:\Something\Demo.minipsf contains "_lib=Hello/Library.psflib"...
- ...then the library is loaded from C:\Something\Hello\Library.psflib
Filenames may contain spaces within, but no leading or trailing spaces.
Detection
When determining whether a PSF file is a
MiniPSF and will need additional data, you should use the presence of _lib* tags to decide, rather than the file extension. It's a
MiniPSF if it includes a _lib or a _lib2.
Refresh Rate
Region information in all _lib executable headers should be ignored; only the original executable's region information should be considered when determining the refresh rate. For instance, a "Europe area"
MiniPSF which imports data from a "North America area" PSFLib would still be considered 50Hz.
If any _refresh override tags are encountered during the PSF loading process, the first tag seen will take effect and override all subsequent tags as well as all EXE header region information. For instance:
- MiniPSF has _refresh=50, and PSFLib has no _refresh tag:
- 50Hz override regardless of the EXE headers
- MiniPSF has _refresh=50, and PSFLib has _refresh=60:
- 50Hz override regardless of the EXE headers
- MiniPSF has no _refresh tag, and PSFLib has _refresh=60:
- 60Hz override regardless of the EXE headers
- Neither the MiniPSF nor the PSFLib have _refresh tags:
- MiniPSF's EXE header is used to determine the refresh rate
CategoryPSF