/* <f10ef> ../engine/sv_steam3.cpp:566 */ bool ISteamApps_BIsSubscribedApp(uint32 appid) { if (CRehldsPlatformHolder::get()->SteamApps()) { ISteamApps* apps = CRehldsPlatformHolder::get()->SteamApps(); return apps->BIsSubscribedApp(appid); } return false; }
int SteamGlobal::init() { #if defined(CHOWDREN_FORCE_STEAM_OPEN) && defined(CHOWDREN_STEAM_APPID) if (SteamAPI_RestartAppIfNecessary(CHOWDREN_STEAM_APPID)) { return EXIT_FAILURE; } #endif initialized = SteamAPI_Init(); if (!initialized) { std::cout << "Could not initialize Steam API" << std::endl; #ifdef CHOWDREN_FORCE_STEAM_OPEN SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Steam error", "Could not initialize Steam API. " "Please make sure you are logged in to Steam " "before opening the game.", NULL); return EXIT_FAILURE; #endif return 0; } std::cout << "Initialized Steam API" << std::endl; bool debug_achievements = getenv("CHOWDREN_DEBUG_ACHIEVEMENTS") != NULL; if (debug_achievements) { if (!SteamUserStats()->ResetAllStats(true)) std::cout << "Could not reset stats" << std::endl; } if (!SteamUserStats()->RequestCurrentStats()) std::cout << "Could not request Steam stats" << std::endl; #ifdef CHOWDREN_STEAM_APPID ISteamApps * ownapp = SteamApps(); if (!ownapp->BIsSubscribedApp(CHOWDREN_STEAM_APPID)) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Steam error", "Please purchase the Steam version of the " "game if you want to play it on Steam.", NULL); return EXIT_FAILURE; } #endif steam_language = SteamApps()->GetCurrentGameLanguage(); if (steam_language.empty()) steam_language = "english"; steam_language[0] = toupper(steam_language[0]); std::cout << "Detected Steam language: " << steam_language << std::endl; return 0; }
bool SteamObject::is_activated() { #ifdef CHOWDREN_ENABLE_STEAM if (!global_steam_obj.initialized) #ifdef CHOWDREN_FORCE_STEAM_OPEN return false; #else return true; #endif SteamUserStats()->RequestCurrentStats(); ISteamApps * ownapp = SteamApps(); return ownapp->BIsSubscribedApp(CHOWDREN_STEAM_APPID); #else return true; #endif }