Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Diff of /ielister.cpp [5617b0] .. [44f623] Maximize Restore

  Switch to side-by-side view

--- a/ielister.cpp
+++ b/ielister.cpp
@@ -23,8 +23,8 @@
 #define stricmp strcasecmp
 
 #ifndef min
-#define min(a,b)  ( (a)>(b)?(b):(a) )
-#define max(a,b)  ( (a)>(b)?(a):(b) )
+#define min(a,b)	( (a)>(b)?(b):(a) )
+#define max(a,b)	( (a)>(b)?(a):(b) )
 #endif
 
 int filelength(int fhandle)
@@ -36,22 +36,23 @@
 }
 #endif
 
-#define FT_ITM  1
-#define FT_SPL  2
-#define FT_CRE  3
-#define FT_STO  4
-#define FT_ARE  5
-#define FT_CHU  6
-#define FT_EFF  7
-#define FT_VVC  8
-#define FT_PRO  9
-#define FT_DLG  10
-#define FT_CHR  11
-#define FT_GAM  12
-#define FT_WED  13
-#define FT_WMP  14
-#define FT_VEF  15
-#define FT_WFX  16
+#define FT_ITM	1
+#define FT_SPL	2
+#define FT_CRE	3
+#define FT_STO	4
+#define FT_ARE	5
+#define FT_CHU	6
+#define FT_EFF	7
+#define FT_VVC	8
+#define FT_PRO	9
+#define FT_DLG	10
+#define FT_CHR	11
+#define FT_GAM	12
+#define FT_WED	13
+#define FT_WMP	14
+#define FT_VEF	15
+#define FT_WFX	16
+#define FT_BAM	17
 
 #define supportedextension1 ".itm"
 #define supportedextension2 ".spl"
@@ -69,6 +70,7 @@
 #define supportedextension14 ".wmp"
 #define supportedextension15 ".vef"
 #define supportedextension16 ".wfx"
+#define supportedextension17 ".bam"
 
 #ifdef WIN32
 /* Note: in C, double quotes inside a string need to be escaped with a backslash! */
@@ -89,6 +91,7 @@
 	"(ext=\"WMP\") | " \
 	"(ext=\"WFX\") | " \
 	"(ext=\"VEF\") | " \
+	"(ext=\"BAM\") | " \
 	"(ext=\"CHR\")"
 #endif
 
@@ -3298,6 +3301,118 @@
 	free(ctable);
 }
 
+void CreateOutputBAM(OutStream &os)
+{
+	int offset1, offset2, offset3;
+	int count1, count2, count3;
+	char tmpstr[20];
+	int i,j;
+	bool bamv2 = false;
+
+	if (os.signature[3]=='C')
+	{
+		os.AddBitmap(0,"Can't decode compressed bam");
+		return;
+	}
+	if (os.signature[5]=='2')
+	{
+		count1 = os.AddDword("Frames");
+		count2 = os.AddDword("Cycles");
+		count3 = os.AddDword("Quads");
+		offset1 = os.AddDword("Frame offset");
+		offset2 = os.AddDword("Cycles offset");
+		offset3 = os.AddDword("Quads offset");
+		bamv2 = true;
+	}
+	else
+	{
+		count1 = os.AddWord("Frames");
+		count2 = os.AddByte("Cycles");
+		os.AddByte("RLE key");
+		offset1 = os.AddDword("Frame offset");
+		offset2 = os.AddDword("Palette offset");
+		offset3 = os.AddDword("Lookup table");
+	}
+
+	for(i=0;i<3;i++) {
+		if(offset1==os.fileoffset) {
+			offset1 = 0;
+			for (j=0;j<count1;j++) {
+				sprintf(tmpstr,"Frame #%d",j+1);
+				os.AddString(0, tmpstr);
+				os.AddIndent();
+				os.AddWord("Width");
+				os.AddWord("Height");
+				os.AddPoint("Center");
+				if (bamv2) {
+					os.AddWord("Quad index");
+					os.AddWord("Quad count");
+				} else {
+					os.AddDword("Offset");
+				}
+				os.EndIndent();
+			}
+			if (!bamv2) {
+				for (j=0;j<count2;j++) {
+					sprintf(tmpstr,"Cycle #%d",j+1);
+					os.AddString(0, tmpstr);
+					os.AddIndent();
+					os.AddWord("Frame count");
+					os.AddWord("Lookup index");
+					os.EndIndent();
+				}
+			}
+			continue;
+		}
+		if(offset2==os.fileoffset) {
+			offset2 = 0;
+			if (bamv2) {
+				for (j=0;j<count2;j++) {
+					sprintf(tmpstr,"Cycle #%d",j+1);
+					os.AddString(0, tmpstr);
+					os.AddIndent();
+					os.AddWord("Frame count");
+					os.AddWord("Frame index");
+					os.EndIndent();
+				}
+			} else {
+				os.AddBitmap(256*4,"Palette data");
+			}
+			continue;
+		}
+		if(offset3==os.fileoffset) {
+			if (bamv2) {
+				for (j=0;j<count3;j++) {
+					sprintf(tmpstr,"Quad #%d",j+1);
+					os.AddString(0, tmpstr);
+					os.AddIndent();
+					os.AddDword("Texture index");
+					os.AddPointLong("Position in pvr");
+					os.AddDword("Width");
+					os.AddDword("Height");
+					os.AddPointLong("Shift");
+					os.EndIndent();
+				}
+			} else {
+				if(offset2>offset3) {
+					count3 = offset2-offset3;
+				}
+				if(offset1>offset3) {
+					count3 = offset1-offset3;
+				}
+				offset3 = 0;
+				os.AddString(0,"Lookup table");
+				count3/=2;
+				for (j=0;j<count3;j++) {
+					sprintf(tmpstr,"Frame #%d",j+1);
+					os.AddWord(tmpstr);
+				}
+			}
+			continue;
+		}
+	}
+}
+
 void CreateOutputWFX(OutStream &os)
 {
 	os.AddDword("SR Curve");
@@ -3313,7 +3428,7 @@
 {
 	int offset1, offset2;
 	int count1, count2;
-	int i, j;
+	int i, j, k;
 
 	offset1 = os.AddDword("Offset 1");
 	count1 = os.AddDword("Count 1");
@@ -3323,26 +3438,28 @@
 		if(offset1==os.fileoffset) {
 			offset1 = 0;
 			os.AddString(0,"Primary Block");
-			for(j=0;i<count1;j++) {
+			for(j=0;j<count1;j++) {
 				os.AddDword("Start delay");
 				os.AddDword("UNKNOWN");
 				os.AddDword("Loop count");
 				os.AddDword("Type");
 				os.AddString(RESREFSIZE, "Resource");
 				os.AddDword("Continuous");
+				for(k=0;k<49;k++) os.AddDword("UNKNOWN");
 			}
 			continue;
 		}
 		if(offset2==os.fileoffset) {
 			offset2 = 0;
 			os.AddString(0,"Secondary Block");
-			for(j=0;i<count2;j++) {
+			for(j=0;j<count2;j++) {
 				os.AddDword("Start delay");
 				os.AddDword("UNKNOWN");
 				os.AddDword("Loop count");
 				os.AddDword("Type");
 				os.AddString(RESREFSIZE, "Resource");
 				os.AddDword("Continuous");
+				for(k=0;k<49;k++) os.AddDword("UNKNOWN");
 			}
 			continue;
 		}
@@ -4126,6 +4243,9 @@
 	case FT_WFX:
 		CreateOutputWFX(os);
 		break;
+	case FT_BAM:
+		CreateOutputBAM(os);
+		break;
 	}
 }
 
@@ -4243,6 +4363,10 @@
 	}
 	if(stricmp(p,supportedextension16)==0) {
 		filetype = FT_WFX;
+		goto ok;
+	}
+	if(stricmp(p,supportedextension17)==0) {
+		filetype = FT_BAM;
 		goto ok;
 	}
 #ifndef WIN32