diff --git a/patches/d3dx9_36-AnimationController/0002-d3dx9_36-Store-all-values-passed-to-the-create-and-r.patch b/patches/d3dx9_36-AnimationController/0002-d3dx9_36-Store-all-values-passed-to-the-create-and-r.patch new file mode 100644 index 00000000..b994971a --- /dev/null +++ b/patches/d3dx9_36-AnimationController/0002-d3dx9_36-Store-all-values-passed-to-the-create-and-r.patch @@ -0,0 +1,120 @@ +From a719ecc33b789c26eb75b1eb27523f47cb02df5c Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Fri, 21 Aug 2015 15:05:51 +1000 +Subject: d3dx9_36: Store all values passed to the create and return them in + the correct functions + +Signed-off-by: Alistair Leslie-Hughes +--- + dlls/d3dx9_36/animation.c | 47 ++++++++++++++++++++++++++++++++--------------- + 1 file changed, 32 insertions(+), 15 deletions(-) + +diff --git a/dlls/d3dx9_36/animation.c b/dlls/d3dx9_36/animation.c +index 72f685f..042079d 100644 +--- a/dlls/d3dx9_36/animation.c ++++ b/dlls/d3dx9_36/animation.c +@@ -27,6 +27,11 @@ struct d3dx9_animation_controller + { + ID3DXAnimationController ID3DXAnimationController_iface; + LONG ref; ++ ++ UINT max_outputs; ++ UINT max_sets; ++ UINT max_tracks; ++ UINT max_events; + }; + + static inline struct d3dx9_animation_controller *impl_from_ID3DXAnimationController(ID3DXAnimationController *iface) +@@ -53,24 +58,24 @@ static HRESULT WINAPI d3dx9_animation_controller_QueryInterface(ID3DXAnimationCo + + static ULONG WINAPI d3dx9_animation_controller_AddRef(ID3DXAnimationController *iface) + { +- struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface); +- ULONG refcount = InterlockedIncrement(&animation->ref); ++ struct d3dx9_animation_controller *This = impl_from_ID3DXAnimationController(iface); ++ ULONG refcount = InterlockedIncrement(&This->ref); + +- TRACE("%p increasing refcount to %u.\n", animation, refcount); ++ TRACE("%p increasing refcount to %u.\n", This, refcount); + + return refcount; + } + + static ULONG WINAPI d3dx9_animation_controller_Release(ID3DXAnimationController *iface) + { +- struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface); +- ULONG refcount = InterlockedDecrement(&animation->ref); ++ struct d3dx9_animation_controller *This = impl_from_ID3DXAnimationController(iface); ++ ULONG refcount = InterlockedDecrement(&This->ref); + +- TRACE("%p decreasing refcount to %u.\n", animation, refcount); ++ TRACE("%p decreasing refcount to %u.\n", This, refcount); + + if (!refcount) + { +- HeapFree(GetProcessHeap(), 0, animation); ++ HeapFree(GetProcessHeap(), 0, This); + } + + return refcount; +@@ -78,30 +83,38 @@ static ULONG WINAPI d3dx9_animation_controller_Release(ID3DXAnimationController + + static UINT WINAPI d3dx9_animation_controller_GetMaxNumAnimationOutputs(ID3DXAnimationController *iface) + { +- FIXME("iface %p stub.\n", iface); ++ struct d3dx9_animation_controller *This = impl_from_ID3DXAnimationController(iface); + +- return 0; ++ TRACE("iface %p.\n", iface); ++ ++ return This->max_outputs; + } + + static UINT WINAPI d3dx9_animation_controller_GetMaxNumAnimationSets(ID3DXAnimationController *iface) + { +- FIXME("iface %p stub.\n", iface); ++ struct d3dx9_animation_controller *This = impl_from_ID3DXAnimationController(iface); + +- return 0; ++ TRACE("iface %p.\n", iface); ++ ++ return This->max_sets; + } + + static UINT WINAPI d3dx9_animation_controller_GetMaxNumTracks(ID3DXAnimationController *iface) + { +- FIXME("iface %p stub.\n", iface); ++ struct d3dx9_animation_controller *This = impl_from_ID3DXAnimationController(iface); + +- return 0; ++ FIXME("iface %p.\n", iface); ++ ++ return This->max_tracks; + } + + static UINT WINAPI d3dx9_animation_controller_GetMaxNumEvents(ID3DXAnimationController *iface) + { +- FIXME("iface %p stub.\n", iface); ++ struct d3dx9_animation_controller *This = impl_from_ID3DXAnimationController(iface); + +- return 0; ++ FIXME("iface %p.\n", iface); ++ ++ return This->max_events; + } + + static HRESULT WINAPI d3dx9_animation_controller_RegisterAnimationOutput(ID3DXAnimationController *iface, +@@ -448,6 +461,10 @@ HRESULT WINAPI D3DXCreateAnimationController(UINT MaxNumAnimationOutputs, UINT M + + object->ID3DXAnimationController_iface.lpVtbl = &d3dx9_animation_controller_vtbl; + object->ref = 1; ++ object->max_outputs = MaxNumAnimationOutputs; ++ object->max_sets = MaxNumAnimationSets; ++ object->max_tracks = MaxNumTracks; ++ object->max_events = MaxNumEvents; + + *AnimationController = &object->ID3DXAnimationController_iface; + +-- +2.6.1 + diff --git a/patches/d3dx9_36-AnimationController/0003-d3dx9_36-Add-D3DXCreateAnimationController-tests.patch b/patches/d3dx9_36-AnimationController/0003-d3dx9_36-Add-D3DXCreateAnimationController-tests.patch new file mode 100644 index 00000000..6fc93eb8 --- /dev/null +++ b/patches/d3dx9_36-AnimationController/0003-d3dx9_36-Add-D3DXCreateAnimationController-tests.patch @@ -0,0 +1,83 @@ +From 151b9f248ad985bb545541fbc4a0096e53385505 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Tue, 25 Aug 2015 14:34:43 +1000 +Subject: d3dx9_36: Add D3DXCreateAnimationController tests + +Signed-off-by: Alistair Leslie-Hughes +--- + dlls/d3dx9_36/tests/mesh.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 52 insertions(+) + +diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c +index 4186e19..fd764df 100644 +--- a/dlls/d3dx9_36/tests/mesh.c ++++ b/dlls/d3dx9_36/tests/mesh.c +@@ -10959,6 +10959,57 @@ static void test_compute_normals(void) + free_test_context(test_context); + } + ++static void D3DXCreateAnimationControllerTest(void) ++{ ++ HRESULT hr; ++ ID3DXAnimationController *animation; ++ UINT value; ++ ++ hr = D3DXCreateAnimationController(0, 0, 0, 0, NULL); ++ todo_wine ok(hr == D3D_OK, "D3DXCreateAnimationController returned %#x, expected D3D_OK\n", hr); ++ ++if (0) /* Crashes when animation is Released */ ++{ ++ hr = D3DXCreateAnimationController(0, 0, 0, 0, &animation); ++ ok(hr == D3D_OK, "D3DXCreateAnimationController returned %#x, expected D3D_OK\n", hr); ++ animation->lpVtbl->Release(animation); ++} ++ ++ hr = D3DXCreateAnimationController(1, 1, 1, 1, &animation); ++ ok(hr == D3D_OK, "D3DXCreateAnimationController returned %#x, expected D3D_OK\n", hr); ++ ++ value = animation->lpVtbl->GetMaxNumAnimationOutputs(animation); ++ ok(value == 1, "returned %u, expected 1\n", value); ++ ++ value = animation->lpVtbl->GetMaxNumAnimationSets(animation); ++ ok(value == 1, "returned %u, expected 1\n", value); ++ ++ value = animation->lpVtbl->GetMaxNumTracks(animation); ++ ok(value == 1, "returned %u, expected 1\n", value); ++ ++ value = animation->lpVtbl->GetMaxNumEvents(animation); ++ ok(value == 1, "returned %u, expected 1\n", value); ++ ++ animation->lpVtbl->Release(animation); ++ ++ hr = D3DXCreateAnimationController(100, 101, 102, 103, &animation); ++ ok(hr == D3D_OK, "D3DXCreateAnimationController returned %#x, expected D3D_OK\n", hr); ++ ++ value = animation->lpVtbl->GetMaxNumAnimationOutputs(animation); ++ ok(value == 100, "returned %u, expected 100\n", value); ++ ++ value = animation->lpVtbl->GetMaxNumAnimationSets(animation); ++ ok(value == 101, "returned %u, expected 101\n", value); ++ ++ value = animation->lpVtbl->GetMaxNumTracks(animation); ++ ok(value == 102, "returned %u, expected 102\n", value); ++ ++ value = animation->lpVtbl->GetMaxNumEvents(animation); ++ ok(value == 103, "returned %u, expected 103\n", value); ++ ++ animation->lpVtbl->Release(animation); ++} ++ + START_TEST(mesh) + { + D3DXBoundProbeTest(); +@@ -10975,6 +11026,7 @@ START_TEST(mesh) + D3DXCreateCylinderTest(); + D3DXCreateTextTest(); + D3DXCreateTorusTest(); ++ D3DXCreateAnimationControllerTest(); + test_get_decl_length(); + test_get_decl_vertex_size(); + test_fvf_decl_conversion(); +-- +2.6.1 + diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index b41c204b..1332f1bd 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -2562,12 +2562,17 @@ fi # | * wined3d-DXTn, d3dx9_36-DXTn # | # | Modified files: -# | * dlls/d3dx9_36/Makefile.in, dlls/d3dx9_36/animation.c, dlls/d3dx9_36/d3dx9_36.spec, include/d3dx9anim.h +# | * dlls/d3dx9_36/Makefile.in, dlls/d3dx9_36/animation.c, dlls/d3dx9_36/d3dx9_36.spec, dlls/d3dx9_36/tests/mesh.c, +# | include/d3dx9anim.h # | if test "$enable_d3dx9_36_AnimationController" -eq 1; then patch_apply d3dx9_36-AnimationController/0001-d3dx9_36-Implement-D3DXCreateAnimationController-wit.patch + patch_apply d3dx9_36-AnimationController/0002-d3dx9_36-Store-all-values-passed-to-the-create-and-r.patch + patch_apply d3dx9_36-AnimationController/0003-d3dx9_36-Add-D3DXCreateAnimationController-tests.patch ( echo '+ { "Christian Costa", "d3dx9_36: Implement D3DXCreateAnimationController with a stubbed ID3DXAnimationController interface.", 1 },'; + echo '+ { "Alistair Leslie-Hughes", "d3dx9_36: Store all values passed to the create and return them in the correct functions.", 1 },'; + echo '+ { "Alistair Leslie-Hughes", "d3dx9_36: Add D3DXCreateAnimationController tests.", 1 },'; ) >> "$patchlist" fi