Add RETRO_ENVIRONMENT_GET_USER_NAME

This commit is contained in:
twinaphex 2014-08-01 04:37:00 +02:00
parent e0fe1752f4
commit 69f2cc9f1a
2 changed files with 18 additions and 2 deletions

View File

@ -585,6 +585,16 @@ bool rarch_environment_cb(unsigned cmd, void *data)
RARCH_LOG("Environ SAVE_DIRECTORY: \"%s\".\n", g_extern.savefile_dir);
break;
case RETRO_ENVIRONMENT_GET_USERNAME:
//TODO/FIXME - username should be decoupled from HAVE_NETPLAY
#ifdef HAVE_NETPLAY
*(const char**)data = *g_extern.netplay_nick ? g_extern.netplay_nick : NULL;
RARCH_LOG("Environ GET_USERNAME: \"%s\".\n", g_extern.netplay_nick);
#else
*(const char**)data = NULL;
#endif
break;
case RETRO_ENVIRONMENT_SET_PIXEL_FORMAT:
{
enum retro_pixel_format pix_fmt = *(const enum retro_pixel_format*)data;

View File

@ -660,8 +660,14 @@ enum retro_mod
//
// A frontend must guarantee that this environment call completes in constant time.
#define RETRO_ENVIRONMENT_GET_USERNAME 38
// const char **
// Returns the specified username of the frontend, if specified.
// This username can be used as a nickname for a core that has online facilities or any other mode where personalization // of the user is desirable.
// The returned value can be NULL.
// If this environ callback is used by a core that requires a valid username, a default username should be specified
// by the core.
//
#define RETRO_MEMDESC_CONST (1 << 0) // The frontend will never change this memory area once retro_load_game has returned.
#define RETRO_MEMDESC_BIGENDIAN (1 << 1) // The memory area contains big endian data. Default is little endian.