CFramework/CFramework/main.cpp

100 lines
2.8 KiB
C++

#include "Cheat/Framework.h"
#include "Framework/Overlay/Overlay.h"
#include "Framework/Input/Input.h"
#pragma comment(lib, "freetype.lib")
/*
- Neko64V
SPT-AKI Simple External - WIP (for UC release)
ToDo:
1. Optimize cheat logic/code
2. Fix Item ESP
slava Ukraine!
*/
auto cheat = std::make_unique<CFramework>();
void Overlay::OverlayUserFunction()
{
cheat->RenderInfo();
if (g.g_ESP)
cheat->RenderESP();
// 自瞄/压枪 (Aim.cpp)
cheat->AimAll();
if (g.ShowMenu)
cheat->RenderMenu();
}
// DEBUG時にはコンソールウィンドウを表示する
#if _DEBUG
int main()
#else
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
#endif
{
auto overlay = std::make_unique<Overlay>();
// Fix DPI Scale
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE);
// ウィンドウをベースにして初期化を行う
if (!m.AttachProcess("EscapeFromTarkov", InitMode::WINDOW_TITLE)) // 詳細は Memory/Memory.h を参照
return 1;
// Overlay
if (!overlay->InitOverlay("EscapeFromTarkov", InitMode::WINDOW_TITLE)) // MemoryInitModeと同様
return 2;
// 低级输入钩子 (GetAsyncKeyState 检测不到鼠标键的环境用)
InstallInputHook();
// ImGui io setting
ImGuiIO& io = ImGui::GetIO(); (void)io;
io.IniFilename = nullptr;
io.LogFilename = nullptr;
// Load Font
io.Fonts->AddFontFromMemoryCompressedTTF(RobotoRegular_compressed_data, RobotoRegular_compressed_size, 13.f, nullptr);
// 中文字体 fallback (微软雅黑, 全量 CJK 字库, 菜单中文化用)
if (GetFileAttributesA("C:\\Windows\\Fonts\\msyh.ttc") != INVALID_FILE_ATTRIBUTES)
{
ImFontConfig cjk_config;
cjk_config.MergeMode = true;
io.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\msyh.ttc", 13.f, &cjk_config, io.Fonts->GetGlyphRangesChineseFull());
}
// Load Icon
static const ImWchar icons_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
ImFontConfig icons_config;
icons_config.MergeMode = true;
icons_config.GlyphOffset.y = 2.f;
cheat->icon = io.Fonts->AddFontFromMemoryCompressedTTF(FA_compressed_data, FA_compressed_size, 16.f, &icons_config, icons_ranges);
// 图标字体也挂中文 (菜单按钮是 icon 字体渲染)
if (GetFileAttributesA("C:\\Windows\\Fonts\\msyh.ttc") != INVALID_FILE_ATTRIBUTES)
{
ImFontConfig cjk_icon_config;
cjk_icon_config.MergeMode = true;
cjk_icon_config.GlyphOffset.y = 2.f;
io.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\msyh.ttc", 16.f, &cjk_icon_config, io.Fonts->GetGlyphRangesChineseFull());
}
io.Fonts->Build();
// スレッドを作成
std::thread([&]() { cheat->UpdateList(); }).detach();
std::thread([&]() { cheat->UpdateStaticList(); }).detach();
overlay->OverlayLoop();
overlay->DestroyOverlay();
RemoveInputHook();
m.DetachProcess();
g.process_active = false;
return 0;
}