mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2026-04-07 09:01:29 -06:00
Add a spot in the UI to authenticate with RetroAchievements
This commit is contained in:
parent
30beb5d972
commit
6a737183c0
@ -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()
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -24,6 +24,7 @@ public:
|
||||
void ApplyConfiguration();
|
||||
void RetranslateUI();
|
||||
void SetConfiguration();
|
||||
void RetroAchievementsLogIn();
|
||||
|
||||
void SetupPerGameUI();
|
||||
|
||||
|
||||
@ -295,7 +295,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="screenshot_dir_label">
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>Save Screenshots To</string>
|
||||
</property>
|
||||
@ -317,6 +317,78 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="retro_achievements_group">
|
||||
<property name="title">
|
||||
<string>RetroAchievements</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_retro_achievements_username" native="true">
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>Username</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="retro_achievements_username_input"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_retro_achievements_password" native="true">
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="retro_achievements_password_input"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="retro_achievements_log_in_button">
|
||||
<property name="text">
|
||||
<string>Log In</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="button_reset_defaults">
|
||||
<property name="text">
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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<RcheevosClient>(*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<VideoDumper::Backend> dumper) {
|
||||
video_dumper = std::move(dumper);
|
||||
}
|
||||
|
||||
@ -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<RcheevosClient> rcheevos_client;
|
||||
#endif
|
||||
|
||||
/// Video dumper backend
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user