-
Notifications
You must be signed in to change notification settings - Fork 0
/
orcf_test.c
48 lines (37 loc) · 1.08 KB
/
orcf_test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-License-Identifier: MIT
#define WIN32_LEAN_AND_MEAN
#define UNICODE
#define _UNICODE
#define INITGUID
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
#define NTDDI_VERSION 0x05010000
#define DIRECTDRAW_VERSION 0x700
#include <windows.h>
#include <ddraw.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
IDirectDraw7* api;
if (FAILED(DirectDrawCreateEx(NULL, (void**) &api, &IID_IDirectDraw7, NULL)))
{
puts("Failed to create DirectDraw");
exit(EXIT_FAILURE);
}
DDSCAPS2 surface_caps = { .dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM };
DWORD total_memory, free_memory;
if (FAILED(IDirectDraw7_GetAvailableVidMem(api, &surface_caps, &total_memory, &free_memory)))
{
IDirectDraw7_Release(api);
puts("Failed to retrieve available video memory");
exit(EXIT_FAILURE);
}
IDirectDraw7_Release(api);
if (total_memory != 0x7fffffff)
{
puts("Available video memory does not match what ORCF returns");
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}