Add retro::username

This commit is contained in:
Jesse Talavera-Greenberg 2023-08-24 22:18:44 -04:00
parent 0dc65bf435
commit e7af37cccd
2 changed files with 13 additions and 0 deletions

View File

@ -437,6 +437,18 @@ optional<retro_language> retro::get_language() noexcept {
return language;
}
optional<string> retro::username() noexcept {
const char* username = nullptr;
if (!environment(RETRO_ENVIRONMENT_GET_USERNAME, &username)) {
return nullopt;
}
if (!username) {
return nullopt;
}
return username;
}
void retro::set_option_visible(const char* key, bool visible) noexcept
{

View File

@ -68,6 +68,7 @@ namespace retro {
const char* get_variable(const char *key);
bool set_variable(const char* key, const char* value);
std::optional<retro_language> get_language() noexcept;
std::optional<std::string> username() noexcept;
void set_option_visible(const char* key, bool visible) noexcept;
bool supports_power_status() noexcept;
std::optional<retro_device_power> get_device_power() noexcept;