• Create Account

Need scary sound effects or creepy audio loops for your next horror-themed game? Check out Highscore Vol.3 - The Horror Edition in our marketplace. 50 sounds and 10 loops for only \$9.99!

### #ActualNik02

Posted 18 October 2012 - 01:56 AM

If the CoCreateInstance call succeeds, m_6[iDeviceNum].m_4 contains a pointer to the IDirectSound interface. It may or may not be subclass of that, because "EAXDirectSound" can be Creative's custom implementation of the object. However:

The following lines call functions that are offset by 40 and 24 from the vtable of the object. You could use dumpbin to try to find out what symbolic function names correspond to those offsets (if they have exported symbols, which is likely here).

Without using dumpbin, we can make an educated guess as to what those functions are by observing the parameters, since the interface itself is not very complex:

-The first call (to offset 40) is very likely an Initialize call, since it takes a device instance GUID as its parameter (the m_1 field of the structure).
-The second call (to offset 24) is likely a call to SetCooperativeLevel, with the window handle and "3" as parameters ("3" means DSSCL_EXCLUSIVE, see SDK docs for explaination).

If these are correct assumptions, the code you have presented has nothing to do with actually using EAX. In general, to use EAX, your app sets EAX parameters by obtaining IKsPropertySet interfaces from your secondary sound buffers, and calling its Get and Set methods as appropriate.

The code looks like it has been obfuscated purposefully; if this is not the case, the coder may be too "clever" for his/her own benefit. The last block of code could be refactored as follows to improve readability:

if(CoCreateInstance(&CLSID_EAXDirectSound8, 0, CLSCTX_INPROC_SERVER, IID_IDirectSound8, (LPVOID*) &m_6[iDeviceNum].m_4)==S_OK)
{
LPDIRECTSOUND8 pDS = (LPDIRECTSOUND8)m_6[iDeviceNum].m_4;
pDS->Initialize(&m_6[iDeviceNum].m_1); // (*(*m_6[iDeviceNum].m_4+40))(m_6[iDeviceNum].m_4, &m_6[iDeviceNum].m_1);
pDS->SetCooperativeLevel(m_hTestWindow, DSSCL_EXCLUSIVE); // (*(*m_6[iDeviceNum].m_4+24))(m_6[iDeviceNum].m_4, m_hTestWindow, 3);
}


### #3Nik02

Posted 18 October 2012 - 01:49 AM

If the CoCreateInstance call succeeds, m_6[iDeviceNum].m_4 contains a pointer to the IDirectSound interface. It may or may not be subclass of that, because "EAXDirectSound" can be Creative's custom implementation of the object. However:

The following lines call functions that are offset by 40 and 24 from the vtable of the object. You could use dumpbin to try to find out what symbolic function names correspond to those offsets (if they have exported symbols, which is likely here).

Without using dumpbin, we can make an educated guess as to what those functions are by observing the parameters, since the interface itself is not very complex:

-The first call (to offset 40) is very likely an Initialize call, since it takes a device instance GUID as its parameter (the m_1 field of the structure).
-The second call (to offset 24) is likely a call to SetCooperativeLevel, with the window handle and "3" as parameters ("3" means DSSCL_EXCLUSIVE, see SDK docs for explaination).

If these are correct assumptions, the code you have presented has nothing to do with actually using EAX. In general, to use EAX, your app sets EAX parameters by obtaining IKsPropertySet interfaces from your secondary sound buffers, and calling its Get and Set methods as appropriate.

The code looks like it has been obfuscated purposefully; if this is not the case, the coder may be too "clever" for his/her own benefit. The last block of code could be refactored as follows to improve readability:

if(CoCreateInstance(&CLSID_EAXDirectSound8, 0, CLSCTX_INPROC_SERVER, IID_IDirectSound8, (LPVOID*) &m_6[iDeviceNum].m_4)==S_OK)
{
LPDIRECTSOUND8 pDS = (LPDIRECTSOUND8)m_6[iDeviceNum].m_4;
pDS->Initialize(&m_6[iDeviceNum].m_1); // (*(*m_6[iDeviceNum].m_4+40))(m_6[iDeviceNum].m_4, &m_6[iDeviceNum].m_1);
pDS->SetCooperativeLevel(m_hTestWindow, DDSCL_EXCLUSIVE); // (*(*m_6[iDeviceNum].m_4+24))(m_6[iDeviceNum].m_4, m_hTestWindow, 3);
}


### #2Nik02

Posted 18 October 2012 - 01:41 AM

If the CoCreateInstance call succeeds, m_6[iDeviceNum].m_4 contains a pointer to the IDirectSound interface. It may or may not be subclass of that, because "EAXDirectSound" can be Creative's custom implementation of the object. However:

The following lines call functions that are offset by 40 and 24 from the vtable of the object. You could use dumpbin to try to find out what symbolic function names correspond to those offsets (if they have exported symbols, which is likely here).

Without using dumpbin, we can make an educated guess as to what those functions are by observing the parameters, since the interface itself is not very complex:

-The first call (to offset 40) is very likely an Initialize call, since it takes a device instance GUID as its parameter (the m_1 field of the structure).
-The second call (to offset 24) is likely a call to SetCooperativeLevel, with the window handle and "3" as parameters ("3" means DSSCL_EXCLUSIVE, see SDK docs for explaination).

If these are correct assumptions, the code you have presented has nothing to do with actually using EAX. In general, to use EAX, your app sets EAX parameters by obtaining IKsPropertySet interfaces from your secondary sound buffers, and calling its Get and Set methods as appropriate.

The code looks like it has been obfuscated purposefully; if this is not the case, the coder may be too "clever" for his/her own benefit.

### #1Nik02

Posted 18 October 2012 - 01:38 AM

If the CoCreateInstance call succeeds, m_6[iDeviceNum].m_4 contains a pointer to the IDirectSound interface. It may or may not be subclass of that, because "EAXDirectSound" can be Creative's custom implementation of the object. However:

The following lines call functions that are offset by 40 and 24 from the vtable of the object. You could use dumpbin to try to find out what symbolic functions correspond to those offsets (if they have exported symbols, which is likely here).

Without using dumpbin, we can make an educated guess as to what those functions are by observing the parameters, since the interface itself is not very complex:

-The first call (to offset 40) is very likely an Initialize call, since it takes a device instance GUID as its parameter (the m_1 field of the structure).
-The second call (to offset 24) is likely a call to SetCooperativeLevel, with the window handle and "3" as parameters ("3" means DSSCL_EXCLUSIVE, see SDK docs for explaination).

If these are correct assumptions, the code you have presented has nothing to do with actually using EAX. In general, to use EAX, your app sets EAX parameters by obtaining IKsPropertySet interfaces from your secondary sound buffers, and calling its Get and Set methods as appropriate.

The code looks like it has been obfuscated purposefully; if this is not the case, the coder may be too "clever" for his/her own benefit.

PARTNERS