mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-31 03:45:38 +00:00
Cheevos: Ignore unofficial achievements for now
This commit is contained in:
parent
7dbc759619
commit
6ecf828171
|
@ -659,19 +659,29 @@ static void GetPatchesCallback(s32 status_code, const FrontendCommon::HTTPDownlo
|
||||||
const auto achievements(patch_data["Achievements"].GetArray());
|
const auto achievements(patch_data["Achievements"].GetArray());
|
||||||
for (const auto& achievement : achievements)
|
for (const auto& achievement : achievements)
|
||||||
{
|
{
|
||||||
if (!achievement.HasMember("ID") || !achievement["ID"].IsNumber() || !achievement.HasMember("MemAddr") ||
|
if (!achievement.HasMember("ID") || !achievement["ID"].IsNumber() || !achievement.HasMember("Flags") ||
|
||||||
!achievement["MemAddr"].IsString() || !achievement.HasMember("Title") || !achievement["Title"].IsString())
|
!achievement["Flags"].IsNumber() || !achievement.HasMember("MemAddr") || !achievement["MemAddr"].IsString() ||
|
||||||
|
!achievement.HasMember("Title") || !achievement["Title"].IsString())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const u32 id = achievement["ID"].GetUint();
|
const u32 id = achievement["ID"].GetUint();
|
||||||
|
const u32 category = achievement["Flags"].GetUint();
|
||||||
const char* memaddr = achievement["MemAddr"].GetString();
|
const char* memaddr = achievement["MemAddr"].GetString();
|
||||||
std::string title = achievement["Title"].GetString();
|
std::string title = achievement["Title"].GetString();
|
||||||
std::string description = GetOptionalString(achievement, "Description");
|
std::string description = GetOptionalString(achievement, "Description");
|
||||||
std::string badge_name = GetOptionalString(achievement, "BadgeName");
|
std::string badge_name = GetOptionalString(achievement, "BadgeName");
|
||||||
const u32 points = GetOptionalUInt(achievement, "Points");
|
const u32 points = GetOptionalUInt(achievement, "Points");
|
||||||
|
|
||||||
|
// Skip local and unofficial achievements for now.
|
||||||
|
if (static_cast<AchievementCategory>(category) == AchievementCategory::Local ||
|
||||||
|
static_cast<AchievementCategory>(category) == AchievementCategory::Unofficial)
|
||||||
|
{
|
||||||
|
Log_WarningPrintf("Skipping unofficial achievement %u (%s)", id, title.c_str());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetAchievementByID(id))
|
if (GetAchievementByID(id))
|
||||||
{
|
{
|
||||||
Log_ErrorPrintf("Achievement %u already exists", id);
|
Log_ErrorPrintf("Achievement %u already exists", id);
|
||||||
|
@ -737,19 +747,11 @@ static void GetPatchesCallback(s32 status_code, const FrontendCommon::HTTPDownlo
|
||||||
|
|
||||||
static void GetPatches(u32 game_id)
|
static void GetPatches(u32 game_id)
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
char url[256] = {};
|
char url[256] = {};
|
||||||
int res = rc_url_get_patch(url, sizeof(url), s_username.c_str(), s_login_token.c_str(), game_id);
|
int res = rc_url_get_patch(url, sizeof(url), s_username.c_str(), s_login_token.c_str(), game_id);
|
||||||
Assert(res == 0);
|
Assert(res == 0);
|
||||||
|
|
||||||
s_http_downloader->CreateRequest(url, GetPatchesCallback);
|
s_http_downloader->CreateRequest(url, GetPatchesCallback);
|
||||||
#else
|
|
||||||
std::optional<std::vector<u8>> f = FileSystem::ReadBinaryFile("D:\\10434.txt");
|
|
||||||
if (!f)
|
|
||||||
return;
|
|
||||||
|
|
||||||
GetPatchesCallback(200, *f);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string GetGameHash(CDImage* cdi)
|
static std::string GetGameHash(CDImage* cdi)
|
||||||
|
|
|
@ -7,6 +7,13 @@ class CDImage;
|
||||||
|
|
||||||
namespace Cheevos {
|
namespace Cheevos {
|
||||||
|
|
||||||
|
enum class AchievementCategory : u32
|
||||||
|
{
|
||||||
|
Local = 0,
|
||||||
|
Core = 3,
|
||||||
|
Unofficial = 5
|
||||||
|
};
|
||||||
|
|
||||||
struct Achievement
|
struct Achievement
|
||||||
{
|
{
|
||||||
u32 id;
|
u32 id;
|
||||||
|
|
Loading…
Reference in a new issue