author | ecalot
<ecalot> 2006-06-25 23:44:12 UTC |
committer | ecalot
<ecalot> 2006-06-25 23:44:12 UTC |
parent | ab4db792d03b59a5b19d76cad21c1f2edbde541d |
PR/src/include/sound.h | +10 | -3 |
PR/src/lib/layers/dat.c | +1 | -1 |
PR/src/lib/object/image/image16.c | +2 | -9 |
PR/src/lib/object/image/image2.c | +2 | -3 |
PR/src/lib/object/image/image_common.c | +1 | -2 |
PR/src/lib/object/sound/sound_common.c | +9 | -28 |
PR/src/ports/winfiles/pr.dev | +1 | -1 |
diff --git a/PR/src/include/sound.h b/PR/src/include/sound.h index 4b199d2..c8fb1e2 100644 --- a/PR/src/include/sound.h +++ b/PR/src/include/sound.h @@ -39,6 +39,12 @@ sound.h: Princed Resources : Common sound objects interfaces #include "mid.h" #include "wav.h" +typedef enum { + magicMidi=0x02, + magicPcspeaker=0x00, + magicWave=0x01 +} tSoundType; + int objectSoundWaveWrite(void* o, const char* file, int optionflag, const char* backupExtension); void* objSoundCreate(tBinary c, int *error); @@ -50,9 +56,10 @@ void* objectSoundWaveRead(const char* file, int *result); #define objectSoundMidiRead(a,b) objectOtherBinaryRead(a,b) #define objectSoundPcspeakerRead(a,b) objectOtherBinaryRead(a,b) -int objectSoundWaveSet(void* o,tResource* res); -int objectSoundPcspeakerSet(void* o,tResource* res); -int objectSoundMidiSet(void* o,tResource* res); +int objectSoundSet(void* o,tResource* res, tSoundType soundType); +#define objectSoundWaveSet(a,b) objectSoundSet(a,b,magicWave) +#define objectSoundPcspeakerSet(a,b) objectSoundSet(a,b,magicPcspeaker) +#define objectSoundMidiSet(a,b) objectSoundSet(a,b,magicMidi) #define objectSoundMidiWrite(a,b,c,d) objectBinaryWrite(a,b,c,d) #define objectSoundPcspeakerWrite(a,b,c,d) objectBinaryWrite(a,b,c,d) diff --git a/PR/src/lib/layers/dat.c b/PR/src/lib/layers/dat.c index 3750cb2..eee44ee 100644 --- a/PR/src/lib/layers/dat.c +++ b/PR/src/lib/layers/dat.c @@ -408,7 +408,7 @@ int dat_readRes(tResource* res, tIndexCursor indexCursor) { } void dat_releaseCursor(tIndexCursor* indexCursor) { - if (0&&indexCursor->popVersion==pop2) free(indexCursor->order); /* TODO: check*/ + if (0&&indexCursor->popVersion==pop2) free(indexCursor->order); /* TODO: check */ } /***************************************************************\ diff --git a/PR/src/lib/object/image/image16.c b/PR/src/lib/object/image/image16.c index c77a1f3..2b411f2 100644 --- a/PR/src/lib/object/image/image16.c +++ b/PR/src/lib/object/image/image16.c @@ -114,20 +114,13 @@ void* objectImage16Create(tBinary cont, int *error) { /* use get like main.c */ image=(tImage*)malloc(sizeof(tImage)); /* Expand graphic and check results */ - *error=mExpandGraphic(cont,image); /* TODO: pass tBinary */ -/* if ((result==COMPRESS_RESULT_WARNING)&&hasFlag(verbose_flag)) - fprintf(outputStream,PR_TEXT_EXPORT_BMP_WARN);*/ + *error=mExpandGraphic(cont,image); if (*error==PR_RESULT_COMPRESS_RESULT_FATAL) { free(image); return NULL; } -/* - image->pal=palette; - bits=objectPaletteGetBitRate(image->pal); - if (bits && bits!=getCarry(image->type)) printf("error, palette mismatch (pal=%d bits=%d)\n",bits,getCarry(image->type)); - image->bits=getCarry(image->type);*/ - image->colorCount=2; + image->colorCount=16; return (void*)image; } diff --git a/PR/src/lib/object/image/image2.c b/PR/src/lib/object/image/image2.c index 98d9392..67fd155 100644 --- a/PR/src/lib/object/image/image2.c +++ b/PR/src/lib/object/image/image2.c @@ -115,9 +115,8 @@ void* objectImage2Create(tBinary cont, int *error) { /* use get like main.c */ image=(tImage*)malloc(sizeof(tImage)); /* Expand graphic and check results */ - *error=mExpandGraphic(cont,image); /* TODO: pass tBinary */ -/* if ((result==COMPRESS_RESULT_WARNING)&&hasFlag(verbose_flag)) - fprintf(outputStream,PR_TEXT_EXPORT_BMP_WARN);*/ + *error=mExpandGraphic(cont,image); + if (*error==PR_RESULT_COMPRESS_RESULT_FATAL) { free(image); return NULL; diff --git a/PR/src/lib/object/image/image_common.c b/PR/src/lib/object/image/image_common.c index aea719f..57658d2 100644 --- a/PR/src/lib/object/image/image_common.c +++ b/PR/src/lib/object/image/image_common.c @@ -214,9 +214,8 @@ int mExpandGraphic(tBinary input, tImage *image) { return result; /* Ok */ } -/* Compress an image into binary data TODO: send to common image */ int mCompressGraphic(tBinary* input, tBinary* output, int ignoreFirstBytes, int w, int h) { -/* unsigned char* *data,tImage* image, int* dataSizeInBytes, int ignoreFirstBytes) {*/ + /* Declare variables */ unsigned char* compressed [COMPRESS_WORKING_ALGORITHMS]; int compressedSize [COMPRESS_WORKING_ALGORITHMS]; diff --git a/PR/src/lib/object/sound/sound_common.c b/PR/src/lib/object/sound/sound_common.c index 36913c5..bac2090 100644 --- a/PR/src/lib/object/sound/sound_common.c +++ b/PR/src/lib/object/sound/sound_common.c @@ -43,6 +43,8 @@ sounds.c: Princed Resources : Common sound object implementation #include "dat.h" #include "types.h" +#include "sound.h" + /***************************************************************\ | Binary Object | \***************************************************************/ @@ -92,34 +94,13 @@ void* objectSoundWaveRead(const char* file, int *result) { return (void*)o; } -/* TODO: factorize */ -int objectSoundWaveSet(void* o,tResource* res) { - tBinary* wave=o; - res->content.size=wave->size+1; - res->content.data=malloc(wave->size+1); - res->content.data[0]=0x01; /* TODO: use WAVE_MAGIC */ - memcpy(res->content.data+1,wave->data,wave->size); - mWriteFileInDatFile(res); - return PR_RESULT_SUCCESS; -} - -int objectSoundMidiSet(void* o,tResource* res) { - tBinary* midi=o; - res->content.size=midi->size+1; - res->content.data=malloc(midi->size+1); - res->content.data[0]=0x02; /* TODO: use MIDI_MAGIC */ - memcpy(res->content.data+1,midi->data,midi->size); +int objectSoundSet(void* o,tResource* res, tSoundType soundType) { + tBinary* sound=o; + res->content.size=sound->size+1; + res->content.data=malloc(sound->size+1); + res->content.data[0]=(unsigned char)soundType; + res->content.isCopy=0; + memcpy(res->content.data+1,sound->data,sound->size); mWriteFileInDatFile(res); return PR_RESULT_SUCCESS; } - -int objectSoundPcspeakerSet(void* o,tResource* res) { - tBinary* pcspeaker=o; - res->content.size=pcspeaker->size+1; - res->content.data=malloc(pcspeaker->size+1); - res->content.data[0]=0x00; /* TODO: use PCSPEAKER_MAGIC */ - memcpy(res->content.data+1,pcspeaker->data,pcspeaker->size); - mWriteFileInDatFile(res); - return PR_RESULT_SUCCESS; -} - diff --git a/PR/src/ports/winfiles/pr.dev b/PR/src/ports/winfiles/pr.dev index a06d3e3..5831a63 100644 --- a/PR/src/ports/winfiles/pr.dev +++ b/PR/src/ports/winfiles/pr.dev @@ -933,7 +933,7 @@ BuildCmd= Major=1 Minor=3 Release=0 -Build=81 +Build=84 LanguageID=2057 CharsetID=1252 CompanyName=Princed development team