From 09b18a40c5c2655c17e0515210f325ba6730ee39 Mon Sep 17 00:00:00 2001 From: Anonymous275 <36374260+Anonymous-275@users.noreply.github.com> Date: Wed, 19 Jan 2022 23:08:37 +0200 Subject: [PATCH] Disabled discord since it randomly crashes smh --- include/Launcher.h | 1 + src/Discord.cpp | 8 +++----- src/Launcher.cpp | 6 ++++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/Launcher.h b/include/Launcher.h index 4092ed9..cb70259 100644 --- a/include/Launcher.h +++ b/include/Launcher.h @@ -49,6 +49,7 @@ private: //functions private: //variables uint32_t GamePID{0}; bool EnableUI = true; + int64_t DiscordTime{}; bool LoginAuth = false; fs::path CurrentPath{}; std::string BeamRoot{}; diff --git a/src/Discord.cpp b/src/Discord.cpp index 8a719a0..d753ce5 100644 --- a/src/Discord.cpp +++ b/src/Discord.cpp @@ -8,21 +8,19 @@ #include "Logger.h" void Launcher::RichPresence() { - Discord_Initialize("629743237988352010", nullptr, 1,nullptr); - int64_t Start{}; + Discord_Initialize("629743237988352010", nullptr, 1, nullptr); while(!Shutdown.load()) { DiscordRichPresence discordPresence; memset(&discordPresence, 0, sizeof(discordPresence)); discordPresence.state = DiscordMessage.c_str(); - discordPresence.startTimestamp = Start; + discordPresence.startTimestamp = DiscordTime; discordPresence.largeImageKey = "mainlogo"; Discord_UpdatePresence(&discordPresence); - Discord_RunCallbacks(); std::this_thread::sleep_for(std::chrono::seconds(1)); } Discord_ClearPresence(); } void Launcher::RunDiscordRPC() { - DiscordRPC = std::thread(&Launcher::RichPresence, this); + //DiscordRPC = std::thread(&Launcher::RichPresence, this); } \ No newline at end of file diff --git a/src/Launcher.cpp b/src/Launcher.cpp index 7baedd6..efe285b 100644 --- a/src/Launcher.cpp +++ b/src/Launcher.cpp @@ -10,10 +10,16 @@ #include #include +LONG WINAPI CrashHandler(EXCEPTION_POINTERS* p) { + LOG(ERROR) << "CAUGHT EXCEPTION! Code " << p->ExceptionRecord->ExceptionCode; + return EXCEPTION_EXECUTE_HANDLER; +} + Launcher::Launcher(int argc, char* argv[]) : CurrentPath(std::filesystem::path(argv[0])), DiscordMessage("Just launched") { Launcher::StaticAbort(this); Log::Init(); WindowsInit(); + SetUnhandledExceptionFilter(CrashHandler); LOG(INFO) << "Starting Launcher V" << FullVersion; UpdateCheck(); }