From 9da4f39ba0c0c191e85791a1a9ad799f5afdeb0d Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Sun, 6 Jul 2003 01:16:03 +0000 Subject: [PATCH] little work --- Include/Win32/CxbxKrnl/EmuD3D8.h | 24 ++ Include/Win32/CxbxKrnl/EmuDSound.h | 61 ++++ Include/Win32/CxbxKrnl/HLEDataBase.h | 5 +- Source/Win32/CxbxKrnl/D3D8.1.0.4627.inl | 81 +++++ Source/Win32/CxbxKrnl/DSound.1.0.4627.inl | 348 ++++++++++++++++++++++ Source/Win32/CxbxKrnl/EmuD3D8.cpp | 79 ++++- Source/Win32/CxbxKrnl/EmuDSound.cpp | 184 +++++++++++- Source/Win32/CxbxKrnl/HLEDataBase.cpp | 3 + 8 files changed, 779 insertions(+), 6 deletions(-) diff --git a/Include/Win32/CxbxKrnl/EmuD3D8.h b/Include/Win32/CxbxKrnl/EmuD3D8.h index 19691400f..9f92cae8b 100644 --- a/Include/Win32/CxbxKrnl/EmuD3D8.h +++ b/Include/Win32/CxbxKrnl/EmuD3D8.h @@ -369,6 +369,14 @@ struct X_D3DIndexBuffer : public X_D3DResource }; +// ****************************************************************** +// * X_D3DPushBuffer +// ****************************************************************** +struct X_D3DPushBuffer : public X_D3DResource +{ + ULONG AllocationSize; +}; + // ****************************************************************** // * X_D3DPixelContainer "Format" Masks // ****************************************************************** @@ -602,6 +610,22 @@ VOID WINAPI EmuIDirect3DDevice8_GetBackBuffer X_D3DSurface **ppBackBuffer ); +// ****************************************************************** +// * func: EmuIDirect3D8_SetViewport +// ****************************************************************** +HRESULT WINAPI EmuIDirect3D8_SetViewport +( + CONST D3DVIEWPORT8 *pViewport +); + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetShaderConstantMode +// ****************************************************************** +HRESULT WINAPI EmuIDirect3DDevice8_SetShaderConstantMode +( + DWORD Mode // TODO: Fill out enumeration +); + // ****************************************************************** // * func: EmuIDirect3DDevice8_GetRenderTarget // ****************************************************************** diff --git a/Include/Win32/CxbxKrnl/EmuDSound.h b/Include/Win32/CxbxKrnl/EmuDSound.h index 5aabdfe91..3cbc658ae 100644 --- a/Include/Win32/CxbxKrnl/EmuDSound.h +++ b/Include/Win32/CxbxKrnl/EmuDSound.h @@ -41,6 +41,14 @@ #include +// ****************************************************************** +// * X_CDirectSound +// ****************************************************************** +struct X_CDirectSound +{ + // TODO: Fill this in? +}; + // ****************************************************************** // * X_CDirectSoundBuffer // ****************************************************************** @@ -87,6 +95,51 @@ HRESULT WINAPI EmuIDirectSound8_DownloadEffectsImage PVOID *ppImageDesc // TODO: Use this param ); +// ****************************************************************** +// * func: EmuIDirectSound8_SetOrientation +// ****************************************************************** +HRESULT WINAPI EmuIDirectSound8_SetOrientation +( + LPDIRECTSOUND8 pThis, + FLOAT xFront, + FLOAT yFront, + FLOAT zFront, + FLOAT xTop, + FLOAT yTop, + FLOAT zTop, + DWORD dwApply +); + +// ****************************************************************** +// * func: EmuIDirectSound8_SetDistanceFactor +// ****************************************************************** +HRESULT WINAPI EmuIDirectSound8_SetDistanceFactor +( + LPDIRECTSOUND8 pThis, + FLOAT fDistanceFactor, + DWORD dwApply +); + +// ****************************************************************** +// * func: EmuIDirectSound8_SetRolloffFactor +// ****************************************************************** +HRESULT WINAPI EmuIDirectSound8_SetRolloffFactor +( + LPDIRECTSOUND8 pThis, + FLOAT fRolloffFactor, + DWORD dwApply +); + +// ****************************************************************** +// * func: EmuIDirectSound8_SetDopplerFactor +// ****************************************************************** +HRESULT WINAPI EmuIDirectSound8_SetDopplerFactor +( + LPDIRECTSOUND8 pThis, + FLOAT fDopplerFactor, + DWORD dwApply +); + // ****************************************************************** // * func: EmuIDirectSound8_CreateSoundBuffer // ****************************************************************** @@ -153,4 +206,12 @@ HRESULT WINAPI EmuIDirectSoundBuffer8_Stop X_CDirectSoundBuffer *pThis ); +// ****************************************************************** +// * func: EmuCDirectSound_CommitDeferredSettings +// ****************************************************************** +HRESULT WINAPI EmuCDirectSound_CommitDeferredSettings +( + X_CDirectSound *pThis +); + #endif diff --git a/Include/Win32/CxbxKrnl/HLEDataBase.h b/Include/Win32/CxbxKrnl/HLEDataBase.h index f04e6aa0a..445c84e93 100644 --- a/Include/Win32/CxbxKrnl/HLEDataBase.h +++ b/Include/Win32/CxbxKrnl/HLEDataBase.h @@ -92,7 +92,10 @@ enum XRefDataBaseOffset XREF_XNINIT = 0, XREF_FCLOSEDEVICE = 1, XREF_CLEARSTATEBLOCKFLAGS = 2, - XREF_RECORDSTATEBLOCK = 3 + XREF_RECORDSTATEBLOCK = 3, + XREF_SETDISTANCEFACTOR = 4, + XREF_SETROLLOFFFACTOR = 5, + XREF_SETDOPPLERFACTOR = 6 }; #endif diff --git a/Source/Win32/CxbxKrnl/D3D8.1.0.4627.inl b/Source/Win32/CxbxKrnl/D3D8.1.0.4627.inl index 458b22c3f..874efa212 100644 --- a/Source/Win32/CxbxKrnl/D3D8.1.0.4627.inl +++ b/Source/Win32/CxbxKrnl/D3D8.1.0.4627.inl @@ -162,6 +162,67 @@ SOOVPA<9> IDirect3D8_KickOffAndWaitForIdle_1_0_4627 = } }; +// ****************************************************************** +// * IDirect3D8_SetViewport +// ****************************************************************** +SOOVPA<9> IDirect3D8_SetViewport_1_0_4627 = +{ + 0, // Large == 0 + 9, // Count == 9 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3D8_SetViewport+0x0A : mov eax, [esi+0x21B4] + { 0x0A, 0x8B }, // (Offset,Value)-Pair #1 + { 0x0B, 0x86 }, // (Offset,Value)-Pair #2 + { 0x0C, 0xB4 }, // (Offset,Value)-Pair #3 + { 0x0D, 0x21 }, // (Offset,Value)-Pair #4 + + // IDirect3D8_SetViewport+0x63 : shl edi, cl + { 0x63, 0xD3 }, // (Offset,Value)-Pair #5 + { 0x64, 0xE7 }, // (Offset,Value)-Pair #6 + + // IDirect3D8_SetViewport+0xDF : and ecx, 0x0F + { 0xDF, 0x83 }, // (Offset,Value)-Pair #7 + { 0xE0, 0xE1 }, // (Offset,Value)-Pair #8 + { 0xE1, 0x0F }, // (Offset,Value)-Pair #9 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetShaderConstantMode +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetShaderConstantMode_1_0_4627 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetShaderConstantMode+0x26 : mov [ebx+0x20D8], eax + { 0x26, 0x89 }, // (Offset,Value)-Pair #1 + { 0x27, 0x83 }, // (Offset,Value)-Pair #2 + { 0x28, 0xD8 }, // (Offset,Value)-Pair #3 + { 0x29, 0x20 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetShaderConstantMode+0x50 : mov dword ptr [eax+0x04], 0x3C + { 0x50, 0xC7 }, // (Offset,Value)-Pair #5 + { 0x51, 0x40 }, // (Offset,Value)-Pair #6 + { 0x52, 0x04 }, // (Offset,Value)-Pair #7 + { 0x53, 0x3C }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetShaderConstantMode+0xE7 : add esi, 0x0124 + { 0xE7, 0x81 }, // (Offset,Value)-Pair #9 + { 0xE8, 0xC6 }, // (Offset,Value)-Pair #10 + { 0xE9, 0x24 }, // (Offset,Value)-Pair #11 + { 0xEA, 0x01 }, // (Offset,Value)-Pair #12 + } +}; + // ****************************************************************** // * IDirect3DDevice8_GetBackBuffer2 // ****************************************************************** @@ -1168,6 +1229,26 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_GetBackBuffer2B" #endif }, + // IDirect3DDevice8::SetViewport + { + (OOVPA*)&IDirect3D8_SetViewport_1_0_4627, + + XTL::EmuIDirect3D8_SetViewport, + + #ifdef _DEBUG_TRACE + "EmuIDirect3D8_SetViewport" + #endif + }, + // IDirect3DDevice8::SetShaderConstantMode + { + (OOVPA*)&IDirect3DDevice8_SetShaderConstantMode_1_0_4627, + + XTL::EmuIDirect3DDevice8_SetShaderConstantMode, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetShaderConstantMode" + #endif + }, // IDirect3DDevice8::GetRenderTarget2 { (OOVPA*)&IDirect3DDevice8_GetRenderTarget2_1_0_4627, diff --git a/Source/Win32/CxbxKrnl/DSound.1.0.4627.inl b/Source/Win32/CxbxKrnl/DSound.1.0.4627.inl index 54754030e..106bc74d4 100644 --- a/Source/Win32/CxbxKrnl/DSound.1.0.4627.inl +++ b/Source/Win32/CxbxKrnl/DSound.1.0.4627.inl @@ -97,6 +97,280 @@ SOOVPA<11> IDirectSound8_DownloadEffectsImage_1_0_4627 = } }; +// ****************************************************************** +// * IDirectSound8_SetOrientation +// ****************************************************************** +SOOVPA<13> IDirectSound8_SetOrientation_1_0_4627 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirectSound8_SetOrientation+0x06 : fld [ebp+0x20] + { 0x06, 0xD9 }, // (Offset,Value)-Pair #1 + { 0x07, 0x45 }, // (Offset,Value)-Pair #2 + { 0x08, 0x20 }, // (Offset,Value)-Pair #3 + + // IDirectSound8_SetOrientation+0x0C : sub esp, 0x18 + { 0x0C, 0x83 }, // (Offset,Value)-Pair #4 + { 0x0D, 0xEC }, // (Offset,Value)-Pair #5 + { 0x0E, 0x18 }, // (Offset,Value)-Pair #6 + + // IDirectSound8_SetOrientation+0x18 : add eax, 0xFFFFFFF8 + { 0x18, 0x83 }, // (Offset,Value)-Pair #7 + { 0x19, 0xC0 }, // (Offset,Value)-Pair #8 + { 0x1A, 0xF8 }, // (Offset,Value)-Pair #9 + + // IDirectSound8_SetOrientation+0x1F : neg ecx + { 0x1F, 0xF7 }, // (Offset,Value)-Pair #10 + { 0x20, 0xD9 }, // (Offset,Value)-Pair #11 + + // IDirectSound8_SetOrientation+0x47 : retn 0x20 + { 0x47, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x48, 0x20 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * CDirectSound::SetDistanceFactor +// ****************************************************************** +SOOVPA<11> CDirectSound_SetDistanceFactor_1_0_4627 = +{ + 0, // Large == 0 + 11, // Count == 11 + + XREF_SETDISTANCEFACTOR, // XRef Is Saved + 0, // XRef Not Used + + { + // CDirectSound_SetDistanceFactor+0x21 : mov eax, 0x80004005 + { 0x21, 0xB8 }, // (Offset,Value)-Pair #1 + { 0x22, 0x05 }, // (Offset,Value)-Pair #2 + { 0x23, 0x40 }, // (Offset,Value)-Pair #3 + { 0x24, 0x00 }, // (Offset,Value)-Pair #4 + { 0x25, 0x80 }, // (Offset,Value)-Pair #5 + + // CDirectSound_SetDistanceFactor+0x39 : or byte ptr[eax+0xA4], 0xE0 + { 0x39, 0x80 }, // (Offset,Value)-Pair #6 + { 0x3A, 0x88 }, // (Offset,Value)-Pair #7 + { 0x3B, 0xA4 }, // (Offset,Value)-Pair #8 + { 0x3F, 0xE0 }, // (Offset,Value)-Pair #9 + + // CDirectSound_SetDistanceFactor+0x4F : jz +0x0B + { 0x4F, 0x74 }, // (Offset,Value)-Pair #10 + { 0x50, 0x0B }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirectSound8_SetDistanceFactor +// ****************************************************************** +SOOVPA<11> IDirectSound8_SetDistanceFactor_1_0_4627 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 1, // XRef Is Used + + { + // IDirectSound8_SetDistanceFactor+0x1D : call [CDirectSound::SetDistanceFactor] + { 0x1D, XREF_SETDISTANCEFACTOR }, // (Offset,Value)-Pair #1 + + // IDirectSound8_SetDistanceFactor+0x04 : fld [esp+0x0C] + { 0x04, 0xD9 }, // (Offset,Value)-Pair #2 + { 0x05, 0x44 }, // (Offset,Value)-Pair #3 + { 0x06, 0x24 }, // (Offset,Value)-Pair #4 + { 0x07, 0x0C }, // (Offset,Value)-Pair #5 + + // IDirectSound8_SetDistanceFactor+0x0C : push ecx + { 0x0C, 0x51 }, // (Offset,Value)-Pair #6 + + // IDirectSound8_SetDistanceFactor+0x12 : add eax, 0xFFFFFFF8 + { 0x12, 0x83 }, // (Offset,Value)-Pair #7 + { 0x13, 0xC0 }, // (Offset,Value)-Pair #8 + { 0x14, 0xF8 }, // (Offset,Value)-Pair #9 + + // IDirectSound8_SetDistanceFactor+0x21 : retn 0x0C + { 0x21, 0xC2 }, // (Offset,Value)-Pair #10 + { 0x22, 0x0C }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * CDirectSound::SetRolloffFactor +// ****************************************************************** +SOOVPA<11> CDirectSound_SetRolloffFactor_1_0_4627 = +{ + 0, // Large == 0 + 11, // Count == 11 + + XREF_SETROLLOFFFACTOR, // XRef Is Saved + 0, // XRef Not Used + + { + // CDirectSound_SetRolloffFactor+0x21 : mov eax, 0x80004005 + { 0x21, 0xB8 }, // (Offset,Value)-Pair #1 + { 0x22, 0x05 }, // (Offset,Value)-Pair #2 + { 0x23, 0x40 }, // (Offset,Value)-Pair #3 + { 0x24, 0x00 }, // (Offset,Value)-Pair #4 + { 0x25, 0x80 }, // (Offset,Value)-Pair #5 + + // CDirectSound_SetRolloffFactor+0x39 : or dword ptr[eax+0xA4], 0x04 + { 0x39, 0x83 }, // (Offset,Value)-Pair #6 + { 0x3A, 0x88 }, // (Offset,Value)-Pair #7 + { 0x3B, 0xA4 }, // (Offset,Value)-Pair #8 + { 0x3F, 0x04 }, // (Offset,Value)-Pair #9 + + // CDirectSound_SetRolloffFactor+0x4F : jz +0x0B + { 0x4F, 0x74 }, // (Offset,Value)-Pair #10 + { 0x50, 0x0B }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirectSound8_SetRolloffFactor +// ****************************************************************** +SOOVPA<11> IDirectSound8_SetRolloffFactor_1_0_4627 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 1, // XRef Is Used + + { + // IDirectSound8_SetRolloffFactor+0x1D : call [CDirectSound::SetRolloffFactor] + { 0x1D, XREF_SETROLLOFFFACTOR }, // (Offset,Value)-Pair #1 + + // IDirectSound8_SetRolloffFactor+0x04 : fld [esp+0x0C] + { 0x04, 0xD9 }, // (Offset,Value)-Pair #2 + { 0x05, 0x44 }, // (Offset,Value)-Pair #3 + { 0x06, 0x24 }, // (Offset,Value)-Pair #4 + { 0x07, 0x0C }, // (Offset,Value)-Pair #5 + + // IDirectSound8_SetRolloffFactor+0x0C : push ecx + { 0x0C, 0x51 }, // (Offset,Value)-Pair #6 + + // IDirectSound8_SetRolloffFactor+0x12 : add eax, 0xFFFFFFF8 + { 0x12, 0x83 }, // (Offset,Value)-Pair #7 + { 0x13, 0xC0 }, // (Offset,Value)-Pair #8 + { 0x14, 0xF8 }, // (Offset,Value)-Pair #9 + + // IDirectSound8_SetRolloffFactor+0x21 : retn 0x0C + { 0x21, 0xC2 }, // (Offset,Value)-Pair #10 + { 0x22, 0x0C }, // (Offset,Value)-Pair #11 + } +}; + + +// ****************************************************************** +// * CDirectSound::SetDopplerFactor +// ****************************************************************** +SOOVPA<14> CDirectSound_SetDopplerFactor_1_0_4627 = +{ + 0, // Large == 0 + 14, // Count == 14 + + XREF_SETDOPPLERFACTOR, // XRef Is Saved + 0, // XRef Not Used + + { + // CDirectSound_SetDopplerFactor+0x21 : mov eax, 0x80004005 + { 0x21, 0xB8 }, // (Offset,Value)-Pair #1 + { 0x22, 0x05 }, // (Offset,Value)-Pair #2 + { 0x23, 0x40 }, // (Offset,Value)-Pair #3 + { 0x24, 0x00 }, // (Offset,Value)-Pair #4 + { 0x25, 0x80 }, // (Offset,Value)-Pair #5 + + // CDirectSound_SetDopplerFactor+0x33 : mov [eax+0x70], edx + { 0x33, 0x89 }, // (Offset,Value)-Pair #6 + { 0x34, 0x50 }, // (Offset,Value)-Pair #7 + { 0x35, 0x70 }, // (Offset,Value)-Pair #8 + + // CDirectSound_SetDopplerFactor+0x39 : or byte ptr[eax+0xA4], 0x80 + { 0x39, 0x80 }, // (Offset,Value)-Pair #9 + { 0x3A, 0x88 }, // (Offset,Value)-Pair #10 + { 0x3B, 0xA4 }, // (Offset,Value)-Pair #11 + { 0x3F, 0x80 }, // (Offset,Value)-Pair #12 + + // CDirectSound_SetDopplerFactor+0x4F : jz +0x0B + { 0x4F, 0x74 }, // (Offset,Value)-Pair #13 + { 0x50, 0x0B }, // (Offset,Value)-Pair #14 + } +}; + +// ****************************************************************** +// * IDirectSound8_SetDopplerFactor +// ****************************************************************** +SOOVPA<11> IDirectSound8_SetDopplerFactor_1_0_4627 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 1, // XRef Is Used + + { + // IDirectSound8_SetDopplerFactor+0x1D : call [CDirectSound::SetDopplerFactor] + { 0x1D, XREF_SETDOPPLERFACTOR}, // (Offset,Value)-Pair #1 + + // IDirectSound8_SetDopplerFactor+0x04 : fld [esp+0x0C] + { 0x04, 0xD9 }, // (Offset,Value)-Pair #2 + { 0x05, 0x44 }, // (Offset,Value)-Pair #3 + { 0x06, 0x24 }, // (Offset,Value)-Pair #4 + { 0x07, 0x0C }, // (Offset,Value)-Pair #5 + + // IDirectSound8_SetDopplerFactor+0x0C : push ecx + { 0x0C, 0x51 }, // (Offset,Value)-Pair #6 + + // IDirectSound8_SetDopplerFactor+0x12 : add eax, 0xFFFFFFF8 + { 0x12, 0x83 }, // (Offset,Value)-Pair #7 + { 0x13, 0xC0 }, // (Offset,Value)-Pair #8 + { 0x14, 0xF8 }, // (Offset,Value)-Pair #9 + + // IDirectSound8_SetDopplerFactor+0x21 : retn 0x0C + { 0x21, 0xC2 }, // (Offset,Value)-Pair #10 + { 0x22, 0x0C }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * CDirectSound::CommitDeferredSettings +// ****************************************************************** +SOOVPA<11> CDirectSound_CommitDeferredSettings_1_0_4627 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // CDirectSound_CommitDeferredSettings+0x10 : movzx eax, al + { 0x10, 0x0F }, // (Offset,Value)-Pair #1 + { 0x11, 0xB6 }, // (Offset,Value)-Pair #2 + { 0x12, 0xC0 }, // (Offset,Value)-Pair #3 + + // CDirectSound_CommitDeferredSettings+0x27 : mov eax, 0x80004005 + { 0x27, 0xB8 }, // (Offset,Value)-Pair #4 + { 0x28, 0x05 }, // (Offset,Value)-Pair #5 + { 0x29, 0x40 }, // (Offset,Value)-Pair #6 + { 0x2B, 0x80 }, // (Offset,Value)-Pair #7 + + // CDirectSound_CommitDeferredSettings+0x5C : and [eax+0xA4], esi + { 0x5C, 0x21 }, // (Offset,Value)-Pair #8 + { 0x5D, 0xB0 }, // (Offset,Value)-Pair #9 + { 0x5E, 0xA4 }, // (Offset,Value)-Pair #10 + + // CDirectSound_CommitDeferredSettings+0x78 : leave + { 0x78, 0xC9 }, // (Offset,Value)-Pair #11 + } +}; + // ****************************************************************** // * DirectSoundCreate_1_0_4627 // ****************************************************************** @@ -132,6 +406,80 @@ OOVPATable DSound_1_0_4627[] = "EmuIDirectSound8_DownloadEffectsImage" #endif }, + // IDirectSound8::SetOrientation + { + (OOVPA*)&IDirectSound8_SetOrientation_1_0_4627, + + XTL::EmuIDirectSound8_SetOrientation, + + #ifdef _DEBUG_TRACE + "EmuIDirectSound8_SetOrientation" + #endif + }, + // CDirectSound::SetDistanceFactor (XREF) + { + (OOVPA*)&CDirectSound_SetDistanceFactor_1_0_4627, 0, + + #ifdef _DEBUG_TRACE + "CDirectSound_SetDistanceFactor (XRef)" + #endif + }, + // IDirectSound8::SetDistanceFactor + { + (OOVPA*)&IDirectSound8_SetDistanceFactor_1_0_4627, + + XTL::EmuIDirectSound8_SetDistanceFactor, + + #ifdef _DEBUG_TRACE + "EmuIDirectSound8_SetDistanceFactor" + #endif + }, + // CDirectSound::SetRolloffFactor (XREF) + { + (OOVPA*)&CDirectSound_SetRolloffFactor_1_0_4627, 0, + + #ifdef _DEBUG_TRACE + "CDirectSound_SetRolloffFactor (XRef)" + #endif + }, + // IDirectSound8::SetRolloffFactor + { + (OOVPA*)&IDirectSound8_SetRolloffFactor_1_0_4627, + + XTL::EmuIDirectSound8_SetRolloffFactor, + + #ifdef _DEBUG_TRACE + "EmuIDirectSound8_SetRolloffFactor" + #endif + }, + // CDirectSound::SetDopplerFactor (XREF) + { + (OOVPA*)&CDirectSound_SetDopplerFactor_1_0_4627, 0, + + #ifdef _DEBUG_TRACE + "CDirectSound_SetDopplerFactor (XRef)" + #endif + }, + // IDirectSound8::SetDopplerFactor + { + (OOVPA*)&IDirectSound8_SetDopplerFactor_1_0_4627, + + XTL::EmuIDirectSound8_SetDopplerFactor, + + #ifdef _DEBUG_TRACE + "EmuIDirectSound8_SetDopplerFactor" + #endif + }, + // CDirectSound::CommitDeferredSettings + { + (OOVPA*)&CDirectSound_CommitDeferredSettings_1_0_4627, + + XTL::EmuCDirectSound_CommitDeferredSettings, + + #ifdef _DEBUG_TRACE + "EmuCDirectSound_CommitDeferredSettings" + #endif + }, }; // ****************************************************************** diff --git a/Source/Win32/CxbxKrnl/EmuD3D8.cpp b/Source/Win32/CxbxKrnl/EmuD3D8.cpp index a0ac68536..f5e4eee9d 100644 --- a/Source/Win32/CxbxKrnl/EmuD3D8.cpp +++ b/Source/Win32/CxbxKrnl/EmuD3D8.cpp @@ -1065,6 +1065,66 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_GetBackBuffer return; } +// ****************************************************************** +// * func: EmuIDirect3D8_SetViewport +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirect3D8_SetViewport +( + CONST D3DVIEWPORT8 *pViewport +) +{ + EmuSwapFS(); // Win2k/XP FS + + // ****************************************************************** + // * debug trace + // ****************************************************************** + #ifdef _DEBUG_TRACE + { + printf("EmuD3D8 (0x%X): EmuIDirect3D8_SetViewport\n" + "(\n" + " pViewport : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pViewport); + } + #endif + + HRESULT hRet = g_pD3DDevice8->SetViewport(pViewport); + + EmuSwapFS(); // Xbox FS + + return hRet; +} + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetShaderConstantMode +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetShaderConstantMode +( + DWORD dwMode // TODO: Fill out enumeration +) +{ + EmuSwapFS(); // Win2k/XP FS + + // ****************************************************************** + // * debug trace + // ****************************************************************** + #ifdef _DEBUG_TRACE + { + printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetShaderConstantMode\n" + "(\n" + " dwMode : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), dwMode); + } + #endif + + // TODO: Actually implement this + + EmuSwapFS(); // Xbox FS + + return S_OK; +} + // ****************************************************************** // * func: EmuIDirect3DDevice8_GetRenderTarget // ****************************************************************** @@ -1080,13 +1140,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_GetRenderTarget // ****************************************************************** #ifdef _DEBUG_TRACE { - EmuSwapFS(); // Win2k/XP FS printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetRenderTarget\n" "(\n" " ppRenderTarget : 0x%.08X\n" ");\n", GetCurrentThreadId(), ppRenderTarget); - EmuSwapFS(); // Xbox FS } #endif @@ -1523,6 +1581,11 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateTexture printf("*Warning* D3DFMT_P8 is an unsupported texture format!\n"); PCFormat = D3DFMT_X8R8G8B8; } + else if(PCFormat == D3DFMT_D24S8) + { + printf("*Warning* D3DFMT_D24S8 is an unsupported texture format!\n"); + PCFormat = D3DFMT_X8R8G8B8; + } *ppTexture = new X_D3DResource(); @@ -1748,7 +1811,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_Clear " pRects : 0x%.08X\n" " Flags : 0x%.08X\n" " Color : 0x%.08X\n" - " Z : 0x%.08X\n" + " Z : %f\n" " Stencil : 0x%.08X\n" ");\n", GetCurrentThreadId(), Count, pRects, Flags, @@ -1960,6 +2023,14 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register } break; + case X_D3DCOMMON_TYPE_PUSHBUFFER: + { + printf("*Warning: X_D3DCOMMON_TYPE_PUSHBUFFER is not yet implemented"); + + X_D3DPushBuffer *pPushBuffer = (X_D3DPushBuffer*)pResource; + } + break; + case X_D3DCOMMON_TYPE_SURFACE: case X_D3DCOMMON_TYPE_TEXTURE: { @@ -2143,7 +2214,7 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register D3DXSaveTextureToFile(szBuffer, D3DXIFF_BMP, pResource->EmuTexture8, NULL); } - */ + //*/ } break; diff --git a/Source/Win32/CxbxKrnl/EmuDSound.cpp b/Source/Win32/CxbxKrnl/EmuDSound.cpp index 968f711a7..c7b37eef5 100644 --- a/Source/Win32/CxbxKrnl/EmuDSound.cpp +++ b/Source/Win32/CxbxKrnl/EmuDSound.cpp @@ -149,12 +149,13 @@ HRESULT WINAPI XTL::EmuIDirectSound8_DownloadEffectsImage { printf("EmuDSound (0x%X): EmuIDirectSound8_DownloadEffectsImage\n" "(\n" + " pThis : 0x%.08X\n" " pvImageBuffer : 0x%.08X\n" " dwImageSize : 0x%.08X\n" " pImageLoc : 0x%.08X\n" " ppImageDesc : 0x%.08X\n" ");\n", - GetCurrentThreadId(), pvImageBuffer, dwImageSize, pImageLoc, ppImageDesc); + GetCurrentThreadId(), pThis, pvImageBuffer, dwImageSize, pImageLoc, ppImageDesc); } #endif @@ -166,6 +167,156 @@ HRESULT WINAPI XTL::EmuIDirectSound8_DownloadEffectsImage return S_OK; } +// ****************************************************************** +// * func: EmuIDirectSound8_SetOrientation +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirectSound8_SetOrientation +( + LPDIRECTSOUND8 pThis, + FLOAT xFront, + FLOAT yFront, + FLOAT zFront, + FLOAT xTop, + FLOAT yTop, + FLOAT zTop, + DWORD dwApply +) +{ + EmuSwapFS(); // Win2k/XP FS + + // ****************************************************************** + // * debug trace + // ****************************************************************** + #ifdef _DEBUG_TRACE + { + printf("EmuDSound (0x%X): EmuIDirectSound8_SetOrientation\n" + "(\n" + " pThis : 0x%.08X\n" + " xFront : %f\n" + " yFront : %f\n" + " zFront : %f\n" + " xTop : %f\n" + " yTop : %f\n" + " zTop : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, xFront, yFront, zFront, xTop, yTop, zTop, dwApply); + } + #endif + + // TODO: Actually implement this + printf("*Note* EmuIDirectSound8_SetOrientation is being ignored\n"); + + EmuSwapFS(); // XBox FS + + return S_OK; +} + +// ****************************************************************** +// * func: EmuIDirectSound8_SetDistanceFactor +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirectSound8_SetDistanceFactor +( + LPDIRECTSOUND8 pThis, + FLOAT fDistanceFactor, + DWORD dwApply +) +{ + EmuSwapFS(); // Win2k/XP FS + + // ****************************************************************** + // * debug trace + // ****************************************************************** + #ifdef _DEBUG_TRACE + { + printf("EmuDSound (0x%X): EmuIDirectSound8_SetDistanceFactor\n" + "(\n" + " pThis : 0x%.08X\n" + " fDistanceFactor : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, fDistanceFactor, dwApply); + } + #endif + + // TODO: Actually implement this + printf("*Note* EmuIDirectSound8_SetDistanceFactor is being ignored\n"); + + EmuSwapFS(); // XBox FS + + return S_OK; +} + +// ****************************************************************** +// * func: EmuIDirectSound8_SetRolloffFactor +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirectSound8_SetRolloffFactor +( + LPDIRECTSOUND8 pThis, + FLOAT fRolloffFactor, + DWORD dwApply +) +{ + EmuSwapFS(); // Win2k/XP FS + + // ****************************************************************** + // * debug trace + // ****************************************************************** + #ifdef _DEBUG_TRACE + { + printf("EmuDSound (0x%X): EmuIDirectSound8_SetRolloffFactor\n" + "(\n" + " pThis : 0x%.08X\n" + " fRolloffFactor : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, fRolloffFactor, dwApply); + } + #endif + + // TODO: Actually implement this + printf("*Note* EmuIDirectSound8_SetRolloffFactor is being ignored\n"); + + EmuSwapFS(); // XBox FS + + return S_OK; +} + +// ****************************************************************** +// * func: EmuIDirectSound8_SetDopplerFactor +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirectSound8_SetDopplerFactor +( + LPDIRECTSOUND8 pThis, + FLOAT fDopplerFactor, + DWORD dwApply +) +{ + EmuSwapFS(); // Win2k/XP FS + + // ****************************************************************** + // * debug trace + // ****************************************************************** + #ifdef _DEBUG_TRACE + { + printf("EmuDSound (0x%X): EmuIDirectSound8_SetDopplerFactor\n" + "(\n" + " pThis : 0x%.08X\n" + " fDopplerFactor : %f\n" + " dwApply : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis, fDopplerFactor, dwApply); + } + #endif + + // TODO: Actually implement this + printf("*Note* EmuIDirectSound8_SetDopplerFactor is being ignored\n"); + + EmuSwapFS(); // XBox FS + + return S_OK; +} + // ****************************************************************** // * func: EmuIDirectSound8_CreateSoundBuffer // ****************************************************************** @@ -408,3 +559,34 @@ HRESULT WINAPI XTL::EmuIDirectSoundBuffer8_Stop return STATUS_SUCCESS; } + +// ****************************************************************** +// * func: EmuCDirectSound_CommitDeferredSettings +// ****************************************************************** +HRESULT WINAPI XTL::EmuCDirectSound_CommitDeferredSettings +( + X_CDirectSound *pThis +) +{ + EmuSwapFS(); // Win2k/XP FS + + // ****************************************************************** + // * debug trace + // ****************************************************************** + #ifdef _DEBUG_TRACE + { + printf("EmuDSound (0x%X): EmuCDirectSound_CommitDeferredSettings\n" + "(\n" + " pThis : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), pThis); + } + #endif + + // Todo: Translate params, then make the PC DirectSound call + printf("*Note* EmuCDirectSound_CommitDeferredSettings is being ignored\n"); + + EmuSwapFS(); // XBox FS + + return STATUS_SUCCESS; +} diff --git a/Source/Win32/CxbxKrnl/HLEDataBase.cpp b/Source/Win32/CxbxKrnl/HLEDataBase.cpp index 4df773723..120f7b5c4 100644 --- a/Source/Win32/CxbxKrnl/HLEDataBase.cpp +++ b/Source/Win32/CxbxKrnl/HLEDataBase.cpp @@ -175,6 +175,9 @@ extern uint32 XRefDataBase[] = -1, // XREF_FCLOSEDEVICE -1, // XREF_CLEARSTATEBLOCKFLAGS -1, // XREF_RECORDSTATEBLOCK + -1, // XREF_SETDISTANCEFACTOR + -1, // XREF_SETROLLOFFFACTOR + -1, // XREF_SETDOPPLERFACTOR }; // ******************************************************************