feat: support for USB mass storage devices, hotplugging

This commit is contained in:
2026-05-18 17:47:12 +02:00
parent d340e01e56
commit c20579afd3
36 changed files with 1537 additions and 130 deletions
+8 -3
View File
@@ -31,7 +31,7 @@ static constexpr int ITEM_H = 32;
static constexpr int MAP_H = 48;
static constexpr int MAP_PAD = 16;
static constexpr int MAX_PARTS = 32;
static constexpr int MAX_DISKS = 8;
static constexpr int MAX_DISKS = 32;
static constexpr int STATUS_H = 44;
static constexpr int TB_BTN_Y = 7;
@@ -120,8 +120,11 @@ extern const Color part_colors[NUM_PART_COLORS];
// ============================================================================
inline int disk_button_width(int idx) {
char label[8];
snprintf(label, sizeof(label), "Disk %d", idx);
char label[16];
int blockDev = (idx >= 0 && idx < g_state.disk_count)
? (int)g_state.disks[idx].port
: idx;
snprintf(label, sizeof(label), "Disk %d", blockDev);
return text_width(label) + 20;
}
@@ -192,6 +195,8 @@ inline Rect dialog_secondary_button_rect(int dialog_w, int dialog_h) {
// ============================================================================
void set_status(const char* msg);
int disk_block_dev(int diskIndex);
int selected_block_dev();
int get_disk_parts(int* indices, int max);
void format_disk_size(char* buf, int bufsize, uint64_t sectors, uint16_t sectorSize);