From 5b8d5131a3d964ba99863fd9d05e0a91004c0994 Mon Sep 17 00:00:00 2001 From: Raphael Junqueira Date: Sun, 7 Mar 2004 03:14:49 +0000 Subject: [PATCH] Fix one ugly bug (horrible cast) into dmusic code to get Unreal2 crashing later (when trying to launch loaded sound) :) --- dlls/dmime/performance.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index f80dfe67b8e..f3b7b8a7f6a 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -486,6 +486,7 @@ HRESULT WINAPI IDirectMusicPerformance8ImplCreateAudioPath (LPDIRECTMUSICPERFORM */ HRESULT WINAPI IDirectMusicPerformance8ImplCreateStandardAudioPath (LPDIRECTMUSICPERFORMANCE8 iface, DWORD dwType, DWORD dwPChannelCount, BOOL fActivate, IDirectMusicAudioPath** ppNewPath) { IDirectMusicAudioPathImpl *default_path; + IDirectMusicAudioPath *pPath; DSBUFFERDESC desc; WAVEFORMATEX format; LPDIRECTSOUNDBUFFER8 buffer; @@ -499,9 +500,10 @@ HRESULT WINAPI IDirectMusicPerformance8ImplCreateStandardAudioPath (LPDIRECTMUSI return E_POINTER; } - DMUSIC_CreateDirectMusicAudioPathImpl (&IID_IDirectMusicAudioPath, (LPVOID*)&default_path, NULL); + DMUSIC_CreateDirectMusicAudioPathImpl (&IID_IDirectMusicAudioPath, (LPVOID*)&pPath, NULL); + default_path = (IDirectMusicAudioPathImpl*)((char*)(pPath) - offsetof(IDirectMusicAudioPathImpl,AudioPathVtbl)); default_path->pPerf = (IDirectMusicPerformance8*) This; - + /* Secondary buffer description */ format.wFormatTag = WAVE_FORMAT_PCM; format.nChannels = 1; @@ -565,7 +567,7 @@ HRESULT WINAPI IDirectMusicPerformance8ImplCreateStandardAudioPath (LPDIRECTMUSI } default_path->pPrimary = (IDirectSoundBuffer*) buffer; - *ppNewPath = (LPDIRECTMUSICAUDIOPATH) default_path; + *ppNewPath = (LPDIRECTMUSICAUDIOPATH) pPath; TRACE(" returning IDirectMusicPerformance interface at %p.\n", *ppNewPath);