From 4981eda8951a5bbe0d4b6aea7777078903c05f06 Mon Sep 17 00:00:00 2001 From: Alexander Dorofeyev Date: Sun, 17 Feb 2008 17:36:35 -0800 Subject: [PATCH] ddraw: Fix executebuffer branching with non-zero offset. Fixes a crash in Moto Racer 2. --- dlls/ddraw/executebuffer.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c index 49b6d6c12e4..fce3c4fac58 100644 --- a/dlls/ddraw/executebuffer.c +++ b/dlls/ddraw/executebuffer.c @@ -524,12 +524,18 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This, if ((This->data.dsStatus.dwStatus & ci->dwMask) == ci->dwValue) { if (!ci->bNegate) { TRACE(" Branch to %d\n", ci->dwOffset); - instr = (char*)current + ci->dwOffset; + if (ci->dwOffset) { + instr = (char*)current + ci->dwOffset; + break; + } } } else { if (ci->bNegate) { TRACE(" Branch to %d\n", ci->dwOffset); - instr = (char*)current + ci->dwOffset; + if (ci->dwOffset) { + instr = (char*)current + ci->dwOffset; + break; + } } }