HostInterface: Support per-controller-type settings

This commit is contained in:
Connor McLaughlin
2020-07-01 00:33:45 +10:00
parent f3b2953e40
commit 4dc9e10777
17 changed files with 247 additions and 7 deletions

View File

@ -118,6 +118,18 @@ std::string LibretroHostInterface::GetGameMemoryCardPath(const char* game_code,
return GetUserDirectoryRelativePath("%s/%s_%d.mcd", GetSaveDirectory(), game_code, slot + 1);
}
std::string LibretroHostInterface::GetSettingValue(const char* section, const char* key,
const char* default_value /*= ""*/)
{
TinyString name;
name.Format("%s.%s", section, key);
retro_variable var{name, default_value};
if (g_retro_environment_callback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
return var.value;
else
return default_value;
}
void LibretroHostInterface::AddOSDMessage(std::string message, float duration /*= 2.0f*/)
{
retro_message msg = {};

View File

@ -24,6 +24,7 @@ public:
void GetGameInfo(const char* path, CDImage* image, std::string* code, std::string* title) override;
std::string GetSharedMemoryCardPath(u32 slot) const override;
std::string GetGameMemoryCardPath(const char* game_code, u32 slot) const override;
std::string GetSettingValue(const char* section, const char* key, const char* default_value = "") override;
// Called by frontend
void retro_get_system_av_info(struct retro_system_av_info* info);