citra-emu
/
citra
Archived
1
0
Fork 0

Merge branch 'master' of github.com:citra-emu/citra into ips-patches

This commit is contained in:
Zak Kurka 2018-10-20 18:11:38 -05:00
commit 261dc33507
21 changed files with 42 additions and 52 deletions

View File

@ -255,13 +255,6 @@ if (ENABLE_QT)
endif() endif()
endif() endif()
if (ENABLE_WEB_SERVICE)
add_definitions(-DENABLE_WEB_SERVICE)
endif()
if (CITRA_ENABLE_COMPATIBILITY_REPORTING)
add_definitions(-DCITRA_ENABLE_COMPATIBILITY_REPORTING)
endif()
if (ENABLE_SCRIPTING) if (ENABLE_SCRIPTING)
add_definitions(-DENABLE_SCRIPTING) add_definitions(-DENABLE_SCRIPTING)
endif() endif()

View File

@ -71,19 +71,19 @@ endif()
# DiscordRPC # DiscordRPC
if (USE_DISCORD_PRESENCE) if (USE_DISCORD_PRESENCE)
add_subdirectory(discord-rpc) add_subdirectory(discord-rpc EXCLUDE_FROM_ALL)
target_include_directories(discord-rpc INTERFACE ./discord-rpc/include) target_include_directories(discord-rpc INTERFACE ./discord-rpc/include)
endif() endif()
if (ENABLE_WEB_SERVICE) if (ENABLE_WEB_SERVICE)
# LibreSSL # LibreSSL
set(LIBRESSL_SKIP_INSTALL ON CACHE BOOL "") set(LIBRESSL_SKIP_INSTALL ON CACHE BOOL "")
add_definitions(-DHAVE_INET_NTOP) add_subdirectory(libressl EXCLUDE_FROM_ALL)
add_subdirectory(libressl)
target_include_directories(ssl INTERFACE ./libressl/include) target_include_directories(ssl INTERFACE ./libressl/include)
target_compile_definitions(ssl PRIVATE -DHAVE_INET_NTOP)
# lurlparser # lurlparser
add_subdirectory(lurlparser) add_subdirectory(lurlparser EXCLUDE_FROM_ALL)
# httplib # httplib
add_library(httplib INTERFACE) add_library(httplib INTERFACE)

View File

@ -248,7 +248,7 @@ enable_telemetry =
# URL for Web API # URL for Web API
web_api_url = https://api.citra-emu.org web_api_url = https://api.citra-emu.org
# Username and token for Citra Web Service # Username and token for Citra Web Service
# See https://services.citra-emu.org/ for more info # See https://profile.citra-emu.org/ for more info
citra_username = citra_username =
citra_token = citra_token =
)"; )";

View File

@ -208,6 +208,10 @@ target_link_libraries(citra-qt PRIVATE audio_core common core input_common netwo
target_link_libraries(citra-qt PRIVATE Boost::boost glad nihstro-headers Qt5::OpenGL Qt5::Widgets Qt5::Multimedia) target_link_libraries(citra-qt PRIVATE Boost::boost glad nihstro-headers Qt5::OpenGL Qt5::Widgets Qt5::Multimedia)
target_link_libraries(citra-qt PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) target_link_libraries(citra-qt PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
if (CITRA_ENABLE_COMPATIBILITY_REPORTING)
add_definitions(-DCITRA_ENABLE_COMPATIBILITY_REPORTING)
endif()
if (USE_DISCORD_PRESENCE) if (USE_DISCORD_PRESENCE)
target_sources(citra-qt PUBLIC target_sources(citra-qt PUBLIC
discord_impl.cpp discord_impl.cpp

View File

@ -25,7 +25,11 @@ CompatDB::CompatDB(QWidget* parent)
CompatDB::~CompatDB() = default; CompatDB::~CompatDB() = default;
enum class CompatDBPage { Intro = 0, Selection = 1, Final = 2 }; enum class CompatDBPage {
Intro = 0,
Selection = 1,
Final = 2,
};
void CompatDB::Submit() { void CompatDB::Submit() {
QButtonGroup* compatibility = new QButtonGroup(this); QButtonGroup* compatibility = new QButtonGroup(this);

View File

@ -21,7 +21,6 @@ public:
private: private:
std::unique_ptr<Ui::CompatDB> ui; std::unique_ptr<Ui::CompatDB> ui;
private slots:
void Submit(); void Submit();
void EnableNext(); void EnableNext();
}; };

View File

@ -25,7 +25,7 @@ ConfigureWeb::ConfigureWeb(QWidget* parent)
this->setConfiguration(); this->setConfiguration();
} }
ConfigureWeb::~ConfigureWeb() {} ConfigureWeb::~ConfigureWeb() = default;
void ConfigureWeb::setConfiguration() { void ConfigureWeb::setConfiguration() {
ui->web_credentials_disclaimer->setWordWrap(true); ui->web_credentials_disclaimer->setWordWrap(true);
@ -38,7 +38,7 @@ void ConfigureWeb::setConfiguration() {
ui->web_signup_link->setOpenExternalLinks(true); ui->web_signup_link->setOpenExternalLinks(true);
ui->web_signup_link->setText( ui->web_signup_link->setText(
tr("<a href='https://services.citra-emu.org/'><span style=\"text-decoration: underline; " tr("<a href='https://profile.citra-emu.org/'><span style=\"text-decoration: underline; "
"color:#039be5;\">Sign up</span></a>")); "color:#039be5;\">Sign up</span></a>"));
ui->web_token_info_link->setOpenExternalLinks(true); ui->web_token_info_link->setOpenExternalLinks(true);
ui->web_token_info_link->setText( ui->web_token_info_link->setText(

View File

@ -11,7 +11,7 @@ namespace DiscordRPC {
class DiscordImpl : public DiscordInterface { class DiscordImpl : public DiscordInterface {
public: public:
DiscordImpl(); DiscordImpl();
~DiscordImpl(); ~DiscordImpl() override;
void Pause() override; void Pause() override;
void Update() override; void Update() override;

View File

@ -92,7 +92,7 @@ void GMainWindow::ShowTelemetryCallout() {
} }
UISettings::values.callout_flags |= static_cast<uint32_t>(CalloutFlag::Telemetry); UISettings::values.callout_flags |= static_cast<uint32_t>(CalloutFlag::Telemetry);
static const QString telemetry_message = const QString telemetry_message =
tr("<a href='https://citra-emu.org/entry/telemetry-and-why-thats-a-good-thing/'>Anonymous " tr("<a href='https://citra-emu.org/entry/telemetry-and-why-thats-a-good-thing/'>Anonymous "
"data is collected</a> to help improve Citra. " "data is collected</a> to help improve Citra. "
"<br/><br/>Would you like to share your usage data with us?"); "<br/><br/>Would you like to share your usage data with us?");

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once #pragma once
#include <condition_variable> #include <condition_variable>
#include <functional> #include <functional>

View File

@ -445,7 +445,8 @@ create_target_directory_groups(core)
target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core) target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core)
target_link_libraries(core PUBLIC Boost::boost PRIVATE cryptopp fmt open_source_archives) target_link_libraries(core PUBLIC Boost::boost PRIVATE cryptopp fmt open_source_archives)
if (ENABLE_WEB_SERVICE) if (ENABLE_WEB_SERVICE)
target_link_libraries(core PUBLIC json-headers web_service) target_compile_definitions(core PRIVATE -DENABLE_WEB_SERVICE)
target_link_libraries(core PRIVATE json-headers web_service)
endif() endif()
if (ARCHITECTURE_x86_64) if (ARCHITECTURE_x86_64)

View File

@ -82,7 +82,7 @@ u64 RegenerateTelemetryId() {
return new_telemetry_id; return new_telemetry_id;
} }
bool VerifyLogin(std::string username, std::string token) { bool VerifyLogin(const std::string& username, const std::string& token) {
#ifdef ENABLE_WEB_SERVICE #ifdef ENABLE_WEB_SERVICE
return WebService::VerifyLogin(Settings::values.web_api_url, username, token); return WebService::VerifyLogin(Settings::values.web_api_url, username, token);
#else #else

View File

@ -56,6 +56,6 @@ u64 RegenerateTelemetryId();
* @param func A function that gets exectued when the verification is finished * @param func A function that gets exectued when the verification is finished
* @returns Future with bool indicating whether the verification succeeded * @returns Future with bool indicating whether the verification succeeded
*/ */
bool VerifyLogin(std::string username, std::string token); bool VerifyLogin(const std::string& username, const std::string& token);
} // namespace Core } // namespace Core

View File

@ -14,5 +14,5 @@ create_target_directory_groups(web_service)
get_directory_property(OPENSSL_LIBS get_directory_property(OPENSSL_LIBS
DIRECTORY ${CMAKE_SOURCE_DIR}/externals/libressl DIRECTORY ${CMAKE_SOURCE_DIR}/externals/libressl
DEFINITION OPENSSL_LIBS) DEFINITION OPENSSL_LIBS)
add_definitions(-DCPPHTTPLIB_OPENSSL_SUPPORT) target_compile_definitions(web_service PRIVATE -DCPPHTTPLIB_OPENSSL_SUPPORT)
target_link_libraries(web_service PUBLIC common json-headers ${OPENSSL_LIBS} httplib lurlparser) target_link_libraries(web_service PRIVATE common json-headers ${OPENSSL_LIBS} httplib lurlparser)

View File

@ -3,10 +3,10 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <future> #include <future>
#include <json.hpp>
#include "common/detached_tasks.h" #include "common/detached_tasks.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "web_service/announce_room_json.h" #include "web_service/announce_room_json.h"
#include "web_service/json.h"
#include "web_service/web_backend.h" #include "web_service/web_backend.h"
namespace AnnounceMultiplayerRoom { namespace AnnounceMultiplayerRoom {

View File

@ -1,18 +0,0 @@
// Copyright 2018 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
// This hack is needed to support json.hpp on platforms where the C++17 stdlib
// lacks std::string_view. See https://github.com/nlohmann/json/issues/735.
// clang-format off
#if !__has_include(<string_view>) && __has_include(<experimental/string_view>)
# include <experimental/string_view>
# define string_view experimental::string_view
# include <json.hpp>
# undef string_view
#else
# include <json.hpp>
#endif
// clang-format on

View File

@ -10,6 +10,11 @@
namespace WebService { namespace WebService {
TelemetryJson::TelemetryJson(const std::string& host, const std::string& username,
const std::string& token)
: host(std::move(host)), username(std::move(username)), token(std::move(token)) {}
TelemetryJson::~TelemetryJson() = default;
template <class T> template <class T>
void TelemetryJson::Serialize(Telemetry::FieldType type, const std::string& name, T value) { void TelemetryJson::Serialize(Telemetry::FieldType type, const std::string& name, T value) {
sections[static_cast<u8>(type)][name] = value; sections[static_cast<u8>(type)][name] = value;

View File

@ -6,9 +6,9 @@
#include <array> #include <array>
#include <string> #include <string>
#include <json.hpp>
#include "common/announce_multiplayer_room.h" #include "common/announce_multiplayer_room.h"
#include "common/telemetry.h" #include "common/telemetry.h"
#include "web_service/json.h"
namespace WebService { namespace WebService {
@ -18,9 +18,8 @@ namespace WebService {
*/ */
class TelemetryJson : public Telemetry::VisitorInterface { class TelemetryJson : public Telemetry::VisitorInterface {
public: public:
TelemetryJson(const std::string& host, const std::string& username, const std::string& token) TelemetryJson(const std::string& host, const std::string& username, const std::string& token);
: host(host), username(username), token(token) {} ~TelemetryJson();
~TelemetryJson() = default;
void Visit(const Telemetry::Field<bool>& field) override; void Visit(const Telemetry::Field<bool>& field) override;
void Visit(const Telemetry::Field<double>& field) override; void Visit(const Telemetry::Field<double>& field) override;

View File

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "web_service/json.h" #include <json.hpp>
#include "web_service/verify_login.h" #include "web_service/verify_login.h"
#include "web_service/web_backend.h" #include "web_service/web_backend.h"

View File

@ -6,19 +6,19 @@
#include <string> #include <string>
#include <thread> #include <thread>
#include <LUrlParser.h> #include <LUrlParser.h>
#include <httplib.h>
#include "common/announce_multiplayer_room.h" #include "common/announce_multiplayer_room.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/settings.h"
#include "web_service/web_backend.h" #include "web_service/web_backend.h"
namespace WebService { namespace WebService {
static constexpr char API_VERSION[]{"1"}; constexpr std::array<const char, 1> API_VERSION{'1'};
constexpr int HTTP_PORT = 80; constexpr int HTTP_PORT = 80;
constexpr int HTTPS_PORT = 443; constexpr int HTTPS_PORT = 443;
constexpr int TIMEOUT_SECONDS = 30; constexpr std::size_t TIMEOUT_SECONDS = 30;
Client::JWTCache Client::jwt_cache{}; Client::JWTCache Client::jwt_cache{};
@ -30,6 +30,8 @@ Client::Client(const std::string& host, const std::string& username, const std::
} }
} }
Client::~Client() = default;
Common::WebResult Client::GenericJson(const std::string& method, const std::string& path, Common::WebResult Client::GenericJson(const std::string& method, const std::string& path,
const std::string& data, const std::string& jwt, const std::string& data, const std::string& jwt,
const std::string& username, const std::string& token) { const std::string& username, const std::string& token) {
@ -70,7 +72,7 @@ Common::WebResult Client::GenericJson(const std::string& method, const std::stri
}; };
} }
params.emplace(std::string("api-version"), std::string(API_VERSION)); params.emplace(std::string("api-version"), std::string(API_VERSION.begin(), API_VERSION.end()));
if (method != "GET") { if (method != "GET") {
params.emplace(std::string("Content-Type"), std::string("application/json")); params.emplace(std::string("Content-Type"), std::string("application/json"));
}; };

View File

@ -8,7 +8,6 @@
#include <mutex> #include <mutex>
#include <string> #include <string>
#include <tuple> #include <tuple>
#include <httplib.h>
#include "common/announce_multiplayer_room.h" #include "common/announce_multiplayer_room.h"
#include "common/common_types.h" #include "common/common_types.h"
@ -21,6 +20,7 @@ namespace WebService {
class Client { class Client {
public: public:
Client(const std::string& host, const std::string& username, const std::string& token); Client(const std::string& host, const std::string& username, const std::string& token);
~Client();
/** /**
* Posts JSON to the specified path. * Posts JSON to the specified path.