-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNMF.cpp
46 lines (35 loc) · 1.01 KB
/
NMF.cpp
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
#include "NMF.h"
#include "lib/detours/include/detours.h"
#define HANDLE_MODULE_WNDPROC(WNDPROC_FUNC) \
result = WNDPROC_FUNC(hWnd, uMsg, wParam, lParam); \
if (result != WndProcHandleResult::Continue) \
return result;
namespace NMF
{
WndProcHandleResult NMFWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
WndProcHandleResult result = WndProcHandleResult::Continue;
#ifdef NMF_USE_IMGUI
HANDLE_MODULE_WNDPROC(ImGuiManager::WndProc);
#endif
#ifdef NMF_USE_MODDING
HANDLE_MODULE_WNDPROC(ModManagerBase::Instance->WndProc);
#endif
return result;
}
void NMFRestoreImportTable()
{
DetourRestoreAfterWith();
}
void NMFExit(NMFExitCode exitCode)
{
#ifdef NMF_USE_LOGGING
LogManager::Log(LogSeverity::Error, "Requested NMF exit with code: %d! Exiting...", exitCode);
#endif
exit(static_cast<int>(exitCode));
}
}
extern "C" __declspec(dllexport) void NMF_dummy_detours_export()
{
}
#undef HANDLE_MODULE_WNDPROC