Skip to content

Commit bb9979e

Browse files
committed
system_info: add space used toggle
1 parent 777573a commit bb9979e

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

menu_system_info.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#define MAX_CHARACTERS 12024
1010
static char char_pool[MAX_CHARACTERS];
1111
static int pool_offset;
12+
static int show_used_space = 1;
1213

1314
typedef struct _PCI_SLOT_NUMBER
1415
{
@@ -53,6 +54,14 @@ static void callback_stub(void)
5354
{
5455
}
5556

57+
static void toggle_space_display(void)
58+
{
59+
show_used_space = !show_used_space;
60+
WaitForSingleObject(text_render_mutex, INFINITE);
61+
update_system_info();
62+
ReleaseMutex(text_render_mutex);
63+
}
64+
5665
static void update_system_info(void)
5766
{
5867
int line = 0;
@@ -82,11 +91,20 @@ static void update_system_info(void)
8291
if (GetDiskFreeSpaceEx(drive_letters[i], &bytes_available, &total_bytes, NULL)) {
8392
ULONGLONG total_mib = total_bytes.QuadPart / 1024ULL;
8493
ULONGLONG mib_available = bytes_available.QuadPart / 1024ULL;
94+
ULONGLONG mib_used = total_mib - mib_available;
8595
ULONGLONG percent_free = (mib_available * 100ULL) / total_mib;
86-
push_line(line++, callback_stub, " %c: %llu / %llu MiB (%llu%%)", drive_letters[i][0], mib_available, total_mib, percent_free);
96+
ULONGLONG percent_used = 100 - percent_free;
97+
98+
if (show_used_space) {
99+
push_line(line++, callback_stub, " %c: %llu / %llu MiB (%llu%% used)", drive_letters[i][0], mib_used, total_mib, percent_used);
100+
} else {
101+
push_line(line++, callback_stub, " %c: %llu / %llu MiB (%llu%% available)", drive_letters[i][0], mib_available, total_mib, percent_free);
102+
}
87103
}
88104
}
89105

106+
push_line(line++, toggle_space_display, show_used_space ? "Press A to show Available Space" : "Press A to show Used Space");
107+
90108
// Active encoder
91109
static const char *encoder_string = NULL;
92110
ULONG encoder_check;

0 commit comments

Comments
 (0)