Cxbx-reloaded: General DSound Coding Bug Issue

Created on 4 Jun 2017  路  17Comments  路  Source: Cxbx-Reloaded/Cxbx-Reloaded

Last update: 2020/25/1

The purpose of this issue filed is to keep a log of changes relative to DSound code bug need to be resolve.

Stable:

  • Xbox Dashboards
  • Xbox Online
  • Descent
  • Panzer Dragoon ORTA
  • Turok Evolution
  • Smashing Drive
  • Psyvariar 2 - Extend Edition
  • Jet Set Radio Future
  • AMF Extreme Bowling
  • The Simpsons: Road Rage
  • Ghost Recon sequels

- Plus among other titles too.

Current Title Issues:

  • Turok Evolution (report by RadWolfie, need verification)

    • HybridDirectSound3DBuffer_SetConeOrientation return 0x80070057 (DSERR_INVALIDPARAM)

  • Panzer Dragoon ORTA (report by RadWolfie, need verification)

    • HybridDirectSound3DBuffer_SetAllParameters return 0x80070057 (DSERR_INVALIDPARAM)

  • Rayman 3 (report by RadWolfie)

    • No audio on first intro (Using XADPCM audio; Unverified for 2nd intro, PCM audio, due to crash before it.)

  • Jet Set Radio Future (report by RadWolfie, need verification)

    • EmuPatch_IDirectSound_SetOrientation return 0x80070057 (DSERR_INVALIDPARAM)

  • Steel Battalion (report by jackchenwkh)
  • OutRun 2006 (report by Voxel9)

    • Crashed at 0x001FBAC3(=XACTEngineCreate+0x215) for 0xC0000094 (STATUS_INTEGER_DIVIDE_BY_ZERO)

  • Richard Burns Rally (report by Voxel9)
  • The Hobbit (report by jeltaqq and tester from discord)
  • Call of Duty 3 (report by Ale100000)
  • Dragon's Lair (discover by youtube, https://www.youtube.com/watch?v=tL0sPCe5OUw)

    • Voiceover audio seems to be playing too fast.

  • Call of Duty: Finest Hour (report by Ale100000)

    • SetCurrentPosition error: 0x80070057 (DSERR_INVALIDPARAM)

- Only has little info: https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/issues/485#issuecomment-412313852

Current code bugs:

- N/A

Still an issue for below?
Current Title(s) with no audio: (affected AFTER merge from #514 HLE-Audio-Improvement)

  • Cxbx-Reloaded/game-compatibility#111 Madagascar (unable to verify if issue is resolved or work as intended)
HLE bug game-compatibility help wanted sound

Most helpful comment

dragons lair 3d reporting to this aswell after the pop up i get black screen but the audio still plays
untitled

All 17 comments

Can anyone care to explain why CMcpxStream_Pause has a 4928 ref in DSound.1.0.4627.inl file? I had looked in blame section to find out who establish this coding bug. Turns out, there's no change of this XREF version since beginning of the file. @LukeUsher was the last person except the commit says it was revert back. Nothing else before it.

Reason for this is to able implement missing DirectSound_CDirectSoundStream_Pause function patch since Turok Evolution and Rayman Arena are not calling DirectSound_CDirectSoundStream_Pause function to play/stop audio during Intro videos. I am able to verify Taz - Wanted is calling it during Intro video.

Thanks @blueshogun96 for incorrect version in my post.

Are you sure you aren't referring to 4928? There was no 5928 XDK.

If that is the case, then it's intentional. Ever since the days of sir caustik and kingofc releasing 0.8.0, 4928 was redirected to 4627 since they were so highly similar. Cxbx will search for that signature accordingly, even if we redirect most of the signatures to 4627. Now, if it's causing a false positive, then we have a bug that needs fixing. If you can verify that, feel free to fix.

Shogun

Only thing I can verify it is not finding DirectSound_CDirectSoundStream_Pause address for both [XDK 4627] Turok Evolution and [XDK 4627] Rayman Arena games. However, it is finding CMcpxStream_Pause address. Note, I am looking in HLE Cache files for this verification. When I look at both addresses in Taz - Wanted and Turok Evolution, it looks different. Even the caller feels different as well. Something tells me this is the wrong location for CMcpxStream_Pause for both Turok E. and Taz plus other XDK 4627+ titles. I am still researching for correct location...

Thanks for the confirmation @blueshogun96 btw. :smiley:

Edit: I just need to separate asm code to see it better. Well, it's at same location and leading to apparently correct function since both are identical. Look like it was not included nor executed, next question would be how does xbox know when to play it? Hmm... In Taz - Wanted, I did see it make a pause first then play flag.

Edit2: Hmm, Turok E. and Rayman Arena titles appear does not need to wait and start playing audio. Except there's an issue with XADPCM playing with Rayman Arena for first video. This should be fun.

Edit3: Resolved

455 (Splinter Cell: Pandora Tomorrow [online.xbe]) is reporting an error related to this.

scpt o 1

.xbe info: Xbe.txt

Kernel Debug file: KrnlDebug.txt

dragons lair 3d reporting to this aswell after the pop up i get black screen but the audio still plays
untitled

Turok Evolution (report by RadWolfie)
Jet Set Radio Future
HybridDirectSound3DBuffer_SetConeOrientation return 0x80070057 (DSERR_INVALIDPARAM)

It looks like this is caused by (0, 0, 0) being sent as the (x, y, z) parameters to the function.

The PC version of SetConeOrientation performs validation on the vector that is passed in, while the xbox version of the function does not.

Since it is expecting a direction vector, that it will in turn normalize, a zero vector is invalid when passed to the PC version of SetConeOrientation.

Correct, which I am so confused about it. There is no documentation of float range acceptable in all 3 parameters, for x y z values. The only thing I ever get was the default value for x: 0, y: 0, z: 1.0f.

I was hoping CDirectSoundVoice_SetConeOrientation might be false detection in WIP_HLEDB_v2 branch. Turns out I was wrong, it is at correct location.

Is it possible these title developers made some mistake about the z value? If so, the only solution we can do is to check if all 3 values has a zero then set z value to 1 for default.

Edit: Or skip the call to PC's DirectSound.

i have not checked to see at which point it is calling this, but the xbox version does not even look like it performs normalization on the values. They are just passed through and stored. Whereas the PC version check for NaN, Length > 0, Normalizes, and then i believe stores the value.

So the zero vector could just be some sort of internal initialization/invalidation of the cone orientation.

But, yeah, i cannot be sure on that. Checking for zero and skipping if so i guess is not so bad (that is what i am doing locally), it is not necessarily a performance critical function.

But it would be good to better understand why it is used this way as well.

Since I'm not quite happy with HLE DSound. I plan on make little bit of improvements next month or sooner.

NOTE: This is a self-planned improvement list.

  • Implement Discontinuity and Flush. (This might will fix audio distort.) Fixed in PR #1073
  • Locks should wait until DoWork function is called then read written data back to host as PCM format. (I think some titles does not have DoWork called after the locks? The goal is to add a flag or check lock ptr is not nulled.)
  • Use alternate method for SetOrientation base on SetConeOrientation.

    • Thanks @hotzenplotz3000 for reporting this, see post below. I couldn't find out what I missed for pop up warning message.

  • Fix several switch methods into a flag bit checks to avoid fatal crash. Since a few titles do combine the defined values.

    • One has been corrected: StopEx

  • Fix silent audio for JSRF issue on sound effects such as... (PS: This is not happening on PR, it happened somewhere in master.) Fixed in PR #1073

    • slide on rail

    • jump

    • etc

Test cases:

  • Sneak King - there are several spots on the map where you can hide, when walking near them a graphic with the Y button will appear and a sound cue will play. In Cxbx-Reloaded the sound is extremely quiet (I had to second guess myself a few times) Report by @CakeLancelot

    • Is happening in master branch.

@RadWolfie Driver 3 https://github.com/Cxbx-Reloaded/game-compatibility/issues/356 reports this error:

Return result report: 0x80070057
In EmuPatch_IDirectSound_SetOrientation (..\..\src\CxbxKrnl\EmuDSound.cpp)

Build: 9f66d00a dsfix 2
Hunter the reckoning

Hunter the reckoning has a ambient background sound trigger issue, when the sound box is entered the game freezes until the audio track finishes playing(4seccond), then the new ambient audio track takes over. Same with menus press pause swatches to no audio lags 4 a certain amount of time.

Org:"D:\MEDIA\Sounds\BGMusic\drip.wav"
New:"$XbePath\MEDIA\Sounds\BGMusic\drip.wav"
[0x1448] WARN: Use of unsupported pdssd->dwFlags mask(s) (0x00040000)
DEBUG: SetVolume | lVolume = 0 | volumeMixbin = 0 | dwHeadroom = 600
[0x1448] WARN: EmuDirectSound_CDirectSoundStream_GetInfo is not yet supported!

KrnlDebug.txt

Mortal Kombat Deception also log this issue in log.

Call of Duty: Finest Hour

[0x2A9C] WARN: SetCurrentPosition Failed!
Return result report: 0x80070057
In EmuPatch_IDirectSoundBuffer_SetCurrentPosition (c:\projects\cxbx-reloaded\src\cxbxkrnl\emudsound.cpp)

Xbe.txt

Update:
Two titles has been removed from current issues list. Since they are resolved in latest develop build.

  • Hunter: The Reckoning (final resolve in pr 1823)
  • MechAssault (resolve in pr 1815)

Enclave (Apr 9 2020 build) crashes "directsoundbuffer unlock failed"

Ah, this is the place to report these DSound problems.
A new issue has just popped up recently for the game below:

Another game, Madagascar (referred from the bottom of the current OP's body), does have an audio problem, if I recall rightly. I saw a recent video by Literalmente{game} where the dialogue audio seems to loop twice or thrice. So definitely check that out. I think I also saw a comment on Discord or game compat repo where one user reported a similar problem (general sound effects or music?) in another game. Can't remember which game.

Addendum: The latest post in the open Madagascar issue page, that was put up on June 2019, actually confirmed the repeating audio issue among many other problems.

Edit (May 19, 2020):

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PatrickvL picture PatrickvL  路  3Comments

jackchentwkh picture jackchentwkh  路  3Comments

PatrickvL picture PatrickvL  路  3Comments

PatrickvL picture PatrickvL  路  3Comments

Kumoashi picture Kumoashi  路  3Comments