mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-02 16:06:35 +00:00
small commit
This commit is contained in:
parent
422e94f833
commit
7d3898568d
@ -21,8 +21,8 @@ extern bool TCPTerminate;
|
|||||||
extern bool MPDEV;
|
extern bool MPDEV;
|
||||||
|
|
||||||
void StartSync(const std::string &Data){
|
void StartSync(const std::string &Data){
|
||||||
//std::thread t1(ProxyThread,Data.substr(1,Data.find(':')-1),std::stoi(Data.substr(Data.find(':')+1)));
|
std::thread t1(ProxyThread,Data.substr(1,Data.find(':')-1),std::stoi(Data.substr(Data.find(':')+1)));
|
||||||
std::thread t1(ProxyThread,"127.0.0.1",30814);
|
//std::thread t1(ProxyThread,"127.0.0.1",30814);
|
||||||
t1.detach();
|
t1.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ void WinExec(const std::string& cmd);
|
|||||||
void Exit(const std::string& Msg);
|
void Exit(const std::string& Msg);
|
||||||
|
|
||||||
void CheckForUpdates(const std::string& CV){
|
void CheckForUpdates(const std::string& CV){
|
||||||
system ("cls");
|
|
||||||
std::string link = "https://beamng-mp.com/builds/launcher?version=true";
|
std::string link = "https://beamng-mp.com/builds/launcher?version=true";
|
||||||
std::string HTTP = HTTP_REQUEST(link,443);
|
std::string HTTP = HTTP_REQUEST(link,443);
|
||||||
link = "https://beamng-mp.com/builds/launcher?download=true";
|
link = "https://beamng-mp.com/builds/launcher?download=true";
|
||||||
@ -22,6 +21,7 @@ void CheckForUpdates(const std::string& CV){
|
|||||||
struct stat buffer{};
|
struct stat buffer{};
|
||||||
if(stat ("BeamMP-Launcher.back", &buffer) == 0)remove("BeamMP-Launcher.back");
|
if(stat ("BeamMP-Launcher.back", &buffer) == 0)remove("BeamMP-Launcher.back");
|
||||||
if(HTTP > CV){
|
if(HTTP > CV){
|
||||||
|
system("cls");
|
||||||
std::cout << "Update found!" << std::endl;
|
std::cout << "Update found!" << std::endl;
|
||||||
std::cout << "Updating..." << std::endl;
|
std::cout << "Updating..." << std::endl;
|
||||||
SystemExec("rename BeamMP-Launcher.exe BeamMP-Launcher.back>nul");
|
SystemExec("rename BeamMP-Launcher.exe BeamMP-Launcher.back>nul");
|
||||||
|
32
src/main.cpp
32
src/main.cpp
@ -42,8 +42,7 @@ void Exit(const std::string& Msg){
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CheckDir(char*dir, const std::string& ver){
|
std::string CheckDir(char*dir){
|
||||||
system(("title BeamMP Launcher v" + ver).c_str());
|
|
||||||
char*temp;size_t len;
|
char*temp;size_t len;
|
||||||
struct stat info{};
|
struct stat info{};
|
||||||
_dupenv_s(&temp, &len,"APPDATA");
|
_dupenv_s(&temp, &len,"APPDATA");
|
||||||
@ -83,23 +82,13 @@ std::string CheckVer(const std::string &path){
|
|||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
int main(int argc, char* argv[]){
|
int main(int argc, char* argv[]){
|
||||||
|
|
||||||
const unsigned long long NPos = std::string::npos;
|
const unsigned long long NPos = std::string::npos;
|
||||||
struct stat info{};
|
struct stat info{};
|
||||||
|
system("cls");
|
||||||
std::string ver = "1.22", link, Path = CheckDir(argv[0],ver),HTTP_Result;
|
std::string ver = "1.3", link, HTTP_Result;
|
||||||
std::thread CFU(CheckForUpdates,ver);
|
SetWindowTextA(GetConsoleWindow(),("BeamMP Launcher v" + ver).c_str());
|
||||||
CFU.join();
|
|
||||||
if(argc > 1){
|
|
||||||
std::string Port = argv[1];
|
|
||||||
if(Port.find_first_not_of("0123456789") == NPos){
|
|
||||||
DEFAULT_PORT = std::stoi(Port);
|
|
||||||
std::cout << "Running on custom port : " << DEFAULT_PORT << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
std::thread t1(Discord_Main);
|
std::thread t1(Discord_Main);
|
||||||
t1.detach();
|
t1.detach();
|
||||||
|
|
||||||
std::cout << "Connecting to discord client..." << std::endl;
|
std::cout << "Connecting to discord client..." << std::endl;
|
||||||
while(GlobalInfo.empty()){
|
while(GlobalInfo.empty()){
|
||||||
GlobalInfo = GetDiscordInfo();
|
GlobalInfo = GetDiscordInfo();
|
||||||
@ -116,7 +105,18 @@ int main(int argc, char* argv[]){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else MPDEV = true;
|
}else MPDEV = true;
|
||||||
|
std::string Path = CheckDir(argv[0]);
|
||||||
|
std::thread CFU(CheckForUpdates,ver);
|
||||||
|
CFU.join();
|
||||||
|
|
||||||
|
if(argc > 1){
|
||||||
|
std::string Port = argv[1];
|
||||||
|
if(Port.find_first_not_of("0123456789") == NPos){
|
||||||
|
DEFAULT_PORT = std::stoi(Port);
|
||||||
|
std::cout << "Running on custom port : " << DEFAULT_PORT << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Security
|
//Security
|
||||||
auto*Sec = new std::thread(Check);
|
auto*Sec = new std::thread(Check);
|
||||||
Sec->join();
|
Sec->join();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user