int c64dtv_snapshot_read(const char *name, int event_mode) { snapshot_t *s; BYTE minor, major; s = snapshot_open(name, &major, &minor, machine_name); if (s == NULL) { return -1; } if (major != SNAP_MAJOR || minor != SNAP_MINOR) { log_error(LOG_DEFAULT, "Snapshot version (%d.%d) not valid: expecting %d.%d.", major, minor, SNAP_MAJOR, SNAP_MINOR); goto fail; } vicii_snapshot_prepare(); joyport_clear_devices(); if (maincpu_snapshot_read_module(s) < 0 || c64dtv_snapshot_read_module(s) < 0 || c64dtvdma_snapshot_read_module(s) < 0 || c64dtvblitter_snapshot_read_module(s) < 0 || c64dtvmisc_snapshot_read_module(s) < 0 || ciacore_snapshot_read_module(machine_context.cia1, s) < 0 || ciacore_snapshot_read_module(machine_context.cia2, s) < 0 || sid_snapshot_read_module(s) < 0 || drive_snapshot_read_module(s) < 0 || vicii_snapshot_read_module(s) < 0 || event_snapshot_read_module(s, event_mode) < 0 || keyboard_snapshot_read_module(s) < 0 || joyport_snapshot_read_module(s, JOYPORT_1) < 0 || joyport_snapshot_read_module(s, JOYPORT_2) < 0 || userport_snapshot_read_module(s) < 0) { goto fail; } snapshot_close(s); sound_snapshot_finish(); return 0; fail: if (s != NULL) { snapshot_close(s); } machine_trigger_reset(MACHINE_RESET_MODE_SOFT); return -1; }
int cbm2_snapshot_read(const char *name, int event_mode) { snapshot_t *s; BYTE minor, major; s = snapshot_open(name, &major, &minor, machine_get_name()); if (s == NULL) { return -1; } if (major != SNAP_MAJOR || minor != SNAP_MINOR) { log_error(LOG_DEFAULT, "Snapshot version (%d.%d) not valid: expecting %d.%d.", major, minor, SNAP_MAJOR, SNAP_MINOR); goto fail; } vicii_snapshot_prepare(); if (maincpu_snapshot_read_module(s) < 0 || vicii_snapshot_read_module(s) < 0 || cbm2_c500_snapshot_read_module(s) < 0 || cbm2_snapshot_read_module(s) < 0 || ciacore_snapshot_read_module(machine_context.cia1, s) < 0 || tpicore_snapshot_read_module(machine_context.tpi1, s) < 0 || tpicore_snapshot_read_module(machine_context.tpi2, s) < 0 || acia1_snapshot_read_module(s) < 0 || sid_snapshot_read_module(s) < 0 || drive_snapshot_read_module(s) < 0 || event_snapshot_read_module(s, event_mode) < 0 || tape_snapshot_read_module(s) < 0 || keyboard_snapshot_read_module(s) < 0 || joystick_snapshot_read_module(s) < 0) { goto fail; } sound_snapshot_finish(); return 0; fail: if (s != NULL) { snapshot_close(s); } machine_trigger_reset(MACHINE_RESET_MODE_SOFT); return -1; }