kodi-game / game.libretro

Libretro compatibility layer for the Kodi Game API
GNU General Public License v2.0
37 stars 26 forks source link

Game API v4.0.0: Achievement support for RetroPlayer #104

Open Shardul555 opened 1 year ago

Shardul555 commented 1 year ago

This PR implement support for Achievements in ReteroPlayer. This PR is based on https://github.com/kodi-game/game.libretro/pull/67 , for adding support of RCheevos. This PR is used by https://github.com/garbear/xbmc/pull/126 for implementing Achievements.

garbear commented 1 year ago

I had to make the following change to update for upstream changes:

diff --git a/src/client.cpp b/src/client.cpp
index 86376d1..f9ec5be 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -504,7 +504,8 @@ GAME_ERROR CGameLibRetro::RCGetPatchFileUrl(std::string& url,
   return GAME_ERROR_NO_ERROR;
 }

-GAME_ERROR CGameLibRetro::SetRetroAchievementsCredentials(const char* username, const char* token)
+GAME_ERROR CGameLibRetro::SetRetroAchievementsCredentials(const std::string& username,
+                                                          const std::string& token)
 {
   CCheevos::Get().SetRetroAchievementsCredentials(username, token);
   return GAME_ERROR_NO_ERROR;
diff --git a/src/client.h b/src/client.h
index d06e4b6..f2e84f4 100644
--- a/src/client.h
+++ b/src/client.h
@@ -78,7 +78,8 @@ public:
                                const std::string& username,
                                const std::string& token,
                                unsigned int gameID) override;
-  GAME_ERROR SetRetroAchievementsCredentials(const char* username, const char* token);
+  GAME_ERROR SetRetroAchievementsCredentials(const std::string& username,
+                                             const std::string& token) override;
   GAME_ERROR RCPostRichPresenceUrl(std::string& url,
                                    std::string& postData,
                                    const std::string& username,