mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 00:59:44 -06:00
Add Discord Join Net Play functionally
This commit is contained in:
45
Source/Core/DolphinQt2/DiscordHandler.cpp
Normal file
45
Source/Core/DolphinQt2/DiscordHandler.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright 2018 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "DolphinQt2/DiscordHandler.h"
|
||||
|
||||
#include "Common/Thread.h"
|
||||
|
||||
#include "UICommon/DiscordPresence.h"
|
||||
|
||||
DiscordHandler::DiscordHandler() = default;
|
||||
|
||||
DiscordHandler::~DiscordHandler()
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
|
||||
void DiscordHandler::Start()
|
||||
{
|
||||
m_stop_requested.Set(false);
|
||||
m_thread = std::thread(&DiscordHandler::Run, this);
|
||||
}
|
||||
|
||||
void DiscordHandler::Stop()
|
||||
{
|
||||
m_stop_requested.Set(true);
|
||||
|
||||
if (m_thread.joinable())
|
||||
m_thread.join();
|
||||
}
|
||||
|
||||
void DiscordHandler::DiscordJoin()
|
||||
{
|
||||
emit DiscordHandler::Join();
|
||||
}
|
||||
|
||||
void DiscordHandler::Run()
|
||||
{
|
||||
while (!m_stop_requested.IsSet())
|
||||
{
|
||||
Common::SleepCurrentThread(1000 * 2);
|
||||
|
||||
Discord::CallPendingCallbacks();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user