Return all elements when getDeclaration is called with pnumelements

set to 0.
This commit is contained in:
Oliver Stieber 2005-07-28 10:15:35 +00:00 committed by Alexandre Julliard
parent 171fea006d
commit 83f8704ba3
1 changed files with 47 additions and 25 deletions

View File

@ -439,7 +439,18 @@ static HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetDeclaration8(IWineD3DVert
*pSizeOfData = This->declaration8Length;
return D3D_OK;
}
/* The increadables and teenage mutant ninja turtles require this in d3d9 for NumElements == 0,
TODO: this needs to be tested against windows */
if(*pSizeOfData == 0) {
TRACE("(%p) : Requested the vertex declaration without specefying the size of the return buffer\n", This);
*pSizeOfData = This->declaration8Length;
memcpy(pData, This->pDeclaration8, This->declaration8Length);
return D3D_OK;
}
if (*pSizeOfData < This->declaration8Length) {
FIXME("(%p) : Returning D3DERR_MOREDATA numElements %ld expected %ld\n", iface, *pSizeOfData, This->declaration8Length);
*pSizeOfData = This->declaration8Length;
return D3DERR_MOREDATA;
}
@ -455,10 +466,21 @@ HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetDeclaration9(IWineD3DVertexDecla
TRACE("(%p) : Returning numElements %ld\n", iface, *pNumElements);
return D3D_OK;
}
if (*pNumElements < This->declaration9NumElements) {
/* The increadables and teenage mutant ninja turtles require this for NumElements == 0,
TODO: this needs to be tested against windows */
if(*pNumElements == 0) {
TRACE("(%p) : Requested the vertex declaration without specefying the size of the return buffer\n", This);
*pNumElements = This->declaration9NumElements;
memcpy(pData, This->pDeclaration9, *pNumElements * sizeof(*pData));
return D3D_OK;
}
/* just incase there's a simila problem to The increadables and teenage mutant ninja without pNumElements = 0 */
if (*pNumElements < This->declaration9NumElements) {
*pNumElements = This->declaration9NumElements;
FIXME("(%p) : Returning D3DERR_MOREDATA numElements %ld expected %u\n", iface, *pNumElements, This->declaration9NumElements);
memcpy(pData, This->pDeclaration9, *pNumElements * sizeof(*pData));
return D3DERR_MOREDATA;
}
TRACE("(%p) : GetVertexDeclaration9 copying to %p\n", This, pData);