diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 892495497..f43e5807b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -184,7 +184,7 @@ endif()
if (ENABLE_RETROACHIEVEMENTS)
add_compile_definitions(ENABLE_RETROACHIEVEMENTS)
- add_subdirectory(rcheevos_integration)
+ add_subdirectory(retroachievements)
endif()
add_subdirectory(common)
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index 87d5a8082..1e7671550 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -330,5 +330,5 @@ if (CITRA_USE_PRECOMPILED_HEADERS)
endif()
if (ENABLE_RETROACHIEVEMENTS)
- target_link_libraries(citra_qt PRIVATE rcheevos_integration)
+ target_link_libraries(citra_qt PRIVATE retroachievements)
endif()
diff --git a/src/citra_qt/configuration/configure_general.cpp b/src/citra_qt/configuration/configure_general.cpp
index a9d72a94f..35956b4e1 100644
--- a/src/citra_qt/configuration/configure_general.cpp
+++ b/src/citra_qt/configuration/configure_general.cpp
@@ -13,7 +13,7 @@
#include "common/settings.h"
#include "core/core.h"
#ifdef ENABLE_RETROACHIEVEMENTS
-#include "rcheevos_integration/rcheevos_integration.h"
+#include "retroachievements/client.h"
#endif
#include "ui_configure_general.h"
@@ -52,7 +52,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
#endif
#ifndef ENABLE_RETROACHIEVEMENTS
- ui->retro_achievements_group->setVisible(false);
+ ui->retroachievements_group->setVisible(false);
#endif
SetupPerGameUI();
@@ -83,7 +83,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
ui->change_screenshot_dir->setEnabled(true);
});
- connect(ui->retro_achievements_log_in_button, &QPushButton::clicked, this,
+ connect(ui->retroachievements_log_in_button, &QPushButton::clicked, this,
&ConfigureGeneral::RetroAchievementsLogIn);
}
@@ -209,10 +209,10 @@ void ConfigureGeneral::RetranslateUI() {
void ConfigureGeneral::RetroAchievementsLogIn() {
#ifdef ENABLE_RETROACHIEVEMENTS
- std::string username = ui->retro_achievements_username_input->text().toStdString(),
- password = ui->retro_achievements_password_input->text().toStdString();
+ std::string username = ui->retroachievements_username_input->text().toStdString(),
+ password = ui->retroachievements_password_input->text().toStdString();
- Core::System::GetInstance().GetRcheevosClient().LogInRetroachievementsUser(username.c_str(), password.c_str());
+ Core::System::GetInstance().RetroAchievementsClient().LogInUser(username.c_str(), password.c_str());
#endif
}
diff --git a/src/citra_qt/configuration/configure_general.ui b/src/citra_qt/configuration/configure_general.ui
index 01f440eba..6741be317 100644
--- a/src/citra_qt/configuration/configure_general.ui
+++ b/src/citra_qt/configuration/configure_general.ui
@@ -318,13 +318,13 @@
-
-
+
RetroAchievements
-
-
+
0
@@ -346,13 +346,13 @@
-
-
+
-
-
+
0
@@ -374,13 +374,13 @@
-
-
+
-
-
+
Log In
diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp
index fb0ef0243..e4710c91f 100644
--- a/src/common/logging/filter.cpp
+++ b/src/common/logging/filter.cpp
@@ -138,7 +138,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
CLS(Loader) \
CLS(WebService) \
CLS(RPC_Server) \
- CLS(Rcheevos)
+ CLS(RetroAchievements)
// GetClassName is a macro defined by Windows.h, grrr...
const char* GetLogClassName(Class log_class) {
diff --git a/src/common/logging/types.h b/src/common/logging/types.h
index 97f008d33..9a72cc5a4 100644
--- a/src/common/logging/types.h
+++ b/src/common/logging/types.h
@@ -52,61 +52,61 @@ enum class Class : u8 {
Applet_SWKBD, ///< The Software Keyboard applet
Service, ///< HLE implementation of system services. Each major service
///< should have its own subclass.
- Service_SRV, ///< The SRV (Service Directory) implementation
- Service_FRD, ///< The FRD (Friends) service
- Service_FS, ///< The FS (Filesystem) service implementation
- Service_ERR, ///< The ERR (Error) port implementation
- Service_ACT, ///< The ACT (Account) service
- Service_APT, ///< The APT (Applets) service
- Service_BOSS, ///< The BOSS (SpotPass) service
- Service_GSP, ///< The GSP (GPU control) service
- Service_AC, ///< The AC (WiFi status) service
- Service_AM, ///< The AM (Application manager) service
- Service_PTM, ///< The PTM (Power status & misc.) service
- Service_LDR, ///< The LDR (3ds dll loader) service
- Service_MIC, ///< The MIC (Microphone) service
- Service_NDM, ///< The NDM (Network daemon manager) service
- Service_NFC, ///< The NFC service
- Service_NIM, ///< The NIM (Network interface manager) service
- Service_NS, ///< The NS (Nintendo User Interface Shell) service
- Service_NWM, ///< The NWM (Network wlan manager) service
- Service_CAM, ///< The CAM (Camera) service
- Service_CECD, ///< The CECD (StreetPass) service
- Service_CFG, ///< The CFG (Configuration) service
- Service_CSND, ///< The CSND (CWAV format process) service
- Service_DSP, ///< The DSP (DSP control) service
- Service_DLP, ///< The DLP (Download Play) service
- Service_HID, ///< The HID (Human interface device) service
- Service_HTTP, ///< The HTTP service
- Service_SOC, ///< The SOC (Socket) service
- Service_IR, ///< The IR service
- Service_Y2R, ///< The Y2R (YUV to RGB conversion) service
- Service_PS, ///< The PS (Process) service
- Service_PLGLDR, ///< The PLGLDR (plugin loader) service
- Service_NEWS, ///< The NEWS (Notifications) service
- HW, ///< Low-level hardware emulation
- HW_Memory, ///< Memory-map and address translation
- HW_LCD, ///< LCD register emulation
- HW_GPU, ///< GPU control emulation
- HW_AES, ///< AES engine emulation
- HW_RSA, ///< RSA engine emulation
- HW_ECC, ///< ECC engine emulation
- Frontend, ///< Emulator UI
- Render, ///< Emulator video output and hardware acceleration
- Render_Software, ///< Software renderer backend
- Render_OpenGL, ///< OpenGL backend
- Render_Vulkan, ///< Vulkan backend
- Audio, ///< Audio emulation
- Audio_DSP, ///< The HLE and LLE implementations of the DSP
- Audio_Sink, ///< Emulator audio output backend
- Loader, ///< ROM loader
- Input, ///< Input emulation
- Network, ///< Network emulation
- Movie, ///< Movie (Input Recording) Playback
- WebService, ///< Interface to Citra Web Services
- RPC_Server, ///< RPC server
- Rcheevos, ///< RetroAchievements
- Count, ///< Total number of logging classes
+ Service_SRV, ///< The SRV (Service Directory) implementation
+ Service_FRD, ///< The FRD (Friends) service
+ Service_FS, ///< The FS (Filesystem) service implementation
+ Service_ERR, ///< The ERR (Error) port implementation
+ Service_ACT, ///< The ACT (Account) service
+ Service_APT, ///< The APT (Applets) service
+ Service_BOSS, ///< The BOSS (SpotPass) service
+ Service_GSP, ///< The GSP (GPU control) service
+ Service_AC, ///< The AC (WiFi status) service
+ Service_AM, ///< The AM (Application manager) service
+ Service_PTM, ///< The PTM (Power status & misc.) service
+ Service_LDR, ///< The LDR (3ds dll loader) service
+ Service_MIC, ///< The MIC (Microphone) service
+ Service_NDM, ///< The NDM (Network daemon manager) service
+ Service_NFC, ///< The NFC service
+ Service_NIM, ///< The NIM (Network interface manager) service
+ Service_NS, ///< The NS (Nintendo User Interface Shell) service
+ Service_NWM, ///< The NWM (Network wlan manager) service
+ Service_CAM, ///< The CAM (Camera) service
+ Service_CECD, ///< The CECD (StreetPass) service
+ Service_CFG, ///< The CFG (Configuration) service
+ Service_CSND, ///< The CSND (CWAV format process) service
+ Service_DSP, ///< The DSP (DSP control) service
+ Service_DLP, ///< The DLP (Download Play) service
+ Service_HID, ///< The HID (Human interface device) service
+ Service_HTTP, ///< The HTTP service
+ Service_SOC, ///< The SOC (Socket) service
+ Service_IR, ///< The IR service
+ Service_Y2R, ///< The Y2R (YUV to RGB conversion) service
+ Service_PS, ///< The PS (Process) service
+ Service_PLGLDR, ///< The PLGLDR (plugin loader) service
+ Service_NEWS, ///< The NEWS (Notifications) service
+ HW, ///< Low-level hardware emulation
+ HW_Memory, ///< Memory-map and address translation
+ HW_LCD, ///< LCD register emulation
+ HW_GPU, ///< GPU control emulation
+ HW_AES, ///< AES engine emulation
+ HW_RSA, ///< RSA engine emulation
+ HW_ECC, ///< ECC engine emulation
+ Frontend, ///< Emulator UI
+ Render, ///< Emulator video output and hardware acceleration
+ Render_Software, ///< Software renderer backend
+ Render_OpenGL, ///< OpenGL backend
+ Render_Vulkan, ///< Vulkan backend
+ Audio, ///< Audio emulation
+ Audio_DSP, ///< The HLE and LLE implementations of the DSP
+ Audio_Sink, ///< Emulator audio output backend
+ Loader, ///< ROM loader
+ Input, ///< Input emulation
+ Network, ///< Network emulation
+ Movie, ///< Movie (Input Recording) Playback
+ WebService, ///< Interface to Citra Web Services
+ RPC_Server, ///< RPC server
+ RetroAchievements, ///< RetroAchievements
+ Count, ///< Total number of logging classes
};
} // namespace Common::Log
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 25e9c86b1..95037d61d 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -505,7 +505,7 @@ target_link_libraries(citra_core PRIVATE Boost::boost Boost::serialization Boost
target_link_libraries(citra_core PUBLIC dds-ktx PRIVATE cryptopp fmt lodepng open_source_archives)
if (ENABLE_RETROACHIEVEMENTS)
- target_link_libraries(citra_core PUBLIC rcheevos_integration)
+ target_link_libraries(citra_core PUBLIC retroachievements)
target_compile_definitions(citra_core PUBLIC ENABLE_RETROACHIEVEMENTS)
endif()
diff --git a/src/core/core.cpp b/src/core/core.cpp
index d788eca4e..707e859af 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -51,7 +51,7 @@
#endif
#include "network/network.h"
#ifdef ENABLE_RETROACHIEVEMENTS
-#include "rcheevos_integration/rcheevos_integration.h"
+#include "retroachievements/client.h"
#endif
#include "video_core/custom_textures/custom_tex_manager.h"
#include "video_core/gpu.h"
@@ -78,8 +78,8 @@ Core::Timing& Global() {
System::System() : movie{*this}, cheat_engine{*this} {
#ifdef ENABLE_RETROACHIEVEMENTS
- rcheevos_client = std::make_unique(*this);
- rcheevos_client->InitializeClient();
+ retroachievements_client = std::make_unique(*this);
+ retroachievements_client->Initialize();
#endif
}
@@ -663,12 +663,12 @@ const Cheats::CheatEngine& System::CheatEngine() const {
}
#ifdef ENABLE_RETROACHIEVEMENTS
-RcheevosClient &System::GetRcheevosClient() {
- return *rcheevos_client;
+RetroAchievements::Client &System::RetroAchievementsClient() {
+ return *retroachievements_client;
}
-const RcheevosClient &System::GetRcheevosClient() const {
- return *rcheevos_client;
+const RetroAchievements::Client &System::RetroAchievementsClient() const {
+ return *retroachievements_client;
}
#endif
diff --git a/src/core/core.h b/src/core/core.h
index 15a25d9fd..b261a1a88 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -71,7 +71,9 @@ class AppLoader;
}
#ifdef ENABLE_RETROACHIEVEMENTS
-class RcheevosClient;
+namespace RetroAchievements {
+class Client;
+} // namespace RetroAchievements
#endif
namespace Core {
@@ -282,11 +284,11 @@ public:
[[nodiscard]] const Cheats::CheatEngine& CheatEngine() const;
#ifdef ENABLE_RETROACHIEVEMENTS
- // Gets a reference to the Rcheevos client
- [[nodiscard]] RcheevosClient &GetRcheevosClient();
+ // Gets a reference to the RetroAchievements client
+ [[nodiscard]] RetroAchievements::Client &RetroAchievementsClient();
- // Gets a const reference to the Rcheevos client
- [[nodiscard]] const RcheevosClient &GetRcheevosClient() const;
+ // Gets a const reference to the RetroAchievements client
+ [[nodiscard]] const RetroAchievements::Client &RetroAchievementsClient() const;
#endif
/// Gets a reference to the custom texture cache system
@@ -453,7 +455,7 @@ private:
#ifdef ENABLE_RETROACHIEVEMENTS
/// RetroAchievements
- std::unique_ptr rcheevos_client;
+ std::unique_ptr retroachievements_client;
#endif
/// Video dumper backend
diff --git a/src/rcheevos_integration/CMakeLists.txt b/src/rcheevos_integration/CMakeLists.txt
deleted file mode 100644
index 4651ec335..000000000
--- a/src/rcheevos_integration/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-add_library(rcheevos_integration STATIC
- rcheevos_integration.cpp
- rcheevos_integration.h
-)
-
-target_link_libraries(rcheevos_integration PRIVATE citra_common httplib rcheevos)
diff --git a/src/rcheevos_integration/rcheevos_integration.h b/src/rcheevos_integration/rcheevos_integration.h
deleted file mode 100644
index 4c21850ca..000000000
--- a/src/rcheevos_integration/rcheevos_integration.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#pragma once
-
-namespace Core {
-class System;
-}
-
-struct rc_client_t;
-
-class RcheevosClient {
-public:
- explicit RcheevosClient(const Core::System& system);
- ~RcheevosClient();
-
- void InitializeClient();
- void LogInRetroachievementsUser(const char* username, const char* password);
-private:
- const Core::System& system;
- rc_client_t* rc_client = nullptr;
-};
diff --git a/src/retroachievements/CMakeLists.txt b/src/retroachievements/CMakeLists.txt
new file mode 100644
index 000000000..86b97b2d2
--- /dev/null
+++ b/src/retroachievements/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_library(retroachievements STATIC
+ client.cpp
+ client.h
+)
+
+target_link_libraries(retroachievements PRIVATE citra_common httplib rcheevos)
diff --git a/src/rcheevos_integration/rcheevos_integration.cpp b/src/retroachievements/client.cpp
similarity index 76%
rename from src/rcheevos_integration/rcheevos_integration.cpp
rename to src/retroachievements/client.cpp
index 65d007d2c..ea5a8676f 100644
--- a/src/rcheevos_integration/rcheevos_integration.cpp
+++ b/src/retroachievements/client.cpp
@@ -1,4 +1,4 @@
-#include "rcheevos_integration.h"
+#include "client.h"
#include
#include
@@ -10,19 +10,21 @@
#include "common/logging/log.h"
#include "common/scm_rev.h"
+namespace RetroAchievements
+{
// This is the function the rc_client will use to read memory for the emulator. we don't need it yet,
// so just provide a dummy function that returns "no memory read".
static uint32_t read_memory(uint32_t address, uint8_t* buffer, uint32_t num_bytes, rc_client_t* client)
{
// TODO: implement later
- LOG_DEBUG(Rcheevos, "Attempting to read memory.");
+ LOG_DEBUG(RetroAchievements, "Attempting to read memory.");
return 0;
}
static void server_call(const rc_api_request_t* request, rc_client_server_callback_t callback, void* callback_data, rc_client_t* rc_client)
{
- LOG_DEBUG(Rcheevos, "Attempting to call server.");
+ LOG_DEBUG(RetroAchievements, "Attempting to call server.");
std::string user_agent = std::string("Azahar/") + Common::g_build_fullname; // TODO: Make this a numeric version as per https://github.com/RetroAchievements/rcheevos/wiki/rc_client-integration#user-agent-header
@@ -40,33 +42,33 @@ static void server_call(const rc_api_request_t* request, rc_client_server_callba
}
if (result) {
- LOG_DEBUG(Rcheevos, "Status: {}", result->status);
- LOG_DEBUG(Rcheevos, "Body: {}", result->body);
+ LOG_DEBUG(RetroAchievements, "Status: {}", result->status);
+ LOG_DEBUG(RetroAchievements, "Body: {}", result->body);
rc_api_server_response_t server_response = { .body = result->body.c_str(), .body_length = result->body.length(), .http_status_code = result->status };
callback(&server_response, callback_data);
} else {
- LOG_DEBUG(Rcheevos, "HTTP error {}", result.error());
+ LOG_DEBUG(RetroAchievements, "HTTP error {}", result.error());
}
}
// Write log messages to the console
static void log_message(const char* message, const rc_client_t* client)
{
- LOG_DEBUG(Rcheevos, "Rcheevos internal message: \"{}\"", message);
+ LOG_DEBUG(RetroAchievements, "RetroAchievements internal message: \"{}\"", message);
}
-RcheevosClient::RcheevosClient(const Core::System& _system) : system{_system} {}
+Client::Client(const Core::System& _system) : system{_system} {}
-RcheevosClient::~RcheevosClient() {
+Client::~Client() {
if (rc_client) {
rc_client_destroy(rc_client);
rc_client = NULL;
}
}
-void RcheevosClient::InitializeClient() {
- LOG_DEBUG(Rcheevos, "Initializing RetroAchievements client.");
+void Client::Initialize() {
+ LOG_DEBUG(RetroAchievements, "Initializing RetroAchievements client.");
rc_client = rc_client_create(read_memory, server_call);
rc_client_enable_logging(rc_client, RC_CLIENT_LOG_LEVEL_VERBOSE, log_message);
@@ -78,7 +80,7 @@ static void login_callback(int result, const char* error_message, rc_client_t* c
// If not successful, just report the error and bail.
if (result != RC_OK)
{
- LOG_ERROR(Rcheevos, "Login failed.");
+ LOG_ERROR(RetroAchievements, "Login failed.");
return;
}
@@ -87,11 +89,11 @@ static void login_callback(int result, const char* error_message, rc_client_t* c
// store_retroachievements_credentials(user->username, user->token);
// Inform user of successful login
- LOG_INFO(Rcheevos, "Logged in as {} ({} points)", user->display_name, user->score);
+ LOG_INFO(RetroAchievements, "Logged in as {} ({} points)", user->display_name, user->score);
}
-void RcheevosClient::LogInRetroachievementsUser(const char* username, const char* password)
+void Client::LogInUser(const char* username, const char* password)
{
rc_client_begin_login_with_password(rc_client, username, password, login_callback, NULL);
}
@@ -102,4 +104,5 @@ void RcheevosClient::LogInRetroachievementsUser(const char* username, const char
// // uses the token captured from the first login instead of a password.
// // Note that it uses the same callback.
// rc_client_begin_login_with_token(rc_client, username, token, login_callback, NULL);
-// }
\ No newline at end of file
+// }
+} // namespace RetroAchievements
diff --git a/src/retroachievements/client.h b/src/retroachievements/client.h
new file mode 100644
index 000000000..7e5dbd9f3
--- /dev/null
+++ b/src/retroachievements/client.h
@@ -0,0 +1,23 @@
+#pragma once
+
+namespace Core {
+class System;
+}
+
+struct rc_client_t;
+
+namespace RetroAchievements
+{
+ class Client {
+ public:
+ explicit Client(const Core::System& system);
+ ~Client();
+
+ void Initialize();
+
+ void LogInUser(const char* username, const char* password);
+ private:
+ const Core::System& system;
+ rc_client_t* rc_client = nullptr;
+ };
+} // namespace RetroAchievements