app/launcher/libs: Clean up imports and display battery percent if battery is present

This commit is contained in:
Joel16 2022-04-16 01:29:42 -04:00
parent 40127cee08
commit 8affe7f631
6 changed files with 11 additions and 6 deletions

View File

@ -1,6 +1,8 @@
#ifndef _CMFILEMANAGER_ARCHIVE_HELPER_H_ #ifndef _CMFILEMANAGER_ARCHIVE_HELPER_H_
#define _CMFILEMANAGER_ARCHIVE_HELPER_H_ #define _CMFILEMANAGER_ARCHIVE_HELPER_H_
#include <string>
namespace ArchiveHelper { namespace ArchiveHelper {
int Extract(const std::string &path); int Extract(const std::string &path);
} }

View File

@ -38,9 +38,12 @@ namespace GUI {
G2D::FontSetStyle(1.f, WHITE, INTRAFONT_ALIGN_LEFT); G2D::FontSetStyle(1.f, WHITE, INTRAFONT_ALIGN_LEFT);
G2D::DrawText(5, 14, time_string); G2D::DrawText(5, 14, time_string);
int state = scePowerIsBatteryCharging(); int state = 0, percent = 0, battery_val = 0;
int percent = scePowerGetBatteryLifePercent(); if (scePowerIsBatteryExist()) {
int battery_val = (percent / 20); state = scePowerIsBatteryCharging();
percent = scePowerGetBatteryLifePercent();
battery_val = (percent / 20);
}
static char percent_string[10]; static char percent_string[10];
std::snprintf(percent_string, 10, "%d", percent); std::snprintf(percent_string, 10, "%d", percent);

View File

@ -168,7 +168,7 @@ namespace AudioPlayer {
G2D::DrawText(455 - length_time_width, 240, length_time); G2D::DrawText(455 - length_time_width, 240, length_time);
G2D::DrawRect(230, 245, 225, 2, G2D_RGBA(97, 97, 97, 150)); G2D::DrawRect(230, 245, 225, 2, G2D_RGBA(97, 97, 97, 150));
G2D::DrawRect(230, 245, ((static_cast<double>(Audio::GetPosition())/static_cast<double>(Audio::GetLength())) * 225.0), 2, WHITE); G2D::DrawRect(230, 245, ((static_cast<float>(Audio::GetPosition())/static_cast<float>(Audio::GetLength())) * 225.0), 2, WHITE);
g2dFlip(G2D_VSYNC); g2dFlip(G2D_VSYNC);
int ctrl = Utils::ReadControls(); int ctrl = Utils::ReadControls();

View File

@ -28,7 +28,7 @@ namespace GUI {
G2D::DrawRect(40, 43, 400, 3, SELECTOR_COLOUR); G2D::DrawRect(40, 43, 400, 3, SELECTOR_COLOUR);
if ((device == BROWSE_STATE_INTERNAL) || (device == BROWSE_STATE_EXTERNAL)) { if ((device == BROWSE_STATE_INTERNAL) || (device == BROWSE_STATE_EXTERNAL)) {
float fill = (static_cast<double>(item.used_storage)/static_cast<double>(item.total_storage)) * 400.f; float fill = (static_cast<float>(item.used_storage)/static_cast<float>(item.total_storage)) * 400.f;
G2D::DrawRect(40, 43, fill, 3, TITLE_COLOUR); G2D::DrawRect(40, 43, fill, 3, TITLE_COLOUR);
} }

View File

@ -1,4 +1,3 @@
#include <pspkernel.h>
#include <pspsdk.h> #include <pspsdk.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View File

@ -5,6 +5,7 @@
extern "C" { extern "C" {
#endif #endif
#include <sys/time.h>
#include <pspsdk.h> #include <pspsdk.h>
#include <pspkernel.h> #include <pspkernel.h>
#include <psploadexec_kernel.h> #include <psploadexec_kernel.h>