| 1686 | } |
| 1687 | |
| 1688 | void Achievements::SaveState(SaveStateBase& writer) |
| 1689 | { |
| 1690 | const auto lock = GetLock(); |
| 1691 | |
| 1692 | #ifdef ENABLE_RAINTEGRATION |
| 1693 | if (IsUsingRAIntegration()) |
| 1694 | { |
| 1695 | const int size = RA_CaptureState(nullptr, 0); |
| 1696 | |
| 1697 | const u32 data_size = (size >= 0) ? static_cast<u32>(size) : 0; |
| 1698 | if (data_size > 0) |
| 1699 | { |
| 1700 | writer.PrepBlock(static_cast<int>(data_size)); |
| 1701 | |
| 1702 | const int result = RA_CaptureState(reinterpret_cast<char*>(writer.GetBlockPtr()), static_cast<int>(data_size)); |
| 1703 | if (result != static_cast<int>(data_size)) |
| 1704 | Console.Warning("Failed to serialize cheevos state from RAIntegration."); |
| 1705 | else |
| 1706 | writer.CommitBlock(static_cast<int>(data_size)); |
| 1707 | } |
| 1708 | |
| 1709 | return; |
| 1710 | } |
| 1711 | #endif |
| 1712 | |
| 1713 | if (IsActive()) |
| 1714 | { |
| 1715 | // internally this happens twice.. not great. |
| 1716 | const size_t data_size = rc_client_progress_size(s_client); |
| 1717 | if (data_size > 0) |
| 1718 | { |
| 1719 | writer.PrepBlock(static_cast<int>(data_size)); |
| 1720 | |
| 1721 | const int result = rc_client_serialize_progress_sized(s_client, writer.GetBlockPtr(), data_size); |
| 1722 | if (result != RC_OK) |
| 1723 | Console.Warning("Failed to serialize cheevos state (%d)", result); |
| 1724 | else |
| 1725 | writer.CommitBlock(static_cast<int>(data_size)); |
| 1726 | } |
| 1727 | } |
| 1728 | } |
| 1729 | |
| 1730 | |
| 1731 | std::string Achievements::GetAchievementBadgePath(const rc_client_achievement_t* achievement, int state) |
nothing calls this directly
no test coverage detected