summaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2013-03-10 00:00:33 +0100
committermanuel <manuel@mausz.at>2013-03-10 00:00:33 +0100
commit7dd1948c98c3cf10fe142384f9756e197d9f5bff (patch)
treec7799219505c419826ec66f5dcc0cbedfb06ec4d /main.cpp
parentd6adb8507ed0637686b92eeecd2ef0013d112a56 (diff)
downloadsteamcmd-7dd1948c98c3cf10fe142384f9756e197d9f5bff.tar.gz
steamcmd-7dd1948c98c3cf10fe142384f9756e197d9f5bff.tar.bz2
steamcmd-7dd1948c98c3cf10fe142384f9756e197d9f5bff.zip
add support for game mods
use -mod <modname> for downloading the game mod
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index 45662dd..394f5b8 100644
--- a/main.cpp
+++ b/main.cpp
@@ -61,6 +61,7 @@ private:
61 EUpdateResult InstallOrUpdateApp(AppId_t uAppId, bool bVerifyAll = false, const char* cszBetaKey = NULL, const char* cszBetaPassword = NULL); 61 EUpdateResult InstallOrUpdateApp(AppId_t uAppId, bool bVerifyAll = false, const char* cszBetaKey = NULL, const char* cszBetaPassword = NULL);
62 bool UninstallApp(AppId_t uAppId); 62 bool UninstallApp(AppId_t uAppId);
63 void ShowAvailableApps(); 63 void ShowAvailableApps();
64 void ParseAppConfig(AppId_t uAppId);
64 65
65 void Msg(const char* cszFormat, ...); 66 void Msg(const char* cszFormat, ...);
66 void Error(const char* cszFormat, ...); 67 void Error(const char* cszFormat, ...);
@@ -160,6 +161,7 @@ void CApplication::Exit(int iCode)
160 161
161bool CApplication::UninstallApp(AppId_t uAppId) 162bool CApplication::UninstallApp(AppId_t uAppId)
162{ 163{
164 ParseAppConfig(uAppId);
163 if(g_pClientAppManager->GetAppInstallState(uAppId) & k_EAppStateUninstalled) 165 if(g_pClientAppManager->GetAppInstallState(uAppId) & k_EAppStateUninstalled)
164 { 166 {
165 Error("This app (%u:%s) isn't installed\n", uAppId, GetAppName(uAppId)); 167 Error("This app (%u:%s) isn't installed\n", uAppId, GetAppName(uAppId));
@@ -255,6 +257,12 @@ void CApplication::OnLicensesUpdated(LicensesUpdated_t* pParam)
255 } 257 }
256} 258}
257 259
260void CApplication::ParseAppConfig(AppId_t uAppId)
261{
262 const char* mod = commandLine.ParmValue("-mod");
263 if (mod)
264 g_pClientAppManager->SetAppConfigValue(uAppId, "mod", mod);
265}
258 266
259void CApplication::OnAppEventStateChange(AppEventStateChange_t* pParam) 267void CApplication::OnAppEventStateChange(AppEventStateChange_t* pParam)
260{ 268{
@@ -340,6 +348,7 @@ CApplication::EUpdateResult CApplication::InstallOrUpdateApp(AppId_t uAppId, boo
340 } 348 }
341 } 349 }
342 350
351 ParseAppConfig(uAppId);
343 EAppState eState = g_pClientAppManager->GetAppInstallState(uAppId); 352 EAppState eState = g_pClientAppManager->GetAppInstallState(uAppId);
344 if(eState == k_EAppStateInvalid || eState & k_EAppStateUninstalled) 353 if(eState == k_EAppStateInvalid || eState & k_EAppStateUninstalled)
345 { 354 {
@@ -425,6 +434,7 @@ void CApplication::OnAppInfoUpdateComplete(AppInfoUpdateComplete_t* pParam)
425 { 434 {
426 AppId_t uAppId = commandLine.ParmValue("-game", (int)k_uAppIdInvalid); 435 AppId_t uAppId = commandLine.ParmValue("-game", (int)k_uAppIdInvalid);
427 436
437 ParseAppConfig(uAppId);
428 if(g_pClientAppManager->GetAppInstallState(uAppId) & k_EAppStateUninstalled) 438 if(g_pClientAppManager->GetAppInstallState(uAppId) & k_EAppStateUninstalled)
429 { 439 {
430 Error("This app (%u:%s) isn't installed\n", uAppId, GetAppName(uAppId)); 440 Error("This app (%u:%s) isn't installed\n", uAppId, GetAppName(uAppId));
@@ -739,6 +749,14 @@ bool CApplication::ParseScript(const char* szFilename)
739 } 749 }
740 } 750 }
741 } 751 }
752 else if(strcasecmp(argv[0], "app_set_config") == 0)
753 {
754 if(argc >= 4 && strcasecmp(argv[2], "mod") == 0)
755 {
756 commandLine.AddParm("-mod");
757 commandLine.AddParm(argv[3]);
758 }
759 }
742 } 760 }
743 } 761 }
744 fclose(hFile); 762 fclose(hFile);
@@ -764,6 +782,7 @@ bool CApplication::CheckCommandline()
764 "Parameters:\n" 782 "Parameters:\n"
765 " -game <appid> - Game AppID to install / update / uninstall\n" 783 " -game <appid> - Game AppID to install / update / uninstall\n"
766 " (use '-command list' to see available games)\n" 784 " (use '-command list' to see available games)\n"
785 " -mod <modname> - Set game mod to install / update / uninstall (e.g. czero)\n"
767 " -dir <installdir> - Game install dir\n" 786 " -dir <installdir> - Game install dir\n"
768 " (if dir not specified, will use %s/steamapps/common/<gamename>/)\n" 787 " (if dir not specified, will use %s/steamapps/common/<gamename>/)\n"
769 " -username <username> - Steam account username\n" 788 " -username <username> - Steam account username\n"