void z3ResEx::parseMsf( TMemoryStream &msf ) { switch( m_fileindexVer ) { case 0 : { unsigned char method( 0 ); FILEINDEX_ENTRY info; unsigned char *strMRFN( nullptr ); unsigned char *strName( nullptr ); unsigned int items( 0 ), errors( 0 ); while( ( msf.Position() < msf.Size() ) && ( errors < MAX_ERRORS ) ) { method = msf.ReadByte(); msf.Read( &info, sizeof( FILEINDEX_ENTRY ) ); unpackStringEx( msf, strMRFN, info.lenMRFN ); unpackStringEx( msf, strName, info.lenName ); if( m_listContents ) { printf( "%s (%u bytes)\n", strName, info.size ); } else { if( !( extractItem( info, method, (char *)strMRFN, (char *)strName ) ) ) ++errors; } ++items; delete strMRFN; delete strName; } printf( "Processed %u items (%u issues)\n\n", items, errors ); break; } case 1 : { parseMsfMethod2( msf ); break; } } }
void z3ResEx::parseMsf( TMemoryStream &msf ) { switch( m_fileindexVer ) { case 0 : { unsigned char method( 0 ); FILEINDEX_ENTRY info; vector<unsigned char> strMRFN(MAX_STRING_SIZE); vector<unsigned char> strName(MAX_STRING_SIZE); unsigned int items( 0 ), errors( 0 ); while( ( msf.Position() < msf.Size() ) && ( errors < MAX_ERRORS ) ) { method = msf.ReadByte(); msf.Read( &info, sizeof( FILEINDEX_ENTRY ) ); unpackStringEx(msf, strMRFN, info.lenMRFN); unpackStringEx(msf, strName, info.lenName); if( m_listContents ) { printf( "%s (%u bytes)\n", &strName[0], info.size ); } else { if( !( extractItem( info, method, reinterpret_cast<const char*>(&strMRFN[0]), reinterpret_cast<const char*>(&strName[0]) ) ) ) ++errors; } ++items; } printf( "Processed %u items (%u issues)\n\n", items, errors ); break; } case 1 : { parseMsfMethod2( msf ); break; } } }