diff --git a/src/libretro/environment.cpp b/src/libretro/environment.cpp index 60cc040..dcf44f5 100644 --- a/src/libretro/environment.cpp +++ b/src/libretro/environment.cpp @@ -437,6 +437,18 @@ optional retro::get_language() noexcept { return language; } +optional 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 { diff --git a/src/libretro/environment.hpp b/src/libretro/environment.hpp index 87790c2..f74eab9 100644 --- a/src/libretro/environment.hpp +++ b/src/libretro/environment.hpp @@ -68,6 +68,7 @@ namespace retro { const char* get_variable(const char *key); bool set_variable(const char* key, const char* value); std::optional get_language() noexcept; + std::optional username() noexcept; void set_option_visible(const char* key, bool visible) noexcept; bool supports_power_status() noexcept; std::optional get_device_power() noexcept;