feat: support for USB mass storage devices, hotplugging
This commit is contained in:
@@ -649,14 +649,14 @@ static void install_single_fat32(int disk) {
|
||||
|
||||
void do_install() {
|
||||
auto& st = g_state;
|
||||
int disk = st.selected_disk;
|
||||
|
||||
if (disk < 0 || disk >= st.disk_count) {
|
||||
if (st.selected_disk < 0 || st.selected_disk >= st.disk_count) {
|
||||
st.step = STEP_ERROR;
|
||||
add_log("No disk selected");
|
||||
flush_ui();
|
||||
return;
|
||||
}
|
||||
int disk = (int)st.disks[st.selected_disk].port;
|
||||
|
||||
g_files_copied = 0;
|
||||
g_dirs_created = 0;
|
||||
|
||||
@@ -28,7 +28,7 @@ static constexpr int INIT_H = 440;
|
||||
static constexpr int TOOLBAR_H = 36;
|
||||
static constexpr int STEP_BAR_H = 32;
|
||||
static constexpr int CONTENT_TOP = TOOLBAR_H + STEP_BAR_H;
|
||||
static constexpr int MAX_DISKS = 8;
|
||||
static constexpr int MAX_DISKS = 32;
|
||||
static constexpr int MAX_PARTS = 32;
|
||||
static constexpr int STATUS_H = 26;
|
||||
|
||||
|
||||
@@ -207,7 +207,8 @@ static void render_select_disk(uint32_t* px) {
|
||||
char info[64], sz[24];
|
||||
format_disk_size(sz, sizeof(sz), st.disks[i].sectorCount, st.disks[i].sectorSizeLog);
|
||||
const char* dtype = st.disks[i].rpm == 1 ? "SSD" : "HDD";
|
||||
snprintf(info, sizeof(info), "%s %s (Disk %d)", sz, dtype, i);
|
||||
snprintf(info, sizeof(info), "%s %s (Disk %d)", sz, dtype,
|
||||
(int)st.disks[i].port);
|
||||
px_text(px, g_win_w, g_win_h, item_x + 32, y + 6 + fh + 2, info, DIM_TEXT, FONT_SM);
|
||||
|
||||
y += item_h + 4;
|
||||
@@ -301,7 +302,8 @@ static void render_confirm(uint32_t* px) {
|
||||
format_disk_size(sz, sizeof(sz), st.disks[st.selected_disk].sectorCount,
|
||||
st.disks[st.selected_disk].sectorSizeLog);
|
||||
snprintf(desc, sizeof(desc), "Disk %d: %s (%s)",
|
||||
st.selected_disk, st.disks[st.selected_disk].model, sz);
|
||||
(int)st.disks[st.selected_disk].port,
|
||||
st.disks[st.selected_disk].model, sz);
|
||||
px_text(px, g_win_w, g_win_h, (g_win_w - text_w(desc)) / 2, y, desc, TEXT_COLOR);
|
||||
y += fh + 16;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user