| 94 | } |
| 95 | |
| 96 | void drawShellInfo(const char *path) { |
| 97 | // Title |
| 98 | char version[8]; |
| 99 | sprintf(version, "%X.%02X", VITASHELL_VERSION_MAJOR, VITASHELL_VERSION_MINOR); |
| 100 | if (version[3] == '0') |
| 101 | version[3] = '\0'; |
| 102 | |
| 103 | pgf_draw_textf(SHELL_MARGIN_X, SHELL_MARGIN_Y, TITLE_COLOR, "VitaShell %s", version); |
| 104 | |
| 105 | // Status bar |
| 106 | float x = SCREEN_WIDTH - SHELL_MARGIN_X; |
| 107 | |
| 108 | // Battery |
| 109 | if (sceKernelGetModel() == SCE_KERNEL_MODEL_VITA) { |
| 110 | float battery_x = ALIGN_RIGHT(x, vita2d_texture_get_width(battery_image)); |
| 111 | vita2d_draw_texture(battery_image, battery_x, SHELL_MARGIN_Y + 3.0f); |
| 112 | |
| 113 | vita2d_texture *battery_bar_image = battery_bar_green_image; |
| 114 | |
| 115 | if (scePowerIsLowBattery() && !scePowerIsBatteryCharging()) { |
| 116 | battery_bar_image = battery_bar_red_image; |
| 117 | } |
| 118 | |
| 119 | float percent = scePowerGetBatteryLifePercent() / 100.0f; |
| 120 | |
| 121 | float width = vita2d_texture_get_width(battery_bar_image); |
| 122 | vita2d_draw_texture_part(battery_bar_image, battery_x + 3.0f + (1.0f - percent) * width, |
| 123 | SHELL_MARGIN_Y + 5.0f, (1.0f - percent) * width, 0.0f, percent * width, |
| 124 | vita2d_texture_get_height(battery_bar_image)); |
| 125 | |
| 126 | if (scePowerIsBatteryCharging()) { |
| 127 | vita2d_draw_texture(battery_bar_charge_image, battery_x + 3.0f, SHELL_MARGIN_Y + 5.0f); |
| 128 | } |
| 129 | |
| 130 | x = battery_x - STATUS_BAR_SPACE_X; |
| 131 | } |
| 132 | |
| 133 | // Date & time |
| 134 | SceDateTime time; |
| 135 | sceRtcGetCurrentClock(&time, 0); |
| 136 | |
| 137 | char date_string[16]; |
| 138 | getDateString(date_string, date_format, &time); |
| 139 | |
| 140 | char time_string[24]; |
| 141 | getTimeString(time_string, time_format, &time); |
| 142 | |
| 143 | char string[64]; |
| 144 | snprintf(string, sizeof(string), "%s %s", date_string, time_string); |
| 145 | float date_time_x = ALIGN_RIGHT(x, pgf_text_width(string)); |
| 146 | pgf_draw_text(date_time_x, SHELL_MARGIN_Y, DATE_TIME_COLOR, string); |
| 147 | |
| 148 | x = date_time_x - STATUS_BAR_SPACE_X; |
| 149 | |
| 150 | // FTP |
| 151 | if (ftpvita_is_initialized()) { |
| 152 | float ftp_x = ALIGN_RIGHT(x, vita2d_texture_get_width(ftp_image)); |
| 153 | vita2d_draw_texture(ftp_image, ftp_x, SHELL_MARGIN_Y + 3.0f); |
no test coverage detected