Mercurial > repos > blastem
comparison genesis.c @ 2486:e8eba0cd5444
Implement turbo/slow for Pico and Copera
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 14 Apr 2024 12:30:32 -0700 |
parents | 59a299610662 |
children | bfd09d3367ba |
comparison
equal
deleted
inserted
replaced
2485:59a299610662 | 2486:e8eba0cd5444 |
---|---|
1874 static void set_speed_percent(system_header * system, uint32_t percent) | 1874 static void set_speed_percent(system_header * system, uint32_t percent) |
1875 { | 1875 { |
1876 genesis_context *context = (genesis_context *)system; | 1876 genesis_context *context = (genesis_context *)system; |
1877 uint32_t old_clock = context->master_clock; | 1877 uint32_t old_clock = context->master_clock; |
1878 context->master_clock = ((uint64_t)context->normal_clock * (uint64_t)percent) / 100; | 1878 context->master_clock = ((uint64_t)context->normal_clock * (uint64_t)percent) / 100; |
1879 while (context->ym->current_cycle != context->psg->cycles) { | 1879 if (context->header.type != SYSTEM_PICO && context->header.type != SYSTEM_COPERA) { |
1880 sync_sound(context, context->psg->cycles + MCLKS_PER_PSG); | 1880 while (context->ym->current_cycle != context->psg->cycles) { |
1881 } | 1881 sync_sound(context, context->psg->cycles + MCLKS_PER_PSG); |
1882 if (context->expansion) { | 1882 } |
1883 segacd_context *cd = context->expansion; | 1883 if (context->expansion) { |
1884 segacd_set_speed_percent(cd, percent); | 1884 segacd_context *cd = context->expansion; |
1885 } | 1885 segacd_set_speed_percent(cd, percent); |
1886 ym_adjust_master_clock(context->ym, context->master_clock); | 1886 } |
1887 ym_adjust_master_clock(context->ym, context->master_clock); | |
1888 } else { | |
1889 while (context->adpcm->cycle != context->psg->cycles) { | |
1890 sync_sound_pico(context, context->psg->cycles + MCLKS_PER_PSG); | |
1891 } | |
1892 if (context->ymz) { | |
1893 ymz263b_adjust_master_clock(context->ymz, context->master_clock); | |
1894 } | |
1895 pico_pcm_adjust_master_clock(context->adpcm, context->master_clock); | |
1896 } | |
1887 psg_adjust_master_clock(context->psg, context->master_clock); | 1897 psg_adjust_master_clock(context->psg, context->master_clock); |
1888 } | 1898 } |
1889 | 1899 |
1890 void set_region(genesis_context *gen, rom_info *info, uint8_t region) | 1900 void set_region(genesis_context *gen, rom_info *info, uint8_t region) |
1891 { | 1901 { |
2209 } | 2219 } |
2210 if (gen->header.type == SYSTEM_PICO || gen->header.type == SYSTEM_COPERA) { | 2220 if (gen->header.type == SYSTEM_PICO || gen->header.type == SYSTEM_COPERA) { |
2211 pico_pcm_free(gen->adpcm); | 2221 pico_pcm_free(gen->adpcm); |
2212 free(gen->adpcm); | 2222 free(gen->adpcm); |
2213 if (gen->ymz) { | 2223 if (gen->ymz) { |
2214 //TODO: call cleanup function once it exists | 2224 ymz263b_free(gen->ymz); |
2215 free(gen->ymz); | 2225 free(gen->ymz); |
2216 } | 2226 } |
2217 } else { | 2227 } else { |
2218 ym_free(gen->ym); | 2228 ym_free(gen->ym); |
2219 } | 2229 } |