joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.76k stars 381 forks source link

Old and mediocre Speed Haste game freezes DOSBox (happened on older DosBox versions as well) #2303

Open dodleh opened 3 years ago

dodleh commented 3 years ago

Launching Speed Haste (protected mode DOS game using embedded DOS4GW launcher) freezes DosBox (actually an old, unsolved error since DosBox 0.73-0.74)

Steps to reproduce the behavior:

Wengier commented 3 years ago

@dodleh Thanks for reporting. I can reproduce the issue with the default setting. But I think I can get rid of the issue by setting cycles=60000, then the game will play. You can try this too.

dodleh commented 3 years ago

I applogize for the late answer. Yes, I have tested with your suggested setting and it works but the inconsistency in fps and music in the main screen versus in-game points at deeper issues of the CPU emulation (of course, compounded by the fact that protected mode is used, which brings with it other problems). I have to say that it is a strange situation because it points at a another issue I noticed. In DOOM it seems that most emulators work the best (heavily tested and documented) but there are games that struggle, with little influence from the emulated system expected performance at a certain MHz metric, pointing at some problem in keeping consistent CPU cycle timing independent on context and only dependent on instruction type (one of the biggest problems in emulation that still haunts us).

In the case of Speed Haste it is strange that even on a real 600 MHz CPU this issue does not occur yet it occurs in DosBOX if cycles is above a certain value (undetermined, a lot lower than the equivalent value that could be calculated on a real system). In a typical situation the emulated system is far from a real 600 MHz CPU (a Pentium III). Probably, it could be due to a CPU governor issue on DosBox, though it could be more complex than that. Another problem with cycles=60000 is that it is not really usable in case your system struggles already with more than 20000 cycles (serious issue on Android ARM v7 systems or borderline-tolerable on Intel Core 2 Duo CPUs, for instance).