Skip to content

framerate not updated on first launch (DOSBox Pure) #619

@pvaibhav

Description

@pvaibhav

Issue

Most DOS games run at 70 Hz while our devices are likely 60 Hz. Currently the DOS.pak from the discord server, as well as a handcrafted one I made, both suffer from the issue that games run slower than normal due to this (video and audio).

Setting Core Sync to Native causes audio crackle although video seems to be fixed.

Setting 'force 60 fps' option for DOSBox under Emulator settings fixes this but it's not re-initialised at next launch even though the minarch UI shows it is.

Root cause

When using DOSBox Pure, it's possible to force a 60 fps framerate and let DOSBox handle the frame blending. Then, either Screen or Native core sync (as also Auto) should work fine. However, there are two issues with this:

  1. Even if you save the core defaults, on next launch DOSBox will get initialised but minarch still thinks it's running at 70 Hz (verified with Debug HUD option on). Only manually toggling this option in Emulator options fixes it
  2. DOSBox uses V2 of Libretro config API, and the minarch code path for V2 doesn't read the current value of V2 config knobs as it does for V1. This can cause mismatch between what the core's config option is and what minarch thinks it is on initial launch of the core.

Regarding audio crackle when sync is set to native, minarch may try to sync the 70 fps of the core to 60 fps by throwing away frames, but the audio path isn't handled correctly, leading to audio crackle while video seems fine.

The Fix

First we need to make sure V2 config API of Libretro also correctly reads the current value of each knob during setup.
Next, I handle AV info and geometry change notifications from the core correctly, so minarch correctly identifies the framerate.
Finally, this is not directly minarch related, but the DOS.pak default.cfg file should be updated to force 60fps.

Testing

I tested this on a TRIMUI Brick by re-compiling minarch under Docker on my M2 MacBook Pro, then copying only minarch.elf from the generated zip's MinUI/.system/tg5040/bin/minarch.elf to my device. Upon next launch the bug is gone.

On the stock minarch.elf the framerate is 70 when the game is launched and Debug HUD is enabled. On the new one it's correctly 60.

For reference I'm testing this with the game One Must Fall 2097.

Notes

I was not too familiar with Libretro/minarch and nextUI until today. So if I've used some unconventional terms (e.g. config knobs) please excuse that. I made use of Claude and Codex to understand minarch codebase for this bug report and the upcoming PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions