is wieder down, wie wärs mit youtube?
Beiträge von the_Bug
-
-
Moin!
Nach ein paar Tagen Retro Fieber hatte ich mal die fixe Idee, das POX Format zu entschlüsseln.
Dank des Interactive Disassemblers habe ich auch den RLE "Algorithmus" entschlüsseln können.
Zunächst der allgemeine Aufbau einer POX Datei mit Bildern (es gibt auch POX Dateien, die nur die Ini Section enthalten):POX File:
type name (value) description
char[4] MAGIC "POXA" POX header magic
char[2] type "TT","PR",... POX type identifier
char[2] indent "\r\n"int iniLength size in bytes of the following section
char[iniLength] iniString the ini file
char[2] block_end "BB" end of ini fileint numPics number of pictures/frames
int dataLength length of RLE section in bytes
RLEHdr[numPics] headers image headers one after the other
char[dataLength] RLEData run length encoded img data
char[2] file_end "BB" end of fileZur Erklärung des RLE Algorithmus:
Wer Pseudo-C++-Code lesen kann ist klar im Vorteil:struct RLEHDR
{
int SrcX, SrcY; // probably draw offset, not implemented in digifx
uint width, height; // size of the ouput picture
int AdjX, AdjY; // pixel offset
uint PixFmt; // pixel format: PIXFMT_8 = 0; PIXFMT_555 = 1; PIXFMT_565 = 2; PIXFMT_888 = 3; PIXFMT_BGR = 128;
uint Data; // pointer to rle data, use ONLY as offset, substract RLEHDR[0].data from RLEHDR[i].data
};// der Stream zeigt auf das erste Byte der RLE Daten des Pictures, in der POX
// Datei sind diese aneinandergehängt
void UnpackRLE(istream& fin, Bitmap* pixelmap, RLEHDR* rlehdr)
{
int x=0, y=0;
char c;
short colour;
int i;
while(1) {
c = fin.get();
switch(c) {
case 1: // colour/pixel data
for( fin.read(&i,4); i > 0; i-- ) {
fin.read(&colour, 2);
pixelmap->setPixel(x + rlehdr->AdjX , y + rlehdr->AdjY, colour);
x++;
}
break;
case 2: // add x offset
fin.read(&i, 4);
i >> 1;
x += i;
break;
case 3: // new line, carriage return (y++, x=0)
y++;
break;
case 0: // end of rle stream
return;
default:
throw;
}
}
}Bei Unklarheiten einfach fragen, dachte diese Information wäre ganz interessant...