prefs->set_lastfile(longname);  updateLoaded (); for(i=strlen(longname);i>=0;i--) if( longname[i] == '/' ){ i++; break; } UI_setTitle(longname+i); free(longname); }
int A_openAvi2 (char *name, uint8_t mode){  uint8_t res;  if (playing)    return 0;  /// check if name exists  FILE *fd;  fd = fopen (name, "rb");  if (!fd)    return 0;  fclose (fd);  if (avifileinfo)		// already opened ?    {				// delete everything      // if preview is on      if (mode_preview)	GUI_PreviewEnd ();      delete avifileinfo;      //delete wavinfo;      wavinfo = (WAVHeader *) NULL;      avifileinfo = (aviInfo *) NULL;      video_body->cleanup ();      curframe = 0;      currentaudiostream = NULL;      changeAudioStream (NULL, AudioNone);      filterCleanUp ();      if (rdr_decomp_buffer)	{	  free (rdr_decomp_buffer);	  rdr_decomp_buffer = NULL;	}    }  DIA_StartBusy ();  if (mode)    res = video_body->addFile (name, 1);  else    res = video_body->addFile (name);  DIA_StopBusy ();  if (res!=ADM_OK)			// an error occured    {    	if(ADM_IGN==res) 	{		return 0;	}	      currentaudiostream = NULL;      avifileinfo = NULL;      GUI_Alert ("Problem opening that file!");      return 0;    }	{ char *longname = PathCanonize(name);	  int i;		// remember this file		prefs->set_lastfile(longname);		updateLoaded ();		for(i=strlen(longname);i>=0;i--)			if( longname[i] == '/' ){				i++;				break;			}		UI_setTitle(longname+i);		free(longname);	}	return 1;}