4627 directsound (turok)

This commit is contained in:
Aaron Robinson 2004-01-14 04:21:46 +00:00
parent 02f6039baf
commit d6fcd5f6c0
8 changed files with 406 additions and 12 deletions

BIN
Cxbx.opt

Binary file not shown.

View File

@ -274,6 +274,15 @@ HRESULT WINAPI EmuIDirectSound8_SetMixBinHeadroom
DWORD dwHeadroom
);
// ******************************************************************
// * func: EmuIDirectSoundBuffer8_SetMixBins
// ******************************************************************
HRESULT WINAPI EmuIDirectSoundBuffer8_SetMixBins
(
LPDIRECTSOUND8 pThis,
PVOID pMixBins // TODO: fill this out
);
// ******************************************************************
// * func: EmuIDirectSoundBuffer8_SetMixBinVolumes
// ******************************************************************

View File

@ -119,6 +119,9 @@ enum XRefDataBaseOffset
XREF_DSSETI3DL2LISTENER,
XREF_DSSETMIXBINHEADROOMA,
XREF_DSSETMIXBINHEADROOMB,
XREF_DSSETMIXBINSA,
XREF_DSSETMIXBINSB,
XREF_DSSETMIXBINSC,
XREF_DSSETMIXBINVOLUMESA,
XREF_DSSETMIXBINVOLUMESB,
XREF_DSSETMIXBINVOLUMESC,

View File

@ -593,6 +593,34 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetMixBinHeadroom
return DS_OK;
}
// ******************************************************************
// * func: EmuIDirectSoundBuffer8_SetMixBins
// ******************************************************************
HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetMixBins
(
LPDIRECTSOUND8 pThis,
PVOID pMixBins
)
{
// debug trace
#ifdef _DEBUG_TRACE
{
EmuSwapFS(); // Win2k/XP FS
printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetMixBins\n"
"(\n"
" pThis : 0x%.08X\n"
" pMixBins : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, pMixBins);
EmuSwapFS(); // XBox FS
}
#endif
// TODO: Actually do something
return DS_OK;
}
// ******************************************************************
// * func: EmuIDirectSoundBuffer8_SetMixBinVolumes
// ******************************************************************
@ -808,6 +836,12 @@ HRESULT WINAPI XTL::EmuDirectSoundCreateBuffer
pDSBufferDesc->lpwfxFormat->nAvgBytesPerSec = pDSBufferDesc->lpwfxFormat->nSamplesPerSec*pDSBufferDesc->lpwfxFormat->nBlockAlign;
pDSBufferDesc->lpwfxFormat->wBitsPerSample = 8;
/* TODO: Get ADPCM working!
pDSBufferDesc->lpwfxFormat->cbSize = 32;
#define WAVE_FORMAT_ADPCM 2
pDSBufferDesc->lpwfxFormat->wFormatTag = WAVE_FORMAT_ADPCM;
*/
}
}

View File

@ -121,9 +121,36 @@ VOID WINAPI XTL::EmuXGSwizzleRect
#endif
if(pRect == NULL && pPoint == NULL && Pitch == 0)
{
memcpy(pDest, pSource, Width*Height*BytesPerPixel);
}
else
EmuCleanup("Unhandled swizzle (temporarily)");
{
if(pPoint != NULL && (pPoint->x != 0 || pPoint->y != 0))
EmuCleanup("Temporarily unsupported swizzle (very easy fix)");
DWORD dwMaxY = Height;
DWORD dwChunkSize = Width;
uint08 *pSrc = (uint08*)pSource;
uint08 *pDst = (uint08*)pDest;
if(pRect != 0)
{
pSrc += pRect->top*Pitch;
pSrc += pRect->left;
dwMaxY = pRect->bottom - pRect->top;
dwChunkSize = pRect->right - pRect->left;
}
for(DWORD y=0;y<dwMaxY;y++)
{
memcpy(pSrc, pDst, dwChunkSize);
pSrc += Pitch;
pDst += Pitch;
}
}
EmuSwapFS(); // Xbox FS

View File

@ -230,6 +230,9 @@ extern uint32 XRefDataBase[] =
-1, // XREF_DSSETI3DL2LISTENER
-1, // XREF_DSSETMIXBINHEADROOMA
-1, // XREF_DSSETMIXBINHEADROOMB
-1, // XREF_DSSETMIXBINSA
-1, // XREF_DSSETMIXBINSB
-1, // XREF_DSSETMIXBINSC
-1, // XREF_DSSETMIXBINVOLUMESA
-1, // XREF_DSSETMIXBINVOLUMESB
-1, // XREF_DSSETMIXBINVOLUMESC

View File

@ -175,6 +175,158 @@ SOOVPA<12> IDirectSound8_SetMixBinHeadroom_1_0_4627 =
}
};
// ******************************************************************
// * CDirectSoundVoiceSettings::SetMixBins
// ******************************************************************
SOOVPA<10> CDirectSoundVoiceSettings_SetMixBins_1_0_4627 =
{
0, // Large == 0
10, // Count == 10
XREF_DSSETMIXBINSC, // XRef Is Saved
0, // XRef Not Used
{
// CDirectSoundVoiceSettings_SetMixBins+0x06 : jnz +0x1A
{ 0x06, 0x75 }, // (Offset,Value)-Pair #1
{ 0x07, 0x1A }, // (Offset,Value)-Pair #2
// CDirectSoundVoiceSettings_SetMixBins+0x08 : test byte ptr [ecx+8], 0x10
{ 0x08, 0xF6 }, // (Offset,Value)-Pair #3
{ 0x09, 0x41 }, // (Offset,Value)-Pair #4
{ 0x0A, 0x08 }, // (Offset,Value)-Pair #5
{ 0x0B, 0x10 }, // (Offset,Value)-Pair #6
// CDirectSoundVoiceSettings_SetMixBins+0x2B : jbe +0x2B
{ 0x2B, 0x76 }, // (Offset,Value)-Pair #7
{ 0x2C, 0x2B }, // (Offset,Value)-Pair #8
// CDirectSoundVoiceSettings_SetMixBins+0xB2 : retn 0x04
{ 0xB2, 0xC2 }, // (Offset,Value)-Pair #9
{ 0xB3, 0x04 }, // (Offset,Value)-Pair #10
}
};
// ******************************************************************
// * CDirectSoundVoice::SetMixBins
// ******************************************************************
SOOVPA<17> CDirectSoundVoice_SetMixBins_1_0_4627 =
{
0, // Large == 0
17, // Count == 17
XREF_DSSETMIXBINSB, // XRef Is Saved
1, // XRef Is Used
{
// CDirectSoundVoice_SetMixBins+0x0D : call [CDirectSoundVoiceSettings::SetMixBins]
{ 0x0D, XREF_DSSETMIXBINSC }, // (Offset,Value)-Pair #1
// CDirectSoundVoice_SetMixBins+0x01 : mov esi, [esp+8]
{ 0x01, 0x8B }, // (Offset,Value)-Pair #2
{ 0x02, 0x74 }, // (Offset,Value)-Pair #3
{ 0x03, 0x24 }, // (Offset,Value)-Pair #4
{ 0x04, 0x08 }, // (Offset,Value)-Pair #5
// CDirectSoundVoice_SetMixBins+0x05 : push [esp+0x0C]
{ 0x05, 0xFF }, // (Offset,Value)-Pair #6
{ 0x06, 0x74 }, // (Offset,Value)-Pair #7
{ 0x07, 0x24 }, // (Offset,Value)-Pair #8
{ 0x08, 0x0C }, // (Offset,Value)-Pair #9
// CDirectSoundVoice_SetMixBins+0x09 : mov ecx, [esi+0x10]
{ 0x09, 0x8B }, // (Offset,Value)-Pair #10
{ 0x0A, 0x4E }, // (Offset,Value)-Pair #11
{ 0x0B, 0x10 }, // (Offset,Value)-Pair #12
// CDirectSoundVoice_SetMixBins+0x11 : mov ecx, [esi+0x0C]
{ 0x11, 0x8B }, // (Offset,Value)-Pair #13
{ 0x12, 0x4E }, // (Offset,Value)-Pair #14
{ 0x13, 0x0C }, // (Offset,Value)-Pair #15
// CDirectSoundVoice_SetMixBins+0x1A : retn 0x08
{ 0x1A, 0xC2 }, // (Offset,Value)-Pair #16
{ 0x1B, 0x08 }, // (Offset,Value)-Pair #17
}
};
// ******************************************************************
// * CDirectSoundBuffer::SetMixBins
// ******************************************************************
SOOVPA<17> CDirectSoundBuffer_SetMixBins_1_0_4627 =
{
0, // Large == 0
17, // Count == 17
XREF_DSSETMIXBINSA, // XRef Is Saved
1, // XRef Not Used
{
// CDirectSoundBuffer_SetMixBins+0x32 : call [CDirectSoundVoice::SetMixBins]
{ 0x32, XREF_DSSETMIXBINSB }, // (Offset,Value)-Pair #1
// CDirectSoundBuffer_SetMixBins+0x21 : mov eax, 0x80004005
{ 0x21, 0xB8 }, // (Offset,Value)-Pair #2
{ 0x22, 0x05 }, // (Offset,Value)-Pair #3
{ 0x23, 0x40 }, // (Offset,Value)-Pair #4
{ 0x24, 0x00 }, // (Offset,Value)-Pair #5
{ 0x25, 0x80 }, // (Offset,Value)-Pair #6
// CDirectSoundBuffer_SetMixBins+0x29 : push [esp+0x10]; push [esp+0x10]
{ 0x29, 0xFF }, // (Offset,Value)-Pair #7
{ 0x2A, 0x74 }, // (Offset,Value)-Pair #8
{ 0x2B, 0x24 }, // (Offset,Value)-Pair #9
{ 0x2C, 0x10 }, // (Offset,Value)-Pair #10
{ 0x2D, 0xFF }, // (Offset,Value)-Pair #11
{ 0x2E, 0x74 }, // (Offset,Value)-Pair #12
{ 0x2F, 0x24 }, // (Offset,Value)-Pair #13
{ 0x30, 0x10 }, // (Offset,Value)-Pair #14
// CDirectSoundBuffer_SetMixBins+0x49 : pop edi
{ 0x49, 0x5F }, // (Offset,Value)-Pair #15
// CDirectSoundBuffer_SetMixBins+0x4B : retn 0x08
{ 0x4B, 0xC2 }, // (Offset,Value)-Pair #16
{ 0x4C, 0x08 }, // (Offset,Value)-Pair #17
}
};
// ******************************************************************
// * IDirectSoundBuffer8_SetMixBins
// ******************************************************************
SOOVPA<12> IDirectSoundBuffer8_SetMixBins_1_0_4627 =
{
0, // Large == 0
12, // Count == 12
-1, // XRef Not Saved
1, // XRef Is Used
{
// IDirectSoundBuffer8_SetMixBins+0x15 : call [CDirectSoundBuffer::SetMixBins]
{ 0x15, XREF_DSSETMIXBINSA }, // (Offset,Value)-Pair #1
// IDirectSoundBuffer8_SetMixBins+0x04 : push [esp+0x08]
{ 0x04, 0xFF }, // (Offset,Value)-Pair #2
{ 0x05, 0x74 }, // (Offset,Value)-Pair #3
{ 0x06, 0x24 }, // (Offset,Value)-Pair #4
{ 0x07, 0x08 }, // (Offset,Value)-Pair #5
// IDirectSoundBuffer8_SetMixBins+0x0A : add eax, 0xFFFFFFE4
{ 0x0A, 0x83 }, // (Offset,Value)-Pair #6
{ 0x0B, 0xC0 }, // (Offset,Value)-Pair #7
{ 0x0C, 0xE4 }, // (Offset,Value)-Pair #8
// IDirectSoundBuffer8_SetMixBins+0x0F : sbb ecx, ecx
{ 0x0F, 0x1B }, // (Offset,Value)-Pair #9
{ 0x10, 0xC9 }, // (Offset,Value)-Pair #10
// IDirectSoundBuffer8_SetMixBins+0x11 : and ecx, eax
{ 0x11, 0x23 }, // (Offset,Value)-Pair #11
{ 0x12, 0xC8 }, // (Offset,Value)-Pair #12
}
};
// ******************************************************************
// * CDirectSoundVoiceSettings::SetMixBinVolumes
// ******************************************************************
@ -251,9 +403,9 @@ SOOVPA<17> CDirectSoundVoice_SetMixBinVolumes_1_0_4627 =
};
// ******************************************************************
// * CDirectSound::SetMixBinVolumes
// * CDirectSoundBuffer::SetMixBinVolumes
// ******************************************************************
SOOVPA<17> CDirectSound_SetMixBinVolumes_1_0_4627 =
SOOVPA<17> CDirectSoundBuffer_SetMixBinVolumes_1_0_4627 =
{
0, // Large == 0
17, // Count == 17
@ -262,17 +414,17 @@ SOOVPA<17> CDirectSound_SetMixBinVolumes_1_0_4627 =
1, // XRef Not Used
{
// CDirectSound_SetMixBinVolumes+0x32 : call [CDirectSoundVoice::SetMixBinVolumes]
// CDirectSoundBuffer_SetMixBinVolumes+0x32 : call [CDirectSoundVoice::SetMixBinVolumes]
{ 0x32, XREF_DSSETMIXBINVOLUMESB }, // (Offset,Value)-Pair #1
// CDirectSound_SetMixBinVolumes+0x21 : mov eax, 0x80004005
// CDirectSoundBuffer_SetMixBinVolumes+0x21 : mov eax, 0x80004005
{ 0x21, 0xB8 }, // (Offset,Value)-Pair #2
{ 0x22, 0x05 }, // (Offset,Value)-Pair #3
{ 0x23, 0x40 }, // (Offset,Value)-Pair #4
{ 0x24, 0x00 }, // (Offset,Value)-Pair #5
{ 0x25, 0x80 }, // (Offset,Value)-Pair #6
// CDirectSound_SetMixBinVolumes+0x29 : push [esp+0x10]; push [esp+0x10]
// CDirectSoundBuffer_SetMixBinVolumes+0x29 : push [esp+0x10]; push [esp+0x10]
{ 0x29, 0xFF }, // (Offset,Value)-Pair #7
{ 0x2A, 0x74 }, // (Offset,Value)-Pair #8
{ 0x2B, 0x24 }, // (Offset,Value)-Pair #9
@ -282,10 +434,10 @@ SOOVPA<17> CDirectSound_SetMixBinVolumes_1_0_4627 =
{ 0x2F, 0x24 }, // (Offset,Value)-Pair #13
{ 0x30, 0x10 }, // (Offset,Value)-Pair #14
// CDirectSound_SetMixBinVolumes+0x49 : pop edi
// CDirectSoundBuffer_SetMixBinVolumes+0x49 : pop edi
{ 0x49, 0x5F }, // (Offset,Value)-Pair #15
// CDirectSound_SetMixBinVolumes+0x4B : retn 0x08
// CDirectSoundBuffer_SetMixBinVolumes+0x4B : retn 0x08
{ 0x4B, 0xC2 }, // (Offset,Value)-Pair #16
{ 0x4C, 0x08 }, // (Offset,Value)-Pair #17
}
@ -303,7 +455,7 @@ SOOVPA<12> IDirectSoundBuffer8_SetMixBinVolumes_1_0_4627 =
1, // XRef Is Used
{
// IDirectSoundBuffer8_SetMixBinVolumes+0x15 : call [CDirectSound::SetMixBinVolumes]
// IDirectSoundBuffer8_SetMixBinVolumes+0x15 : call [CDirectSoundBuffer::SetMixBinVolumes]
{ 0x15, XREF_DSSETMIXBINVOLUMESA }, // (Offset,Value)-Pair #1
// IDirectSoundBuffer8_SetMixBinVolumes+0x04 : push [esp+0x08]
@ -613,6 +765,102 @@ SOOVPA<11> CDirectSoundStream_SetVolume_1_0_4361 =
}
};
// ******************************************************************
// * CMcpxBuffer_GetStatus
// ******************************************************************
SOOVPA<11> CMcpxBuffer_GetStatus_1_0_4627 =
{
0, // Large == 0
11, // Count == 11
XREF_DSBUFFERGETSTATUSA, // XRef Is Saved
0, // XRef Not Used
{
// CMcpxBuffer_GetStatus+0x0A : mov esi, ecx
{ 0x0A, 0x8B }, // (Offset,Value)-Pair #1
{ 0x0B, 0xF1 }, // (Offset,Value)-Pair #2
// CMcpxBuffer_GetStatus+0x20 : jz +0x18
{ 0x20, 0x74 }, // (Offset,Value)-Pair #3
{ 0x21, 0x18 }, // (Offset,Value)-Pair #4
// CMcpxBuffer_GetStatus+0x22 : test word ptr [esi+0x12], 0x8002
{ 0x22, 0x66 }, // (Offset,Value)-Pair #5
{ 0x23, 0xF7 }, // (Offset,Value)-Pair #6
{ 0x24, 0x46 }, // (Offset,Value)-Pair #7
{ 0x25, 0x12 }, // (Offset,Value)-Pair #8
// CMcpxBuffer_GetStatus+0x2C : test word ptr [esi+0x12], 0x200
{ 0x2C, 0x66 }, // (Offset,Value)-Pair #9
{ 0x2D, 0xF7 }, // (Offset,Value)-Pair #10
{ 0x2E, 0x46 }, // (Offset,Value)-Pair #11
}
};
// ******************************************************************
// * CDirectSoundBuffer_GetStatus
// ******************************************************************
SOOVPA<10> CDirectSoundBuffer_GetStatus_1_0_4627 =
{
0, // Large == 0
10, // Count == 10
XREF_DSBUFFERGETSTATUSB, // XRef Is Saved
1, // XRef Is Used
{
// CDirectSoundBuffer_GetStatus+0x35 : call [CMcpxBuffer::GetStatus]
{ 0x35, XREF_DSBUFFERGETSTATUSA }, // (Offset,Value)-Pair #1
// CDirectSoundBuffer_GetStatus+0x21 : mov eax, 0x80004005
{ 0x21, 0xB8 }, // (Offset,Value)-Pair #2
{ 0x22, 0x05 }, // (Offset,Value)-Pair #3
{ 0x23, 0x40 }, // (Offset,Value)-Pair #4
{ 0x24, 0x00 }, // (Offset,Value)-Pair #5
{ 0x25, 0x80 }, // (Offset,Value)-Pair #6
// CDirectSoundBuffer_GetStatus+0x3D : jz +0x0B
{ 0x3D, 0x74 }, // (Offset,Value)-Pair #7
{ 0x3E, 0x0B }, // (Offset,Value)-Pair #8
// CDirectSoundBuffer_GetStatus+0x4E : retn 0x08
{ 0x4E, 0xC2 }, // (Offset,Value)-Pair #9
{ 0x4F, 0x08 }, // (Offset,Value)-Pair #10
}
};
// ******************************************************************
// * IDirectSoundBuffer8_GetStatus
// ******************************************************************
SOOVPA<9> IDirectSoundBuffer8_GetStatus_1_0_4627 =
{
0, // Large == 0
9, // Count == 9
-1, // XRef Not Saved
1, // XRef Is Used
{
// IDirectSoundBuffer8_GetStatus+0x15 : call [CDirectSoundBuffer::GetStatus]
{ 0x15, XREF_DSBUFFERGETSTATUSB }, // (Offset,Value)-Pair #1
// IDirectSoundBuffer8_GetStatus+0x04 : push [esp+0x08]
{ 0x04, 0xFF }, // (Offset,Value)-Pair #2
{ 0x05, 0x74 }, // (Offset,Value)-Pair #3
{ 0x06, 0x24 }, // (Offset,Value)-Pair #4
{ 0x07, 0x08 }, // (Offset,Value)-Pair #5
// IDirectSoundBuffer8_GetStatus+0x0F : sbb ecx, ecx
{ 0x0F, 0x1B }, // (Offset,Value)-Pair #6
{ 0x10, 0xC9 }, // (Offset,Value)-Pair #7
// IDirectSoundBuffer8_GetStatus+0x11 : and ecx, eax
{ 0x11, 0x23 }, // (Offset,Value)-Pair #8
{ 0x12, 0xC8 }, // (Offset,Value)-Pair #9
}
};
// ******************************************************************
// * CDirectSound::SetDistanceFactorA
// ******************************************************************
@ -918,6 +1166,40 @@ OOVPATable DSound_1_0_4627[] =
"EmuIDirectSound8_SetMixBinHeadroom"
#endif
},
// CDirectSoundVoiceSettings_SetMixBins
{
(OOVPA*)&CDirectSoundVoiceSettings_SetMixBins_1_0_4627, 0,
#ifdef _DEBUG_TRACE
"CDirectSoundVoiceSettings::SetMixBins (XREF)"
#endif
},
// CDirectSoundVoice_SetMixBins
{
(OOVPA*)&CDirectSoundVoice_SetMixBins_1_0_4627, 0,
#ifdef _DEBUG_TRACE
"CDirectSoundVoice::SetMixBins (XREF)"
#endif
},
// CDirectSoundBuffer_SetMixBins
{
(OOVPA*)&CDirectSoundBuffer_SetMixBins_1_0_4627, 0,
#ifdef _DEBUG_TRACE
"CDirectSoundBuffer::SetMixBins (XREF)"
#endif
},
// IDirectSoundBuffer8_SetMixBins
{
(OOVPA*)&IDirectSoundBuffer8_SetMixBins_1_0_4627,
XTL::EmuIDirectSoundBuffer8_SetMixBins,
#ifdef _DEBUG_TRACE
"EmuIDirectSoundBuffer8_SetMixBins"
#endif
},
// CDirectSoundVoiceSettings_SetMixBinVolumes
{
(OOVPA*)&CDirectSoundVoiceSettings_SetMixBinVolumes_1_0_4627, 0,
@ -934,12 +1216,12 @@ OOVPATable DSound_1_0_4627[] =
"CDirectSoundVoice::SetMixBinVolumes (XREF)"
#endif
},
// CDirectSound_SetMixBinVolumes
// CDirectSoundBuffer_SetMixBinVolumes
{
(OOVPA*)&CDirectSound_SetMixBinVolumes_1_0_4627, 0,
(OOVPA*)&CDirectSoundBuffer_SetMixBinVolumes_1_0_4627, 0,
#ifdef _DEBUG_TRACE
"CDirectSound::SetMixBinVolumes (XREF)"
"CDirectSoundBuffer::SetMixBinVolumes (XREF)"
#endif
},
// IDirectSoundBuffer8_SetMixBinVolumes
@ -1070,6 +1352,32 @@ OOVPATable DSound_1_0_4627[] =
"IDirectSoundBuffer8_SetBufferData"
#endif
},
// CMcpxBuffer::GetStatus
{
(OOVPA*)&CMcpxBuffer_GetStatus_1_0_4627, 0,
#ifdef _DEBUG_TRACE
"CMcpxBuffer_GetStatus (XREF)"
#endif
},
// CDirectSoundBuffer::GetStatus
{
(OOVPA*)&CDirectSoundBuffer_GetStatus_1_0_4627, 0,
#ifdef _DEBUG_TRACE
"CDirectSoundBuffer_GetStatus (XREF)"
#endif
},
// IDirectSoundBuffer8::GetStatus
{
(OOVPA*)&IDirectSoundBuffer8_GetStatus_1_0_4627,
XTL::EmuIDirectSoundBuffer8_GetStatus,
#ifdef _DEBUG_TRACE
"IDirectSoundBuffer8_GetStatus"
#endif
},
// CMcpxBuffer::Play (* unchanged since 4361 *)
{
(OOVPA*)&CMcpxBuffer_Play_1_0_4361, 0,

View File

@ -47,6 +47,16 @@ OOVPATable XG_1_0_4627[] =
"XGIsSwizzledFormat"
#endif
},
// XGSwizzleRect (* unchanged since 4361 *)
{
(OOVPA*)&XGSwizzleRect_1_0_4361,
XTL::EmuXGSwizzleRect,
#ifdef _DEBUG_TRACE
"EmuXGSwizzleRect"
#endif
},
};
// ******************************************************************