DSound etc

This commit is contained in:
Aaron Robinson 2003-07-08 01:37:46 +00:00
parent 3572305008
commit f36790b655
9 changed files with 642 additions and 65 deletions

View File

@ -67,9 +67,9 @@ typedef signed long sint32;
// * Version information
// ******************************************************************
#ifndef _DEBUG_TRACE
#define _CXBX_VERSION "0.7.6"
#define _CXBX_VERSION "0.7.7-Pre1"
#else
#define _CXBX_VERSION "0.7.6-Trace"
#define _CXBX_VERSION "0.7.7-Pre1-Trace"
#endif
// ******************************************************************

View File

@ -58,13 +58,26 @@ struct X_CDirectSoundBuffer
union // Offset: 0x20
{
PVOID pMpcxBuffer;
IDirectSoundBuffer8 *EmuDirectSoundBuffer8;
PVOID pMpcxBuffer;
IDirectSoundBuffer *EmuDirectSoundBuffer8;
};
BYTE UnknownB[0x0C]; // Offset: 0x24
};
// ******************************************************************
// * X_DSBUFFERDESC
// ******************************************************************
struct X_DSBUFFERDESC
{
DWORD dwSize;
DWORD dwFlags;
DWORD dwBufferBytes;
LPWAVEFORMATEX lpwfxFormat;
LPVOID lpMixBins; // TODO: Implement
DWORD dwInputMixBin;
};
// ******************************************************************
// * func: EmuDirectSoundCreate
// ******************************************************************
@ -75,6 +88,15 @@ HRESULT WINAPI EmuDirectSoundCreate
LPUNKNOWN pUnknown
);
// ******************************************************************
// * func: EmuDirectSoundCreateBuffer
// ******************************************************************
HRESULT WINAPI EmuDirectSoundCreateBuffer
(
X_DSBUFFERDESC *pdsbd,
X_CDirectSoundBuffer **ppBuffer
);
// ******************************************************************
// * func: EmuIDirectSound8_Release
// ******************************************************************
@ -146,7 +168,7 @@ HRESULT WINAPI EmuIDirectSound8_SetDopplerFactor
HRESULT WINAPI EmuIDirectSound8_CreateSoundBuffer
(
LPDIRECTSOUND8 pThis,
LPCDSBUFFERDESC pdsbd,
X_DSBUFFERDESC *pdsbd,
X_CDirectSoundBuffer **ppBuffer,
LPUNKNOWN pUnkOuter
);
@ -195,7 +217,18 @@ HRESULT WINAPI EmuIDirectSoundBuffer8_SetVolume
// ******************************************************************
HRESULT WINAPI EmuIDirectSoundBuffer8_SetCurrentPosition
(
DWORD dwNewPosition
X_CDirectSoundBuffer *pThis,
DWORD dwNewPosition
);
// ******************************************************************
// * func: EmuIDirectSoundBuffer8_GetCurrentPosition
// ******************************************************************
HRESULT WINAPI EmuIDirectSoundBuffer8_GetCurrentPosition
(
X_CDirectSoundBuffer *pThis,
PDWORD pdwCurrentPlayCursor,
PDWORD pdwCurrentWriteCursor
);
// ******************************************************************
@ -206,6 +239,17 @@ HRESULT WINAPI EmuIDirectSoundBuffer8_Stop
X_CDirectSoundBuffer *pThis
);
// ******************************************************************
// * func: EmuIDirectSoundBuffer8_Play
// ******************************************************************
HRESULT WINAPI EmuIDirectSoundBuffer8_Play
(
X_CDirectSoundBuffer *pThis,
DWORD dwReserved1,
DWORD dwReserved2,
DWORD dwFlags
);
// ******************************************************************
// * func: EmuCDirectSound_CommitDeferredSettings
// ******************************************************************

View File

@ -95,7 +95,14 @@ enum XRefDataBaseOffset
XREF_RECORDSTATEBLOCK = 3,
XREF_SETDISTANCEFACTOR = 4,
XREF_SETROLLOFFFACTOR = 5,
XREF_SETDOPPLERFACTOR = 6
XREF_SETDOPPLERFACTOR = 6,
XREF_SETBUFFERDATA = 7,
XREF_SETCURRENTPOSITION = 8,
XREF_SETCURRENTPOSITION2 = 9,
XREF_GETCURRENTPOSITION = 10,
XREF_GETCURRENTPOSITION2 = 11,
XREF_DSOUNDPLAY = 12,
XREF_DSOUNDPLAY2 = 13,
};
#endif

View File

@ -108,7 +108,7 @@ SOOVPA<10> IDirectSoundBuffer8_SetBufferData_1_0_4361 =
0, // XRef Not Used
{
// IDirectSoundBuffer8_SetBufferData+0x48 : cmp ebx, [eax+0x00B8]
// IDirectSoundBuffer8_SetBufferData+0x4E : cmp ebx, [eax+0x00B8]
{ 0x4E, 0x3B }, // (Offset,Value)-Pair #1
{ 0x4F, 0x98 }, // (Offset,Value)-Pair #2
{ 0x50, 0xB8 }, // (Offset,Value)-Pair #3
@ -231,29 +231,27 @@ SOOVPA<11> IDirectSoundBuffer8_SetVolume_1_0_4361 =
};
// ******************************************************************
// * IDirectSoundBuffer8_SetCurrentPosition
// * CMcpxBuffer_SetCurrentPosition
// ******************************************************************
SOOVPA<9> IDirectSoundBuffer8_SetCurrentPosition_1_0_4361 =
SOOVPA<9> CMcpxBuffer_SetCurrentPosition_1_0_4361 =
{
0, // Large == 0
9, // Count == 9
// NOTE: This is actually intercepting CMcpxBuffer::SetCurrentPosition(ULONG)
-1, // XRef Not Saved
0, // XRef Not Used
XREF_SETCURRENTPOSITION, // XRef Is Saved
0, // XRef Not Used
{
// IDirectSoundBuffer8_SetCurrentPosition+0x11 : mov al, [esi+12]
// CMcpxBuffer_SetCurrentPosition+0x11 : mov al, [esi+12]
{ 0x11, 0x8A }, // (Offset,Value)-Pair #1
{ 0x12, 0x46 }, // (Offset,Value)-Pair #2
{ 0x13, 0x12 }, // (Offset,Value)-Pair #3
// IDirectSoundBuffer8_SetCurrentPosition+0x5F : jb +0x10
// CMcpxBuffer_SetCurrentPosition+0x5F : jb +0x10
{ 0x5F, 0x72 }, // (Offset,Value)-Pair #4
{ 0x60, 0x10 }, // (Offset,Value)-Pair #5
// IDirectSoundBuffer8_SetCurrentPosition+0x86 : movzx eax, byte ptr [esi+0x64]
// CMcpxBuffer_SetCurrentPosition+0x86 : movzx eax, byte ptr [esi+0x64]
{ 0x86, 0x0F }, // (Offset,Value)-Pair #6
{ 0x87, 0xB6 }, // (Offset,Value)-Pair #7
{ 0x88, 0x46 }, // (Offset,Value)-Pair #8
@ -261,6 +259,259 @@ SOOVPA<9> IDirectSoundBuffer8_SetCurrentPosition_1_0_4361 =
}
};
// ******************************************************************
// * CDirectSoundBuffer_SetCurrentPosition
// ******************************************************************
SOOVPA<10> CDirectSoundBuffer_SetCurrentPosition_1_0_4361 =
{
0, // Large == 0
10, // Count == 10
XREF_SETCURRENTPOSITION2, // XRef Is Saved
1, // XRef Is Used
{
// CDirectSoundBuffer_SetCurrentPosition+0x35 : call [CMcpxBuffer::SetCurrentPosition]
{ 0x35, XREF_SETCURRENTPOSITION }, // (Offset,Value)-Pair #1
// CDirectSoundBuffer_SetCurrentPosition+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_SetCurrentPosition+0x3D : jz +0x0B
{ 0x3D, 0x74 }, // (Offset,Value)-Pair #7
{ 0x3E, 0x0B }, // (Offset,Value)-Pair #8
// CDirectSoundBuffer_SetCurrentPosition+0x3D : retn 0x08
{ 0x4E, 0xC2 }, // (Offset,Value)-Pair #9
{ 0x4F, 0x08 }, // (Offset,Value)-Pair #10
}
};
// ******************************************************************
// * IDirectSoundBuffer8_SetCurrentPosition
// ******************************************************************
SOOVPA<8> IDirectSoundBuffer8_SetCurrentPosition_1_0_4361 =
{
0, // Large == 0
8, // Count == 8
-1, // XRef Not Saved
1, // XRef Is Used
{
// IDirectSoundBuffer8_SetCurrentPosition+0x15 : call [CDirectSoundBuffer::SetCurrentPosition]
{ 0x15, XREF_SETCURRENTPOSITION2 }, // (Offset,Value)-Pair #1
// IDirectSoundBuffer8_SetCurrentPosition+0x0A : add eax, 0xFFFFFFE4
{ 0x0A, 0x83 }, // (Offset,Value)-Pair #2
{ 0x0B, 0xC0 }, // (Offset,Value)-Pair #3
{ 0x0C, 0xE4 }, // (Offset,Value)-Pair #4
// IDirectSoundBuffer8_SetCurrentPosition+0x0F : sbb ecx, ecx
{ 0x0F, 0x1B }, // (Offset,Value)-Pair #5
{ 0x10, 0xC9 }, // (Offset,Value)-Pair #6
// IDirectSoundBuffer8_SetCurrentPosition+0x11 : and ecx, eax
{ 0x11, 0x23 }, // (Offset,Value)-Pair #7
{ 0x12, 0xC8 }, // (Offset,Value)-Pair #8
}
};
// ******************************************************************
// * CMcpxBuffer_GetCurrentPosition
// ******************************************************************
SOOVPA<11> CMcpxBuffer_GetCurrentPosition_1_0_4361 =
{
0, // Large == 0
11, // Count == 11
XREF_GETCURRENTPOSITION, // XRef Is Saved
0, // XRef Not Used
{
// CMcpxBuffer_GetCurrentPosition+0x0E : lea ecx, [ebp-0x08]
{ 0x0E, 0x8D }, // (Offset,Value)-Pair #1
{ 0x0F, 0x4D }, // (Offset,Value)-Pair #2
{ 0x10, 0xF8 }, // (Offset,Value)-Pair #3
// CMcpxBuffer_GetCurrentPosition+0x31 : jz +0x02
{ 0x31, 0x74 }, // (Offset,Value)-Pair #4
{ 0x32, 0x02 }, // (Offset,Value)-Pair #5
// CMcpxBuffer_GetCurrentPosition+0xA0 : div dword ptr [ecx+0xBC]
{ 0xA0, 0xF7 }, // (Offset,Value)-Pair #6
{ 0xA1, 0xB1 }, // (Offset,Value)-Pair #7
{ 0xA2, 0xBC }, // (Offset,Value)-Pair #8
// CMcpxBuffer_GetCurrentPosition+0xD6 : retn 0x08
{ 0xD6, 0xC2 }, // (Offset,Value)-Pair #9
{ 0xD7, 0x08 }, // (Offset,Value)-Pair #10
{ 0xD8, 0x00 }, // (Offset,Value)-Pair #11
}
};
// ******************************************************************
// * CDirectSoundBuffer_GetCurrentPosition
// ******************************************************************
SOOVPA<10> CDirectSoundBuffer_GetCurrentPosition_1_0_4361 =
{
0, // Large == 0
10, // Count == 10
XREF_GETCURRENTPOSITION2, // XRef Is Saved
1, // XRef Is Used
{
// CDirectSoundBuffer_GetCurrentPosition+0x39 : call [CMcpxBuffer::GetCurrentPosition]
{ 0x39, XREF_GETCURRENTPOSITION }, // (Offset,Value)-Pair #1
// CDirectSoundBuffer_GetCurrentPosition+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_GetCurrentPosition+0x41 : jz +0x0B
{ 0x41, 0x74 }, // (Offset,Value)-Pair #7
{ 0x42, 0x0B }, // (Offset,Value)-Pair #8
// CDirectSoundBuffer_GetCurrentPosition+0x3D : retn 0x08
{ 0x52, 0xC2 }, // (Offset,Value)-Pair #9
{ 0x53, 0x0C }, // (Offset,Value)-Pair #10
}
};
// ******************************************************************
// * IDirectSoundBuffer8_GetCurrentPosition
// ******************************************************************
SOOVPA<8> IDirectSoundBuffer8_GetCurrentPosition_1_0_4361 =
{
0, // Large == 0
8, // Count == 8
-1, // XRef Not Saved
1, // XRef Is Used
{
// IDirectSoundBuffer8_GetCurrentPosition+0x19 : call [CDirectSoundBuffer::GetCurrentPosition]
{ 0x19, XREF_GETCURRENTPOSITION2 }, // (Offset,Value)-Pair #1
// IDirectSoundBuffer8_GetCurrentPosition+0x0E : add eax, 0xFFFFFFE4
{ 0x0E, 0x83 }, // (Offset,Value)-Pair #2
{ 0x0F, 0xC0 }, // (Offset,Value)-Pair #3
{ 0x10, 0xE4 }, // (Offset,Value)-Pair #4
// IDirectSoundBuffer8_GetCurrentPosition+0x13 : sbb ecx, ecx
{ 0x13, 0x1B }, // (Offset,Value)-Pair #5
{ 0x14, 0xC9 }, // (Offset,Value)-Pair #6
// IDirectSoundBuffer8_GetCurrentPosition+0x15 : and ecx, eax
{ 0x15, 0x23 }, // (Offset,Value)-Pair #7
{ 0x16, 0xC8 }, // (Offset,Value)-Pair #8
}
};
// ******************************************************************
// * CMcpxBuffer_Play
// ******************************************************************
SOOVPA<11> CMcpxBuffer_Play_1_0_4361 =
{
0, // Large == 0
11, // Count == 11
XREF_DSOUNDPLAY, // XRef Is Saved
0, // XRef Not Used
{
// CMcpxBuffer_Play+0x0E : cmp ebx, edi
{ 0x0E, 0x3B }, // (Offset,Value)-Pair #1
{ 0x0F, 0xDF }, // (Offset,Value)-Pair #2
// CMcpxBuffer_Play+0x1C : jz +0x09
{ 0x1C, 0x74 }, // (Offset,Value)-Pair #3
{ 0x1D, 0x09 }, // (Offset,Value)-Pair #4
// CMcpxBuffer_Play+0x30 : test byte ptr [esi+0x12], 2
{ 0x30, 0xF6 }, // (Offset,Value)-Pair #5
{ 0x31, 0x46 }, // (Offset,Value)-Pair #6
{ 0x32, 0x12 }, // (Offset,Value)-Pair #7
{ 0x33, 0x02 }, // (Offset,Value)-Pair #8
// CMcpxBuffer_Play+0x71 : call dword ptr [eax+0x18]
{ 0x71, 0xFF }, // (Offset,Value)-Pair #9
{ 0x72, 0x50 }, // (Offset,Value)-Pair #10
{ 0x73, 0x18 }, // (Offset,Value)-Pair #11
}
};
// ******************************************************************
// * CDirectSoundBuffer_Play
// ******************************************************************
SOOVPA<10> CDirectSoundBuffer_Play_1_0_4361 =
{
0, // Large == 0
10, // Count == 10
XREF_DSOUNDPLAY2, // XRef Is Saved
1, // XRef Is Used
{
// CDirectSoundBuffer_Play+0x35 : call [CMcpxBuffer::Play]
{ 0x35, XREF_DSOUNDPLAY }, // (Offset,Value)-Pair #1
// CDirectSoundBuffer_Play+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_Play+0x3D : jz +0x0B
{ 0x3D, 0x74 }, // (Offset,Value)-Pair #7
{ 0x3E, 0x0B }, // (Offset,Value)-Pair #8
// CDirectSoundBuffer_Play+0x4E : retn 0x10
{ 0x4E, 0xC2 }, // (Offset,Value)-Pair #9
{ 0x4F, 0x10 }, // (Offset,Value)-Pair #10
}
};
// ******************************************************************
// * IDirectSoundBuffer8_Play
// ******************************************************************
SOOVPA<9> IDirectSoundBuffer8_Play_1_0_4361 =
{
0, // Large == 0
9, // Count == 9
-1, // XRef Not Saved
1, // XRef Is Used
{
// IDirectSoundBuffer8_GetCurrentPosition+0x1D : call [CDirectSoundBuffer::Play]
{ 0x1D, XREF_DSOUNDPLAY2 }, // (Offset,Value)-Pair #1
// IDirectSoundBuffer8_GetCurrentPosition+0x0E : push [esp+0x10]
{ 0x0E, 0xFF }, // (Offset,Value)-Pair #2
{ 0x0F, 0x74 }, // (Offset,Value)-Pair #3
{ 0x10, 0x24 }, // (Offset,Value)-Pair #4
{ 0x11, 0x10 }, // (Offset,Value)-Pair #5
// IDirectSoundBuffer8_GetCurrentPosition+0x17 : sbb ecx, ecx
{ 0x17, 0x1B }, // (Offset,Value)-Pair #6
{ 0x18, 0xC9 }, // (Offset,Value)-Pair #7
// IDirectSoundBuffer8_GetCurrentPosition+0x19 : and ecx, eax
{ 0x19, 0x23 }, // (Offset,Value)-Pair #8
{ 0x1A, 0xC8 }, // (Offset,Value)-Pair #9
}
};
// ******************************************************************
// * IDirectSoundBuffer8_Stop
// ******************************************************************
@ -359,14 +610,56 @@ OOVPATable DSound_1_0_4361[] =
"EmuIDirectSoundBuffer8_SetVolume"
#endif
},
// CMcpxBuffer::SetCurrentPosition
{
(OOVPA*)&CMcpxBuffer_SetCurrentPosition_1_0_4361, 0,
#ifdef _DEBUG_TRACE
"CMcpxBuffer_SetCurrentPosition (XREF)"
#endif
},
// CDirectSoundBuffer::SetCurrentPosition
{
(OOVPA*)&CDirectSoundBuffer_SetCurrentPosition_1_0_4361, 0,
#ifdef _DEBUG_TRACE
"CDirectSoundBuffer_SetCurrentPosition (XREF)"
#endif
},
// IDirectSoundBuffer8::SetCurrentPosition
{
(OOVPA*)&IDirectSoundBuffer8_SetCurrentPosition_1_0_4361,
(OOVPA*)&IDirectSoundBuffer8_SetCurrentPosition_1_0_4361,
XTL::EmuIDirectSoundBuffer8_SetCurrentPosition,
#ifdef _DEBUG_TRACE
"EmuIDirectSoundBuffer8_SetCurrentPosition"
"IDirectSoundBuffer8_SetCurrentPosition"
#endif
},
// CMcpxBuffer::GetCurrentPosition
{
(OOVPA*)&CMcpxBuffer_GetCurrentPosition_1_0_4361, 0,
#ifdef _DEBUG_TRACE
"CMcpxBuffer_GetCurrentPosition (XREF)"
#endif
},
// CDirectSoundBuffer::GetCurrentPosition
{
(OOVPA*)&CDirectSoundBuffer_GetCurrentPosition_1_0_4361, 0,
#ifdef _DEBUG_TRACE
"CDirectSoundBuffer_GetCurrentPosition (XREF)"
#endif
},
// IDirectSoundBuffer8::GetCurrentPosition
{
(OOVPA*)&IDirectSoundBuffer8_GetCurrentPosition_1_0_4361,
XTL::EmuIDirectSoundBuffer8_GetCurrentPosition,
#ifdef _DEBUG_TRACE
"IDirectSoundBuffer8_GetCurrentPosition"
#endif
},
// IDirectSoundBuffer8::Stop
@ -379,6 +672,32 @@ OOVPATable DSound_1_0_4361[] =
"EmuIDirectSoundBuffer8_Stop"
#endif
},
// CMcpxBuffer::Play
{
(OOVPA*)&CMcpxBuffer_Play_1_0_4361, 0,
#ifdef _DEBUG_TRACE
"CMcpxBuffer_Play (XREF)"
#endif
},
// CDirectSoundBuffer::Play
{
(OOVPA*)&CDirectSoundBuffer_Play_1_0_4361, 0,
#ifdef _DEBUG_TRACE
"CDirectSoundBuffer_Play (XREF)"
#endif
},
// IDirectSoundBuffer8::Play
{
(OOVPA*)&IDirectSoundBuffer8_Play_1_0_4361,
XTL::EmuIDirectSoundBuffer8_Play,
#ifdef _DEBUG_TRACE
"IDirectSoundBuffer8_Play"
#endif
},
};
// ******************************************************************

View File

@ -32,6 +32,39 @@
// *
// ******************************************************************
// ******************************************************************
// * DirectSoundCreateBuffer
// ******************************************************************
SOOVPA<11> DirectSoundCreateBuffer_1_0_4627 =
{
0, // Large == 0
11, // Count == 11
-1, // XRef Not Saved
0, // XRef Not Used
{
// DirectSoundCreateBuffer+0x04 : and [ebp-0x04], 0
{ 0x04, 0x83 }, // (Offset,Value)-Pair #1
{ 0x05, 0x65 }, // (Offset,Value)-Pair #2
{ 0x06, 0xFC }, // (Offset,Value)-Pair #3
// DirectSoundCreateBuffer+0x08 : push ebx; push esi; push edi
{ 0x08, 0x53 }, // (Offset,Value)-Pair #4
{ 0x09, 0x56 }, // (Offset,Value)-Pair #5
{ 0x0A, 0x57 }, // (Offset,Value)-Pair #6
// DirectSoundCreateBuffer+0x3C : call dword ptr [eax+8]
{ 0x3C, 0xFF }, // (Offset,Value)-Pair #7
{ 0x3D, 0x50 }, // (Offset,Value)-Pair #8
{ 0x3E, 0x08 }, // (Offset,Value)-Pair #9
// DirectSoundCreateBuffer+0x54 : retn 0x08
{ 0x54, 0xC2 }, // (Offset,Value)-Pair #10
{ 0x55, 0x08 }, // (Offset,Value)-Pair #11
}
};
// ******************************************************************
// * IDirectSound8_Release
// ******************************************************************
@ -266,7 +299,6 @@ SOOVPA<11> IDirectSound8_SetRolloffFactor_1_0_4627 =
}
};
// ******************************************************************
// * CDirectSound::SetDopplerFactor
// ******************************************************************
@ -386,6 +418,26 @@ OOVPATable DSound_1_0_4627[] =
"EmuDirectSoundCreate"
#endif
},
// DirectSoundCreateBuffer
{
(OOVPA*)&DirectSoundCreateBuffer_1_0_4627,
XTL::EmuDirectSoundCreateBuffer,
#ifdef _DEBUG_TRACE
"EmuDirectSoundCreateBuffer"
#endif
},
// IDirectSoundBuffer8::SetBufferData (* unchanged since 4361 *)
{
(OOVPA*)&IDirectSoundBuffer8_SetBufferData_1_0_4361,
XTL::EmuIDirectSoundBuffer8_SetBufferData,
#ifdef _DEBUG_TRACE
"EmuIDirectSoundBuffer8_SetBufferData"
#endif
},
// IDirectSound8::Release
{
(OOVPA*)&IDirectSound8_Release_1_0_4627,

View File

@ -682,6 +682,8 @@ void *EmuLocateFunction(OOVPA *Oovpa, uint32 lower, uint32 upper)
{
uint32 v;
// if( (cur == 0x0006A6C6) && (Soovpa->Sovp[v].Value == XREF_SETCURRENTPOSITION2) )
// _asm int 3
// ******************************************************************
// * check all cross references
// ******************************************************************

View File

@ -1601,17 +1601,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateTexture
if(FAILED(hRet))
printf("*Warning* CreateTexture FAILED\n");
/*
{
static int dwDumpTex = 0;
char szBuffer[255];
sprintf(szBuffer, "C:\\Aaron\\Textures\\CreateTexture%.03d.bmp", dwDumpTex++);
D3DXSaveTextureToFile(szBuffer, D3DXIFF_BMP, (*ppTexture)->EmuTexture8, NULL);
}
*/
EmuSwapFS(); // XBox FS
return hRet;
@ -2454,12 +2444,12 @@ HRESULT WINAPI XTL::EmuIDirect3DSurface8_LockRect
" Flags : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, pLockedRect, pRect, Flags);
if(Flags & 0x40)
printf("*Warning* D3DLOCK_TILED ignored!\n");
}
}
#endif
if(Flags & 0x40)
printf("*Warning* D3DLOCK_TILED ignored!\n");
EmuVerifyResourceIsRegistered(pThis);
IDirect3DSurface8 *pSurface8 = pThis->EmuSurface8;
@ -3434,6 +3424,17 @@ static void EmuUpdateDeferredStates()
if(XTL::EmuD3DDeferredRenderState[1] != X_D3DRS_UNK)
g_pD3DDevice8->SetRenderState(D3DRS_FOGTABLEMODE, XTL::EmuD3DDeferredRenderState[1]);
if(XTL::EmuD3DDeferredRenderState[6] != X_D3DRS_UNK)
{
::DWORD dwConv = 0;
dwConv |= (XTL::EmuD3DDeferredRenderState[6] & 0x00000010) ? D3DWRAP_U : 0;
dwConv |= (XTL::EmuD3DDeferredRenderState[6] & 0x00001000) ? D3DWRAP_V : 0;
dwConv |= (XTL::EmuD3DDeferredRenderState[6] & 0x00100000) ? D3DWRAP_W : 0;
g_pD3DDevice8->SetRenderState(D3DRS_WRAP0, dwConv);
}
if(XTL::EmuD3DDeferredRenderState[10] != X_D3DRS_UNK)
g_pD3DDevice8->SetRenderState(D3DRS_LIGHTING, XTL::EmuD3DDeferredRenderState[10]);
@ -3467,14 +3468,17 @@ static void EmuUpdateDeferredStates()
if(XTL::EmuD3DDeferredRenderState[30] != X_D3DRS_UNK)
g_pD3DDevice8->SetRenderState(D3DRS_POINTSCALE_C, XTL::EmuD3DDeferredRenderState[30]);
if(XTL::EmuD3DDeferredRenderState[33] != X_D3DRS_UNK)
g_pD3DDevice8->SetRenderState(D3DRS_PATCHSEGMENTS, XTL::EmuD3DDeferredRenderState[33]);
/** To check for unhandled RenderStates
for(int v=0;v<117-82;v++)
{
if(XTL::EmuD3DDeferredRenderState[v] != X_D3DRS_UNK)
{
if(v != 0 && v != 1 && v != 10 && v != 11 && v != 20 && v != 23
&& v != 24 && v != 25 && v != 26 && v != 27 && v != 28 && v != 29
&& v != 30)
if(v != 0 && v != 1 && v != 6 && v != 10 && v != 11 && v != 20 && v != 23
&& v != 24 && v != 25 && v != 26 && v != 27 && v != 28 && v != 29 && v != 30
&& v != 33)
printf("*Warning* Unhandled RenderState Change @ %d (%d)\n", v, v + 82);
}
}

View File

@ -62,7 +62,7 @@ namespace XTL
// ******************************************************************
// * Static Variable(s)
// ******************************************************************
static XTL::LPDIRECTSOUND8 g_pD3D8 = NULL;
static XTL::LPDIRECTSOUND8 g_pDSound8 = NULL;
// ******************************************************************
// * func: EmuDirectSoundCreate
@ -93,6 +93,72 @@ HRESULT WINAPI XTL::EmuDirectSoundCreate
HRESULT hRet = DirectSoundCreate8(NULL, ppDirectSound, NULL);
g_pDSound8 = *ppDirectSound;
hRet = g_pDSound8->SetCooperativeLevel(g_hEmuWindow, DSSCL_PRIORITY);
EmuSwapFS(); // XBox FS
return hRet;
}
// ******************************************************************
// * func: EmuDirectSoundCreateBuffer
// ******************************************************************
HRESULT WINAPI XTL::EmuDirectSoundCreateBuffer
(
X_DSBUFFERDESC *pdsbd,
X_CDirectSoundBuffer **ppBuffer
)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuDSound (0x%X): EmuDirectSoundCreateBuffer\n"
"(\n"
" pdsbd : 0x%.08X\n"
" ppBuffer : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pdsbd, ppBuffer);
}
#endif
DSBUFFERDESC DSBufferDesc;
// ******************************************************************
// * Convert from Xbox to PC DSound
// ******************************************************************
{
DWORD dwAcceptableMask = 0x00000010 | 0x00000020 | 0x00000080 | 0x00000100 | 0x00002000 | 0x00040000 | 0x00080000;
if(pdsbd->dwFlags & (~dwAcceptableMask))
printf("*Warning* use of unsupported pdsbd->dwFlags mask(s) (0x%.08X)", pdsbd->dwFlags & (~dwAcceptableMask));
DSBufferDesc.dwSize = sizeof(DSBufferDesc);
DSBufferDesc.dwFlags = pdsbd->dwFlags & dwAcceptableMask | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY;
if(pdsbd->dwBufferBytes < DSBSIZE_MIN)
DSBufferDesc.dwBufferBytes = 16384; // NOTE: HACK: TEMPORARY FOR STELLA
else
DSBufferDesc.dwBufferBytes = pdsbd->dwBufferBytes;
DSBufferDesc.dwReserved = 0;
DSBufferDesc.lpwfxFormat = pdsbd->lpwfxFormat; // TODO: Make sure this is the same as PC
DSBufferDesc.guid3DAlgorithm = DS3DALG_DEFAULT;
}
// Todo: Garbage Collection
*ppBuffer = new X_CDirectSoundBuffer();
HRESULT hRet = g_pDSound8->CreateSoundBuffer(&DSBufferDesc, &((*ppBuffer)->EmuDirectSoundBuffer8), NULL);
if(FAILED(hRet))
printf("*Warning* CreateSoundBuffer FAILED\n");
EmuSwapFS(); // XBox FS
return hRet;
@ -323,18 +389,17 @@ HRESULT WINAPI XTL::EmuIDirectSound8_SetDopplerFactor
HRESULT WINAPI XTL::EmuIDirectSound8_CreateSoundBuffer
(
LPDIRECTSOUND8 pThis,
LPCDSBUFFERDESC pdsbd,
X_DSBUFFERDESC *pdsbd,
X_CDirectSoundBuffer **ppBuffer,
LPUNKNOWN pUnkOuter
)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
EmuSwapFS(); // Win2k/XP FS
printf("EmuDSound (0x%X): EmuIDirectSound8_CreateSoundBuffer\n"
"(\n"
" pdsbd : 0x%.08X\n"
@ -342,22 +407,11 @@ HRESULT WINAPI XTL::EmuIDirectSound8_CreateSoundBuffer
" pUnkOuter : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pdsbd, ppBuffer, pUnkOuter);
EmuSwapFS(); // XBox FS
}
#endif
// Todo: Garbage Collection
*ppBuffer = new X_CDirectSoundBuffer();
(*ppBuffer)->EmuDirectSoundBuffer8 = 0;
// Todo: Translate params, then make the PC DirectSound call
// HRESULT hRet = pThis->CreateSoundBuffer(pdsbd, ppBuffer, pUnkOuter);
printf("*Note* EmuIDirectSound8_CreateSoundBuffer is being ignored\n");
EmuSwapFS(); // XBox FS
return STATUS_SUCCESS;
return EmuDirectSoundCreateBuffer(pdsbd, ppBuffer);
}
// ******************************************************************
@ -386,13 +440,19 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetBufferData
GetCurrentThreadId(), pThis, pvBufferData, dwBufferBytes);
}
#endif
/*
char szBuffer[266];
sprintf(szBuffer, "Yea 0x%.08X - %d", pvBufferData, dwBufferBytes);
MessageBox(g_hEmuWindow, szBuffer, "Cxbx", MB_OK);
*/
// Todo: Translate params, then make the PC DirectSound call
printf("*Note* EmuIDirectSoundBuffer8_SetBufferData is being ignored\n");
EmuSwapFS(); // XBox FS
return STATUS_SUCCESS;
return DS_OK;
}
// ******************************************************************
@ -427,7 +487,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetPlayRegion
EmuSwapFS(); // XBox FS
return STATUS_SUCCESS;
return DS_OK;
}
// ******************************************************************
@ -462,7 +522,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetLoopRegion
EmuSwapFS(); // XBox FS
return STATUS_SUCCESS;
return DS_OK;
}
// ******************************************************************
@ -495,7 +555,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetVolume
EmuSwapFS(); // XBox FS
return STATUS_SUCCESS;
return DS_OK;
}
// ******************************************************************
@ -503,6 +563,7 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetVolume
// ******************************************************************
HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetCurrentPosition
(
X_CDirectSoundBuffer *pThis,
DWORD dwNewPosition
)
{
@ -515,18 +576,60 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_SetCurrentPosition
{
printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_SetCurrentPosition\n"
"(\n"
" pThis : 0x%.08X\n"
" dwNewPosition : 0x%.08X\n"
");\n",
GetCurrentThreadId(), dwNewPosition);
GetCurrentThreadId(), pThis, dwNewPosition);
}
#endif
// Todo: Translate params, then make the PC DirectSound call
printf("*Note* EmuIDirectSoundBuffer8_SetCurrentPosition is being ignored\n");
// NOTE: TODO: This call *will* (by MSDN) fail on primary buffers!
HRESULT hRet = pThis->EmuDirectSoundBuffer8->SetCurrentPosition(dwNewPosition);
if(FAILED(hRet))
printf("*Warning* SetCurrentPosition FAILED\n");
EmuSwapFS(); // XBox FS
return STATUS_SUCCESS;
return hRet;
}
// ******************************************************************
// * func: EmuIDirectSoundBuffer8_GetCurrentPosition
// ******************************************************************
HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_GetCurrentPosition
(
X_CDirectSoundBuffer *pThis,
PDWORD pdwCurrentPlayCursor,
PDWORD pdwCurrentWriteCursor
)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_GetCurrentPosition\n"
"(\n"
" pThis : 0x%.08X\n"
" pdwCurrentPlayCursor : 0x%.08X\n"
" pdwCurrentWriteCursor : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, pdwCurrentPlayCursor, pdwCurrentWriteCursor);
}
#endif
// NOTE: TODO: This call always seems to fail on primary buffers!
HRESULT hRet = pThis->EmuDirectSoundBuffer8->GetCurrentPosition(pdwCurrentPlayCursor, pdwCurrentWriteCursor);
if(FAILED(hRet))
printf("*Warning* GetCurrentPosition FAILED\n");
EmuSwapFS(); // XBox FS
return hRet;
}
// ******************************************************************
@ -557,7 +660,46 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_Stop
EmuSwapFS(); // XBox FS
return STATUS_SUCCESS;
return DS_OK;
}
// ******************************************************************
// * func: EmuIDirectSoundBuffer8_Play
// ******************************************************************
HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_Play
(
X_CDirectSoundBuffer *pThis,
DWORD dwReserved1,
DWORD dwReserved2,
DWORD dwFlags
)
{
EmuSwapFS(); // Win2k/XP FS
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
printf("EmuDSound (0x%X): EmuIDirectSoundBuffer8_Play\n"
"(\n"
" pThis : 0x%.08X\n"
" dwReserved1 : 0x%.08X\n"
" dwReserved2 : 0x%.08X\n"
" dwFlags : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, dwReserved1, dwReserved2, dwFlags);
}
#endif
if(dwFlags & (~DSBPLAY_LOOPING))
EmuCleanup("Unsupported Playing Flags");
pThis->EmuDirectSoundBuffer8->Play(0, 0, dwFlags);
EmuSwapFS(); // XBox FS
return DS_OK;
}
// ******************************************************************
@ -588,5 +730,5 @@ HRESULT WINAPI XTL::EmuCDirectSound_CommitDeferredSettings
EmuSwapFS(); // XBox FS
return STATUS_SUCCESS;
return DS_OK;
}

View File

@ -178,6 +178,13 @@ extern uint32 XRefDataBase[] =
-1, // XREF_SETDISTANCEFACTOR
-1, // XREF_SETROLLOFFFACTOR
-1, // XREF_SETDOPPLERFACTOR
-1, // XREF_SETBUFFERDATA
-1, // XREF_SETCURRENTPOSITION
-1, // XREF_SETCURRENTPOSITION2
-1, // XREF_GETCURRENTPOSITION
-1, // XREF_GETCURRENTPOSITION2
-1, // XREF_DSOUNDPLAY
-1, // XREF_DSOUNDPLAY2
};
// ******************************************************************