Skip to content

Commit

Permalink
Implements RETRO_ENVIRONMENT_GET_USERNAME now - propagates
Browse files Browse the repository at this point in the history
username set in libretro frontend to core
  • Loading branch information
inactive123 committed Dec 23, 2014
1 parent c187d33 commit 4a14dd2
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion common/sys_libretro.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,21 @@ static void update_variables(void)
}
}

static void update_env_variables(void)
{
const char *default_username = NULL;

if (environ_cb(RETRO_ENVIRONMENT_GET_USERNAME, &default_username))
{
if (default_username[0] != '\0')
{
char setplayer[256];
sprintf(setplayer, "name %s", default_username);
retro_cheat_set(0, true, setplayer);
}
}
}

byte *vid_buffer;
short *zbuffer;
short *finalimage;
Expand All @@ -629,10 +644,16 @@ static bool did_flip;

void retro_run(void)
{
static bool has_set_username = false;
did_flip = false;
bool updated = false;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
update_variables();
if (!has_set_username)
{
update_env_variables();
has_set_username = true;
}

// find time spent rendering last frame
newtime = Sys_DoubleTime();
Expand Down Expand Up @@ -793,7 +814,7 @@ bool retro_load_game(const struct retro_game_info *info)
#ifdef QW_HACK
oldtime = Sys_DoubleTime();
#endif


return true;
}
Expand Down

0 comments on commit 4a14dd2

Please sign in to comment.