//------------------------------------------------- // audit_one_disk - validate a single disk entry //------------------------------------------------- audit_record audit_one_disk(ListPointer <rom_entry> rom, string locationtag = null) //const rom_entry *rom { // allocate and append a new record audit_record record = m_record_list.emplace_back(new audit_record(rom, audit_record.media_type.MEDIA_DISK)).Value; //audit_record &record = *m_record_list.emplace(m_record_list.end(), *rom, media_type::DISK); // open the disk chd_file source = new chd_file(); chd_error err = (chd_error)romload_global.open_disk_image(m_enumerator.options(), m_enumerator.driver(), rom[0], source, locationtag); // if we succeeded, get the hashes if (err == chd_error.CHDERR_NONE) { util.hash_collection hashes = new util.hash_collection(); // if there's a SHA1 hash, add them to the output hash if (source.sha1() != null) { hashes.add_sha1(source.sha1()); } // update the actual values record.set_actual(hashes); } // compute the final status compute_status(record, rom[0], err == chd_error.CHDERR_NONE); return(record); }
// file close //void close(); // read/write //chd_error read_hunk(UINT32 hunknum, void *buffer); //chd_error write_hunk(UINT32 hunknum, const void *buffer); //chd_error read_units(UINT64 unitnum, void *buffer, UINT32 count = 1); //chd_error write_units(UINT64 unitnum, const void *buffer, UINT32 count = 1); //chd_error read_bytes(UINT64 offset, void *buffer, UINT32 bytes); //chd_error write_bytes(UINT64 offset, const void *buffer, UINT32 bytes); // metadata management //chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, astring &output); //chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output); //chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 &resultlen); //chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output, chd_metadata_tag &resulttag, UINT8 &resultflags); //chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const void *inputbuf, UINT32 inputlen, UINT8 flags = CHD_MDFLAGS_CHECKSUM); //chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const astring &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input.cstr(), input.len() + 1, flags); } //chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const dynamic_buffer &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input, input.count(), flags); } //chd_error delete_metadata(chd_metadata_tag metatag, UINT32 metaindex); //chd_error clone_all_metadata(chd_file &source); // hashing helper //sha1_t compute_overall_sha1(sha1_t rawsha1); // codec interfaces //chd_error codec_configure(chd_codec_type codec, int param, void *config); // static helpers /** * @fn const char *chd_file::error_string(chd_error err) * * @brief ------------------------------------------------- * error_string - return an error string for the given CHD error * -------------------------------------------------. * * @param err The error. * * @return null if it fails, else a char*. */ public static string error_string(chd_error err) { switch (err) { case chd_error.CHDERR_NONE: return("no error"); case chd_error.CHDERR_NO_INTERFACE: return("no drive interface"); case chd_error.CHDERR_OUT_OF_MEMORY: return("out of memory"); case chd_error.CHDERR_NOT_OPEN: return("file not open"); case chd_error.CHDERR_ALREADY_OPEN: return("file already open"); case chd_error.CHDERR_INVALID_FILE: return("invalid file"); case chd_error.CHDERR_INVALID_PARAMETER: return("invalid parameter"); case chd_error.CHDERR_INVALID_DATA: return("invalid data"); case chd_error.CHDERR_FILE_NOT_FOUND: return("file not found"); case chd_error.CHDERR_REQUIRES_PARENT: return("requires parent"); case chd_error.CHDERR_FILE_NOT_WRITEABLE: return("file not writeable"); case chd_error.CHDERR_READ_ERROR: return("read error"); case chd_error.CHDERR_WRITE_ERROR: return("write error"); case chd_error.CHDERR_CODEC_ERROR: return("codec error"); case chd_error.CHDERR_INVALID_PARENT: return("invalid parent"); case chd_error.CHDERR_HUNK_OUT_OF_RANGE: return("hunk out of range"); case chd_error.CHDERR_DECOMPRESSION_ERROR: return("decompression error"); case chd_error.CHDERR_COMPRESSION_ERROR: return("compression error"); case chd_error.CHDERR_CANT_CREATE_FILE: return("can't create file"); case chd_error.CHDERR_CANT_VERIFY: return("can't verify file"); case chd_error.CHDERR_NOT_SUPPORTED: return("operation not supported"); case chd_error.CHDERR_METADATA_NOT_FOUND: return("can't find metadata"); case chd_error.CHDERR_INVALID_METADATA_SIZE: return("invalid metadata size"); case chd_error.CHDERR_UNSUPPORTED_VERSION: return("mismatched DIFF and CHD or unsupported CHD version"); case chd_error.CHDERR_VERIFY_INCOMPLETE: return("incomplete verify"); case chd_error.CHDERR_INVALID_METADATA: return("invalid metadata"); case chd_error.CHDERR_INVALID_STATE: return("invalid state"); case chd_error.CHDERR_OPERATION_PENDING: return("operation pending"); case chd_error.CHDERR_UNSUPPORTED_FORMAT: return("unsupported format"); case chd_error.CHDERR_UNKNOWN_COMPRESSION: return("unknown compression type"); case chd_error.CHDERR_WALKING_PARENT: return("currently examining parent"); case chd_error.CHDERR_COMPRESSING: return("currently compressing"); default: return("undocumented error"); } }