From 7dd1948c98c3cf10fe142384f9756e197d9f5bff Mon Sep 17 00:00:00 2001 From: manuel Date: Sun, 10 Mar 2013 00:00:33 +0100 Subject: add support for game mods use -mod for downloading the game mod --- main.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/main.cpp b/main.cpp index 45662dd..394f5b8 100644 --- a/main.cpp +++ b/main.cpp @@ -61,6 +61,7 @@ private: EUpdateResult InstallOrUpdateApp(AppId_t uAppId, bool bVerifyAll = false, const char* cszBetaKey = NULL, const char* cszBetaPassword = NULL); bool UninstallApp(AppId_t uAppId); void ShowAvailableApps(); + void ParseAppConfig(AppId_t uAppId); void Msg(const char* cszFormat, ...); void Error(const char* cszFormat, ...); @@ -160,6 +161,7 @@ void CApplication::Exit(int iCode) bool CApplication::UninstallApp(AppId_t uAppId) { + ParseAppConfig(uAppId); if(g_pClientAppManager->GetAppInstallState(uAppId) & k_EAppStateUninstalled) { Error("This app (%u:%s) isn't installed\n", uAppId, GetAppName(uAppId)); @@ -255,6 +257,12 @@ void CApplication::OnLicensesUpdated(LicensesUpdated_t* pParam) } } +void CApplication::ParseAppConfig(AppId_t uAppId) +{ + const char* mod = commandLine.ParmValue("-mod"); + if (mod) + g_pClientAppManager->SetAppConfigValue(uAppId, "mod", mod); +} void CApplication::OnAppEventStateChange(AppEventStateChange_t* pParam) { @@ -340,6 +348,7 @@ CApplication::EUpdateResult CApplication::InstallOrUpdateApp(AppId_t uAppId, boo } } + ParseAppConfig(uAppId); EAppState eState = g_pClientAppManager->GetAppInstallState(uAppId); if(eState == k_EAppStateInvalid || eState & k_EAppStateUninstalled) { @@ -425,6 +434,7 @@ void CApplication::OnAppInfoUpdateComplete(AppInfoUpdateComplete_t* pParam) { AppId_t uAppId = commandLine.ParmValue("-game", (int)k_uAppIdInvalid); + ParseAppConfig(uAppId); if(g_pClientAppManager->GetAppInstallState(uAppId) & k_EAppStateUninstalled) { Error("This app (%u:%s) isn't installed\n", uAppId, GetAppName(uAppId)); @@ -739,6 +749,14 @@ bool CApplication::ParseScript(const char* szFilename) } } } + else if(strcasecmp(argv[0], "app_set_config") == 0) + { + if(argc >= 4 && strcasecmp(argv[2], "mod") == 0) + { + commandLine.AddParm("-mod"); + commandLine.AddParm(argv[3]); + } + } } } fclose(hFile); @@ -764,6 +782,7 @@ bool CApplication::CheckCommandline() "Parameters:\n" " -game - Game AppID to install / update / uninstall\n" " (use '-command list' to see available games)\n" + " -mod - Set game mod to install / update / uninstall (e.g. czero)\n" " -dir - Game install dir\n" " (if dir not specified, will use %s/steamapps/common//)\n" " -username - Steam account username\n" -- cgit v1.2.3