Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RetroAchievements: Add option to allow saving, but not loading, in challenge / hardcore mode. #18425

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ static const ConfigSetting achievementSettings[] = {
ConfigSetting("AchievementsEncoreMode", &g_Config.bAchievementsEncoreMode, false, CfgFlag::DEFAULT),
ConfigSetting("AchievementsUnofficial", &g_Config.bAchievementsUnofficial, false, CfgFlag::DEFAULT),
ConfigSetting("AchievementsLogBadMemReads", &g_Config.bAchievementsLogBadMemReads, false, CfgFlag::DEFAULT),
ConfigSetting("bAchievementsSaveStateInChallengeMode", &g_Config.bAchievementsSaveStateInChallengeMode, false, CfgFlag::DEFAULT),

// Achievements login info. Note that password is NOT stored, only a login token.
// And that login token is stored separately from the ini, see NativeSaveSecret, but it can also be loaded
Expand Down
1 change: 1 addition & 0 deletions Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ struct Config {
bool bAchievementsUnofficial;
bool bAchievementsSoundEffects;
bool bAchievementsLogBadMemReads;
bool bAchievementsSaveStateInChallengeMode;

// Positioning of the various notifications
int iAchievementsLeaderboardTrackerPos;
Expand Down
8 changes: 6 additions & 2 deletions Core/SaveState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,12 @@ namespace SaveState
void Enqueue(SaveState::Operation op)
{
if (Achievements::ChallengeModeActive()) {
// No savestate operations are permitted, let's just ignore it.
return;
if (g_Config.bAchievementsSaveStateInChallengeMode && (op.type == SaveState::SAVESTATE_SAVE) || (op.type == SAVESTATE_SAVE_SCREENSHOT)) {
// We allow saving in challenge mode if this setting is on.
} else {
// Operation not allowed
return;
}
}

std::lock_guard<std::mutex> guard(mutex);
Expand Down
12 changes: 7 additions & 5 deletions UI/PauseScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,10 @@ SaveSlotView::SaveSlotView(const Path &gameFilename, int slot, bool vertical, UI
fv->OnClick.Handle(this, &SaveSlotView::OnScreenshotClick);

if (SaveState::HasSaveInSlot(gamePath_, slot)) {
loadStateButton_ = buttons->Add(new Button(pa->T("Load State"), new LinearLayoutParams(0.0, G_VCENTER)));
loadStateButton_->OnClick.Handle(this, &SaveSlotView::OnLoadState);
if (!Achievements::ChallengeModeActive()) {
loadStateButton_ = buttons->Add(new Button(pa->T("Load State"), new LinearLayoutParams(0.0, G_VCENTER)));
loadStateButton_->OnClick.Handle(this, &SaveSlotView::OnLoadState);
}

std::string dateStr = SaveState::GetSlotDateAsString(gamePath_, slot_);
if (!dateStr.empty()) {
Expand Down Expand Up @@ -286,7 +288,7 @@ void GamePauseScreen::CreateSavestateControls(UI::LinearLayout *leftColumnItems,
leftColumnItems->Add(new Spacer(0.0));

LinearLayout *buttonRow = leftColumnItems->Add(new LinearLayout(ORIENT_HORIZONTAL));
if (g_Config.bEnableStateUndo) {
if (g_Config.bEnableStateUndo && !Achievements::ChallengeModeActive()) {
UI::Choice *loadUndoButton = buttonRow->Add(new Choice(pa->T("Undo last load")));
loadUndoButton->SetEnabled(SaveState::HasUndoLoad(gamePath_));
loadUndoButton->OnClick.Handle(this, &GamePauseScreen::OnLoadUndo);
Expand All @@ -296,7 +298,7 @@ void GamePauseScreen::CreateSavestateControls(UI::LinearLayout *leftColumnItems,
saveUndoButton->OnClick.Handle(this, &GamePauseScreen::OnLastSaveUndo);
}

if (g_Config.iRewindSnapshotInterval > 0) {
if (g_Config.iRewindSnapshotInterval > 0 && !Achievements::ChallengeModeActive()) {
UI::Choice *rewindButton = buttonRow->Add(new Choice(pa->T("Rewind")));
rewindButton->SetEnabled(SaveState::CanRewind());
rewindButton->OnClick.Handle(this, &GamePauseScreen::OnRewind);
Expand Down Expand Up @@ -328,7 +330,7 @@ void GamePauseScreen::CreateViews() {
leftColumnItems->Add(new Spacer(5.0));
}

if (!Achievements::ChallengeModeActive()) {
if (!Achievements::ChallengeModeActive() || g_Config.bAchievementsSaveStateInChallengeMode) {
CreateSavestateControls(leftColumnItems, vertical);
} else {
// Let's show the active challenges.
Expand Down
1 change: 1 addition & 0 deletions UI/RetroAchievementScreens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ void RetroAchievementsSettingsScreen::CreateDeveloperToolsTab(UI::ViewGroup *vie
viewGroup->Add(new CheckBox(&g_Config.bAchievementsEncoreMode, ac->T("Encore Mode")))->SetEnabledPtr(&g_Config.bAchievementsEnable);
viewGroup->Add(new CheckBox(&g_Config.bAchievementsUnofficial, ac->T("Unofficial achievements")))->SetEnabledPtr(&g_Config.bAchievementsEnable);
viewGroup->Add(new CheckBox(&g_Config.bAchievementsLogBadMemReads, ac->T("Log bad memory accesses")))->SetEnabledPtr(&g_Config.bAchievementsEnable);
viewGroup->Add(new CheckBox(&g_Config.bAchievementsSaveStateInChallengeMode, ac->T("Allow Save State in Challenge Mode (but not Load State)")))->SetEnabledPtr(&g_Config.bAchievementsEnable);
}

void MeasureAchievement(const UIContext &dc, const rc_client_achievement_t *achievement, AchievementRenderStyle style, float *w, float *h) {
Expand Down
1 change: 1 addition & 0 deletions assets/lang/ar_AE.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/az_AZ.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/bg_BG.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/ca_ES.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/cz_CZ.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/da_DK.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/de_DE.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/dr_ID.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/en_US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Achievements = Achievements
Achievements enabled = Achievements enabled
Achievements are disabled = Achievements are disabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Challenge indicator = Challenge indicator
Expand Down
1 change: 1 addition & 0 deletions assets/lang/es_ES.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Logros
Achievements are disabled = Los logros están desactivados
Achievements enabled = Los logros están activados
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Alrededor mio
Can't log in to RetroAchievements right now = No se pudo iniciar sesión a RetroAchievements en estos momentos
Expand Down
1 change: 1 addition & 0 deletions assets/lang/es_LA.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Logros
Achievements are disabled = Los logros están desactivados
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = No se pudo iniciar sesión a RetroAchievements
Expand Down
1 change: 1 addition & 0 deletions assets/lang/fa_IR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/fi_FI.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Saavutukset
Achievements are disabled = Saavutukset ovat pois käytöstä
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = RetroAchievements:iin ei voida kirjautua juuri nyt
Expand Down
1 change: 1 addition & 0 deletions assets/lang/fr_FR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/gl_ES.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/gr_EL.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/he_IL.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/he_IL_invert.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/hr_HR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/hu_HU.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/id_ID.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/it_IT.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Obiettivi
Achievements enabled = Obiettivi abilitati
Achievements are disabled = Gli obiettivi sono disabilitati
Achievements with active challenges = Obiettivi con sfide attive
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Obiettivi quasi completati
Can't log in to RetroAchievements right now = Impossibile accedere a RetroAchievements in questo momento
Challenge indicator = Indicatore sfida
Expand Down
1 change: 1 addition & 0 deletions assets/lang/ja_JP.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = 実績
Achievements are disabled = 実績は無効化されています
Achievements enabled = 実績を有効化
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = もう少しで達成する実績
Around me = 自分の近く
Can't log in to RetroAchievements right now = 現在RetroAchievementsにログインできません。
Expand Down
1 change: 1 addition & 0 deletions assets/lang/jv_ID.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/ko_KR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = 성과
Achievements enabled = 성과 활성화
Achievements are disabled = 성과 비활성화
Achievements with active challenges = 도전 과제가 활성화된 성과
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = 거의 완료된 성과
Can't log in to RetroAchievements right now = 지금 RetroAchievements에 로그인할 수 없음
Challenge indicator = 도전 표시기
Expand Down
1 change: 1 addition & 0 deletions assets/lang/lo_LA.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/lt-LT.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/ms_MY.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/nl_NL.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
1 change: 1 addition & 0 deletions assets/lang/no_NO.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Achievements = Achievements
Achievements are disabled = Achievements are disabled
Achievements enabled = Achievements enabled
Achievements with active challenges = Achievements with active challenges
Allow Save State in Challenge Mode (but not Load State) = Allow Save State in Challenge Mode (but not Load State)
Almost completed achievements = Almost completed achievements
Around me = Around me
Can't log in to RetroAchievements right now = Can't log in to RetroAchievements right now
Expand Down
Loading