Allow submitting entries to Leaderboards only in Hardcore Mode.

This is a requirement from RetroAchievements.
This commit is contained in:
Silent
2021-06-19 17:15:47 +02:00
parent e7b113f454
commit 99fbd2827b
2 changed files with 32 additions and 0 deletions

View File

@ -587,6 +587,19 @@ static void DisplayAchievementSummary()
{
summary = GetHostInterface()->TranslateString("Cheevos", "This game has no achievements.");
}
if (GetLeaderboardCount() > 0)
{
summary.push_back('\n');
if (g_challenge_mode)
{
summary.append(GetHostInterface()->TranslateString("Cheevos", "Leaderboards are enabled."));
}
else
{
summary.append(
GetHostInterface()->TranslateString("Cheevos", "Leaderboards are DISABLED because Hardcore Mode is off."));
}
}
ImGuiFullscreen::AddNotification(10.0f, std::move(title), std::move(summary), s_game_icon);
}
@ -1346,6 +1359,13 @@ void SubmitLeaderboard(u32 leaderboard_id, int value)
return;
}
if (!g_challenge_mode)
{
Log_WarningPrintf("Skipping sending leaderboard %u result to server because Challenge mode is off.",
leaderboard_id);
return;
}
char url[512];
rc_url_submit_lboard(url, sizeof(url), s_username.c_str(), s_login_token.c_str(), leaderboard_id, value);
s_http_downloader->CreateRequest(url, SubmitLeaderboardCallback);