d3dx8_main.c 3.42 KB
Newer Older
Raphael Junqueira's avatar
Raphael Junqueira committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 * Direct3D X 8 main file
 *
 * Copyright (C) 2002 Raphael Junqueira
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Raphael Junqueira's avatar
Raphael Junqueira committed
19 20 21 22 23 24
 *
 */

#include "config.h"
#include "wine/port.h"

25 26
#include <stdarg.h>

Raphael Junqueira's avatar
Raphael Junqueira committed
27 28 29 30 31
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h"
32
#include "wine/unicode.h"
33
#include "d3dx8_private.h"
Raphael Junqueira's avatar
Raphael Junqueira committed
34 35 36

WINE_DEFAULT_DEBUG_CHANNEL(d3d);

37
HRESULT WINAPI D3DXCreateBuffer(DWORD NumBytes, LPD3DXBUFFER* ppBuffer) {
Raphael Junqueira's avatar
Raphael Junqueira committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
  ID3DXBufferImpl *object;

  object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ID3DXBufferImpl));
  if (NULL == object) {
    *ppBuffer = (LPD3DXBUFFER)NULL;
    return E_OUTOFMEMORY;
  }
  object->lpVtbl = &D3DXBuffer_Vtbl;
  object->ref = 1;
  object->bufferSize = NumBytes;
  object->buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, NumBytes);
  if (NULL == object->buffer) {
    HeapFree(GetProcessHeap(), 0, object);
    *ppBuffer = (LPD3DXBUFFER)NULL;
    return E_OUTOFMEMORY;
  }
  *ppBuffer = (LPD3DXBUFFER)object;
  return D3D_OK;
}

58
HRESULT WINAPI D3DXCreateFont(LPDIRECT3DDEVICE8 pDevice, HFONT hFont, LPD3DXFONT* ppFont) {
Raphael Junqueira's avatar
Raphael Junqueira committed
59 60 61 62
  FIXME("(void): stub\n");
  return D3D_OK;
}

63
UINT WINAPI D3DXGetFVFVertexSize(DWORD FVF) {
Raphael Junqueira's avatar
Raphael Junqueira committed
64 65 66 67
  FIXME("(void): stub\n");
  return 0;
}

68
HRESULT WINAPI D3DXAssembleShader(LPCVOID pSrcData, UINT SrcDataLen, DWORD Flags, 
Raphael Junqueira's avatar
Raphael Junqueira committed
69 70 71 72 73 74 75
			   LPD3DXBUFFER* ppConstants, 
			   LPD3DXBUFFER* ppCompiledShader,
			   LPD3DXBUFFER* ppCompilationErrors) {
  FIXME("(void): stub\n");
  return D3D_OK;
}

76
HRESULT WINAPI D3DXAssembleShaderFromFileA(LPCSTR pSrcFile, DWORD Flags,
Raphael Junqueira's avatar
Raphael Junqueira committed
77 78 79
				    LPD3DXBUFFER* ppConstants,
				    LPD3DXBUFFER* ppCompiledShader,
				    LPD3DXBUFFER* ppCompilationErrors) {
80 81 82 83 84 85 86 87 88 89 90 91
  LPWSTR pSrcFileW = NULL;
  DWORD len;
  HRESULT ret;

  if (!pSrcFile) return D3DXERR_INVALIDDATA;

  len = MultiByteToWideChar( CP_ACP, 0, pSrcFile, -1, NULL, 0 );
  pSrcFileW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
  MultiByteToWideChar( CP_ACP, 0, pSrcFile, -1, pSrcFileW, len );
  ret=D3DXAssembleShaderFromFileW(pSrcFileW, Flags, ppConstants, ppCompiledShader, ppCompilationErrors);
  HeapFree( GetProcessHeap(), 0, pSrcFileW );
  return ret;
Raphael Junqueira's avatar
Raphael Junqueira committed
92 93
}

94
HRESULT WINAPI D3DXAssembleShaderFromFileW(LPCWSTR pSrcFile, DWORD Flags,
Raphael Junqueira's avatar
Raphael Junqueira committed
95 96 97 98 99 100
				    LPD3DXBUFFER* ppConstants,
				    LPD3DXBUFFER* ppCompiledShader,
				    LPD3DXBUFFER* ppCompilationErrors) {
  FIXME("(void): stub\n");
  return D3D_OK;
}
Louis Lenders's avatar
Louis Lenders committed
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118

/***********************************************************************
 * DllMain.
 */
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
{
    switch(reason)
    {
    case DLL_WINE_PREATTACH:
        return FALSE; /* prefer native version */
    case DLL_PROCESS_ATTACH:
        DisableThreadLibraryCalls(inst);
        break;
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}