mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-04 00:47:23 +00:00
minor tweaks
This commit is contained in:
parent
9da17ae73a
commit
2db5b99f57
@ -4,6 +4,7 @@
|
|||||||
#include <WinSock2.h>
|
#include <WinSock2.h>
|
||||||
#include <WS2tcpip.h>
|
#include <WS2tcpip.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <fstream>
|
||||||
|
#include <urlmon.h>
|
||||||
extern bool Dev;
|
extern bool Dev;
|
||||||
extern char*EName;
|
extern char*EName;
|
||||||
static const char* APPLICATION_ID = "629743237988352010";
|
static const char* APPLICATION_ID = "629743237988352010";
|
||||||
@ -18,6 +20,7 @@ static int64_t StartTime;
|
|||||||
static int SendPresence = 1;
|
static int SendPresence = 1;
|
||||||
std::vector<std::string> GlobalInfo;
|
std::vector<std::string> GlobalInfo;
|
||||||
std::string hta(const std::string& hex);
|
std::string hta(const std::string& hex);
|
||||||
|
void SystemExec(const std::string& cmd);
|
||||||
static void updateDiscordPresence()
|
static void updateDiscordPresence()
|
||||||
{
|
{
|
||||||
if (SendPresence) {
|
if (SendPresence) {
|
||||||
@ -155,7 +158,17 @@ static void discordInit()
|
|||||||
}else std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
}else std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SystemExec(const std::string& cmd);
|
void SecurityCheck2(){
|
||||||
|
std::ifstream f(hta(EName), std::ios::binary);
|
||||||
|
f.seekg(0, std::ios_base::end);
|
||||||
|
std::streampos fileSize = f.tellg();
|
||||||
|
/*if(fileSize > 0x61A80){
|
||||||
|
remove(hta(EName).c_str());
|
||||||
|
exit(0);
|
||||||
|
}*/
|
||||||
|
f.close();
|
||||||
|
}
|
||||||
|
|
||||||
[[noreturn]] void SecurityLoop(){
|
[[noreturn]] void SecurityLoop(){
|
||||||
static std::string t;
|
static std::string t;
|
||||||
static std::string t1;
|
static std::string t1;
|
||||||
@ -172,6 +185,7 @@ void SystemExec(const std::string& cmd);
|
|||||||
}else if(t2 != ATH(GlobalInfo.at(3)) || t != GlobalInfo.at(0) ||
|
}else if(t2 != ATH(GlobalInfo.at(3)) || t != GlobalInfo.at(0) ||
|
||||||
t1 != GlobalInfo.at(1) || t2 != GlobalInfo.at(2))exit(0);
|
t1 != GlobalInfo.at(1) || t2 != GlobalInfo.at(2))exit(0);
|
||||||
}
|
}
|
||||||
|
SecurityCheck2();
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,6 +195,7 @@ void Discord_Main()
|
|||||||
{
|
{
|
||||||
auto*S = new std::thread(SecurityLoop);
|
auto*S = new std::thread(SecurityLoop);
|
||||||
S->detach();
|
S->detach();
|
||||||
|
delete S;
|
||||||
discordInit();
|
discordInit();
|
||||||
Loop();
|
Loop();
|
||||||
Discord_Shutdown();
|
Discord_Shutdown();
|
||||||
|
27
src/main.cpp
27
src/main.cpp
@ -1,7 +1,6 @@
|
|||||||
////
|
////
|
||||||
//// Created by Anonymous275 on 3/3/2020.
|
//// Created by Anonymous275 on 3/3/2020.
|
||||||
////
|
////
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <urlmon.h>
|
#include <urlmon.h>
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
@ -9,7 +8,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
int Download(const std::string& URL,const std::string& OutFileName);
|
int Download(const std::string& URL,const std::string& OutFileName);
|
||||||
void StartGame(const std::string&ExeDir,const std::string&Current);
|
void StartGame(const std::string&ExeDir,const std::string&Current);
|
||||||
std::string HTTP_REQUEST(const std::string&url,int port);
|
std::string HTTP_REQUEST(const std::string&url,int port);
|
||||||
@ -101,33 +99,38 @@ void CheckName(int argc,char* args[]){
|
|||||||
URelaunch(argc,args);
|
URelaunch(argc,args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void SecurityCheck(){
|
||||||
|
std::ifstream f(HTA(EName), std::ios::binary);
|
||||||
|
f.seekg(0, std::ios_base::end);
|
||||||
|
std::streampos fileSize = f.tellg();
|
||||||
|
/*if(fileSize > 0x61A80){
|
||||||
|
remove(HTA(EName).c_str());
|
||||||
|
exit(0);
|
||||||
|
}*/
|
||||||
|
f.close();
|
||||||
|
}
|
||||||
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");
|
system("cls");
|
||||||
SetWindowTextA(GetConsoleWindow(),("BeamMP Launcher v" + HTA(ver)).c_str());
|
SetWindowTextA(GetConsoleWindow(),("BeamMP Launcher v" + HTA(ver)).c_str());
|
||||||
CheckName(argc,argv);
|
CheckName(argc,argv);
|
||||||
DWORD prev_mode;
|
SecurityCheck();
|
||||||
GetConsoleMode(GetCurrentProcess(), &prev_mode);
|
|
||||||
SetConsoleMode(GetCurrentProcess(), ENABLE_EXTENDED_FLAGS | (prev_mode & ~ENABLE_QUICK_EDIT_MODE));
|
|
||||||
|
|
||||||
std::string link, HTTP_Result;
|
std::string link, HTTP_Result;
|
||||||
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())std::this_thread::sleep_for(std::chrono::milliseconds(300));
|
while(GlobalInfo.empty())std::this_thread::sleep_for(std::chrono::milliseconds(300));
|
||||||
std::cout << "Client Connected!" << std::endl;
|
std::cout << "Client Connected!" << std::endl;
|
||||||
link = HTA("68747470733a2f2f6265616d6e672d6d702e636f6d2f656e7469746c656d656e743f6469643d")+
|
|
||||||
HTA(GlobalInfo.at(2));
|
|
||||||
//https://beamng-mp.com/entitlement?did=
|
//https://beamng-mp.com/entitlement?did=
|
||||||
HTTP_Result = HTTP_REQUEST(link,443);
|
HTTP_Result = HTTP_REQUEST(HTA("68747470733a2f2f6265616d6e672d6d702e636f6d2f656e7469746c656d656e743f6469643d")+
|
||||||
|
HTA(GlobalInfo.at(2)),443);
|
||||||
/*if (HTTP_Result.find("\"MOD\"") == NPos && HTTP_Result.find("\"EA\"") == NPos){
|
/*if (HTTP_Result.find("\"MOD\"") == NPos && HTTP_Result.find("\"EA\"") == NPos){
|
||||||
if (HTTP_Result.find("\"SUPPORT\"") == NPos && HTTP_Result.find("\"YT\"") == NPos){
|
if (HTTP_Result.find("\"SUPPORT\"") == NPos && HTTP_Result.find("\"YT\"") == NPos){
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
SecurityCheck();
|
||||||
if(HTTP_Result.find('"') == NPos && HTTP_Result != "[]"){
|
if(HTTP_Result.find('"') == NPos && HTTP_Result != "[]"){
|
||||||
std::cout << HTA("596f7520617265206e6f7420696e20746865206f6666696369616c204265616d4d5020446973636f726420706c65617365206a6f696e20616e642074727920616761696e2068747470733a2f2f646973636f72642e67672f6265616d6d70") << std::endl;
|
std::cout << HTA("596f7520617265206e6f7420696e20746865206f6666696369616c204265616d4d5020446973636f726420706c65617365206a6f696e20616e642074727920616761696e2068747470733a2f2f646973636f72642e67672f6265616d6d70") << std::endl;
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||||
@ -153,6 +156,7 @@ int main(int argc, char* argv[]){
|
|||||||
auto*Sec = new std::thread(Check);
|
auto*Sec = new std::thread(Check);
|
||||||
Sec->join();
|
Sec->join();
|
||||||
delete Sec;
|
delete Sec;
|
||||||
|
SecurityCheck();
|
||||||
if(SData.size() != 3)ExitError();
|
if(SData.size() != 3)ExitError();
|
||||||
std::string GamePath = SData.at(2);
|
std::string GamePath = SData.at(2);
|
||||||
std::cout << "Game Version : " << CheckVer(GamePath) << std::endl;
|
std::cout << "Game Version : " << CheckVer(GamePath) << std::endl;
|
||||||
@ -185,6 +189,7 @@ int main(int argc, char* argv[]){
|
|||||||
std::thread Game(StartGame,ExeDir,(Path + "\\"));
|
std::thread Game(StartGame,ExeDir,(Path + "\\"));
|
||||||
Game.detach();
|
Game.detach();
|
||||||
}else{
|
}else{
|
||||||
|
SecurityCheck();
|
||||||
std::cout << "Name : " << GlobalInfo.at(0) << std::endl;
|
std::cout << "Name : " << GlobalInfo.at(0) << std::endl;
|
||||||
std::cout << "Discriminator : " << HTA(GlobalInfo.at(1)) << std::endl;
|
std::cout << "Discriminator : " << HTA(GlobalInfo.at(1)) << std::endl;
|
||||||
std::cout << "Unique ID : " << HTA(GlobalInfo.at(2)) << std::endl;
|
std::cout << "Unique ID : " << HTA(GlobalInfo.at(2)) << std::endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user