Disabled discord since it randomly crashes smh

This commit is contained in:
Anonymous275
2022-01-19 23:08:37 +02:00
parent 2b73c120a8
commit 09b18a40c5
3 changed files with 10 additions and 5 deletions
+1
View File
@@ -49,6 +49,7 @@ private: //functions
private: //variables private: //variables
uint32_t GamePID{0}; uint32_t GamePID{0};
bool EnableUI = true; bool EnableUI = true;
int64_t DiscordTime{};
bool LoginAuth = false; bool LoginAuth = false;
fs::path CurrentPath{}; fs::path CurrentPath{};
std::string BeamRoot{}; std::string BeamRoot{};
+3 -5
View File
@@ -8,21 +8,19 @@
#include "Logger.h" #include "Logger.h"
void Launcher::RichPresence() { void Launcher::RichPresence() {
Discord_Initialize("629743237988352010", nullptr, 1,nullptr); Discord_Initialize("629743237988352010", nullptr, 1, nullptr);
int64_t Start{};
while(!Shutdown.load()) { while(!Shutdown.load()) {
DiscordRichPresence discordPresence; DiscordRichPresence discordPresence;
memset(&discordPresence, 0, sizeof(discordPresence)); memset(&discordPresence, 0, sizeof(discordPresence));
discordPresence.state = DiscordMessage.c_str(); discordPresence.state = DiscordMessage.c_str();
discordPresence.startTimestamp = Start; discordPresence.startTimestamp = DiscordTime;
discordPresence.largeImageKey = "mainlogo"; discordPresence.largeImageKey = "mainlogo";
Discord_UpdatePresence(&discordPresence); Discord_UpdatePresence(&discordPresence);
Discord_RunCallbacks();
std::this_thread::sleep_for(std::chrono::seconds(1)); std::this_thread::sleep_for(std::chrono::seconds(1));
} }
Discord_ClearPresence(); Discord_ClearPresence();
} }
void Launcher::RunDiscordRPC() { void Launcher::RunDiscordRPC() {
DiscordRPC = std::thread(&Launcher::RichPresence, this); //DiscordRPC = std::thread(&Launcher::RichPresence, this);
} }
+6
View File
@@ -10,10 +10,16 @@
#include <windows.h> #include <windows.h>
#include <shellapi.h> #include <shellapi.h>
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::Launcher(int argc, char* argv[]) : CurrentPath(std::filesystem::path(argv[0])), DiscordMessage("Just launched") {
Launcher::StaticAbort(this); Launcher::StaticAbort(this);
Log::Init(); Log::Init();
WindowsInit(); WindowsInit();
SetUnhandledExceptionFilter(CrashHandler);
LOG(INFO) << "Starting Launcher V" << FullVersion; LOG(INFO) << "Starting Launcher V" << FullVersion;
UpdateCheck(); UpdateCheck();
} }