Rebase against 6391b8d5c99c206689c6e55a675b51086d8be821.

This commit is contained in:
Alistair Leslie-Hughes 2023-10-19 09:21:42 +11:00
parent 9486ca2543
commit 28180a60fd
5 changed files with 13 additions and 248 deletions

View File

@ -1,154 +0,0 @@
From d32988c911aae73ec81242cd8f6ae37e078d212f Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 2 Dec 2022 14:41:30 +1100
Subject: [PATCH] dmime: Implement IDirectMusicSegment8 Download
---
dlls/dmime/dmime_private.h | 1 +
dlls/dmime/performance.c | 7 ++++
dlls/dmime/segment.c | 84 +++++++++++++++++++++++++++++++++++++-
3 files changed, 91 insertions(+), 1 deletion(-)
diff --git a/dlls/dmime/dmime_private.h b/dlls/dmime/dmime_private.h
index c35c52eb066..ca8323fc525 100644
--- a/dlls/dmime/dmime_private.h
+++ b/dlls/dmime/dmime_private.h
@@ -72,6 +72,7 @@ extern void set_audiopath_primary_dsound_buffer(IDirectMusicAudioPath*,IDirectSo
extern HRESULT segment_state_create(IDirectMusicSegment *segment, MUSIC_TIME start_time,
IDirectMusicSegmentState **ret_iface);
+extern IDirectSound *get_dsound_interface(IDirectMusicPerformance8*);
/*****************************************************************************
* Auxiliary definitions
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c
index 9f293358ca6..3658c16c187 100644
--- a/dlls/dmime/performance.c
+++ b/dlls/dmime/performance.c
@@ -251,6 +251,13 @@ static inline struct performance *impl_from_IDirectMusicPerformance8(IDirectMusi
return CONTAINING_RECORD(iface, struct performance, IDirectMusicPerformance8_iface);
}
+IDirectSound *get_dsound_interface(IDirectMusicPerformance8* iface)
+{
+ struct performance *This = impl_from_IDirectMusicPerformance8(iface);
+ return This->dsound;
+}
+
+
/* IDirectMusicPerformance8 IUnknown part: */
static HRESULT WINAPI performance_QueryInterface(IDirectMusicPerformance8 *iface, REFIID riid, void **ret_iface)
{
diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c
index af7729f34b9..284564749df 100644
--- a/dlls/dmime/segment.c
+++ b/dlls/dmime/segment.c
@@ -54,6 +54,7 @@ struct segment
PCMWAVEFORMAT wave_format;
void *wave_data;
int data_size;
+ IDirectSoundBuffer *buffer;
};
static struct segment *segment_create(void);
@@ -114,6 +115,8 @@ static ULONG WINAPI segment_Release(IDirectMusicSegment8 *iface)
track_entry_destroy(entry);
}
+ if (This->buffer)
+ IDirectSoundBuffer_Release(This->buffer);
if (This->wave_data)
free(This->wave_data);
@@ -533,8 +536,87 @@ static HRESULT WINAPI segment_Compose(IDirectMusicSegment8 *iface, MUSIC_TIME mt
static HRESULT WINAPI segment_Download(IDirectMusicSegment8 *iface, IUnknown *audio_path)
{
struct segment *This = impl_from_IDirectMusicSegment8(iface);
+ IDirectMusicPerformance8 *perf;
+ IDirectMusicAudioPath *audio;
+ IDirectSound *dsound;
+ HRESULT hr;
+ DSBUFFERDESC dsbd = {.dwSize = sizeof(dsbd)};
+ void *data;
+ DWORD size;
+ DWORD buffer = 0;
+
TRACE("(%p, %p)\n", This, audio_path);
- return IDirectMusicSegment8_SetParam(iface, &GUID_DownloadToAudioPath, -1, DMUS_SEG_ALLTRACKS, 0, audio_path);
+
+ if (!audio_path)
+ return E_INVALIDARG;
+
+ hr = IDirectMusicSegment8_SetParam(iface, &GUID_DownloadToAudioPath, -1, DMUS_SEG_ALLTRACKS, 0, audio_path);
+ if (FAILED(hr))
+ return hr;
+
+ if (This->buffer)
+ {
+ TRACE("Using Cached buffer\n");
+ return S_OK;
+ }
+
+ /* pAudioPath can either be IDirectMusicAudioPath or IDirectMusicPerformance */
+ hr = IUnknown_QueryInterface(audio_path, &IID_IDirectMusicPerformance8, (void**)&perf);
+ if (FAILED(hr))
+ {
+ TRACE("Checking for IDirectMusicAudioPath interface\n");
+ hr = IUnknown_QueryInterface(audio_path, &IID_IDirectMusicAudioPath, (void**)&audio);
+ if (FAILED(hr))
+ {
+ WARN("Cannot query for IDirectMusicAudioPath\n");
+ return E_INVALIDARG;
+ }
+
+ IDirectMusicAudioPath_GetObjectInPath(audio, DMUS_PCHANNEL_ALL, DMUS_PATH_PERFORMANCE, buffer, &GUID_NULL,
+ 0, &IID_IDirectMusicPerformance, (void**)&perf);
+ IDirectMusicAudioPath_Release(audio);
+ }
+
+ if (!perf)
+ {
+ ERR("Failed to get IDirectMusicPerformance interface\n");
+ return E_INVALIDARG;
+ }
+
+ dsound = get_dsound_interface(perf);
+ if (!dsound)
+ {
+ ERR("Failed get_dsound_interface\n");
+ return E_INVALIDARG;
+ }
+
+ if (This->data_size == 0)
+ {
+ FIXME("No wave data skipping\n");
+ return S_OK;
+ }
+
+ dsbd.dwBufferBytes = This->data_size;
+ dsbd.lpwfxFormat = (WAVEFORMATEX*)&This->wave_format;
+
+ hr = IDirectSound_CreateSoundBuffer(dsound, &dsbd, &This->buffer, NULL);
+ if (FAILED(hr))
+ {
+ ERR("IDirectSound_CreateSoundBuffer failed 0x%08lx\n", hr);
+ return E_INVALIDARG;
+ }
+
+ TRACE("CreateSoundBuffer successful\n");
+
+ hr = IDirectSoundBuffer_Lock(This->buffer, 0, This->data_size, &data, &size, NULL, 0, 0);
+ TRACE("IDirectSoundBuffer_Lock hr 0x%08lx\n", hr);
+
+ memcpy(data, This->wave_data, This->data_size);
+
+ hr = IDirectSoundBuffer_Unlock(This->buffer, data, This->data_size, NULL, 0);
+ TRACE("IDirectSoundBuffer_Unlock hr 0x%08lx\n", hr);
+
+ return S_OK;
}
static HRESULT WINAPI segment_Unload(IDirectMusicSegment8 *iface, IUnknown *audio_path)
--
2.42.0

View File

@ -1,67 +0,0 @@
From b9c561a99b7034e3cac64ab85e4d50a6fb0c304c Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 12 Dec 2022 15:20:10 +1100
Subject: [PATCH] dmime: Play a sound in IDirectMusicPerformance8 PlaySegmentEx
---
dlls/dmime/dmime_private.h | 1 +
dlls/dmime/performance.c | 6 ++++++
dlls/dmime/segment.c | 6 ++++++
3 files changed, 13 insertions(+)
diff --git a/dlls/dmime/dmime_private.h b/dlls/dmime/dmime_private.h
index ca8323fc525..2b4537233fc 100644
--- a/dlls/dmime/dmime_private.h
+++ b/dlls/dmime/dmime_private.h
@@ -73,6 +73,7 @@ extern void set_audiopath_primary_dsound_buffer(IDirectMusicAudioPath*,IDirectSo
extern HRESULT segment_state_create(IDirectMusicSegment *segment, MUSIC_TIME start_time,
IDirectMusicSegmentState **ret_iface);
extern IDirectSound *get_dsound_interface(IDirectMusicPerformance8*);
+extern IDirectSoundBuffer *get_segment_buffer(IDirectMusicSegment8 *iface);
/*****************************************************************************
* Auxiliary definitions
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c
index 3658c16c187..14831e72ba3 100644
--- a/dlls/dmime/performance.c
+++ b/dlls/dmime/performance.c
@@ -1078,6 +1078,7 @@ static HRESULT WINAPI performance_PlaySegmentEx(IDirectMusicPerformance8 *iface,
IDirectMusicSegmentState *state;
IDirectMusicSegment *segment;
HRESULT hr;
+ IDirectSoundBuffer *buffer;
FIXME("(%p, %p, %s, %p, %#lx, %I64d, %p, %p, %p): stub\n", This, source, debugstr_w(segment_name),
transition, segment_flags, start_time, segment_state, from, audio_path);
@@ -1096,6 +1097,11 @@ static HRESULT WINAPI performance_PlaySegmentEx(IDirectMusicPerformance8 *iface,
IDirectMusicSegmentState_AddRef(state);
}
+ buffer = get_segment_buffer(segment);
+
+ if (segment)
+ hr = IDirectSoundBuffer_Play(buffer, 0, 0, 0);
+
IDirectMusicSegmentState_Release(state);
IDirectMusicSegment_Release(segment);
return hr;
diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c
index 284564749df..af76258c979 100644
--- a/dlls/dmime/segment.c
+++ b/dlls/dmime/segment.c
@@ -64,6 +64,12 @@ static inline struct segment *impl_from_IDirectMusicSegment8(IDirectMusicSegment
return CONTAINING_RECORD(iface, struct segment, IDirectMusicSegment8_iface);
}
+IDirectSoundBuffer *get_segment_buffer(IDirectMusicSegment8 *iface)
+{
+ struct segment *This = impl_from_IDirectMusicSegment8(iface);
+ return This->buffer;
+}
+
static HRESULT WINAPI segment_QueryInterface(IDirectMusicSegment8 *iface, REFIID riid, void **ret_iface)
{
struct segment *This = impl_from_IDirectMusicSegment8(iface);
--
2.42.0

View File

@ -1,14 +0,0 @@
Fixes: [48220] dmime: Handle basic loading of Wave files and playing them.
Fixes: [61322] dmine: No Sound in Black Rockman Shooter.
Fixes: [34751] dmime: Aura: Fate of the Ages: sounds aren't played, but music works fine
Fixes: [9027] dmime: No sound for rise of nations - all versions.
Disabled: True
# Also
# - Cloning Clyde demo
# Doesnt fix
# The following are known not to work, at the moment.
# [31586] : Myst sounds (Voices)
# [30969] : Tron 2.0 Background music
# [32896] : Serious Sam: The Random Encounter

View File

@ -1,4 +1,4 @@
From 2dedad4a62b8d8b829a690d0d00a5405b4dd2ea1 Mon Sep 17 00:00:00 2001
From a4b3e6ebf11273f97e2fd1fedaeb264149a0685f Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 10 Feb 2016 15:09:29 +0800
Subject: [PATCH] winex11.drv: Add support for _NET_ACTIVE_WINDOW. (v2)
@ -18,7 +18,7 @@ For bug #2155.
8 files changed, 67 insertions(+)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c
index ed2e0973d39..79c4714f15a 100644
index e6a24d1a46c..d5865eff545 100644
--- a/dlls/win32u/driver.c
+++ b/dlls/win32u/driver.c
@@ -837,6 +837,10 @@ static BOOL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update )
@ -49,7 +49,7 @@ index ed2e0973d39..79c4714f15a 100644
SET_USER_FUNC(SetDesktopWindow);
SET_USER_FUNC(SetFocus);
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c
index b286298bf73..5acb17db7ea 100644
index 500d02ab26d..a836a381a26 100644
--- a/dlls/win32u/input.c
+++ b/dlls/win32u/input.c
@@ -1889,6 +1889,8 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
@ -62,7 +62,7 @@ index b286298bf73..5acb17db7ea 100644
if (focus)
{
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index c3c8d9a4070..a7793f0c399 100644
index 97bec34b0ea..b5f05bd108f 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -576,6 +576,9 @@ static void set_focus( Display *display, HWND hwnd, Time time )
@ -75,7 +75,7 @@ index c3c8d9a4070..a7793f0c399 100644
TRACE( "setting foreground window to %p\n", hwnd );
NtUserSetForegroundWindow( hwnd );
@@ -818,6 +821,8 @@ static void focus_out( Display *display , HWND hwnd )
@@ -820,6 +823,8 @@ static void focus_out( Display *display , HWND hwnd )
if (!is_current_process_focused())
{
@ -97,10 +97,10 @@ index 813532eff53..fe40582dc89 100644
.pSetDesktopWindow = X11DRV_SetDesktopWindow,
.pSetFocus = X11DRV_SetFocus,
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 974bd376fe6..177cdc0faa3 100644
index 53982bb8c3b..f6769a695d4 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -2429,6 +2429,54 @@ BOOL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update )
@@ -2467,6 +2467,54 @@ BOOL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update )
}
@ -156,7 +156,7 @@ index 974bd376fe6..177cdc0faa3 100644
* SetCapture (X11DRV.@)
*/
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 4350f894aca..27ad4d9d19b 100644
index b8a8592f7fa..eefbaaf1fec 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -231,6 +231,7 @@ extern void X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect,
@ -173,9 +173,9 @@ index 4350f894aca..27ad4d9d19b 100644
HWND grab_hwnd; /* window that currently grabs the mouse */
+ HWND active_window; /* active window */
HWND last_focus; /* last window that had focus */
HWND keymapnotify_hwnd; /* window that should receive modifier release events */
XIM xim; /* input method */
HWND last_xic_hwnd; /* last xic window */
@@ -486,6 +488,7 @@ enum x11drv_atoms
@@ -487,6 +489,7 @@ enum x11drv_atoms
XATOM__ICC_PROFILE,
XATOM__KDE_NET_WM_STATE_SKIP_SWITCHER,
XATOM__MOTIF_WM_HINTS,
@ -184,7 +184,7 @@ index 4350f894aca..27ad4d9d19b 100644
XATOM__NET_STARTUP_INFO,
XATOM__NET_SUPPORTED,
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index c4d537d6ada..9c56d7df56a 100644
index 32a20e0e4f2..c12905f0ded 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -153,6 +153,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
@ -208,5 +208,5 @@ index c4e859f21e5..24df7ea0b25 100644
void (*pSetDesktopWindow)(HWND);
void (*pSetFocus)(HWND);
--
2.40.1
2.42.0

View File

@ -1 +1 @@
0c7a09cb1f92d55d8381ff6460e13ed085d434db
6391b8d5c99c206689c6e55a675b51086d8be821