forked from MidTerm-CN/Il2CppDumper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cpp
47 lines (42 loc) · 1.04 KB
/
Main.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
47
#include "Main.h"
#pragma comment(lib, "d3d11.lib")
#define LOGGER_MESSAGE_BUFFER(level) \
char buffer[1024]; \
va_list args; \
va_start(args, m); \
vsprintf_s(buffer, m.c_str(), args); \
va_end(args); \
logger.Log(NaLogItemLevel_##level, buffer);
bool Il2CppResolverInit()
{
NaResolver::Config config;
config.enableLogger = true;
config.logger.debug = [](std::string m, ...)->void { };
config.logger.info = [](std::string m, ...)->void { };
config.logger.error = [](std::string m, ...)->void { };
config.logger.fatal = [](std::string m, ...)->void { LOGGER_MESSAGE_BUFFER(Fatal); };
return Il2CppResolver->Setup(config);
}
void Unload()
{
logger.LogInfo("Perfect unloaded!");
Il2CppResolver->Destroy();
free(Il2CppResolver);
FreeLibraryAndExitThread(module, 0);
}
void Run()
{
try
{
logger.LogInfo("Perfect loaded!");
if (!Il2CppResolverInit())
return;
logger.LogDebug("Il2CppResolverInit success!");
RunResolver();
logger.~NaLogger();
}
catch (const std::exception& e)
{
logger.LogFatal("Exception: %s", e.what());
}
}