Cxbx-reloaded: REQUEST: GetCaps' structure values from retail hardware.

Created on 5 May 2018  路  10Comments  路  Source: Cxbx-Reloaded/Cxbx-Reloaded

I need IDirectSound GetCaps' DSCAPS information in order to emulate it correctly before start working on DSound fixes part3.

2DBuffers = ?
3DBuffers = ?
BufferSGEs = should be 2047 (Is already emulated)
MemoryAllocated = should be 0 by default. (Is already emulated)

I have some information and theory for 2D and 3D Buffers value. However it is not enough info and really need hardware's info. Can someone please help me with this simple task? All it need to do is create directsound then call it. That's it.

BONUS: It would be nice to know what values all 4 variables above has after calling DirectSoundUseFullHRTF and DirectSoundUseLightHRTF separately to prove my theory.

UPDATE:
Here's what the experiment xdk should do.

Create DSound
Output GetCaps (no 3D count maybe?)
Call DS UseLightHRTF (may return less 3D count)
Output GetCaps
Call DS UseFullHRTF (full 64 3D count, should be)
Output GetCaps
Create DS Buffer (8kb of buffer, 4kb per voice buffer. Might only decrement by one.)
Output GetCaps
Create DS Stream (Should only decrement by one?)
Output GetCaps
Create DS Buffer (with 3D flag)
Output GetCaps
Create DS Stream (with 3D flag)
Output GetCaps

EXTRA BONUS: Check if DS Buffer with 2kb buffer allocate loop do return out of memory error. If not, then what's the real error code? Plus how many allocated did it do? 192 or 256?

By reviewing this result can give me best idea how to correct it better.

HLE help wanted request sound

Most helpful comment

UPDATE

Turns out I am able to use both trampoline and lle audio experiment to figure out where the initialized values came from. It is from software's end instead of hardware directly.

All 10 comments

I took a shot at this last weekend. My first experiment was to stub out only the data structures I needed from dsound.h inside of main.c. and then link in the x86 dsound.lib file, which would allow me to use xboxkrnl functions. I was able to get this to compile/link under nxdk but my Xbox hung when executing DirectSoundCreate.

My second expirement was to use dsound.h and x86 dsound.lib from the Windows 8.1 SDK. I was able to get it to compile and link with nxdk but I could not include include xboxkrnl.h due to name collision between Windows headers and xboxkrnl headers. Which ultimately killed the experiment because without xboxkrnl access there is no way to print out the information returned by the calls.

I am stumped at this point and is above my level of expertise. I've included my code that I wrote and maybe someone else can finish this up.

audo_query.zip

Windows' DSound library is not the same as Xbox's DSound. You have to use Xbox's DSound library in order for xbox's hardware to work correctly.

Nxdk's xboxkrnl functions might not be accurate or not compatible enough. This is my guess. Though, I don't think this is the cause of the problem. I think you are linking to Windows' DSound library instead of Xbox's library.

That makes perfect sense. The only problem is that the nxdk does not have any audio libraries as far as I can tell. Which is why I tried the windows library since I didn't any have any other ideas.

If I understand correctly, the whole idea is to get information about the Xbox direct sound capabilities record, which can only be retrieved by means of an XDK build software title that calls GetCaps for dsound

I'll make it simple.

Nxdk (community open source 2nd version) =/= XDK (Microsoft's xbox development kit)

If you don't have XDK source files, then don't waste your time trying to get inaccessible xbox DSound library to work. Unless you do, then use the xbox directory inside xdk which contain the xbox's version of DSound.

Another approach @Fisherman166 would be to find a game which calls this method and patch the XBE to dump information to a local file.

I haven't done testing on real hardware yet (I will later :P), but from disassembling various XBEs I found the default value that these fields are initialized to:

3D Buffers = 64
2D Buffers = 192

Adding up to a total of 256 buffers.

Obviously these values are the available buffers, so they should decrement/increment as buffers are created and freed.

Yeah, my investigation lead to same result as you have base on the documentation. For some reason, it still wants to create 2047 classes of DirectSoundStream. Even if I return out of memory error.

I think two of test cases made my code not to work correctly was Mafia and Burnout.

Note for others to remember. Some titles want to create 2047 classes of Buffer, others for Stream class. Then it stop there. So, that's outside of 256 buffers limit.

EDIT: Updated the OP post.

Also, when drive into another car to crash at start of the race. I noticed long time ago about the value is 64 of attempted access of the stream(?) function for get status. It might have to do with 3D buffer count checks since it is reading GetCaps' structure pass down on the go.

UPDATE

Turns out I am able to use both trampoline and lle audio experiment to figure out where the initialized values came from. It is from software's end instead of hardware directly.

ANOTHER UPDATE

I have new idea to resolve this issue. However, the requirement is partial stubbed LLE APU in order for trampoline to work then remove GetCaps function patch. Plus trampoline method to forward handle the allocate/deallocate the buffer and stream classes. If trampoline return a fail status, do nothing plus send the status back to the title.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gandalfthewhite19890404 picture gandalfthewhite19890404  路  3Comments

LukeUsher picture LukeUsher  路  4Comments

Margen67 picture Margen67  路  3Comments

Kumoashi picture Kumoashi  路  3Comments

PatrickvL picture PatrickvL  路  3Comments