mirror of
https://gitlab.com/Theopse/fbi-i18n-zh.git
synced 2025-04-06 03:58:02 +08:00
Correct size units, show free space of all partitions.
This commit is contained in:
parent
107cea8aad
commit
321540f585
@ -209,7 +209,7 @@ static void action_install_cdn_update(ui_view* view, void* data, float* progress
|
||||
}
|
||||
|
||||
*progress = installData->installInfo.currTotal != 0 ? (float) ((double) installData->installInfo.currProcessed / (double) installData->installInfo.currTotal) : 0;
|
||||
snprintf(text, PROGRESS_TEXT_MAX, "%lu / %lu\n%.2f MB / %.2f MB", installData->installInfo.processed, installData->installInfo.total, installData->installInfo.currProcessed / 1024.0 / 1024.0, installData->installInfo.currTotal / 1024.0 / 1024.0);
|
||||
snprintf(text, PROGRESS_TEXT_MAX, "%lu / %lu\n%.2f MiB / %.2f MiB", installData->installInfo.processed, installData->installInfo.total, installData->installInfo.currProcessed / 1024.0 / 1024.0, installData->installInfo.currTotal / 1024.0 / 1024.0);
|
||||
}
|
||||
|
||||
void action_install_cdn_noprompt(volatile bool* done, ticket_info* info, bool finishedPrompt) {
|
||||
|
@ -220,7 +220,7 @@ static void action_install_cias_update(ui_view* view, void* data, float* progres
|
||||
}
|
||||
|
||||
*progress = installData->installInfo.currTotal != 0 ? (float) ((double) installData->installInfo.currProcessed / (double) installData->installInfo.currTotal) : 0;
|
||||
snprintf(text, PROGRESS_TEXT_MAX, "%lu / %lu\n%.2f MB / %.2f MB", installData->installInfo.processed, installData->installInfo.total, installData->installInfo.currProcessed / 1024.0 / 1024.0, installData->installInfo.currTotal / 1024.0 / 1024.0);
|
||||
snprintf(text, PROGRESS_TEXT_MAX, "%lu / %lu\n%.2f MiB / %.2f MiB", installData->installInfo.processed, installData->installInfo.total, installData->installInfo.currProcessed / 1024.0 / 1024.0, installData->installInfo.currTotal / 1024.0 / 1024.0);
|
||||
}
|
||||
|
||||
static void action_install_cias_onresponse(ui_view* view, void* data, bool response) {
|
||||
|
@ -192,7 +192,7 @@ static void action_install_tickets_update(ui_view* view, void* data, float* prog
|
||||
}
|
||||
|
||||
*progress = installData->installInfo.currTotal != 0 ? (float) ((double) installData->installInfo.currProcessed / (double) installData->installInfo.currTotal) : 0;
|
||||
snprintf(text, PROGRESS_TEXT_MAX, "%lu / %lu\n%.2f MB / %.2f MB", installData->installInfo.processed, installData->installInfo.total, installData->installInfo.currProcessed / 1024.0 / 1024.0, installData->installInfo.currTotal / 1024.0 / 1024.0);
|
||||
snprintf(text, PROGRESS_TEXT_MAX, "%lu / %lu\n%.2f MiB / %.2f MiB", installData->installInfo.processed, installData->installInfo.total, installData->installInfo.currProcessed / 1024.0 / 1024.0, installData->installInfo.currTotal / 1024.0 / 1024.0);
|
||||
}
|
||||
|
||||
static void action_install_tickets_cdn_check_onresponse(ui_view* view, void* data, bool response) {
|
||||
|
@ -240,7 +240,7 @@ static void action_paste_files_update(ui_view* view, void* data, float* progress
|
||||
}
|
||||
|
||||
*progress = pasteData->pasteInfo.currTotal != 0 ? (float) ((double) pasteData->pasteInfo.currProcessed / (double) pasteData->pasteInfo.currTotal) : 0;
|
||||
snprintf(text, PROGRESS_TEXT_MAX, "%lu / %lu\n%.2f MB / %.2f MB", pasteData->pasteInfo.processed, pasteData->pasteInfo.total, pasteData->pasteInfo.currProcessed / 1024.0 / 1024.0, pasteData->pasteInfo.currTotal / 1024.0 / 1024.0);
|
||||
snprintf(text, PROGRESS_TEXT_MAX, "%lu / %lu\n%.2f MiB / %.2f MiB", pasteData->pasteInfo.processed, pasteData->pasteInfo.total, pasteData->pasteInfo.currProcessed / 1024.0 / 1024.0, pasteData->pasteInfo.currTotal / 1024.0 / 1024.0);
|
||||
}
|
||||
|
||||
static void action_paste_files_onresponse(ui_view* view, void* data, bool response) {
|
||||
|
@ -79,7 +79,7 @@ static void dumpnand_update(ui_view* view, void* data, float* progress, char* te
|
||||
}
|
||||
|
||||
*progress = dumpData->currTotal != 0 ? (float) ((double) dumpData->currProcessed / (double) dumpData->currTotal) : 0;
|
||||
snprintf(text, PROGRESS_TEXT_MAX, "%.2f MB / %.2f MB", dumpData->currProcessed / 1024.0f / 1024.0f, dumpData->currTotal / 1024.0f / 1024.0f);
|
||||
snprintf(text, PROGRESS_TEXT_MAX, "%.2f MiB / %.2f MiB", dumpData->currProcessed / 1024.0f / 1024.0f, dumpData->currTotal / 1024.0f / 1024.0f);
|
||||
}
|
||||
|
||||
static void dumpnand_onresponse(ui_view* view, void* data, bool response) {
|
||||
|
@ -233,7 +233,7 @@ static void networkinstall_install_update(ui_view* view, void* data, float* prog
|
||||
}
|
||||
|
||||
*progress = networkInstallData->installInfo.currTotal != 0 ? (float) ((double) networkInstallData->installInfo.currProcessed / (double) networkInstallData->installInfo.currTotal) : 0;
|
||||
snprintf(text, PROGRESS_TEXT_MAX, "%lu / %lu\n%.2f MB / %.2f MB", networkInstallData->installInfo.processed, networkInstallData->installInfo.total, networkInstallData->installInfo.currProcessed / 1024.0 / 1024.0, networkInstallData->installInfo.currTotal / 1024.0 / 1024.0);
|
||||
snprintf(text, PROGRESS_TEXT_MAX, "%lu / %lu\n%.2f MiB / %.2f MiB", networkInstallData->installInfo.processed, networkInstallData->installInfo.total, networkInstallData->installInfo.currProcessed / 1024.0 / 1024.0, networkInstallData->installInfo.currTotal / 1024.0 / 1024.0);
|
||||
}
|
||||
|
||||
static void networkinstall_cdn_check_onresponse(ui_view* view, void* data, bool response) {
|
||||
|
@ -242,7 +242,7 @@ static void qrinstall_install_update(ui_view* view, void* data, float* progress,
|
||||
}
|
||||
|
||||
*progress = qrInstallData->installInfo.currTotal != 0 ? (float) ((double) qrInstallData->installInfo.currProcessed / (double) qrInstallData->installInfo.currTotal) : 0;
|
||||
snprintf(text, PROGRESS_TEXT_MAX, "%lu / %lu\n%.2f MB / %.2f MB", qrInstallData->installInfo.processed, qrInstallData->installInfo.total, qrInstallData->installInfo.currProcessed / 1024.0 / 1024.0, qrInstallData->installInfo.currTotal / 1024.0 / 1024.0);
|
||||
snprintf(text, PROGRESS_TEXT_MAX, "%lu / %lu\n%.2f MiB / %.2f MiB", qrInstallData->installInfo.processed, qrInstallData->installInfo.total, qrInstallData->installInfo.currProcessed / 1024.0 / 1024.0, qrInstallData->installInfo.currTotal / 1024.0 / 1024.0);
|
||||
}
|
||||
|
||||
static void qrinstall_cdn_check_onresponse(ui_view* view, void* data, bool response) {
|
||||
|
@ -157,19 +157,54 @@ static void ui_draw_top(ui_view* ui) {
|
||||
float wifiY = topScreenTopBarY + (topScreenTopBarHeight - wifiHeight) / 2;
|
||||
screen_draw_texture(wifiIcon, wifiX, wifiY, wifiWidth, wifiHeight);
|
||||
|
||||
FS_ArchiveResource sd;
|
||||
FSUSER_GetSdmcArchiveResource(&sd);
|
||||
char buffer[128];
|
||||
char* currBuffer = buffer;
|
||||
FS_ArchiveResource resource = {0};
|
||||
|
||||
FS_ArchiveResource nand;
|
||||
FSUSER_GetNandArchiveResource(&nand);
|
||||
if(R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, SYSTEM_MEDIATYPE_SD)) && currBuffer < buffer + sizeof(buffer)) {
|
||||
if(currBuffer != buffer) {
|
||||
snprintf(currBuffer, sizeof(buffer) - (currBuffer - buffer), ", ");
|
||||
currBuffer += strlen(currBuffer);
|
||||
}
|
||||
|
||||
char buffer[64];
|
||||
snprintf(buffer, 64, "SD: %.1f MiB, NAND: %.1f MiB", ((u64) sd.freeClusters * (u64) sd.clusterSize) / 1024.0 / 1024.0, ((u64) nand.freeClusters * (u64) nand.clusterSize) / 1024.0 / 1024.0);
|
||||
snprintf(currBuffer, sizeof(buffer) - (currBuffer - buffer), "SD: %.1f MiB", ((u64) resource.freeClusters * (u64) resource.clusterSize) / 1024.0 / 1024.0);
|
||||
currBuffer += strlen(currBuffer);
|
||||
}
|
||||
|
||||
if(R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, SYSTEM_MEDIATYPE_CTR_NAND)) && currBuffer < buffer + sizeof(buffer)) {
|
||||
if(currBuffer != buffer) {
|
||||
snprintf(currBuffer, sizeof(buffer) - (currBuffer - buffer), ", ");
|
||||
currBuffer += strlen(currBuffer);
|
||||
}
|
||||
|
||||
snprintf(currBuffer, sizeof(buffer) - (currBuffer - buffer), "CTR NAND: %.1f MiB", ((u64) resource.freeClusters * (u64) resource.clusterSize) / 1024.0 / 1024.0);
|
||||
currBuffer += strlen(currBuffer);
|
||||
}
|
||||
|
||||
if(R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, SYSTEM_MEDIATYPE_TWL_NAND)) && currBuffer < buffer + sizeof(buffer)) {
|
||||
if(currBuffer != buffer) {
|
||||
snprintf(currBuffer, sizeof(buffer) - (currBuffer - buffer), ", ");
|
||||
currBuffer += strlen(currBuffer);
|
||||
}
|
||||
|
||||
snprintf(currBuffer, sizeof(buffer) - (currBuffer - buffer), "TWL NAND: %.1f MiB", ((u64) resource.freeClusters * (u64) resource.clusterSize) / 1024.0 / 1024.0);
|
||||
currBuffer += strlen(currBuffer);
|
||||
}
|
||||
|
||||
if(R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, SYSTEM_MEDIATYPE_TWL_PHOTO)) && currBuffer < buffer + sizeof(buffer)) {
|
||||
if(currBuffer != buffer) {
|
||||
snprintf(currBuffer, sizeof(buffer) - (currBuffer - buffer), ", ");
|
||||
currBuffer += strlen(currBuffer);
|
||||
}
|
||||
|
||||
snprintf(currBuffer, sizeof(buffer) - (currBuffer - buffer), "TWL Photo: %.1f MiB", ((u64) resource.freeClusters * (u64) resource.clusterSize) / 1024.0 / 1024.0);
|
||||
currBuffer += strlen(currBuffer);
|
||||
}
|
||||
|
||||
float freeSpaceHeight;
|
||||
screen_get_string_size(NULL, &freeSpaceHeight, buffer, 0.5f, 0.5f);
|
||||
screen_get_string_size(NULL, &freeSpaceHeight, buffer, 0.35f, 0.35f);
|
||||
|
||||
screen_draw_string(buffer, topScreenBottomBarX + 2, topScreenBottomBarY + (topScreenBottomBarHeight - freeSpaceHeight) / 2, 0.5f, 0.5f, COLOR_TEXT, false);
|
||||
screen_draw_string(buffer, topScreenBottomBarX + 2, topScreenBottomBarY + (topScreenBottomBarHeight - freeSpaceHeight) / 2, 0.35f, 0.35f, COLOR_TEXT, false);
|
||||
}
|
||||
|
||||
static void ui_draw_bottom(ui_view* ui) {
|
||||
@ -344,7 +379,7 @@ void ui_draw_file_info(ui_view* view, void* data, float x1, float y1, float x2,
|
||||
screen_draw_string(buf, nameX, nameY, 0.5f, 0.5f, COLOR_TEXT, false);
|
||||
|
||||
if(!info->isDirectory) {
|
||||
snprintf(buf, 64, "Size: %.2f MB", info->size / 1024.0 / 1024.0);
|
||||
snprintf(buf, 64, "Size: %.2f MiB", info->size / 1024.0 / 1024.0);
|
||||
|
||||
float sizeWidth;
|
||||
float sizeHeight;
|
||||
@ -421,7 +456,7 @@ void ui_draw_file_info(ui_view* view, void* data, float x1, float y1, float x2,
|
||||
float versionY = titleIdY + titleIdHeight + 2;
|
||||
screen_draw_string(buf, versionX, versionY, 0.5f, 0.5f, COLOR_TEXT, false);
|
||||
|
||||
snprintf(buf, 64, "Installed Size: %.2f MB", info->ciaInfo.installedSize / 1024.0 / 1024.0);
|
||||
snprintf(buf, 64, "Installed Size: %.2f MiB", info->ciaInfo.installedSize / 1024.0 / 1024.0);
|
||||
|
||||
float installedSizeWidth;
|
||||
float installedSizeHeight;
|
||||
@ -613,7 +648,7 @@ void ui_draw_title_info(ui_view* view, void* data, float x1, float y1, float x2,
|
||||
float versionY = productCodeY + productCodeHeight + 2;
|
||||
screen_draw_string(buf, versionX, versionY, 0.5f, 0.5f, COLOR_TEXT, false);
|
||||
|
||||
snprintf(buf, 64, "Installed Size: %.2f MB", info->installedSize / 1024.0 / 1024.0);
|
||||
snprintf(buf, 64, "Installed Size: %.2f MiB", info->installedSize / 1024.0 / 1024.0);
|
||||
|
||||
float installedSizeWidth;
|
||||
float installedSizeHeight;
|
||||
|
Loading…
x
Reference in New Issue
Block a user