git » fp-git.git » commit eb7b4a8

tested: now again bin files may be extracted and imported

author ecalot
2006-02-25 00:03:58 UTC
committer ecalot
2006-02-25 00:03:58 UTC
parent bcdc767bbd14e114872bfed3f953923af9b14def

tested: now again bin files may be extracted and imported

PR/src/include/other.h +1 -0
PR/src/lib/object/object.c +3 -3
PR/src/lib/object/other/binary.c +8 -0

diff --git a/PR/src/include/other.h b/PR/src/include/other.h
index 00f06f5..c3b9acd 100644
--- a/PR/src/include/other.h
+++ b/PR/src/include/other.h
@@ -38,5 +38,6 @@ other.h: Princed Resources :
 void* objBinaryCreate(tBinary c, int *error);
 int objBinaryWrite(void* o, const char* file, int optionflag, const char* backupExtension);
 void* objBinaryRead(const char* file,int *result);
+int objBinarySet(void* o,tResource* res);
 
 #endif
diff --git a/PR/src/lib/object/object.c b/PR/src/lib/object/object.c
index ae87082..8a8a0ea 100644
--- a/PR/src/lib/object/object.c
+++ b/PR/src/lib/object/object.c
@@ -89,7 +89,8 @@ int writeObject(tObject o, const char* file, int optionflag, const char* backupE
 		break;
 	case eResTypeBinary: /* Binary files */
 	case eResTypeText: /* Text files */
-	case eResTypeRaw: /* Raw files */
+	case eResTypeRaw: /* Raw/autodetect files */
+		error=objBinaryWrite(o.obj,file,optionflag,backupExtension);
 		break;
 	case eResTypePop1Palette4bits: /* save and remember palette file */
 		error=objPalette_pop1_4bitsWrite(o.obj,file,optionflag,backupExtension);
@@ -140,7 +141,6 @@ void setObject(tObject o,int *result,tResource* res) {
 			break;
 		case eResTypeWave:
 			*result=objWaveSet(o.obj,res);
-			/*o.obj=objWaveRead(file,result);*/
 			break;
 		case eResTypeMidi:
 			*result=objMidiSet(o.obj,res);
@@ -153,7 +153,7 @@ void setObject(tObject o,int *result,tResource* res) {
 			break;
 		case eResTypeBinary:
 		default:
-			/*o.obj=objBinaryRead(file,result);*/
+			*result=objBinarySet(o.obj,res);
 			break;
 	}
 	
diff --git a/PR/src/lib/object/other/binary.c b/PR/src/lib/object/other/binary.c
index f530d03..cb217e5 100644
--- a/PR/src/lib/object/other/binary.c
+++ b/PR/src/lib/object/other/binary.c
@@ -37,6 +37,8 @@
 
 #include "binary.h" /* tBinary */
 #include "common.h"
+#include "dat.h" /* WriteDat */
+#include "reslist.h" /* tResources */
 #include "disk.h" /* we are skiping the format layer here */
 #include <stdlib.h>
 
@@ -67,3 +69,9 @@ void* objBinaryRead(const char* file,int *result) {
 	return objBinaryCreate(o,result);
 }
 
+int objBinarySet(void* o,tResource* res) {
+	tBinary* bin=o;
+	res->content=*bin;
+	mWriteFileInDatFile(res);
+	return PR_RESULT_SUCCESS;
+}