int c64_glue_snapshot_read_module(snapshot_t *s) { BYTE major_version, minor_version; int snap_type, snap_alarm_active; snapshot_module_t *m; m = snapshot_module_open(s, snap_module_name, &major_version, &minor_version); if (m == NULL) { return -1; } if (major_version > SNAP_MAJOR || minor_version > SNAP_MINOR) { log_error(LOG_ERR, "GlueLogic: Snapshot module version (%d.%d) newer than %d.%d.", major_version, minor_version, SNAP_MAJOR, SNAP_MINOR); goto fail; } if (0 || SMR_B_INT(m, &snap_type) < 0 || SMR_B_INT(m, &old_vbank) < 0 || SMR_B_INT(m, &snap_alarm_active) < 0) { goto fail; } if (snap_type != glue_logic_type) { log_warning(LOG_DEFAULT, "GlueLogic: Snapshot type %i differs from selected type %i, changing.", snap_type, glue_logic_type); glue_logic_type = snap_type; } if (glue_alarm_active) { glue_alarm_unset(); } glue_alarm_active = snap_alarm_active; if (glue_alarm_active && (glue_logic_type == 1)) { glue_alarm_set(); } snapshot_module_close(m); return 0; fail: if (m != NULL) { snapshot_module_close(m); } return -1; }
void c64_glue_set_vbank(int vbank, int ddr_flag) { int new_vbank = vbank; int update_now = 1; if (glue_logic_type == 1) { if (((old_vbank ^ vbank) == 3) && ((vbank & (vbank - 1)) == 0) && (vbank != 0)) { new_vbank = 3; glue_alarm_set(); } else if (ddr_flag && (vbank < old_vbank) && ((old_vbank ^ vbank) != 3)) { /* this is not quite accurate; the results flicker in some cases */ update_now = 0; glue_alarm_set(); } } if (update_now) { perform_vbank_switch(new_vbank); } old_vbank = vbank; }
int c64_glue_snapshot_read_module(snapshot_t *s) { BYTE major_version, minor_version; int snap_type, snap_alarm_active; snapshot_module_t *m; m = snapshot_module_open(s, snap_module_name, &major_version, &minor_version); if (m == NULL) { return -1; } /* Do not accept versions higher than current */ if (major_version > SNAP_MAJOR || minor_version > SNAP_MINOR) { snapshot_set_error(SNAPSHOT_MODULE_HIGHER_VERSION); goto fail; } if (0 || SMR_B_INT(m, &snap_type) < 0 || SMR_B_INT(m, &old_vbank) < 0 || SMR_B_INT(m, &snap_alarm_active) < 0) { goto fail; } if (snap_type != glue_logic_type) { log_warning(LOG_DEFAULT, "GlueLogic: Snapshot type %i differs from selected type %i, changing.", snap_type, glue_logic_type); glue_logic_type = snap_type; } if (glue_alarm_active) { glue_alarm_unset(); } glue_alarm_active = snap_alarm_active; if (glue_alarm_active && (glue_logic_type == 1)) { glue_alarm_set(); } snapshot_module_close(m); return 0; fail: if (m != NULL) { snapshot_module_close(m); } return -1; }