git » fp-git.git » commit d9db3fe

started hooking pop2 256 bits palette

author ecalot
2006-03-07 10:52:49 UTC
committer ecalot
2006-03-07 10:52:49 UTC
parent 2e0dc0a3c19a4e37c9f78509eb6f45bb9fc9cca4

started hooking pop2 256 bits palette

PR/src/lib/actions/export.c +1 -0
PR/src/lib/layers/autodetect.c +9 -4

diff --git a/PR/src/lib/actions/export.c b/PR/src/lib/actions/export.c
index 79ec011..2a31695 100644
--- a/PR/src/lib/actions/export.c
+++ b/PR/src/lib/actions/export.c
@@ -114,6 +114,7 @@ int extract(const char* vFiledat,const char* vDirExt, tResourceList* r, int opti
 
 				/* handle palette linking */
 				switch (res.type) { /* TODO: use if and elsif */
+					case eResTypePop2Palette4bits: 
 					case eResTypePop1Palette4bits: { /* save and remember palette file */
 						tPaletteListItem e; /* TODO: decide if the palette list has to be erased from the code */
 						o=e.pal=currentPalette=getObject(&res,&ok);
diff --git a/PR/src/lib/layers/autodetect.c b/PR/src/lib/layers/autodetect.c
index ba3dd00..eec642e 100644
--- a/PR/src/lib/layers/autodetect.c
+++ b/PR/src/lib/layers/autodetect.c
@@ -72,13 +72,17 @@ int verifyImage256Header(tBinary c) {
 	 */
 }
 
-int verifyPaletteHeader(tBinary c) {
+int verifyPaletteHeaderPop1(tBinary c) {
+	return (
+		((c.size==101)&&(!c.data[2])&&(!c.data[3])&&(c.data[4]==0x10))
+	);
+}
+
+int verifyPaletteHeaderPop2(tBinary c) {
 	tBinary c2;
 	c2.size=c.size-1;
 	c2.data=c.data+1;
 	return (
-		((c.size==101)&&(!c.data[2])&&(!c.data[3])&&(c.data[4]==0x10))
-		||
 		((c.size==(256*3+1)||c.size==(320*3+1))&&isA64kPalette(c2))
 	);
 }
@@ -114,7 +118,8 @@ tResourceType verifyHeader(tBinary c) { /* TODO: add the pop version as another
 	if (verifyMidiHeader     (c)) return eResTypeMidi;
 	if (verifyImage16Header  (c)) return eResTypeImage16;
 	if (verifyImage256Header (c)) return eResTypeImage256;
-	if (verifyPaletteHeader  (c)) return eResTypePop1Palette4bits;
+	if (verifyPaletteHeaderPop1  (c)) return eResTypePop1Palette4bits;
+	if (verifyPaletteHeaderPop2  (c)) return eResTypePop2Palette4bits;
 	if (verifyWaveHeader     (c)) return eResTypeWave;
 	if (verifySpeakerHeader  (c)) return eResTypePcspeaker;
 	return eResTypeBinary;