mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 08:30:16 +00:00
always show battery level, not just when it actually updates
This commit is contained in:
parent
51b9886586
commit
5945b8d888
2
deps/SPIRV-Cross
vendored
2
deps/SPIRV-Cross
vendored
@ -1 +1 @@
|
||||
Subproject commit 5c24d99ff22a25ef38e9e39985f80cf57a1e7418
|
||||
Subproject commit cc207e32c8668bfe5a5cc514394e7df8f020ecf6
|
2
deps/glslang/glslang
vendored
2
deps/glslang/glslang
vendored
@ -1 +1 @@
|
||||
Subproject commit a4a4d5e22c375d37bd286106904ef819eafff29b
|
||||
Subproject commit ec2e27adf86a911c5af6c676a539166b5674a09d
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user