Ejemplo n.º 1
0
void SteamClient::runCallbacks() {
    if (!initialized) {
        return;
    }

    auto steamPipe = SteamAPI_GetHSteamPipe();
    if (!steamPipe) {
        qDebug() << "Could not get SteamPipe";
        return;
    }

    Steam_RunCallbacks(steamPipe, false);
}
Ejemplo n.º 2
0
SB_API void S_CALLTYPE Steam_RunCallbacks_(HSteamPipe hSteamPipe, bool bGameServerCallbacks) {
	Steam_RunCallbacks(hSteamPipe, bGameServerCallbacks);
}
Ejemplo n.º 3
0
int main(int argc, char *argv[]) {
    if (argc != 2) {
        std::cerr << "Usage: ./broiler dir_with_replays" << std::endl;
        return 1;
    }
    std::string directory(argv[1]);

    // init steam
    if (SteamAPI_RestartAppIfNecessary(k_uAppIdInvalid))
        return 1;
    if (!SteamAPI_Init()) {
        Error("Fatal Error", "Steam must be running (SteamAPI_Init() failed).\n");
        return 1;
    }
    if (!SteamUser()->BLoggedOn()) {
        Error("Fatal Error",
              "Steam user must be logged in (SteamUser()->BLoggedOn() returned false).\n");
        return 1;
    }

    bool running = true;
    auto cbthread = std::thread([&running]() {
        while (running) {
            try {
                std::this_thread::sleep_for(std::chrono::milliseconds(50));
                Steam_RunCallbacks(GetHSteamPipe(), false);
            } catch (BoilerException &e) {
                Error("Fatal Error", e.what());
                exit(1);
            }
        };
    });

    int res = 0;

    try {
        // make sure we are connected to the gc
        CSGOClient::GetInstance()->WaitForGcConnect();

        // refresh match list
        CSGOMatchList refresher;
        refresher.RefreshWait();
        std::vector<CDataGCCStrike15_v2_MatchInfo> matches = refresher.Matches();
        for (auto &match : matches) {
            CMsgGCCStrike15_v2_MatchmakingServerRoundStats* rs = getLegacyRoundStats(match);
            if (!rs) {
                std::cerr << "Cannot get info for match" << std::endl;
                continue;
            }
            std::string dotDemFile = directory + "/" + dotDem(match, *rs);
            std::string dotDemDotInfoFile = dotDemFile + ".info";
            std::string link = rs->map();

            if (!file_exists(dotDemDotInfoFile)) {
                rs->clear_map();
                std::cerr << "Creating " << dotDemDotInfoFile << std::endl;
                std::ofstream myfile;
                myfile.open(dotDemDotInfoFile, std::ios::binary);
                if (!match.SerializeToOstream(&myfile))
                    Error("Error", std::string("Cannot serialize to file ") + dotDemDotInfoFile);
                myfile.close();
            }

            if (!file_exists(dotDemFile))
                std::cout << link << std::endl;
        }
    } catch (BoilerException &e) {
        Error("Fatal error", e.what());
        res = 1;
    }

    // shutdown
    running = false;
    cbthread.join();
    CSGOClient::Destroy();

    SteamAPI_Shutdown();
    return res;
}