mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-03 16:37:11 +00:00
- add message for two launcher open with no game process
This commit is contained in:
parent
b233778ae0
commit
cc1c0d4a48
@ -106,7 +106,13 @@ void Launcher::LaunchGame() {
|
|||||||
<< "BeamNG V" << BeamVersion
|
<< "BeamNG V" << BeamVersion
|
||||||
<< " is slightly older than recommended, this might cause issues!";
|
<< " is slightly older than recommended, this might cause issues!";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Memory::GetBeamNGPID({}) == 0) {
|
if (Memory::GetBeamNGPID({}) == 0) {
|
||||||
|
if(Memory::GetLauncherPID({GetCurrentProcessId()}) != 0) {
|
||||||
|
Abort();
|
||||||
|
LOG(ERROR) << "Two launchers are open with no game process";
|
||||||
|
return;
|
||||||
|
}
|
||||||
LOG(INFO) << "Launching BeamNG from steam";
|
LOG(INFO) << "Launching BeamNG from steam";
|
||||||
ShellExecuteA(nullptr, nullptr, "steam://rungameid/284160", nullptr,
|
ShellExecuteA(nullptr, nullptr, "steam://rungameid/284160", nullptr,
|
||||||
nullptr, SW_SHOWNORMAL);
|
nullptr, SW_SHOWNORMAL);
|
||||||
@ -119,12 +125,8 @@ void Launcher::LaunchGame() {
|
|||||||
void Launcher::WaitForGame() {
|
void Launcher::WaitForGame() {
|
||||||
std::set<uint32_t> BlackList;
|
std::set<uint32_t> BlackList;
|
||||||
int chan = 1;
|
int chan = 1;
|
||||||
do {
|
while (GamePID == 0 && !Shutdown.load()) {
|
||||||
auto PID = Memory::GetBeamNGPID(BlackList);
|
auto PID = Memory::GetBeamNGPID(BlackList);
|
||||||
if(PID == 0 && BlackList.empty() && Memory::GetLauncherPID({GetCurrentProcessId()})) {
|
|
||||||
Shutdown.store(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (PID != 0 && IPC::mem_used(PID)) {
|
if (PID != 0 && IPC::mem_used(PID)) {
|
||||||
BlackList.emplace(PID);
|
BlackList.emplace(PID);
|
||||||
LOG(INFO) << "Skipping Channel #" << chan++;
|
LOG(INFO) << "Skipping Channel #" << chan++;
|
||||||
@ -132,7 +134,7 @@ void Launcher::WaitForGame() {
|
|||||||
GamePID = PID;
|
GamePID = PID;
|
||||||
}
|
}
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
} while (GamePID == 0 && !Shutdown.load());
|
}
|
||||||
if (Shutdown.load()) return;
|
if (Shutdown.load()) return;
|
||||||
|
|
||||||
if (GamePID == 0) {
|
if (GamePID == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user