| 2744 | { |
| 2745 | static bool IsInitialized = false; |
| 2746 | bool ColdClientInitializzation() |
| 2747 | { |
| 2748 | if (!IsInitialized) |
| 2749 | { |
| 2750 | // Init Interfaces. |
| 2751 | ColdAPI_General::InitInterfaces(); |
| 2752 | |
| 2753 | // Configuration attempt. |
| 2754 | ColdAPI_General::ReadIni(); |
| 2755 | |
| 2756 | if (Steam_Config::AppId == NULL) |
| 2757 | { |
| 2758 | char SteamAPPID[MAX_PATH] = { 0 }; |
| 2759 | std::strcpy(SteamAPPID, Steamapipath); |
| 2760 | std::strcat(SteamAPPID, STEAMAPPID); |
| 2761 | |
| 2762 | // Read from steam_appid.txt file if the APPID wasn't provided from the INI. |
| 2763 | std::FILE* hSteamAPPID = std::fopen(SteamAPPID, "r"); |
| 2764 | if (hSteamAPPID) |
| 2765 | { |
| 2766 | std::fscanf(hSteamAPPID, "%u", &Steam_Config::AppId); |
| 2767 | std::fclose(hSteamAPPID); |
| 2768 | } |
| 2769 | } |
| 2770 | if (Steam_Config::AppId == NULL) |
| 2771 | { |
| 2772 | MessageBoxA(NULL, "Please set an AppID and try again.", "ColdAPI", MB_ICONERROR); |
| 2773 | ExitProcess(NULL); |
| 2774 | } |
| 2775 | |
| 2776 | // Check if we're not emulating steamclient as Registry is mainly used to get the steamclient directory to load it and for process checks. |
| 2777 | if (!Steam_Config::ClientEmulation) |
| 2778 | { |
| 2779 | SetEnvironmentVariableA("SteamAppId", ColdAPI_General::FormatTheString("%lu", EMPTY, Steam_Config::AppId)); |
| 2780 | SetEnvironmentVariableA("SteamGameId", ColdAPI_General::FormatTheString("%llu", EMPTY, Steam_Config::AppId & 0xFFFFFF)); |
| 2781 | |
| 2782 | // Overlay |
| 2783 | std::string OverLay64 = "GameOverlayRenderer64.dll"; |
| 2784 | std::string OverLay32 = "GameOverlayRenderer.dll"; |
| 2785 | |
| 2786 | std::string OverLay = ""; |
| 2787 | #ifdef _WIN64 |
| 2788 | OverLay = OverLay64; |
| 2789 | #else |
| 2790 | OverLay = OverLay32; |
| 2791 | #endif |
| 2792 | OverLayModule = GetModuleHandleA(OverLay.c_str()); |
| 2793 | } |
| 2794 | |
| 2795 | // Check if we should hook LoadLibraries functions |
| 2796 | if (Steam_Config::ClientEmulation) |
| 2797 | { |
| 2798 | if (Steam_Config::HookForInjection) |
| 2799 | { |
| 2800 | ColdClientHookManager::ColdClientHookInit(); |
| 2801 | } |
| 2802 | } |
| 2803 |
no test coverage detected