crazii / SBEMU

legacy sound blaster emulation for DOS
GNU General Public License v2.0
626 stars 33 forks source link

SBEMU issues with FastDoom #88

Closed viti95 closed 9 months ago

viti95 commented 9 months ago

There are some issues with FastDoom, mainly SB emulation is not working properly. FastDoom uses DOS32/A extender instead of DOS/4G. It's working fine on real hardware, so there is some kind of incompatibility.

Here is a message from @Baron-von-Riedesel in VOGONS to make it partially compatible:

"Well, I played a bit with Fastdoom and can say that it partially works with both SBEMU and VSBHDA. There are a few issues:

I also compiled Fastdoom with Watcom v1.9, creating a HX binary instead of DOS32A - it works."

crazii commented 9 months ago

Novcpi is needed for some games and there's no good solution. But the crash is a serious problem that should be fixed, thanks for the feedback!

crazii commented 9 months ago

I test the with the latest build of SBEMU and FastDOOM, and it fails with 'Error Initializing Music device: -1`, no crashes, I will try to fix the Adlib handling.

EDIT: after disable VCPI it crahses.

hjnijlunsing commented 9 months ago

When selecting no FM and Sound Blaster as FX (Both with direct and non-direct) it fails with "Error setup Sound device: -1", thus SFX does not work on my machine

crazii commented 9 months ago

When selecting no FM and Sound Blaster as FX (Both with direct and non-direct) it fails with "Error setup Sound device: -1", thus SFX does not work on my machine

did you run jemmex novcpi after sbemu? fastdoom/dos32a needs this to work.

hjnijlunsing commented 9 months ago

My bad, indeed that solves the FX...

crazii commented 9 months ago

I'm debugging it, and some information might help, since you are the owner of fast doom, it might be more easy that I ask you directly: how many tasks are installed by TS_ScheduleTask when sound blaster SFX + sound blaster music are selected? As I read the code of fastdoom, it seems only _MIDI_ServiceRoutine are used, besides I_TimerISR/I_TimerMS. Does any of those effective tasks calls any real mode code directly/indirectly? I didn't found any but the problem might be related to it. I added detailed log to hdpmi32i but it seems hdpmi32i works as expected - still need more debugging.

Also I found an irrelevant problem: fast doom has no opl music on DOSBox-X, for default opl or nuked opl emulation, general midi / sound blaster midi works. You can ignore it if DOSBox is not intended to be supported. - EDIT: it has music but the volume is low so I didn't notice it.

EDIT: Please note that the information I asked doesn't indicates the problem exists in Fastdoom or Dos32A, actually it could be in any code, and the information will help me identifying it.

crazii commented 9 months ago

Never mind. I just found the in-compatibility problem, but currently there's no way to fix it in SBEMU or HDPMI, because HDPMI does what the DPMI spec requires. I modified the code of FastDoom a little bit so that it works with HDPMI/SBEMU, and I believe it also works as the original code (for the real SB HW).

I'll create a PR tomorrow.

viti95 commented 9 months ago

I'm really curious to see what's doing DOS32/A different. Sorry for not being able to provide more feedback/information, these days have been quite stressing for me. Thanks.

crazii commented 9 months ago

No problem. What I did is just switching to a pm stack. check this PR for details.

viti95 commented 9 months ago

I've been testing this on multiple PC's and it's working really good, so we can close this issue. Thanks!!