From 5945b8d8889e0b98b401a86e786784e1427d67d1 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Mon, 19 Dec 2016 18:03:31 -0500 Subject: [PATCH] always show battery level, not just when it actually updates --- deps/SPIRV-Cross | 2 +- deps/glslang/glslang | 2 +- menu/drivers/xmb.c | 15 +++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/deps/SPIRV-Cross b/deps/SPIRV-Cross index 5c24d99ff2..cc207e32c8 160000 --- a/deps/SPIRV-Cross +++ b/deps/SPIRV-Cross @@ -1 +1 @@ -Subproject commit 5c24d99ff22a25ef38e9e39985f80cf57a1e7418 +Subproject commit cc207e32c8668bfe5a5cc514394e7df8f020ecf6 diff --git a/deps/glslang/glslang b/deps/glslang/glslang index a4a4d5e22c..ec2e27adf8 160000 --- a/deps/glslang/glslang +++ b/deps/glslang/glslang @@ -1 +1 @@ -Subproject commit a4a4d5e22c375d37bd286106904ef819eafff29b +Subproject commit ec2e27adf86a911c5af6c676a539166b5674a09d diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index be2a9d6ee8..1769b0b6e9 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -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;