Skip to content

Commit

Permalink
FullscreenUI: Redo landing page and add help bar
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Apr 9, 2024
1 parent d4d7a13 commit bf4e8fe
Show file tree
Hide file tree
Showing 17 changed files with 1,003 additions and 217 deletions.
Binary file added data/resources/fullscreenui/back-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/resources/fullscreenui/desktop-mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/resources/fullscreenui/drive-cdrom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/resources/fullscreenui/exit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/resources/fullscreenui/start-bios.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/resources/fullscreenui/start-file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 35 additions & 10 deletions src/core/achievements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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())
Expand Down Expand Up @@ -2290,6 +2312,8 @@ void Achievements::DrawAchievementsWindow()
ImGuiFullscreen::EndMenuButtons();
}
ImGuiFullscreen::EndFullscreenWindow();

FullscreenUI::SetStandardSelectionFooterText(true);
}

void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
Expand Down Expand Up @@ -2705,6 +2729,7 @@ void Achievements::DrawLeaderboardsWindow()
}
}
ImGuiFullscreen::EndFullscreenWindow();
FullscreenUI::SetStandardSelectionFooterText(true);

if (!is_leaderboard_open)
{
Expand Down
7 changes: 7 additions & 0 deletions src/core/achievements.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Loading

0 comments on commit bf4e8fe

Please sign in to comment.