- debug state

- new fail message from pull/58
This commit is contained in:
Anonymous-275
2023-08-04 20:57:52 +01:00
parent a504114809
commit f1d960d062
5 changed files with 38 additions and 19 deletions
+1
View File
@@ -79,6 +79,7 @@ class Launcher {
fs::path LauncherCache{"Resources"}; fs::path LauncherCache{"Resources"};
int64_t DiscordTime{}; int64_t DiscordTime{};
bool LoginAuth = false; bool LoginAuth = false;
bool DebugMode = false;
fs::path CurrentPath{}; fs::path CurrentPath{};
std::string BeamRoot{}; std::string BeamRoot{};
std::string UserRole{}; std::string UserRole{};
+1
View File
@@ -15,6 +15,7 @@ class Memory {
static uint64_t GetModuleBase(const char* Name); static uint64_t GetModuleBase(const char* Name);
static void Print(const std::string& msg); static void Print(const std::string& msg);
static std::string GetHex(uint64_t num); static std::string GetHex(uint64_t num);
static inline bool DebugMode = false;
static void Inject(uint32_t PID); static void Inject(uint32_t PID);
static uint32_t GetTickCount(); static uint32_t GetTickCount();
static uint32_t EntryPoint(); static uint32_t EntryPoint();
+9 -2
View File
@@ -32,8 +32,15 @@ Launcher::Launcher(int argc, char* argv[]) :
WindowsInit(); WindowsInit();
SetUnhandledExceptionFilter(CrashHandler); SetUnhandledExceptionFilter(CrashHandler);
LOG(INFO) << "Starting Launcher v" << FullVersion; LOG(INFO) << "Starting Launcher v" << FullVersion;
if (argc > 1) LoadConfig(fs::current_path() / argv[1]); if (argc > 1) {
else LoadConfig(fs::current_path() / "Launcher.toml"); if(std::string(argv[1]).find('0') != std::string::npos) {
DebugMode = true;
Memory::DebugMode = true;
LoadConfig(fs::current_path() / "Launcher.toml");
} else {
LoadConfig(fs::current_path() / argv[1]);
}
} else LoadConfig(fs::current_path() / "Launcher.toml");
} }
void Launcher::Abort() { void Launcher::Abort() {
+2
View File
@@ -171,8 +171,10 @@ void Memory::Print(const std::string& msg) {
} }
uint32_t Memory::EntryPoint() { uint32_t Memory::EntryPoint() {
if (Memory::DebugMode) {
AllocConsole(); AllocConsole();
SetConsoleTitleA("BeamMP Console"); SetConsoleTitleA("BeamMP Console");
}
BeamNG::EntryPoint(); BeamNG::EntryPoint();
return 0; return 0;
} }
+8
View File
@@ -41,6 +41,7 @@ size_t DirCount(const std::filesystem::path& path) {
} }
void Launcher::ResetMods() { void Launcher::ResetMods() {
try {
if (!fs::exists(MPUserPath)) { if (!fs::exists(MPUserPath)) {
fs::create_directories(MPUserPath); fs::create_directories(MPUserPath);
return; return;
@@ -55,6 +56,9 @@ void Launcher::ResetMods() {
std::filesystem::remove(de.path()); std::filesystem::remove(de.path());
} }
} }
} catch (...) {
throw ShutdownException("We were unable to clean the multiplayer mods folder! Is the game still running or do you have something open in that folder?");
}
} }
void Launcher::EnableMP() { void Launcher::EnableMP() {
@@ -103,6 +107,10 @@ void Launcher::SetupMOD() {
} }
void Launcher::UpdateCheck() { void Launcher::UpdateCheck() {
if(DebugMode){
LOG(DEBUG) << "Debug mode active skipping update checks";
return;
}
std::string LatestHash = HTTP::Get("https://backend.beammp.com/sha/launcher?branch=" + TargetBuild + "&pk=" + PublicKey); std::string LatestHash = HTTP::Get("https://backend.beammp.com/sha/launcher?branch=" + TargetBuild + "&pk=" + PublicKey);
transform(LatestHash.begin(), LatestHash.end(), LatestHash.begin(), ::tolower); transform(LatestHash.begin(), LatestHash.end(), LatestHash.begin(), ::tolower);