Implement IDirectSoundBuffer Unlock OOVPA

Verified Unlock does exist in xbe file and is in used. Even though xbox
doesn't handle it directly. It will allow fix audio issue especially
Turok Evolution's XADPCM backgrounc music. Yet is not fully fixed...

On side note... Xbox dashboard is calling Unlock function?!?!
This commit is contained in:
RadWolfie 2017-08-17 04:57:15 -05:00 committed by Luke Usher
parent b68e9bb90b
commit 443e0987ed
4 changed files with 66 additions and 0 deletions

View File

@ -1058,6 +1058,45 @@ HRESULT WINAPI XTL::EMUPATCH(IDirectSoundBuffer_Lock)
RETURN_RESULT_CHECK(hRet);
}
// ******************************************************************
// * patch: IDirectSoundBuffer_Unlock
// ******************************************************************
HRESULT WINAPI XTL::EMUPATCH(IDirectSoundBuffer_Unlock)
(
X_CDirectSoundBuffer* pThis,
LPVOID ppvAudioPtr1,
DWORD pdwAudioBytes1,
LPVOID ppvAudioPtr2,
DWORD pdwAudioBytes2
)
{
FUNC_EXPORTS;
enterCriticalSection;
LOG_FUNC_BEGIN
LOG_FUNC_ARG(pThis)
LOG_FUNC_ARG(ppvAudioPtr1)
LOG_FUNC_ARG(pdwAudioBytes1)
LOG_FUNC_ARG(ppvAudioPtr2)
LOG_FUNC_ARG(pdwAudioBytes2)
LOG_FUNC_END;
DSoundGenericUnlock(pThis->EmuFlags,
pThis->EmuDirectSoundBuffer8,
pThis->EmuBufferDesc,
pThis->EmuLockOffset,
pThis->EmuLockPtr1,
pThis->EmuLockBytes1,
pThis->EmuLockPtr2,
pThis->EmuLockBytes2,
pThis->EmuLockFlags);
leaveCriticalSection;
return DS_OK;
}
// ******************************************************************
// * patch: IDirectSoundBuffer_SetHeadroom
// ******************************************************************

View File

@ -707,6 +707,17 @@ HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_Lock)
LPDWORD pdwAudioBytes2,
DWORD dwFlags
);
// ******************************************************************
// * patch: IDirectSoundBuffer_Unlock
// ******************************************************************
HRESULT WINAPI EMUPATCH(IDirectSoundBuffer_Unlock)
(
X_CDirectSoundBuffer* pThis,
LPVOID ppvAudioPtr1,
DWORD pdwAudioBytes1,
LPVOID ppvAudioPtr2,
DWORD pdwAudioBytes2
);
// ******************************************************************
// * patch: IDirectSoundBuffer_SetHeadroom

View File

@ -4035,6 +4035,21 @@ OOVPA_XREF(IDirectSoundBuffer_SetConeOutsideVolume, 3936, 9,
{ 0x1F, 0x00 }
OOVPA_END;
// ******************************************************************
// * IDirectSoundBuffer_Unlock
// ******************************************************************
OOVPA_NO_XREF(IDirectSoundBuffer_Unlock, 3936, 5)
// IDirectSoundBuffer_Unlock+0x00 : xor eax, eax
{ 0x00, 0x33 },
{ 0x01, 0xC0 },
// IDirectSoundBuffer_Unlock+0x02 : ret 14h
{ 0x02, 0xC2 },
{ 0x03, 0x14 },
{ 0x04, 0x00 }
OOVPA_END;
// ******************************************************************
// * DSound_3936
// ******************************************************************

View File

@ -284,6 +284,7 @@ OOVPATable DSound_OOVPAV2[] = {
REGISTER_OOVPAS(IDirectSoundBuffer_SetVolumeB, XREF, 3936),
REGISTER_OOVPAS(IDirectSoundBuffer_Stop, PATCH, 3936, 4134, 4361),
REGISTER_OOVPAS(IDirectSoundBuffer_StopEx, PATCH, 4361),
REGISTER_OOVPAS(IDirectSoundBuffer_Unlock, PATCH, 3936),
REGISTER_OOVPAS(IDirectSoundBuffer_Use3DVoiceData, PATCH, 5558),
REGISTER_OOVPAS(IDirectSound_AddRef, PATCH, 3936),
REGISTER_OOVPAS(IDirectSound_CreateSoundBuffer, PATCH, 3936/*, 4134, 4361*/),