private void decomposeHeader() { //data grabbed from 4 first bytes (converted to bits) int dataInitial = CGeneric.ConvertByteArrayToInt(CGeneric.GiveMeArray(rawData, 0, 4)); //set flags transparencybit = CGeneric.GetBitStateFromInt(dataInitial, 22); extra2 = CGeneric.GetBitStateFromInt(dataInitial, 26); //set unknown flags bit19 = CGeneric.GetBitStateFromInt(dataInitial, 19); bit20 = CGeneric.GetBitStateFromInt(dataInitial, 20); bit21 = CGeneric.GetBitStateFromInt(dataInitial, 21); bit23 = CGeneric.GetBitStateFromInt(dataInitial, 23); bit24 = CGeneric.GetBitStateFromInt(dataInitial, 24); bit25 = CGeneric.GetBitStateFromInt(dataInitial, 25); bit27 = CGeneric.GetBitStateFromInt(dataInitial, 27); bit28 = CGeneric.GetBitStateFromInt(dataInitial, 28); bit29 = CGeneric.GetBitStateFromInt(dataInitial, 29); bit30 = CGeneric.GetBitStateFromInt(dataInitial, 30); bit31 = CGeneric.GetBitStateFromInt(dataInitial, 31); bit32 = CGeneric.GetBitStateFromInt(dataInitial, 32); if (transparencybit) { this.transparency = rawData[31]; } if (rawData[3] != 8) { this.isCompressedTexture = true; } this.textureIndex = rawData[27]; this.posX = CGeneric.ConvertByteArrayToInt(CGeneric.GiveMeArray(rawData, 4, 4)); this.posY = CGeneric.ConvertByteArrayToInt(CGeneric.GiveMeArray(rawData, 8, 4)); }
public static int GetHeaderLength(int headerValue) { var result = 28; if (CGeneric.GetBitStateFromInt(headerValue, 22)) { result += 4; } if (CGeneric.GetBitStateFromInt(headerValue, 26)) { result += 8; } return(result); //unknown data for now //switch (headerValue) //{ // case 0x00000000: return 0x1C; // case 0x00000002: return 0x1C; //tested // case 0x00000004: return 0x1C; //tested // case 0x00000006: return 0x1C; // case 0x00000008: return 0x1C; //tested // case 0x0000000C: return 0x1C; // case 0x00000040: return 0x24; //tested // case 0x00000044: return 0x24; //tested // case 0x00000080: return 0x1C; //tested // case 0x00000082: return 0x1C; // case 0x00000084: return 0x1C; //tested // case 0x00000200: return 0x1C; // case 0x00000400: return 0x20; //tested // case 0x00000402: return 0x20; // case 0x00000404: return 0x20; // case 0x00000406: return 0x20; //tested // case 0x00000482: return 0x20; // case 0x00002000: return 0x1C; // case 0x00002006: return 0x1C; //tested // case 0x00002040: return 0x24; // case 0x00002406: return 0x20; //tested // //test cas ISO only // case 0x00000664: return 0x28;//old vavlue 1C // case 0x00000764: return 0x28; // case 0x00000C02: return 0x20; // //case 0x000000D2: return 0x1C; //not exists // //case 0x000000D3: return 0x1C; //not exists // case 0x00000091: return 0x1C; // case 0x0000008C: return 0x1C; // case 0x00000010: return 0x1C; // case 0x00000210: return 0x1C; // case 0x00000204: return 0x1C; // case 0x00000104: return 0x1C; // case 0x00001000: return 0x1C; // case 0x00000001: return 0x1C;//tested // case 0x00000502: return 0x20; // case 0x00000202: return 0x1C; // //case 0x00000020: return 0x18;//not exist // default: throw new NotImplementedException(); //} }