From 6ea5e1f5202d3dfc7504a825565b3b0cefe63bf5 Mon Sep 17 00:00:00 2001 From: Prashant Vaibhav Date: Fri, 30 Jan 2026 18:59:56 +0530 Subject: [PATCH] fix(minarch): improved 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. --- workspace/all/minarch/minarch.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/workspace/all/minarch/minarch.c b/workspace/all/minarch/minarch.c index b257d81b0..e6f1d47fb 100644 --- a/workspace/all/minarch/minarch.c +++ b/workspace/all/minarch/minarch.c @@ -4643,6 +4643,19 @@ static bool environment_callback(unsigned cmd, void *data) { // copied from pico *out = core.saves_dir; // save_dir; break; } + case RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO: { /* 32 */ + const struct retro_system_av_info *av = (const struct retro_system_av_info *)data; + if (av) { + double a = av->geometry.aspect_ratio; + if (a <= 0) a = (double)av->geometry.base_width / av->geometry.base_height; + + core.fps = av->timing.fps; + core.sample_rate = av->timing.sample_rate; + core.aspect_ratio = a; + renderer.dst_p = 0; + } + return true; + } case RETRO_ENVIRONMENT_SET_CONTROLLER_INFO: { /* 35 */ // LOG_info("RETRO_ENVIRONMENT_SET_CONTROLLER_INFO\n"); const struct retro_controller_info *infos = (const struct retro_controller_info *)data; @@ -4668,6 +4681,16 @@ static bool environment_callback(unsigned cmd, void *data) { // copied from pico RA_setMemoryMap(mmap); break; } + case RETRO_ENVIRONMENT_SET_GEOMETRY: { /* 37 */ + const struct retro_game_geometry *geom = (const struct retro_game_geometry *)data; + if (geom) { + double a = geom->aspect_ratio; + if (a <= 0) a = (double)geom->base_width / geom->base_height; + core.aspect_ratio = a; + renderer.dst_p = 0; + } + return true; + } case RETRO_ENVIRONMENT_GET_LANGUAGE: { /* 39 */ // puts("RETRO_ENVIRONMENT_GET_LANGUAGE"); if (data) *(int *) data = RETRO_LANGUAGE_ENGLISH; @@ -4790,6 +4813,7 @@ static bool environment_callback(unsigned cmd, void *data) { // copied from pico if (data) { OptionList_reset(); OptionList_v2_init((const struct retro_core_options_v2 *)data); + Config_readOptions(); } break; } @@ -4797,8 +4821,11 @@ static bool environment_callback(unsigned cmd, void *data) { // copied from pico // puts("RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL"); if (data) { const struct retro_core_options_v2_intl *intl = (const struct retro_core_options_v2_intl *)data; - OptionList_reset(); - OptionList_v2_init(intl->us); + if (intl && intl->us) { + OptionList_reset(); + OptionList_v2_init(intl->us); + Config_readOptions(); + } } break; }