1 | /* $Id: d3d8_main.c 40587 2012-03-23 09:08:44Z 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 | static HRESULT WINAPI vboxD3D8GetSWInfoStub(void)
|
---|
29 | {
|
---|
30 | return E_FAIL;
|
---|
31 | }
|
---|
32 |
|
---|
33 | static void WINAPI vboxDebugSetMuteStub(void)
|
---|
34 | {
|
---|
35 |
|
---|
36 | }
|
---|
37 |
|
---|
38 | static IDirect3D8* WINAPI vboxDirect3DCreate8Stub(UINT SDKVersion)
|
---|
39 | {
|
---|
40 | return NULL;
|
---|
41 | }
|
---|
42 |
|
---|
43 | static HRESULT WINAPI vboxValidatePixelShaderStub(DWORD* pixelshader, DWORD* reserved1, BOOL bool, DWORD* toto)
|
---|
44 | {
|
---|
45 | return E_FAIL;
|
---|
46 | }
|
---|
47 |
|
---|
48 | static HRESULT WINAPI vboxValidateVertexShaderStub(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL bool, DWORD* toto)
|
---|
49 | {
|
---|
50 | return E_FAIL;
|
---|
51 | }
|
---|
52 |
|
---|
53 | typedef struct _D3D8ExTag
|
---|
54 | {
|
---|
55 | int initialized;
|
---|
56 | const char *vboxName;
|
---|
57 | const char *msName;
|
---|
58 | D3D8GetSWInfoProc pD3D8GetSWInfo;
|
---|
59 | DebugSetMuteProc pDebugSetMute;
|
---|
60 | Direct3DCreate8Proc pDirect3DCreate8;
|
---|
61 | ValidatePixelShaderProc pValidatePixelShader;
|
---|
62 | ValidateVertexShaderProc pValidateVertexShader;
|
---|
63 | } D3D8Export;
|
---|
64 |
|
---|
65 | static D3D8Export g_swd3d8 = {0, "VBoxD3D8.dll", "MSD3D8.dll",};
|
---|
66 |
|
---|
67 | void FillD3DExports(HANDLE hDLL)
|
---|
68 | {
|
---|
69 | SW_FILLPROC(g_swd3d8, hDLL, D3D8GetSWInfo);
|
---|
70 | SW_FILLPROC(g_swd3d8, hDLL, DebugSetMute);
|
---|
71 | SW_FILLPROC(g_swd3d8, hDLL, Direct3DCreate8);
|
---|
72 | SW_FILLPROC(g_swd3d8, hDLL, ValidatePixelShader);
|
---|
73 | SW_FILLPROC(g_swd3d8, hDLL, ValidateVertexShader);
|
---|
74 | }
|
---|
75 |
|
---|
76 | HRESULT WINAPI D3D8GetSWInfo(void)
|
---|
77 | {
|
---|
78 | SW_CHECKRET(g_swd3d8, D3D8GetSWInfo, E_FAIL);
|
---|
79 | return g_swd3d8.pD3D8GetSWInfo();
|
---|
80 | }
|
---|
81 |
|
---|
82 | void WINAPI DebugSetMute(void)
|
---|
83 | {
|
---|
84 | SW_CHECKCALL(g_swd3d8, DebugSetMute);
|
---|
85 | g_swd3d8.pDebugSetMute();
|
---|
86 | }
|
---|
87 |
|
---|
88 | IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion)
|
---|
89 | {
|
---|
90 | SW_CHECKRET(g_swd3d8, Direct3DCreate8, NULL);
|
---|
91 | return g_swd3d8.pDirect3DCreate8(SDKVersion);
|
---|
92 | }
|
---|
93 |
|
---|
94 | HRESULT WINAPI ValidatePixelShader(DWORD* pixelshader, DWORD* reserved1, BOOL bool, DWORD* toto)
|
---|
95 | {
|
---|
96 | SW_CHECKRET(g_swd3d8, ValidatePixelShader, E_FAIL);
|
---|
97 | return g_swd3d8.pValidatePixelShader(pixelshader, reserved1, bool, toto);
|
---|
98 | }
|
---|
99 |
|
---|
100 | HRESULT WINAPI ValidateVertexShader(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL bool, DWORD* toto)
|
---|
101 | {
|
---|
102 | SW_CHECKRET(g_swd3d8, ValidateVertexShader, E_FAIL)
|
---|
103 | return g_swd3d8.pValidateVertexShader(vertexshader, reserved1, reserved2, bool, toto);
|
---|
104 | }
|
---|