| 2552 | return (void*)&Sctx->Out; |
| 2553 | } |
| 2554 | bool ReadIni() |
| 2555 | { |
| 2556 | char SteamORG[MAX_PATH] = { 0 }; |
| 2557 | std::strcpy(SteamORG, Steamapipath); |
| 2558 | std::strcat(SteamORG, ORGAPI); |
| 2559 | char SteamINI[MAX_PATH] = { 0 }; |
| 2560 | std::strcpy(SteamINI, Steamapipath); |
| 2561 | std::strcat(SteamINI, INI); |
| 2562 | |
| 2563 | // Read from INI |
| 2564 | Steam_Config::AppId = GetPrivateProfileIntA("SteamData", "AppID", NULL, SteamINI); |
| 2565 | Steam_Config::AppBuildId = GetPrivateProfileIntA("SteamData", "AppBuildId", NULL, SteamINI); |
| 2566 | Steam_Config::OnlineMod = GetPrivateProfileIntA("SteamData", "OnlineMode", NULL, SteamINI) != FALSE; |
| 2567 | Steam_Config::UnlockAllDLCS = GetPrivateProfileIntA("SteamData", "UnlockAllDLCs", true, SteamINI) != FALSE; |
| 2568 | Steam_Config::LowViolence = GetPrivateProfileIntA("SteamProfile", "LowViolence", NULL, SteamINI) != FALSE; |
| 2569 | Steam_Config::RemoteStorage = GetPrivateProfileIntA("SteamData", "SteamFileSave", true, SteamINI) != FALSE; |
| 2570 | Steam_Config::StubBypass = GetPrivateProfileIntA("SteamAdditional", "PatchSteamStub", NULL, SteamINI) != FALSE; |
| 2571 | Steam_Config::ClientEmulation = GetPrivateProfileIntA("SteamAdditional", "ClientEmulation", NULL, SteamINI) != FALSE; |
| 2572 | Steam_Config::HookForInjection = GetPrivateProfileIntA("SteamClient", "HookInjectionMode", NULL, SteamINI) != FALSE; |
| 2573 | Steam_Config::InterfaceNFound = GetPrivateProfileIntA("SteamAdditional", "WarnInterfaceNFound", NULL, SteamINI) != FALSE; |
| 2574 | |
| 2575 | GetPrivateProfileStringA("SteamProfile", "Username", "ColdAPI", Steam_Config::Username, sizeof(Steam_Config::Username), SteamINI); |
| 2576 | GetPrivateProfileStringA("SteamProfile", "Language", "english", Steam_Config::Language, sizeof(Steam_Config::Language), SteamINI); |
| 2577 | GetPrivateProfileStringA("SteamData", "SavePath", "Auto", Steam_Config::SaveDirectory, sizeof(Steam_Config::SaveDirectory), SteamINI); |
| 2578 | |
| 2579 | // DLC attempt: |
| 2580 | if (!Steam_Config::UnlockAllDLCS) |
| 2581 | { |
| 2582 | bool NullByte = false; |
| 2583 | size_t OffSet = 0; |
| 2584 | char String[500] = { 0 }; |
| 2585 | char Section[0x900] = { 0 }; |
| 2586 | GetPrivateProfileSectionA("DLC", Section, sizeof(Section), SteamINI); |
| 2587 | uint32_t DAppid = 0; |
| 2588 | |
| 2589 | // GetDLCs |
| 2590 | while (std::memcmp(&Section[OffSet], &NullByte, 1) != 0) |
| 2591 | { |
| 2592 | // Scan the string. |
| 2593 | std::sscanf(&Section[OffSet], "%u=%[^\n]", &DAppid, String); |
| 2594 | |
| 2595 | ColdDLC_Config::DLCsAPPID.push_back(DAppid); |
| 2596 | ColdDLC_Config::DLCsNames.push_back(String); |
| 2597 | ColdDLC_Config::DLCsCount++; |
| 2598 | |
| 2599 | // Prepare for next DLC String Info |
| 2600 | std::memset(String, 0, sizeof(String)); |
| 2601 | DAppid = 0; |
| 2602 | |
| 2603 | // Calculate the offset for the next string, just get the string length and add 1 byte. |
| 2604 | size_t SSize = std::strlen(&Section[OffSet]) + 1; |
| 2605 | OffSet += SSize; |
| 2606 | } |
| 2607 | } |
| 2608 | // Check if we should read interfaces from the original steam_api. |
| 2609 | if (GetPrivateProfileIntA("SteamAdditional", "InterfaceChecker", NULL, SteamINI) == TRUE) |
| 2610 | { |
| 2611 | HANDLE hOrg = CreateFileA(SteamORG, GENERIC_READ, NULL, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); |
no test coverage detected