VICModel.java

package libsidplay.common;

import java.util.Objects;

/** User-selectable VIC overrides. DEFAULT follows the machine preset and tune clock. */
public enum VICModel {
    DEFAULT(null),
    MOS6569R3(VICChipModel.MOS6569R3),
    MOS8565(VICChipModel.MOS8565),
    MOS6567R8(VICChipModel.MOS6567R8),
    MOS6567R56A(VICChipModel.MOS6567R56A);

    private final VICChipModel chip;

    VICModel(VICChipModel chip) {
        this.chip = chip;
    }

    /** AUTO means the existing forced/tune/default clock resolution remains in effect. */
    public CPUClock getClock() {
        return chip == null ? CPUClock.AUTO : chip.getClock();
    }

    public VICConfiguration resolve(C64Model machine) {
        VICConfiguration defaults = Objects.requireNonNull(machine, "machine").getDefaultVicConfiguration();
        if (chip == null) return defaults;
        return chip.getClock() == CPUClock.PAL ? defaults.withPalModel(chip) : defaults.withNtscModel(chip);
    }
}