mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 23:11:25 +12:00
sceNpTrophy: deny unlocking of platinum trophies
This commit is contained in:
parent
765bd6b6c6
commit
be2d225d96
3 changed files with 22 additions and 0 deletions
|
@ -819,9 +819,19 @@ error_code sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::pt
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trophyId < 0 || trophyId >= static_cast<s32>(ctxt->tropusr->GetTrophiesCount()))
|
if (trophyId < 0 || trophyId >= static_cast<s32>(ctxt->tropusr->GetTrophiesCount()))
|
||||||
|
{
|
||||||
return SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID;
|
return SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxt->tropusr->GetTrophyGrade(trophyId) == SCE_NP_TROPHY_GRADE_PLATINUM)
|
||||||
|
{
|
||||||
|
return SCE_NP_TROPHY_ERROR_CANNOT_UNLOCK_PLATINUM;
|
||||||
|
}
|
||||||
|
|
||||||
if (ctxt->tropusr->GetTrophyUnlockState(trophyId))
|
if (ctxt->tropusr->GetTrophyUnlockState(trophyId))
|
||||||
|
{
|
||||||
return SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED;
|
return SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED;
|
||||||
|
}
|
||||||
|
|
||||||
ctxt->tropusr->UnlockTrophy(trophyId, 0, 0); // TODO: add timestamps
|
ctxt->tropusr->UnlockTrophy(trophyId, 0, 0); // TODO: add timestamps
|
||||||
|
|
||||||
|
|
|
@ -291,6 +291,17 @@ u32 TROPUSRLoader::GetUnlockedPlatinumID(u32 trophy_id, const std::string& confi
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 TROPUSRLoader::GetTrophyGrade(u32 id)
|
||||||
|
{
|
||||||
|
if (id >= m_table4.size())
|
||||||
|
{
|
||||||
|
LOG_WARNING(LOADER, "TROPUSRLoader::GetTrophyGrade: Invalid id=%d", id);
|
||||||
|
return trophy_grade::unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_table4[id].trophy_grade; // Let's assume the trophies are stored ordered
|
||||||
|
}
|
||||||
|
|
||||||
u32 TROPUSRLoader::GetTrophyUnlockState(u32 id)
|
u32 TROPUSRLoader::GetTrophyUnlockState(u32 id)
|
||||||
{
|
{
|
||||||
if (id >= m_table6.size())
|
if (id >= m_table6.size())
|
||||||
|
|
|
@ -86,6 +86,7 @@ public:
|
||||||
|
|
||||||
virtual u32 GetUnlockedPlatinumID(u32 trophy_id, const std::string& config_path);
|
virtual u32 GetUnlockedPlatinumID(u32 trophy_id, const std::string& config_path);
|
||||||
|
|
||||||
|
virtual u32 GetTrophyGrade(u32 id);
|
||||||
virtual u32 GetTrophyUnlockState(u32 id);
|
virtual u32 GetTrophyUnlockState(u32 id);
|
||||||
virtual u64 GetTrophyTimestamp(u32 id);
|
virtual u64 GetTrophyTimestamp(u32 id);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue