//--------------------------------------------------------------------------- bool File_Cdxa::Synchronize() { //Synchronizing while ( Buffer_Offset+2352*3+12<=Buffer_Size && !(CC8(Buffer+Buffer_Offset+2352*0)==0x00FFFFFFFFFFFFFFLL && CC4(Buffer+Buffer_Offset+2352*0+8)==0xFFFFFF00 && CC8(Buffer+Buffer_Offset+2352*1)==0x00FFFFFFFFFFFFFFLL && CC4(Buffer+Buffer_Offset+2352*1+8)==0xFFFFFF00 && CC8(Buffer+Buffer_Offset+2352*2)==0x00FFFFFFFFFFFFFFLL && CC4(Buffer+Buffer_Offset+2352*2+8)==0xFFFFFF00 && CC8(Buffer+Buffer_Offset+2352*3)==0x00FFFFFFFFFFFFFFLL && CC4(Buffer+Buffer_Offset+2352*3+8)==0xFFFFFF00)) Buffer_Offset++; if (Buffer_Offset+2352*3+12>Buffer_Size) return false; //Synched is OK return true; }
//--------------------------------------------------------------------------- bool File_ExtendedModule::FileHeader_Begin() { //Element_Size if (Buffer_Size<38) return false; //Must wait for more data if (CC8(Buffer)!=0x457874656E646564LL || CC8(Buffer+8)!=0x204D6F64756C653ALL //"Extended Module: " || CC1(Buffer+16)!=0x20 || CC1(Buffer+37)!=0x1A) { Reject("Extended Module"); return false; } //All should be OK... return true; }
//--------------------------------------------------------------------------- bool File_Cdxa::Synched_Test() { //Must have enough buffer for having header if (Buffer_Offset+12>Buffer_Size) return false; //Quick test of synchro if (!(CC8(Buffer+Buffer_Offset)==0x00FFFFFFFFFFFFFFLL && CC4(Buffer+Buffer_Offset+8)==0xFFFFFF00)) Synched=false; //We continue return true; }
//--------------------------------------------------------------------------- bool File_N19::FileHeader_Begin() { //Element_Size if (Buffer_Size<11) return false; //Must wait for more data int64u DiskFormatCode=CC8(Buffer+3); if (DiskFormatCode!=0x53544C32352E3031LL && DiskFormatCode!=0x53544C33302E3031LL) { Reject("N19"); return false; } //All should be OK... return true; }
//--------------------------------------------------------------------------- bool File_Cdxa::Header_Begin() { //Must have enough buffer for having header if (Buffer_Offset+12>Buffer_Size) return false; //Quick test of synchro if (Synched && !(CC8(Buffer+Buffer_Offset)==0x00FFFFFFFFFFFFFFLL && CC4(Buffer+Buffer_Offset+8)==0xFFFFFF00)) { Trusted_IsNot("CDXA, Synchronisation lost"); Synched=false; } //Synchro if (!Synched && !Synchronize()) return false; //All should be OK... return true; }
//--------------------------------------------------------------------------- void File_ApeTag::Header_Parse() { //Testing if begin or end of tags if (CC8(Buffer+Buffer_Offset)==0x4150455441474558LL) //"APETAGEX" { //Filling Header_Fill_Code((int64u)-1, "File Footer"); Header_Fill_Size(0x20); return; } //Parsing Ztring Value; int32u Flags, Length; Get_L4 (Length, "Length"); Get_L4 (Flags, "Flags"); Skip_Flags(Flags, 0, "Read Only"); Skip_Flags(Flags, 1, "Binary"); Skip_Flags(Flags, 2, "Locator of external stored information"); Skip_Flags(Flags, 29, "Is the header"); Skip_Flags(Flags, 30, "Contains a footer"); Skip_Flags(Flags, 31, "Contains a header"); size_t Pos=(size_t)Element_Offset; for (; Pos<Element_Size; Pos++) if (Buffer[Buffer_Offset+Pos]==0x00) break; if (Pos==Element_Size) { Element_WaitForMoreData(); return; } Get_String(Pos-Element_Offset, Key, "Key"); Skip_L1( "0x00"); //Filling Header_Fill_Code(0, Key.c_str()); Header_Fill_Size(Element_Offset+Length); }