[PATCH] dmime: Accept a DMUS_IO_SEGMENT_HEADER without rtPlayStart field
Michael Stefaniuc
mstefani at winehq.org
Tue Nov 2 18:54:50 CDT 2021
Tron 2.0 has a segment header of 56, so is missing the rtPlayStart field.
Based on a patch by Alistair Leslie-Hughes.
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
The demo shows the same problem. All 112 segments that get loaded for me
have a segment header of 56 bytes.
dlls/dmime/segment.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c
index f5dbf4b9959..326ffe98e18 100644
--- a/dlls/dmime/segment.c
+++ b/dlls/dmime/segment.c
@@ -727,7 +727,8 @@ static inline void dump_segment_header(DMUS_IO_SEGMENT_HEADER *h, DWORD size)
if (dx == 9) {
TRACE("\trtLoopStart: %s\n", wine_dbgstr_longlong(h->rtLoopStart));
TRACE("\trtLoopEnd: %s\n", wine_dbgstr_longlong(h->rtLoopEnd));
- TRACE("\trtPlayStart: %s\n", wine_dbgstr_longlong(h->rtPlayStart));
+ if (size > offsetof(DMUS_IO_SEGMENT_HEADER, rtPlayStart))
+ TRACE("\trtPlayStart: %s\n", wine_dbgstr_longlong(h->rtPlayStart));
}
}
@@ -742,8 +743,11 @@ static HRESULT parse_segment_form(IDirectMusicSegment8Impl *This, IStream *strea
while ((hr = stream_next_chunk(stream, &chunk)) == S_OK) {
switch (chunk.id) {
case DMUS_FOURCC_SEGMENT_CHUNK:
+ /* DX9 without rtPlayStart field */
+ if (chunk.size == offsetof(DMUS_IO_SEGMENT_HEADER, rtPlayStart))
+ WARN("Missing rtPlayStart field in %s\n", debugstr_chunk(&chunk));
/* DX7, DX8 and DX9 structure sizes */
- if (chunk.size != offsetof(DMUS_IO_SEGMENT_HEADER, rtLength) &&
+ else if (chunk.size != offsetof(DMUS_IO_SEGMENT_HEADER, rtLength) &&
chunk.size != offsetof(DMUS_IO_SEGMENT_HEADER, rtLoopStart) &&
chunk.size != sizeof(DMUS_IO_SEGMENT_HEADER)) {
WARN("Invalid size of %s\n", debugstr_chunk(&chunk));
--
2.31.1
More information about the wine-devel
mailing list