d3d8_main.c revision 7be8d76da2c10d927dc85d0076a40cda027f15e6
/* $Id$ */
/** @file
* VBox D3D8 dll switcher
*/
/*
* Copyright (C) 2009 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#include "d3d8.h"
#include "switcher.h"
typedef HRESULT (WINAPI *D3D8GetSWInfoProc)(void);
typedef void (WINAPI *DebugSetMuteProc)(void);
typedef IDirect3D8* (WINAPI *Direct3DCreate8Proc)(UINT SDKVersion);
typedef HRESULT (WINAPI *ValidatePixelShaderProc)(DWORD* pixelshader, DWORD* reserved1, BOOL bool, DWORD* toto);
typedef HRESULT (WINAPI *ValidateVertexShaderProc)(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL bool, DWORD* toto);
typedef struct _D3D8ExTag
{
int initialized;
const char *vboxName;
const char *msName;
D3D8GetSWInfoProc pD3D8GetSWInfo;
DebugSetMuteProc pDebugSetMute;
Direct3DCreate8Proc pDirect3DCreate8;
ValidatePixelShaderProc pValidatePixelShader;
ValidateVertexShaderProc pValidateVertexShader;
} D3D8Export;
static D3D8Export g_swd3d8 = {0, "VBoxD3D8.dll", "MSD3D8.dll",};
void FillD3DExports(HANDLE hDLL)
{
SW_FILLPROC(g_swd3d8, hDLL, D3D8GetSWInfo);
SW_FILLPROC(g_swd3d8, hDLL, DebugSetMute);
SW_FILLPROC(g_swd3d8, hDLL, Direct3DCreate8);
SW_FILLPROC(g_swd3d8, hDLL, ValidatePixelShader);
SW_FILLPROC(g_swd3d8, hDLL, ValidateVertexShader);
}
HRESULT WINAPI D3D8GetSWInfo(void)
{
SW_CHECKRET(g_swd3d8, D3D8GetSWInfo, E_FAIL);
return g_swd3d8.pD3D8GetSWInfo();
}
void WINAPI DebugSetMute(void)
{
SW_CHECKCALL(g_swd3d8, DebugSetMute);
g_swd3d8.pDebugSetMute();
}
IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion)
{
SW_CHECKRET(g_swd3d8, Direct3DCreate8, NULL);
return g_swd3d8.pDirect3DCreate8(SDKVersion);
}
HRESULT WINAPI ValidatePixelShader(DWORD* pixelshader, DWORD* reserved1, BOOL bool, DWORD* toto)
{
SW_CHECKRET(g_swd3d8, ValidatePixelShader, E_FAIL);
return g_swd3d8.pValidatePixelShader(pixelshader, reserved1, bool, toto);
}
HRESULT WINAPI ValidateVertexShader(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL bool, DWORD* toto)
{
SW_CHECKRET(g_swd3d8, ValidateVertexShader, E_FAIL)
return g_swd3d8.pValidateVertexShader(vertexshader, reserved1, reserved2, bool, toto);
}