int easyflash_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, SNAP_MODULE_NAME, CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_B(m, (BYTE)easyflash_jumper) < 0) || (SMW_B(m, easyflash_register_00) < 0) || (SMW_B(m, easyflash_register_02) < 0) || (SMW_BA(m, easyflash_ram, 256) < 0) || (SMW_BA(m, roml_banks, 0x80000) < 0) || (SMW_BA(m, romh_banks, 0x80000) < 0)) { snapshot_module_close(m); return -1; } snapshot_module_close(m); if (0 || (flash040core_snapshot_write_module(s, easyflash_state_low, FLASH_SNAP_MODULE_NAME) < 0) || (flash040core_snapshot_write_module(s, easyflash_state_high, FLASH_SNAP_MODULE_NAME) < 0)) { return -1; } return 0; }
int vic_fp_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, SNAP_MODULE_NAME, VIC20CART_DUMP_VER_MAJOR, VIC20CART_DUMP_VER_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_B(m, cart_bank_reg) < 0) || (SMW_B(m, cart_cfg_reg) < 0) || (SMW_BA(m, cart_ram, CART_RAM_SIZE) < 0) || (SMW_BA(m, cart_rom, CART_ROM_SIZE) < 0)) { snapshot_module_close(m); return -1; } snapshot_module_close(m); if ((flash040core_snapshot_write_module(s, &flash_state, FLASH_SNAP_MODULE_NAME) < 0)) { return -1; } return 0; }
static int mem_write_rom_snapshot_module(snapshot_t *p, int save_roms) { snapshot_module_t *m; if (!save_roms) { return 0; } m = snapshot_module_create(p, SNAP_ROM_MODULE_NAME, VIC20MEM_DUMP_VER_MAJOR, VIC20MEM_DUMP_VER_MINOR); if (m == NULL) { return -1; } /* old cart system config bits. all zero = no roms */ SMW_B(m, 0x00); /* save kernal */ SMW_BA(m, vic20memrom_kernal_rom, 0x2000); /* save basic */ SMW_BA(m, vic20memrom_basic_rom, 0x2000); SMW_BA(m, vic20memrom_chargen_rom, 0x1000); snapshot_module_close(m); return 0; }
int finalexpansion_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, SNAP_MODULE_NAME, VIC20CART_DUMP_VER_MAJOR, VIC20CART_DUMP_VER_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_B(m, register_a) < 0) || (SMW_B(m, register_b) < 0) || (SMW_B(m, lock_bit) < 0) || (SMW_BA(m, cart_ram, CART_RAM_SIZE) < 0) || (SMW_BA(m, flash_state.flash_data, CART_ROM_SIZE) < 0)) { snapshot_module_close(m); return -1; } snapshot_module_close(m); if ((flash040core_snapshot_write_module(s, &flash_state, FLASH_SNAP_MODULE_NAME) < 0)) { return -1; } return 0; }
int ds1216e_write_snapshot(rtc_ds1216e_t *context, snapshot_t *s) { DWORD latch_lo = 0; DWORD latch_hi = 0; DWORD offset_lo = 0; DWORD offset_hi = 0; DWORD old_offset_lo = 0; DWORD old_offset_hi = 0; snapshot_module_t *m; /* time_t can be either 32bit or 64bit, so we save as 64bit */ #if (SIZE_OF_TIME_T == 8) latch_hi = (DWORD)(context->latch >> 32); latch_lo = (DWORD)(context->latch & 0xffffffff); offset_hi = (DWORD)(context->offset >> 32); offset_lo = (DWORD)(context->offset & 0xffffffff); old_offset_hi = (DWORD)(context->old_offset >> 32); old_offset_lo = (DWORD)(context->old_offset & 0xffffffff); #else latch_lo = (DWORD)context->latch; offset_lo = (DWORD)context->offset; old_offset_lo = (DWORD)context->old_offset; #endif m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR); if (m == NULL) { return -1; } if (0 || SMW_B(m, (BYTE)context->reset) < 0 || SMW_B(m, (BYTE)context->inactive) < 0 || SMW_B(m, (BYTE)context->hours12) < 0 || SMW_B(m, (BYTE)context->pattern_pos) < 0 || SMW_B(m, (BYTE)context->pattern_ignore) < 0 || SMW_B(m, (BYTE)context->output) < 0 || SMW_B(m, (BYTE)context->output_pos) < 0 || SMW_DW(m, latch_hi) < 0 || SMW_DW(m, latch_lo) < 0 || SMW_DW(m, offset_hi) < 0 || SMW_DW(m, offset_lo) < 0 || SMW_DW(m, old_offset_hi) < 0 || SMW_DW(m, old_offset_lo) < 0 || SMW_BA(m, context->clock_regs, DS1216E_REG_SIZE) < 0 || SMW_BA(m, context->old_clock_regs, DS1216E_REG_SIZE) < 0 || SMW_BA(m, context->clock_regs_changed, DS1216E_REG_SIZE) < 0 || SMW_STR(m, context->device) < 0) { snapshot_module_close(m); return -1; } return snapshot_module_close(m); }
static int mem_write_rom_snapshot_module(snapshot_t *s) { snapshot_module_t *m; int trapfl; /* Main memory module. */ m = snapshot_module_create(s, snap_rom_module_name, SNAP_ROM_MAJOR, SNAP_ROM_MINOR); if (m == NULL) return -1; /* disable traps before saving the ROM */ resources_get_int("VirtualDevices", &trapfl); resources_set_int("VirtualDevices", 0); if (0 || SMW_BA(m, c128memrom_kernal_rom, C128_KERNAL_ROM_SIZE) < 0 || SMW_BA(m, c128memrom_basic_rom, C128_BASIC_ROM_SIZE) < 0 || SMW_BA(m, c128memrom_basic_rom + C128_BASIC_ROM_SIZE, C128_EDITOR_ROM_SIZE) < 0 || SMW_BA(m, mem_chargen_rom, C128_CHARGEN_ROM_SIZE) < 0) goto fail; /* FIXME: save cartridge ROM (& RAM?) areas: first write out the configuration, i.e. - type of cartridge (banking scheme type) - state of cartridge (active/which bank, ...) then the ROM/RAM arrays: - cartridge ROM areas - cartridge RAM areas */ /* enable traps again when necessary */ resources_set_int("VirtualDevices", trapfl); if (snapshot_module_close(m) < 0) goto fail; return 0; fail: /* enable traps again when necessary */ resources_set_int("VirtualDevices", trapfl); if (m != NULL) snapshot_module_close(m); return -1; }
int digimax_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, SNAP_MODULE_NAME, CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_DW(m, (DWORD)digimax_address) < 0) /* FIXME: implement userport part in userport_digimax.c */ #if 0 || (SMW_B(m, digimax_userport_address) < 0) || (SMW_B(m, digimax_userport_direction_A) < 0) || (SMW_B(m, digimax_userport_direction_B) < 0) #endif || (SMW_BA(m, digimax_sound_data, 4) < 0) || (SMW_B(m, snd.voice0) < 0) || (SMW_B(m, snd.voice1) < 0) || (SMW_B(m, snd.voice2) < 0) || (SMW_B(m, snd.voice3) < 0)) { snapshot_module_close(m); return -1; } snapshot_module_close(m); return 0; }
static int sid_snapshot_write_module_simple(snapshot_t *s) { int sound, sid_engine; snapshot_module_t *m; m = snapshot_module_create(s, snap_module_name_simple, SNAP_MAJOR_SIMPLE, SNAP_MINOR_SIMPLE); if (m == NULL) { return -1; } resources_get_int("Sound", &sound); if (SMW_B(m, (BYTE)sound) < 0) { snapshot_module_close(m); return -1; } if (sound) { resources_get_int("SidEngine", &sid_engine); if (SMW_B(m, (BYTE)sid_engine) < 0) { snapshot_module_close(m); return -1; } /* FIXME: Only data for first SID stored. */ if (SMW_BA(m, sid_get_siddata(0), 32) < 0) { snapshot_module_close(m); return -1; } } snapshot_module_close(m); return 0; }
static int tape_snapshot_write_tapimage_module(snapshot_t *s) { snapshot_module_t *m; FILE *ftap; long pos, tap_size; BYTE buffer[256]; int i; m = snapshot_module_create(s, "TAPIMAGE", TAPIMAGE_SNAP_MAJOR, TAPIMAGE_SNAP_MINOR); if (m == NULL) return -1; /* get the file descriptor */ ftap = ((tap_t*)tape_image_dev1->data)->fd; if (!ftap) { log_error(tape_snapshot_log, "Cannot open tapfile for reading"); return -1; } /* remeber current position */ pos = ftell(ftap); /* move to end and get size of file */ if (fseek(ftap, 0, SEEK_END) != 0) { log_error(tape_snapshot_log, "Cannot move to end of tapfile"); return -1; } tap_size = ftell(ftap); if (SMW_DW(m, tap_size)) { fseek(ftap, pos, SEEK_SET); log_error(tape_snapshot_log, "Cannot write size of tap image"); } /* move to beginning */ if (fseek(ftap, 0, SEEK_SET) != 0) { log_error(tape_snapshot_log, "Cannot move to beginning of tapfile"); return -1; } /* read every BYTE and write to snapshot module */ while (tap_size > 0) { i = fread(buffer, 1, 256, ftap); if (SMW_BA(m, buffer, i) < 0) { log_error(tape_snapshot_log, "Cannot write tap image"); fseek(ftap, pos, SEEK_SET); return -1; } tap_size -= i; } /* restore position */ fseek(ftap, pos, SEEK_SET); if (snapshot_module_close(m) < 0) return -1; return 0; }
static int drive_snapshot_write_image_module(snapshot_t *s, unsigned int dnr) { char snap_module_name[10]; snapshot_module_t *m; BYTE sector_data[0x100]; WORD word; disk_addr_t dadr; int rc; drive_t *drive; drive = drive_context[dnr]->drive; if (drive->image == NULL) { sprintf(snap_module_name, "NOIMAGE%i", dnr); } else { sprintf(snap_module_name, "IMAGE%i", dnr); } m = snapshot_module_create(s, snap_module_name, IMAGE_SNAP_MAJOR, IMAGE_SNAP_MINOR); if (m == NULL) { return -1; } if (drive->image == NULL) { if (snapshot_module_close(m) < 0) { return -1; } return 0; } word = drive->image->type; SMW_W(m, word); /* we use the return code to step through the tracks. So we do not need any geometry info. */ for (dadr.track = 1;; dadr.track++) { rc = 0; for (dadr.sector = 0;; dadr.sector++) { rc = disk_image_read_sector(drive->image, sector_data, &dadr); if (rc == 0) { SMW_BA(m, sector_data, 0x100); } else { break; } } if (dadr.sector == 0) { break; } } if (snapshot_module_close(m) < 0) { return -1; } return 0; }
int vic_snapshot_write_module(snapshot_t *s) { int i; snapshot_module_t *m; m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR); if (m == NULL) { return -1; } if (SMW_B(m, (BYTE)VIC_RASTER_CYCLE(maincpu_clk)) < 0 || SMW_W(m, (WORD)VIC_RASTER_Y(maincpu_clk)) < 0) { goto fail; } if (0 || (SMW_W(m, (WORD)vic.area) < 0) || (SMW_W(m, (WORD)vic.fetch_state) < 0) || (SMW_DW(m, (DWORD)vic.raster_line) < 0) || (SMW_DW(m, (DWORD)vic.text_cols) < 0) || (SMW_DW(m, (DWORD)vic.text_lines) < 0) || (SMW_DW(m, (DWORD)vic.pending_text_cols) < 0) || (SMW_DW(m, (DWORD)vic.line_was_blank) < 0) || (SMW_DW(m, (DWORD)vic.memptr) < 0) || (SMW_DW(m, (DWORD)vic.memptr_inc) < 0) || (SMW_DW(m, (DWORD)vic.row_counter) < 0) || (SMW_DW(m, (DWORD)vic.buf_offset) < 0) || SMW_B(m, (BYTE)vic.light_pen.state) < 0 || SMW_B(m, (BYTE)vic.light_pen.triggered) < 0 || SMW_DW(m, (DWORD)vic.light_pen.x) < 0 || SMW_DW(m, (DWORD)vic.light_pen.y) < 0 || SMW_DW(m, (DWORD)vic.light_pen.x_extra_bits) < 0 || SMW_DW(m, (DWORD)vic.light_pen.trigger_cycle) < 0 || (SMW_B(m, vic.vbuf) < 0)) { goto fail; } /* Color RAM. */ if (SMW_BA(m, mem_ram + 0x9400, 0x400) < 0) { goto fail; } for (i = 0; i < 0x10; i++) { if (SMW_B(m, (BYTE)vic.regs[i]) < 0) { goto fail; } } return snapshot_module_close(m); fail: if (m != NULL) snapshot_module_close(m); return -1; }
int simon_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, SNAP_MODULE_NAME, CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_BA(m, roml_banks, 0x2000) < 0) || (SMW_BA(m, romh_banks, 0x2000) < 0)) { snapshot_module_close(m); return -1; } snapshot_module_close(m); return 0; }
int simon_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR); if (m == NULL) { return -1; } if (0 || SMW_B(m, (BYTE)simon_a000) < 0 || SMW_BA(m, roml_banks, 0x2000) < 0 || SMW_BA(m, romh_banks, 0x2000) < 0) { snapshot_module_close(m); return -1; } return snapshot_module_close(m); }
int ross_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR); if (m == NULL) { return -1; } if (0 || SMW_B(m, (uint8_t)ross_is_32k) < 0 || SMW_B(m, (uint8_t)currbank) < 0 || SMW_BA(m, roml_banks, 0x4000) < 0 || SMW_BA(m, romh_banks, 0x4000) < 0) { snapshot_module_close(m); return -1; } return snapshot_module_close(m); }
int freezemachine_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR); if (m == NULL) { return -1; } if (0 || SMW_B(m, (BYTE)rom_A14) < 0 || SMW_B(m, (BYTE)roml_toggle) < 0 || SMW_B(m, (BYTE)allow_toggle) < 0 || SMW_BA(m, roml_banks, 0x4000) < 0 || SMW_BA(m, romh_banks, 0x4000) < 0) { snapshot_module_close(m); return -1; } return snapshot_module_close(m); }
int ramcart_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_B(m, (uint8_t)ramcart_enabled) < 0) || (SMW_B(m, (uint8_t)ramcart_readonly) < 0) || (SMW_DW(m, (uint32_t)ramcart_size) < 0) || (SMW_B(m, (uint8_t)ramcart_size_kb) < 0) || (SMW_BA(m, ramcart, 2) < 0) || (SMW_BA(m, ramcart_ram, ramcart_size) < 0)) { snapshot_module_close(m); return -1; } return snapshot_module_close(m); }
int kcs_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, SNAP_MODULE_NAME, CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_B(m, (BYTE)freeze_flag) < 0) || (SMW_B(m, (BYTE)config) < 0) || (SMW_BA(m, roml_banks, 0x2000) < 0) || (SMW_BA(m, romh_banks, 0x2000) < 0) || (SMW_BA(m, export_ram0, 0x2000) < 0)) { snapshot_module_close(m); return -1; } snapshot_module_close(m); return 0; }
int freezemachine_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, SNAP_MODULE_NAME, CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_B(m, (BYTE)rom_A14) < 0) || (SMW_B(m, (BYTE)roml_toggle) < 0) || (SMW_B(m, (BYTE)allow_toggle) < 0) || (SMW_BA(m, roml_banks, 0x4000) < 0) || (SMW_BA(m, romh_banks, 0x4000) < 0)) { snapshot_module_close(m); return -1; } snapshot_module_close(m); return 0; }
static int drive_snapshot_write_p64image_module(snapshot_t *s, unsigned int dnr) { char snap_module_name[10]; snapshot_module_t *m; drive_t *drive; TP64MemoryStream P64MemoryStreamInstance; PP64Image P64Image; drive = drive_context[dnr]->drive; sprintf(snap_module_name, "P64IMAGE%i", dnr); m = snapshot_module_create(s, snap_module_name, GCRIMAGE_SNAP_MAJOR, GCRIMAGE_SNAP_MINOR); if (m == NULL) { return -1; } P64Image = (void*)drive->p64; if (P64Image == NULL) { if (m != NULL) { snapshot_module_close(m); } return -1; } P64MemoryStreamCreate(&P64MemoryStreamInstance); P64MemoryStreamClear(&P64MemoryStreamInstance); if (!P64ImageWriteToStream(P64Image, &P64MemoryStreamInstance)) { P64MemoryStreamDestroy(&P64MemoryStreamInstance); return -1; } if (SMW_DW(m, P64MemoryStreamInstance.Size) < 0 || SMW_BA(m, P64MemoryStreamInstance.Data, P64MemoryStreamInstance.Size) < 0) { if (m != NULL) { snapshot_module_close(m); } P64MemoryStreamDestroy(&P64MemoryStreamInstance); return -1; } P64MemoryStreamDestroy(&P64MemoryStreamInstance); if (snapshot_module_close(m) < 0) { return -1; } return 0; }
int megacart_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, SNAP_MODULE_NAME, VIC20CART_DUMP_VER_MAJOR, VIC20CART_DUMP_VER_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_B(m, bank_low_reg) < 0) || (SMW_B(m, bank_high_reg) < 0) || (SMW_B(m, (BYTE)oe_flop) < 0) || (SMW_B(m, (BYTE)nvram_en_flop) < 0) || (SMW_BA(m, cart_ram, CART_RAM_SIZE) < 0) || (SMW_BA(m, cart_rom, CART_ROM_SIZE) < 0) || (SMW_BA(m, cart_nvram, CART_NVRAM_SIZE) < 0)) { snapshot_module_close(m); return -1; } snapshot_module_close(m); return 0; }
static int mem_write_ram_snapshot_module(snapshot_t *p) { snapshot_module_t *m; BYTE config; config = (ram_block_0_enabled ? 1 : 0) | (ram_block_1_enabled ? 2 : 0) | (ram_block_2_enabled ? 4 : 0) | (ram_block_3_enabled ? 8 : 0) | (ram_block_5_enabled ? 32 : 0); m = snapshot_module_create(p, SNAP_MEM_MODULE_NAME, VIC20MEM_DUMP_VER_MAJOR, VIC20MEM_DUMP_VER_MINOR); if (m == NULL) { return -1; } SMW_B(m, config); SMW_B(m, vic20_cpu_last_data); SMW_B(m, vic20_v_bus_last_data); SMW_B(m, vic20_v_bus_last_high); SMW_BA(m, mem_ram, 0x0400); SMW_BA(m, mem_ram + 0x1000, 0x1000); if (config & 1) { SMW_BA(m, mem_ram + 0x0400, 0x0c00); } if (config & 2) { SMW_BA(m, mem_ram + 0x2000, 0x2000); } if (config & 4) { SMW_BA(m, mem_ram + 0x4000, 0x2000); } if (config & 8) { SMW_BA(m, mem_ram + 0x6000, 0x2000); } if (config & 32) { SMW_BA(m, mem_ram + 0xA000, 0x2000); } snapshot_module_close(m); return 0; }
static int drive_snapshot_write_gcrimage_module(snapshot_t *s, unsigned int dnr) { char snap_module_name[10]; snapshot_module_t *m; BYTE *data; unsigned int i; drive_t *drive; DWORD num_half_tracks, track_size; drive = drive_context[dnr]->drive; sprintf(snap_module_name, "GCRIMAGE%i", dnr); m = snapshot_module_create(s, snap_module_name, GCRIMAGE_SNAP_MAJOR, GCRIMAGE_SNAP_MINOR); if (m == NULL) { return -1; } num_half_tracks = MAX_TRACKS_1571 * 2; /* Write general data */ if (SMW_DW(m, num_half_tracks) < 0) { snapshot_module_close(m); return -1; } /* Write half track data */ for (i = 0; i < num_half_tracks; i++) { data = drive->gcr->tracks[i].data; track_size = data ? drive->gcr->tracks[i].size : 0; if (0 || SMW_DW(m, (DWORD)track_size) < 0 || (track_size && SMW_BA(m, data, track_size) < 0) ) { break; } } if (snapshot_module_close(m) < 0 || (i != num_half_tracks)) { return -1; } return 0; }
int freezeframe_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, SNAP_MODULE_NAME, CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_BA(m, roml_banks, FREEZE_FRAME_CART_SIZE) < 0)) { snapshot_module_close(m); return -1; } snapshot_module_close(m); return 0; }
int dinamic_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, SNAP_MODULE_NAME, CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_B(m, (BYTE)currbank) < 0) || (SMW_BA(m, roml_banks, 0x2000 * 16) < 0)) { snapshot_module_close(m); return -1; } snapshot_module_close(m); return 0; }
int epyxfastload_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, SNAP_MODULE_NAME, CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_DW(m, epyxrom_alarm_time) < 0) || (SMW_BA(m, roml_banks, 0x2000) < 0)) { snapshot_module_close(m); return -1; } snapshot_module_close(m); return 0; }
int freezeframe_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_B(m, (BYTE)freezeframe_rom_8000) < 0) || (SMW_B(m, (BYTE)freezeframe_rom_e000) < 0) || (SMW_BA(m, roml_banks, FREEZE_FRAME_CART_SIZE) < 0)) { snapshot_module_close(m); return -1; } return snapshot_module_close(m); }
int magicdesk_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, SNAP_MODULE_NAME, CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_B(m, (BYTE)regval) < 0) || (SMW_BA(m, roml_banks, 0x2000 * MAXBANKS) < 0)) { snapshot_module_close(m); return -1; } snapshot_module_close(m); return 0; }
int joystick_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, "JOYSTICK", 1, 0); if (m == NULL) { return -1; } if (SMW_BA(m, joystick_value, (JOYSTICK_NUM + 1)) < 0) { snapshot_module_close(m); return -1; } if (snapshot_module_close(m) < 0) { return -1; } return 0; }
int behrbonz_snapshot_write_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, SNAP_MODULE_NAME, VIC20CART_DUMP_VER_MAJOR, VIC20CART_DUMP_VER_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_B(m, bank_reg) < 0) || (SMW_B(m, reset_mode) < 0) || (SMW_B(m, write_once) < 0) || (SMW_BA(m, cart_rom, CART_ROM_SIZE) < 0)) { snapshot_module_close(m); return -1; } snapshot_module_close(m); return 0; }
static int userport_digimax_write_snapshot_module(snapshot_t *s) { snapshot_module_t *m; m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR); if (m == NULL) { return -1; } if (0 || (SMW_B(m, userport_digimax_address) < 0) || (SMW_BA(m, digimax_sound_data, 4) < 0) || (SMW_B(m, snd.voice0) < 0) || (SMW_B(m, snd.voice1) < 0) || (SMW_B(m, snd.voice2) < 0) || (SMW_B(m, snd.voice3) < 0)) { snapshot_module_close(m); return -1; } return snapshot_module_close(m); }