diff --git a/src/config.c b/src/config.c index 6ea5b8fa0..da58b02e8 100644 --- a/src/config.c +++ b/src/config.c @@ -111,6 +111,9 @@ typedef struct { static list_t config_head; +/* TODO: Backwards compatibility, get rid of this when enough time has passed. */ +static int backwards_compat = 0; + #ifdef ENABLE_CONFIG_LOG int config_do_log = ENABLE_CONFIG_LOG; @@ -1003,6 +1006,7 @@ load_hard_disks(void) } +/* TODO: Backwards compatibility, get rid of this when enough time has passed. */ /* Load "Floppy Drives" section. */ static void load_floppy_drives(void) @@ -1012,6 +1016,72 @@ load_floppy_drives(void) wchar_t *wp; int c; + if (!backwards_compat) + return; + + for (c=0; c 13) + fdd_set_type(c, 13); + config_delete_var(cat, temp); + + sprintf(temp, "fdd_%02i_fn", c + 1); + wp = config_get_wstring(cat, temp, L""); + config_delete_var(cat, temp); + +#if 0 + /* + * NOTE: + * Temporary hack to remove the absolute + * path currently saved in most config + * files. We should remove this before + * finalizing this release! --FvK + */ + if (! wcsnicmp(wp, usr_path, wcslen(usr_path))) { + /* + * Yep, its absolute and prefixed + * with the EXE path. Just strip + * that off for now... + */ + wcsncpy(floppyfns[c], &wp[wcslen(usr_path)], sizeof_w(floppyfns[c])); + } else +#endif + wcsncpy(floppyfns[c], wp, sizeof_w(floppyfns[c])); + + /* if (*wp != L'\0') + config_log("Floppy%d: %ls\n", c, floppyfns[c]); */ + sprintf(temp, "fdd_%02i_writeprot", c+1); + ui_writeprot[c] = !!config_get_int(cat, temp, 0); + config_delete_var(cat, temp); + sprintf(temp, "fdd_%02i_turbo", c + 1); + fdd_set_turbo(c, !!config_get_int(cat, temp, 0)); + config_delete_var(cat, temp); + sprintf(temp, "fdd_%02i_check_bpb", c+1); + fdd_set_check_bpb(c, !!config_get_int(cat, temp, 1)); + config_delete_var(cat, temp); + } + + delete_section_if_empty(cat); +} + + +/* Load "Floppy and CD-ROM Drives" section. */ +static void +load_floppy_and_cdrom_drives(void) +{ + char *cat = "Floppy and CD-ROM drives"; + char temp[512], tmp2[512], *p; + char s[512]; + unsigned int board = 0, dev = 0; + wchar_t *wp; + int c, d = 0; + + /* TODO: Backwards compatibility, get rid of this when enough time has passed. */ + backwards_compat = (find_section(cat) == NULL); + + memset(temp, 0x00, sizeof(temp)); for (c=0; c>1, (c+2)&1); + p = config_get_string(cat, temp, tmp2); + sscanf(p, "%01u:%01u", &board, &dev); + board &= 3; + dev &= 1; + cdrom[c].ide_channel = (board<<1)+dev; + + if (cdrom[c].ide_channel > 7) + cdrom[c].ide_channel = 7; + } else { + sprintf(temp, "cdrom_%02i_scsi_id", c+1); + if (cdrom[c].bus_type == CDROM_BUS_SCSI) { + cdrom[c].scsi_device_id = config_get_int(cat, temp, c+2); + + if (cdrom[c].scsi_device_id > 15) + cdrom[c].scsi_device_id = 15; + } else + config_delete_var(cat, temp); + } + config_delete_var(cat, temp); + + sprintf(temp, "cdrom_%02i_image_path", c+1); + wp = config_get_wstring(cat, temp, L""); + config_delete_var(cat, temp); + +#if 0 + /* + * NOTE: + * Temporary hack to remove the absolute + * path currently saved in most config + * files. We should remove this before + * finalizing this release! --FvK + */ + if (! wcsnicmp(wp, usr_path, wcslen(usr_path))) { + /* + * Yep, its absolute and prefixed + * with the EXE path. Just strip + * that off for now... + */ + wcsncpy(cdrom[c].image_path, &wp[wcslen(usr_path)], sizeof_w(cdrom[c].image_path)); + } else +#endif + wcsncpy(cdrom[c].image_path, wp, sizeof_w(cdrom[c].image_path)); + + if (cdrom[c].host_drive && (cdrom[c].host_drive != 200)) + cdrom[c].host_drive = 0; + + if ((cdrom[c].host_drive == 0x200) && + (wcslen(cdrom[c].image_path) == 0)) + cdrom[c].host_drive = 0; + } + } + backwards_compat = 0; memset(temp, 0x00, sizeof(temp)); for (c=0; c #include <86box/ui.h> #include <86box/scsi_device.h> +#include <86box/mo.h> #include <86box/zip.h> #include <86box/win.h> @@ -173,6 +174,7 @@ create_86f(WCHAR *file_name, disk_size_t disk_size, uint8_t rpm_mode) static int is_zip; +static int is_mo; static int @@ -204,7 +206,7 @@ create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi) fat2_offs = fat1_offs + fat_size; zero_bytes = fat2_offs + fat_size + root_dir_bytes; - if (!is_zip && is_fdi) { + if (!is_zip && !is_mo && is_fdi) { empty = (unsigned char *) malloc(base); memset(empty, 0, base); @@ -222,7 +224,7 @@ create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi) empty = (unsigned char *) malloc(total_size); memset(empty, 0x00, zero_bytes); - if (!is_zip) { + if (!is_zip && !is_mo) { memset(empty + zero_bytes, 0xF6, total_size - zero_bytes); empty[0x00] = 0xEB; /* Jump to make MS-DOS happy. */ @@ -352,10 +354,21 @@ create_zip_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_zdi, fwrite(empty, 1, 2048, f); SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0); + while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + fwrite(&empty[0x0800], 1, 2048, f); free(empty); SendMessage(h, PBM_SETPOS, (WPARAM) 2, (LPARAM) 0); + + while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + pbar_max -= 2; } @@ -507,6 +520,106 @@ create_zip_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_zdi, } +static int +create_mo_sector_image(WCHAR *file_name, int8_t disk_size, uint8_t is_mdi, HWND hwnd) +{ + HWND h; + FILE *f; + const mo_type_t *dp = &mo_types[disk_size]; + uint8_t *empty; + uint32_t total_size = 0; + uint32_t total_sectors = 0; + uint32_t sector_bytes = 0; + uint16_t base = 0x1000; + uint32_t pbar_max = 0; + uint32_t i; + MSG msg; + + f = plat_fopen(file_name, L"wb"); + if (!f) + return 0; + + sector_bytes = dp->bytes_per_sector; + total_sectors = dp->sectors; + total_size = total_sectors * sector_bytes; + + pbar_max = dp->sectors >> 11; + if (is_mdi) + pbar_max += base; + pbar_max >>= 11; + pbar_max--; + + h = GetDlgItem(hwnd, IDC_COMBO_RPM_MODE); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + h = GetDlgItem(hwnd, IDT_1751); + EnableWindow(h, FALSE); + ShowWindow(h, SW_HIDE); + h = GetDlgItem(hwnd, IDC_PBAR_IMG_CREATE); + SendMessage(h, PBM_SETRANGE32, (WPARAM) 0, (LPARAM) pbar_max); + SendMessage(h, PBM_SETPOS, (WPARAM) 0, (LPARAM) 0); + EnableWindow(h, TRUE); + ShowWindow(h, SW_SHOW); + h = GetDlgItem(hwnd, IDT_1757); + EnableWindow(h, TRUE); + ShowWindow(h, SW_SHOW); + + h = GetDlgItem(hwnd, IDC_PBAR_IMG_CREATE); + pbar_max++; + + if (is_mdi) { + empty = (unsigned char *) malloc(base); + memset(empty, 0, base); + + *(uint32_t *) &(empty[0x08]) = (uint32_t) base; + *(uint32_t *) &(empty[0x0C]) = total_size; + *(uint16_t *) &(empty[0x10]) = (uint16_t) sector_bytes; + *(uint8_t *) &(empty[0x14]) = (uint8_t) 25; + *(uint8_t *) &(empty[0x18]) = (uint8_t) 64; + *(uint8_t *) &(empty[0x1C]) = (uint8_t) (dp->sectors / 64) / 25; + + fwrite(empty, 1, 2048, f); + SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0); + + while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + fwrite(&empty[0x0800], 1, 2048, f); + free(empty); + + SendMessage(h, PBM_SETPOS, (WPARAM) 2, (LPARAM) 0); + + while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + pbar_max -= 2; + } + + empty = (unsigned char *) malloc(total_size); + memset(empty, 0x00, total_size); + + for (i = 0; i < pbar_max; i++) { + fwrite(&empty[i << 11], 1, 2048, f); + SendMessage(h, PBM_SETPOS, (WPARAM) i + 2, (LPARAM) 0); + + while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + free(empty); + + fclose(f); + + return 1; +} + + static int fdd_id, sb_part; static int file_type = 0; /* 0 = IMG, 1 = Japanese FDI, 2 = 86F */ @@ -562,7 +675,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) uint8_t disk_size, rpm_mode; int ret; FILE *f; - int zip_types; + int zip_types, mo_types; wchar_t *twcs; switch (message) { @@ -574,6 +687,11 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) zip_types = zip_drives[fdd_id].is_250 ? 2 : 1; for (i = 0; i < zip_types; i++) SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_5900 + i)); + } else if (is_mo) { + mo_types = 10; + /* TODO: Proper string ID's. */ + for (i = 0; i < mo_types; i++) + SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_5902 + i)); } else { for (i = 0; i < 12; i++) SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_5888 + i)); @@ -606,22 +724,24 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) disk_size = SendMessage(h, CB_GETCURSEL, 0, 0); if (is_zip) disk_size += 12; - if (file_type == 2) { + if (!is_zip && !is_mo && (file_type == 2)) { h = GetDlgItem(hdlg, IDC_COMBO_RPM_MODE); rpm_mode = SendMessage(h, CB_GETCURSEL, 0, 0); ret = create_86f(fd_file_name, disk_sizes[disk_size], rpm_mode); } else { if (is_zip) ret = create_zip_sector_image(fd_file_name, disk_sizes[disk_size], file_type, hdlg); + if (is_mo) + ret = create_mo_sector_image(fd_file_name, disk_size, file_type, hdlg); else ret = create_sector_image(fd_file_name, disk_sizes[disk_size], file_type); } if (ret) { if (is_zip) - //ui_sb_mount_zip_img(fdd_id, sb_part, 0, fd_file_name); zip_mount(fdd_id, fd_file_name, 0); + else if (is_mo) + mo_mount(fdd_id, fd_file_name, 0); else - //ui_sb_mount_floppy_img(fdd_id, sb_part, 0, fd_file_name); floppy_mount(fdd_id, fd_file_name, 0); } else { new_floppy_msgbox_header(hdlg, MBX_ERROR, (wchar_t *) IDS_4108, (wchar_t *) IDS_4115); @@ -639,7 +759,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) if (wcslen(wopenfilestring) && (wcslen(wopenfilestring) <= 256)) { twcs = &wopenfilestring[wcslen(wopenfilestring)]; twcs[0] = L'.'; - if (!is_zip && (filterindex == 3)) { + if (!is_zip && !is_mo && (filterindex == 3)) { twcs[1] = L'8'; twcs[2] = L'6'; twcs[3] = L'f'; @@ -671,6 +791,11 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) file_type = 1; else file_type = 0; + } else if (is_mo) { + if (((wcs_len >= 4) && !wcsicmp(ext, L".MDI"))) + file_type = 1; + else + file_type = 0; } else { if (((wcs_len >= 4) && !wcsicmp(ext, L".FDI"))) file_type = 1; @@ -717,5 +842,10 @@ NewFloppyDialogCreate(HWND hwnd, int id, int part) fdd_id = id & 0x7f; sb_part = part; is_zip = !!(id & 0x80); + is_mo = !!(id & 0x100); + if (is_zip && is_mo) { + fatal("Attempting to create a new image dialog that is for both ZIP and MO at the same time\n"); + return; + } DialogBox(hinstance, (LPCTSTR)DLG_NEW_FLOPPY, hwnd, NewFloppyDialogProcedure); } diff --git a/src/win/win_settings.c b/src/win/win_settings.c index f13cc4f29..ebf20dbd3 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -322,13 +322,13 @@ win_settings_init(void) else if (zip_drives[i].bus_type == ZIP_BUS_SCSI) scsi_tracking[zip_drives[i].scsi_device_id >> 3] |= (1 << ((zip_drives[i].scsi_device_id & 0x07) << 3)); } - memcpy(temp_mo_drives, mo_drives, MO_NUM * sizeof(mo_drive_t)); - for (i = 0; i < MO_NUM; i++) { - if (mo_drives[i].bus_type == MO_BUS_ATAPI) - ide_tracking |= (1 << (mo_drives[i].ide_channel << 3)); - else if (mo_drives[i].bus_type == MO_BUS_SCSI) - scsi_tracking[mo_drives[i].scsi_device_id >> 3] |= (1 << ((mo_drives[i].scsi_device_id & 0x07) << 3)); - } + memcpy(temp_mo_drives, mo_drives, MO_NUM * sizeof(mo_drive_t)); + for (i = 0; i < MO_NUM; i++) { + if (mo_drives[i].bus_type == MO_BUS_ATAPI) + ide_tracking |= (1 << (mo_drives[i].ide_channel << 3)); + else if (mo_drives[i].bus_type == MO_BUS_SCSI) + scsi_tracking[mo_drives[i].scsi_device_id >> 3] |= (1 << ((mo_drives[i].scsi_device_id & 0x07) << 3)); + } temp_deviceconfig = 0; } @@ -411,7 +411,7 @@ win_settings_changed(void) /* Other removable devices category */ i = i || memcmp(cdrom, temp_cdrom, CDROM_NUM * sizeof(cdrom_t)); i = i || memcmp(zip_drives, temp_zip_drives, ZIP_NUM * sizeof(zip_drive_t)); - i = i || memcmp(mo_drives, temp_mo_drives, MO_NUM * sizeof(mo_drive_t)); + i = i || memcmp(mo_drives, temp_mo_drives, MO_NUM * sizeof(mo_drive_t)); i = i || !!temp_deviceconfig; @@ -540,7 +540,7 @@ win_settings_save(void) zip_drives[i].f = NULL; zip_drives[i].priv = NULL; } - memcpy(mo_drives, temp_mo_drives, MO_NUM * sizeof(mo_drive_t)); + memcpy(mo_drives, temp_mo_drives, MO_NUM * sizeof(mo_drive_t)); for (i = 0; i < MO_NUM; i++) { mo_drives[i].f = NULL; mo_drives[i].priv = NULL; @@ -3518,7 +3518,7 @@ win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPar { HWND h = NULL; int old_sel = 0, b = 0, assign = 0; - const uint8_t hd_icons[2] = { 64, 0 }; + const uint8_t hd_icons[2] = { 80, 0 }; switch (message) { case WM_INITDIALOG: @@ -3754,7 +3754,7 @@ win_settings_cdrom_drives_recalc_list(HWND hwndList) WCHAR szText[256]; lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; - lvI.stateMask = lvI.iSubItem = lvI.state = 0; + lvI.stateMask = lvI.iSubItem = lvI.state = 0; for (i = 0; i < 4; i++) { fsid = combo_id_to_format_string_id(temp_cdrom[i].bus_type); @@ -4007,6 +4007,7 @@ win_settings_mo_drives_init_columns(HWND hwndList) return TRUE; } + static BOOL win_settings_zip_drives_init_columns(HWND hwndList) { @@ -4150,6 +4151,7 @@ win_settings_cdrom_drives_update_item(HWND hwndList, int i) return; } + static void win_settings_mo_drives_update_item(HWND hwndList, int i) { @@ -4296,7 +4298,7 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id) int i = 0; HWND h; - int bus = temp_cdrom[lv1_current_sel].bus_type; + int bus = temp_cdrom[lv2_current_sel].bus_type; for (i = IDT_1741; i < (IDT_1742 + 1); i++) { h = GetDlgItem(hdlg, i); @@ -4319,7 +4321,7 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id) } else { ShowWindow(h, SW_SHOW); EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_cdrom[lv1_current_sel].speed - 1, 0); + SendMessage(h, CB_SETCURSEL, temp_cdrom[lv2_current_sel].speed - 1, 0); } h = GetDlgItem(hdlg, IDT_1758); @@ -4338,12 +4340,12 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id) EnableWindow(h, TRUE); if (assign_id) - temp_cdrom[lv1_current_sel].ide_channel = next_free_ide_channel(); + temp_cdrom[lv2_current_sel].ide_channel = next_free_ide_channel(); h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE); ShowWindow(h, SW_SHOW); EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_cdrom[lv1_current_sel].ide_channel, 0); + SendMessage(h, CB_SETCURSEL, temp_cdrom[lv2_current_sel].ide_channel, 0); break; case CDROM_BUS_SCSI: /* SCSI */ h = GetDlgItem(hdlg, IDT_1741); @@ -4351,12 +4353,12 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id) EnableWindow(h, TRUE); if (assign_id) - next_free_scsi_id((uint8_t *) &temp_cdrom[lv1_current_sel].scsi_device_id); + next_free_scsi_id((uint8_t *) &temp_cdrom[lv2_current_sel].scsi_device_id); h = GetDlgItem(hdlg, IDC_COMBO_CD_ID); ShowWindow(h, SW_SHOW); EnableWindow(h, TRUE); - SendMessage(h, CB_SETCURSEL, temp_cdrom[lv1_current_sel].scsi_device_id, 0); + SendMessage(h, CB_SETCURSEL, temp_cdrom[lv2_current_sel].scsi_device_id, 0); break; } } @@ -4364,15 +4366,15 @@ static void cdrom_recalc_location_controls(HWND hdlg, int assign_id) static void mo_add_locations(HWND hdlg) { - LPTSTR lptsTemp; - char *temp; + LPTSTR lptsTemp; + char *temp; HWND h; int i = 0; - lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); - temp = (char*) malloc(30*sizeof(char)); + lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); + temp = (char*) malloc(30*sizeof(char)); - h = GetDlgItem(hdlg, IDC_COMBO_MO_BUS); + h = GetDlgItem(hdlg, IDC_COMBO_MO_BUS); for (i = MO_BUS_DISABLED; i <= MO_BUS_SCSI; i++) { if ((i == MO_BUS_DISABLED) || (i >= MO_BUS_ATAPI)) SendMessage(h, CB_ADDSTRING, 0, win_get_string(combo_id_to_string_id(i))); @@ -4390,21 +4392,21 @@ mo_add_locations(HWND hdlg) SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); } - h = GetDlgItem(hdlg, IDC_COMBO_MO_TYPE); - for (int i=0; i < KNOWN_MO_DRIVE_TYPES; i++) { - memset(temp, 0, 30); - memcpy(temp, mo_drive_types[i].vendor, 8); - temp[strlen(temp)] = ' '; - memcpy(temp + strlen(temp), mo_drive_types[i].model, 16); - temp[strlen(temp)] = ' '; - memcpy(temp + strlen(temp), mo_drive_types[i].revision, 4); + h = GetDlgItem(hdlg, IDC_COMBO_MO_TYPE); + for (int i=0; i < KNOWN_MO_DRIVE_TYPES; i++) { + memset(temp, 0, 30); + memcpy(temp, mo_drive_types[i].vendor, 8); + temp[strlen(temp)] = ' '; + memcpy(temp + strlen(temp), mo_drive_types[i].model, 16); + temp[strlen(temp)] = ' '; + memcpy(temp + strlen(temp), mo_drive_types[i].revision, 4); - mbstowcs(lptsTemp, temp, strlen(temp)+1); - SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); - } + mbstowcs(lptsTemp, temp, strlen(temp)+1); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); + } - free(temp); - free(lptsTemp); + free(temp); + free(lptsTemp); } @@ -4639,12 +4641,14 @@ static LRESULT CALLBACK #else static BOOL CALLBACK #endif -win_settings_floppy_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) +win_settings_floppy_and_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND h = NULL; - int i = 0, old_sel = 0; + int i = 0, old_sel = 0, b = 0, assign = 0; + uint32_t b2 = 0; WCHAR szText[256]; const uint8_t fd_icons[15] = { 248, 16, 16, 16, 16, 16, 16, 24, 24, 24, 24, 24, 24, 24, 0 }; + const uint8_t cd_icons[3] = { 249, 32, 0 }; switch (message) { case WM_INITDIALOG: @@ -4673,6 +4677,33 @@ win_settings_floppy_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM l h = GetDlgItem(hdlg, IDC_CHECKBPB); SendMessage(h, BM_SETCHECK, temp_fdd_check_bpb[lv1_current_sel], 0); + lv2_current_sel = 0; + h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); + win_settings_cdrom_drives_init_columns(h); + image_list_init(h, (const uint8_t *) cd_icons); + win_settings_cdrom_drives_recalc_list(h); + ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + cdrom_add_locations(hdlg); + + h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); + + switch (temp_cdrom[lv2_current_sel].bus_type) { + case CDROM_BUS_DISABLED: + default: + b = 0; + break; + case CDROM_BUS_ATAPI: + b = 1; + break; + case CDROM_BUS_SCSI: + b = 2; + break; + } + + SendMessage(h, CB_SETCURSEL, b, 0); + + cdrom_recalc_location_controls(hdlg, 0); + ignore_change = 0; return TRUE; @@ -4700,6 +4731,39 @@ win_settings_floppy_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM l h = GetDlgItem(hdlg, IDC_CHECKBPB); SendMessage(h, BM_SETCHECK, temp_fdd_check_bpb[lv1_current_sel], 0); ignore_change = 0; + } else if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_LIST_CDROM_DRIVES)) { + old_sel = lv2_current_sel; + lv2_current_sel = get_selected_drive(hdlg, IDC_LIST_CDROM_DRIVES); + if (lv2_current_sel == old_sel) + return FALSE; + else if (lv2_current_sel == -1) { + ignore_change = 1; + lv2_current_sel = old_sel; + ListView_SetItemState(h, lv2_current_sel, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); + ignore_change = 0; + return FALSE; + } + ignore_change = 1; + + h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); + + switch (temp_cdrom[lv2_current_sel].bus_type) { + case CDROM_BUS_DISABLED: + default: + b = 0; + break; + case CDROM_BUS_ATAPI: + b = 1; + break; + case CDROM_BUS_SCSI: + b = 2; + break; + } + + SendMessage(h, CB_SETCURSEL, b, 0); + + mo_recalc_location_controls(hdlg, 0); + ignore_change = 0; } break; @@ -4729,109 +4793,7 @@ win_settings_floppy_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM l h = GetDlgItem(hdlg, IDC_LIST_FLOPPY_DRIVES); win_settings_floppy_drives_update_item(h, lv1_current_sel); break; - } - ignore_change = 0; - default: - return FALSE; - } - - return FALSE; -} - - -#if defined(__amd64__) || defined(__aarch64__) -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif -win_settings_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - HWND h = NULL; - int old_sel = 0, b = 0, assign = 0; - uint32_t b2 = 0; - const uint8_t cd_icons[3] = { 249, 32, 0 }; - - switch (message) { - case WM_INITDIALOG: - ignore_change = 1; - - lv1_current_sel = 0; - h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_init_columns(h); - image_list_init(h, (const uint8_t *) cd_icons); - win_settings_cdrom_drives_recalc_list(h); - ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); - cdrom_add_locations(hdlg); - - h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); - - switch (temp_cdrom[lv1_current_sel].bus_type) { - case CDROM_BUS_DISABLED: - default: - b = 0; - break; - case CDROM_BUS_ATAPI: - b = 1; - break; - case CDROM_BUS_SCSI: - b = 2; - break; - } - - SendMessage(h, CB_SETCURSEL, b, 0); - - cdrom_recalc_location_controls(hdlg, 0); - - ignore_change = 0; - return TRUE; - - case WM_NOTIFY: - if (ignore_change) - return FALSE; - - if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_LIST_CDROM_DRIVES)) { - old_sel = lv1_current_sel; - lv1_current_sel = get_selected_drive(hdlg, IDC_LIST_CDROM_DRIVES); - if (lv1_current_sel == old_sel) - return FALSE; - else if (lv1_current_sel == -1) { - ignore_change = 1; - lv1_current_sel = old_sel; - ListView_SetItemState(h, lv1_current_sel, LVIS_FOCUSED | LVIS_SELECTED, 0x000F); - ignore_change = 0; - return FALSE; - } - ignore_change = 1; - - h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); - - switch (temp_cdrom[lv1_current_sel].bus_type) { - case CDROM_BUS_DISABLED: - default: - b = 0; - break; - case CDROM_BUS_ATAPI: - b = 1; - break; - case CDROM_BUS_SCSI: - b = 2; - break; - } - - SendMessage(h, CB_SETCURSEL, b, 0); - - mo_recalc_location_controls(hdlg, 0); - ignore_change = 0; - } - break; - - case WM_COMMAND: - if (ignore_change) - return FALSE; - - ignore_change = 1; - switch (LOWORD(wParam)) { case IDC_COMBO_CD_BUS: h = GetDlgItem(hdlg, IDC_COMBO_CD_BUS); b = SendMessage(h, CB_GETCURSEL, 0, 0); @@ -4846,42 +4808,42 @@ win_settings_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP b2 = CDROM_BUS_SCSI; break; } - if (b2 == temp_cdrom[lv1_current_sel].bus_type) + if (b2 == temp_cdrom[lv2_current_sel].bus_type) break; - cdrom_untrack(lv1_current_sel); - assign = (temp_cdrom[lv1_current_sel].bus_type == b2) ? 0 : 1; - if (temp_cdrom[lv1_current_sel].bus_type == CDROM_BUS_DISABLED) - temp_cdrom[lv1_current_sel].speed = 8; - temp_cdrom[lv1_current_sel].bus_type = b2; + cdrom_untrack(lv2_current_sel); + assign = (temp_cdrom[lv2_current_sel].bus_type == b2) ? 0 : 1; + if (temp_cdrom[lv2_current_sel].bus_type == CDROM_BUS_DISABLED) + temp_cdrom[lv2_current_sel].speed = 8; + temp_cdrom[lv2_current_sel].bus_type = b2; cdrom_recalc_location_controls(hdlg, assign); - cdrom_track(lv1_current_sel); + cdrom_track(lv2_current_sel); h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_update_item(h, lv1_current_sel); + win_settings_cdrom_drives_update_item(h, lv2_current_sel); break; case IDC_COMBO_CD_ID: h = GetDlgItem(hdlg, IDC_COMBO_CD_ID); - cdrom_untrack(lv1_current_sel); - temp_cdrom[lv1_current_sel].scsi_device_id = SendMessage(h, CB_GETCURSEL, 0, 0); - cdrom_track(lv1_current_sel); + cdrom_untrack(lv2_current_sel); + temp_cdrom[lv2_current_sel].scsi_device_id = SendMessage(h, CB_GETCURSEL, 0, 0); + cdrom_track(lv2_current_sel); h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_update_item(h, lv1_current_sel); + win_settings_cdrom_drives_update_item(h, lv2_current_sel); break; case IDC_COMBO_CD_CHANNEL_IDE: h = GetDlgItem(hdlg, IDC_COMBO_CD_CHANNEL_IDE); - cdrom_untrack(lv1_current_sel); - temp_cdrom[lv1_current_sel].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0); - cdrom_track(lv1_current_sel); + cdrom_untrack(lv2_current_sel); + temp_cdrom[lv2_current_sel].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0); + cdrom_track(lv2_current_sel); h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_update_item(h, lv1_current_sel); + win_settings_cdrom_drives_update_item(h, lv2_current_sel); break; case IDC_COMBO_CD_SPEED: h = GetDlgItem(hdlg, IDC_COMBO_CD_SPEED); - temp_cdrom[lv1_current_sel].speed = SendMessage(h, CB_GETCURSEL, 0, 0) + 1; + temp_cdrom[lv2_current_sel].speed = SendMessage(h, CB_GETCURSEL, 0, 0) + 1; h = GetDlgItem(hdlg, IDC_LIST_CDROM_DRIVES); - win_settings_cdrom_drives_update_item(h, lv1_current_sel); + win_settings_cdrom_drives_update_item(h, lv2_current_sel); break; } ignore_change = 0; @@ -4893,6 +4855,7 @@ win_settings_cdrom_drives_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP return FALSE; } + #if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else @@ -4903,7 +4866,7 @@ win_settings_other_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam HWND h = NULL; int old_sel = 0, b = 0, assign = 0; uint32_t b2 = 0; - const uint8_t mo_icons[3] = { 251, 56, 0 }; + const uint8_t mo_icons[3] = { 251, 56, 0 }; const uint8_t zip_icons[3] = { 250, 48, 0 }; switch (message) { @@ -5195,11 +5158,8 @@ void win_settings_show_child(HWND hwndParent, DWORD child_id) case SETTINGS_PAGE_HARD_DISKS: hwndChildDialog = CreateDialog(hinstance, (LPCWSTR)DLG_CFG_HARD_DISKS, hwndParent, win_settings_hard_disks_proc); break; - case SETTINGS_PAGE_FLOPPY_DRIVES: - hwndChildDialog = CreateDialog(hinstance, (LPCWSTR)DLG_CFG_FLOPPY_DRIVES, hwndParent, win_settings_floppy_drives_proc); - break; - case SETTINGS_PAGE_CDROM_DRIVES: - hwndChildDialog = CreateDialog(hinstance, (LPCWSTR)DLG_CFG_CDROM_DRIVES, hwndParent, win_settings_cdrom_drives_proc); + case SETTINGS_PAGE_FLOPPY_AND_CDROM_DRIVES: + hwndChildDialog = CreateDialog(hinstance, (LPCWSTR)DLG_CFG_FLOPPY_AND_CDROM_DRIVES, hwndParent, win_settings_floppy_and_cdrom_drives_proc); break; case SETTINGS_PAGE_OTHER_REMOVABLE_DEVICES: hwndChildDialog = CreateDialog(hinstance, (LPCWSTR)DLG_CFG_OTHER_REMOVABLE_DEVICES, hwndParent, win_settings_other_removable_devices_proc); @@ -5222,13 +5182,8 @@ win_settings_main_insert_categories(HWND hwndList) lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvI.stateMask = lvI.iSubItem = lvI.state = 0; - for (i = 0; i < 11; i++) { - if (i <= 8) - lvI.pszText = plat_get_string(IDS_2065+i); - else if (i == 9) - lvI.pszText = plat_get_string(IDS_2139); - else if (i == 10) - lvI.pszText = plat_get_string(IDS_2074); + for (i = 0; i < 10; i++) { + lvI.pszText = plat_get_string(IDS_2065+i); lvI.iItem = i; lvI.iImage = i; @@ -5275,7 +5230,7 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { HWND h = NULL; int category, i = 0, j = 0; - const uint8_t cat_icons[12] = { 240, 241, 242, 243, 80, 244, 245, 64, 246, 32, 247, 0 }; + const uint8_t cat_icons[12] = { 240, 241, 242, 243, 96, 244, 245, 80, 246, 247, 0 }; hwndParentDialog = hdlg; diff --git a/src/win/win_stbar.c b/src/win/win_stbar.c index afd47a384..67add30f1 100644 --- a/src/win/win_stbar.c +++ b/src/win/win_stbar.c @@ -259,6 +259,7 @@ StatusBarCreateZIPTip(int part) wcscpy(sbTips[part], tempTip); } + static void StatusBarCreateMOTip(int part) { @@ -287,6 +288,7 @@ StatusBarCreateMOTip(int part) wcscpy(sbTips[part], tempTip); } + static void StatusBarCreateDiskTip(int part) { @@ -677,12 +679,12 @@ ui_sb_update_panes(void) break; case SB_HDD: /* Hard disk */ - sb_part_icons[i] = 64; + sb_part_icons[i] = 80; StatusBarCreateDiskTip(i); break; case SB_NETWORK: /* Network */ - sb_part_icons[i] = 80; + sb_part_icons[i] = 96; StatusBarCreateNetworkTip(i); break; @@ -806,12 +808,14 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 48; i < 50; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); - for (i = 56; i < 58; i++) + for (i = 56; i < 58; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 64; i < 66; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 80; i < 82; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); + for (i = 96; i < 98; i++) + hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 144; i < 146; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 152; i < 154; i++) @@ -820,7 +824,9 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 176; i < 178; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); - for (i = 184; i < 186; i++) + for (i = 184; i < 186; i++) + hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); + for (i = 192; i < 194; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i); for (i = 243; i < 244; i++) hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);