d3dx9: Implement D3DXCreateEffectCompilerFromFile/Resource.

This commit is contained in:
Owen Rudge 2010-05-17 10:50:29 -05:00 committed by Alexandre Julliard
parent 943eefc8fc
commit b3523a447c
2 changed files with 101 additions and 4 deletions

View File

@ -48,10 +48,10 @@
@ stub D3DXCreateCylinder
@ stdcall D3DXCreateEffect(ptr ptr long ptr ptr long ptr ptr ptr)
@ stdcall D3DXCreateEffectCompiler(ptr long ptr ptr long ptr ptr)
@ stub D3DXCreateEffectCompilerFromFileA
@ stub D3DXCreateEffectCompilerFromFileW
@ stub D3DXCreateEffectCompilerFromResourceA
@ stub D3DXCreateEffectCompilerFromResourceW
@ stdcall D3DXCreateEffectCompilerFromFileA(str ptr ptr long ptr ptr)
@ stdcall D3DXCreateEffectCompilerFromFileW(wstr ptr ptr long ptr ptr)
@ stdcall D3DXCreateEffectCompilerFromResourceA(long str ptr ptr long ptr ptr)
@ stdcall D3DXCreateEffectCompilerFromResourceW(long wstr ptr ptr long ptr ptr)
@ stdcall D3DXCreateEffectEx(ptr ptr long ptr ptr ptr long ptr ptr ptr)
@ stub D3DXCreateEffectFromFileA
@ stub D3DXCreateEffectFromFileExA

View File

@ -998,3 +998,100 @@ HRESULT WINAPI D3DXCreateEffectPool(LPD3DXEFFECTPOOL* pool)
return S_OK;
}
HRESULT WINAPI D3DXCreateEffectCompilerFromFileW(LPCWSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
{
LPVOID buffer;
HRESULT ret;
DWORD size;
TRACE("(%s): relay\n", debugstr_w(srcfile));
if (!srcfile || !defines)
return D3DERR_INVALIDCALL;
ret = map_view_of_file(srcfile, &buffer, &size);
if (FAILED(ret))
return D3DXERR_INVALIDDATA;
ret = D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
UnmapViewOfFile(buffer);
return ret;
}
HRESULT WINAPI D3DXCreateEffectCompilerFromFileA(LPCSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
{
LPWSTR srcfileW;
HRESULT ret;
DWORD len;
TRACE("(void): relay\n");
if (!srcfile || !defines)
return D3DERR_INVALIDCALL;
len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
srcfileW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
ret = D3DXCreateEffectCompilerFromFileW(srcfileW, defines, include, flags, effectcompiler, parseerrors);
HeapFree(GetProcessHeap(), 0, srcfileW);
return ret;
}
HRESULT WINAPI D3DXCreateEffectCompilerFromResourceA(HMODULE srcmodule, LPCSTR srcresource, const D3DXMACRO *defines,
LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
{
HRSRC resinfo;
TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
if (resinfo)
{
LPVOID buffer;
HRESULT ret;
DWORD size;
ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
if (FAILED(ret))
return D3DXERR_INVALIDDATA;
return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
}
return D3DXERR_INVALIDDATA;
}
HRESULT WINAPI D3DXCreateEffectCompilerFromResourceW(HMODULE srcmodule, LPCWSTR srcresource, const D3DXMACRO *defines,
LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
{
HRSRC resinfo;
TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
if (resinfo)
{
LPVOID buffer;
HRESULT ret;
DWORD size;
ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
if (FAILED(ret))
return D3DXERR_INVALIDDATA;
return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
}
return D3DXERR_INVALIDDATA;
}