diff --git a/src/config.c b/src/config.c index 0d3b13a29..1267cd91c 100644 --- a/src/config.c +++ b/src/config.c @@ -709,9 +709,9 @@ load_network(void) if (p != NULL) { if ((network_dev_to_id(p) == -1) || (network_ndev == 1)) { if ((network_ndev == 1) && strcmp(network_host, "none")) { - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2103); + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2094); } else if (network_dev_to_id(p) == -1) { - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2104); + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2095); } strcpy(network_host, "none"); diff --git a/src/include/86box/language.h b/src/include/86box/language.h index 9b3065be9..b95f692f7 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -53,53 +53,44 @@ #define IDS_2077 2077 // "Click to capture mouse" #define IDS_2078 2078 // "Press F12-F8 to release mouse" #define IDS_2079 2079 // "Press F12-F8 or middle button.." -#define IDS_2080 2080 // "E&xport to 86F..." -#define IDS_2081 2081 // "Unable to initialize Flui.." -#define IDS_2082 2082 // "Bus" -#define IDS_2083 2083 // "File" -#define IDS_2084 2084 // "C" -#define IDS_2085 2085 // "H" -#define IDS_2086 2086 // "S" -#define IDS_2087 2087 // "MB" -#define IDS_2088 2088 // "Check BPB" -#define IDS_2089 2089 // "&Image..." -#define IDS_2090 2090 // "&Reload previous image" -#define IDS_2091 2091 // "E&mpty" -#define IDS_2092 2092 // "&Mute" -#define IDS_2093 2093 // "E&ject" -#define IDS_2094 2094 // "KB" -#define IDS_2095 2095 // "Neither DirectDraw nor Dire.." -#define IDS_2096 2096 // "&New image..." -#define IDS_2097 2097 // "&Existing image..." -#define IDS_2098 2098 // "Existing image (&Write-pr..." -#define IDS_2099 2099 // "Default" -#define IDS_2100 2100 // "%i Wait state(s)" -#define IDS_2101 2101 // "Type" -#define IDS_2102 2102 // "PCap failed to set up.." -#define IDS_2103 2103 // "No PCap devices found" -#define IDS_2104 2104 // "Invalid PCap device" -#define IDS_2105 2105 // "Standard 2-button joystick(s)" -#define IDS_2106 2106 // "Standard 4-button joystick" -#define IDS_2107 2107 // "Standard 6-button joystick" -#define IDS_2108 2108 // "Standard 8-button joystick" -#define IDS_2109 2109 // "CH Flightstick Pro" -#define IDS_2110 2110 // "Microsoft SideWinder Pad" -#define IDS_2111 2111 // "Thrustmaster Flight Cont.." -#define IDS_2112 2112 // "None" -#define IDS_2113 2113 // "Unable to load Accelerators" -#define IDS_2114 2114 // "Unable to register Raw Input" -#define IDS_2115 2115 // "%u" -#define IDS_2116 2116 // "%u MB (CHS: %i, %i, %i)" -#define IDS_2117 2117 // "Floppy %i (%s): %ls" -#define IDS_2118 2118 // "All floppy images (*.0??;*.." -#define IDS_2119 2119 // "Unable to initialize Free.." -#define IDS_2120 2120 // "Unable to initialize SDL..." -#define IDS_2121 2121 // "Are you sure you want to..." -#define IDS_2122 2122 // "Are you sure you want to..." -#define IDS_2123 2123 // "Unable to initialize Ghostscript..." -#define IDS_2124 2124 // "MO %i (%03i): %ls" -#define IDS_2125 2125 // "MO images (*.IM?)\0*.IM..." -#define IDS_2126 2126 // "Welcome to 86Box!" +#define IDS_2080 2080 // "Unable to initialize Flui.." +#define IDS_2081 2081 // "Bus" +#define IDS_2082 2082 // "File" +#define IDS_2083 2083 // "C" +#define IDS_2084 2084 // "H" +#define IDS_2085 2085 // "S" +#define IDS_2086 2086 // "MB" +#define IDS_2087 2087 // "Check BPB" +#define IDS_2088 2088 // "KB" +#define IDS_2089 2089 // "Neither DirectDraw nor Dire.." +#define IDS_2090 2090 // "Default" +#define IDS_2091 2091 // "%i Wait state(s)" +#define IDS_2092 2092 // "Type" +#define IDS_2093 2093 // "PCap failed to set up.." +#define IDS_2094 2094 // "No PCap devices found" +#define IDS_2095 2095 // "Invalid PCap device" +#define IDS_2096 2096 // "Standard 2-button joystick(s)" +#define IDS_2097 2097 // "Standard 4-button joystick" +#define IDS_2098 2098 // "Standard 6-button joystick" +#define IDS_2099 2099 // "Standard 8-button joystick" +#define IDS_2100 2100 // "CH Flightstick Pro" +#define IDS_2101 2101 // "Microsoft SideWinder Pad" +#define IDS_2102 2102 // "Thrustmaster Flight Cont.." +#define IDS_2103 2103 // "None" +#define IDS_2104 2104 // "Unable to load Accelerators" +#define IDS_2105 2105 // "Unable to register Raw Input" +#define IDS_2106 2106 // "%u" +#define IDS_2107 2107 // "%u MB (CHS: %i, %i, %i)" +#define IDS_2108 2108 // "Floppy %i (%s): %ls" +#define IDS_2109 2109 // "All floppy images (*.0??;*.." +#define IDS_2110 2110 // "Unable to initialize Free.." +#define IDS_2111 2111 // "Unable to initialize SDL..." +#define IDS_2112 2112 // "Are you sure you want to..." +#define IDS_2113 2113 // "Are you sure you want to..." +#define IDS_2114 2114 // "Unable to initialize Ghostscript..." +#define IDS_2115 2115 // "MO %i (%03i): %ls" +#define IDS_2116 2116 // "MO images (*.IM?)\0*.IM..." +#define IDS_2117 2117 // "Welcome to 86Box!" #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" @@ -178,7 +169,7 @@ #define IDS_LANG_ENUS IDS_7168 -#define STR_NUM_2048 79 +#define STR_NUM_2048 70 #define STR_NUM_3072 11 #define STR_NUM_4096 18 #define STR_NUM_4352 7 diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 7e51ab210..5cf520dbf 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -289,6 +289,7 @@ extern int machine_at_p55t2s_init(const machine_t *); extern int machine_at_m7shi_init(const machine_t *); extern int machine_at_tc430hx_init(const machine_t *); extern int machine_at_equium5200_init(const machine_t *); +extern int machine_at_p65up5_cp55t2d_init(const machine_t *); extern int machine_at_p55tvp4_init(const machine_t *); extern int machine_at_p55va_init(const machine_t *); @@ -319,8 +320,14 @@ extern int machine_at_686nx_init(const machine_t *); extern int machine_at_mb600n_init(const machine_t *); extern int machine_at_8500ttc_init(const machine_t *); extern int machine_at_m6mi_init(const machine_t *); +extern int machine_at_vs440fx_init(const machine_t *); +#ifdef EMU_DEVICE_H +extern void machine_at_p65up5_common_init(const machine_t *, const device_t *northbridge); +#endif +extern int machine_at_p65up5_cp6nd_init(const machine_t *); /* m_at_slot1.c */ +extern int machine_at_p65up5_cpknd_init(const machine_t *); extern int machine_at_p6kfx_init(const machine_t *); extern int machine_at_6bxc_init(const machine_t *); diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index 25e607e0b..32af72c32 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -119,10 +119,15 @@ extern void do_stop(void); /* Platform-specific device support. */ +extern void floppy_mount(uint8_t id, wchar_t *fn, uint8_t wp); +extern void floppy_eject(uint8_t id); +extern void cdrom_mount(uint8_t id, wchar_t *fn); extern void plat_cdrom_ui_update(uint8_t id, uint8_t reload); extern void zip_eject(uint8_t id); +extern void zip_mount(uint8_t id, wchar_t *fn, uint8_t wp); extern void zip_reload(uint8_t id); extern void mo_eject(uint8_t id); +extern void mo_mount(uint8_t id, wchar_t *fn, uint8_t wp); extern void mo_reload(uint8_t id); extern int ioctl_open(uint8_t id, char d); extern void ioctl_reset(uint8_t id); diff --git a/src/include/86box/ui.h b/src/include/86box/ui.h index 6d6cafcd1..ce9635cf1 100644 --- a/src/include/86box/ui.h +++ b/src/include/86box/ui.h @@ -58,16 +58,12 @@ extern int ui_sb_find_part(int tag); extern void ui_sb_set_ready(int ready); extern void ui_sb_update_panes(void); extern void ui_sb_update_tip(int meaning); -extern void ui_sb_check_menu_item(int tag, int id, int chk); -extern void ui_sb_enable_menu_item(int tag, int id, int val); extern void ui_sb_timer_callback(int pane); extern void ui_sb_update_icon(int tag, int val); extern void ui_sb_update_icon_state(int tag, int active); extern void ui_sb_set_text_w(wchar_t *wstr); extern void ui_sb_set_text(char *str); extern void ui_sb_bugui(char *str); -extern void ui_sb_mount_floppy_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name); -extern void ui_sb_mount_zip_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name); #ifdef __cplusplus } diff --git a/src/include/86box/win.h b/src/include/86box/win.h index 5498d3f07..f73956656 100644 --- a/src/include/86box/win.h +++ b/src/include/86box/win.h @@ -43,6 +43,11 @@ #define SB_MENU_NAME L"StatusBarMenu" #define FS_CLASS_NAME L"86BoxFullScreen" +#define FLOPPY_SUBMENU_NAME L"FloppySubmenu" +#define CDROM_SUBMENU_NAME L"CdromSubmenu" +#define ZIP_SUBMENU_NAME L"ZIPSubmenu" +#define MO_SUBMENU_NAME L"MOSubmenu" + /* Application-specific window messages. A dialog sends 0x8895 with WPARAM = 1 followed by 0x8896 with WPARAM = 1 on open, @@ -181,6 +186,20 @@ extern int file_dlg_st(HWND hwnd, int i, char *fn, int save); extern wchar_t *BrowseFolder(wchar_t *saved_path, wchar_t *title); +/* Functions in win_media_menu.c */ +extern void media_menu_init(); +extern void media_menu_reset(); +extern int media_menu_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); +extern HMENU media_menu_get_floppy(int id); +extern HMENU media_menu_get_cdrom(int id); +extern HMENU media_menu_get_zip(int id); +extern HMENU media_menu_get_mo(int id); +extern void media_menu_update_floppy(int id); +extern void media_menu_update_cdrom(int id); +extern void media_menu_update_zip(int id); +extern void media_menu_update_mo(int id); + + #ifdef __cplusplus } #endif diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index 800768ce8..37c8868e6 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -33,12 +33,30 @@ #include <86box/intel_sio.h> #include <86box/piix.h> #include <86box/sio.h> +#include <86box/intel_sio.h> #include <86box/sst_flash.h> #include <86box/hwm.h> #include <86box/spd.h> #include <86box/video.h> #include "cpu.h" #include <86box/machine.h> + +int +machine_at_p65up5_cpknd_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear(L"roms/machines/p65up5/ndkn0218.awd", + 0x000e0000, 131072, 0); + + if (bios_only || !ret) + return ret; + + machine_at_p65up5_common_init(model, &i440fx_device); + + return ret; +} + int machine_at_p6kfx_init(const machine_t *model) { @@ -69,6 +87,7 @@ machine_at_p6kfx_init(const machine_t *model) return ret; } +#if defined(DEV_BRANCH) && defined(NO_SIO) int machine_at_6bxc_init(const machine_t *model) { @@ -93,12 +112,13 @@ machine_at_6bxc_init(const machine_t *model) device_add(&i440bx_device); device_add(&piix4e_device); device_add(&keyboard_ps2_pci_device); - device_add(&um8669f_device); /*Placeholder for ITE 8671*/ + device_add(&um8669f_device); /*ITE 8671*/ device_add(&sst_flash_39sf020_device); spd_register(SPD_TYPE_SDRAM, 0xF, 256); return ret; } +#endif int machine_at_p2bls_init(const machine_t *model) @@ -288,4 +308,4 @@ machine_at_borapro_init(const machine_t *model) spd_register(SPD_TYPE_SDRAM, 0x3, 256); return ret; -} \ No newline at end of file +} diff --git a/src/machine/m_at_socket7_s7.c b/src/machine/m_at_socket7_s7.c index 4eb1f963b..24a6d533c 100644 --- a/src/machine/m_at_socket7_s7.c +++ b/src/machine/m_at_socket7_s7.c @@ -400,6 +400,22 @@ machine_at_equium5200_init(const machine_t *model) // Information about that mac return ret; } +int +machine_at_p65up5_cp55t2d_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear(L"roms/machines/p65up5/td5i0201.awd", + 0x000e0000, 131072, 0); + + if (bios_only || !ret) + return ret; + + machine_at_p65up5_common_init(model, &i430hx_device); + + return ret; +} + int machine_at_p55tvp4_init(const machine_t *model) { @@ -549,6 +565,7 @@ machine_at_pb680_init(const machine_t *model) return ret; } +#if defined(DEV_BRANCH) && defined(NO_SIO) int machine_at_p55xb2_init(const machine_t *model) { @@ -577,7 +594,7 @@ machine_at_p55xb2_init(const machine_t *model) return ret; } - +#endif int machine_at_tx97_init(const machine_t *model) @@ -702,7 +719,7 @@ machine_at_ym430tx_init(const machine_t *model) return ret; } - +#if defined(DEV_BRANCH) && defined(NO_SIO) int machine_at_586t2_init(const machine_t *model) { @@ -796,7 +813,7 @@ machine_at_807ds_init(const machine_t *model) return ret; } - +#endif int machine_at_p5mms98_init(const machine_t *model) @@ -862,6 +879,7 @@ machine_at_p5mms98_init(const machine_t *model) return ret; } +#if defined(DEV_BRANCH) && defined(NO_SIO) int machine_at_tx100_init(const machine_t *model) { @@ -919,4 +937,5 @@ machine_at_advanceii_init(const machine_t *model) spd_register(SPD_TYPE_SDRAM, 0xF, 64); return ret; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/machine/m_at_socket8.c b/src/machine/m_at_socket8.c index 14b72dcc7..dba53237b 100644 --- a/src/machine/m_at_socket8.c +++ b/src/machine/m_at_socket8.c @@ -156,4 +156,72 @@ machine_at_m6mi_init(const machine_t *model) device_add(&intel_flash_bxt_device); return ret; -} \ No newline at end of file +} + +#if defined(DEV_BRANCH) && defined(NO_SIO) +int +machine_at_vs440fx_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear_combined2(L"roms/machines/vs440fx/1011CS1_.BIO", + L"roms/machines/vs440fx/1011CS1_.BI1", + L"roms/machines/vs440fx/1011CS1_.BI2", + L"roms/machines/vs440fx/1011CS1_.BI3", + L"roms/machines/vs440fx/1011CS1_.RCV", + 0x3a000, 128); + + if (bios_only || !ret) + return ret; + + machine_at_common_init(model); + + pci_init(PCI_CONFIG_TYPE_1); + pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); + device_add(&i440fx_device); + device_add(&piix3_device); + device_add(&keyboard_ps2_ami_pci_device); + //device_add(&pc87307_device); + device_add(&pc87306_device); + device_add(&intel_flash_bxt_ami_device); + + return ret; +} +#endif + +void +machine_at_p65up5_common_init(const machine_t *model, const device_t *northbridge) +{ + machine_at_common_init(model); + + pci_init(PCI_CONFIG_TYPE_1); + pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x01, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x09, PCI_CARD_NORMAL, 4, 1, 2, 3); + pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); + pci_register_slot(0x0B, PCI_CARD_NORMAL, 2, 3, 4, 1); + pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); + pci_register_slot(0x0D, PCI_CARD_NORMAL, 4, 1, 2, 3); + device_add(northbridge); + device_add(&piix3_device); + device_add(&keyboard_ps2_ami_pci_device); + device_add(&w83877f_device); + device_add(&intel_flash_bxt_device); +} + +int +machine_at_p65up5_cp6nd_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear(L"roms/machines/p65up5/nd6i0218.awd", + 0x000e0000, 131072, 0); + + if (bios_only || !ret) + return ret; + + machine_at_p65up5_common_init(model, &i440fx_device); + + return ret; +} diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 8cc0dbfaf..2ce007f51 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -244,28 +244,35 @@ const machine_t machines[] = { { "[Socket 7 HX] Micronics M7S-Hi", "m7shi", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 511, machine_at_m7shi_init, NULL }, { "[Socket 7 HX] Intel TC430HX", "tc430hx", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 255, machine_at_tc430hx_init, NULL }, { "[Socket 7 HX] Toshiba Equium 5200D", "equium5200", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 192, 8, 127, machine_at_equium5200_init, NULL }, + { "[Socket 7 HX] ASUS P/I-P65UP5 (C-P55T2D)","p65up5_cp55t2d", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 512, 8, 127, machine_at_p65up5_cp55t2d_init, NULL }, /* 430VX */ { "[Socket 7 VX] ASUS P/I-P55TVP4", "p55tvp4", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_p55tvp4_init, NULL }, { "[Socket 7 VX] Shuttle HOT-557", "430vx", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_i430vx_init, NULL }, { "[Socket 7 VX] Epox P55-VA", "p55va", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_p55va_init, NULL }, - { "[Socket 7 VX] HP Brio 80xx", "brio80xx", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_brio80xx_init, NULL }, - { "[Socket 7 VX] Packard Bell PB680", "pb680", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_pb680_init, NULL }, + { "[Socket 7 VX] HP Brio 80xx", "brio80xx", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_brio80xx_init, NULL }, + { "[Socket 7 VX] Packard Bell PB680", "pb680", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_pb680_init, NULL }, /* 430TX */ { "[Socket 7 TX] ASUS TX97", "tx97", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 256, 8, 255, machine_at_tx97_init, NULL }, +#if defined(DEV_BRANCH) && defined(NO_SIO) { "[Socket 7 TX] Gigabyte GA-586T2", "586t2", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 256, 8, 255, machine_at_586t2_init, NULL }, +#endif { "[Socket 7 TX] Intel YM430TX", "ym430tx", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 256, 8, 255, machine_at_ym430tx_init, NULL }, +#if defined(DEV_BRANCH) && defined(NO_SIO) { "[Socket 7 TX] Iwill P55XB2", "p55xb2", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 256, 8, 255, machine_at_p55xb2_init, NULL }, { "[Socket 7 TX] PC Partner TXA807DS", "807ds", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 256, 8, 255, machine_at_807ds_init, NULL }, +#endif { "[Socket 7 TX] SuperMicro P5MMS98", "p5mms98", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 256, 8, 255, machine_at_p5mms98_init, NULL }, +#if defined(DEV_BRANCH) && defined(NO_SIO) /* Apollo VPX */ { "[Socket 7 VPX] Zida Tomato TX100", "tx100", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 512, 8, 127, machine_at_tx100_init, NULL }, /* Apollo VP3 */ { "[Socket 7 VP3] QDI Advance II", "advanceii", MACHINE_CPUS_PENTIUM_S7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_advanceii_init, NULL }, - +#endif + /* Super Socket 7 machines */ /* Apollo MVP3 */ { "[Super 7 MVP3] AOpen AX59 Pro", "ax59pro", MACHINE_CPUS_PENTIUM_SS7, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 1024, 8, 255, machine_at_ax59pro_init, NULL }, @@ -277,15 +284,23 @@ const machine_t machines[] = { { "[Socket 8 FX] PC Partner MB600N", "mb600n", {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 512, 8, 127, machine_at_mb600n_init, NULL }, { "[Socket 8 FX] Biostar MB-8500ttc", "8500ttc", {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 512, 8, 127, machine_at_8500ttc_init, NULL }, { "[Socket 8 FX] Micronics M6MI", "m6mi", {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 384, 8, 127, machine_at_m6mi_init, NULL }, +#if defined(DEV_BRANCH) && defined(NO_SIO) + { "[Socket 8 FX] Intel VS440FX", "vs440fx", {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 256, 8, 127, machine_at_vs440fx_init, NULL }, +#endif + { "[Socket 8 FX] ASUS P/I-P65UP5 (C-P6ND)", "p65up5_cp6nd", {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 512, 8, 127, machine_at_p65up5_cp6nd_init, NULL }, + /* Slot 1 machines */ /* 440FX */ + { "[Slot 1 FX] ASUS P/I-P65UP5 (C-PKND)", "p65up5_cpknd", {{"Intel", cpus_PentiumII_28v},{"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 512, 8, 127, machine_at_p65up5_cpknd_init, NULL }, { "[Slot 1 FX] ECS P6KFX-A", "p6kfx", {{"Intel", cpus_PentiumII_28v},{"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 384, 8, 127, machine_at_p6kfx_init, NULL }, /* 440LX */ /* 440BX */ +#if defined(DEV_BRANCH) && defined(NO_SIO) { "[Slot 1 BX] Gigabyte GA-6BXC", "6bxc", {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL},{"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 768, 8, 255, machine_at_6bxc_init, NULL }, +#endif { "[Slot 1 BX] ASUS P2B-LS", "p2bls", {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL},{"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 1024, 8, 255, machine_at_p2bls_init, NULL }, { "[Slot 1 BX] ASUS P3B-F", "p3bf", {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL},{"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 1024, 8, 255, machine_at_p3bf_init, NULL }, { "[Slot 1 BX] ABit BF6", "bf6", {{"Intel", cpus_PentiumII}, {"Intel/PGA370", cpus_Celeron},{"VIA", cpus_Cyrix3},{"", NULL},{"", NULL}}, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 768, 8, 255, machine_at_bf6_init, NULL }, diff --git a/src/network/network.c b/src/network/network.c index 4273cf6fb..eaf317f89 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -328,7 +328,7 @@ network_reset(void) if (i < 0) { /* Tell user we can't do this (at the moment.) */ - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2102); + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2093); // FIXME: we should ask in the dialog if they want to // reconfigure or quit, and throw them into the diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index 93a628f5b..9cfc2a762 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -2036,7 +2036,7 @@ escp_init(void *lpt) if (ft_handle == NULL) { ft_handle = dynld_module(fn, ft_imports); if (ft_handle == NULL) { - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2119); + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2110); return(NULL); } } @@ -2044,7 +2044,7 @@ escp_init(void *lpt) /* Initialize FreeType. */ if (ft_lib == NULL) { if (ft_Init_FreeType(&ft_lib)) { - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2119); + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2110); dynld_close(ft_lib); ft_lib = NULL; return(NULL); diff --git a/src/printer/prt_ps.c b/src/printer/prt_ps.c index 8057213eb..b822ff17a 100644 --- a/src/printer/prt_ps.c +++ b/src/printer/prt_ps.c @@ -352,7 +352,7 @@ ps_init(void *lpt) /* Try loading the DLL. */ ghostscript_handle = dynld_module(PATH_GHOSTSCRIPT_DLL, ghostscript_imports); if (ghostscript_handle == NULL) { - ui_msgbox(MBX_ERROR, (wchar_t *) IDS_2123); + ui_msgbox(MBX_ERROR, (wchar_t *) IDS_2114); } else { if (gsapi_revision(&rev, sizeof(rev)) == 0) { pclog("Loaded %s, rev %ld (%ld)\n", rev.product, rev.revision, rev.revisiondate); diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index bc18027e6..11c4a8b57 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -230,7 +230,7 @@ void* fluidsynth_init(const device_t *info) #endif if (fluidsynth_handle == NULL) { - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2081); + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2080); return NULL; } diff --git a/src/win/86Box.rc b/src/win/86Box.rc index c71fb8b43..068f8d6ed 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -172,6 +172,62 @@ BEGIN MENUITEM SEPARATOR END +FloppySubmenu MENU DISCARDABLE +BEGIN + POPUP "" + BEGIN + MENUITEM "&New image...", IDM_FLOPPY_IMAGE_NEW + MENUITEM SEPARATOR + MENUITEM "&Existing image...", IDM_FLOPPY_IMAGE_EXISTING + MENUITEM "Existing image (&Write-protected)...", IDM_FLOPPY_IMAGE_EXISTING_WP + MENUITEM SEPARATOR + MENUITEM "E&xport to 86F...", IDM_FLOPPY_EXPORT_TO_86F + MENUITEM SEPARATOR + MENUITEM "E&ject", IDM_FLOPPY_EJECT + END +END + +CdromSubmenu MENU DISCARDABLE +BEGIN + POPUP "" + BEGIN + MENUITEM "&Mute", IDM_CDROM_MUTE + MENUITEM SEPARATOR + MENUITEM "E&mpty", IDM_CDROM_EMPTY + MENUITEM "&Reload previous image", IDM_CDROM_RELOAD + MENUITEM SEPARATOR + MENUITEM "&Image", IDM_CDROM_IMAGE + END +END + +ZIPSubmenu MENU DISCARDABLE +BEGIN + POPUP "" + BEGIN + MENUITEM "&New image...", IDM_ZIP_IMAGE_NEW + MENUITEM SEPARATOR + MENUITEM "&Existing image...", IDM_ZIP_IMAGE_EXISTING + MENUITEM "Existing image (&Write-protected)...", IDM_ZIP_IMAGE_EXISTING_WP + MENUITEM SEPARATOR + MENUITEM "E&ject", IDM_ZIP_EJECT + MENUITEM "&Reload previous image", IDM_ZIP_RELOAD + END +END + +MOSubmenu MENU DISCARDABLE +BEGIN + POPUP "" + BEGIN + MENUITEM "&New image...", IDM_MO_IMAGE_NEW + MENUITEM SEPARATOR + MENUITEM "&Existing image...", IDM_MO_IMAGE_EXISTING + MENUITEM "Existing image (&Write-protected)...", IDM_MO_IMAGE_EXISTING_WP + MENUITEM SEPARATOR + MENUITEM "E&ject", IDM_MO_EJECT + MENUITEM "&Reload previous image", IDM_MO_RELOAD + END +END + ///////////////////////////////////////////////////////////////////////////// // @@ -870,53 +926,44 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_2080 "E&xport to 86F..." - IDS_2081 "Unable to initialize FluidSynth, libfluidsynth.dll is required" - IDS_2082 "Bus" - IDS_2083 "File" - IDS_2084 "C" - IDS_2085 "H" - IDS_2086 "S" - IDS_2087 "MB" - IDS_2088 "Check BPB" - IDS_2089 "&Image..." - IDS_2090 "&Reload previous image" - IDS_2091 "E&mpty" - IDS_2092 "&Mute" - IDS_2093 "E&ject" - IDS_2094 "KB" - IDS_2095 "86Box could not initialize the video renderer." - IDS_2096 "&New image..." - IDS_2097 "&Existing image..." - IDS_2098 "Existing image (&Write-protected)..." - IDS_2099 "Default" - IDS_2100 "%i Wait state(s)" - IDS_2101 "Type" - IDS_2102 "PCap failed to set up because it may not be initialized" - IDS_2103 "No PCap devices found" - IDS_2104 "Invalid PCap device" - IDS_2105 "Standard 2-button joystick(s)" - IDS_2106 "Standard 4-button joystick" - IDS_2107 "Standard 6-button joystick" - IDS_2108 "Standard 8-button joystick" - IDS_2109 "CH Flightstick Pro" - IDS_2110 "Microsoft SideWinder Pad" - IDS_2111 "Thrustmaster Flight Control System" - IDS_2112 "None" - IDS_2113 "Unable to load Keyboard Accelerators!" - IDS_2114 "Unable to register Raw Input!" - IDS_2115 "%u" - IDS_2116 "%u MB (CHS: %i, %i, %i)" - IDS_2117 "Floppy %i (%s): %ls" - IDS_2118 "All images (*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF)\0*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F;*.MFM)\0*.86F;*.MFM\0All files (*.*)\0*.*\0" - IDS_2119 "Unable to initialize FreeType, freetype.dll is required" - IDS_2120 "Unable to initialize SDL, SDL2.dll is required" - IDS_2121 "Are you sure you want to hard reset the emulated machine?" - IDS_2122 "Are you sure you want to quit 86Box?" - IDS_2123 "Unable to initialize Ghostscript, gsdll32.dll is required for automatic convertion of PostScript files to PDF.\n\nAny documents sent to the generic PostScript printer will be saved as PostScript files (.ps)." - IDS_2124 "MO %i (%03i): %ls" - IDS_2125 "MO images (*.IM?)\0*.IM?\0All files (*.*)\0*.*\0" - IDS_2126 "Welcome to 86Box!" + IDS_2080 "Unable to initialize FluidSynth, libfluidsynth.dll is required" + IDS_2081 "Bus" + IDS_2082 "File" + IDS_2083 "C" + IDS_2084 "H" + IDS_2085 "S" + IDS_2086 "MB" + IDS_2087 "Check BPB" + IDS_2088 "KB" + IDS_2089 "86Box could not initialize the video renderer." + IDS_2090 "Default" + IDS_2091 "%i Wait state(s)" + IDS_2092 "Type" + IDS_2093 "PCap failed to set up because it may not be initialized" + IDS_2094 "No PCap devices found" + IDS_2095 "Invalid PCap device" + IDS_2096 "Standard 2-button joystick(s)" + IDS_2097 "Standard 4-button joystick" + IDS_2098 "Standard 6-button joystick" + IDS_2099 "Standard 8-button joystick" + IDS_2100 "CH Flightstick Pro" + IDS_2101 "Microsoft SideWinder Pad" + IDS_2102 "Thrustmaster Flight Control System" + IDS_2103 "None" + IDS_2104 "Unable to load Keyboard Accelerators!" + IDS_2105 "Unable to register Raw Input!" + IDS_2106 "%u" + IDS_2107 "%u MB (CHS: %i, %i, %i)" + IDS_2108 "Floppy %i (%s): %ls" + IDS_2109 "All images (*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF)\0*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F;*.MFM)\0*.86F;*.MFM\0All files (*.*)\0*.*\0" + IDS_2110 "Unable to initialize FreeType, freetype.dll is required" + IDS_2111 "Unable to initialize SDL, SDL2.dll is required" + IDS_2112 "Are you sure you want to hard reset the emulated machine?" + IDS_2113 "Are you sure you want to quit 86Box?" + IDS_2114 "Unable to initialize Ghostscript, gsdll32.dll is required for automatic convertion of PostScript files to PDF.\n\nAny documents sent to the generic PostScript printer will be saved as PostScript files (.ps)." + IDS_2115 "MO %i (%03i): %ls" + IDS_2116 "MO images (*.IM?)\0*.IM?\0All files (*.*)\0*.*\0" + IDS_2117 "Welcome to 86Box!" END STRINGTABLE DISCARDABLE diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index f8044ddd5..e57efc9bd 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -92,6 +92,9 @@ ifeq ($(DEV_BUILD), y) ifndef XL24 XL24 := y endif + ifndef NO_SIO + NO_SIO := y + endif else ifndef DEBUG DEBUG := n @@ -150,6 +153,9 @@ else ifndef XL24 XL24 := n endif + ifndef NO_SIO + NO_SIO := n + endif endif # Defaults for several build options (possibly defined in a chained file.) @@ -370,7 +376,7 @@ else win_sdl.o \ win_dialog.o win_about.o \ win_settings.o win_devconf.o win_snd_gain.o \ - win_new_floppy.o win_jsconf.o + win_new_floppy.o win_jsconf.o win_media_menu.o endif ifeq ($(OPENAL), y) @@ -484,6 +490,10 @@ ifeq ($(XL24), y) OPTS += -DUSE_XL24 endif +ifeq ($(NO_SIO), y) +OPTS += -DNO_SIO +endif + endif diff --git a/src/win/Makefile_ndr.mingw b/src/win/Makefile_ndr.mingw index 1a15963e6..1967963ea 100644 --- a/src/win/Makefile_ndr.mingw +++ b/src/win/Makefile_ndr.mingw @@ -92,6 +92,9 @@ ifeq ($(DEV_BUILD), y) ifndef XL24 XL24 := y endif + ifndef NO_SIO + NO_SIO := y + endif else ifndef DEBUG DEBUG := n @@ -153,6 +156,9 @@ else ifndef XL24 XL24 := n endif + ifndef NO_SIO + NO_SIO := n + endif endif # Defaults for several build options (possibly defined in a chained file.) @@ -379,7 +385,7 @@ else win_sdl.o \ win_dialog.o win_about.o \ win_settings.o win_devconf.o win_snd_gain.o \ - win_new_floppy.o win_jsconf.o + win_new_floppy.o win_jsconf.o win_media_menu.o endif ifeq ($(OPENAL), y) @@ -493,6 +499,10 @@ ifeq ($(XL24), y) OPTS += -DUSE_XL24 endif +ifeq ($(NO_SIO), y) +OPTS += -DNO_SIO +endif + endif diff --git a/src/win/win_cdrom.c b/src/win/win_cdrom.c index 82f4adbe0..f470c0a57 100644 --- a/src/win/win_cdrom.c +++ b/src/win/win_cdrom.c @@ -28,6 +28,8 @@ #include #include #include <86box/config.h> +#include <86box/timer.h> +#include <86box/fdd.h> #include <86box/hdd.h> #include <86box/scsi_device.h> #include <86box/cdrom.h> @@ -39,25 +41,68 @@ #include <86box/win.h> +void +floppy_mount(uint8_t id, wchar_t *fn, uint8_t wp) +{ + fdd_close(id); + ui_writeprot[id] = wp; + fdd_load(id, fn); + ui_sb_update_icon_state(SB_FLOPPY | id, wcslen(floppyfns[id]) ? 0 : 1); + media_menu_update_floppy(id); + ui_sb_update_tip(SB_FLOPPY | id); + config_save(); +} + +void +floppy_eject(uint8_t id) +{ + fdd_close(id); + ui_sb_update_icon_state(SB_FLOPPY | id, 1); + media_menu_update_floppy(id); + ui_sb_update_tip(SB_FLOPPY | id); + config_save(); +} + + void plat_cdrom_ui_update(uint8_t id, uint8_t reload) { cdrom_t *drv = &cdrom[id]; if (drv->host_drive == 0) { - ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_CHECKED); - ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_UNCHECKED); ui_sb_update_icon_state(SB_CDROM|id, 1); } else { - ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_EMPTY | id, MF_UNCHECKED); - ui_sb_check_menu_item(SB_CDROM|id, IDM_CDROM_IMAGE | id, MF_CHECKED); ui_sb_update_icon_state(SB_CDROM|id, 0); } - ui_sb_enable_menu_item(SB_CDROM|id, IDM_CDROM_RELOAD | id, MF_BYCOMMAND | (reload ? MF_GRAYED : MF_ENABLED)); + media_menu_update_cdrom(id); ui_sb_update_tip(SB_CDROM|id); } +void +cdrom_mount(uint8_t id, wchar_t *fn) +{ + cdrom[id].prev_host_drive = cdrom[id].host_drive; + wcscpy(cdrom[id].prev_image_path, cdrom[id].image_path); + if (cdrom[id].ops && cdrom[id].ops->exit) + cdrom[id].ops->exit(&(cdrom[id])); + cdrom[id].ops = NULL; + memset(cdrom[id].image_path, 0, sizeof(cdrom[id].image_path)); + cdrom_image_open(&(cdrom[id]), fn); + /* Signal media change to the emulated machine. */ + if (cdrom[id].insert) + cdrom[id].insert(cdrom[id].priv); + cdrom[id].host_drive = (wcslen(cdrom[id].image_path) == 0) ? 0 : 200; + if (cdrom[id].host_drive == 200) { + ui_sb_update_icon_state(SB_CDROM | id, 0); + } else { + ui_sb_update_icon_state(SB_CDROM | id, 1); + } + media_menu_update_cdrom(id); + ui_sb_update_tip(SB_CDROM | id); + config_save(); +} + void mo_eject(uint8_t id) { @@ -70,13 +115,30 @@ mo_eject(uint8_t id) } ui_sb_update_icon_state(SB_MO | id, 1); - ui_sb_enable_menu_item(SB_MO|id, IDM_MO_EJECT | id, MF_BYCOMMAND | MF_GRAYED); - ui_sb_enable_menu_item(SB_MO|id, IDM_MO_RELOAD | id, MF_BYCOMMAND | MF_ENABLED); + media_menu_update_mo(id); ui_sb_update_tip(SB_MO | id); config_save(); } +void +mo_mount(uint8_t id, wchar_t *fn, uint8_t wp) +{ + mo_t *dev = (mo_t *) mo_drives[id].priv; + + mo_disk_close(dev); + mo_drives[id].read_only = wp; + mo_load(dev, fn); + mo_insert(dev); + + ui_sb_update_icon_state(SB_MO | id, wcslen(mo_drives[id].image_path) ? 0 : 1); + media_menu_update_mo(id); + ui_sb_update_tip(SB_MO | id); + + config_save(); +} + + void mo_reload(uint8_t id) { @@ -84,14 +146,12 @@ mo_reload(uint8_t id) mo_disk_reload(dev); if (wcslen(mo_drives[id].image_path) == 0) { - ui_sb_enable_menu_item(SB_MO|id, IDM_MO_EJECT | id, MF_BYCOMMAND | MF_GRAYED); ui_sb_update_icon_state(SB_MO|id, 1); } else { - ui_sb_enable_menu_item(SB_MO|id, IDM_MO_EJECT | id, MF_BYCOMMAND | MF_ENABLED); ui_sb_update_icon_state(SB_MO|id, 0); } - ui_sb_enable_menu_item(SB_MO|id, IDM_MO_RELOAD | id, MF_BYCOMMAND | MF_GRAYED); + media_menu_update_mo(id); ui_sb_update_tip(SB_MO|id); config_save(); @@ -109,13 +169,30 @@ zip_eject(uint8_t id) } ui_sb_update_icon_state(SB_ZIP | id, 1); - ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_GRAYED); - ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_ENABLED); + media_menu_update_zip(id); ui_sb_update_tip(SB_ZIP | id); config_save(); } +void +zip_mount(uint8_t id, wchar_t *fn, uint8_t wp) +{ + zip_t *dev = (zip_t *) zip_drives[id].priv; + + zip_disk_close(dev); + zip_drives[id].read_only = wp; + zip_load(dev, fn); + zip_insert(dev); + + ui_sb_update_icon_state(SB_ZIP | id, wcslen(zip_drives[id].image_path) ? 0 : 1); + media_menu_update_zip(id); + ui_sb_update_tip(SB_ZIP | id); + + config_save(); +} + + void zip_reload(uint8_t id) { @@ -123,14 +200,12 @@ zip_reload(uint8_t id) zip_disk_reload(dev); if (wcslen(zip_drives[id].image_path) == 0) { - ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_GRAYED); ui_sb_update_icon_state(SB_ZIP|id, 1); } else { - ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_ENABLED); ui_sb_update_icon_state(SB_ZIP|id, 0); } - ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_GRAYED); + media_menu_update_zip(id); ui_sb_update_tip(SB_ZIP|id); config_save(); diff --git a/src/win/win_media_menu.c b/src/win/win_media_menu.c new file mode 100644 index 000000000..cdd4b90ac --- /dev/null +++ b/src/win/win_media_menu.c @@ -0,0 +1,559 @@ +#define UNICODE +#include +#include +#include +#include +#include <86box/86box.h> +#include <86box/cdrom.h> +#include <86box/config.h> +#include <86box/device.h> +#include <86box/timer.h> +#include <86box/fdd.h> +#include <86box/fdd_86f.h> +#include <86box/hdc.h> +#include <86box/language.h> +#include <86box/machine.h> +#include <86box/scsi_device.h> +#include <86box/mo.h> +#include <86box/plat.h> +#include <86box/scsi.h> +#include <86box/sound.h> +#include <86box/ui.h> +#include <86box/zip.h> +#include <86box/win.h> + +#define MACHINE_HAS_IDE ((machines[machine].flags & MACHINE_HDC) || !memcmp(hdc_get_internal_name(hdc_current), "ide", 3)) + +#define FDD_FIRST 0 +#define CDROM_FIRST FDD_FIRST + FDD_NUM +#define ZIP_FIRST CDROM_FIRST + CDROM_NUM +#define MO_FIRST ZIP_FIRST + ZIP_NUM + +static HMENU media_menu, stbar_menu; +static HMENU menus[FDD_NUM + CDROM_NUM + ZIP_NUM + MO_NUM]; +static char index_map[255]; + +static void +media_menu_set_ids(HMENU hMenu, int id) +{ + int c = GetMenuItemCount(hMenu); + + MENUITEMINFO mii = { 0 }; + mii.fMask = MIIM_ID; + mii.cbSize = sizeof(mii); + + for(int i = 0; i < c; i++) + { + GetMenuItemInfo(hMenu, i, TRUE, &mii); + mii.wID |= id; + SetMenuItemInfo(hMenu, i, TRUE, &mii); + } +} + +/* Loads the submenu from resource by name */ +static HMENU +media_menu_load_resource(wchar_t *lpName) +{ + HMENU loaded = LoadMenu(NULL, lpName); + + /* The actual submenu is in a dummy popup menu item */ + HMENU actual = GetSubMenu(loaded, 0); + + /* Now that we have our submenu, we can destroy the parent menu */ + RemoveMenu(loaded, (UINT_PTR)actual, MF_BYCOMMAND); + DestroyMenu(loaded); + + return actual; +} + +static void +media_menu_set_name_floppy(int drive) +{ + wchar_t name[512], temp[512]; + MENUITEMINFO mii = { 0 }; + + mbstowcs(temp, fdd_getname(fdd_get_type(drive)), + strlen(fdd_getname(fdd_get_type(drive))) + 1); + if (wcslen(floppyfns[drive]) == 0) { + _swprintf(name, plat_get_string(IDS_2108), + drive + 1, temp, plat_get_string(IDS_2057)); + } else { + _swprintf(name, plat_get_string(IDS_2108), + drive + 1, temp, floppyfns[drive]); + } + + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_STRING; + mii.dwTypeData = name; + + SetMenuItemInfo(media_menu, (UINT_PTR)menus[FDD_FIRST + drive], FALSE, &mii); +} + +static void +media_menu_set_name_cdrom(int drive) +{ + wchar_t name[512], *temp; + MENUITEMINFO mii = { 0 }; + + int bus = cdrom[drive].bus_type; + int id = IDS_5377 + (bus - 1); + + temp = plat_get_string(id); + + if (cdrom[drive].host_drive == 200) { + if (wcslen(cdrom[drive].image_path) == 0) + _swprintf(name, plat_get_string(IDS_5120), drive+1, temp, plat_get_string(IDS_2057)); + else + _swprintf(name, plat_get_string(IDS_5120), drive+1, temp, cdrom[drive].image_path); + } else + _swprintf(name, plat_get_string(IDS_5120), drive+1, temp, plat_get_string(IDS_2057)); + + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_STRING; + mii.dwTypeData = name; + + SetMenuItemInfo(media_menu, (UINT_PTR)menus[CDROM_FIRST + drive], FALSE, &mii); +} + +static void +media_menu_set_name_zip(int drive) +{ + wchar_t name[512], *temp; + MENUITEMINFO mii = { 0 }; + + int bus = zip_drives[drive].bus_type; + int id = IDS_5377 + (bus - 1); + + temp = plat_get_string(id); + + int type = zip_drives[drive].is_250 ? 250 : 100; + + if (wcslen(zip_drives[drive].image_path) == 0) { + _swprintf(name, plat_get_string(IDS_2054), + type, drive+1, temp, plat_get_string(IDS_2057)); + } else { + _swprintf(name, plat_get_string(IDS_2054), + type, drive+1, temp, zip_drives[drive].image_path); + } + + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_STRING; + mii.dwTypeData = name; + + SetMenuItemInfo(media_menu, (UINT_PTR)menus[ZIP_FIRST + drive], FALSE, &mii); +} + +static void +media_menu_set_name_mo(int drive) +{ + wchar_t name[512], *temp; + MENUITEMINFO mii = { 0 }; + + int bus = mo_drives[drive].bus_type; + int id = IDS_5377 + (bus - 1); + + temp = plat_get_string(id); + + if (wcslen(mo_drives[drive].image_path) == 0) { + _swprintf(name, plat_get_string(IDS_2115), + drive+1, temp, plat_get_string(IDS_2057)); + } else { + _swprintf(name, plat_get_string(IDS_2115), + drive+1, temp, mo_drives[drive].image_path); + } + + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_STRING; + mii.dwTypeData = name; + + SetMenuItemInfo(media_menu, (UINT_PTR)menus[MO_FIRST + drive], FALSE, &mii); +} + +void +media_menu_update_floppy(int id) +{ + int i = FDD_FIRST + id; + + if (floppyfns[id][0] == 0x0000) { + EnableMenuItem(menus[i], IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | MF_GRAYED); + EnableMenuItem(menus[i], IDM_FLOPPY_EXPORT_TO_86F | id, MF_BYCOMMAND | MF_GRAYED); + } else { + EnableMenuItem(menus[i], IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | MF_ENABLED); + EnableMenuItem(menus[i], IDM_FLOPPY_EXPORT_TO_86F | id, MF_BYCOMMAND | MF_ENABLED); + } + + media_menu_set_name_floppy(id); +} + +void +media_menu_update_cdrom(int id) +{ + int i = CDROM_FIRST + id; + + if (! cdrom[id].sound_on) + CheckMenuItem(menus[i], IDM_CDROM_MUTE | id, MF_BYCOMMAND | MF_CHECKED); + else + CheckMenuItem(menus[i], IDM_CDROM_MUTE | id, MF_BYCOMMAND | MF_UNCHECKED); + + if (cdrom[id].host_drive == 200) { + CheckMenuItem(menus[i], IDM_CDROM_IMAGE | id, MF_BYCOMMAND | MF_CHECKED); + CheckMenuItem(menus[i], IDM_CDROM_EMPTY | id, MF_BYCOMMAND | MF_UNCHECKED); + } else { + cdrom[id].host_drive = 0; + CheckMenuItem(menus[i], IDM_CDROM_IMAGE | id, MF_BYCOMMAND | MF_UNCHECKED); + CheckMenuItem(menus[i], IDM_CDROM_EMPTY | id, MF_BYCOMMAND | MF_CHECKED); + } + + if(cdrom[id].prev_host_drive == 0) + EnableMenuItem(menus[i], IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED); + else + EnableMenuItem(menus[i], IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_ENABLED); + + media_menu_set_name_cdrom(id); +} + +void +media_menu_update_zip(int id) +{ + int i = ZIP_FIRST + id; + + if (zip_drives[id].image_path[0] == 0x0000) + EnableMenuItem(menus[i], IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_GRAYED); + else + EnableMenuItem(menus[i], IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_ENABLED); + + if(zip_drives[id].prev_image_path[0] == 0x0000) + EnableMenuItem(menus[i], IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_GRAYED); + else + EnableMenuItem(menus[i], IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_ENABLED); + + media_menu_set_name_zip(id); +} + +void +media_menu_update_mo(int id) +{ + int i = MO_FIRST + id; + + if (mo_drives[id].image_path[0] == 0x0000) + EnableMenuItem(menus[i], IDM_MO_EJECT | id, MF_BYCOMMAND | MF_GRAYED); + else + EnableMenuItem(menus[i], IDM_MO_EJECT | id, MF_BYCOMMAND | MF_ENABLED); + + if(mo_drives[id].prev_image_path[0] == 0x0000) + EnableMenuItem(menus[i], IDM_MO_RELOAD | id, MF_BYCOMMAND | MF_GRAYED); + else + EnableMenuItem(menus[i], IDM_MO_RELOAD | id, MF_BYCOMMAND | MF_ENABLED); + + media_menu_set_name_mo(id); +} + +static void +media_menu_load_submenus() +{ + memset(index_map, -1, sizeof(index_map)); + + int curr = 0; + + for(int i = 0; i < FDD_NUM; i++) { + menus[curr] = media_menu_load_resource(FLOPPY_SUBMENU_NAME); + media_menu_set_ids(menus[curr++], i); + } + + for(int i = 0; i < CDROM_NUM; i++) { + menus[curr] = media_menu_load_resource(CDROM_SUBMENU_NAME); + media_menu_set_ids(menus[curr++], i); + } + + for(int i = 0; i < ZIP_NUM; i++) { + menus[curr] = media_menu_load_resource(ZIP_SUBMENU_NAME); + media_menu_set_ids(menus[curr++], i); + } + + for(int i = 0; i < MO_NUM; i++) { + menus[curr] = media_menu_load_resource(MO_SUBMENU_NAME); + media_menu_set_ids(menus[curr++], i); + } +} + +static inline int +is_valid_fdd(int i) +{ + return fdd_get_type(i) != 0; +} + +static inline int +is_valid_cdrom(int i) +{ + if ((cdrom[i].bus_type == CDROM_BUS_ATAPI) && !MACHINE_HAS_IDE) + return 0; + if ((cdrom[i].bus_type == CDROM_BUS_SCSI) && (scsi_card_current == 0)) + return 0; + return cdrom[i].bus_type != 0; +} + +static inline int +is_valid_zip(int i) +{ + if ((zip_drives[i].bus_type == ZIP_BUS_ATAPI) && !MACHINE_HAS_IDE) + return 0; + if ((zip_drives[i].bus_type == ZIP_BUS_SCSI) && (scsi_card_current == 0)) + return 0; + return zip_drives[i].bus_type != 0; +} + +static inline int +is_valid_mo(int i) +{ + if ((mo_drives[i].bus_type == MO_BUS_ATAPI) && !MACHINE_HAS_IDE) + return 0; + if ((mo_drives[i].bus_type == MO_BUS_SCSI) && (scsi_card_current == 0)) + return 0; + return mo_drives[i].bus_type != 0; +} + +void +media_menu_reset() +{ + /* Remove existing entries. */ + int c = GetMenuItemCount(media_menu); + + for(int i = 0; i < c; i++) + RemoveMenu(media_menu, 0, MF_BYPOSITION); + + /* Add new ones. */ + int curr = 0; + + for(int i = 0; i < FDD_NUM; i++) { + if(is_valid_fdd(i)) { + AppendMenu(media_menu, MF_POPUP | MF_STRING, (UINT_PTR)menus[curr], L"Test"); + media_menu_update_floppy(i); + } + curr++; + } + + for(int i = 0; i < CDROM_NUM; i++) { + if(is_valid_cdrom(i)) { + AppendMenu(media_menu, MF_POPUP | MF_STRING, (UINT_PTR)menus[curr], L"Test"); + media_menu_update_cdrom(i); + } + curr++; + } + + for(int i = 0; i < ZIP_NUM; i++) { + if(is_valid_zip(i)) { + AppendMenu(media_menu, MF_POPUP | MF_STRING, (UINT_PTR)menus[curr], L"Test"); + media_menu_update_zip(i); + } + curr++; + } + + for(int i = 0; i < MO_NUM; i++) { + if(is_valid_mo(i)) { + AppendMenu(media_menu, MF_POPUP | MF_STRING, (UINT_PTR)menus[curr], L"Test"); + media_menu_update_mo(i); + } + curr++; + } +} + +/* Initializes the Media menu in the main menu bar. */ +static void +media_menu_main_init() +{ + HMENU hMenu; + LPWSTR lpMenuName; + + hMenu = GetMenu(hwndMain); + media_menu = CreatePopupMenu(); + + /* Get the menu name */ + int len = GetMenuString(hMenu, IDM_MEDIA, NULL, 0, MF_BYCOMMAND); + lpMenuName = malloc((len + 1) * sizeof(WCHAR)); + GetMenuString(hMenu, IDM_MEDIA, lpMenuName, len + 1, MF_BYCOMMAND); + + /* Replace the placeholder menu item */ + ModifyMenu(hMenu, IDM_MEDIA, MF_BYCOMMAND | MF_STRING | MF_POPUP, (UINT_PTR)media_menu, lpMenuName); + + /* Clean up */ + DrawMenuBar(hwndMain); + free(lpMenuName); +} + +void +media_menu_init() +{ + /* Initialize the main menu bar menu */ + media_menu_main_init(); + + /* Initialize the dummy status bar menu. */ + stbar_menu = CreateMenu(); + AppendMenu(stbar_menu, MF_POPUP, (UINT_PTR)media_menu, NULL); + + /* Load the submenus for each drive type. */ + media_menu_load_submenus(); + + /* Populate the Media and status bar menus. */ + media_menu_reset(); +} + +int +media_menu_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int id = 0, ret = 0, wp = 0; + + id = LOWORD(wParam) & 0x00ff; + + switch (LOWORD(wParam) & 0xff00) { + case IDM_FLOPPY_IMAGE_NEW: + if (menus == NULL) + break; + + NewFloppyDialogCreate(hwnd, id, 0); + break; + + case IDM_FLOPPY_IMAGE_EXISTING_WP: + wp = 1; + /* FALLTHROUGH */ + case IDM_FLOPPY_IMAGE_EXISTING: + if (menus == NULL) + break; + + ret = file_dlg_w_st(hwnd, IDS_2109, floppyfns[id], 0); + if (! ret) { + floppy_mount(id, wopenfilestring, wp); + } + break; + + case IDM_FLOPPY_EJECT: + if (menus == NULL) + break; + + floppy_eject(id); + break; + + case IDM_FLOPPY_EXPORT_TO_86F: + if (menus == NULL) + break; + + ret = file_dlg_w_st(hwnd, IDS_2076, floppyfns[id], 1); + if (! ret) { + plat_pause(1); + ret = d86f_export(id, wopenfilestring); + if (!ret) + ui_msgbox(MBX_ERROR, (wchar_t *)IDS_4108); + plat_pause(0); + } + break; + + case IDM_CDROM_MUTE: + if (menus == NULL) + break; + + cdrom[id].sound_on ^= 1; + config_save(); + media_menu_update_cdrom(id); + sound_cd_thread_reset(); + break; + + case IDM_CDROM_EMPTY: + if (menus == NULL) + break; + + cdrom_eject(id); + break; + + case IDM_CDROM_RELOAD: + if (menus == NULL) + break; + + cdrom_reload(id); + break; + + case IDM_CDROM_IMAGE: + if (menus == NULL) + break; + + if (!file_dlg_w_st(hwnd, IDS_2075, cdrom[id].image_path, 0)) { + cdrom_mount(id, wopenfilestring); + } + break; + + case IDM_ZIP_IMAGE_NEW: + NewFloppyDialogCreate(hwnd, id | 0x80, 0); /* NewZIPDialogCreate */ + break; + + case IDM_ZIP_IMAGE_EXISTING_WP: + wp = 1; + /* FALLTHROUGH */ + case IDM_ZIP_IMAGE_EXISTING: + if (menus == NULL) + break; + + ret = file_dlg_w_st(hwnd, IDS_2058, zip_drives[id].image_path, 0); + if (! ret) + zip_mount(id, wopenfilestring, wp); + break; + + case IDM_ZIP_EJECT: + zip_eject(id); + break; + + case IDM_ZIP_RELOAD: + zip_reload(id); + break; + + case IDM_MO_IMAGE_NEW: + NewFloppyDialogCreate(hwnd, id | 0x80, 0); /* NewZIPDialogCreate */ + break; + + case IDM_MO_IMAGE_EXISTING_WP: + wp = 1; + /* FALLTHROUGH */ + case IDM_MO_IMAGE_EXISTING: + if (menus == NULL) + break; + + ret = file_dlg_w_st(hwnd, IDS_2116, mo_drives[id].image_path, 0); + if (! ret) + mo_mount(id, wopenfilestring, wp); + break; + + case IDM_MO_EJECT: + mo_eject(id); + break; + + case IDM_MO_RELOAD: + mo_reload(id); + break; + + default: + return(0); + } + + return(1); +} + +HMENU +media_menu_get_floppy(int id) +{ + return menus[FDD_FIRST + id]; +} + +HMENU +media_menu_get_cdrom(int id) +{ + return menus[CDROM_FIRST + id]; +} + +HMENU +media_menu_get_zip(int id) +{ + return menus[ZIP_FIRST + id]; +} + +HMENU +media_menu_get_mo(int id) +{ + return menus[MO_FIRST + id]; +} \ No newline at end of file diff --git a/src/win/win_new_floppy.c b/src/win/win_new_floppy.c index 1dd3aa2c1..78c51b497 100644 --- a/src/win/win_new_floppy.c +++ b/src/win/win_new_floppy.c @@ -601,9 +601,11 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) } if (ret) { if (is_zip) - ui_sb_mount_zip_img(fdd_id, sb_part, 0, fd_file_name); + //ui_sb_mount_zip_img(fdd_id, sb_part, 0, fd_file_name); + zip_mount(fdd_id, fd_file_name, 0); else - ui_sb_mount_floppy_img(fdd_id, sb_part, 0, fd_file_name); + //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(hdlg, MBX_ERROR, (wchar_t *)IDS_4108); return TRUE; diff --git a/src/win/win_settings.c b/src/win/win_settings.c index b34afd943..413fe2daf 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -625,11 +625,11 @@ win_settings_machine_recalc_machine(HWND hdlg) if (!(machines[temp_machine].flags & MACHINE_AT) || (machines[temp_machine].ram_granularity >= 128)) { SendMessage(h, UDM_SETPOS, 0, temp_mem_size); h = GetDlgItem(hdlg, IDC_TEXT_MB); - SendMessage(h, WM_SETTEXT, 0, win_get_string(IDS_2094)); + SendMessage(h, WM_SETTEXT, 0, win_get_string(IDS_2088)); } else { SendMessage(h, UDM_SETPOS, 0, temp_mem_size / 1024); h = GetDlgItem(hdlg, IDC_TEXT_MB); - SendMessage(h, WM_SETTEXT, 0, win_get_string(IDS_2087)); + SendMessage(h, WM_SETTEXT, 0, win_get_string(IDS_2086)); } free(lptsTemp); @@ -668,10 +668,10 @@ win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) SendMessage(h, CB_SETCURSEL, machinetolist[temp_machine], 0); h = GetDlgItem(hdlg, IDC_COMBO_WS); - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2099)); + SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2090)); for (c = 0; c < 8; c++) { - wsprintf(lptsTemp, plat_get_string(2100), c); + wsprintf(lptsTemp, plat_get_string(IDS_2091), c); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); } @@ -1009,7 +1009,7 @@ win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) mbstowcs(str, joy_name, strlen(joy_name) + 1); SendMessage(h, CB_ADDSTRING, 0, (LPARAM)str); - // SendMessage(h, CB_ADDSTRING, 0, win_get_string(2105 + c)); + // SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2096 + c)); c++; joy_name = joystick_get_name(c); } @@ -1155,7 +1155,7 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) if (device_is_valid(sound_dev, machines[temp_machine].flags)) { if (c == 0) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2112)); + SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2103)); else { mbstowcs(lptsTemp, s, strlen(s) + 1); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); @@ -1186,7 +1186,7 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) if (midi_device_available(c)) { if (c == 0) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2112)); + SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2103)); else { mbstowcs(lptsTemp, s, strlen(s) + 1); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); @@ -1217,7 +1217,7 @@ win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) if (midi_in_device_available(c)) { if (c == 0) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2112)); + SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2103)); else { mbstowcs(lptsTemp, s, strlen(s) + 1); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); @@ -1426,7 +1426,7 @@ win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) break; if (c == 0) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2112)); + SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2103)); else { mbstowcs(lptsTemp, s, strlen(s) + 1); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); @@ -1582,7 +1582,7 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa if (device_is_valid(scsi_dev, machines[temp_machine].flags)) { if (c == 0) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2112)); + SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2103)); else { mbstowcs(lptsTemp, s, strlen(s) + 1); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); @@ -1637,7 +1637,7 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa if (d == 0) { /* Translate "None". */ - SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2112)); + SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2103)); } else { mbstowcs(lptsTemp, s, strlen(s) + 1); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); @@ -1663,8 +1663,7 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa if (d == 0) { /* Translate "None". */ - SendMessage(h, CB_ADDSTRING, 0, - (LPARAM)win_get_string(IDS_2112)); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)win_get_string(IDS_2103)); } else { s = (char *) isamem_get_name(d); mbstowcs(lptsTemp, s, strlen(s) + 1); @@ -1922,7 +1921,7 @@ win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) if (network_card_available(c) && device_is_valid(network_card_getdevice(c), machines[temp_machine].flags)) { if (c == 0) - SendMessage(h, CB_ADDSTRING, 0, win_get_string(2112)); + SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2103)); else { mbstowcs(lptsTemp, s, strlen(s) + 1); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); @@ -2491,7 +2490,7 @@ win_settings_hard_disks_init_columns(HWND hwndList) for (iCol = 0; iCol < C_COLUMNS_HARD_DISKS; iCol++) { lvc.iSubItem = iCol; - lvc.pszText = plat_get_string(IDS_2082 + iCol); + lvc.pszText = plat_get_string(IDS_2081 + iCol); switch(iCol) { case 0: /* Bus */ @@ -2556,7 +2555,7 @@ set_edit_box_contents(HWND hdlg, int id, uint32_t val) WCHAR szText[256]; h = GetDlgItem(hdlg, id); - wsprintf(szText, plat_get_string(IDS_2115), val); + wsprintf(szText, plat_get_string(IDS_2106), val); SendMessage(h, WM_SETTEXT, (WPARAM) wcslen(szText), (LPARAM) szText); } @@ -2575,7 +2574,7 @@ static int hdconf_initialize_hdt_combo(HWND hdlg) for (i = 0; i < 127; i++) { temp_size = ((uint64_t) hdd_table[i][0]) * hdd_table[i][1] * hdd_table[i][2]; size_mb = (uint32_t) (temp_size >> 11LL); - wsprintf(szText, plat_get_string(IDS_2116), size_mb, hdd_table[i][0], hdd_table[i][1], hdd_table[i][2]); + wsprintf(szText, plat_get_string(IDS_2107), size_mb, hdd_table[i][0], hdd_table[i][1], hdd_table[i][2]); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText); if ((tracks == (int) hdd_table[i][0]) && (hpc == (int) hdd_table[i][1]) && (spt == (int) hdd_table[i][2])) @@ -3593,7 +3592,7 @@ win_settings_cdrom_drives_recalc_list(HWND hwndList) lvI.iSubItem = 1; if (temp_cdrom[i].bus_type == CDROM_BUS_DISABLED) - lvI.pszText = plat_get_string(IDS_2112); + lvI.pszText = plat_get_string(IDS_2103); else { wsprintf(szText, L"%ix", temp_cdrom[i].speed); lvI.pszText = szText; @@ -3667,7 +3666,7 @@ win_settings_floppy_drives_init_columns(HWND hwndList) lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.iSubItem = 0; - lvc.pszText = plat_get_string(IDS_2101); + lvc.pszText = plat_get_string(IDS_2092); lvc.cx = 292; lvc.fmt = LVCFMT_LEFT; @@ -3685,7 +3684,7 @@ win_settings_floppy_drives_init_columns(HWND hwndList) return FALSE; lvc.iSubItem = 2; - lvc.pszText = plat_get_string(IDS_2088); + lvc.pszText = plat_get_string(IDS_2087); lvc.cx = 75; lvc.fmt = LVCFMT_LEFT; @@ -3705,7 +3704,7 @@ win_settings_cdrom_drives_init_columns(HWND hwndList) lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.iSubItem = 0; - lvc.pszText = plat_get_string(IDS_2082); + lvc.pszText = plat_get_string(IDS_2081); lvc.cx = 342; lvc.fmt = LVCFMT_LEFT; @@ -3734,7 +3733,7 @@ win_settings_zip_drives_init_columns(HWND hwndList) lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.iSubItem = 0; - lvc.pszText = plat_get_string(IDS_2082); + lvc.pszText = plat_get_string(IDS_2081); lvc.cx = 342; lvc.fmt = LVCFMT_LEFT; @@ -3743,7 +3742,7 @@ win_settings_zip_drives_init_columns(HWND hwndList) return FALSE; lvc.iSubItem = 1; - lvc.pszText = plat_get_string(IDS_2101); + lvc.pszText = plat_get_string(IDS_2092); lvc.cx = 50; lvc.fmt = LVCFMT_LEFT; @@ -3857,7 +3856,7 @@ win_settings_cdrom_drives_update_item(HWND hwndList, int i) lvI.iSubItem = 1; if (temp_cdrom[i].bus_type == CDROM_BUS_DISABLED) - lvI.pszText = plat_get_string(IDS_2112); + lvI.pszText = plat_get_string(IDS_2103); else { wsprintf(szText, L"%ix", temp_cdrom[i].speed); lvI.pszText = szText; diff --git a/src/win/win_stbar.c b/src/win/win_stbar.c index bdbd13f87..f509b45a5 100644 --- a/src/win/win_stbar.c +++ b/src/win/win_stbar.c @@ -62,8 +62,6 @@ int update_icons = 1; static LONG_PTR OriginalProcedure; -static HMENU *sb_menu_handles; -static HMENU menuSBAR; static WCHAR **sbTips; static int *iStatusWidths; static int *sb_part_meanings; @@ -72,10 +70,6 @@ static int sb_parts = 0; static int sb_ready = 0; static uint8_t sb_map[256]; -static HMENU hmenuMedia; -static HMENU *media_menu_handles; - - /* Also used by win_settings.c */ intptr_t fdd_type_to_icon(int type) @@ -120,107 +114,6 @@ hdd_count(int bus) } -static void -StatusBarCreateFloppySubmenu(HMENU m, int id) -{ - AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_NEW | id, - plat_get_string(IDS_2096)); - AppendMenu(m, MF_SEPARATOR, 0, 0); - AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_EXISTING | id, - plat_get_string(IDS_2097)); - AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_EXISTING_WP | id, - plat_get_string(IDS_2098)); - AppendMenu(m, MF_SEPARATOR, 0, 0); - AppendMenu(m, MF_STRING, IDM_FLOPPY_EXPORT_TO_86F | id, - plat_get_string(IDS_2080)); - AppendMenu(m, MF_SEPARATOR, 0, 0); - AppendMenu(m, MF_STRING, IDM_FLOPPY_EJECT | id, - plat_get_string(IDS_2093)); - - if (floppyfns[id][0] == 0x0000) { - EnableMenuItem(m, IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | MF_GRAYED); - EnableMenuItem(m, IDM_FLOPPY_EXPORT_TO_86F | id, MF_BYCOMMAND | MF_GRAYED); - } -} - - -static void -StatusBarCreateCdromSubmenu(HMENU m, int id) -{ - AppendMenu(m, MF_STRING, IDM_CDROM_MUTE | id, - plat_get_string(IDS_2092)); - AppendMenu(m, MF_SEPARATOR, 0, 0); - AppendMenu(m, MF_STRING, IDM_CDROM_EMPTY | id, - plat_get_string(IDS_2091)); - AppendMenu(m, MF_STRING, IDM_CDROM_RELOAD | id, - plat_get_string(IDS_2090)); - AppendMenu(m, MF_SEPARATOR, 0, 0); - AppendMenu(m, MF_STRING, IDM_CDROM_IMAGE | id, - plat_get_string(IDS_2089)); - - if (! cdrom[id].sound_on) - CheckMenuItem(m, IDM_CDROM_MUTE | id, MF_CHECKED); - - if (cdrom[id].host_drive == 200) - CheckMenuItem(m, IDM_CDROM_IMAGE | id, MF_CHECKED); - else { - cdrom[id].host_drive = 0; - CheckMenuItem(m, IDM_CDROM_EMPTY | id, MF_CHECKED); - } -} - - -static void -StatusBarCreateZIPSubmenu(HMENU m, int id) -{ - AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_NEW | id, - plat_get_string(IDS_2096)); - AppendMenu(m, MF_SEPARATOR, 0, 0); - AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_EXISTING | id, - plat_get_string(IDS_2097)); - AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_EXISTING_WP | id, - plat_get_string(IDS_2098)); - AppendMenu(m, MF_SEPARATOR, 0, 0); - AppendMenu(m, MF_STRING, IDM_ZIP_EJECT | id, - plat_get_string(IDS_2093)); - AppendMenu(m, MF_STRING, IDM_ZIP_RELOAD | id, - plat_get_string(IDS_2090)); - - if (zip_drives[id].image_path[0] == 0x0000) { - EnableMenuItem(m, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_GRAYED); - EnableMenuItem(m, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_ENABLED); - } else { - EnableMenuItem(m, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_ENABLED); - EnableMenuItem(m, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_GRAYED); - } -} - -static void -StatusBarCreateMOSubmenu(HMENU m, int id) -{ - AppendMenu(m, MF_STRING, IDM_MO_IMAGE_NEW | id, - plat_get_string(IDS_2096)); - AppendMenu(m, MF_SEPARATOR, 0, 0); - AppendMenu(m, MF_STRING, IDM_MO_IMAGE_EXISTING | id, - plat_get_string(IDS_2097)); - AppendMenu(m, MF_STRING, IDM_MO_IMAGE_EXISTING_WP | id, - plat_get_string(IDS_2098)); - AppendMenu(m, MF_SEPARATOR, 0, 0); - AppendMenu(m, MF_STRING, IDM_MO_EJECT | id, - plat_get_string(IDS_2093)); - AppendMenu(m, MF_STRING, IDM_MO_RELOAD | id, - plat_get_string(IDS_2090)); - - if (mo_drives[id].image_path[0] == 0x0000) { - EnableMenuItem(m, IDM_MO_EJECT | id, MF_BYCOMMAND | MF_GRAYED); - EnableMenuItem(m, IDM_MO_RELOAD | id, MF_BYCOMMAND | MF_ENABLED); - } else { - EnableMenuItem(m, IDM_MO_EJECT | id, MF_BYCOMMAND | MF_ENABLED); - EnableMenuItem(m, IDM_MO_RELOAD | id, MF_BYCOMMAND | MF_GRAYED); - } -} - - void ui_sb_timer_callback(int pane) { @@ -290,10 +183,10 @@ StatusBarCreateFloppyTip(int part) mbstowcs(wtext, fdd_getname(fdd_get_type(drive)), strlen(fdd_getname(fdd_get_type(drive))) + 1); if (wcslen(floppyfns[drive]) == 0) { - _swprintf(tempTip, plat_get_string(IDS_2117), + _swprintf(tempTip, plat_get_string(IDS_2108), drive+1, wtext, plat_get_string(IDS_2057)); } else { - _swprintf(tempTip, plat_get_string(IDS_2117), + _swprintf(tempTip, plat_get_string(IDS_2108), drive+1, wtext, floppyfns[drive]); } @@ -378,10 +271,10 @@ StatusBarCreateMOTip(int part) szText = plat_get_string(id); if (wcslen(mo_drives[drive].image_path) == 0) { - _swprintf(tempTip, plat_get_string(IDS_2124), + _swprintf(tempTip, plat_get_string(IDS_2115), drive+1, szText, plat_get_string(IDS_2057)); } else { - _swprintf(tempTip, plat_get_string(IDS_2124), + _swprintf(tempTip, plat_get_string(IDS_2115), drive+1, szText, mo_drives[drive].image_path); } @@ -486,54 +379,10 @@ ui_sb_update_tip(int meaning) } SendMessage(hwndSBAR, SB_SETTIPTEXT, part, (LPARAM)sbTips[part]); - ModifyMenu(hmenuMedia, part, MF_BYPOSITION, (UINT_PTR)media_menu_handles[part], sbTips[part]); } } -static void -MediaMenuDestroyMenus(void) -{ - int i; - - if (sb_parts == 0) return; - - if (! media_menu_handles) return; - - for (i=0; i 0) { for (i = 0; i < sb_parts; i++) SendMessage(hwndSBAR, SB_SETICON, i, (LPARAM)NULL); @@ -630,9 +457,7 @@ ui_sb_update_panes(void) free(sb_part_icons); sb_part_icons = NULL; } - StatusBarDestroyMenus(); StatusBarDestroyTips(); - MediaMenuDestroyMenus(); } memset(sb_map, 0xff, sizeof(sb_map)); @@ -691,12 +516,8 @@ ui_sb_update_panes(void) memset(sb_part_meanings, 0, sb_parts * sizeof(int)); sb_part_icons = (uint8_t *)malloc(sb_parts * sizeof(uint8_t)); memset(sb_part_icons, 0, sb_parts * sizeof(uint8_t)); - sb_menu_handles = (HMENU *)malloc(sb_parts * sizeof(HMENU)); - memset(sb_menu_handles, 0, sb_parts * sizeof(HMENU)); sbTips = (WCHAR **)malloc(sb_parts * sizeof(WCHAR *)); memset(sbTips, 0, sb_parts * sizeof(WCHAR *)); - media_menu_handles = (HMENU *)malloc(sb_parts * sizeof(HMENU)); - memset(media_menu_handles, 0, sb_parts * sizeof(HMENU)); sb_parts = 0; for (i=0; i= (sb_parts - 1)) return; pt.x = id * SB_ICON_WIDTH; /* Justify to the left. */ pt.y = 0; /* Justify to the top. */ ClientToScreen(hwnd, (LPPOINT) &pt); - TrackPopupMenu(sb_menu_handles[id], + + switch(sb_part_meanings[id] & 0xF0) { + case SB_FLOPPY: + menu = media_menu_get_floppy(sb_part_meanings[id] & 0x0F); + break; + case SB_CDROM: + menu = media_menu_get_cdrom(sb_part_meanings[id] & 0x0F); + break; + case SB_ZIP: + menu = media_menu_get_zip(sb_part_meanings[id] & 0x0F); + break; + case SB_MO: + menu = media_menu_get_mo(sb_part_meanings[id] & 0x0F); + break; + default: + return; + } + + TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, hwndSBAR, NULL); } -void -ui_sb_mount_floppy_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name) -{ - fdd_close(id); - ui_writeprot[id] = wp; - fdd_load(id, file_name); - if (sb_ready) { - ui_sb_update_icon_state(SB_FLOPPY | id, wcslen(floppyfns[id]) ? 0 : 1); - ui_sb_enable_menu_item(SB_FLOPPY | id, IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED)); - ui_sb_enable_menu_item(SB_FLOPPY | id, IDM_FLOPPY_EXPORT_TO_86F | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED)); - ui_sb_update_tip(SB_FLOPPY | id); - } - config_save(); -} - - -void -ui_sb_mount_zip_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name) -{ - zip_t *dev = (zip_t *) zip_drives[id].priv; - - zip_disk_close(dev); - zip_drives[id].read_only = wp; - zip_load(dev, file_name); - zip_insert(dev); - if (sb_ready) { - ui_sb_update_icon_state(SB_ZIP | id, wcslen(zip_drives[id].image_path) ? 0 : 1); - ui_sb_enable_menu_item(SB_ZIP | id, IDM_ZIP_EJECT | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_ENABLED : MF_GRAYED)); - ui_sb_enable_menu_item(SB_ZIP | id, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_GRAYED : MF_ENABLED)); - ui_sb_update_tip(SB_ZIP | id); - } - config_save(); -} - -void -ui_sb_mount_mo_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name) -{ - mo_t *dev = (mo_t *) mo_drives[id].priv; - - mo_disk_close(dev); - mo_drives[id].read_only = wp; - mo_load(dev, file_name); - mo_insert(dev); - if (sb_ready) { - ui_sb_update_icon_state(SB_MO | id, wcslen(mo_drives[id].image_path) ? 0 : 1); - ui_sb_enable_menu_item(SB_MO | id, IDM_MO_EJECT | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_ENABLED : MF_GRAYED)); - ui_sb_enable_menu_item(SB_MO | id, IDM_MO_RELOAD | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_GRAYED : MF_ENABLED)); - ui_sb_update_tip(SB_MO | id); - } - config_save(); -} - -int -MediaMenuHandler(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - int id = 0, ret = 0; - uint8_t part = 0; - WCHAR temp_path[1024]; - int item_id, item_params; - - item_id = LOWORD(wParam) & 0xff00; /* low 8 bits */ - item_params = LOWORD(wParam) & 0x00ff; /* high 8 bits */ - - switch (item_id) { - case IDM_FLOPPY_IMAGE_NEW: - id = item_params & 0x0003; - part = sb_map[SB_FLOPPY | id]; - if ((part == 0xff) || (sb_menu_handles == NULL)) - break; - - NewFloppyDialogCreate(hwnd, id, part); - break; - - case IDM_FLOPPY_IMAGE_EXISTING: - case IDM_FLOPPY_IMAGE_EXISTING_WP: - id = item_params & 0x0003; - part = sb_map[SB_FLOPPY | id]; - if ((part == 0xff) || (sb_menu_handles == NULL)) - break; - - ret = file_dlg_w_st(hwnd, IDS_2118, floppyfns[id], 0); - if (! ret) - ui_sb_mount_floppy_img(id, part, (item_id == IDM_FLOPPY_IMAGE_EXISTING_WP) ? 1 : 0, wopenfilestring); - break; - - case IDM_FLOPPY_EJECT: - id = item_params & 0x0003; - part = sb_map[SB_FLOPPY | id]; - if ((part == 0xff) || (sb_menu_handles == NULL)) - break; - - fdd_close(id); - ui_sb_update_icon_state(SB_FLOPPY | id, 1); - ui_sb_enable_menu_item(SB_FLOPPY | id, IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | MF_GRAYED); - ui_sb_enable_menu_item(SB_FLOPPY | id, IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | MF_GRAYED); - ui_sb_update_tip(SB_FLOPPY | id); - config_save(); - break; - - case IDM_FLOPPY_EXPORT_TO_86F: - id = item_params & 0x0003; - part = sb_map[SB_FLOPPY | id]; - if ((part == 0xff) || (sb_menu_handles == NULL)) - break; - - ret = file_dlg_w_st(hwnd, IDS_2076, floppyfns[id], 1); - if (! ret) { - plat_pause(1); - ret = d86f_export(id, wopenfilestring); - if (!ret) - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_4108); - plat_pause(0); - } - break; - - case IDM_CDROM_MUTE: - id = item_params & 0x0007; - part = sb_map[SB_CDROM | id]; - if ((part == 0xff) || (sb_menu_handles == NULL)) - break; - - cdrom[id].sound_on ^= 1; - ui_sb_check_menu_item(SB_CDROM | id, IDM_CDROM_MUTE | id, cdrom[id].sound_on ? MF_UNCHECKED : MF_CHECKED); - config_save(); - sound_cd_thread_reset(); - break; - - case IDM_CDROM_EMPTY: - id = item_params & 0x0007; - part = sb_map[SB_CDROM | id]; - if ((part == 0xff) || (sb_menu_handles == NULL)) - break; - - cdrom_eject(id); - break; - - case IDM_CDROM_RELOAD: - id = item_params & 0x0007; - part = sb_map[SB_CDROM | id]; - if ((part == 0xff) || (sb_menu_handles == NULL)) - break; - - cdrom_reload(id); - break; - - case IDM_CDROM_IMAGE: - id = item_params & 0x0007; - part = sb_map[SB_CDROM | id]; - if ((part == 0xff) || (sb_menu_handles == NULL)) - break; - - if (!file_dlg_w_st(hwnd, IDS_2075, cdrom[id].image_path, 0)) { - cdrom[id].prev_host_drive = cdrom[id].host_drive; - wcscpy(temp_path, wopenfilestring); - wcscpy(cdrom[id].prev_image_path, cdrom[id].image_path); - if (cdrom[id].ops && cdrom[id].ops->exit) - cdrom[id].ops->exit(&(cdrom[id])); - cdrom[id].ops = NULL; - memset(cdrom[id].image_path, 0, sizeof(cdrom[id].image_path)); - cdrom_image_open(&(cdrom[id]), temp_path); - /* Signal media change to the emulated machine. */ - if (cdrom[id].insert) - cdrom[id].insert(cdrom[id].priv); - cdrom[id].host_drive = (wcslen(cdrom[id].image_path) == 0) ? 0 : 200; - if (cdrom[id].host_drive == 200) { - ui_sb_check_menu_item(SB_CDROM | id, IDM_CDROM_EMPTY | id, MF_UNCHECKED); - ui_sb_check_menu_item(SB_CDROM | id, IDM_CDROM_IMAGE | id, MF_CHECKED); - ui_sb_update_icon_state(SB_CDROM | id, 0); - } else { - ui_sb_check_menu_item(SB_CDROM | id, IDM_CDROM_IMAGE | id, MF_UNCHECKED); - ui_sb_check_menu_item(SB_CDROM | id, IDM_CDROM_EMPTY | id, MF_CHECKED); - ui_sb_update_icon_state(SB_CDROM | id, 1); - } - ui_sb_enable_menu_item(SB_CDROM | id, IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED); - ui_sb_update_tip(SB_CDROM | id); - config_save(); - } - break; - - case IDM_ZIP_IMAGE_NEW: - id = item_params & 0x0003; - part = sb_map[SB_ZIP | id]; - NewFloppyDialogCreate(hwnd, id | 0x80, part); /* NewZIPDialogCreate */ - break; - - case IDM_ZIP_IMAGE_EXISTING: - case IDM_ZIP_IMAGE_EXISTING_WP: - id = item_params & 0x0003; - part = sb_map[SB_ZIP | id]; - if ((part == 0xff) || (sb_menu_handles == NULL)) - break; - - ret = file_dlg_w_st(hwnd, IDS_2058, zip_drives[id].image_path, 0); - if (! ret) - ui_sb_mount_zip_img(id, part, (item_id == IDM_ZIP_IMAGE_EXISTING_WP) ? 1 : 0, wopenfilestring); - break; - - case IDM_ZIP_EJECT: - id = item_params & 0x0003; - zip_eject(id); - break; - - case IDM_ZIP_RELOAD: - id = item_params & 0x0003; - zip_reload(id); - break; - - case IDM_MO_IMAGE_NEW: - id = item_params & 0x0003; - part = sb_map[SB_MO | id]; - NewFloppyDialogCreate(hwnd, id | 0x80, part); /* NewZIPDialogCreate */ - break; - - case IDM_MO_IMAGE_EXISTING: - case IDM_MO_IMAGE_EXISTING_WP: - id = item_params & 0x0003; - part = sb_map[SB_MO | id]; - if ((part == 0xff) || (sb_menu_handles == NULL)) - break; - - ret = file_dlg_w_st(hwnd, IDS_2125, mo_drives[id].image_path, 0); - if (! ret) - ui_sb_mount_mo_img(id, part, (item_id == IDM_MO_IMAGE_EXISTING_WP) ? 1 : 0, wopenfilestring); - break; - - case IDM_MO_EJECT: - id = item_params & 0x0003; - mo_eject(id); - break; - - case IDM_MO_RELOAD: - id = item_params & 0x0003; - mo_reload(id); - break; - - default: - return(0); - } - - return(1); -} - - /* Handle messages for the Status Bar window. */ #if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK @@ -1183,7 +744,7 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) switch (message) { case WM_COMMAND: - MediaMenuHandler(hwnd, message, wParam, lParam); + media_menu_proc(hwnd, message, wParam, lParam); return(0); case WM_LBUTTONDOWN: @@ -1215,27 +776,6 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } -void -MediaMenuCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst) -{ - HMENU hmenu; - LPWSTR lpMenuName; - - hmenu = GetMenu(hwndParent); - hmenuMedia = CreatePopupMenu(); - - int len = GetMenuString(hmenu, IDM_MEDIA, NULL, 0, MF_BYCOMMAND); - lpMenuName = malloc((len + 1) * sizeof(WCHAR)); - GetMenuString(hmenu, IDM_MEDIA, lpMenuName, len + 1, MF_BYCOMMAND); - - InsertMenu(hmenu, IDM_MEDIA, MF_BYCOMMAND | MF_STRING | MF_POPUP, (UINT_PTR)hmenuMedia, lpMenuName); - RemoveMenu(hmenu, IDM_MEDIA, MF_BYCOMMAND); - DrawMenuBar(hwndParent); - - free(lpMenuName); -} - - /* API: Create and set up the Status Bar window. */ void StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst) @@ -1299,9 +839,6 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst) rectDialog.bottom-rectDialog.top, SWP_SHOWWINDOW); - /* Load the dummu menu for this window. */ - menuSBAR = LoadMenu(hInst, SB_MENU_NAME); - /* Initialize the status bar. This is clumsy. */ sb_parts = 1; iStatusWidths = (int *)malloc(sb_parts * sizeof(int)); @@ -1310,12 +847,8 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst) memset(sb_part_meanings, 0, sb_parts * sizeof(int)); sb_part_icons = (uint8_t *)malloc(sb_parts * sizeof(uint8_t)); memset(sb_part_icons, 0, sb_parts * sizeof(uint8_t)); - sb_menu_handles = (HMENU *)malloc(sb_parts * sizeof(HMENU)); - memset(sb_menu_handles, 0, sb_parts * sizeof(HMENU)); sbTips = (WCHAR **)malloc(sb_parts * sizeof(WCHAR *)); memset(sbTips, 0, sb_parts * sizeof(WCHAR *)); - media_menu_handles = (HMENU *)malloc(sb_parts * sizeof(HMENU)); - memset(media_menu_handles, 0, sb_parts * sizeof(HMENU)); sb_parts = 0; iStatusWidths[sb_parts] = -1; sb_part_meanings[sb_parts] = SB_TEXT; @@ -1323,50 +856,12 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst) sb_parts++; SendMessage(hwndSBAR, SB_SETPARTS, (WPARAM)sb_parts, (LPARAM)iStatusWidths); SendMessage(hwndSBAR, SB_SETTEXT, 0 | SBT_NOBORDERS, - (LPARAM)plat_get_string(IDS_2126)); - - MediaMenuCreate(hwndParent, idStatus, hInst); + (LPARAM)plat_get_string(IDS_2117)); sb_ready = 1; } -/* API (Settings) */ -void -ui_sb_check_menu_item(int tag, int id, int chk) -{ - uint8_t part; - - if (!sb_ready) - return; - - part = sb_map[tag]; - if ((part == 0xff) || (sb_menu_handles == NULL)) - return; - - CheckMenuItem(sb_menu_handles[part], id, chk); - CheckMenuItem(media_menu_handles[part], id, chk); -} - - -/* API (Settings) */ -void -ui_sb_enable_menu_item(int tag, int id, int flg) -{ - uint8_t part; - - if (!sb_ready) - return; - - part = sb_map[tag]; - if ((part == 0xff) || (sb_menu_handles == NULL)) - return; - - EnableMenuItem(sb_menu_handles[part], id, flg); - EnableMenuItem(media_menu_handles[part], id, flg); -} - - /* API */ void ui_sb_set_text_w(wchar_t *wstr) diff --git a/src/win/win_ui.c b/src/win/win_ui.c index cc4240949..4c2e46f3a 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -312,7 +312,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case IDM_ACTION_HRESET: win_notify_dlg_open(); - i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2121); + i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2112); if (i == 0) pc_reset(1); win_notify_dlg_closed(); @@ -327,7 +327,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (no_quit_confirm) i = 0; else - i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122); + i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2113); if (i == 0) { UnhookWindowsHookEx(hKeyboardHook); KillTimer(hwnd, TIMER_1SEC); @@ -595,7 +595,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; #endif default: - MediaMenuHandler(hwnd, message, wParam, lParam); + media_menu_proc(hwnd, message, wParam, lParam); break; } return(0); @@ -695,7 +695,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (no_quit_confirm) i = 0; else - i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122); + i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2113); if (i == 0) { UnhookWindowsHookEx(hKeyboardHook); KillTimer(hwnd, TIMER_1SEC); @@ -731,7 +731,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (manager_wm) break; win_notify_dlg_open(); - i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2121); + i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2112); if (i == 0) pc_reset(1); win_notify_dlg_closed(); @@ -744,7 +744,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (no_quit_confirm) i = 0; else - i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2122); + i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2113); if (i == 0) { UnhookWindowsHookEx(hKeyboardHook); KillTimer(hwnd, TIMER_1SEC); @@ -913,6 +913,7 @@ ui_init(int nCmdShow) /* Reset all menus to their defaults. */ ResetAllMenus(); + media_menu_init(); /* Make the window visible on the screen. */ ShowWindow(hwnd, nCmdShow); @@ -925,7 +926,7 @@ ui_init(int nCmdShow) ridev.hwndTarget = NULL; /* current focus window */ if (! RegisterRawInputDevices(&ridev, 1, sizeof(ridev))) { MessageBox(hwndMain, - plat_get_string(IDS_2114), + plat_get_string(IDS_2105), plat_get_string(IDS_2050), MB_OK | MB_ICONERROR); return(4); @@ -939,7 +940,7 @@ ui_init(int nCmdShow) haccel = LoadAccelerators(hinstance, ACCEL_NAME); if (haccel == NULL) { MessageBox(hwndMain, - plat_get_string(IDS_2113), + plat_get_string(IDS_2104), plat_get_string(IDS_2050), MB_OK | MB_ICONERROR); return(3); @@ -981,7 +982,7 @@ ui_init(int nCmdShow) /* Initialize the configured Video API. */ if (! plat_setvid(vid_api)) { MessageBox(hwnd, - plat_get_string(IDS_2095), + plat_get_string(IDS_2089), plat_get_string(IDS_2050), MB_OK | MB_ICONERROR); return(5);