[Gnupoc-development] Re: [Gnupoc] difficulty in getting gnupoc running
Status: Pre-Alpha
Brought to you by:
intera
From: Andre H. <and...@we...> - 2005-02-13 22:19:17
|
> Andre - Does this mean you managed to get genaif working on Mac OS X? > > -- Tap Hello Tapan, In addition to your patch there was a conversion in the crc check needed. Please see appended diff. There had to be a small hack in bmconv as well. At least for creating of .mbm files for uiq21. Somehow bmconv doesn't align odd bitmaps plus swaps the bytes for the 16 bit output. I got to zip it up and we got to merge it at some point with the linux stuff to make it compile. But meanwhile please see the second appended diff for bmconv. [andres-Computer:~/sos/genaif] andre% diff -ruN genaif-orig.c genaif.c --- genaif-orig.c Fri Feb 11 16:14:52 2005 +++ genaif.c Sun Feb 13 22:00:59 2005 @@ -13,8 +13,28 @@ /* NOTE: we have to write intel byte oder. Fix this if not on native */ -#define PUTLONG(X) fwrite(&X, sizeof(long), 1, fpout) -#define GETLONG(X) fread(&X, sizeof(long), 1, fpin) +#define PUTLONG(X) PutLong(&X, fpout) +#define GETLONG(X) GetLong(&X, fpin) + +void GetLong(long* ret_val, FILE *fp) +{ + long val; + val = (long) (fgetc(fp) & 0xFF); + val |= ((long) (fgetc(fp) & 0xFF) << 0x08); + val |= ((long) (fgetc(fp) & 0xFF) << 0x10); + val |= ((long) (fgetc(fp) & 0xFF) << 0x18); + *ret_val = val; +} + +void PutLong(long* val, FILE *fp) +{ + fputc(*val & 0xFF, fp); + fputc((*val >> 0x08) & 0xFF, fp); + fputc((*val >> 0x10) & 0xFF, fp); + fputc((*val >> 0x18) & 0xFF, fp); +} + + static char *Usage = "Usage: genaif [-u] UID3 aifspecfile app.aif\n" @@ -90,10 +110,17 @@ for(i = 0; i < 3; i++) { c = (unsigned char *)&u[i]; + // @todo andreh - big endian swap here + /* crc1 = docrc16_1(crc1, c[0]); crc2 = docrc16_1(crc2, c[1]); crc1 = docrc16_1(crc1, c[2]); crc2 = docrc16_1(crc2, c[3]); + */ + crc1 = docrc16_1(crc1, c[3]); + crc2 = docrc16_1(crc2, c[2]); + crc1 = docrc16_1(crc1, c[1]); + crc2 = docrc16_1(crc2, c[0]); } return (crc2 << 16) | crc1; } @@ -313,8 +340,9 @@ PUTLONG(l[2]); PUTLONG(id); count++; - while(GETLONG(id) == 1) + while(!feof(fpin)) { + GETLONG(id); if(id == oldid) count++, id = l[2]; PUTLONG(id); [andres-Computer:~/sos/genaif] andre% diff -ruN ./src/pbmcomp.cpp ../diff/bmconv-1.1.0-2/src/pbmcomp.cpp --- ./src/pbmcomp.cpp Sat Feb 12 02:06:37 2005 +++ ../diff/bmconv-1.1.0-2/src/pbmcomp.cpp Sun Jan 16 14:53:36 2005 @@ -287,7 +287,6 @@ } byteswritten+=4; Write32(byteswritten); - return NoError; } @@ -312,9 +311,8 @@ { unsigned char b[2]; - // todo andreh - change to big endian here - b[1] = (unsigned char)((v >> 0) & 0xff); - b[0] = (unsigned char)((v >> 8) & 0xff); + b[0] = (unsigned char)((v >> 0) & 0xff); + b[1] = (unsigned char)((v >> 8) & 0xff); iDestFile.write((char*)b, 2); } @@ -376,18 +374,9 @@ return PaletteSupportNotImplemented; int dataSize = aPbm->iBitmapSize - sizeof(SEpocBitmapHeader); + WriteBuf32((char*)(aPbm),sizeof(SEpocBitmapHeader)); WriteBuf16(((char*)(aPbm)) + sizeof(SEpocBitmapHeader),dataSize); - - // @todo andreh - more debugging here plus make the bytes even - printf("size 0x%08x hdr 0x%08x\n",dataSize,sizeof(SEpocBitmapHeader)); - if(dataSize % 2 != 0) - { - printf("printing one more byte\n"); - unsigned char b[1]; - b[0] = 0xdd; - iDestFile.write((char*)b, 1); - } return NoError; } |