author | ecalot
<ecalot> 2006-02-23 05:02:43 UTC |
committer | ecalot
<ecalot> 2006-02-23 05:02:43 UTC |
parent | 869a96308b0c437ea9959da4f10b1dc65626351f |
PR/src/include/object.h | +1 | -1 |
PR/src/include/sound.h | +3 | -0 |
PR/src/lib/actions/import.c | +2 | -2 |
PR/src/lib/object/object.c | +27 | -1 |
PR/src/lib/object/sound/sound_common.c | +8 | -0 |
diff --git a/PR/src/include/object.h b/PR/src/include/object.h index 8f12cec..6a6ee9f 100644 --- a/PR/src/include/object.h +++ b/PR/src/include/object.h @@ -40,7 +40,7 @@ object.h: Princed Resources : Main item class types and prototypes tObject getObject(tResource* r, int* error); int writeObject(tObject o, const char* file, int optionflag, const char* backupExtension); tObject readObject(const char* file,tResource* newRes,int *result); -void setObject(tObject o,int *result); +void setObject(tObject o,int *result,tResource* res); int paletteGetBits(tObject pal); int paletteGetColors(tObject pal); diff --git a/PR/src/include/sound.h b/PR/src/include/sound.h index ec6bebd..e271b42 100644 --- a/PR/src/include/sound.h +++ b/PR/src/include/sound.h @@ -34,6 +34,7 @@ sound.h: Princed Resources : #define _SOUND_H_ #include "binary.h" +#include "reslist.h" #include "mid.h" #include "wav.h" @@ -55,4 +56,6 @@ void* objSoundRead(const char* file, int read(const char* file, tBinary* c, int void* objWaveRead(const char* file, int *result); +int objWaveSet(void* o,tResource* res); + #endif diff --git a/PR/src/lib/actions/import.c b/PR/src/lib/actions/import.c index 575b96a..499330d 100644 --- a/PR/src/lib/actions/import.c +++ b/PR/src/lib/actions/import.c @@ -92,7 +92,7 @@ int import_full(const char* vFiledat, const char* vDirExt, tResourceList* r, int /* TODO: let each format handle the files */ o=readObject(vFileext,&newRes,&result); /* if (!fatal(ok)) */ - setObject(o,&result); + setObject(o,&result,&newRes); /* if (!fatal(ok)) { if (hasFlag(verbose_flag)) fprintf(outputStream,PR_TEXT_IMPORT_ERRORS,getFileNameFromPath(vFileext)); @@ -159,7 +159,7 @@ int import_partial(const char* vFiledat, const char* vDirExt, tResourceList* r, o=readObject(repairFolders(vFileext),&newRes,&result); /* if (!fatal(ok)) */ - setObject(o,&result); + setObject(o,&result,&newRes); /* the file is in the partial matching list, so I'll import */ /* newRes.content=mLoadFileArray(vFileext); diff --git a/PR/src/lib/object/object.c b/PR/src/lib/object/object.c index 2188450..755b40a 100644 --- a/PR/src/lib/object/object.c +++ b/PR/src/lib/object/object.c @@ -130,7 +130,33 @@ tColor* paletteGetColorArray(tObject pal) { | Dat compiling primitive | \***************************************************************/ -void setObject(tObject o,int *result) { +void setObject(tObject o,int *result,tResource* res) { + switch (o.type) { + case eResTypeLevel: + /*o.obj=objLevelRead(file,res.content,result);*/ + break; + case eResTypeImage: + /*o.obj=objImageRead(file,res.content,res.palette,result);*/ + break; + case eResTypeWave: + *result=objWaveSet(o.obj,res); + /*o.obj=objWaveRead(file,result);*/ + break; + case eResTypeMidi: + /*o.obj=objMidiRead(file,res.content,result);*/ + break; + case eResTypePcspeaker: + /*o.obj=objPcspeakerRead(file,res.content,result);*/ + break; + case eResTypePop1Palette4bits: + /*o.obj=objPop1Palette4bitsRead(file,res.content,result);*/ + break; + case eResTypeBinary: + default: + /*o.obj=objBinaryRead(file,result);*/ + break; + } + } /* Format detection function (private function, not in header file) */ diff --git a/PR/src/lib/object/sound/sound_common.c b/PR/src/lib/object/sound/sound_common.c index da27043..b9c2403 100644 --- a/PR/src/lib/object/sound/sound_common.c +++ b/PR/src/lib/object/sound/sound_common.c @@ -39,6 +39,8 @@ wave.c: Princed Resources : #include "common.h" #include "wav.h" #include <stdlib.h> +#include "dat.h" +#include "reslist.h" /***************************************************************\ | Binary Object | @@ -87,5 +89,11 @@ void* objWaveRead(const char* file, int *result) { } +int objWaveSet(void* o,tResource* res) { + tBinary* wave=o; + res->content=*wave; + mWriteFileInDatFile(res); + return PR_RESULT_SUCCESS; +}