--- np2/win9x/menu.cpp 2005/02/07 14:46:14 1.19 +++ np2/win9x/menu.cpp 2005/03/24 01:42:46 1.23 @@ -23,7 +23,7 @@ void menu_addmenubar(HMENU popup, HMENU UINT pos; UINT i; MENUITEMINFO mii; - char str[128]; + TCHAR str[128]; HMENU hSubMenu; cnt = GetMenuItemCount(menubar); @@ -34,7 +34,7 @@ void menu_addmenubar(HMENU popup, HMENU mii.fMask = MIIM_TYPE | MIIM_STATE | MIIM_ID | MIIM_SUBMENU | MIIM_DATA; mii.dwTypeData = str; - mii.cch = sizeof(str); + mii.cch = NELEMENTS(str); if (GetMenuItemInfo(menubar, i, TRUE, &mii)) { if (mii.hSubMenu) { hSubMenu = CreatePopupMenu(); @@ -48,11 +48,11 @@ void menu_addmenubar(HMENU popup, HMENU } static void insertresmenu(HMENU menu, UINT pos, UINT flag, - UINT item, UINT str) { + UINT32 item, UINT str) { - char tmp[128]; + TCHAR tmp[128]; - if (LoadString(hInst, str, tmp, sizeof(tmp))) { + if (LoadString(hInst, str, tmp, NELEMENTS(tmp))) { InsertMenu(menu, pos, flag, item, tmp); } } @@ -189,68 +189,87 @@ void sysmenu_setscrnmul(UINT8 value) { typedef struct { UINT16 title; + UINT16 items; + MENUITEMS item[1]; +} SUBMITEMS; + +typedef struct { + UINT16 title; + UINT16 items; MENUITEMS item[3]; -} DISKMENU; +} SUBMITEM3; -static const DISKMENU fddmenu[4] = { - {IDS_FDD1, {{IDM_FDD1OPEN, IDS_OPEN}, - {0, 0}, - {IDM_FDD1EJECT, IDS_EJECT}}}, - {IDS_FDD2, {{IDM_FDD2OPEN, IDS_OPEN}, - {0, 0}, - {IDM_FDD2EJECT, IDS_EJECT}}}, - {IDS_FDD3, {{IDM_FDD3OPEN, IDS_OPEN}, - {0, 0}, - {IDM_FDD3EJECT, IDS_EJECT}}}, - {IDS_FDD4, {{IDM_FDD4OPEN, IDS_OPEN}, - {0, 0}, - {IDM_FDD4EJECT, IDS_EJECT}}}}; +static const SUBMITEM3 fddmenu[4] = { + {IDS_FDD1, 3, + {{IDM_FDD1OPEN, IDS_OPEN}, {0, 0}, {IDM_FDD1EJECT, IDS_EJECT}}}, + {IDS_FDD2, 3, + {{IDM_FDD2OPEN, IDS_OPEN}, {0, 0}, {IDM_FDD2EJECT, IDS_EJECT}}}, + {IDS_FDD3, 3, + {{IDM_FDD3OPEN, IDS_OPEN}, {0, 0}, {IDM_FDD3EJECT, IDS_EJECT}}}, + {IDS_FDD4, 3, + {{IDM_FDD4OPEN, IDS_OPEN}, {0, 0}, {IDM_FDD4EJECT, IDS_EJECT}}}}; + +#if defined(SUPPORT_IDEIO) +static const SUBMITEM3 side[3] = { + {IDS_IDE0, 3, + {{IDM_IDE0OPEN, IDS_OPEN}, {0, 0}, {IDM_IDE0EJECT, IDS_REMOVE}}}, + {IDS_IDE1, 3, + {{IDM_IDE1OPEN, IDS_OPEN}, {0, 0}, {IDM_IDE1EJECT, IDS_REMOVE}}}, + {IDS_IDE2, 3, + {{IDM_IDE2OPEN, IDS_OPEN}, {0, 0}, {IDM_IDE2EJECT, IDS_EJECT}}}}; +#else +static const SUBMITEM3 ssasi[2] = { + {IDS_SASI1, 3, + {{IDM_IDE0OPEN, IDS_OPEN}, {0, 0}, {IDM_IDE0EJECT, IDS_REMOVE}}}, + {IDS_SASI2, 3, + {{IDM_IDE1OPEN, IDS_OPEN}, {0, 0}, {IDM_IDE1EJECT, IDS_REMOVE}}}}; +#endif -static void insdiskmenu(HMENU hMenu, UINT pos, const DISKMENU *m) { +#if defined(SUPPORT_SCSI) +static const SUBMITEM3 sscsi[4] = { + {IDS_SCSI0, 3, + {{IDM_SCSI0OPEN, IDS_OPEN}, {0, 0}, {IDM_SCSI0EJECT, IDS_REMOVE}}}, + {IDS_SCSI1, 3, + {{IDM_SCSI1OPEN, IDS_OPEN}, {0, 0}, {IDM_SCSI1EJECT, IDS_REMOVE}}}, + {IDS_SCSI2, 3, + {{IDM_SCSI2OPEN, IDS_OPEN}, {0, 0}, {IDM_SCSI2EJECT, IDS_REMOVE}}}, + {IDS_SCSI3, 3, + {{IDM_SCSI3OPEN, IDS_OPEN}, {0, 0}, {IDM_SCSI3EJECT, IDS_REMOVE}}}}; +#endif - HMENU hSubMenu; + +static void insdiskmenu(HMENU hMenu, UINT pos, const void *item) { + + HMENU hSubMenu; +const SUBMITEMS *smi; hSubMenu = CreatePopupMenu(); - insertresmenus(hSubMenu, 0, m->item, 3); + smi = (SUBMITEMS *)item; + insertresmenus(hSubMenu, 0, smi->item, smi->items); insertresmenu(hMenu, pos, MF_BYPOSITION | MF_POPUP, - (UINT)hSubMenu, m->title); + (UINT)hSubMenu, smi->title); } -#if defined(SUPPORT_SCSI) -static const DISKMENU scsimenu[4] = { - {IDS_SCSI0, {{IDM_SCSI0OPEN, IDS_OPEN}, - {0, 0}, - {IDM_SCSI0EJECT, IDS_REMOVE}}}, - {IDS_SCSI1, {{IDM_SCSI1OPEN, IDS_OPEN}, - {0, 0}, - {IDM_SCSI1EJECT, IDS_REMOVE}}}, - {IDS_SCSI2, {{IDM_SCSI2OPEN, IDS_OPEN}, - {0, 0}, - {IDM_SCSI2EJECT, IDS_REMOVE}}}, - {IDS_SCSI3, {{IDM_SCSI3OPEN, IDS_OPEN}, - {0, 0}, - {IDM_SCSI3EJECT, IDS_REMOVE}}}}; -#endif #if defined(SUPPORT_STATSAVE) -static const char xmenu_stat[] = "S&tat"; -static const char xmenu_statsave[] = "Save %u"; -static const char xmenu_statload[] = "Load %u"; +static const TCHAR xmenu_stat[] = _T("S&tat"); +static const TCHAR xmenu_statsave[] = _T("Save %u"); +static const TCHAR xmenu_statload[] = _T("Load %u"); static void addstatsavemenu(HMENU hMenu, UINT pos) { HMENU hSubMenu; UINT i; - char buf[16]; + TCHAR buf[16]; hSubMenu = CreatePopupMenu(); for (i=0; i0;) { + i--; if (np2cfg.fddequip & (1 << i)) { insdiskmenu(hMenu, 1, fddmenu + i); }