16 return version >= 0x500;
22 OSVERSIONINFOA os_version;
24 os_version.dwOSVersionInfoSize =
sizeof(os_version);
25 if (!GetVersionExA(&os_version)) {
30 if (os_version.dwPlatformId == 2) {
32 if (os_version.dwMajorVersion < 4) {
36 if (os_version.dwMajorVersion != 4) {
41 HMODULE dinput_module = LoadLibraryA(
"DINPUT.DLL");
43 OutputDebugStringA(
"Couldn't LoadLibrary DInput\r\n");
48 FreeLibrary(dinput_module);
49 if (!func_DirectInputCreateA) {
50 OutputDebugStringA(
"Couldn't GetProcAddress DInputCreate\r\n");
57 if (LOWORD(os_version.dwBuildNumber) >= 0x550) {
61 HMODULE ddraw_module = LoadLibraryA(
"DDRAW.DLL");
65 FreeLibrary(ddraw_module);
70 if (!func_DirectDrawCreate) {
73 FreeLibrary(ddraw_module);
74 OutputDebugStringA(
"Couldn't LoadLibrary DDraw\r\n");
78 if (FAILED(func_DirectDrawCreate(
NULL, &ddraw,
NULL))) {
81 FreeLibrary(ddraw_module);
82 OutputDebugStringA(
"Couldn't create DDraw\r\n");
87 if (FAILED(ddraw->QueryInterface(IID_IDirectDraw2, (
LPVOID*) &ddraw2))) {
89 FreeLibrary(ddraw_module);
90 OutputDebugStringA(
"Couldn't QI DDraw2\r\n");
95 HMODULE dinput_module = LoadLibraryA(
"DINPUT.DLL");
97 OutputDebugStringA(
"Couldn't LoadLibrary DInput\r\n");
99 FreeLibrary(ddraw_module);
104 FreeLibrary(dinput_module);
105 if (!func_DirectInputCreateA) {
106 FreeLibrary(ddraw_module);
108 OutputDebugStringA(
"Couldn't GetProcAddress DInputCreate\r\n");
113 memset(&surface_desc, 0,
sizeof(surface_desc));
114 surface_desc.
dwSize =
sizeof(surface_desc);
119 FreeLibrary(ddraw_module);
121 OutputDebugStringA(
"Couldn't Set coop level\r\n");
125 if (FAILED(ddraw2->CreateSurface(&surface_desc, &surface,
NULL))) {
127 FreeLibrary(ddraw_module);
129 OutputDebugStringA(
"Couldn't CreateSurface\r\n");
133 if (FAILED(surface->QueryInterface(IID_IDirectDrawSurface3, (
LPVOID*) &surface3))) {
135 FreeLibrary(ddraw_module);
141 FreeLibrary(ddraw_module);
struct IDirectDraw2 FAR * LPDIRECTDRAW2
struct IDirectDrawSurface3 FAR * LPDIRECTDRAWSURFACE3
struct IDirectDrawSurface FAR * LPDIRECTDRAWSURFACE
#define DDCAPS2_NONLOCALVIDMEM
typedef DWORD(FAR PASCAL *LPCLIPPERCALLBACK)(LPDIRECTDRAWCLIPPER lpDDClipper
struct IDirectDraw FAR * LPDIRECTDRAW
void DetectDirectX(unsigned int *p_version, BOOL *p_found)
[AI] Detects the version of DirectX installed and indicates if it is present.
HRESULT WINAPI DirectDrawCreate_fn(GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter)
BOOL DetectDirectX5()
[AI] Checks whether DirectX 5 or a later version is present and available on the system.
HRESULT WINAPI DirectInputCreateA_fn(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter)
#define NULL
[AI] Null pointer value (C/C++ semantics).