Header
| offset | size | description |
| 0x00000000 | 12 | Magic = ‘Ps2PowerSave’ |
| 0x0000000C | 4 | checksum (CRC32 all of file with checksum area treated as 0x00000000 |
| 0x00000010 | 32 | Directory name (0x00 terminated) |
| 0x00000030 | 32 | icon.sys name in ascii English |
| 0x00000050 | 4 | size of compressed data |
| 0x00000054 | 4 | number of files in save archive |
| 0x00000058 | 4 | size of uncompressed data |
| 0x0000005C | (see 0x000000050) | lzAri compressed data |
Archive
After uncompressing the data using the lzAri algorithm you will have an archive file containing the actual files.
The archive is a simple format consisting of file information followed by the actual data and then some padding repeated for as many files as there are:
| offset | size | description |
| 0x00000000 | 4 | size of the data |
| 0x00000004 | 32 | filename |
| 0x00000024 | (see 0x00000000) | file data |
The padding following file data is calculated using the following algorithm:
padding := roundUp(clump.Position + 8, 16) – 8 – clump.Position;
(algo courtesy of Ross Ridge).
The full code creating the archive in the ARMax DLL is:
procedure TMaxSave.buildClump;
var
aFile : PFileDetails;
a, b : integer;
fileDetails : TClumpFileDetails;
padding : integer;
paddingdata : array of char;
padd : byte;
begin
clump.Clear;
clump.position := 0;
padd := $0;
for a := 0 to files.Count - 1 do begin
aFile := files.Items[a];
fileDetails.name := aFile^.name;
fileDetails.size := aFile^.data.Size;
aFile^.data.Position := 0;
clump.Write(fileDetails, sizeof(fileDetails));
clump.CopyFrom(aFile^.data, fileDetails.size);
padding := roundUp(clump.Position + 8, 16) - 8 - clump.Position;
for b := 1 to padding do begin
clump.Write(padd, sizeOf(padd));
end;
end;
end;