FullscreenUI: Redo landing page and add help bar

This commit is contained in:
Stenzek
2024-04-09 20:04:45 +10:00
parent d4d7a13fed
commit bf4e8feb25
17 changed files with 1006 additions and 220 deletions

View File

@ -1725,16 +1725,7 @@ void Achievements::ShowLoginNotification()
if (g_settings.achievements_notifications && FullscreenUI::Initialize())
{
std::string badge_path = GetUserBadgePath(user->username);
if (!FileSystem::FileExists(badge_path.c_str()))
{
char url[512];
const int res = rc_client_user_get_image_url(user, url, std::size(url));
if (res == RC_OK)
DownloadImage(url, badge_path);
else
ReportRCError(res, "rc_client_user_get_image_url() failed: ");
}
std::string badge_path = GetLoggedInUserBadgePath();
//: Summary for login notification.
std::string title = user->display_name;
@ -1746,6 +1737,37 @@ void Achievements::ShowLoginNotification()
}
}
const char* Achievements::GetLoggedInUserName()
{
const rc_client_user_t* user = rc_client_get_user_info(s_client);
if (!user) [[unlikely]]
return nullptr;
return user->username;
}
std::string Achievements::GetLoggedInUserBadgePath()
{
std::string badge_path;
const rc_client_user_t* user = rc_client_get_user_info(s_client);
if (!user) [[unlikely]]
return badge_path;
badge_path = GetUserBadgePath(user->username);
if (!FileSystem::FileExists(badge_path.c_str())) [[unlikely]]
{
char url[512];
const int res = rc_client_user_get_image_url(user, url, std::size(url));
if (res == RC_OK)
DownloadImage(url, badge_path);
else
ReportRCError(res, "rc_client_user_get_image_url() failed: ");
}
return badge_path;
}
void Achievements::Logout()
{
if (IsActive())
@ -2290,6 +2312,8 @@ void Achievements::DrawAchievementsWindow()
ImGuiFullscreen::EndMenuButtons();
}
ImGuiFullscreen::EndFullscreenWindow();
FullscreenUI::SetStandardSelectionFooterText(true);
}
void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
@ -2705,6 +2729,7 @@ void Achievements::DrawLeaderboardsWindow()
}
}
ImGuiFullscreen::EndFullscreenWindow();
FullscreenUI::SetStandardSelectionFooterText(true);
if (!is_leaderboard_open)
{

View File

@ -119,6 +119,13 @@ const std::string& GetRichPresenceString();
/// Should be called with the lock held.
const std::string& GetGameTitle();
/// Returns the logged-in user name.
const char* GetLoggedInUserName();
/// Returns the path to the user's profile avatar.
/// Should be called with the lock held.
std::string GetLoggedInUserBadgePath();
/// Clears all cached state used to render the UI.
void ClearUIState();

File diff suppressed because it is too large Load Diff

View File

@ -34,6 +34,7 @@ void OpenLeaderboardsWindow();
bool IsLeaderboardsWindowOpen();
void ReturnToMainWindow();
void ReturnToPreviousWindow();
void SetStandardSelectionFooterText(bool back_instead_of_cancel);
#endif
void Shutdown();
@ -45,5 +46,13 @@ void TimeToPrintableString(SmallStringBase* str, time_t t);
// Host UI triggers from Big Picture mode.
namespace Host {
/// Requests shut down and exit of the hosting application. This may not actually exit,
/// if the user cancels the shutdown confirmation.
void RequestExitApplication(bool allow_confirm);
/// Requests Big Picture mode to be shut down, returning to the desktop interface.
void RequestExitBigPicture();
/// Requests the cover downloader be opened.
void OnCoverDownloaderOpenRequested();
} // namespace Host

View File

@ -94,10 +94,6 @@ void DisplayLoadingScreen(const char* message, int progress_min = -1, int progre
/// Safely executes a function on the VM thread.
void RunOnCPUThread(std::function<void()> function, bool block = false);
/// Requests shut down and exit of the hosting application. This may not actually exit,
/// if the user cancels the shutdown confirmation.
void RequestExit(bool allow_confirm);
/// Attempts to create the rendering device backend.
bool CreateGPUDevice(RenderAPI api);