int warpspeed_snapshot_read_module(snapshot_t *s) { BYTE vmajor, vminor; snapshot_module_t *m; m = snapshot_module_open(s, SNAP_MODULE_NAME, &vmajor, &vminor); if (m == NULL) { return -1; } if ((vmajor != CART_DUMP_VER_MAJOR) || (vminor != CART_DUMP_VER_MINOR)) { snapshot_module_close(m); return -1; } if (0 || (SMR_BA(m, roml_banks, 0x2000) < 0) || (SMR_BA(m, romh_banks, 0x2000) < 0)) { snapshot_module_close(m); return -1; } snapshot_module_close(m); return warpspeed_common_attach(); }
int warpspeed_bin_attach(const char *filename, BYTE *rawcart) { if (util_file_load(filename, rawcart, 0x4000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } return warpspeed_common_attach(); }
int warpspeed_crt_attach(FILE *fd, BYTE *rawcart) { BYTE chipheader[0x10]; if (fread(chipheader, 0x10, 1, fd) < 1) { return -1; } if (chipheader[0xc] != 0x80 || chipheader[0xe] != 0x40) { return -1; } if (fread(rawcart, chipheader[0xe] << 8, 1, fd) < 1) { return -1; } return warpspeed_common_attach(); }
int warpspeed_crt_attach(FILE *fd, BYTE *rawcart) { crt_chip_header_t chip; if (crt_read_chip_header(&chip, fd)) { return -1; } if (chip.start != 0x8000 || chip.size != 0x4000) { return -1; } if (crt_read_chip(rawcart, 0, &chip, fd)) { return -1; } return warpspeed_common_attach(); }