summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2013-03-26 12:51:50 +0100
committermanuel <manuel@mausz.at>2013-03-26 12:51:50 +0100
commitd64ac227ead1dbe4178cbfdb05d243f52d59b6a1 (patch)
tree4610b57384dac117def1a051df76e0ef4e7fbc43
parent8c417384e29635c680745425abd630d5208cbaf2 (diff)
downloadsteamcmd-d64ac227ead1dbe4178cbfdb05d243f52d59b6a1.tar.gz
steamcmd-d64ac227ead1dbe4178cbfdb05d243f52d59b6a1.tar.bz2
steamcmd-d64ac227ead1dbe4178cbfdb05d243f52d59b6a1.zip
remove stl calls
-rw-r--r--main.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/main.cpp b/main.cpp
index d126fdf..0991150 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,14 +1,13 @@
1/* 1/*
2 This file is a part of "Didrole's Update Tool" 2 This file is a part of "Didrole's Update Tool"
3 ©2k12, Didrole 3 ©2k12, Didrole
4 4
5 License : Public domain 5 License : Public domain
6*/ 6*/
7 7
8#include <stdarg.h> 8#include <stdarg.h>
9#include <math.h> 9#include <math.h>
10#include <stdlib.h> 10#include <stdlib.h>
11#include <sstream>
12 11
13#include "CCommandLine.h" 12#include "CCommandLine.h"
14 13
@@ -271,23 +270,25 @@ bool CApplication::ParseAppConfig(AppId_t uAppId)
271 bool ret = true; 270 bool ret = true;
272 for(unsigned int i = 0; i < commandLine.FindParmCount("-config"); i++) 271 for(unsigned int i = 0; i < commandLine.FindParmCount("-config"); i++)
273 { 272 {
274 std::string keyval = commandLine.ParmValues("-config", i); 273 const char *keyval = commandLine.ParmValues("-config", i);
275 size_t pos = keyval.find_first_of('='); 274 const char *pos = strchr(keyval, '=');
276 if (pos == std::string::npos) 275 if (pos == NULL)
277 { 276 {
278 Error("Invalid syntax for param \"-config %s\"\n", keyval.c_str()); 277 Error("Invalid syntax for param \"-config %s\"\n", keyval);
279 ret = false; 278 ret = false;
280 continue; 279 continue;
281 } 280 }
282 g_pClientAppManager->SetAppConfigValue(uAppId, keyval.substr(0, pos).c_str(), 281
283 keyval.substr(pos + 1).c_str()); 282 char *key = strndup(keyval, pos - keyval);
283 g_pClientAppManager->SetAppConfigValue(uAppId, key, pos + 1);
284 free(key);
284 } 285 }
285 return ret; 286 return ret;
286} 287}
287 288
288void CApplication::OnAppEventStateChange(AppEventStateChange_t* pParam) 289void CApplication::OnAppEventStateChange(AppEventStateChange_t* pParam)
289{ 290{
290 if(pParam->m_nAppID == this->m_uInstallingAppId) 291 if(pParam->m_nAppID == this->m_uInstallingAppId)
291 { 292 {
292 if(pParam->m_eAppError != k_EAppErrorNone) 293 if(pParam->m_eAppError != k_EAppErrorNone)
293 { 294 {
@@ -343,7 +344,7 @@ CApplication::EUpdateResult CApplication::InstallOrUpdateApp(AppId_t uAppId, boo
343 szKeyName[sizeof(szKeyName) - 1] = '\0'; 344 szKeyName[sizeof(szKeyName) - 1] = '\0';
344 char szBuildID[11]; 345 char szBuildID[11];
345 snprintf(szKeyName, sizeof(szKeyName) - 1, "depots/branches/%s/buildid", cszBetaKey); 346 snprintf(szKeyName, sizeof(szKeyName) - 1, "depots/branches/%s/buildid", cszBetaKey);
346 347
347 int32 iResult = g_pClientApps->GetAppData(uAppId, szKeyName, szBuildID, sizeof(szBuildID)); 348 int32 iResult = g_pClientApps->GetAppData(uAppId, szKeyName, szBuildID, sizeof(szBuildID));
348 if(iResult <= 0) 349 if(iResult <= 0)
349 { 350 {
@@ -616,7 +617,7 @@ bool CApplication::InitSteam()
616 CModuleScanner steamclientScanner((void*)pCreateInterface); 617 CModuleScanner steamclientScanner((void*)pCreateInterface);
617 618
618#ifdef _WIN32 619#ifdef _WIN32
619 void* pppUsePICS = steamclientScanner.FindSignature("\x00\x00\x00\x00\x83\x78\x34\x00\x75\x00\xc6\x81\x74\x0c\x00\x00\x00\x5d\xc2\x04\x00", "????xxxxx?xxxxxxxxxxx"); 620 void* pppUsePICS = steamclientScanner.FindSignature("\x00\x00\x00\x00\x8B\x40\x34\x83\xF8\x01", "????xxxxxx");
620 if(pppUsePICS) 621 if(pppUsePICS)
621 g_pUsePICS = **(void***)pppUsePICS; 622 g_pUsePICS = **(void***)pppUsePICS;
622#else 623#else
@@ -779,12 +780,15 @@ bool CApplication::ParseScript(const char* szFilename)
779 } 780 }
780 else if(strcasecmp(argv[0], "app_set_config") == 0) 781 else if(strcasecmp(argv[0], "app_set_config") == 0)
781 { 782 {
783 // app_set_config <appid> <key> <value>
782 if(argc == 4) 784 if(argc == 4)
783 { 785 {
786 // we ignore the appid parameter here
784 commandLine.AddParm("-config"); 787 commandLine.AddParm("-config");
785 std::ostringstream oss; 788 char *buf = new char[strlen(argv[2]) + strlen(argv[3]) + 2];
786 oss << argv[2] << "=" << argv[3]; 789 sprintf(buf, "%s=%s", argv[2], argv[3]);
787 commandLine.AddParm(oss.str().c_str()); 790 commandLine.AddParm(buf);
791 delete[] buf;
788 } 792 }
789 } 793 }
790 } 794 }
@@ -911,7 +915,7 @@ bool CApplication::LogOn()
911 return false; 915 return false;
912 } 916 }
913#ifdef _WIN32 917#ifdef _WIN32
914 void (__thiscall* pSetValue)(void* pThis, const char* cszValue) = (void (__thiscall *)(void *,const char *)) (*(void***)g_pUsePICS)[12]; 918 bool (__thiscall* pSetValue)(void* pThis, const char* cszValue) = (bool (__thiscall *)(void *,const char *)) (*(void***)g_pUsePICS)[13];
915#else 919#else
916 void (*pSetValue)(void* pThis, const char* cszValue) = (void (*)(void *,const char *)) (*(void***)g_pUsePICS)[13]; 920 void (*pSetValue)(void* pThis, const char* cszValue) = (void (*)(void *,const char *)) (*(void***)g_pUsePICS)[13];
917#endif 921#endif
@@ -949,7 +953,7 @@ bool CApplication::LogOn()
949 g_pClientUser->Set2ndFactorAuthCode(cszSteamGuardCode, false); 953 g_pClientUser->Set2ndFactorAuthCode(cszSteamGuardCode, false);
950 } 954 }
951 } 955 }
952 956
953 char szSteamIDKey[256]; 957 char szSteamIDKey[256];
954 snprintf(szSteamIDKey, sizeof(szSteamIDKey) - 1, "Software/Valve/Steam/Accounts/%s/SteamID", cszUsername); 958 snprintf(szSteamIDKey, sizeof(szSteamIDKey) - 1, "Software/Valve/Steam/Accounts/%s/SteamID", cszUsername);
955 szSteamIDKey[sizeof(szSteamIDKey) - 1] = '\0'; 959 szSteamIDKey[sizeof(szSteamIDKey) - 1] = '\0';