Add Spectator Mode to achievement settings
Spectator Mode is a new mode added by rc_client that allows for achievement and leaderboard functionality, but does not submit this data to the site, partially allowing for offline achievements. It effectively replaces the former settings for disabling achievements, leaderboards, and RP, which are now always active internally as long as the client is active.
This commit is contained in:
parent
fd0de1b01f
commit
d8ef3ee6c5
|
@ -111,6 +111,7 @@ void AchievementManager::LoadGame(const std::string& file_path, const DiscIO::Vo
|
|||
}
|
||||
rc_client_set_unofficial_enabled(m_client, Config::Get(Config::RA_UNOFFICIAL_ENABLED));
|
||||
rc_client_set_encore_mode_enabled(m_client, Config::Get(Config::RA_ENCORE_ENABLED));
|
||||
rc_client_set_spectator_mode_enabled(m_client, Config::Get(Config::RA_SPECTATOR_ENABLED));
|
||||
if (volume)
|
||||
{
|
||||
std::lock_guard lg{m_lock};
|
||||
|
@ -256,6 +257,11 @@ bool AchievementManager::IsHardcoreModeActive() const
|
|||
return rc_client_is_processing_required(m_client);
|
||||
}
|
||||
|
||||
void AchievementManager::SetSpectatorMode()
|
||||
{
|
||||
rc_client_set_spectator_mode_enabled(m_client, Config::Get(Config::RA_SPECTATOR_ENABLED));
|
||||
}
|
||||
|
||||
std::string_view AchievementManager::GetPlayerDisplayName() const
|
||||
{
|
||||
if (!HasAPIToken())
|
||||
|
|
|
@ -105,6 +105,7 @@ public:
|
|||
std::recursive_mutex& GetLock();
|
||||
void SetHardcoreMode();
|
||||
bool IsHardcoreModeActive() const;
|
||||
void SetSpectatorMode();
|
||||
std::string_view GetPlayerDisplayName() const;
|
||||
u32 GetPlayerScore() const;
|
||||
const BadgeStatus& GetPlayerBadge() const;
|
||||
|
|
|
@ -20,6 +20,8 @@ const Info<bool> RA_HARDCORE_ENABLED{{System::Achievements, "Achievements", "Har
|
|||
const Info<bool> RA_UNOFFICIAL_ENABLED{{System::Achievements, "Achievements", "UnofficialEnabled"},
|
||||
false};
|
||||
const Info<bool> RA_ENCORE_ENABLED{{System::Achievements, "Achievements", "EncoreEnabled"}, false};
|
||||
const Info<bool> RA_SPECTATOR_ENABLED{{System::Achievements, "Achievements", "SpectatorEnabled"},
|
||||
false};
|
||||
const Info<bool> RA_PROGRESS_ENABLED{{System::Achievements, "Achievements", "ProgressEnabled"},
|
||||
false};
|
||||
const Info<bool> RA_BADGES_ENABLED{{System::Achievements, "Achievements", "BadgesEnabled"}, false};
|
||||
|
|
|
@ -17,6 +17,7 @@ extern const Info<std::string> RA_API_TOKEN;
|
|||
extern const Info<bool> RA_HARDCORE_ENABLED;
|
||||
extern const Info<bool> RA_UNOFFICIAL_ENABLED;
|
||||
extern const Info<bool> RA_ENCORE_ENABLED;
|
||||
extern const Info<bool> RA_SPECTATOR_ENABLED;
|
||||
extern const Info<bool> RA_PROGRESS_ENABLED;
|
||||
extern const Info<bool> RA_BADGES_ENABLED;
|
||||
} // namespace Config
|
||||
|
|
|
@ -87,6 +87,13 @@ void AchievementSettingsWidget::CreateLayout()
|
|||
"the player has already unlocked on the site so that the player will be notified if they "
|
||||
"meet the unlock conditions again, useful for custom speedrun criteria or simply for fun."
|
||||
"<br><br>Setting takes effect on next game load."));
|
||||
m_common_spectator_enabled_input = new ToolTipCheckBox(tr("Enable Spectator Mode"));
|
||||
m_common_spectator_enabled_input->SetDescription(
|
||||
tr("Enable unlocking achievements in Spectator Mode.<br><br>While in Spectator Mode, "
|
||||
"achievements and leaderboards will be processed and displayed on screen, but will not be "
|
||||
"submitted to the server.<br><br>If this is on at game launch, it will not be turned off "
|
||||
"until game close, because a RetroAchievements session will not be created.<br><br>If "
|
||||
"this is off at game launch, it can be toggled freely while the game is running."));
|
||||
m_common_progress_enabled_input = new ToolTipCheckBox(tr("Enable Progress Notifications"));
|
||||
m_common_progress_enabled_input->SetDescription(
|
||||
tr("Enable progress notifications on achievements.<br><br>Displays a brief popup message "
|
||||
|
@ -110,6 +117,7 @@ void AchievementSettingsWidget::CreateLayout()
|
|||
m_common_layout->addWidget(m_common_hardcore_enabled_input);
|
||||
m_common_layout->addWidget(m_common_unofficial_enabled_input);
|
||||
m_common_layout->addWidget(m_common_encore_enabled_input);
|
||||
m_common_layout->addWidget(m_common_spectator_enabled_input);
|
||||
m_common_layout->addWidget(new QLabel(tr("Display Settings")));
|
||||
m_common_layout->addWidget(m_common_progress_enabled_input);
|
||||
m_common_layout->addWidget(m_common_badges_enabled_input);
|
||||
|
@ -130,6 +138,8 @@ void AchievementSettingsWidget::ConnectWidgets()
|
|||
&AchievementSettingsWidget::ToggleUnofficial);
|
||||
connect(m_common_encore_enabled_input, &QCheckBox::toggled, this,
|
||||
&AchievementSettingsWidget::ToggleEncore);
|
||||
connect(m_common_spectator_enabled_input, &QCheckBox::toggled, this,
|
||||
&AchievementSettingsWidget::ToggleSpectator);
|
||||
connect(m_common_progress_enabled_input, &QCheckBox::toggled, this,
|
||||
&AchievementSettingsWidget::ToggleProgress);
|
||||
connect(m_common_badges_enabled_input, &QCheckBox::toggled, this,
|
||||
|
@ -180,6 +190,10 @@ void AchievementSettingsWidget::LoadSettings()
|
|||
SignalBlocking(m_common_encore_enabled_input)->setChecked(Config::Get(Config::RA_ENCORE_ENABLED));
|
||||
SignalBlocking(m_common_encore_enabled_input)->setEnabled(enabled);
|
||||
|
||||
SignalBlocking(m_common_spectator_enabled_input)
|
||||
->setChecked(Config::Get(Config::RA_SPECTATOR_ENABLED));
|
||||
SignalBlocking(m_common_spectator_enabled_input)->setEnabled(enabled);
|
||||
|
||||
SignalBlocking(m_common_progress_enabled_input)
|
||||
->setChecked(Config::Get(Config::RA_PROGRESS_ENABLED));
|
||||
SignalBlocking(m_common_progress_enabled_input)->setEnabled(enabled);
|
||||
|
@ -198,6 +212,8 @@ void AchievementSettingsWidget::SaveSettings()
|
|||
Config::SetBaseOrCurrent(Config::RA_UNOFFICIAL_ENABLED,
|
||||
m_common_unofficial_enabled_input->isChecked());
|
||||
Config::SetBaseOrCurrent(Config::RA_ENCORE_ENABLED, m_common_encore_enabled_input->isChecked());
|
||||
Config::SetBaseOrCurrent(Config::RA_SPECTATOR_ENABLED,
|
||||
m_common_spectator_enabled_input->isChecked());
|
||||
Config::SetBaseOrCurrent(Config::RA_PROGRESS_ENABLED,
|
||||
m_common_progress_enabled_input->isChecked());
|
||||
Config::SetBaseOrCurrent(Config::RA_BADGES_ENABLED, m_common_badges_enabled_input->isChecked());
|
||||
|
@ -254,6 +270,12 @@ void AchievementSettingsWidget::ToggleEncore()
|
|||
SaveSettings();
|
||||
}
|
||||
|
||||
void AchievementSettingsWidget::ToggleSpectator()
|
||||
{
|
||||
SaveSettings();
|
||||
AchievementManager::GetInstance().SetSpectatorMode();
|
||||
}
|
||||
|
||||
void AchievementSettingsWidget::ToggleProgress()
|
||||
{
|
||||
SaveSettings();
|
||||
|
|
|
@ -35,6 +35,7 @@ private:
|
|||
void ToggleHardcore();
|
||||
void ToggleUnofficial();
|
||||
void ToggleEncore();
|
||||
void ToggleSpectator();
|
||||
void ToggleProgress();
|
||||
void ToggleBadges();
|
||||
|
||||
|
@ -51,6 +52,7 @@ private:
|
|||
ToolTipCheckBox* m_common_hardcore_enabled_input;
|
||||
ToolTipCheckBox* m_common_unofficial_enabled_input;
|
||||
ToolTipCheckBox* m_common_encore_enabled_input;
|
||||
ToolTipCheckBox* m_common_spectator_enabled_input;
|
||||
ToolTipCheckBox* m_common_progress_enabled_input;
|
||||
ToolTipCheckBox* m_common_badges_enabled_input;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue