Skip to content

Commit 7beec00

Browse files
committed
minarch: fixes for DOSBox frame rate sync
- Properly sync current values for config knobs when using CORE_OPTIONS_V2 so cores see config values during init - Honor SET_SYSTEM_AV_INFO and SET_GEOMETRY to keep fps/aspect in sync (fixes DOSBox Pure force output FPS until toggle) Note that DOSBox pure is not part of NextUI right now, but these minarch fixes are necessary for any external DOS pak to work.
1 parent 9810ba8 commit 7beec00

1 file changed

Lines changed: 29 additions & 2 deletions

File tree

workspace/all/minarch/minarch.c

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4616,6 +4616,19 @@ static bool environment_callback(unsigned cmd, void *data) { // copied from pico
46164616
*out = core.saves_dir; // save_dir;
46174617
break;
46184618
}
4619+
case RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO: { /* 32 */
4620+
const struct retro_system_av_info *av = (const struct retro_system_av_info *)data;
4621+
if (av) {
4622+
double a = av->geometry.aspect_ratio;
4623+
if (a <= 0) a = (double)av->geometry.base_width / av->geometry.base_height;
4624+
4625+
core.fps = av->timing.fps;
4626+
core.sample_rate = av->timing.sample_rate;
4627+
core.aspect_ratio = a;
4628+
renderer.dst_p = 0;
4629+
}
4630+
return true;
4631+
}
46194632
case RETRO_ENVIRONMENT_SET_CONTROLLER_INFO: { /* 35 */
46204633
// LOG_info("RETRO_ENVIRONMENT_SET_CONTROLLER_INFO\n");
46214634
const struct retro_controller_info *infos = (const struct retro_controller_info *)data;
@@ -4636,6 +4649,16 @@ static bool environment_callback(unsigned cmd, void *data) { // copied from pico
46364649
break;
46374650
}
46384651
// RETRO_ENVIRONMENT_SET_MEMORY_MAPS (36 | RETRO_ENVIRONMENT_EXPERIMENTAL)
4652+
case RETRO_ENVIRONMENT_SET_GEOMETRY: { /* 37 */
4653+
const struct retro_game_geometry *geom = (const struct retro_game_geometry *)data;
4654+
if (geom) {
4655+
double a = geom->aspect_ratio;
4656+
if (a <= 0) a = (double)geom->base_width / geom->base_height;
4657+
core.aspect_ratio = a;
4658+
renderer.dst_p = 0;
4659+
}
4660+
return true;
4661+
}
46394662
case RETRO_ENVIRONMENT_GET_LANGUAGE: { /* 39 */
46404663
// puts("RETRO_ENVIRONMENT_GET_LANGUAGE");
46414664
if (data) *(int *) data = RETRO_LANGUAGE_ENGLISH;
@@ -4758,15 +4781,19 @@ static bool environment_callback(unsigned cmd, void *data) { // copied from pico
47584781
if (data) {
47594782
OptionList_reset();
47604783
OptionList_v2_init((const struct retro_core_options_v2 *)data);
4784+
Config_readOptions();
47614785
}
47624786
break;
47634787
}
47644788
case RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL: { /* 68 */
47654789
// puts("RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL");
47664790
if (data) {
47674791
const struct retro_core_options_v2_intl *intl = (const struct retro_core_options_v2_intl *)data;
4768-
OptionList_reset();
4769-
OptionList_v2_init(intl->us);
4792+
if (intl && intl->us) {
4793+
OptionList_reset();
4794+
OptionList_v2_init(intl->us);
4795+
Config_readOptions();
4796+
}
47704797
}
47714798
break;
47724799
}

0 commit comments

Comments
 (0)