v9: Split patch. v8: Rebased on top of master as of this patch date. --- dlls/d3drm/d3drm.c | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-)
diff --git a/dlls/d3drm/d3drm.c b/dlls/d3drm/d3drm.c index 3ea16327bf..d0f20235a8 100644 --- a/dlls/d3drm/d3drm.c +++ b/dlls/d3drm/d3drm.c @@ -638,12 +638,24 @@ static HRESULT WINAPI d3drm1_LoadTexture(IDirect3DRM *iface, struct d3drm_texture *object; HRESULT hr;
- FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture); + TRACE("iface %p, filename %s, texture %p.\n", iface, debugstr_a(filename), texture); + + if (!texture) + return D3DRMERR_BADVALUE;
if (FAILED(hr = d3drm_texture_create(&object, iface))) return hr;
*texture = &object->IDirect3DRMTexture_iface; + if (FAILED(hr = IDirect3DRMTexture_InitFromFile(*texture, filename))) + { + IDirect3DRMTexture_Release(*texture); + *texture = NULL; + if (!filename) + return D3DRMERR_BADVALUE; + + return hr == D3DRMERR_BADOBJECT ? D3DRMERR_FILENOTFOUND : hr; + }
return D3DRM_OK; } @@ -1143,15 +1155,22 @@ static HRESULT WINAPI d3drm2_LoadTexture(IDirect3DRM2 *iface, const char *filename, IDirect3DRMTexture2 **texture) { struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); - struct d3drm_texture *object; + IDirect3DRMTexture3 *texture3; HRESULT hr;
- FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture); + TRACE("iface %p, filename %s, texture %p.\n", iface, debugstr_a(filename), texture);
- if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface))) + if (!texture) + return D3DRMERR_BADVALUE; + + if (FAILED(hr = IDirect3DRM3_LoadTexture(&d3drm->IDirect3DRM3_iface, filename, &texture3))) + { + *texture = NULL; return hr; + }
- *texture = &object->IDirect3DRMTexture2_iface; + hr = IDirect3DRMTexture3_QueryInterface(texture3, &IID_IDirect3DRMTexture2, (void **)texture); + IDirect3DRMTexture3_Release(texture3);
return hr; } @@ -1818,12 +1837,21 @@ static HRESULT WINAPI d3drm3_LoadTexture(IDirect3DRM3 *iface, struct d3drm_texture *object; HRESULT hr;
- FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture); + TRACE("iface %p, filename %s, texture %p.\n", iface, debugstr_a(filename), texture); + + if (!texture) + return D3DRMERR_BADVALUE;
if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface))) return hr;
*texture = &object->IDirect3DRMTexture3_iface; + if (FAILED(hr = IDirect3DRMTexture3_InitFromFile(*texture, filename))) + { + IDirect3DRMTexture3_Release(*texture); + *texture = NULL; + return hr == D3DRMERR_BADOBJECT ? D3DRMERR_FILENOTFOUND : hr; + }
return D3DRM_OK; }