1 | /* $Id: d3d8_main.c 28800 2010-04-27 08:22:32Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * VBox D3D8 dll switcher
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2009 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #include "d3d8.h"
|
---|
20 | #include "switcher.h"
|
---|
21 |
|
---|
22 | typedef HRESULT (WINAPI *D3D8GetSWInfoProc)(void);
|
---|
23 | typedef void (WINAPI *DebugSetMuteProc)(void);
|
---|
24 | typedef IDirect3D8* (WINAPI *Direct3DCreate8Proc)(UINT SDKVersion);
|
---|
25 | typedef HRESULT (WINAPI *ValidatePixelShaderProc)(DWORD* pixelshader, DWORD* reserved1, BOOL bool, DWORD* toto);
|
---|
26 | typedef HRESULT (WINAPI *ValidateVertexShaderProc)(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL bool, DWORD* toto);
|
---|
27 |
|
---|
28 | typedef struct _D3D8ExTag
|
---|
29 | {
|
---|
30 | int initialized;
|
---|
31 | const char *vboxName;
|
---|
32 | const char *msName;
|
---|
33 | D3D8GetSWInfoProc pD3D8GetSWInfo;
|
---|
34 | DebugSetMuteProc pDebugSetMute;
|
---|
35 | Direct3DCreate8Proc pDirect3DCreate8;
|
---|
36 | ValidatePixelShaderProc pValidatePixelShader;
|
---|
37 | ValidateVertexShaderProc pValidateVertexShader;
|
---|
38 | } D3D8Export;
|
---|
39 |
|
---|
40 | static D3D8Export g_swd3d8 = {0, "VBoxD3D8.dll", "MSD3D8.dll",};
|
---|
41 |
|
---|
42 | void FillD3DExports(HANDLE hDLL)
|
---|
43 | {
|
---|
44 | SW_FILLPROC(g_swd3d8, hDLL, D3D8GetSWInfo);
|
---|
45 | SW_FILLPROC(g_swd3d8, hDLL, DebugSetMute);
|
---|
46 | SW_FILLPROC(g_swd3d8, hDLL, Direct3DCreate8);
|
---|
47 | SW_FILLPROC(g_swd3d8, hDLL, ValidatePixelShader);
|
---|
48 | SW_FILLPROC(g_swd3d8, hDLL, ValidateVertexShader);
|
---|
49 | }
|
---|
50 |
|
---|
51 | HRESULT WINAPI D3D8GetSWInfo(void)
|
---|
52 | {
|
---|
53 | SW_CHECKRET(g_swd3d8, D3D8GetSWInfo, E_FAIL);
|
---|
54 | return g_swd3d8.pD3D8GetSWInfo();
|
---|
55 | }
|
---|
56 |
|
---|
57 | void WINAPI DebugSetMute(void)
|
---|
58 | {
|
---|
59 | SW_CHECKCALL(g_swd3d8, DebugSetMute);
|
---|
60 | g_swd3d8.pDebugSetMute();
|
---|
61 | }
|
---|
62 |
|
---|
63 | IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion)
|
---|
64 | {
|
---|
65 | SW_CHECKRET(g_swd3d8, Direct3DCreate8, NULL);
|
---|
66 | return g_swd3d8.pDirect3DCreate8(SDKVersion);
|
---|
67 | }
|
---|
68 |
|
---|
69 | HRESULT WINAPI ValidatePixelShader(DWORD* pixelshader, DWORD* reserved1, BOOL bool, DWORD* toto)
|
---|
70 | {
|
---|
71 | SW_CHECKRET(g_swd3d8, ValidatePixelShader, E_FAIL);
|
---|
72 | return g_swd3d8.pValidatePixelShader(pixelshader, reserved1, bool, toto);
|
---|
73 | }
|
---|
74 |
|
---|
75 | HRESULT WINAPI ValidateVertexShader(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL bool, DWORD* toto)
|
---|
76 | {
|
---|
77 | SW_CHECKRET(g_swd3d8, ValidateVertexShader, E_FAIL)
|
---|
78 | return g_swd3d8.pValidateVertexShader(vertexshader, reserved1, reserved2, bool, toto);
|
---|
79 | }
|
---|