Baron-von-Riedesel / VSBHDA

Sound Blaster emulation for DOS
60 stars 3 forks source link

Feature Request: Slowdown support #9

Open hjnijlunsing opened 6 months ago

hjnijlunsing commented 6 months ago

It's very difficult to use Dos Slow down applications together with VSBHDA due to VSBHDA and Slowdown applications using some timers which can interfere. (I.e. VSBHDA will not run on 4,77Mhz, but sometimes you need to slow down to this speed for certain games).

Does it make sense to have VSBHDA also give the ability to slow down the PC in order to play games like Wing Commander I, Civilization 1, Bubble Bobble etc. with working sound.

Baron-von-Riedesel commented 6 months ago

It's very difficult to use Dos Slow down applications together with VSBHDA due to VSBHDA and Slowdown applications using some timers which can interfere.

But what timers do interfere? vsbhda uses only the sound hardware "timer" for interrupt generation - I don't think that anything else makes use of that at the same time.

I haven't analysed this deeply, but the problem might be that the SB software emulation that sbemu/vsbhda provides needs a relatively powerful cpu ( because the synthesizer, the mixer, the format conversion is all done in software ). If you slow down the CPU there's perhaps just not enough power left for all those tasks.

Baron-von-Riedesel commented 5 months ago

A possible "slow down" fix might be to disable the cache in CR0 while the game is running, but (re)enable it during sound hardware interrupt time. This will allow to run VSBHDA code at full speed, while the game runs significantly slower.

Have to try that out...

Baron-von-Riedesel commented 5 months ago

Experimentally there's now a /SD cmdline option to slow down execution. Needs a numeric argument - the best value has to be found out. On my system, if I select /SD115, the shareware version of Decent becomes playable.

hjnijlunsing commented 5 months ago

Nice! Do you have a binary which I could test? Otherwise I'll await the next release ;-) Very curious if this allows for Wing Commander I to be played.

Baron-von-Riedesel commented 5 months ago

/SD option may now be tried in https://github.com/Baron-von-Riedesel/VSBHDA/releases/tag/v1.5pre1

hjnijlunsing commented 5 months ago

Just tried VSBHDA 1.5pre1; it hangs after running vsbhda /O1 /SD100 It returns to the command prompt; and I am able to type; but during type of cd \games\b it fails with Exception 0E

Let me know if the rest of the register dump might be useful ;-)

Baron-von-Riedesel commented 5 months ago

Well, you have to experiment. /SD100 might simply consume too much time on your machine.

hjnijlunsing commented 5 months ago

Indeed it seems that /SD50 is around the maximum on my machine where it is stable. With Bubble Bobble and BBFAST.EXE I can get it almost to work; but still seems to have some pauses every second. With Wing Commander the intro with the dirigent is slow enough, but the game itself still runs too fast.

I tried running it after setmul disabling L1 cache, but it seems that VSBHDA doesn't run after that (cannot find dmi host)

Very interesting feature; I'll continue to play with it ;-)

Baron-von-Riedesel commented 4 months ago

I tried running it after setmul disabling L1 cache, but it seems that VSBHDA doesn't run after that

I also once tried that. My guess is that the sample processing inside VSBHDA requires too much CPU power and memory bandwidth.

vicokoby commented 1 month ago

Can this be used to play Joe & Mac - Caveman Ninja? The game runs with a maximum of 65200 Hz, with more than this a "Divide Overflow" error occurs. My Pentium 4 processor is 2.66GHz, what /SD value should I use to get it closer to 65200 Hz?

By the way, I can play this game without sound by disabling cache 1 using SetMul. The problem is when I run SetMul after running vsbhda, it seems that SetMul doesn't work properly because the divide overflow occurs despite disabling cache 1.