diff options
author | notaz | 2011-08-13 22:32:14 +0300 |
---|---|---|
committer | notaz | 2011-08-13 22:32:14 +0300 |
commit | 65092fd8a8191ea66f980cbed9310ebdb5a13dcc (patch) | |
tree | 118c20d27b4386d9ac9ccdcaa351240403f138ce | |
parent | 7ca0ce80ad969c7a77e2dcccb4575eded4d4a7c6 (diff) | |
download | pcsx_rearmed-65092fd8a8191ea66f980cbed9310ebdb5a13dcc.tar.gz pcsx_rearmed-65092fd8a8191ea66f980cbed9310ebdb5a13dcc.tar.bz2 pcsx_rearmed-65092fd8a8191ea66f980cbed9310ebdb5a13dcc.zip |
frontend: show time and battery capacity
useful for longer gaming sessions
-rw-r--r-- | frontend/menu.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/frontend/menu.c b/frontend/menu.c index 69bcd59..45e9d5d 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -607,6 +607,18 @@ static void apply_lcdrate(int pal) old = pal; } +static int get_bat_capacity(void) +{ + FILE *f; + int ret = 0; + f = fopen("/sys/class/power_supply/bq27500-0/capacity", "r"); + if (f) { + fscanf(f, "%d", &ret); + fclose(f); + } + return ret; +} + static menu_entry e_menu_gfx_options[]; static void pnd_menu_init(void) @@ -1469,13 +1481,25 @@ void OnFile_Exit(); static void draw_frame_main(void) { + struct tm *tmp; + time_t ltime; + char ltime_s[16]; + char buff[64]; + if (CdromId[0] != 0) { - char buff[64]; snprintf(buff, sizeof(buff), "%.32s/%.9s (running as %s, with %s)", get_cd_label(), CdromId, Config.PsxType ? "PAL" : "NTSC", Config.HLE ? "HLE" : "BIOS"); smalltext_out16(4, 1, buff, 0x105f); } + + if (ready_to_go) { + ltime = time(NULL); + tmp = localtime(<ime); + strftime(ltime_s, sizeof(ltime_s), "%H:%M", tmp); + snprintf(buff, sizeof(buff), "%s %3d%%", ltime_s, get_bat_capacity()); + smalltext_out16(4, 1 + me_sfont_h, buff, 0x105f); + } } static void draw_frame_credits(void) |