-
Notifications
You must be signed in to change notification settings - Fork 8
/
steam_api.nim
43 lines (37 loc) · 1.07 KB
/
steam_api.nim
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
{.deadCodeElim: on.}
from genmacros.wine import trace
from genmacros.cdecls import generateLinuxDecls, generateWineDecls
from genmacros.utils import parseFullSpec
const specname {.strdefine.} = "steam_api.auto.spec"
{.passL: "'" & specname & "'".}
#{.link: "callbacks.o".}
#{.compile: "callbacks.cpp".}
#{.compile: "steam_api.cpp".}
#{.link: "steam_api.o".}
#{.passL: "-lstdc++".}
#{.passC: "-I.".}
#{.passC: "-g".}
#{.passC: "-Iautoclass".}
#{.passC: "-Isteam".}
#{.passC: "-fpermissive".}
#{.passC: "-DVERSION_SAFE_STEAM_API_INTERFACES".}
#{.passC: "-DUSE_BREAKPAD_HANDLER".}
const spec = parseFullSpec(specname)
generateLinuxDecls(spec)
generateWineDecls(spec)
{.emit:["""
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
{
""", trace, """("(%p, %u, %p)\n", instance, reason, reserved);
switch (reason)
{
case DLL_WINE_PREATTACH:
return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(instance);
NimMain();
break;
}
return TRUE;
}
"""].}