int ross_bin_attach(const char *filename, BYTE *rawcart) { if (util_file_load(filename, rawcart, 0x8000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { if (util_file_load(filename, rawcart, 0x4000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } memcpy(&rawcart[0x4000], &rawcart[0x0000], 0x4000); } return ross_common_attach(); }
int mach5_bin_attach(const char *filename, BYTE *rawcart) { if (util_file_load(filename, rawcart, 0x2000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { if (util_file_load(filename, rawcart, 0x1000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } memcpy(&rawcart[0x1000], rawcart, 0x1000); } return mach5_common_attach(); }
int magicdesk_bin_attach(const char *filename, BYTE *rawcart) { if (util_file_load(filename, rawcart, 0x20000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { if (util_file_load(filename, rawcart, 0x10000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { if (util_file_load(filename, rawcart, 0x8000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } } } return magicdesk_common_attach(); }
int ross_bin_attach(const char *filename, uint8_t *rawcart) { if (util_file_load(filename, rawcart, 0x8000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { if (util_file_load(filename, rawcart, 0x4000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } ross_is_32k = 0; } else { ross_is_32k = 1; } return ross_common_attach(); }
int freezemachine_bin_attach(const char *filename, BYTE *rawcart) { DBG(("Freeze Machine: bin attach '%s'\n", filename)); allow_toggle = 1; if (util_file_load(filename, rawcart, FREEZE_MACHINE_CART_SIZE, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { if (util_file_load(filename, rawcart, FREEZE_FRAME_MK4_CART_SIZE, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } allow_toggle = 0; } return freezemachine_common_attach(); }
int ramcart_bin_attach(const char *filename, uint8_t *rawcart) { int size = 128; if (util_file_load(filename, rawcart, 128 * 1024, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { size = 64; if (util_file_load(filename, rawcart, 64 * 1024, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } } set_ramcart_size(size, NULL); set_ramcart_filename(filename, NULL); return ramcart_enable(); }
int simon_bin_attach(const char *filename, uint8_t *rawcart) { if (util_file_load(filename, rawcart, 0x4000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } return simon_common_attach(); }
int supergames_bin_attach(const char *filename, BYTE *rawcart) { if (util_file_load(filename, rawcart, 0x10000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } return supergames_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 dinamic_bin_attach(const char *filename, BYTE *rawcart) { if (util_file_load(filename, rawcart, 0x20000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } return dinamic_common_attach(); }
static int plus60k_activate(void) { plus60k_ram = (BYTE *)lib_realloc((void *)plus60k_ram, (size_t)0xf000); log_message(plus60k_log, "PLUS60K expansion installed."); if (!util_check_null_string(plus60k_filename)) { if (util_file_load(plus60k_filename, plus60k_ram, (size_t)0xf000, UTIL_FILE_LOAD_RAW) < 0) { log_message(plus60k_log, "Reading PLUS60K image %s failed.", plus60k_filename); if (util_file_save(plus60k_filename, plus60k_ram, 0xf000) < 0) { log_message(plus60k_log, "Creating PLUS60K image %s failed.", plus60k_filename); return -1; } log_message(plus60k_log, "Creating PLUS60K image %s.", plus60k_filename); return 0; } log_message(plus60k_log, "Reading PLUS60K image %s.", plus60k_filename); } plus60k_reset(); return 0; }
int se5_bin_attach(const char *filename, BYTE *rawcart) { if (util_file_load(filename, rawcart, SE5_CART_SIZE, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } return se5_common_attach(); }
static int expert_bin_load(const char *filename, BYTE *rawcart) { if (util_file_load(filename, rawcart, EXPERT_RAM_SIZE, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } expert_filetype = CARTRIDGE_FILETYPE_BIN; return 0; }
int dsm_bin_attach(const char *filename, BYTE *rawcart) { DBG(("Diashow Maker: bin attach '%s'\n", filename)); if (util_file_load(filename, rawcart, DSM_CART_SIZE, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } return dsm_common_attach(); }
int stb_bin_attach(const char *filename, BYTE *rawcart) { /* load file into cartridge address space */ if (util_file_load(filename, rawcart, 0x4000, UTIL_FILE_LOAD_RAW) < 0) { return -1; } return stb_common_attach(); }
int freezeframe_bin_attach(const char *filename, BYTE *rawcart) { DBG(("Freeze Frame: bin attach '%s'\n", filename)); if (util_file_load(filename, rawcart, FREEZE_FRAME_CART_SIZE, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } return freezeframe_common_attach(); }
int stardos_bin_attach(const char *filename, BYTE *rawcart) { if (util_file_load(filename, rawcart, 0x4000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) return -1; if (c64export_add(&export_res) < 0) return -1; return 0; }
int ocean_bin_attach(const char *filename, BYTE *rawcart) { int rc = 0; int i; size_t size; for(i = 0; (size = ocean_cart_sizes[i]) != 0; i++ ) { rc = util_file_load(filename, rawcart, size, UTIL_FILE_LOAD_SKIP_ADDRESS); if ( rc == 0 ) { io1_mask = (size >> 13)-1; /* printf("rc=%d i=%d sz=0x%x mask=0x%02x\n", rc, i, size, io1_mask); */ break; } }
int supercard_load(const char *name) { DBG(("supercard_load <%s>\n", name)); if (util_check_null_string(name)) { return 0; } if (util_file_load(name, supercard_rom, SUPERCARD_ROM_SIZE, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } return 0; }
static int functionrom_load_external(void) { if (external_function_rom_enabled) { if (util_check_null_string(external_function_rom_name)) return 0; if (util_file_load(external_function_rom_name, ext_function_rom, EXTERNAL_FUNCTION_ROM_SIZE, UTIL_FILE_LOAD_SKIP_ADDRESS | UTIL_FILE_LOAD_FILL) < 0) return -1; } else { memset(ext_function_rom, 0, sizeof(ext_function_rom)); } return 0; }
static int ramcart_activate(void) { if (!ramcart_size) return 0; ramcart_ram = lib_realloc((void *)ramcart_ram, (size_t)ramcart_size); /* Clear newly allocated RAM. */ if (ramcart_size > old_ramcart_ram_size) memset(ramcart_ram, 0, (size_t)(ramcart_size - old_ramcart_ram_size)); old_ramcart_ram_size = ramcart_size; #ifdef CELL_DEBUG printf("INFO: %dKB unit installed.\n", ramcart_size >> 10); #endif if (!util_check_null_string(ramcart_filename)) { if (util_file_load(ramcart_filename, ramcart_ram, (size_t)ramcart_size, UTIL_FILE_LOAD_RAW) < 0) { #ifdef CELL_DEBUG printf("INFO: Reading RAMCART image %s failed.\n", ramcart_filename); #endif if (util_file_save(ramcart_filename, ramcart_ram, ramcart_size) < 0) { #ifdef CELL_DEBUG printf("INFO: Creating RAMCART image %s failed.\n", ramcart_filename); #endif return -1; } #ifdef CELL_DEBUG printf("INFO: Creating RAMCART image %s.\n", ramcart_filename); #endif return 0; } #ifdef CELL_DEBUG printf("INFO: Reading RAMCART image %s.\n", ramcart_filename); #endif } ramcart_reset(); return 0; }
static int plus256k_activate(void) { plus256k_ram = lib_realloc((void *)plus256k_ram, (size_t)0x40000); log_message(plus256k_log, "PLUS256K hack installed."); if (!util_check_null_string(plus256k_filename)) { if (util_file_load(plus256k_filename, plus256k_ram, (size_t)0x40000, UTIL_FILE_LOAD_RAW) < 0) { log_message(plus256k_log, "Reading PLUS256K image %s failed.", plus256k_filename); if (util_file_save(plus256k_filename, plus256k_ram, 0x40000) < 0) { log_message(plus256k_log, "Creating PLUS256K image %s failed.", plus256k_filename); return -1; } log_message(plus256k_log, "Creating PLUS256K image %s.", plus256k_filename); return 0; } log_message(plus256k_log, "Reading PLUS256K image %s.", plus256k_filename); } plus256k_reset(); set_cpu_lines_lock(CPU_LINES_PLUS256K, "PLUS256K"); return 0; }
static int petdww_activate(void) { if (petres.IOSize < 2048) { log_message(petdww_log, "Cannot enable DWW: IOSize too small (%d but must be 2K)", petres.IOSize); return -1; } if (petres.superpet) { log_message(petdww_log, "Cannot enable DWW: not compatible with SuperPET"); return -1; } petdww_ram = lib_realloc((void *)petdww_ram, (size_t)PET_DWW_RAM_SIZE); /* Clear newly allocated RAM. */ memset(petdww_ram, 0, (size_t)PET_DWW_RAM_SIZE); log_message(petdww_log, "%dKB of hi-res RAM installed.", PET_DWW_RAM_SIZE >> 10); if (!util_check_null_string(petdww_filename)) { if (util_file_load(petdww_filename, petdww_ram, (size_t)PET_DWW_RAM_SIZE, UTIL_FILE_LOAD_RAW) < 0) { log_message(petdww_log, "Reading PET DWW image %s failed.", petdww_filename); if (util_file_save(petdww_filename, petdww_ram, PET_DWW_RAM_SIZE) < 0) { log_message(petdww_log, "Creating PET DWW image %s failed.", petdww_filename); return -1; } log_message(petdww_log, "Creating PET DWW image %s.", petdww_filename); return 0; } log_message(petdww_log, "Reading PET DWW image %s.", petdww_filename); } petdww_reset(); return 0; }
static int ramcart_activate(void) { if (!ramcart_size) { return 0; } ramcart_ram = lib_realloc((void *)ramcart_ram, (size_t)ramcart_size); /* Clear newly allocated RAM. */ if (ramcart_size > old_ramcart_ram_size) { memset(ramcart_ram, 0, (size_t)(ramcart_size - old_ramcart_ram_size)); } old_ramcart_ram_size = ramcart_size; log_message(ramcart_log, "%dKB unit installed.", ramcart_size >> 10); if (!util_check_null_string(ramcart_filename)) { if (util_file_load(ramcart_filename, ramcart_ram, (size_t)ramcart_size, UTIL_FILE_LOAD_RAW) < 0) { log_error(ramcart_log, "Reading RAMCART image %s failed.", ramcart_filename); /* only create a new file if no file exists, so we dont accidently overwrite any files */ if (!util_file_exists(ramcart_filename)) { if (util_file_save(ramcart_filename, ramcart_ram, ramcart_size) < 0) { log_error(ramcart_log, "Creating RAMCART image %s failed.", ramcart_filename); return -1; } log_message(ramcart_log, "Creating RAMCART image %s.", ramcart_filename); return 0; } } log_message(ramcart_log, "Reading RAMCART image %s.", ramcart_filename); } ramcart_reset(); return 0; }
static int plus60k_activate(void) { plus60k_ram = lib_realloc((void *)plus60k_ram, (size_t)0xf000); #ifdef CELL_DEBUG printf("INFO: PLUS60K expansion installed.\n"); #endif if (!util_check_null_string(plus60k_filename)) { if (util_file_load(plus60k_filename, plus60k_ram, (size_t)0xf000, UTIL_FILE_LOAD_RAW) < 0) { #ifdef CELL_DEBUG printf("INFO: Reading PLUS60K image %s failed.\n", plus60k_filename); #endif if (util_file_save(plus60k_filename, plus60k_ram, 0xf000) < 0) { #ifdef CELL_DEBUG printf("INFO: Creating PLUS60K image %s failed.\n", plus60k_filename); #endif return -1; } #ifdef CELL_DEBUG printf("INFO: Creating PLUS60K image %s.\n", plus60k_filename); #endif return 0; } #ifdef CELL_DEBUG printf("INFO: Reading PLUS60K image %s.\n", plus60k_filename); #endif } plus60k_reset(); set_cpu_lines_lock(CPU_LINES_PLUS60K, "PLUS60K"); return 0; }
int magicdesk_bin_attach(const char *filename, uint8_t *rawcart) { bankmask = 0x7f; if (util_file_load(filename, rawcart, 0x100000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { bankmask = 0x3f; if (util_file_load(filename, rawcart, 0x80000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { bankmask = 0x1f; if (util_file_load(filename, rawcart, 0x40000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { bankmask = 0x0f; if (util_file_load(filename, rawcart, 0x20000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { bankmask = 0x07; if (util_file_load(filename, rawcart, 0x10000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { bankmask = 0x03; if (util_file_load(filename, rawcart, 0x8000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { return -1; } } } } } } return magicdesk_common_attach(); }