AS_PRINTF(1, 2) NORETURN inline void loader_failure(const char *format=NULL, ...) { va_list va; va_start(va, format); vloader_failure(format, va); #ifdef __BORLANDC__ // NOTREACHED va_end(va); #endif }
//---------------------------------------------------------------------- // // loads the whole file into IDA // this is a wrapper function, which: // // - checks the header for validity and fixes broken headers // - creates all necessary segments // - saves the whole file to blobs // - loads prg pages/banks // - adds informational descriptions to the database // static void load_ines_file( linput_t *li ) { // go to file offset 0 - just to be sure qlseek(li, 0, SEEK_SET); // read the whole header if( qlread(li, &hdr, sizeof(ines_hdr)) != sizeof(ines_hdr) ) vloader_failure("File read error!",0); // check if header is corrupt // show a warning msg, but load the rom nonetheless if( is_corrupt_ines_hdr() ) { //warning("The iNES header seems to be corrupt.\nLoader might give inaccurate results!"); int code = askyn_c(1, "The iNES header seems to be corrupt.\n" "The NES loader could produce wrong results!\n" "Do you want to internally fix the header ?\n\n" "(this will not affect the input file)"); if( code == 1 ) fix_ines_hdr(); } // create NES segments create_segments( li ); // save NES file to blobs save_image_as_blobs( li ); // load relevant ROM banks into database load_rom_banks( li ); // make vectors public add_entry_points( li ); // fill inf structure set_ida_export_data(); // add information about the ROM image describe_rom_image(); // let IDA add some information about the loaded file create_filename_cmt(); }