Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General DSound Coding Bug Issue #485

Open
RadWolfie opened this issue Jun 4, 2017 · 19 comments
Open

General DSound Coding Bug Issue #485

RadWolfie opened this issue Jun 4, 2017 · 19 comments
Labels
bug a real issue of the emulator game-compatibility game specific issue help wanted other devs should help HLE High Level Emulation sound APU and/or game sound related

Comments

@RadWolfie
Copy link
Member

RadWolfie commented Jun 4, 2017

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)
  • OutRun 2006 (report by Voxel9)
    • Crashed at 0x001FBAC3(=XACTEngineCreate+0x215) for 0xC0000094 (STATUS_INTEGER_DIVIDE_BY_ZERO)
  • Richard Burns Rally (report by Voxel9)
  • 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)

Current code bugs:

  • N/A

Still an issue for below?

  • N/A
@RadWolfie
Copy link
Member Author

RadWolfie commented Jun 4, 2017

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.

@blueshogun96
Copy link
Contributor

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

@RadWolfie
Copy link
Member Author

RadWolfie commented Jun 4, 2017

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. 😃

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

@ghost
Copy link

ghost commented Jul 23, 2017

#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

@PatrickvL PatrickvL added help wanted other devs should help sound APU and/or game sound related labels Jul 27, 2017
@MarcoLoves360
Copy link

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

@PatrickvL PatrickvL added the OOVPA Optimized Offset Value Pair Array label Aug 15, 2017
@RadWolfie RadWolfie self-assigned this Aug 27, 2017
@revel8n
Copy link
Contributor

revel8n commented Oct 14, 2017

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.

@RadWolfie
Copy link
Member Author

RadWolfie commented Oct 14, 2017

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.

@revel8n
Copy link
Contributor

revel8n commented Oct 14, 2017

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.

@RadWolfie RadWolfie removed their assignment Nov 11, 2017
@RadWolfie
Copy link
Member Author

RadWolfie commented Feb 27, 2018

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 Dsound fixes part2 #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 Dsound fixes part2 #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.

@hotzenplotz3000
Copy link

@RadWolfie Driver 3 Cxbx-Reloaded/game-compatibility#356 reports this error:

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

@Crimsom13
Copy link

Build: 9f66d00 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

@PatrickvL
Copy link
Member

I left a review comment here that might be related to this : 270a821#r28802750

@RadWolfie RadWolfie added bug a real issue of the emulator game-compatibility game specific issue HLE High Level Emulation and removed OOVPA Optimized Offset Value Pair Array labels May 15, 2018
@gandalfthewhite19890404
Copy link
Contributor

Mortal Kombat Deception also log this issue in log.

@Ale100000
Copy link

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

@RadWolfie
Copy link
Member Author

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)

@T02my
Copy link

T02my commented Apr 11, 2020

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

@ObiKKa
Copy link

ObiKKa commented May 10, 2020

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):

@dtowell
Copy link

dtowell commented Feb 5, 2021

SSX 3 (US) has no audio but does not report any type of failure as far as I can tell. (Should I report this someplace else?)

@NZJenkins
Copy link
Contributor

Peter Jackson's King Kong is full of CreateSound3DBuffer Failed!
Then

[0x4DBC] WARN : DSBUFFERCreateSound3DBuffer Failed!
[0x4B04] WARN : DSBUFFERCould not set notification position(s)!
Return result report: 0x88780032
In EmuPatch_IDirectSoundBuffer_SetNotificationPositions (c:\users\oem\desktop\repos\cxbx-reloaded\src\core\hle\dsound\directsound\directsoundbuffer.cpp)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug a real issue of the emulator game-compatibility game specific issue help wanted other devs should help HLE High Level Emulation sound APU and/or game sound related
Projects
None yet
Development

No branches or pull requests