Changeset 544 for abuse/trunk


Ignore:
Timestamp:
Apr 28, 2011, 1:07:39 AM (12 years ago)
Author:
Sam Hocevar
Message:

imlib: get rid of fast path loading, it was no longer used. We also
delete the old cache file we put in the user's directory.

Location:
abuse/trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/game.cpp

    r541 r544  
    13391339}
    13401340
    1341 extern void fast_load_start_recording(char *name);
    1342 extern void fast_load_stop_recording();
    1343 extern void fast_load_start_reloading(char *name);
    1344 extern void fast_load_stop_reloading();
    1345 
    13461341Game::Game(int argc, char **argv)
    13471342{
     
    13841379  else has_joystick = 0;
    13851380
     1381    // Clean up that old crap
     1382    char *fastpath = (char *)malloc(strlen(get_save_filename_prefix()) + 13);
     1383    sprintf(fastpath, "%sfastload.dat", get_save_filename_prefix());
     1384    unlink(fastpath);
     1385    free(fastpath);
     1386
    13861387//    ProfilerInit(collectDetailed, bestTimeBase, 2000, 200); //prof
    1387     char *fastpath;
    1388     fastpath = (char *)malloc(strlen(get_save_filename_prefix()) + 12 + 1);
    1389     sprintf(fastpath, "%sfastload.dat", get_save_filename_prefix());
    1390     fast_load_start_recording(fastpath);
    13911388    load_data(argc, argv);
    1392     fast_load_stop_recording();
    1393     free(fastpath);
    13941389//    ProfilerDump("\pabuse.prof");  //prof
    13951390//    ProfilerTerm();
  • abuse/trunk/src/imlib/specs.cpp

    r542 r544  
    6868static spec_directory spec_main_sd;
    6969
    70 static int fast_load_fd = -1;
    71 static int fast_load_mode = 0;
    72 
    7370void set_filename_prefix(char const *prefix)
    7471{
     
    280277}
    281278
    282 void fast_load_start_recording(char *filename)
    283 {
    284     fast_load_fd = ::open(filename,O_CREAT|O_RDWR,S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
    285     fast_load_mode = 1;
    286 }
    287 
    288 void fast_load_stop_recording()
    289 {
    290     fast_load_mode = 0;
    291 }
    292 
    293 void fast_load_start_reloading(char *filename)
    294 {
    295     fast_load_fd = ::open(filename,O_RDONLY);
    296     fast_load_mode = 2;
    297 }
    298 
    299 void fast_load_stop_reloading()
    300 {
    301     fast_load_mode = 0;
    302 }
    303 
    304279jFILE::jFILE(FILE *file_pointer)                       // assumes fp is at begining of file
    305280{
     
    475450    if (fd == spec_main_fd)
    476451    {
    477         switch (fast_load_mode)
    478         {
    479         case 0:
    480             if (current_offset+start_offset != spec_main_offset)
    481                 spec_main_offset = lseek(fd, start_offset+current_offset, SEEK_SET);
    482 
    483             len = ::read(fd,(char*)buf,count);
    484             break;
    485         case 1:
    486             if (current_offset+start_offset != spec_main_offset)
    487                 spec_main_offset = lseek(fd, start_offset+current_offset, SEEK_SET);
    488 
    489             len = ::read(fd,(char*)buf,count);
    490             ::write(fast_load_fd,(char*)&len,sizeof(len));
    491             ::write(fast_load_fd,(char*)buf,len);
    492             break;
    493         case 2:
    494             ::read(fast_load_fd,(char*)&len,sizeof(len));
    495             len = ::read(fast_load_fd,(char*)buf,len);
    496             break;
    497         }
    498 
     452        if (current_offset+start_offset != spec_main_offset)
     453            spec_main_offset = lseek(fd, start_offset+current_offset, SEEK_SET);
     454
     455        len = ::read(fd,(char*)buf,count);
    499456        spec_main_offset += len;
    500457    }
    501458    else
    502459    {
    503         switch (fast_load_mode)
    504         {
    505         case 0:
    506           len = ::read(fd,(char*)buf,count);
    507           break;
    508         case 1:
    509           len = ::read(fd,(char*)buf,count);
    510             ::write(fast_load_fd,(char*)&len,sizeof(len));
    511             ::write(fast_load_fd,(char*)buf,len);
    512           break;
    513         case 2:
    514             ::read(fast_load_fd,(char*)&len,sizeof(len));
    515             len = ::read(fast_load_fd,(char*)buf,len);
    516             if (count != len)
    517                 printf("short read! %ld:%ld\n",current_offset,len);
    518           break;
    519       }
     460      len = ::read(fd,(char*)buf,count);
    520461    }
    521462    current_offset += len;
     
    533474{
    534475  long ret;
    535 
    536   if (fast_load_mode == 2)
    537   {
    538     switch (whence)
    539     {
    540     case SEEK_SET :
    541       current_offset = start_offset+offset;
    542       break;
    543     case SEEK_END :
    544       current_offset = start_offset+file_length-offset;
    545       break;
    546     case SEEK_CUR :
    547       current_offset += offset;
    548       break;
    549     default:
    550       ret = -1;
    551       break;
    552     }
    553     return current_offset;
    554   }
    555476
    556477  switch (whence)
Note: See TracChangeset for help on using the changeset viewer.