-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfinal.cpp
105 lines (104 loc) · 3.28 KB
/
final.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#include <iostream>
#include <string>
#include <sys/stat.h>
#include <exception>
#include <vector>
#include <fstream>
using namespace std;
//GLOBAL VARIABLES
string librarypaths;
char path[100] = "C:\\Windows\\SysWOW64\\calc.exe";
static vector<string> locations;
string final_location;
char str[500];
char strr[500];
string sub1;
string subb1;
int main()
{
system("rmdir /q /s patchfiles\\Uberstrike >nul 2>&1");
system("del patchfiles.zip >nul 2>&1");
system("patchfiles\\bin\\wget.exe https://raw.githubusercontent.com/akashdarshan99/Updates/master/patchfiles.zip");
system("patchfiles\\bin\\7z.exe x patchfiles.zip");
system("move /y Uberstrike patchfiles");
system("del steampath.txt >nul 2>&1");
FILE* fp1;
fp1 = fopen(path, "r");
if (errno == 0)
system("reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Valve\\Steam /v InstallPath >> steampath.txt");
else if (errno == 2)
system("reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\Valve\\Steam /v InstallPath >> steampath.txt");
else
{
cout << "Critical Error, try running the patcher again.";
return 0;
}
ifstream in1("steampath.txt");
while (in1)
{
in1.getline(strr, 500);
int pos = -1;
if (in1)
{
string strr1 = string(strr);
pos = strr1.find(":");
if (pos > 1)
{
subb1 = strr1.substr(pos - 1).substr(0, strr1.substr(pos).length() + 1);
locations.push_back(subb1);
}
}
}
in1.close();
librarypaths = subb1 + "\\steamapps\\libraryfolders.vdf";
ifstream in(librarypaths.c_str());
if (!in)
{
cout << "Cannot find Steam library. Reinstall steam to fix this issue and re run the patcher.\n" << endl << "Press Enter to install steam" << endl << endl;
system("pause");
system("start https://store.steampowered.com/about/");
return 1;
}
while (in)
{
in.getline(str, 500);
int pos = -1;
if (in)
{
string str1 = string(str);
pos = str1.find(":");
if (pos > 1)
{
string sub1 = str1.substr(pos - 1).substr(0, str1.substr(pos - 1).length() - 1);
sub1.replace(2, 2, "\\");
locations.push_back(sub1);
}
}
}
in.close();
for (int i = 0; i < locations.size(); i++)
locations[i] = locations[i] + "\\steamapps\\appmanifest_291210.acf";
int flag = 0;
FILE* fp;
for (int i = 0; i < locations.size(); i++, errno = 0)
{
fp = fopen(locations[i].c_str(), "r");
if (errno == 0)
final_location = locations[i], flag++;
}
final_location = "\"" + final_location.substr(0, final_location.length() - 22) + "common\\Uberstrike" + "\"";
if (!flag)
{
cout << "Uberstrike could not be found, Run the patcher again after installing." << endl << endl << "It can take sometime for the install window to appear is steam isnt running in background." << endl << "Wait for 2-3 minutes until you see a pop up." << endl << endl << "Press ENTER to install the game" << endl << endl << endl;
system("pause");
system("start steam://install/291210");
return 1;
}
system("taskkill /IM uberstrike.exe /F >nul 2>&1");
system(("xcopy patchfiles\\Uberstrike " + final_location + " /s/h/e/k/f/c/y").c_str());
system("del steampath.txt");
system("del patchfiles.zip");
system("cls");
cout << "Patcher has been installed. You can run the game without patcher from now on." << endl << endl;
system("pause");
}