Beispiel #1
0
static int flagload(const TCHAR *ext, const TCHAR *title, BOOL force) {

	int		ret;
	int		id;
	TCHAR	path[MAX_PATH];
	TCHAR	buf[1024];

	getstatfilename(path, ext, NELEMENTS(path));
	winuienter();
	id = IDYES;
	ret = statsave_check(path, buf, NELEMENTS(buf));
	if (ret & (~STATFLAG_DISKCHG)) {
		MessageBox(hWndMain, _T("Couldn't restart"), title,
										MB_OK | MB_ICONSTOP);
		id = IDNO;
	}
	else if ((!force) && (ret & STATFLAG_DISKCHG)) {
		TCHAR buf2[1024 + 256];
		wsprintf(buf2, _T("Conflict!\n\n%s\nContinue?"), buf);
		id = MessageBox(hWndMain, buf2, title,
										MB_YESNOCANCEL | MB_ICONQUESTION);
	}
	if (id == IDYES) {
		statsave_load(path);
	}
	sysmng_workclockreset();
	sysmng_updatecaption();
	winuileave();
	return(id);
}
Beispiel #2
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {

	PAINTSTRUCT	ps;
	RECT		rc;
	HDC			hdc;
	UINT		update;

	switch (msg) {
		case WM_CREATE:
#ifndef __GNUC__
			WINNLSEnableIME(hWnd, FALSE);
#endif
			break;

		case WM_SYSCOMMAND:
			update = 0;
			switch(wParam) {
				case IDM_MEMORYDUMP:
					debugsub_memorydump();
					break;

				default:
					return(DefWindowProc(hWnd, msg, wParam, lParam));
			}
			sysmng_update(update);
			break;

		case WM_COMMAND:
			np2cmd(hWnd, LOWORD(wParam));
			break;

		case WM_ACTIVATE:
			if (LOWORD(wParam) != WA_INACTIVE) {
				scrnmng_update();
				keystat_allrelease();
				mousemng_enable(MOUSEPROC_BG);
			}
			else {
				mousemng_disable(MOUSEPROC_BG);
			}
			break;

		case WM_PAINT:
			hdc = BeginPaint(hWnd, &ps);
			if (np2opening) {
				HINSTANCE	hinst;
				RECT		rect;
				int			width;
				int			height;
				HBITMAP		hbmp;
				BITMAP		bmp;
				HDC			hmdc;
				HBRUSH		hbrush;

#if defined(_WIN64)
				hinst = reinterpret_cast<HINSTANCE>(::GetWindowLongPtr(hWnd, GWLP_HINSTANCE));
#else
				hinst = reinterpret_cast<HINSTANCE>(::GetWindowLong(hWnd, GWL_HINSTANCE));
#endif
				GetClientRect(hWnd, &rect);
				width = rect.right - rect.left;
				height = rect.bottom - rect.top;
				hbmp = LoadBitmap(hinst, _T("NP2BMP"));
				GetObject(hbmp, sizeof(BITMAP), &bmp);
				hbrush = (HBRUSH)SelectObject(hdc,
												GetStockObject(BLACK_BRUSH));
				PatBlt(hdc, 0, 0, width, height, PATCOPY);
				SelectObject(hdc, hbrush);
				hmdc = CreateCompatibleDC(hdc);
				SelectObject(hmdc, hbmp);
				BitBlt(hdc, (width - bmp.bmWidth) / 2,
						(height - bmp.bmHeight) / 2,
							bmp.bmWidth, bmp.bmHeight, hmdc, 0, 0, SRCCOPY);
				DeleteDC(hmdc);
				DeleteObject(hbmp);
			}
			else {
//				scrnmng_update();
				scrndraw_redraw();
			}
			EndPaint(hWnd, &ps);
			break;

		case WM_QUERYNEWPALETTE:
			scrnmng_querypalette();
			break;

		case WM_MOVE:
			if ((!scrnmng_isfullscreen()) &&
				(!(GetWindowLong(hWnd, GWL_STYLE) &
									(WS_MAXIMIZE | WS_MINIMIZE)))) {
				GetWindowRect(hWnd, &rc);
				np2oscfg.winx = rc.left;
				np2oscfg.winy = rc.top;
				sysmng_update(SYS_UPDATEOSCFG);
			}
			break;

		case WM_SIZE:
			if (wParam == SIZE_RESTORED) {
				scrnmng_restoresize();
			}
			break;

		case WM_ENTERMENULOOP:
			winuienter();
			if (scrnmng_isfullscreen()) {
				DrawMenuBar(hWnd);
			}
			break;

		case WM_EXITMENULOOP:
			winuileave();
			break;

		case WM_ENTERSIZEMOVE:
			soundmng_disable(SNDPROC_MAIN);
			mousemng_disable(MOUSEPROC_WINUI);
			break;

		case WM_EXITSIZEMOVE:
			mousemng_enable(MOUSEPROC_WINUI);
			soundmng_enable(SNDPROC_MAIN);
			break;

		case WM_KEYDOWN:
			if (wParam == VK_F11) {
				return(DefWindowProc(hWnd, WM_SYSKEYDOWN, VK_F10, lParam));
			}
			if ((wParam == VK_F12) && (!np2oscfg.F12COPY)) {
				mousemng_toggle(MOUSEPROC_SYSTEM);
				xmenu_setmouse(np2oscfg.MOUSE_SW ^ 1);
				sysmng_update(SYS_UPDATECFG);
			}
			else {
				winkbd_keydown(wParam, lParam);
			}
			break;

		case WM_KEYUP:
			if (wParam == VK_F11) {
				return(DefWindowProc(hWnd, WM_SYSKEYUP, VK_F10, lParam));
			}
			if ((wParam != VK_F12) || (np2oscfg.F12COPY)) {
				winkbd_keyup(wParam, lParam);
			}
			break;

		case WM_SYSKEYDOWN:
			winkbd_keydown(wParam, lParam);
			break;

		case WM_SYSKEYUP:
			winkbd_keyup(wParam, lParam);
			break;

		case WM_LBUTTONDOWN:
			if (!mousemng_buttonevent(MOUSEMNG_LEFTDOWN)) {
				return(DefWindowProc(hWnd, msg, wParam, lParam));
			}
			break;

		case WM_LBUTTONUP:
			if (!mousemng_buttonevent(MOUSEMNG_LEFTUP)) {
				return(DefWindowProc(hWnd, msg, wParam, lParam));
			}
			break;

		case WM_MBUTTONDOWN:									// ver0.26
			mousemng_toggle(MOUSEPROC_SYSTEM);
			xmenu_setmouse(np2oscfg.MOUSE_SW ^ 1);
			sysmng_update(SYS_UPDATECFG);
			break;

		case WM_RBUTTONDOWN:
			if (!mousemng_buttonevent(MOUSEMNG_RIGHTDOWN)) {
				return(DefWindowProc(hWnd, msg, wParam, lParam));
			}
			break;

		case WM_RBUTTONUP:
			if (!mousemng_buttonevent(MOUSEMNG_RIGHTUP)) {
				return(DefWindowProc(hWnd, msg, wParam, lParam));
			}
			break;

		case WM_CLOSE:
			DestroyWindow(hWnd);
			break;

		case WM_DESTROY:
			PostQuitMessage(0);
			break;

		case WM_NP2CMD:
			switch(LOWORD(lParam)) {
				case NP2CMD_EXIT:
					np2quitmsg = 1;
					PostQuitMessage(0);
					break;

				case NP2CMD_EXIT2:
					np2quitmsg = 2;
					PostQuitMessage(0);
					break;

				case NP2CMD_RESET:
					pccore_cfgupdate();
					pccore_reset();
					break;
			}
			break;

		default:
			return(DefWindowProc(hWnd, msg, wParam, lParam));
	}
	return(0L);
}
Beispiel #3
0
static void np2cmd(HWND hWnd, UINT16 cmd) {

	UINT	update;

	update = 0;
	switch(cmd) {
		case IDM_RESET:
			pccore_cfgupdate();
			pccore_reset();
			break;

		case IDM_CONFIG:
			winuienter();
			DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIG),
											hWnd, (DLGPROC)CfgDialogProc);
			winuileave();
			break;

		case IDM_NEWDISK:
			winuienter();
			dialog_newdisk(hWnd);
			winuileave();
			break;

		case IDM_CHANGEFONT:
			winuienter();
			dialog_font(hWnd);
			winuileave();
			break;

		case IDM_EXIT:
			SendMessage(hWnd, WM_CLOSE, 0, 0L);
			break;

		case IDM_FDD1OPEN:
			winuienter();
			dialog_changefdd(hWnd, 0);
			winuileave();
			break;

		case IDM_FDD1EJECT:
			diskdrv_setfdd(0, NULL, 0);
			break;

		case IDM_FDD2OPEN:
			winuienter();
			dialog_changefdd(hWnd, 1);
			winuileave();
			break;

		case IDM_FDD2EJECT:
			diskdrv_setfdd(1, NULL, 0);
			break;

		case IDM_SASI1OPEN:
			winuienter();
			dialog_changehdd(hWnd, 0);
			winuileave();
			break;

		case IDM_SASI1EJECT:
			diskdrv_sethdd(0, NULL);
			break;

		case IDM_SASI2OPEN:
			winuienter();
			dialog_changehdd(hWnd, 1);
			winuileave();
			break;

		case IDM_SASI2EJECT:
			diskdrv_sethdd(1, NULL);
			break;

		case IDM_WINDOW:
			changescreen(scrnmode & (~SCRNMODE_FULLSCREEN));
			break;

		case IDM_FULLSCREEN:
			changescreen(scrnmode | SCRNMODE_FULLSCREEN);
			break;

		case IDM_ROLNORMAL:
			xmenu_setroltate(0);
			changescreen(scrnmode & (~SCRNMODE_ROTATEMASK));
			break;

		case IDM_ROLLEFT:
			xmenu_setroltate(1);
			changescreen((scrnmode & (~SCRNMODE_ROTATEMASK)) |
														SCRNMODE_ROTATELEFT);
			break;

		case IDM_ROLRIGHT:
			xmenu_setroltate(2);
			changescreen((scrnmode & (~SCRNMODE_ROTATEMASK)) |
														SCRNMODE_ROTATERIGHT);
			break;

		case IDM_DISPSYNC:
			xmenu_setdispmode(np2cfg.DISPSYNC ^ 1);
			update |= SYS_UPDATECFG;
			break;

		case IDM_RASTER:
			xmenu_setraster(np2cfg.RASTER ^ 1);
			if (np2cfg.RASTER) {
				changescreen(scrnmode | SCRNMODE_HIGHCOLOR);
			}
			else {
				changescreen(scrnmode & (~SCRNMODE_HIGHCOLOR));
			}
			update |= SYS_UPDATECFG;
			break;

		case IDM_NOWAIT:
			xmenu_setwaitflg(np2oscfg.NOWAIT ^ 1);
			update |= SYS_UPDATECFG;
			break;

		case IDM_AUTOFPS:
			xmenu_setframe(0);
			update |= SYS_UPDATECFG;
			break;

		case IDM_60FPS:
			xmenu_setframe(1);
			update |= SYS_UPDATECFG;
			break;

		case IDM_30FPS:
			xmenu_setframe(2);
			update |= SYS_UPDATECFG;
			break;

		case IDM_20FPS:
			xmenu_setframe(3);
			update |= SYS_UPDATECFG;
			break;

		case IDM_15FPS:
			xmenu_setframe(4);
			update |= SYS_UPDATECFG;
			break;

		case IDM_SCREENOPT:
			winuienter();
			dialog_scropt(hWnd);
			winuileave();
			break;

		case IDM_KEY:
			xmenu_setkey(0);
			update |= SYS_UPDATECFG;
			break;

		case IDM_JOY1:
			xmenu_setkey(1);
			update |= SYS_UPDATECFG;
			break;

		case IDM_JOY2:
			xmenu_setkey(2);
			update |= SYS_UPDATECFG;
			break;

		case IDM_XSHIFT:
			xmenu_setxshift(np2cfg.XSHIFT ^ 1);
			keystat_forcerelease(0x70);
			update |= SYS_UPDATECFG;
			break;

		case IDM_XCTRL:
			xmenu_setxshift(np2cfg.XSHIFT ^ 2);
			keystat_forcerelease(0x74);
			update |= SYS_UPDATECFG;
			break;

		case IDM_XGRPH:
			xmenu_setxshift(np2cfg.XSHIFT ^ 4);
			keystat_forcerelease(0x73);
			update |= SYS_UPDATECFG;
			break;

		case IDM_F12MOUSE:
			xmenu_setf12copy(0);
			winkbd_resetf12();
			update |= SYS_UPDATEOSCFG;
			break;

		case IDM_F12COPY:
			xmenu_setf12copy(1);
			winkbd_resetf12();
			update |= SYS_UPDATEOSCFG;
			break;

		case IDM_F12STOP:
			xmenu_setf12copy(2);
			winkbd_resetf12();
			update |= SYS_UPDATEOSCFG;
			break;

		case IDM_F12EQU:
			xmenu_setf12copy(3);
			winkbd_resetf12();
			update |= SYS_UPDATEOSCFG;
			break;

		case IDM_F12COMMA:
			xmenu_setf12copy(4);
			winkbd_resetf12();
			update |= SYS_UPDATEOSCFG;
			break;

		case IDM_BEEPOFF:
			xmenu_setbeepvol(0);
			beep_setvol(0);
			update |= SYS_UPDATECFG;
			break;

		case IDM_BEEPLOW:
			xmenu_setbeepvol(1);
			beep_setvol(1);
			update |= SYS_UPDATECFG;
			break;

		case IDM_BEEPMID:
			xmenu_setbeepvol(2);
			beep_setvol(2);
			update |= SYS_UPDATECFG;
			break;

		case IDM_BEEPHIGH:
			xmenu_setbeepvol(3);
			beep_setvol(3);
			update |= SYS_UPDATECFG;
			break;

		case IDM_NOSOUND:
			xmenu_setsound(0x00);
			update |= SYS_UPDATECFG;
			break;

		case IDM_PC9801_14:
			xmenu_setsound(0x01);
			update |= SYS_UPDATECFG;
			break;

		case IDM_PC9801_26K:
			xmenu_setsound(0x02);
			update |= SYS_UPDATECFG;
			break;

		case IDM_PC9801_86:
			xmenu_setsound(0x04);
			update |= SYS_UPDATECFG;
			break;

		case IDM_PC9801_26_86:
			xmenu_setsound(0x06);
			update |= SYS_UPDATECFG;
			break;

		case IDM_PC9801_86_CB:
			xmenu_setsound(0x14);
			update |= SYS_UPDATECFG;
			break;

		case IDM_PC9801_118:
			xmenu_setsound(0x08);
			update |= SYS_UPDATECFG;
			break;

		case IDM_SPEAKBOARD:
			xmenu_setsound(0x20);
			update |= SYS_UPDATECFG;
			break;

		case IDM_SPARKBOARD:
			xmenu_setsound(0x40);
			update |= SYS_UPDATECFG;
			break;

		case IDM_AMD98:
			xmenu_setsound(0x80);
			update |= SYS_UPDATECFG;
			break;

		case IDM_JASTSOUND:
			xmenu_setjastsound(np2oscfg.jastsnd ^ 1);
			update |= SYS_UPDATEOSCFG;
			break;

		case IDM_SEEKSND:
			xmenu_setmotorflg(np2cfg.MOTOR ^ 1);
			update |= SYS_UPDATECFG;
			break;

		case IDM_MEM640:
			xmenu_setextmem(0);
			update |= SYS_UPDATECFG;
			break;

		case IDM_MEM16:
			xmenu_setextmem(1);
			update |= SYS_UPDATECFG;
			break;

		case IDM_MEM36:
			xmenu_setextmem(3);
			update |= SYS_UPDATECFG;
			break;

		case IDM_MEM76:
			xmenu_setextmem(7);
			update |= SYS_UPDATECFG;
			break;

		case IDM_MEM116:
			xmenu_setextmem(11);
			update |= SYS_UPDATECFG;
			break;

		case IDM_MEM136:
			xmenu_setextmem(13);
			update |= SYS_UPDATECFG;
			break;

		case IDM_MOUSE:
			mousemng_toggle(MOUSEPROC_SYSTEM);
			xmenu_setmouse(np2oscfg.MOUSE_SW ^ 1);
			update |= SYS_UPDATECFG;
			break;

		case IDM_MPUPC98:
			winuienter();
			DialogBox(hInst, MAKEINTRESOURCE(IDD_MPUPC98),
											hWnd, (DLGPROC)MidiDialogProc);
			winuileave();
			break;

		case IDM_MIDIPANIC:									// ver0.29
			rs232c_midipanic();
			mpu98ii_midipanic();
			pc9861k_midipanic();
			break;

		case IDM_SNDOPT:
			winuienter();
			dialog_sndopt(hWnd);
			winuileave();
			break;

		case IDM_BMPSAVE:
			winuienter();
			dialog_writebmp(hWnd);
			winuileave();
			break;
#if defined(SUPPPORT_S98)
		case IDM_S98LOGGING:
			winuienter();
			dialog_s98(hWnd);
			winuileave();
			break;
#endif
#if defined(SUPPORT_WAVEREC)
		case IDM_WAVEREC:
			winuienter();
			dialog_waverec(hWnd);
			winuileave();
			break;
#endif
		case IDM_CALENDAR:
			winuienter();
			DialogBox(hInst, MAKEINTRESOURCE(IDD_CALENDAR),
											hWnd, (DLGPROC)ClndDialogProc);
			winuileave();
			break;

		case IDM_JOYX:
			xmenu_setbtnmode(np2cfg.BTN_MODE ^ 1);
			update |= SYS_UPDATECFG;
			break;

		case IDM_RAPID:
			xmenu_setbtnrapid(np2cfg.BTN_RAPID ^ 1);
			update |= SYS_UPDATECFG;
			break;

		case IDM_MSRAPID:
			xmenu_setmsrapid(np2cfg.MOUSERAPID ^ 1);
			update |= SYS_UPDATECFG;
			break;

		case IDM_I286SAVE:
			debugsub_status();
			break;

		case IDM_HELP:
			ShellExecute(hWnd, NULL, file_getcd(np2help),
											NULL, NULL, SW_SHOWNORMAL);
			break;

		case IDM_ABOUT:
			winuienter();
			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT),
									hWnd, (DLGPROC)AboutDialogProc);
			winuileave();
			break;
	}
	sysmng_update(update);
}
Beispiel #4
0
static void sys_cmd(MENUID id) {

    UINT	update;

    update = 0;
    switch(id) {
    case MID_RESET:
        pccore_cfgupdate();
        pccore_reset();
        break;

    case MID_CONFIG:
        menudlg_create(DLGCFG_WIDTH, DLGCFG_HEIGHT,
                       (char *)mstr_cfg, dlgcfg_cmd);
        break;

    case MID_FDD1OPEN:
        filesel_fdd(0);
        break;

    case MID_FDD1EJECT:
        diskdrv_setfdd(0, NULL, 0);
        break;

    case MID_FDD2OPEN:
        filesel_fdd(1);
        break;

    case MID_FDD2EJECT:
        diskdrv_setfdd(1, NULL, 0);
        break;

    case MID_SASI1OPEN:
        filesel_hdd(0x00);
        break;

    case MID_SASI1EJECT:
        diskdrv_sethdd(0x00, NULL);
        break;

    case MID_SASI2OPEN:
        filesel_hdd(0x01);
        break;

    case MID_SASI2EJECT:
        diskdrv_sethdd(0x01, NULL);
        break;
#if defined(SUPPORT_SCSI)
    case MID_SCSI0OPEN:
        filesel_hdd(0x20);
        break;

    case MID_SCSI0EJECT:
        diskdrv_sethdd(0x20, NULL);
        break;

    case MID_SCSI1OPEN:
        filesel_hdd(0x21);
        break;

    case MID_SCSI1EJECT:
        diskdrv_sethdd(0x21, NULL);
        break;

    case MID_SCSI2OPEN:
        filesel_hdd(0x22);
        break;

    case MID_SCSI2EJECT:
        diskdrv_sethdd(0x22, NULL);
        break;

    case MID_SCSI3OPEN:
        filesel_hdd(0x23);
        break;

    case MID_SCSI3EJECT:
        diskdrv_sethdd(0x23, NULL);
        break;
#endif
    case MID_DISPSYNC:
        np2cfg.DISPSYNC ^= 1;
        update |= SYS_UPDATECFG;
        break;

    case MID_RASTER:
        np2cfg.RASTER ^= 1;
        update |= SYS_UPDATECFG;
        break;

    case MID_NOWAIT:
        np2oscfg.NOWAIT ^= 1;
        update |= SYS_UPDATECFG;
        break;

    case MID_AUTOFPS:
        np2oscfg.DRAW_SKIP = 0;
        update |= SYS_UPDATECFG;
        break;

    case MID_60FPS:
        np2oscfg.DRAW_SKIP = 1;
        update |= SYS_UPDATECFG;
        break;

    case MID_30FPS:
        np2oscfg.DRAW_SKIP = 2;
        update |= SYS_UPDATECFG;
        break;

    case MID_20FPS:
        np2oscfg.DRAW_SKIP = 3;
        update |= SYS_UPDATECFG;
        break;

    case MID_15FPS:
        np2oscfg.DRAW_SKIP = 4;
        update |= SYS_UPDATECFG;
        break;

    case MID_SCREENOPT:
        menudlg_create(DLGSCR_WIDTH, DLGSCR_HEIGHT,
                       (char *)mstr_scropt, dlgscr_cmd);
        break;

    case MID_KEY:
        np2cfg.KEY_MODE = 0;
        keystat_resetjoykey();
        update |= SYS_UPDATECFG;
        break;

    case MID_JOY1:
        np2cfg.KEY_MODE = 1;
        keystat_resetjoykey();
        update |= SYS_UPDATECFG;
        break;

    case MID_JOY2:
        np2cfg.KEY_MODE = 2;
        keystat_resetjoykey();
        update |= SYS_UPDATECFG;
        break;

    case MID_MOUSEKEY:
        np2cfg.KEY_MODE = 3;
        keystat_resetjoykey();
        update |= SYS_UPDATECFG;
        break;

    case MID_XSHIFT:
        np2cfg.XSHIFT ^= 1;
        keystat_forcerelease(0x70);
        update |= SYS_UPDATECFG;
        break;

    case MID_XCTRL:
        np2cfg.XSHIFT ^= 2;
        keystat_forcerelease(0x74);
        update |= SYS_UPDATECFG;
        break;

    case MID_XGRPH:
        np2cfg.XSHIFT ^= 4;
        keystat_forcerelease(0x73);
        update |= SYS_UPDATECFG;
        break;

    case MID_F12MOUSE:
        np2oscfg.F12KEY = 0;
        sdlkbd_resetf12();
        update |= SYS_UPDATEOSCFG;
        break;

    case MID_F12COPY:
        np2oscfg.F12KEY = 1;
        sdlkbd_resetf12();
        update |= SYS_UPDATEOSCFG;
        break;

    case MID_F12STOP:
        np2oscfg.F12KEY = 2;
        sdlkbd_resetf12();
        update |= SYS_UPDATEOSCFG;
        break;

    case MID_F12EQU:
        np2oscfg.F12KEY = 3;
        sdlkbd_resetf12();
        update |= SYS_UPDATEOSCFG;
        break;

    case MID_F12COMMA:
        np2oscfg.F12KEY = 4;
        sdlkbd_resetf12();
        update |= SYS_UPDATEOSCFG;
        break;

    case MID_BEEPOFF:
        np2cfg.BEEP_VOL = 0;
        beep_setvol(0);
        update |= SYS_UPDATECFG;
        break;

    case MID_BEEPLOW:
        np2cfg.BEEP_VOL = 1;
        beep_setvol(1);
        update |= SYS_UPDATECFG;
        break;

    case MID_BEEPMID:
        np2cfg.BEEP_VOL = 2;
        beep_setvol(2);
        update |= SYS_UPDATECFG;
        break;

    case MID_BEEPHIGH:
        np2cfg.BEEP_VOL = 3;
        beep_setvol(3);
        update |= SYS_UPDATECFG;
        break;

    case MID_NOSOUND:
        np2cfg.SOUND_SW = 0x00;
        update |= SYS_UPDATECFG;
        break;

    case MID_PC9801_14:
        np2cfg.SOUND_SW = 0x01;
        update |= SYS_UPDATECFG;
        break;

    case MID_PC9801_26K:
        np2cfg.SOUND_SW = 0x02;
        update |= SYS_UPDATECFG;
        break;

    case MID_PC9801_86:
        np2cfg.SOUND_SW = 0x04;
        update |= SYS_UPDATECFG;
        break;

    case MID_PC9801_26_86:
        np2cfg.SOUND_SW = 0x06;
        update |= SYS_UPDATECFG;
        break;

    case MID_PC9801_86_CB:
        np2cfg.SOUND_SW = 0x14;
        update |= SYS_UPDATECFG;
        break;

    case MID_PC9801_118:
        np2cfg.SOUND_SW = 0x08;
        update |= SYS_UPDATECFG;
        break;

    case MID_SPEAKBOARD:
        np2cfg.SOUND_SW = 0x20;
        update |= SYS_UPDATECFG;
        break;

    case MID_SPARKBOARD:
        np2cfg.SOUND_SW = 0x40;
        update |= SYS_UPDATECFG;
        break;

    case MID_AMD98:
        np2cfg.SOUND_SW = 0x80;
        update |= SYS_UPDATECFG;
        break;

    case MID_JASTSND:
        np2oscfg.jastsnd ^= 1;
        update |= SYS_UPDATEOSCFG;
        break;

    case MID_SEEKSND:
        np2cfg.MOTOR ^= 1;
        update |= SYS_UPDATECFG;
        break;
#if 0
    case IDM_SNDOPT:
        winuienter();
        dialog_sndopt(hWnd);
        winuileave();
        break;
#endif
    case MID_MEM640:
        np2cfg.EXTMEM = 0;
        update |= SYS_UPDATECFG;
        break;

    case MID_MEM16:
        np2cfg.EXTMEM = 1;
        update |= SYS_UPDATECFG;
        break;

    case MID_MEM36:
        np2cfg.EXTMEM = 3;
        update |= SYS_UPDATECFG;
        break;

    case MID_MEM76:
        np2cfg.EXTMEM = 7;
        update |= SYS_UPDATECFG;
        break;
#if 0
    case IDM_MOUSE:
        mousemng_toggle(MOUSEPROC_SYSTEM);
        xmenu_setmouse(np2oscfg.MOUSE_SW ^ 1);
        update |= SYS_UPDATECFG;
        break;

    case IDM_SERIAL1:
        winuienter();
        dialog_serial(hWnd);
        winuileave();
        break;

    case IDM_MPUPC98:
        winuienter();
        DialogBox(hInst, MAKEINTRESOURCE(IDD_MPUPC98),
                  hWnd, (DLGPROC)MidiDialogProc);
        winuileave();
        break;
#endif
    case MID_MIDIPANIC:
        rs232c_midipanic();
        mpu98ii_midipanic();
        pc9861k_midipanic();
        break;
#if 0
    case IDM_BMPSAVE:
        winuienter();
        dialog_writebmp(hWnd);
        winuileave();
        break;

    case IDM_S98LOGGING:
        winuienter();
        dialog_s98(hWnd);
        winuileave();
        break;

    case IDM_DISPCLOCK:
        xmenu_setdispclk(np2oscfg.DISPCLK ^ 1);
        update |= SYS_UPDATECFG;
        break;

    case IDM_DISPFRAME:
        xmenu_setdispclk(np2oscfg.DISPCLK ^ 2);
        update |= SYS_UPDATECFG;
        break;

    case IDM_CALENDAR:
        winuienter();
        DialogBox(hInst, MAKEINTRESOURCE(IDD_CALENDAR),
                  hWnd, (DLGPROC)ClndDialogProc);
        winuileave();
        break;

    case IDM_ALTENTER:
        xmenu_setshortcut(np2oscfg.shortcut ^ 1);
        update |= SYS_UPDATECFG;
        break;

    case IDM_ALTF4:
        xmenu_setshortcut(np2oscfg.shortcut ^ 2);
        update |= SYS_UPDATECFG;
        break;
#endif
    case MID_JOYX:
        np2cfg.BTN_MODE ^= 1;
        update |= SYS_UPDATECFG;
        break;

    case MID_RAPID:
        np2cfg.BTN_RAPID ^= 1;
        update |= SYS_UPDATECFG;
        break;

    case MID_MSRAPID:
        np2cfg.MOUSERAPID ^= 1;
        update |= SYS_UPDATECFG;
        break;

    case MID_ABOUT:
        menudlg_create(DLGABOUT_WIDTH, DLGABOUT_HEIGHT,
                       (char *)mstr_about, dlgabout_cmd);
        break;

#if defined(MENU_TASKMINIMIZE)
    case SID_MINIMIZE:
        taskmng_minimize();
        break;
#endif
    case MID_EXIT:
    case SID_CLOSE:
        taskmng_exit();
        break;
    }
    sysmng_update(update);
}