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);
|
||||
void SyncResources(const std::string& IP, int port);
|
||||
void Exit(const std::string& Msg);
|
||||
extern std::string UlStatus;
|
||||
extern std::string MStatus;
|
||||
extern int ping;
|
||||
@ -104,7 +105,7 @@ std::string Parse(const std::string& Data){
|
||||
// Setup the TCP listening socket
|
||||
iResult = bind(ListenSocket, result->ai_addr, (int)result->ai_addrlen);
|
||||
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);
|
||||
closesocket(ListenSocket);
|
||||
WSACleanup();
|
||||
|
10
main.cpp
10
main.cpp
@ -104,7 +104,8 @@ std::string Write(const std::string&Path){
|
||||
}
|
||||
void RollBack(const std::string&Val){
|
||||
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){
|
||||
std::cout << "Game Launched!\n";
|
||||
@ -118,6 +119,9 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
const unsigned long long NPos = std::string::npos;
|
||||
struct stat info{};
|
||||
|
||||
std::string ver = "0.90", Path = CheckDir(argv[0],ver),HTTP_Result;
|
||||
CheckForUpdates(ver);
|
||||
if(argc > 1){
|
||||
std::string Port = argv[1];
|
||||
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::string ver = "0.90", Path = CheckDir(argv[0],ver),HTTP_Result;
|
||||
CheckForUpdates(ver);
|
||||
|
||||
std::thread t1(Discord_Main);
|
||||
t1.detach();
|
||||
|
||||
|
||||
std::cout << "Connecting to discord client..." << std::endl;
|
||||
while(GlobalInfo.empty()){
|
||||
GlobalInfo = GetDiscordInfo();
|
||||
|
Loading…
x
Reference in New Issue
Block a user