From d64ac227ead1dbe4178cbfdb05d243f52d59b6a1 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 26 Mar 2013 12:51:50 +0100 Subject: remove stl calls --- main.cpp | 36 ++++++++++++++++++++---------------- 1 file 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 @@ /* This file is a part of "Didrole's Update Tool" ©2k12, Didrole - + License : Public domain */ #include #include #include -#include #include "CCommandLine.h" @@ -271,23 +270,25 @@ bool CApplication::ParseAppConfig(AppId_t uAppId) bool ret = true; for(unsigned int i = 0; i < commandLine.FindParmCount("-config"); i++) { - std::string keyval = commandLine.ParmValues("-config", i); - size_t pos = keyval.find_first_of('='); - if (pos == std::string::npos) + const char *keyval = commandLine.ParmValues("-config", i); + const char *pos = strchr(keyval, '='); + if (pos == NULL) { - Error("Invalid syntax for param \"-config %s\"\n", keyval.c_str()); + Error("Invalid syntax for param \"-config %s\"\n", keyval); ret = false; continue; } - g_pClientAppManager->SetAppConfigValue(uAppId, keyval.substr(0, pos).c_str(), - keyval.substr(pos + 1).c_str()); + + char *key = strndup(keyval, pos - keyval); + g_pClientAppManager->SetAppConfigValue(uAppId, key, pos + 1); + free(key); } return ret; } void CApplication::OnAppEventStateChange(AppEventStateChange_t* pParam) { - if(pParam->m_nAppID == this->m_uInstallingAppId) + if(pParam->m_nAppID == this->m_uInstallingAppId) { if(pParam->m_eAppError != k_EAppErrorNone) { @@ -343,7 +344,7 @@ CApplication::EUpdateResult CApplication::InstallOrUpdateApp(AppId_t uAppId, boo szKeyName[sizeof(szKeyName) - 1] = '\0'; char szBuildID[11]; snprintf(szKeyName, sizeof(szKeyName) - 1, "depots/branches/%s/buildid", cszBetaKey); - + int32 iResult = g_pClientApps->GetAppData(uAppId, szKeyName, szBuildID, sizeof(szBuildID)); if(iResult <= 0) { @@ -616,7 +617,7 @@ bool CApplication::InitSteam() CModuleScanner steamclientScanner((void*)pCreateInterface); #ifdef _WIN32 - 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"); + void* pppUsePICS = steamclientScanner.FindSignature("\x00\x00\x00\x00\x8B\x40\x34\x83\xF8\x01", "????xxxxxx"); if(pppUsePICS) g_pUsePICS = **(void***)pppUsePICS; #else @@ -779,12 +780,15 @@ bool CApplication::ParseScript(const char* szFilename) } else if(strcasecmp(argv[0], "app_set_config") == 0) { + // app_set_config if(argc == 4) { + // we ignore the appid parameter here commandLine.AddParm("-config"); - std::ostringstream oss; - oss << argv[2] << "=" << argv[3]; - commandLine.AddParm(oss.str().c_str()); + char *buf = new char[strlen(argv[2]) + strlen(argv[3]) + 2]; + sprintf(buf, "%s=%s", argv[2], argv[3]); + commandLine.AddParm(buf); + delete[] buf; } } } @@ -911,7 +915,7 @@ bool CApplication::LogOn() return false; } #ifdef _WIN32 - void (__thiscall* pSetValue)(void* pThis, const char* cszValue) = (void (__thiscall *)(void *,const char *)) (*(void***)g_pUsePICS)[12]; + bool (__thiscall* pSetValue)(void* pThis, const char* cszValue) = (bool (__thiscall *)(void *,const char *)) (*(void***)g_pUsePICS)[13]; #else void (*pSetValue)(void* pThis, const char* cszValue) = (void (*)(void *,const char *)) (*(void***)g_pUsePICS)[13]; #endif @@ -949,7 +953,7 @@ bool CApplication::LogOn() g_pClientUser->Set2ndFactorAuthCode(cszSteamGuardCode, false); } } - + char szSteamIDKey[256]; snprintf(szSteamIDKey, sizeof(szSteamIDKey) - 1, "Software/Valve/Steam/Accounts/%s/SteamID", cszUsername); szSteamIDKey[sizeof(szSteamIDKey) - 1] = '\0'; -- cgit v1.2.3