Rename public-facing RA stuff from rcheevos to just RA

This commit is contained in:
Chase Harkcom 2026-02-18 17:48:26 -07:00
parent 6a737183c0
commit b89d93a8e8
14 changed files with 133 additions and 124 deletions

View File

@ -184,7 +184,7 @@ endif()
if (ENABLE_RETROACHIEVEMENTS)
add_compile_definitions(ENABLE_RETROACHIEVEMENTS)
add_subdirectory(rcheevos_integration)
add_subdirectory(retroachievements)
endif()
add_subdirectory(common)

View File

@ -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()

View File

@ -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
}

View File

@ -318,13 +318,13 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="retro_achievements_group">
<widget class="QGroupBox" name="retroachievements_group">
<property name="title">
<string>RetroAchievements</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QWidget" name="widget_retro_achievements_username" native="true">
<widget class="QWidget" name="widget_retroachievements_username" native="true">
<layout class="QHBoxLayout">
<property name="leftMargin">
<number>0</number>
@ -346,13 +346,13 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="retro_achievements_username_input"/>
<widget class="QLineEdit" name="retroachievements_username_input"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_retro_achievements_password" native="true">
<widget class="QWidget" name="widget_retroachievements_password" native="true">
<layout class="QHBoxLayout">
<property name="leftMargin">
<number>0</number>
@ -374,13 +374,13 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="retro_achievements_password_input"/>
<widget class="QLineEdit" name="retroachievements_password_input"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="retro_achievements_log_in_button">
<widget class="QPushButton" name="retroachievements_log_in_button">
<property name="text">
<string>Log In</string>
</property>

View File

@ -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) {

View File

@ -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

View File

@ -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()

View File

@ -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<RcheevosClient>(*this);
rcheevos_client->InitializeClient();
retroachievements_client = std::make_unique<RetroAchievements::Client>(*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

View File

@ -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<RcheevosClient> rcheevos_client;
std::unique_ptr<RetroAchievements::Client> retroachievements_client;
#endif
/// Video dumper backend

View File

@ -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)

View File

@ -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;
};

View File

@ -0,0 +1,6 @@
add_library(retroachievements STATIC
client.cpp
client.h
)
target_link_libraries(retroachievements PRIVATE citra_common httplib rcheevos)

View File

@ -1,4 +1,4 @@
#include "rcheevos_integration.h"
#include "client.h"
#include <cstring>
#include <string>
@ -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);
// }
// }
} // namespace RetroAchievements

View File

@ -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