diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index e6faa88ce..87d5a8082 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -328,3 +328,7 @@ endif()
if (CITRA_USE_PRECOMPILED_HEADERS)
target_precompile_headers(citra_qt PRIVATE precompiled_headers.h)
endif()
+
+if (ENABLE_RETROACHIEVEMENTS)
+ target_link_libraries(citra_qt PRIVATE rcheevos_integration)
+endif()
diff --git a/src/citra_qt/configuration/configure_general.cpp b/src/citra_qt/configuration/configure_general.cpp
index ca548b21b..a9d72a94f 100644
--- a/src/citra_qt/configuration/configure_general.cpp
+++ b/src/citra_qt/configuration/configure_general.cpp
@@ -11,6 +11,10 @@
#include "citra_qt/uisettings.h"
#include "common/file_util.h"
#include "common/settings.h"
+#include "core/core.h"
+#ifdef ENABLE_RETROACHIEVEMENTS
+#include "rcheevos_integration/rcheevos_integration.h"
+#endif
#include "ui_configure_general.h"
// The QSlider doesn't have an easy way to set a custom step amount,
@@ -47,6 +51,10 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
ui->updates_group->setVisible(false);
#endif
+#ifndef ENABLE_RETROACHIEVEMENTS
+ ui->retro_achievements_group->setVisible(false);
+#endif
+
SetupPerGameUI();
SetConfiguration();
@@ -74,6 +82,9 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
}
ui->change_screenshot_dir->setEnabled(true);
});
+
+ connect(ui->retro_achievements_log_in_button, &QPushButton::clicked, this,
+ &ConfigureGeneral::RetroAchievementsLogIn);
}
ConfigureGeneral::~ConfigureGeneral() = default;
@@ -196,6 +207,15 @@ void ConfigureGeneral::RetranslateUI() {
ui->retranslateUi(this);
}
+void ConfigureGeneral::RetroAchievementsLogIn() {
+#ifdef ENABLE_RETROACHIEVEMENTS
+ std::string username = ui->retro_achievements_username_input->text().toStdString(),
+ password = ui->retro_achievements_password_input->text().toStdString();
+
+ Core::System::GetInstance().GetRcheevosClient().LogInRetroachievementsUser(username.c_str(), password.c_str());
+#endif
+}
+
void ConfigureGeneral::SetupPerGameUI() {
if (Settings::IsConfiguringGlobal()) {
ui->frame_limit->setEnabled(Settings::values.frame_limit.UsingGlobal());
diff --git a/src/citra_qt/configuration/configure_general.h b/src/citra_qt/configuration/configure_general.h
index 93a855387..6817506b4 100644
--- a/src/citra_qt/configuration/configure_general.h
+++ b/src/citra_qt/configuration/configure_general.h
@@ -24,6 +24,7 @@ public:
void ApplyConfiguration();
void RetranslateUI();
void SetConfiguration();
+ void RetroAchievementsLogIn();
void SetupPerGameUI();
diff --git a/src/citra_qt/configuration/configure_general.ui b/src/citra_qt/configuration/configure_general.ui
index 1c4a05631..01f440eba 100644
--- a/src/citra_qt/configuration/configure_general.ui
+++ b/src/citra_qt/configuration/configure_general.ui
@@ -295,7 +295,7 @@
-
-
+
Save Screenshots To
@@ -317,6 +317,78 @@
+ -
+
+
+ RetroAchievements
+
+
+
-
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ Username
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ Password
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+ Log In
+
+
+
+
+
+
-
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index a0d4d77e5..25e9c86b1 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -506,6 +506,7 @@ target_link_libraries(citra_core PUBLIC dds-ktx PRIVATE cryptopp fmt lodepng ope
if (ENABLE_RETROACHIEVEMENTS)
target_link_libraries(citra_core PUBLIC rcheevos_integration)
+ target_compile_definitions(citra_core PUBLIC ENABLE_RETROACHIEVEMENTS)
endif()
if (ENABLE_WEB_SERVICE)
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 64863d6ed..d788eca4e 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -50,6 +50,9 @@
#include "core/rpc/server.h"
#endif
#include "network/network.h"
+#ifdef ENABLE_RETROACHIEVEMENTS
+#include "rcheevos_integration/rcheevos_integration.h"
+#endif
#include "video_core/custom_textures/custom_tex_manager.h"
#include "video_core/gpu.h"
#include "video_core/renderer_base.h"
@@ -73,11 +76,12 @@ Core::Timing& Global() {
return System::GetInstance().CoreTiming();
}
-System::System() : movie{*this}, cheat_engine{*this}
+System::System() : movie{*this}, cheat_engine{*this} {
#ifdef ENABLE_RETROACHIEVEMENTS
- , rcheevos_client{*this}
+ rcheevos_client = std::make_unique(*this);
+ rcheevos_client->InitializeClient();
#endif
-{}
+}
System::~System() = default;
@@ -595,11 +599,6 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window,
plg_ldr->SetAllowGameChangeState(Settings::values.allow_plugin_loader.GetValue());
}
-#ifdef ENABLE_RETROACHIEVEMENTS
- rcheevos_client.InitializeClient();
- rcheevos_client.LoginRetroachievementsUser("", "");
-#endif
-
LOG_DEBUG(Core, "Initialized OK");
is_powered_on = true;
@@ -663,6 +662,16 @@ const Cheats::CheatEngine& System::CheatEngine() const {
return cheat_engine;
}
+#ifdef ENABLE_RETROACHIEVEMENTS
+RcheevosClient &System::GetRcheevosClient() {
+ return *rcheevos_client;
+}
+
+const RcheevosClient &System::GetRcheevosClient() const {
+ return *rcheevos_client;
+}
+#endif
+
void System::RegisterVideoDumper(std::shared_ptr dumper) {
video_dumper = std::move(dumper);
}
diff --git a/src/core/core.h b/src/core/core.h
index 083256a2e..15a25d9fd 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -18,7 +18,6 @@
#include "core/hle/service/plgldr/plgldr.h"
#include "core/movie.h"
#include "core/perf_stats.h"
-#include "rcheevos_integration/rcheevos_integration.h"
namespace Frontend {
class EmuWindow;
@@ -71,6 +70,10 @@ namespace Loader {
class AppLoader;
}
+#ifdef ENABLE_RETROACHIEVEMENTS
+class RcheevosClient;
+#endif
+
namespace Core {
class ARM_Interface;
@@ -278,6 +281,14 @@ public:
/// Gets a const reference to the cheat engine
[[nodiscard]] const Cheats::CheatEngine& CheatEngine() const;
+#ifdef ENABLE_RETROACHIEVEMENTS
+ // Gets a reference to the Rcheevos client
+ [[nodiscard]] RcheevosClient &GetRcheevosClient();
+
+ // Gets a const reference to the Rcheevos client
+ [[nodiscard]] const RcheevosClient &GetRcheevosClient() const;
+#endif
+
/// Gets a reference to the custom texture cache system
[[nodiscard]] VideoCore::CustomTexManager& CustomTexManager();
@@ -442,7 +453,7 @@ private:
#ifdef ENABLE_RETROACHIEVEMENTS
/// RetroAchievements
- RcheevosClient rcheevos_client;
+ std::unique_ptr rcheevos_client;
#endif
/// Video dumper backend
diff --git a/src/rcheevos_integration/rcheevos_integration.cpp b/src/rcheevos_integration/rcheevos_integration.cpp
index 87040e231..65d007d2c 100644
--- a/src/rcheevos_integration/rcheevos_integration.cpp
+++ b/src/rcheevos_integration/rcheevos_integration.cpp
@@ -91,7 +91,7 @@ static void login_callback(int result, const char* error_message, rc_client_t* c
}
-void RcheevosClient::LoginRetroachievementsUser(const char* username, const char* password)
+void RcheevosClient::LogInRetroachievementsUser(const char* username, const char* password)
{
rc_client_begin_login_with_password(rc_client, username, password, login_callback, NULL);
}
diff --git a/src/rcheevos_integration/rcheevos_integration.h b/src/rcheevos_integration/rcheevos_integration.h
index 4eecff4d8..4c21850ca 100644
--- a/src/rcheevos_integration/rcheevos_integration.h
+++ b/src/rcheevos_integration/rcheevos_integration.h
@@ -12,7 +12,7 @@ public:
~RcheevosClient();
void InitializeClient();
- void LoginRetroachievementsUser(const char* username, const char* password);
+ void LogInRetroachievementsUser(const char* username, const char* password);
private:
const Core::System& system;
rc_client_t* rc_client = nullptr;