IMG_lbm.c
changeset 117 e613cf987897
parent 104 e77df0fdb882
child 118 c5e736a47ad2
equal deleted inserted replaced
116:df32aeaf0b10 117:e613cf987897
    61     Sint16  Hpage;		/* height of the screen in pixels */
    61     Sint16  Hpage;		/* height of the screen in pixels */
    62 } BMHD;
    62 } BMHD;
    63 
    63 
    64 int IMG_isLBM( SDL_RWops *src )
    64 int IMG_isLBM( SDL_RWops *src )
    65 {
    65 {
       
    66 	int start;
    66 	int   is_LBM;
    67 	int   is_LBM;
    67 	Uint8 magic[4+4+4];
    68 	Uint8 magic[4+4+4];
    68 
    69 
       
    70 	start = SDL_RWtell(src);
    69 	is_LBM = 0;
    71 	is_LBM = 0;
    70 	if ( SDL_RWread( src, magic, 4+4+4, 1 ) )
    72 	if ( SDL_RWread( src, magic, sizeof(magic), 1 ) )
    71 	{
    73 	{
    72 		if ( !memcmp( magic, "FORM", 4 ) &&
    74 		if ( !memcmp( magic, "FORM", 4 ) &&
    73 			( !memcmp( magic + 8, "PBM ", 4 ) ||
    75 			( !memcmp( magic + 8, "PBM ", 4 ) ||
    74 			  !memcmp( magic + 8, "ILBM", 4 ) ) )
    76 			  !memcmp( magic + 8, "ILBM", 4 ) ) )
    75 		{
    77 		{
    76 			is_LBM = 1;
    78 			is_LBM = 1;
    77 		}
    79 		}
    78 	}
    80 	}
       
    81 	SDL_RWseek(src, start, SEEK_SET);
    79 	return( is_LBM );
    82 	return( is_LBM );
    80 }
    83 }
    81 
    84 
    82 SDL_Surface *IMG_LoadLBM_RW( SDL_RWops *src )
    85 SDL_Surface *IMG_LoadLBM_RW( SDL_RWops *src )
    83 {
    86 {