// 2. Pull the latest level from the API (cached for 30 s) static std::wstring levelStr; static std::chrono::steady_clock::time_point lastRefresh = std::chrono::steady_clock::now() - std::chrono::seconds(31); if (std::chrono::steady_clock::now() - lastRefresh > std::chrono::seconds(30)) auto profile = cf::GetPlayerProfile(); // <-- HTTPS GET /v1/profile levelStr = L"Level: " + std::to_wstring(profile.level); lastRefresh = std::chrono::steady_clock::now();
Again, this —the DLL merely registers a DirectX draw call that renders text on top of the game window. 5.6 The Overlay Hook (simplified) // hooks/overlay_hook.cpp #include <xhook/hook.h> #include <d3d11.h> #include <string> #include "api/cf_api.h" crossfire account github xhook
3️⃣ XHook loads into the official Crossfire client (optional, for UI extensions only) augmentation) → reads token from a safe (memory‑protected) store → queries API Create a build folder mkdir build && cd build cmake
#include "xhook/hook.h" int main()
// Call the original Present function return xhook::CallOriginal<PresentHook>(pSwapChain, SyncInterval, Flags); if (std::chrono::steady_clock::now() - lastRefresh >
# 2. Create a build folder mkdir build && cd build cmake .. -G "Visual Studio 17 2022" -A x64 cmake --build . --config Release The output is Release/overlay.dll . # .github/workflows/build.yml name: Build Overlay on: push: branches: [ main ] jobs: build: runs-on: windows-latest steps: - uses: actions/checkout@v3 - name: Set up MSVC uses: ilammy/msvc-dev-cmd@v1 - name: Configure CMake run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release - name: Build run: cmake --build build --config Release - name: Sign DLL (optional) env: CODE_SIGN_CERT: $ secrets.CODE_SIGN_CERT CODE_SIGN_PASSWORD: $ secrets.CODE_SIGN_PASSWORD run: | # Example using signtool signtool sign /f "$env:CODE_SIGN_CERT" /p "$env:CODE_SIGN_PASSWORD" /tr http://timestamp.digicert.com /td sha256 /fd sha256 build\Release\overlay.dll - name: Upload artifact uses: actions/upload-artifact@v3 with: name: overlay path: build/Release/overlay.dll The secrets ( CODE_SIGN_CERT , …) are never visible to the runner’s logs. 5.5 Runtime – Loading the Hook A lightweight loader (e.g., loader.exe ) can be used by the player: