mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
Fixed Leaderboard Scored message format
Refactored the message displayed when a leaderboard is submitted to so that it properly generates and uses a FormattedValue.
This commit is contained in:
parent
0366122306
commit
7a7e0ab2f5
@ -585,7 +585,7 @@ void AchievementManager::ActivateDeactivateAchievement(AchievementId id, bool en
|
||||
rc_runtime_deactivate_achievement(&m_runtime, id);
|
||||
}
|
||||
|
||||
RichPresence AchievementManager::GenerateRichPresence()
|
||||
AchievementManager::RichPresence AchievementManager::GenerateRichPresence()
|
||||
{
|
||||
RichPresence rp_buffer;
|
||||
Core::RunAsCPUThread([&] {
|
||||
@ -716,9 +716,22 @@ void AchievementManager::HandleLeaderboardTriggeredEvent(const rc_runtime_event_
|
||||
{
|
||||
if (m_game_data.leaderboards[ix].id == runtime_event->id)
|
||||
{
|
||||
OSD::AddMessage(fmt::format("Scored {} on leaderboard: {}", runtime_event->value,
|
||||
m_game_data.leaderboards[ix].title),
|
||||
OSD::Duration::VERY_LONG, OSD::Color::YELLOW);
|
||||
FormattedValue value{};
|
||||
rc_runtime_format_lboard_value(value.data(), static_cast<int>(value.size()),
|
||||
runtime_event->value, m_game_data.leaderboards[ix].format);
|
||||
if (std::find(value.begin(), value.end(), '\0') == value.end())
|
||||
{
|
||||
OSD::AddMessage(fmt::format("Scored {} on leaderboard: {}",
|
||||
std::string_view{value.data(), value.size()},
|
||||
m_game_data.leaderboards[ix].title),
|
||||
OSD::Duration::VERY_LONG, OSD::Color::YELLOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
OSD::AddMessage(fmt::format("Scored {} on leaderboard: {}", value.data(),
|
||||
m_game_data.leaderboards[ix].title),
|
||||
OSD::Duration::VERY_LONG, OSD::Color::YELLOW);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +19,6 @@
|
||||
#include "Common/Event.h"
|
||||
#include "Common/WorkQueueThread.h"
|
||||
|
||||
using AchievementId = u32;
|
||||
constexpr size_t RP_SIZE = 256;
|
||||
using RichPresence = std::array<char, RP_SIZE>;
|
||||
|
||||
namespace Core
|
||||
{
|
||||
class System;
|
||||
@ -53,6 +49,12 @@ public:
|
||||
u32 soft_points;
|
||||
};
|
||||
|
||||
using AchievementId = u32;
|
||||
static constexpr size_t FORMAT_SIZE = 24;
|
||||
using FormattedValue = std::array<char, FORMAT_SIZE>;
|
||||
static constexpr size_t RP_SIZE = 256;
|
||||
using RichPresence = std::array<char, RP_SIZE>;
|
||||
|
||||
struct UnlockStatus
|
||||
{
|
||||
AchievementId game_data_index = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user