Skip to content

Commit

Permalink
Cheevos: game metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
NikosSiak committed Nov 6, 2021
1 parent d4f5299 commit 1db07cd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
15 changes: 14 additions & 1 deletion xbmc/cores/RetroPlayer/cheevos/Cheevos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ using namespace RETRO;

// API JSON Field names
constexpr auto SUCCESS = "Success";
constexpr auto GAME_ID = "GameID";
constexpr auto PATCH_DATA = "PatchData";
constexpr auto GAME_ID = "GameID";
constexpr auto RICH_PRESENCE = "RichPresencePatch";
constexpr auto GAME_TITLE = "Title";
constexpr auto PUBLISHER = "Publisher";
constexpr auto DEVELOPER = "Developer";
constexpr auto GENRE = "Genre";
constexpr auto CONSOLE_NAME = "ConsoleName";
constexpr auto RELEASED = "Released";

constexpr int HASH_SIZE = 33;
constexpr int RESPORNSE_SIZE = 64;
Expand Down Expand Up @@ -110,6 +116,13 @@ bool CCheevos::LoadData()
m_richPresenceScript = data[PATCH_DATA][RICH_PRESENCE].asString();
m_richPresenceLoaded = true;

m_title = data[PATCH_DATA][GAME_TITLE].asString();
m_publisher = data[PATCH_DATA][PUBLISHER].asString();
m_developer = data[PATCH_DATA][DEVELOPER].asString();
m_genre = data[PATCH_DATA][GENRE].asString();
m_consoleName = data[PATCH_DATA][CONSOLE_NAME].asString();
m_released = data[PATCH_DATA][RELEASED].asString();

return true;
}

Expand Down
15 changes: 15 additions & 0 deletions xbmc/cores/RetroPlayer/cheevos/Cheevos.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ class CCheevos
void EnableRichPresence();
bool GetRichPresenceEvaluation(char* evaluation, size_t size);

std::string GetTitle() { return m_title; }
std::string GetPublisher() { return m_publisher; }
std::string GetDeveloper() { return m_developer; }
std::string GetGenre() { return m_genre; }
std::string GetConsoleName() { return m_consoleName; }
std::string GetReleased() { return m_released; }

private:
bool LoadData();

Expand All @@ -41,6 +48,14 @@ class CCheevos
unsigned m_gameID{};
bool m_richPresenceLoaded{};

// Game metadata
std::string m_title;
std::string m_publisher;
std::string m_developer;
std::string m_genre;
std::string m_consoleName;
std::string m_released;

const std::map<std::string, int> m_extensionToConsole = {{".a26", RC_CONSOLE_ATARI_2600},
{".a78", RC_CONSOLE_ATARI_7800},
{".agb", RC_CONSOLE_GAMEBOY_ADVANCE},
Expand Down

0 comments on commit 1db07cd

Please sign in to comment.