mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-03 08:26:01 +00:00
game crash on startup preventions
This commit is contained in:
parent
5be1e93f37
commit
72cd3dde79
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
std::string HTTP_REQUEST(const std::string&url,int port);
|
std::string HTTP_REQUEST(const std::string&url,int port);
|
||||||
void SyncResources(const std::string& IP, int port);
|
void SyncResources(const std::string& IP, int port);
|
||||||
|
void Exit(const std::string& Msg);
|
||||||
extern std::string UlStatus;
|
extern std::string UlStatus;
|
||||||
extern std::string MStatus;
|
extern std::string MStatus;
|
||||||
extern int ping;
|
extern int ping;
|
||||||
@ -104,7 +105,7 @@ std::string Parse(const std::string& Data){
|
|||||||
// Setup the TCP listening socket
|
// Setup the TCP listening socket
|
||||||
iResult = bind(ListenSocket, result->ai_addr, (int)result->ai_addrlen);
|
iResult = bind(ListenSocket, result->ai_addr, (int)result->ai_addrlen);
|
||||||
if (iResult == SOCKET_ERROR) {
|
if (iResult == SOCKET_ERROR) {
|
||||||
if(MPDEV)std::cout << "(Core) bind failed with error: " << WSAGetLastError() << std::endl;
|
if(MPDEV)Exit("(Core) bind failed with error: " + std::to_string(WSAGetLastError()));
|
||||||
freeaddrinfo(result);
|
freeaddrinfo(result);
|
||||||
closesocket(ListenSocket);
|
closesocket(ListenSocket);
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
|
10
main.cpp
10
main.cpp
@ -104,7 +104,8 @@ std::string Write(const std::string&Path){
|
|||||||
}
|
}
|
||||||
void RollBack(const std::string&Val){
|
void RollBack(const std::string&Val){
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(5));
|
std::this_thread::sleep_for(std::chrono::seconds(5));
|
||||||
Write(Val);
|
if(!Val.empty())Write(Val);
|
||||||
|
else Write(" ");
|
||||||
}
|
}
|
||||||
void StartGame(const std::string&ExeDir,const std::string&Current){
|
void StartGame(const std::string&ExeDir,const std::string&Current){
|
||||||
std::cout << "Game Launched!\n";
|
std::cout << "Game Launched!\n";
|
||||||
@ -118,6 +119,9 @@ 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{};
|
||||||
|
|
||||||
|
std::string ver = "0.90", Path = CheckDir(argv[0],ver),HTTP_Result;
|
||||||
|
CheckForUpdates(ver);
|
||||||
if(argc > 1){
|
if(argc > 1){
|
||||||
std::string Port = argv[1];
|
std::string Port = argv[1];
|
||||||
if(Port.find_first_not_of("0123456789") == NPos){
|
if(Port.find_first_not_of("0123456789") == NPos){
|
||||||
@ -125,13 +129,9 @@ int main(int argc, char* argv[])
|
|||||||
std::cout << "Running on custom port : " << DEFAULT_PORT << std::endl;
|
std::cout << "Running on custom port : " << DEFAULT_PORT << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string ver = "0.90", Path = CheckDir(argv[0],ver),HTTP_Result;
|
|
||||||
CheckForUpdates(ver);
|
|
||||||
|
|
||||||
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();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user