-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdllmain.cpp
More file actions
45 lines (40 loc) · 1.07 KB
/
dllmain.cpp
File metadata and controls
45 lines (40 loc) · 1.07 KB
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
// dllmain.cpp : Defines the entry point for the DLL application.
#include "pch.h"
#include "MyModule/MyModule.h"
static DWORD WINAPI MainThread(LPVOID lpReserved)
{
// Wait for Twinkie to initialize
while (!GetImGuiContext())
{
Sleep(1);
}
ImGui::SetCurrentContext(GetImGuiContext());
MyModule* NewModule = new MyModule(*GetTrackmaniaMgr(), *GetLogger(), GetUiRenderEnabled());
AddModule(NewModule);
return TRUE;
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
DisableThreadLibraryCalls(hModule);
CreateThread(nullptr, 0, MainThread, hModule, 0, nullptr);
break;
}
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
// Only use this when you are targeting your DLL for ModLoader release
extern "C" __declspec(dllexport) void ThisFunctionDoesNothing()
{
return;
}