From e2d02b21248cbf929d3d5ae8b4bee769500cedd2 Mon Sep 17 00:00:00 2001 From: RadWolfie Date: Wed, 11 Oct 2017 11:37:05 -0500 Subject: [PATCH] DSound Signature for 3925 and 3936 Titles are Done - Add XAudioCreatePcmFormat to 3911 - Add XAudioCreateAdpcmFormat to 3911 - Add IsValidFormat to 3911 - Add CMcpxStream_Flush to 3936 - Add CSensaura3d_GetLiteHRTFFilterPair to 3936 - Improve CMcpxStream_Flush in 3911 All DSound functions are fully detected for 3925 and 3936 titles. Verified with - [3925] Cel Damage - [3936] Silent Hill 2 --- src/CxbxKrnl/HLEDataBase/DSound.1.0.3911.inl | 91 ++++++++++++++++++-- src/CxbxKrnl/HLEDataBase/DSound.1.0.3936.inl | 62 +++++++++++++ src/CxbxKrnl/HLEDataBase/DSound.1.0.4039.inl | 2 +- src/CxbxKrnl/HLEDataBase/DSound.OOVPA.inl | 30 +++---- 4 files changed, 160 insertions(+), 25 deletions(-) diff --git a/src/CxbxKrnl/HLEDataBase/DSound.1.0.3911.inl b/src/CxbxKrnl/HLEDataBase/DSound.1.0.3911.inl index ebb9fade6..83f41c76c 100644 --- a/src/CxbxKrnl/HLEDataBase/DSound.1.0.3911.inl +++ b/src/CxbxKrnl/HLEDataBase/DSound.1.0.3911.inl @@ -1662,21 +1662,21 @@ OOVPA_XREF(CSensaura3d_GetLiteHRTFFilterPair, 3911, 10, XREF_CSensaura3d_GetLiteHRTFFilterPair, XRefZero) - //CSensaura3d_GetLightHRTFFilterPair+0x00 : push ebp + //CSensaura3d_GetLiteHRTFFilterPair+0x00 : push ebp { 0x00, 0x55 }, - //CSensaura3d_GetLightHRTFFilterPair+0x14 : push ecx + //CSensaura3d_GetLiteHRTFFilterPair+0x14 : push ecx { 0x15, 0x51 }, - //CSensaura3d_GetLightHRTFFilterPair+0x22 : push 3 + //CSensaura3d_GetLiteHRTFFilterPair+0x22 : push 3 { 0x1F, 0x6A }, { 0x20, 0x03 }, - //CSensaura3d_GetLightHRTFFilterPair+0x22 : idiv eax, ecx + //CSensaura3d_GetLiteHRTFFilterPair+0x22 : idiv eax, ecx { 0x22, 0xF7 }, { 0x23, 0xF9 }, - //CSensaura3d_GetLightHRTFFilterPair+0x24 : cmp dword ptr [ebp+10h], 0 + //CSensaura3d_GetLiteHRTFFilterPair+0x24 : cmp dword ptr [ebp+10h], 0 { 0x24, 0x83 }, { 0x25, 0x7D }, { 0x26, 0x10 }, @@ -2119,7 +2119,7 @@ OOVPA_END; // ****************************************************************** // * CMcpxStream_Flush // ****************************************************************** -OOVPA_XREF(CMcpxStream_Flush, 3911, 11, +OOVPA_XREF(CMcpxStream_Flush, 3911, 15, XREF_CMcpxStream_Flush, XRefZero) @@ -2135,6 +2135,12 @@ OOVPA_XREF(CMcpxStream_Flush, 3911, 11, { 0x4B, 0xE8 }, + //CMcpxStream_Flush+0x57 : e__,0x80004004 (unique value) + { 0x58, 0x04 }, + { 0x59, 0x40 }, + { 0x5A, 0x00 }, + { 0x5B, 0x80 }, + { 0x62, 0xE8 }, @@ -5592,3 +5598,76 @@ OOVPA_XREF(CMcpxStream_Pause, 3911, 12, { 0x45, 0xC2 }, { 0x46, 0x04 }, OOVPA_END; + +// ****************************************************************** +// * XAudioCreatePcmFormat +// ****************************************************************** +OOVPA_NO_XREF(XAudioCreatePcmFormat, 3911, 11) + + { 0x00, 0x8B }, + + { 0x11, 0x02 }, + { 0x18, 0x0E }, + { 0x2E, 0x10 }, + + + //XAudioCreatePcmFormat+0x10 : mov word ptr [ecx],1 + { 0x34, 0x66 }, + { 0x35, 0xC7 }, + { 0x36, 0x01 }, + { 0x37, 0x01 }, + { 0x38, 0x00 }, + + { 0x47, 0xC2 }, + { 0x48, 0x10 }, +OOVPA_END; + +// ****************************************************************** +// * XAudioCreateAdpcmFormat +// ****************************************************************** +OOVPA_NO_XREF(XAudioCreateAdpcmFormat, 3911, 14) + + { 0x00, 0x8B }, + { 0x04, 0x8B }, + { 0x09, 0x8B }, + + //XAudioCreateAdpcmFormat+0x10 : mov word ptr [edx],69h + { 0x10, 0x66 }, + { 0x11, 0xC7 }, + { 0x12, 0x02 }, + { 0x13, 0x69 }, + { 0x14, 0x00 }, + + { 0x20, 0x04 }, + + { 0x22, 0xE8 }, + + { 0x38, 0x02 }, + + { 0x3E, 0x40 }, + + { 0x41, 0xC2 }, + { 0x42, 0x0C }, +OOVPA_END; + +// ****************************************************************** +// * IsValidFormat +// ****************************************************************** +OOVPA_NO_XREF(IsValidFormat, 3911, 10) + + { 0x00, 0x8B }, + { 0x04, 0x0F }, + { 0x07, 0x48 }, + + //IsValidFormat+0x10 : sub eax,68h + { 0x0A, 0x83 }, + { 0x0B, 0xE8 }, + { 0x0C, 0x68 }, + + { 0x14, 0xE8 }, + + { 0x1C, 0xE8 }, + + { 0x21, 0xC2 }, + { 0x22, 0x04 }, +OOVPA_END; diff --git a/src/CxbxKrnl/HLEDataBase/DSound.1.0.3936.inl b/src/CxbxKrnl/HLEDataBase/DSound.1.0.3936.inl index 5ce8ad491..f8a5f1398 100644 --- a/src/CxbxKrnl/HLEDataBase/DSound.1.0.3936.inl +++ b/src/CxbxKrnl/HLEDataBase/DSound.1.0.3936.inl @@ -3998,6 +3998,68 @@ OOVPA_XREF(IDirectSoundBuffer_SetConeOrientation, 3936, 9, { 0x34, 0x00 } OOVPA_END; #endif + +// ****************************************************************** +// * CMcpxStream_Flush +// ****************************************************************** +OOVPA_XREF(CMcpxStream_Flush, 3936, 15, + XREF_CMcpxStream_Flush, + XRefZero) + + { 0x08, 0xF6 }, + { 0x12, 0xF6 }, + + { 0x22, 0x33 }, + { 0x24, 0x33 }, + + { 0x2F, 0x83 }, + { 0x30, 0xFF }, + { 0x31, 0x03 }, + + { 0x4D, 0xE8 }, + + //CMcpxStream_Flush+0x54 : e__,0x80004004 (unique value) + { 0x55, 0x04 }, + { 0x56, 0x40 }, + { 0x57, 0x00 }, + { 0x58, 0x80 }, + + { 0x5F, 0xE8 }, + + + { 0xA1, 0xC9 }, + { 0xA2, 0xC3 }, +OOVPA_END; + +// ****************************************************************** +// * CSensaura3d_GetLiteHRTFFilterPair +// ****************************************************************** +OOVPA_XREF(CSensaura3d_GetLiteHRTFFilterPair, 3936, 10, + + XREF_CSensaura3d_GetLiteHRTFFilterPair, + XRefZero) + + //CSensaura3d_GetLiteHRTFFilterPair+0x00 : push ebp + { 0x00, 0x55 }, + + //CSensaura3d_GetLiteHRTFFilterPair+0x14 : push ecx + { 0x15, 0x51 }, + + //CSensaura3d_GetLiteHRTFFilterPair+0x22 : push 3 + { 0x1F, 0x6A }, + { 0x20, 0x03 }, + + //CSensaura3d_GetLiteHRTFFilterPair+0x22 : idiv eax, ecx + { 0x22, 0xF7 }, + { 0x23, 0xF9 }, + + //CSensaura3d_GetLiteHRTFFilterPair+0x24 : cmp dword ptr [ebp+10h], 0 + { 0x36, 0x83 }, + { 0x37, 0x7D }, + { 0x38, 0x10 }, + { 0x39, 0x00 }, +OOVPA_END; + // ****************************************************************** // * DSound_3936 // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/DSound.1.0.4039.inl b/src/CxbxKrnl/HLEDataBase/DSound.1.0.4039.inl index 9a088e143..4033a80af 100644 --- a/src/CxbxKrnl/HLEDataBase/DSound.1.0.4039.inl +++ b/src/CxbxKrnl/HLEDataBase/DSound.1.0.4039.inl @@ -971,7 +971,7 @@ OOVPA_XREF(CDirectSoundBuffer_SetPlayRegion, 4039, 13, { 0x7D, 0x0C }, OOVPA_END; -// TODO: Is there IDirectSoundBuffer_SetPlayRegion in 3936? Revision 3925 doesn't have one. + // ****************************************************************** // * IDirectSoundBuffer_SetPlayRegion // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/DSound.OOVPA.inl b/src/CxbxKrnl/HLEDataBase/DSound.OOVPA.inl index 16a926ae4..546b7d352 100644 --- a/src/CxbxKrnl/HLEDataBase/DSound.OOVPA.inl +++ b/src/CxbxKrnl/HLEDataBase/DSound.OOVPA.inl @@ -33,11 +33,11 @@ // * // ****************************************************************** -// Titles which did compiled with full libary -// [revi] Title Name | Verify | Comments +// Titles which did compiled with full libary version +// [LibV] Title Name | Verify | Comments //------------------------------------------------------------------- -// * [3925] Cel Damage | 100% | Contain full library. Need to add 3 missing OOVPAs, see TODO issue list. -// * [3936] Silent Hill 2 | 80% | Need verify non-exist function is there or not, re-check missing detection. +// * [3925] Cel Damage | 100% | Contain full library. +// * [3936] Silent Hill 2 | 100% | Contain full library. // * [4039] Nightcaster | 100% | Only has 90% of the library compiled with xbe build. // * [4134] RaceX (Demo) | 1% | Does not have full library? Need to create bunch of OOVPAs... // * [4134] Blood Omen 2 | 1% | Does not have full library? Need to create bunch of OOVPAs... @@ -61,7 +61,7 @@ // * IDirectSoundBuffer_SetRolloffCurve // * IDirectSoundBuffer_Pause // * IDirectSoundBuffer_PauseEx -// * IDirectSoundBuffer_SetPlayRegion (last seen is 4039?) +// * IDirectSoundBuffer_SetPlayRegion (Introduce in 4039, last known earliest revision) // * IDirectSoundStream_FlushEx // * IDirectSoundStream_GetVoiceProperties // * IDirectSoundStream_PauseEx @@ -88,11 +88,7 @@ // * IDirectSoundStream_SetFrequency & CDirectSoundStream_SetFrequency // * IDirectSoundStream_SetMixBins & CDirectSoundStream_SetMixBins // * Need to include func export support for IDirectSoundStream_Setxxxxx from above. -// * 3911 - Need to add: -// * XAudioCreateAdpcmFormat -// * XAudioCreatePcmFormat -// * IsValidFormat -// Not part of API, yet is a non-member function : (might be useful) +// * 3911 - Not part of API, yet is a non-member function : (might be useful) // * GetFormatSize // * CopyFormat // * CompareFormats @@ -108,10 +104,6 @@ // * Using XREF_DS_CRefCount_Release // * CDirectSound_Release (Is unique, however need multiple OOVPAs to register all revisions) // * Using XREF_DS_CRefCount_Release -// * 3936 verification needed: -// * CDirectSoundBuffer_SetVolume -// * IDirectSoundBuffer_SetVolume -// * What else? Need to re-check the list again... // * 4039 verification needed: // * DirectSoundCreateBuffer // * DirectSoundCreateStream @@ -120,7 +112,7 @@ // * IDirectSound_GetCaps // * IDirectSound_GetEffectData // * IDirectSound_GetSpeakerConfig -// * IDirectSound_GetTime +// * IDirectSound_GetTime (It is generic) // * IDirectSound_SetAllParameters // * IDirectSound_SetEffectData // * IDirectSound_SetMixBinHeadroom @@ -183,10 +175,10 @@ OOVPATable DSound_OOVPAV2[] = { REGISTER_OOVPAS(CMcpxBuffer_Stop, XREF, 3911, 4134, 4242), // NOTE: ?Stop@CMcpxBuffer@DirectSound@@QAEJK@Z REGISTER_OOVPAS(CMcpxBuffer_Stop2, XREF, 4361), // NOTE: ?Stop@CMcpxBuffer@DirectSound@@QAEJ_JK@Z REGISTER_OOVPAS(CMcpxStream_Discontinuity, XREF, 3911, 4039), - REGISTER_OOVPAS(CMcpxStream_Flush, XREF, 3911, 4039), + REGISTER_OOVPAS(CMcpxStream_Flush, XREF, 3911, 3936, 4039), REGISTER_OOVPAS(CMcpxStream_Pause, XREF, 3911, 4039, 4361, 4831, 5788), REGISTER_OOVPAS(CSensaura3d_GetFullHRTFFilterPair, XREF, 3911, 3936), - REGISTER_OOVPAS(CSensaura3d_GetLiteHRTFFilterPair, XREF, 3911), + REGISTER_OOVPAS(CSensaura3d_GetLiteHRTFFilterPair, XREF, 3911, 3936), REGISTER_OOVPAS(CMcpxVoiceClient_Commit3dSettings, XREF, 3911), REGISTER_OOVPAS(CMcpxVoiceClient_Set3dConeOrientation, XREF, 3911), REGISTER_OOVPAS(CMcpxVoiceClient_Set3dConeOutsideVolume, XREF, 3911), @@ -437,7 +429,9 @@ OOVPATable DSound_OOVPAV2[] = { REGISTER_OOVPAS(WaveFormat_CreateXboxAdpcmFormat, XREF, 5344), REGISTER_OOVPAS(XAudioDownloadEffectsImage, PATCH, 4627, 5558, 5788), - REGISTER_OOVPAS(XAudioCreateAdpcmFormat, PATCH, 5344), + REGISTER_OOVPAS(IsValidFormat, UNPATCHED, 3911), + REGISTER_OOVPAS(XAudioCreatePcmFormat, UNPATCHED, 3911), + REGISTER_OOVPAS(XAudioCreateAdpcmFormat, PATCH, 3911, 5344), REGISTER_OOVPAS(XFileCreateMediaObjectAsync, PATCH, 5788), REGISTER_OOVPAS(XFileCreateMediaObjectEx, PATCH, 4627, 5028), REGISTER_OOVPAS(XWaveFileCreateMediaObject, PATCH, 4627),