MCPcopy Create free account
hub / github.com/Rat431/ColdAPI_Steam / ColdClientInitializzation

Function ColdClientInitializzation

src/ColdAPI_Steam/ColdManager.cpp:2746–2815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

SteamAPI_InitFunction · 0.85
DllMainFunction · 0.85

Calls 6

InitInterfacesFunction · 0.85
ReadIniFunction · 0.85
FormatTheStringFunction · 0.85
ColdClientHookInitFunction · 0.85
Storage_InitializzationFunction · 0.85
PatchFunction · 0.85

Tested by

no test coverage detected