Add user agent to headers for all RetroAchievements server calls

Requested agent syntax is "Dolphin/5.0-23456"
This commit is contained in:
LillyJadeKatrin
2024-04-24 07:09:43 -04:00
parent 222a393080
commit 9499e14209
3 changed files with 48 additions and 37 deletions

View File

@ -9,6 +9,8 @@
namespace Common
{
#define EMULATOR_NAME "Dolphin"
#ifdef _DEBUG
#define BUILD_TYPE_STR "Debug "
#elif defined DEBUGFAST
@ -19,10 +21,10 @@ namespace Common
const std::string& GetScmRevStr()
{
static const std::string scm_rev_str = "Dolphin "
static const std::string scm_rev_str = EMULATOR_NAME " "
// Note this macro can be empty if the master branch does not exist.
#if 1 - SCM_COMMITS_AHEAD_MASTER - 1 != 0
"[" SCM_BRANCH_STR "] "
"[" SCM_BRANCH_STR "] "
#endif
#ifdef __INTEL_COMPILER
@ -51,6 +53,12 @@ const std::string& GetScmBranchStr()
return scm_branch_str;
}
const std::string& GetUserAgentStr()
{
static const std::string user_agent_str = EMULATOR_NAME "/" SCM_DESC_STR;
return user_agent_str;
}
const std::string& GetScmDistributorStr()
{
static const std::string scm_distributor_str = SCM_DISTRIBUTOR_STR;