mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
ACHIEVEMENTS: Add an API to store platform-specific special strings like ClientSecret
This commit is contained in:
parent
772a38588c
commit
6513bab7af
@ -46,11 +46,11 @@ bool AchievementsManager::setActiveDomain(const AchievementsInfo &info) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* prefix = info.platform == STEAM_ACHIEVEMENTS ? "steam" :
|
||||
const char* platform = info.platform == STEAM_ACHIEVEMENTS ? "steam" :
|
||||
info.platform == GALAXY_ACHIEVEMENTS ? "galaxy" :
|
||||
"achman";
|
||||
|
||||
String iniFileName = String::format("%s-%s.dat", prefix, info.appId.c_str());
|
||||
String iniFileName = String::format("%s-%s.dat", platform, info.appId.c_str());
|
||||
|
||||
if (_iniFileName == iniFileName) {
|
||||
return true;
|
||||
@ -67,6 +67,9 @@ bool AchievementsManager::setActiveDomain(const AchievementsInfo &info) {
|
||||
|
||||
_descriptions = info.descriptions;
|
||||
|
||||
setSpecialString("platform", platform);
|
||||
setSpecialString("gameId", info.appId);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -220,6 +223,17 @@ int AchievementsManager::getStatInt(String const &id) {
|
||||
}
|
||||
|
||||
|
||||
bool AchievementsManager::setSpecialString(String const &id, String const &value) {
|
||||
if (!isReady()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_iniFile->setKey(id, "special", value);
|
||||
_iniFile->saveToSaveFile(_iniFileName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool AchievementsManager::resetAllAchievements() {
|
||||
if (!isReady()) {
|
||||
return false;
|
||||
|
@ -179,6 +179,22 @@ public:
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Methods for storing platform-specific data
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Store provided key and value pair in additional section.
|
||||
* May be useful for posting achievements to original platform.
|
||||
*
|
||||
* @param[in] id Internal ID of the achievement.
|
||||
* @param[in] value Value to which the statistic is set.
|
||||
*/
|
||||
bool setSpecialString(const String &id, const String &value);
|
||||
|
||||
/** @} */
|
||||
|
||||
private:
|
||||
float getStatFloatEx(const String &id, const String §ion);
|
||||
bool setStatFloatEx(const String &id, float value, const String §ion);
|
||||
|
Loading…
Reference in New Issue
Block a user