void ReSID::loadFromBuffer(uint8_t **buffer) { debug(2, " Loading ReSID state...\n"); setChipModel((chip_model)read8(buffer)); setAudioFilter((bool)read8(buffer)); setSamplingMethod((sampling_method)read8(buffer)); setSampleRate(read32(buffer)); setClockFrequency(read32(buffer)); }
ReSID::ReSID() { name = "ReSID"; debug(2, " Creating ReSID at address %p...\n", this); sid = new SID(); // Register snapshot items SnapshotItem items[] = { // Configuration items { &chipModel, sizeof(chipModel), KEEP_ON_RESET }, { &sampleRate, sizeof(sampleRate), KEEP_ON_RESET }, { &samplingMethod, sizeof(samplingMethod), KEEP_ON_RESET }, { &cpuFrequency, sizeof(cpuFrequency), KEEP_ON_RESET }, { &audioFilter, sizeof(audioFilter), KEEP_ON_RESET }, { &externalAudioFilter, sizeof(externalAudioFilter), KEEP_ON_RESET }, { &volume, sizeof(volume), KEEP_ON_RESET }, { &targetVolume, sizeof(targetVolume), KEEP_ON_RESET }, // ReSID state { st.sid_register, sizeof(st.sid_register), KEEP_ON_RESET }, { &st.bus_value, sizeof(st.bus_value), KEEP_ON_RESET }, { &st.bus_value_ttl, sizeof(st.bus_value_ttl), KEEP_ON_RESET }, { &st.accumulator[0], sizeof(st.accumulator[0]), KEEP_ON_RESET }, { &st.accumulator[1], sizeof(st.accumulator[1]), KEEP_ON_RESET }, { &st.accumulator[2], sizeof(st.accumulator[2]), KEEP_ON_RESET }, { &st.shift_register[0], sizeof(&st.shift_register[0]), KEEP_ON_RESET }, { &st.shift_register[1], sizeof(&st.shift_register[1]), KEEP_ON_RESET }, { &st.shift_register[2], sizeof(&st.shift_register[2]), KEEP_ON_RESET }, { &st.rate_counter[0], sizeof(st.rate_counter[0]), KEEP_ON_RESET }, { &st.rate_counter[1], sizeof(st.rate_counter[1]), KEEP_ON_RESET }, { &st.rate_counter[2], sizeof(st.rate_counter[2]), KEEP_ON_RESET }, { &st.rate_counter_period[0], sizeof(st.rate_counter_period[0]), KEEP_ON_RESET }, { &st.rate_counter_period[1], sizeof(st.rate_counter_period[1]), KEEP_ON_RESET }, { &st.rate_counter_period[2], sizeof(st.rate_counter_period[2]), KEEP_ON_RESET }, { &st.exponential_counter[0], sizeof(st.exponential_counter[0]), KEEP_ON_RESET }, { &st.exponential_counter[1], sizeof(st.exponential_counter[1]), KEEP_ON_RESET }, { &st.exponential_counter[2], sizeof(st.exponential_counter[2]), KEEP_ON_RESET }, { &st.exponential_counter_period[0],sizeof(st.exponential_counter_period[0]), KEEP_ON_RESET }, { &st.exponential_counter_period[1],sizeof(st.exponential_counter_period[1]), KEEP_ON_RESET }, { &st.exponential_counter_period[2],sizeof(st.exponential_counter_period[2]), KEEP_ON_RESET }, { &st.envelope_counter[0], sizeof(st.envelope_counter[0]), KEEP_ON_RESET }, { &st.envelope_counter[1], sizeof(st.envelope_counter[1]), KEEP_ON_RESET }, { &st.envelope_counter[2], sizeof(st.envelope_counter[2]), KEEP_ON_RESET }, { &st.envelope_state[0], sizeof(st.envelope_state[0]), KEEP_ON_RESET }, { &st.envelope_state[1], sizeof(st.envelope_state[1]), KEEP_ON_RESET }, { &st.envelope_state[2], sizeof(st.envelope_state[2]), KEEP_ON_RESET }, { &st.hold_zero[0], sizeof(st.hold_zero[0]), KEEP_ON_RESET }, { &st.hold_zero[1], sizeof(st.hold_zero[1]), KEEP_ON_RESET }, { &st.hold_zero[2], sizeof(st.hold_zero[2]), KEEP_ON_RESET }, { NULL, 0, 0 }}; registerSnapshotItems(items, sizeof(items)); // Set default values setChipModel(MOS6581); cpuFrequency = PAL_CYCLES_PER_FRAME * PAL_REFRESH_RATE; samplingMethod = SAMPLE_FAST; sampleRate = 44100; sid->set_sampling_parameters(cpuFrequency, samplingMethod, sampleRate); setAudioFilter(false); setExternalAudioFilter(false); volume = 100000; targetVolume = 100000; }