mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-22 15:48:56 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ad92813fec | |||
| 8c7e28efb6 |
+8
-11
@@ -687,12 +687,17 @@ function(set_yuzu_qt_components)
|
|||||||
if (ENABLE_QT_TRANSLATION)
|
if (ENABLE_QT_TRANSLATION)
|
||||||
list(APPEND YUZU_QT_COMPONENTS2 LinguistTools)
|
list(APPEND YUZU_QT_COMPONENTS2 LinguistTools)
|
||||||
endif()
|
endif()
|
||||||
if (USE_DISCORD_PRESENCE)
|
|
||||||
list(APPEND YUZU_QT_COMPONENTS2 Network)
|
|
||||||
endif()
|
|
||||||
set(YUZU_QT_COMPONENTS ${YUZU_QT_COMPONENTS2} PARENT_SCOPE)
|
set(YUZU_QT_COMPONENTS ${YUZU_QT_COMPONENTS2} PARENT_SCOPE)
|
||||||
endfunction(set_yuzu_qt_components)
|
endfunction(set_yuzu_qt_components)
|
||||||
|
|
||||||
|
if(ENABLE_QT)
|
||||||
|
set_yuzu_qt_components()
|
||||||
|
find_package(Qt6 REQUIRED COMPONENTS ${YUZU_QT_COMPONENTS})
|
||||||
|
set(QT_MAJOR_VERSION 6)
|
||||||
|
# Qt6 sets cxx_std_17 and we need to undo that
|
||||||
|
set_target_properties(Qt6::Platform PROPERTIES INTERFACE_COMPILE_FEATURES "")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (UNIX AND NOT APPLE AND NOT ANDROID)
|
if (UNIX AND NOT APPLE AND NOT ANDROID)
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(LIBVA libva)
|
pkg_check_modules(LIBVA libva)
|
||||||
@@ -708,14 +713,6 @@ if (NOT (YUZU_USE_BUNDLED_FFMPEG OR YUZU_USE_EXTERNAL_FFMPEG))
|
|||||||
set_property(GLOBAL APPEND PROPERTY CPM_PACKAGE_URLS "https://github.com/FFmpeg/FFmpeg")
|
set_property(GLOBAL APPEND PROPERTY CPM_PACKAGE_URLS "https://github.com/FFmpeg/FFmpeg")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_QT)
|
|
||||||
set_yuzu_qt_components()
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS ${YUZU_QT_COMPONENTS})
|
|
||||||
set(QT_MAJOR_VERSION 6)
|
|
||||||
# Qt6 sets cxx_std_17 and we need to undo that
|
|
||||||
set_target_properties(Qt6::Platform PROPERTIES INTERFACE_COMPILE_FEATURES "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (WIN32 AND YUZU_CRASH_DUMPS)
|
if (WIN32 AND YUZU_CRASH_DUMPS)
|
||||||
set(BREAKPAD_VER "breakpad-c89f9dd")
|
set(BREAKPAD_VER "breakpad-c89f9dd")
|
||||||
download_bundled_external("breakpad/" ${BREAKPAD_VER} "breakpad-win" BREAKPAD_PREFIX "c89f9dd")
|
download_bundled_external("breakpad/" ${BREAKPAD_VER} "breakpad-win" BREAKPAD_PREFIX "c89f9dd")
|
||||||
|
|||||||
@@ -10,10 +10,6 @@
|
|||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#ifndef CPPHTTPLIB_OPENSSL_SUPPORT
|
|
||||||
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <httplib.h>
|
#include <httplib.h>
|
||||||
|
|
||||||
#ifdef YUZU_BUNDLED_OPENSSL
|
#ifdef YUZU_BUNDLED_OPENSSL
|
||||||
|
|||||||
@@ -36,7 +36,11 @@ if (USE_DISCORD_PRESENCE)
|
|||||||
discord/discord_impl.cpp
|
discord/discord_impl.cpp
|
||||||
discord/discord_impl.h
|
discord/discord_impl.h
|
||||||
)
|
)
|
||||||
target_link_libraries(qt_common PUBLIC DiscordRPC::discord-rpc Qt6::Network)
|
target_link_libraries(qt_common PUBLIC DiscordRPC::discord-rpc httplib::httplib)
|
||||||
|
if (YUZU_USE_BUNDLED_OPENSSL)
|
||||||
|
target_link_libraries(qt_common PUBLIC OpenSSL::SSL)
|
||||||
|
target_compile_definitions(qt_common PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT)
|
||||||
|
endif()
|
||||||
target_compile_definitions(qt_common PUBLIC USE_DISCORD_PRESENCE)
|
target_compile_definitions(qt_common PUBLIC USE_DISCORD_PRESENCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
#include <QNetworkAccessManager>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <QNetworkReply>
|
#include <httplib.h>
|
||||||
|
|
||||||
#include <discord_rpc.h>
|
#include <discord_rpc.h>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
@@ -18,7 +18,12 @@
|
|||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
#include "qt_common/discord/discord_impl.h"
|
|
||||||
|
#include "discord_impl.h"
|
||||||
|
|
||||||
|
#ifdef YUZU_BUNDLED_OPENSSL
|
||||||
|
#include <openssl/cert.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace DiscordRPC {
|
namespace DiscordRPC {
|
||||||
|
|
||||||
@@ -44,6 +49,7 @@ std::string DiscordImpl::GetGameString(const std::string& title) {
|
|||||||
|
|
||||||
// Replace spaces with dashes
|
// Replace spaces with dashes
|
||||||
std::replace(icon_name.begin(), icon_name.end(), ' ', '-');
|
std::replace(icon_name.begin(), icon_name.end(), ' ', '-');
|
||||||
|
boost::replace_all(icon_name, "é", "e");
|
||||||
|
|
||||||
// Remove non-alphanumeric characters but keep dashes
|
// Remove non-alphanumeric characters but keep dashes
|
||||||
std::erase_if(icon_name, [](char c) { return !std::isalnum(c) && c != '-'; });
|
std::erase_if(icon_name, [](char c) { return !std::isalnum(c) && c != '-'; });
|
||||||
@@ -97,15 +103,22 @@ void DiscordImpl::Update() {
|
|||||||
"https://raw.githubusercontent.com/eden-emulator/boxart/refs/heads/master/img/{}.png",
|
"https://raw.githubusercontent.com/eden-emulator/boxart/refs/heads/master/img/{}.png",
|
||||||
icon_name);
|
icon_name);
|
||||||
|
|
||||||
QNetworkAccessManager manager;
|
httplib::SSLClient client(game_url);
|
||||||
QNetworkRequest request;
|
client.set_connection_timeout(3);
|
||||||
request.setUrl(QUrl(QString::fromStdString(game_url)));
|
client.set_read_timeout(3);
|
||||||
request.setTransferTimeout(3000);
|
client.set_follow_location(true);
|
||||||
QNetworkReply* reply = manager.head(request);
|
|
||||||
QEventLoop request_event_loop;
|
#ifdef YUZU_BUNDLED_OPENSSL
|
||||||
reply->connect(reply, &QNetworkReply::finished, &request_event_loop, &QEventLoop::quit);
|
client.load_ca_cert_store(kCert, sizeof(kCert));
|
||||||
request_event_loop.exec();
|
#endif
|
||||||
UpdateGameStatus(reply->error());
|
|
||||||
|
httplib::Request request{
|
||||||
|
.method = "HEAD",
|
||||||
|
.path = game_url,
|
||||||
|
};
|
||||||
|
|
||||||
|
auto res = client.send(request);
|
||||||
|
UpdateGameStatus(res && res->status == 200);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user