always show battery level, not just when it actually updates

This commit is contained in:
Brad Parker 2016-12-19 18:03:31 -05:00
parent 51b9886586
commit 5945b8d888
3 changed files with 11 additions and 8 deletions

2
deps/SPIRV-Cross vendored

@ -1 +1 @@
Subproject commit 5c24d99ff22a25ef38e9e39985f80cf57a1e7418
Subproject commit cc207e32c8668bfe5a5cc514394e7df8f020ecf6

@ -1 +1 @@
Subproject commit a4a4d5e22c375d37bd286106904ef819eafff29b
Subproject commit ec2e27adf86a911c5af6c676a539166b5674a09d

View File

@ -2637,22 +2637,25 @@ static void xmb_frame(void *data)
if (settings->menu.battery_level_enable)
{
const frontend_ctx_driver_t *frontend = frontend_get_ptr();
static retro_time_t last_time = 0;
retro_time_t current_time = cpu_features_get_time_usec();
static int percent = 0;
static enum frontend_powerstate state = FRONTEND_POWERSTATE_NONE;
int seconds = 0;
bool time_to_update = false;
const frontend_ctx_driver_t *frontend = frontend_get_ptr();
retro_time_t current_time = cpu_features_get_time_usec();
if (current_time - last_time >= BATTERY_LEVEL_CHECK_INTERVAL)
time_to_update = true;
if (time_to_update && frontend && frontend->get_powerstate)
if (frontend && frontend->get_powerstate)
{
char msg[12];
int seconds = 0, percent = 0;
enum frontend_powerstate state =
frontend->get_powerstate(&seconds, &percent);
bool charging = (state == FRONTEND_POWERSTATE_CHARGING);
if (time_to_update)
state = frontend->get_powerstate(&seconds, &percent);
*msg = '\0';
last_time = current_time;