From 1ca1b3b602e5b59abb6b60d6755bf1b62b355814 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 2 Aug 2023 08:25:36 +1000 Subject: [PATCH] Updated d3dx11_43-D3DX11CreateTextureFromMemory patchset --- ...GetImageInfoFromMemory-Only-use-fram.patch | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 patches/d3dx11_43-D3DX11CreateTextureFromMemory/0003-d3dx11_43-D3DX11GetImageInfoFromMemory-Only-use-fram.patch diff --git a/patches/d3dx11_43-D3DX11CreateTextureFromMemory/0003-d3dx11_43-D3DX11GetImageInfoFromMemory-Only-use-fram.patch b/patches/d3dx11_43-D3DX11CreateTextureFromMemory/0003-d3dx11_43-D3DX11GetImageInfoFromMemory-Only-use-fram.patch new file mode 100644 index 00000000..2ef57607 --- /dev/null +++ b/patches/d3dx11_43-D3DX11CreateTextureFromMemory/0003-d3dx11_43-D3DX11GetImageInfoFromMemory-Only-use-fram.patch @@ -0,0 +1,56 @@ +From 30d677139afe2af3f72c68ba11f1bbaead6f1c11 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Wed, 2 Aug 2023 08:24:11 +1000 +Subject: [PATCH] d3dx11_43: D3DX11GetImageInfoFromMemory - Only use frame for + non DDS images + +--- + dlls/d3dx11_43/texture.c | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) + +diff --git a/dlls/d3dx11_43/texture.c b/dlls/d3dx11_43/texture.c +index 10dedf30c0f..f3f7d350131 100644 +--- a/dlls/d3dx11_43/texture.c ++++ b/dlls/d3dx11_43/texture.c +@@ -295,6 +295,7 @@ static const GUID *dxgi_format_to_wic_guid(DXGI_FORMAT format) + HRESULT WINAPI D3DX11GetImageInfoFromMemory(const void *src_data, SIZE_T src_data_size, ID3DX11ThreadPump *pump, + D3DX11_IMAGE_INFO *img_info, HRESULT *hresult) + { ++ IWICBitmapFrameDecode *frame = NULL; + IWICImagingFactory *factory = NULL; + IWICDdsDecoder *dds_decoder = NULL; + IWICBitmapDecoder *decoder = NULL; +@@ -358,9 +359,18 @@ HRESULT WINAPI D3DX11GetImageInfoFromMemory(const void *src_data, SIZE_T src_dat + } + else + { +- FIXME("Unsupported image format %d\n", img_info->ImageFileFormat); +- img_info->Width = 1; +- img_info->Height = 1; ++ unsigned int frame_count; ++ ++ hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count); ++ if (FAILED(hr) || !frame_count) ++ goto end; ++ hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); ++ if (FAILED(hr)) ++ goto end; ++ hr = IWICBitmapFrameDecode_GetSize(frame, &img_info->Width, &img_info->Height); ++ if (FAILED(hr)) ++ goto end; ++ + img_info->ArraySize = 1; + img_info->Depth = 1; + img_info->MipLevels = 1; +@@ -372,6 +382,8 @@ HRESULT WINAPI D3DX11GetImageInfoFromMemory(const void *src_data, SIZE_T src_dat + end: + if (dds_decoder) + IWICDdsDecoder_Release(dds_decoder); ++ if (frame) ++ IWICBitmapFrameDecode_Release(frame); + if (decoder) + IWICBitmapDecoder_Release(decoder); + if (stream) +-- +2.40.1 +