https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d9ceaa2284f75937119813f6f82ef9b7562e8c38

commit d9ceaa2284f75937119813f6f82ef9b7562e8c38
Author:     winesync <[email protected]>
AuthorDate: Mon Sep 21 23:01:49 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Thu Feb 4 16:37:04 2021 +0100

    [WINESYNC] d3dx9: Correctly handle NULL constant state for objects on 64 
bit arch.
    
    Signed-off-by: Paul Gofman <[email protected]>
    Signed-off-by: Matteo Bruni <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id aef11864a47a33830eca086de8bf337ee9b5114a by Paul Gofman 
<[email protected]>
---
 dll/directx/wine/d3dx9_36/effect.c | 35 +++++++++++++++++++++++++++++++----
 sdk/tools/winesync/d3dx9.cfg       |  2 +-
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/dll/directx/wine/d3dx9_36/effect.c 
b/dll/directx/wine/d3dx9_36/effect.c
index 403c9d09989..895cbdef5af 100644
--- a/dll/directx/wine/d3dx9_36/effect.c
+++ b/dll/directx/wine/d3dx9_36/effect.c
@@ -5349,8 +5349,11 @@ static HRESULT d3dx_parse_effect_annotation(struct 
d3dx_effect *effect, struct d
 static HRESULT d3dx_parse_state(struct d3dx_effect *effect, struct d3dx_state 
*state,
         const char *data, const char **ptr, struct d3dx_object *objects)
 {
-    DWORD offset;
+    struct d3dx_parameter *param = &state->parameter;
+    enum STATE_CLASS state_class;
     const char *ptr2;
+    void *new_data;
+    DWORD offset;
     HRESULT hr;
 
     state->type = ST_CONSTANT;
@@ -5364,7 +5367,7 @@ static HRESULT d3dx_parse_state(struct d3dx_effect 
*effect, struct d3dx_state *s
     read_dword(ptr, &offset);
     TRACE("Typedef offset: %#x\n", offset);
     ptr2 = data + offset;
-    hr = d3dx_parse_effect_typedef(effect, &state->parameter, data, &ptr2, 
NULL, 0);
+    hr = d3dx_parse_effect_typedef(effect, param, data, &ptr2, NULL, 0);
     if (hr != D3D_OK)
     {
         WARN("Failed to parse type definition\n");
@@ -5373,18 +5376,42 @@ static HRESULT d3dx_parse_state(struct d3dx_effect 
*effect, struct d3dx_state *s
 
     read_dword(ptr, &offset);
     TRACE("Value offset: %#x\n", offset);
-    hr = d3dx_parse_init_value(effect, &state->parameter, data, data + offset, 
objects);
+    hr = d3dx_parse_init_value(effect, param, data, data + offset, objects);
     if (hr != D3D_OK)
     {
         WARN("Failed to parse value\n");
         goto err_out;
     }
 
+    if (((state_class = state_table[state->operation].class) == SC_VERTEXSHADER
+            || state_class == SC_PIXELSHADER || state_class == SC_TEXTURE)
+            && param->bytes < sizeof(void *))
+    {
+        if (param->type != D3DXPT_INT || *(unsigned int *)param->data)
+        {
+            FIXME("Unexpected parameter for object, param->type %#x, 
param->class %#x, *param->data %#x.\n",
+                    param->type, param->class, *(unsigned int *)param->data);
+            hr = D3DXERR_INVALIDDATA;
+            goto err_out;
+        }
+
+        new_data = heap_realloc(param->data, sizeof(void *));
+        if (!new_data)
+        {
+            ERR("Out of memory.\n");
+            hr = E_OUTOFMEMORY;
+            goto err_out;
+        }
+        memset(new_data, 0, sizeof(void *));
+        param->data = new_data;
+        param->bytes = sizeof(void *);
+    }
+
     return D3D_OK;
 
 err_out:
 
-    free_parameter(&state->parameter, FALSE, FALSE);
+    free_parameter(param, FALSE, FALSE);
 
     return hr;
 }
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index d5d29603838..b7a46b5de82 100644
--- a/sdk/tools/winesync/d3dx9.cfg
+++ b/sdk/tools/winesync/d3dx9.cfg
@@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, 
include/d3dx9anim.h: sdk/inc
   include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: 
sdk/include/dxsdk/d3dx9of.h,
   include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, 
include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
   include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: 
sdk/include/dxsdk/d3dx9xof.h}
-tags: {wine: 5b66442bc95e42bcef2ca385168fc3d594182e4a}
+tags: {wine: aef11864a47a33830eca086de8bf337ee9b5114a}

Reply via email to