# WindThunder AMP_File V1.0 Format # AMP files are WindThunder's transparent PCX format used in *Heroine Anthem I&II*. Their extension is usually .AMP, .000 or .001. Rather than specify a mask bit, a second, monochrome PCX file is stored after the full-color image. In theory, this format will work with other image formats besides PCX, but I do not believe it is used in the games with any other format. ## File Format ## Every AMP file begins with a 30 byte header. Offsets are stored in little endian ordering, and strings are padded with 0×00: <pre>ID Tag: 'AMP_FILE V1.0' [14 bytes, string] Image width [4 bytes, long] Image height [4 bytes, long] File size [4 bytes, long] Mask size [4 bytes, long] (data)</pre> Immediately following the header is the first graphic. The second graphic [mask] begins at (File size + 30) and continues until the end of the file. ## Proof of Concept ## Proof of method code is included below: <pre class="line-numbers"><code class="language-php">$filename = 'CatchPointFont.000'; $fd = fopen($filename, 'rb'); if(rtrim(fread($fd, 14)) != "AMP_FILE V1.0") die; $imgwidth = unpack('V*', fread($fd, 4)); $imgheight = unpack('V*', fread($fd, 4)); $filesize = unpack('V*', fread($fd, 4)); $masksize = unpack('V*', fread($fd, 4)); $fo = fopen($filename.'.image', "w"); fputs($fo, fread($fd, $filesize)); fclose($fo); $fo = fopen($filename.'.mask', "w"); fputs($fo, fread($fd, $masksize)); fclose($fo); fclose($fd);</code></pre> Copyright (c) 2005 Derrick Sobodash. Some Rights Reserved. This work is licensed under a CC Attribution-ShareAlike 4.0 International License (http://creativecommons.org/licenses/by-sa/4.0/).