1 | /* $Id: d3d8_main.c 20508 2009-06-12 12:48:23Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * VBox D3D8 dll switcher
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2009 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #include "d3d8.h"
|
---|
24 | #include "switcher.h"
|
---|
25 |
|
---|
26 | typedef HRESULT (WINAPI *D3D8GetSWInfoProc)(void);
|
---|
27 | typedef void (WINAPI *DebugSetMuteProc)(void);
|
---|
28 | typedef IDirect3D8* (WINAPI *Direct3DCreate8Proc)(UINT SDKVersion);
|
---|
29 | typedef HRESULT (WINAPI *ValidatePixelShaderProc)(DWORD* pixelshader, DWORD* reserved1, BOOL bool, DWORD* toto);
|
---|
30 | typedef HRESULT (WINAPI *ValidateVertexShaderProc)(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL bool, DWORD* toto);
|
---|
31 |
|
---|
32 | typedef struct _D3D8ExTag
|
---|
33 | {
|
---|
34 | int initialized;
|
---|
35 | const char *vboxName;
|
---|
36 | const char *msName;
|
---|
37 | D3D8GetSWInfoProc pD3D8GetSWInfo;
|
---|
38 | DebugSetMuteProc pDebugSetMute;
|
---|
39 | Direct3DCreate8Proc pDirect3DCreate8;
|
---|
40 | ValidatePixelShaderProc pValidatePixelShader;
|
---|
41 | ValidateVertexShaderProc pValidateVertexShader;
|
---|
42 | } D3D8Export;
|
---|
43 |
|
---|
44 | static D3D8Export g_swd3d8 = {0, "VBoxD3D8.dll", "MSD3D8.dll",};
|
---|
45 |
|
---|
46 | void FillD3DExports(HANDLE hDLL)
|
---|
47 | {
|
---|
48 | SW_FILLPROC(g_swd3d8, hDLL, D3D8GetSWInfo);
|
---|
49 | SW_FILLPROC(g_swd3d8, hDLL, DebugSetMute);
|
---|
50 | SW_FILLPROC(g_swd3d8, hDLL, Direct3DCreate8);
|
---|
51 | SW_FILLPROC(g_swd3d8, hDLL, ValidatePixelShader);
|
---|
52 | SW_FILLPROC(g_swd3d8, hDLL, ValidateVertexShader);
|
---|
53 | }
|
---|
54 |
|
---|
55 | HRESULT WINAPI D3D8GetSWInfo(void)
|
---|
56 | {
|
---|
57 | SW_CHECKRET(g_swd3d8, D3D8GetSWInfo, E_FAIL);
|
---|
58 | return g_swd3d8.pD3D8GetSWInfo();
|
---|
59 | }
|
---|
60 |
|
---|
61 | void WINAPI DebugSetMute(void)
|
---|
62 | {
|
---|
63 | SW_CHECKCALL(g_swd3d8, DebugSetMute);
|
---|
64 | g_swd3d8.pDebugSetMute();
|
---|
65 | }
|
---|
66 |
|
---|
67 | IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion)
|
---|
68 | {
|
---|
69 | SW_CHECKRET(g_swd3d8, Direct3DCreate8, NULL);
|
---|
70 | return g_swd3d8.pDirect3DCreate8(SDKVersion);
|
---|
71 | }
|
---|
72 |
|
---|
73 | HRESULT WINAPI ValidatePixelShader(DWORD* pixelshader, DWORD* reserved1, BOOL bool, DWORD* toto)
|
---|
74 | {
|
---|
75 | SW_CHECKRET(g_swd3d8, ValidatePixelShader, E_FAIL);
|
---|
76 | return g_swd3d8.pValidatePixelShader(pixelshader, reserved1, bool, toto);
|
---|
77 | }
|
---|
78 |
|
---|
79 | HRESULT WINAPI ValidateVertexShader(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL bool, DWORD* toto)
|
---|
80 | {
|
---|
81 | SW_CHECKRET(g_swd3d8, ValidateVertexShader, E_FAIL)
|
---|
82 | return g_swd3d8.pValidateVertexShader(vertexshader, reserved1, reserved2, bool, toto);
|
---|
83 | }
|
---|