Exemplo n.º 1
0
/*
 * Interface
 */
void
kdispwin_create(void)
{
	GtkWidget *main_widget;
#if 0
	GtkWidget *kdispwin_menu;
#endif
	GtkWidget *da;
	CMNPALFN palfn;
	UINT8 mode;

	if (kdwin.window)
		return;

	kdwin.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(kdwin.window), "Key Display");
	gtk_window_set_resizable(GTK_WINDOW(kdwin.window), FALSE);
	g_signal_connect(GTK_OBJECT(kdwin.window), "destroy",
	    GTK_SIGNAL_FUNC(kdispwin_window_destroy), NULL);
	gtk_widget_realize(kdwin.window);

	main_widget = gtk_vbox_new(FALSE, 2);
	gtk_widget_show(main_widget);
	gtk_container_add(GTK_CONTAINER(kdwin.window), main_widget);

#if 0
	kdispwin_menu = create_kdispwin_menu(kdwin.window);
	gtk_box_pack_start(GTK_BOX(main_widget), kdispwin_menu, FALSE, TRUE, 0);
	gtk_widget_show(kdispwin_menu);
#endif

	kdwin.hdl = drawmng_create(kdwin.window, KEYDISP_WIDTH, KEYDISP_HEIGHT);
	if (kdwin.hdl == NULL) {
		goto destroy;
	}

	da = GTK_WIDGET(drawmng_get_widget_handle(kdwin.hdl));
	gtk_box_pack_start(GTK_BOX(main_widget), da, FALSE, TRUE, 0);
	gtk_widget_show(da);
	g_signal_connect(GTK_OBJECT(da), "expose_event",
	    GTK_SIGNAL_FUNC(kdispwin_expose), NULL);

	mode = kdispwin_getmode(kdispcfg.mode);
	setkeydispmode(mode);
	setkdwinsize();
	gtk_widget_show_all(kdwin.window);

	palfn.get8 = getpal8;
	palfn.get32 = getpal32;
	palfn.cnv16 = cnvpal16;
	keydisp_setpal(&palfn);
	drawmng_invalidate(kdwin.hdl, NULL);
	return;

destroy:
	gtk_widget_destroy(kdwin.window);
	kdwin.window = NULL;
//	xmenu_toggle_item(NULL, "keydisp", FALSE);
	sysmng_update(SYS_UPDATEOSCFG);
}
Exemplo n.º 2
0
void dialog_waverec(HWND hWnd)
{
#if defined(SUPPORT_RECVIDEO)
	const bool bShiftDown = (::GetKeyState(VK_SHIFT) < 0);
	recvideo_close();
#endif	// defined(SUPPORT_RECVIDEO)

	sound_recstop();

	TCHAR szPath[MAX_PATH];
	file_cpyname(szPath, bmpfilefolder, NELEMENTS(szPath));
	file_cutname(szPath);
	file_catname(szPath, szWaveFile, NELEMENTS(szPath));

	UINT8 bCheck = FALSE;
	if ((dlgs_createfilenum(hWnd, &fpWave, szPath, NELEMENTS(szPath))) &&
		(sound_recstart(szPath) == SUCCESS))
	{
		file_cpyname(bmpfilefolder, szPath, NELEMENTS(bmpfilefolder));
		sysmng_update(SYS_UPDATEOSCFG);
		bCheck = TRUE;
	}

#if defined(SUPPORT_RECVIDEO)
	if (bShiftDown)
	{
		file_cutext(szPath);
		file_catname(szPath, _T(".avi"), NELEMENTS(szPath));
		recvideo_open(hWnd, szPath);
	}
#endif	// defined(SUPPORT_RECVIDEO)

	xmenu_setwaverec(bCheck);
}
Exemplo n.º 3
0
static LRESULT CALLBACK PAD1optDlgProc(HWND hWnd, UINT msg,
													WPARAM wp, LPARAM lp) {

	int		i;
	UINT8	renewal;

	switch(msg) {
		case WM_INITDIALOG:
			for (i=0; i<13; i++) {
				checkbtnres_load(hWnd, pad1opt + i);
			}
			if (np2oscfg.JOYPAD1 & 2) {
				EnableWindow(GetDlgItem(hWnd, IDC_JOYPAD1), FALSE);
			}
			return(TRUE);

		case WM_NOTIFY:
			if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) {
				renewal = 0;
				for (i=0; i<13; i++) {
					renewal |= checkbtnres_store(hWnd, pad1opt + i);
				}
				if (renewal) {
					joymng_initialize();
					sysmng_update(SYS_UPDATECFG);
				}
				return(TRUE);
			}
			break;
	}
	return(FALSE);
}
Exemplo n.º 4
0
void mackbd_keydown(int keycode) {

	BYTE	data;

	data = NC;
	if (keycode == 0x67) {
		if (np2oscfg.F11KEY < (sizeof(bindtbl.f11)/sizeof(BYTE))) {
			data = bindtbl.f11[np2oscfg.F11KEY];
		}
	}
	else if (keycode == 0x6f) {
		if (np2oscfg.F12KEY < (sizeof(bindtbl.f12)/sizeof(BYTE))) {
			data = bindtbl.f12[np2oscfg.F12KEY];
            if (data == NC) {
                mousemng_toggle(MOUSEPROC_SYSTEM);
                menu_setmouse(np2oscfg.MOUSE_SW ^ 1);
                sysmng_update(SYS_UPDATECFG);
            }
		}
	}
    else {
        data = keymac[keycode];
    }
	if (data != NC) {
		keystat_senddata(data);
	}
}
Exemplo n.º 5
0
void MPU98DialogProc(void) {

	DialogPtr		hDlg;
	int				done;
	short			item;
	ControlHandle	lst[2];
	UINT8			mpu;
	short			value;

	hDlg = GetNewDialog(IDD_MPU98II, NULL, (WindowPtr)-1);
	if (!hDlg) {
		return;
	}
	lst[0] = (ControlHandle)GetDlgItem(hDlg, IDC_MPUPORT);
	lst[1] = (ControlHandle)GetDlgItem(hDlg, IDC_MPUIRQ);

	mpu = np2cfg.mpuopt;
	SetControlValue(lst[0], ((mpu >> 4) & 15) + 1);
	SetControlValue(lst[1], (mpu & 3) + 1);

	SetDialogDefaultItem(hDlg, IDOK);

	done = 0;
	while(!done) {
		ModalDialog(NULL, &item);
		switch(item) {
			case IDOK:
				mpu = np2cfg.mpuopt;
				value = GetControlValue(lst[0]);
				if (value) {
					mpu &= ~0xf0;
					mpu |= (UINT8)((value - 1) << 4);
				}
				value = GetControlValue(lst[1]);
				if (value) {
					mpu &= ~0x03;
					mpu |= (UINT8)((value - 1) & 3);
				}
				if (np2cfg.mpuopt != mpu) {
					np2cfg.mpuopt = mpu;
					sysmng_update(SYS_UPDATEOSCFG);
				}
				done = IDOK;
				break;

			case IDCANCEL:
				done = IDCANCEL;
				break;

			case IDC_MPUDEF:
				SetControlValue(lst[0], ((0x82 >> 4) & 15) + 1);
				SetControlValue(lst[1], (0x82 & 3) + 1);
				break;
		}
	}
	DisposeDialog(hDlg);
}
Exemplo n.º 6
0
void kdispwin_create(HINSTANCE hInstance) {

	TCHAR		szCaption[128];
	HWND		hwnd;
	UINT8		mode;
	CMNPALFN	palfn;

	if (kdispwin.hwnd != NULL) {
		return;
	}
	ZeroMemory(&kdispwin, sizeof(kdispwin));

	loadstringresource(LOWORD(IDS_CAPTION_KEYDISP),
										szCaption, NELEMENTS(szCaption));
	hwnd = CreateWindow(kdispclass, szCaption,
						WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION |
						WS_MINIMIZEBOX,
						kdispcfg.posx, kdispcfg.posy,
						KEYDISP_WIDTH, KEYDISP_HEIGHT,
						NULL, NULL, hInstance, NULL);
	kdispwin.hwnd = hwnd;
	if (hwnd == NULL) {
		goto kdcre_err1;
	}
	switch(kdispcfg.mode) {
		case KDISPCFG_FM:
		default:
			mode = KEYDISP_MODEFM;
			break;

		case KDISPCFG_MIDI:
			mode = KEYDISP_MODEMIDI;
			break;
	}
	kdsetdispmode(mode);
	ShowWindow(hwnd, SW_SHOWNOACTIVATE);
	UpdateWindow(hwnd);
	kdispwin.dd2hdl = dd2_create(hwnd, KEYDISP_WIDTH, KEYDISP_HEIGHT);
	if (kdispwin.dd2hdl == NULL) {
		goto kdcre_err2;
	}
	palfn.get8 = kdgetpal8;
	palfn.get32 = kdgetpal32;
	palfn.cnv16 = kdcnvpal16;
	palfn.userdata = (long)kdispwin.dd2hdl;
	keydisp_setpal(&palfn);
	kdispwin_draw(0);
	SetForegroundWindow(g_hWndMain);
	return;

kdcre_err2:
	DestroyWindow(hwnd);

kdcre_err1:
	sysmenu_setkeydisp(0);
	sysmng_update(SYS_UPDATEOSCFG);
}
Exemplo n.º 7
0
static LRESULT CALLBACK SndmixDlgProc(HWND hWnd, UINT msg,
													WPARAM wp, LPARAM lp) {

	int		i;
	int		ctrlid;

	switch (msg) {
		case WM_INITDIALOG:
			for (i=0; i<5; i++) {
				sliderinit(hWnd, &sndmixitem[i]);
			}
			return(TRUE);

		case WM_COMMAND:
			switch(LOWORD(wp)) {
				case IDC_SNDMIXDEF:
					for (i=0; i<5; i++) {
						slidersetvalue(hWnd, &sndmixitem[i], 64);
					}
					break;
			}
			break;

		case WM_HSCROLL:
			ctrlid = GetDlgCtrlID((HWND)lp);
			for (i=0; i<5; i++) {
				if (ctrlid == sndmixitem[i].res) {
					sliderresetpos(hWnd, &sndmixitem[i]);
					return(TRUE);
				}
			}
			break;

		case WM_NOTIFY:
			if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) {
				for (i=0; i<5; i++) {
					if (sliderrestore(hWnd, &sndmixitem[i])) {
						sysmng_update(SYS_UPDATECFG);
					}
				}
				opngen_setvol(np2cfg.vol_fm);
				psggen_setvol(np2cfg.vol_ssg);
				rhythm_setvol(np2cfg.vol_rhythm);
				adpcm_setvol(np2cfg.vol_adpcm);
				pcm86gen_setvol(np2cfg.vol_pcm);
				pcm86gen_update();
				for (i = 0; i < NELEMENTS(g_opna); i++)
				{
					rhythm_update(&g_opna[i].rhythm);
					adpcm_update(&g_opna[i].adpcm);
				}
				return(TRUE);
			}
			break;
	}
	return(FALSE);
}
Exemplo n.º 8
0
static void
change_module(gpointer data, guint action, GtkWidget *w)
{

	UNUSED(data);
	UNUSED(w);

	if (kdispcfg.mode != action) {
		kdispcfg.mode = action;
		sysmng_update(SYS_UPDATEOSCFG);
		setkeydispmode(kdispwin_getmode(kdispcfg.mode));
	}
}
Exemplo n.º 9
0
void dialog_font(HWND hWnd)
{
	TCHAR	szPath[MAX_PATH];

	file_cpyname(szPath, np2cfg.fontfile, NELEMENTS(szPath));
	if ((dlgs_openfile(hWnd, &fpFont, szPath, NELEMENTS(szPath), NULL)) &&
		(font_load(szPath, FALSE)))
	{
		gdcs.textdisp |= GDCSCRN_ALLDRAW2;
		milstr_ncpy(np2cfg.fontfile, szPath, NELEMENTS(np2cfg.fontfile));
		sysmng_update(SYS_UPDATECFG);
	}
}
Exemplo n.º 10
0
int wiimenu_do_option_selection(int opt)
{
	UINT32 update = 0;
	switch(opt) {
		case 0:
			np2oscfg.DRAW_SKIP++;
			np2oscfg.DRAW_SKIP %= 5;
			return 1;
		case 1:
			np2oscfg.NOWAIT ^= 1;
			return 2;
		case 2:
			np2cfg.KEY_MODE++;
			np2cfg.KEY_MODE %= 4;
			keystat_resetjoykey();
			update |= SYS_UPDATECFG;
			sysmng_update(update);
			return 3;
		case 3:
			wiimenu_sound_cfg();
			return 4;
		case 4:
			switch(np2cfg.EXTMEM) {
				case 7:
					np2cfg.EXTMEM = 0;
					break;
				case 3:
					np2cfg.EXTMEM += 2;
				case 1:
					np2cfg.EXTMEM++;
				case 0:
					np2cfg.EXTMEM++;
					break;
			}
			return 5;
		case 5:
			rs232c_midipanic();
			mpu98ii_midipanic();
			pc9861k_midipanic();
			return 6;
		case 6:
			wiimenu_dip_cfg();
			return 0;
		default:
			return -1;
	}
}
Exemplo n.º 11
0
static LRESULT CALLBACK Scropt2DlgProc(HWND hWnd, UINT msg,
													WPARAM wp, LPARAM lp) {

	UINT8	b;
	UINT	update;

	switch(msg) {
		case WM_INITDIALOG:
			if (!np2cfg.uPD72020) {
				SetDlgItemCheck(hWnd, IDC_GDC7220, TRUE);
			}
			else {
				SetDlgItemCheck(hWnd, IDC_GDC72020, TRUE);
			}
			SetDlgItemCheck(hWnd, gdcchip[np2cfg.grcg & 3], TRUE);
			SetDlgItemCheck(hWnd, IDC_PC980124, np2cfg.color16);
			return(TRUE);

		case WM_NOTIFY:
			if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) {
				update = 0;
				b = GetDlgItemCheck(hWnd, IDC_GDC72020);
				if (np2cfg.uPD72020 != b) {
					np2cfg.uPD72020 = b;
					update |= SYS_UPDATECFG;
					gdc_restorekacmode();
					gdcs.grphdisp |= GDCSCRN_ALLDRAW2;
				}
				for (b=0; (b<3) && (!GetDlgItemCheck(hWnd, gdcchip[b])); b++);
				if (np2cfg.grcg != b) {
					np2cfg.grcg = b;
					update |= SYS_UPDATECFG;
					gdcs.grphdisp |= GDCSCRN_ALLDRAW2;
				}
				b = GetDlgItemCheck(hWnd, IDC_PC980124);
				if (np2cfg.color16 != b) {
					np2cfg.color16 = b;
					update |= SYS_UPDATECFG;
				}
				sysmng_update(update);
				return(TRUE);
			}
			break;
	}
	return(FALSE);
}
Exemplo n.º 12
0
static void mpuupdate(HWND hWnd) {

	union {
		OEMCHAR	mmap[MAXPNAMELEN];
		OEMCHAR	mmdl[64];
		OEMCHAR	mdef[MAX_PATH];
		OEMCHAR	mdin[MAXPNAMELEN];
	} s;
	UINT	update;

	update = 0;
	if (np2cfg.mpuopt != mpu) {
		np2cfg.mpuopt = mpu;
		update |= SYS_UPDATECFG | SYS_UPDATEMIDI;
	}
	GetDlgItemText(hWnd, IDC_MPU98MMAP, s.mmap, NELEMENTS(s.mmap));
	if (milstr_cmp(np2oscfg.mpu.mout, s.mmap)) {
		milstr_ncpy(np2oscfg.mpu.mout, s.mmap, NELEMENTS(np2oscfg.mpu.mout));
		update |= SYS_UPDATEOSCFG | SYS_UPDATEMIDI;
	}
	GetDlgItemText(hWnd, IDC_MPU98MDIN, s.mdin, NELEMENTS(s.mdin));
	if (milstr_cmp(np2oscfg.mpu.min, s.mdin)) {
		milstr_ncpy(np2oscfg.mpu.min, s.mdin, NELEMENTS(np2oscfg.mpu.min));
		update |= SYS_UPDATEOSCFG | SYS_UPDATEMIDI;
	}
	GetDlgItemText(hWnd, IDC_MPU98MMDL, s.mmdl, NELEMENTS(s.mmdl));
	if (milstr_cmp(np2oscfg.mpu.mdl, s.mmdl)) {
		milstr_ncpy(np2oscfg.mpu.mdl, s.mmdl, NELEMENTS(np2oscfg.mpu.mdl));
		update |= SYS_UPDATEOSCFG | SYS_UPDATEMIDI;
	}

	np2oscfg.mpu.def_en = GetDlgItemCheck(hWnd, IDC_MPU98DEFE);
	if (cm_mpu98) {
		cm_mpu98->msg(cm_mpu98, COMMSG_MIMPIDEFEN, np2oscfg.mpu.def_en);
	}
	GetDlgItemText(hWnd, IDC_MPU98DEFF, s.mdef, NELEMENTS(s.mdef));
	if (milstr_cmp(np2oscfg.mpu.def, s.mdef)) {
		milstr_ncpy(np2oscfg.mpu.def, s.mdef, NELEMENTS(np2oscfg.mpu.def));
		if (cm_mpu98) {
			cm_mpu98->msg(cm_mpu98, COMMSG_MIMPIDEFFILE, (long)s.mdef);
		}
		update |= SYS_UPDATEOSCFG;
	}
	sysmng_update(update);
}
Exemplo n.º 13
0
void dialog_waverec(HWND hWnd)
{
	UINT8	bCheck;
	OEMCHAR	szPath[MAX_PATH];

	bCheck = FALSE;
	sound_recstop();
	file_cpyname(szPath, bmpfilefolder, NELEMENTS(szPath));
	file_cutname(szPath);
	file_catname(szPath, szWaveFile, NELEMENTS(szPath));
	if ((dlgs_createfilenum(hWnd, &fpWave, szPath, NELEMENTS(szPath))) &&
		(sound_recstart(szPath) == SUCCESS))
	{
		file_cpyname(bmpfilefolder, szPath, NELEMENTS(bmpfilefolder));
		sysmng_update(SYS_UPDATEOSCFG);
		bCheck = TRUE;
	}
	xmenu_setwaverec(bCheck);
}
Exemplo n.º 14
0
void dialog_s98(HWND hWnd)
{
	BOOL	bCheck;
	OEMCHAR	szPath[MAX_PATH];

	S98_close();
	bCheck = FALSE;
	file_cpyname(szPath, bmpfilefolder, NELEMENTS(szPath));
	file_cutname(szPath);
	file_catname(szPath, szS98File, NELEMENTS(szPath));
	if ((dlgs_createfilenum(hWnd, &fpS98, szPath, NELEMENTS(szPath))) &&
		(S98_open(szPath) == SUCCESS))
	{
		file_cpyname(bmpfilefolder, szPath, NELEMENTS(bmpfilefolder));
		sysmng_update(SYS_UPDATEOSCFG);
		bCheck = TRUE;
	}
	xmenu_sets98logging(bCheck);
}
Exemplo n.º 15
0
void
toolkit_initialize(void)
{
	int i;

	if (NELEMENTS(toolkit) > 0) {
		for (i = 0; i < NELEMENTS(toolkit); i++) {
			gui_toolkit_t* p = toolkit[i].toolkit;
			if (strcasecmp(p->get_toolkit(), np2oscfg.toolkit) == 0)
				break;
		}
		if (i < NELEMENTS(toolkit)) {
			toolkitp = toolkit[i].toolkit;
			return;
		}
		sysmng_update(SYS_UPDATEOSCFG);
		milstr_ncpy(np2oscfg.toolkit, "gtk", sizeof(np2oscfg.toolkit));
	}
	toolkitp = &gtk_toolkit;
}
Exemplo n.º 16
0
static void
ok_button_clicked(GtkButton *b, gpointer d)
{
	UINT8 calendar_buf[8];
	const gchar *entryp;
	BOOL renewal;
	UINT8 val;
	int i;

	renewal = FALSE;
	if (np2cfg.calendar != calendar_kind) {
		renewal = TRUE;
	}
	if (!np2cfg.calendar) {
		memset(calendar_buf, 0, sizeof(calendar_buf));
		for (i = 0; i < NELEMENTS(vircal); i++) {
			entryp = gtk_entry_get_text(GTK_ENTRY(vircal[i].entry));
			val = getbcd(entryp, 2);
			if (val >= vircal[i].min && val <= vircal[i].max) {
				if (i == 1) {
					val = ((val & 0x10) * 10) + (val << 4);
				}
				calendar_buf[i] = (UINT8)val;
			} else {
				break;
			}
		}
		if (i == NELEMENTS(vircal)) {
			calendar_set(calendar_buf);
		} else {
			renewal = FALSE;
		}
	}

	if (renewal) {
		np2cfg.calendar = calendar_kind;
		sysmng_update(SYS_UPDATECFG);
	}

	gtk_widget_destroy((GtkWidget *)d);
}
Exemplo n.º 17
0
void dialog_writebmp(HWND hWnd) {

	SCRNSAVE	ss;
	int type;
	FSPARAM		fp;
	TCHAR		szPath[MAX_PATH];
	LPCTSTR		pszExt;

	ss = scrnsave_create();
	if (ss == NULL)
	{
		return;
	}
	type = scrnsave_gettype(ss);
	fp.lpszTitle = MAKEINTRESOURCE(IDS_BMPTITLE);
	fp.lpszDefExt = MAKEINTRESOURCE(IDS_BMPEXT);
	fp.lpszFilter = lpszBmpFilter[type];
	fp.nFilterIndex = 1;
	file_cpyname(szPath, bmpfilefolder, NELEMENTS(szPath));
	file_cutname(szPath);
	file_catname(szPath, szBmpFile, NELEMENTS(szPath));
	if (dlgs_createfilenum(hWnd, &fp, szPath, NELEMENTS(szPath)))
	{
		file_cpyname(bmpfilefolder, szPath, NELEMENTS(bmpfilefolder));
		sysmng_update(SYS_UPDATEOSCFG);
		pszExt = file_getext(szPath);
		if ((type <= SCRNSAVE_8BIT) &&
			(!file_cmpname(pszExt, TEXT("gif"))))
		{
			scrnsave_writegif(ss, szPath, SCRNSAVE_AUTO);
		}
		else if (!file_cmpname(pszExt, str_bmp))
		{
			scrnsave_writebmp(ss, szPath, SCRNSAVE_AUTO);
		}
	}
	scrnsave_destroy(ss);
}
Exemplo n.º 18
0
static void dlgupdate(void)
{
	BOOL	renewal;
	int val;

	renewal = FALSE;
	val = menudlg_getval(DID_JOYPAD1);
	if (np2oscfg.JOYPAD1 != (UINT8)val) {
		np2oscfg.JOYPAD1 = (UINT8)val;
		renewal = TRUE;
	}
	
	val = menudlg_getval(DID_PAD1_1A) + (menudlg_getval(DID_PAD1_2A) << 1);
	if (np2oscfg.JOY1BTN[0] != (UINT8)val) {
		np2oscfg.JOY1BTN[0] = (UINT8)val;
		renewal = TRUE;
	}
	val = menudlg_getval(DID_PAD1_1B) + (menudlg_getval(DID_PAD1_2B) << 1);
	if (np2oscfg.JOY1BTN[1] != (UINT8)val) {
		np2oscfg.JOY1BTN[1] = (UINT8)val;
		renewal = TRUE;
	}
	val = menudlg_getval(DID_PAD1_1C) + (menudlg_getval(DID_PAD1_2C) << 1);
	if (np2oscfg.JOY1BTN[2] != (UINT8)val) {
		np2oscfg.JOY1BTN[2] = (UINT8)val;
		renewal = TRUE;
	}
	val = menudlg_getval(DID_PAD1_1D) + (menudlg_getval(DID_PAD1_2D) << 1);
	if (np2oscfg.JOY1BTN[3] != (UINT8)val) {
		np2oscfg.JOY1BTN[3] = (UINT8)val;
		renewal = TRUE;
	}

	if (renewal) {
		joymng_initialize();
		sysmng_update(SYS_UPDATECFG);
	}
}
Exemplo n.º 19
0
static LRESULT CALLBACK Snd14optDlgProc(HWND hWnd, UINT msg,
													WPARAM wp, LPARAM lp) {

	int		i;
	int		ctrlid;

	switch (msg) {
		case WM_INITDIALOG:
			for (i=0; i<6; i++) {
				sliderinit(hWnd, &snd14item[i]);
			}
			return(TRUE);

		case WM_HSCROLL:
			ctrlid = GetDlgCtrlID((HWND)lp);
			for (i=0; i<6; i++) {
				if (ctrlid == snd14item[i].res) {
					sliderresetpos(hWnd, &snd14item[i]);
					return(TRUE);
				}
			}
			break;

		case WM_NOTIFY:
			if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) {
				for (i=0; i<6; i++) {
					if (sliderrestore(hWnd, &snd14item[i])) {
						sysmng_update(SYS_UPDATECFG);
					}
				}
				tms3631_setvol(np2cfg.vol14);
				return(TRUE);
			}
			break;
	}
	return(FALSE);
}
Exemplo n.º 20
0
void
create_configure_dialog(void)
{
	GtkWidget *config_dialog;
	GtkWidget *main_widget;
	GtkWidget *cpu_hbox;
	GtkWidget *cpu_frame;
	GtkWidget *cpuframe_vbox;
	GtkWidget *cpuclock_hbox;
	GtkWidget *baseclock_combo;
	GtkWidget *rate_combo;
	GtkWidget *times_label;
	GtkWidget *realclock_label;
	GtkWidget *confirm_widget;
	GtkWidget *ok_button;
	GtkWidget *cancel_button;
	GtkWidget *arch_frame;
	GtkWidget *arch_hbox;
	GtkWidget *arch_radiobutton[NELEMENTS(architecture)];
	GtkWidget *sound_frame;
	GtkWidget *soundframe_vbox;
	GtkWidget *soundrate_hbox;
	GtkWidget *rate_label;
	GtkWidget *rate_radiobutton[NELEMENTS(samplingrate)];
	GtkWidget *soundbuffer_hbox;
	GtkWidget *buffer_label;
	GtkWidget *ms_label;
	gchar buf[8];
	int i;

	uninstall_idle_process();

	config_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(config_dialog), "Configure");
	gtk_window_set_position(GTK_WINDOW(config_dialog), GTK_WIN_POS_CENTER);
	gtk_window_set_modal(GTK_WINDOW(config_dialog), TRUE);
	gtk_window_set_resizable(GTK_WINDOW(config_dialog), FALSE);
	gtk_container_set_border_width(GTK_CONTAINER(config_dialog), 5);

	g_signal_connect(GTK_OBJECT(config_dialog), "destroy",
	    G_CALLBACK(dialog_destroy), NULL);

	main_widget = gtk_vbox_new(FALSE, 0);
	gtk_widget_show(main_widget);
	gtk_container_add(GTK_CONTAINER(config_dialog), main_widget);

	/* CPU column */
	cpu_hbox = gtk_hbox_new(FALSE, 0);
	gtk_widget_show(cpu_hbox);
	gtk_box_pack_start(GTK_BOX(main_widget), cpu_hbox, TRUE, TRUE, 0);

	/*
	 * CPU frame
	 */
	cpu_frame = gtk_frame_new("CPU");
	gtk_widget_show(cpu_frame);
	gtk_box_pack_start(GTK_BOX(cpu_hbox), cpu_frame, TRUE, TRUE, 0);

	cpuframe_vbox = gtk_vbox_new(FALSE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(cpuframe_vbox), 5);
	gtk_widget_show(cpuframe_vbox);
	gtk_container_add(GTK_CONTAINER(cpu_frame), cpuframe_vbox);

	/* cpu clock */
	cpuclock_hbox = gtk_hbox_new(FALSE, 0);
	gtk_widget_show(cpuclock_hbox);
	gtk_box_pack_start(GTK_BOX(cpuframe_vbox),cpuclock_hbox, TRUE, TRUE, 2);

	baseclock_combo = gtk_combo_box_entry_new_text();
	gtk_widget_show(baseclock_combo);
	gtk_box_pack_start(GTK_BOX(cpuclock_hbox), baseclock_combo, TRUE, FALSE, 0);
	gtk_widget_set_size_request(baseclock_combo, 96, -1);
	for (i = 0; i < NELEMENTS(baseclock_str); i++) {
		gtk_combo_box_append_text(GTK_COMBO_BOX(baseclock_combo), baseclock_str[i]);
	}

	baseclock_entry = GTK_BIN(baseclock_combo)->child;
	gtk_widget_show(baseclock_entry);
	gtk_editable_set_editable(GTK_EDITABLE(baseclock_entry), FALSE);
	switch (np2cfg.baseclock) {
	default:
		np2cfg.baseclock = PCBASECLOCK25;
		sysmng_update(SYS_UPDATECFG|SYS_UPDATECLOCK);
		/*FALLTHROUGH*/
	case PCBASECLOCK25:
		gtk_entry_set_text(GTK_ENTRY(baseclock_entry),baseclock_str[1]);
		break;

	case PCBASECLOCK20:
		gtk_entry_set_text(GTK_ENTRY(baseclock_entry),baseclock_str[0]);
		break;
	}

	times_label = gtk_label_new("x");
	gtk_widget_show(times_label);
	gtk_box_pack_start(GTK_BOX(cpuclock_hbox), times_label, TRUE, FALSE, 0);
	gtk_misc_set_padding(GTK_MISC(times_label), 5, 0);

	rate_combo = gtk_combo_box_entry_new_text();
	gtk_widget_show(rate_combo);
	gtk_box_pack_start(GTK_BOX(cpuclock_hbox), rate_combo, TRUE, FALSE, 0);
	gtk_widget_set_size_request(rate_combo, 48, -1);
	for (i = 0; i < NELEMENTS(clockmult_str); i++) {
		gtk_combo_box_append_text(GTK_COMBO_BOX(rate_combo), clockmult_str[i]);
	}

	clockmult_entry = GTK_BIN(rate_combo)->child;
	gtk_widget_show(clockmult_entry);
	gtk_editable_set_editable(GTK_EDITABLE(clockmult_entry), FALSE);
	switch (np2cfg.multiple) {
	case 1: case 2: case 4: case 5: case 6: case 8: case 10: case 12:
	case 16: case 20:
		g_snprintf(buf, sizeof(buf), "%d", np2cfg.multiple);
		gtk_entry_set_text(GTK_ENTRY(clockmult_entry), buf);
		break;

	default:
		gtk_entry_set_text(GTK_ENTRY(clockmult_entry), "4");
		break;
	}

	/* calculated cpu clock */
	realclock_label = gtk_label_new("MHz");
	gtk_widget_show(realclock_label);
	gtk_box_pack_start(GTK_BOX(cpuframe_vbox), realclock_label, FALSE, FALSE, 2);
	gtk_misc_set_alignment(GTK_MISC(realclock_label), 1.0, 0.5);

	g_signal_connect(GTK_OBJECT(baseclock_entry), "changed",
	  G_CALLBACK(clock_changed), (gpointer)realclock_label);
	g_signal_connect(GTK_OBJECT(clockmult_entry), "changed",
	  G_CALLBACK(clock_changed), (gpointer)realclock_label);
	clock_changed(NULL, realclock_label);

	/* OK, Cancel button base widget */
	confirm_widget = gtk_vbutton_box_new();
	gtk_widget_show(confirm_widget);
	gtk_box_pack_start(GTK_BOX(cpu_hbox), confirm_widget, TRUE, TRUE, 0);
	gtk_button_box_set_layout(GTK_BUTTON_BOX(confirm_widget), GTK_BUTTONBOX_END);
	//gtk_button_box_set_spacing(GTK_BUTTON_BOX(confirm_widget), 0);

	/*
	 * Architecture frame
	 */
	arch_frame = gtk_frame_new("Architecture");
	gtk_widget_show(arch_frame);
	gtk_box_pack_start(GTK_BOX(main_widget), arch_frame, TRUE, TRUE, 0);

	/* architecture */
	arch_hbox = gtk_hbox_new(TRUE, 0);
	gtk_widget_show(arch_hbox);
	gtk_container_add(GTK_CONTAINER(arch_frame), arch_hbox);

	for (i = 0; i < NELEMENTS(architecture); i++) {
		arch_radiobutton[i] = gtk_radio_button_new_with_label_from_widget(i > 0 ? GTK_RADIO_BUTTON(arch_radiobutton[i-1]) : NULL, architecture[i].label);
		gtk_widget_show(arch_radiobutton[i]);
		gtk_box_pack_start(GTK_BOX(arch_hbox), arch_radiobutton[i], FALSE, FALSE, 0);
#if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 18)
		gtk_widget_set_can_focus(arch_radiobutton[i], FALSE);
#else
		GTK_WIDGET_UNSET_FLAGS(rate_radiobutton[i], GTK_CAN_FOCUS);
#endif
		g_signal_connect(GTK_OBJECT(arch_radiobutton[i]), "clicked",
		    G_CALLBACK(arch_radiobutton_clicked), (gpointer)architecture[i].arch);
	}
	for (i = 0; i < NELEMENTS(architecture); i++) {
		if (strcmp(np2cfg.model, architecture[i].arch) == 0) {
			break;
		}
	}
	if (i == NELEMENTS(architecture)) {
		i = 1;
		milstr_ncpy(np2cfg.model, "VX", sizeof(np2cfg.model));
		sysmng_update(SYS_UPDATECFG);
	}
	g_signal_emit_by_name(GTK_OBJECT(arch_radiobutton[i]), "clicked");

	/*
	 * Sound frame
	 */
	sound_frame = gtk_frame_new("Sound");
	gtk_widget_show(sound_frame);
	gtk_box_pack_start(GTK_BOX(main_widget), sound_frame, TRUE, TRUE, 0);

	soundframe_vbox = gtk_vbox_new(FALSE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(soundframe_vbox), 5);
	gtk_widget_show(soundframe_vbox);
	gtk_container_add(GTK_CONTAINER(sound_frame), soundframe_vbox);

	/* sampling rate */
	soundrate_hbox = gtk_hbox_new(FALSE, 0);
	gtk_widget_show(soundrate_hbox);
	gtk_box_pack_start(GTK_BOX(soundframe_vbox), soundrate_hbox, TRUE, TRUE, 2);

	rate_label = gtk_label_new("Sampling Rate");
	gtk_widget_show(rate_label);
	gtk_box_pack_start(GTK_BOX(soundrate_hbox), rate_label, FALSE, TRUE, 3);
	gtk_widget_set_size_request(rate_label, 96, -1);

	for (i = 0; i < NELEMENTS(samplingrate); i++) {
		rate_radiobutton[i] = gtk_radio_button_new_with_label_from_widget((i > 0) ? GTK_RADIO_BUTTON(rate_radiobutton[i-1]) : NULL, samplingrate[i].label);
		gtk_widget_show(rate_radiobutton[i]);
		gtk_box_pack_start(GTK_BOX(soundrate_hbox), rate_radiobutton[i], FALSE, FALSE, 0);
#if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 18)
		gtk_widget_set_can_focus(rate_radiobutton[i], FALSE);
#else
		GTK_WIDGET_UNSET_FLAGS(rate_radiobutton[i], GTK_CAN_FOCUS);
#endif
		g_signal_connect(GTK_OBJECT(rate_radiobutton[i]), "clicked",
		    G_CALLBACK(rate_radiobutton_clicked), GINT_TO_POINTER(samplingrate[i].rate));
	}
	if (np2cfg.samplingrate == 11025) {
		i = 0;
	} else if (np2cfg.samplingrate == 22050) {
		i = 1;
	} else if (np2cfg.samplingrate == 44100) {
		i = 2;
	} else {
		i = 1;
		np2cfg.samplingrate = 22050;
		sysmng_update(SYS_UPDATECFG|SYS_UPDATERATE);
	}
	g_signal_emit_by_name(GTK_OBJECT(rate_radiobutton[i]), "clicked");

	soundbuffer_hbox = gtk_hbox_new(FALSE, 0);
	gtk_widget_show(soundbuffer_hbox);
	gtk_box_pack_start(GTK_BOX(soundframe_vbox), soundbuffer_hbox, TRUE, TRUE, 2);

	/* buffer size */
	buffer_label = gtk_label_new("Buffer");
	gtk_widget_show(buffer_label);
	gtk_box_pack_start(GTK_BOX(soundbuffer_hbox), buffer_label, FALSE, FALSE, 0);
	gtk_widget_set_size_request(buffer_label, 96, -1);

	buffer_entry = gtk_entry_new();
	gtk_widget_show(buffer_entry);
	gtk_box_pack_start(GTK_BOX(soundbuffer_hbox), buffer_entry, FALSE, FALSE, 0);
	gtk_widget_set_size_request(buffer_entry, 48, -1);

	if (np2cfg.delayms >= 20 && np2cfg.delayms <= 1000) {
		g_snprintf(buf, sizeof(buf), "%d", np2cfg.delayms);
		gtk_entry_set_text(GTK_ENTRY(buffer_entry), buf);
	} else {
		gtk_entry_set_text(GTK_ENTRY(buffer_entry), "500");
		np2cfg.delayms = 500;
		sysmng_update(SYS_UPDATECFG|SYS_UPDATESBUF);
		soundrenewal = 1;
	}

	ms_label = gtk_label_new(" ms");
	gtk_widget_show(ms_label);
	gtk_box_pack_start(GTK_BOX(soundbuffer_hbox),ms_label, FALSE, FALSE, 0);

#if defined(SUPPORT_RESUME)
	/* resume */
	resume_checkbutton = gtk_check_button_new_with_label("Resume");
	gtk_widget_show(resume_checkbutton);
	gtk_box_pack_start(GTK_BOX(main_widget), resume_checkbutton, FALSE, FALSE, 1);
	if (np2oscfg.resume) {
		g_signal_emit_by_name(GTK_OBJECT(resume_checkbutton), "clicked");
	}
#endif

#if defined(GCC_CPU_ARCH_IA32)
	/* Disable MMX */
	disablemmx_checkbutton = gtk_check_button_new_with_label("Disable MMX");
	gtk_widget_show(disablemmx_checkbutton);
	gtk_box_pack_start(GTK_BOX(main_widget), disablemmx_checkbutton, FALSE, FALSE, 1);
	if (mmxflag & MMXFLAG_NOTSUPPORT) {
		gtk_widget_set_sensitive(disablemmx_checkbutton, FALSE);
	} else if (mmxflag & MMXFLAG_DISABLE) {
		g_signal_emit_by_name(GTK_OBJECT(disablemmx_checkbutton), "clicked");
	}
#endif

	/*
	 * OK, Cancel button
	 */
	ok_button = gtk_button_new_from_stock(GTK_STOCK_OK);
	gtk_widget_show(ok_button);
	gtk_container_add(GTK_CONTAINER(confirm_widget), ok_button);
#if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 18)
	gtk_widget_set_can_default(ok_button, TRUE);
	gtk_widget_has_default(ok_button);
#else
	GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT);
	GTK_WIDGET_SET_FLAGS(ok_button, GTK_HAS_DEFAULT);
#endif
	g_signal_connect(GTK_OBJECT(ok_button), "clicked",
	    G_CALLBACK(ok_button_clicked), (gpointer)config_dialog);
	gtk_widget_grab_default(ok_button);

	cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
	gtk_widget_show(cancel_button);
	gtk_container_add(GTK_CONTAINER(confirm_widget), cancel_button);
#if GTK_MAJOR_VERSION > 2 || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 18)
	gtk_widget_set_can_default(cancel_button, TRUE);
#else
	GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT);
#endif
	g_signal_connect_swapped(GTK_OBJECT(cancel_button), "clicked",
	    G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(config_dialog));

	gtk_widget_show_all(config_dialog);
}
Exemplo n.º 21
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);
}
Exemplo n.º 22
0
static LRESULT CALLBACK SPBoptDlgProc(HWND hWnd, UINT msg,
													WPARAM wp, LPARAM lp) {
	UINT8	b;
	UINT	update;

	switch(msg) {
		case WM_INITDIALOG:
			spbcreate(hWnd);
			return(TRUE);

		case WM_COMMAND:
			switch(LOWORD(wp)) {
				case IDC_SPBIO:
					setspbjmp(hWnd, getsnd26io(hWnd, IDC_SPBIO), 0x10);
					break;

				case IDC_SPBINT:
					setspbjmp(hWnd, getsnd26int(hWnd, IDC_SPBINT), 0xc0);
					break;

				case IDC_SPBROM:
					setspbjmp(hWnd, getsnd26rom(hWnd, IDC_SPBROM), 0x07);
					break;

				case IDC_SPBDEF:
					spb = 0xd1;
					setsnd26io(hWnd, IDC_SPBIO, spb);
					setsnd26int(hWnd, IDC_SPBINT, spb);
					setsnd26rom(hWnd, IDC_SPBROM, spb);
					spbvrc = 0;
					setspbVRch(hWnd);
					InvalidateRect(GetDlgItem(hWnd, IDC_SPBJMP), NULL, TRUE);
					break;

				case IDC_SPBVRL:
				case IDC_SPBVRR:
					b = getspbVRch(hWnd);
					if ((spbvrc ^ b) & 3) {
						spbvrc = b;
						InvalidateRect(GetDlgItem(hWnd, IDC_SPBJMP),
																NULL, TRUE);
					}
					break;

				case IDC_SPBJMP:
					spbcmdjmp(hWnd);
					break;
			}
			break;

		case WM_NOTIFY:
			if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) {
				update = 0;
				if (np2cfg.spbopt != spb) {
					np2cfg.spbopt = spb;
					update |= SYS_UPDATECFG;
				}
				if (np2cfg.spb_vrc != spbvrc) {
					np2cfg.spb_vrc = spbvrc;
					update |= SYS_UPDATECFG;
				}
				b = (UINT8)SendDlgItemMessage(hWnd, IDC_SPBVRLEVEL,
															TBM_GETPOS, 0, 0);
				if (np2cfg.spb_vrl != b) {
					np2cfg.spb_vrl = b;
					update |= SYS_UPDATECFG;
				}
				opngen_setVR(np2cfg.spb_vrc, np2cfg.spb_vrl);
				b = (UINT8)GetDlgItemCheck(hWnd, IDC_SPBREVERSE);
				if (np2cfg.spb_x != b) {
					np2cfg.spb_x = b;
					update |= SYS_UPDATECFG;
				}
				sysmng_update(update);
				return(TRUE);
			}
			break;

		case WM_DRAWITEM:
			if (LOWORD(wp) == IDC_SPBJMP) {
				dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC,
											dipswbmp_getsndspb(spb, spbvrc));
			}
			return(FALSE);
	}
	return(FALSE);
}
Exemplo n.º 23
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);
}
Exemplo n.º 24
0
static LRESULT CALLBACK Snd86optDlgProc(HWND hWnd, UINT msg,
													WPARAM wp, LPARAM lp) {

	HWND	sub;

	switch(msg) {
		case WM_INITDIALOG:
			snd86 = np2cfg.snd86opt;
			dlgs_setcbitem(hWnd, IDC_SND86IO, cpIO86, NELEMENTS(cpIO86));
			setsnd86io(hWnd, IDC_SND86IO, snd86);
			SetDlgItemCheck(hWnd, IDC_SND86INT, snd86 & 0x10);
			dlgs_setcbitem(hWnd, IDC_SND86INTA, cpInt86, NELEMENTS(cpInt86));
			setsnd86int(hWnd, IDC_SND86INTA, snd86);
			dlgs_setcbitem(hWnd, IDC_SND86ID, cpID, NELEMENTS(cpID));
			setsnd86id(hWnd, IDC_SND86ID, snd86);
			SetDlgItemCheck(hWnd, IDC_SND86ROM, snd86 & 2);

			sub = GetDlgItem(hWnd, IDC_SND86DIP);
			SetWindowLong(sub, GWL_STYLE, SS_OWNERDRAW +
							(GetWindowLong(sub, GWL_STYLE) & (~SS_TYPEMASK)));
			return(TRUE);

		case WM_COMMAND:
			switch(LOWORD(wp)) {
				case IDC_SND86IO:
					set86jmp(hWnd, getsnd86io(hWnd, IDC_SND86IO), 0x01);
					break;

				case IDC_SND86INT:
					set86jmp(hWnd,
							(GetDlgItemCheck(hWnd, IDC_SND86INT))?0x10:0x00,
																		0x10);
					break;

				case IDC_SND86INTA:
					set86jmp(hWnd, getsnd86int(hWnd, IDC_SND86INTA), 0x0c);
					break;

				case IDC_SND86ROM:
					set86jmp(hWnd,
							(GetDlgItemCheck(hWnd, IDC_SND86ROM))?0x02:0x00,
																		0x02);
					break;

				case IDC_SND86ID:
					set86jmp(hWnd, getsnd86id(hWnd, IDC_SND86ID), 0xe0);
					break;

				case IDC_SND86DEF:
					snd86 = 0x7f;
					setsnd86io(hWnd, IDC_SND86IO, snd86);
					SetDlgItemCheck(hWnd, IDC_SND86INT, TRUE);
					setsnd86int(hWnd, IDC_SND86INTA, snd86);
					setsnd86id(hWnd, IDC_SND86ID, snd86);
					SetDlgItemCheck(hWnd, IDC_SND86ROM, TRUE);
					InvalidateRect(GetDlgItem(hWnd, IDC_SND86DIP), NULL, TRUE);
					break;

				case IDC_SND86DIP:
					snd86cmddipsw(hWnd);
					break;
			}
			break;

		case WM_NOTIFY:
			if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) {
				if (np2cfg.snd86opt != snd86) {
					np2cfg.snd86opt = snd86;
					sysmng_update(SYS_UPDATECFG);
				}
				return(TRUE);
			}
			break;

		case WM_DRAWITEM:
			if (LOWORD(wp) == IDC_SND86DIP) {
				dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC,
												dipswbmp_getsnd86(snd86));
			}
			return(FALSE);
	}
	return(FALSE);
}
Exemplo n.º 25
0
static LRESULT CALLBACK Snd26optDlgProc(HWND hWnd, UINT msg,
													WPARAM wp, LPARAM lp) {

	HWND	sub;

	switch(msg) {
		case WM_INITDIALOG:
			snd26 = np2cfg.snd26opt;
			dlgs_setcbitem(hWnd, IDC_SND26IO, cpIO26, NELEMENTS(cpIO26));
			dlgs_setcbitem(hWnd, IDC_SND26INT, cpInt26, NELEMENTS(cpInt26));
			dlgs_setcbitem(hWnd, IDC_SND26ROM, cpAddr, NELEMENTS(cpAddr));
			snd26set(hWnd, snd26);
			sub = GetDlgItem(hWnd, IDC_SND26JMP);
			SetWindowLong(sub, GWL_STYLE, SS_OWNERDRAW +
							(GetWindowLong(sub, GWL_STYLE) & (~SS_TYPEMASK)));
			return(TRUE);

		case WM_COMMAND:
			switch(LOWORD(wp)) {
				case IDC_SND26IO:
					set26jmp(hWnd, getsnd26io(hWnd, IDC_SND26IO), 0x10);
					break;

				case IDC_SND26INT:
					set26jmp(hWnd, getsnd26int(hWnd, IDC_SND26INT), 0xc0);
					break;

				case IDC_SND26ROM:
					set26jmp(hWnd, getsnd26rom(hWnd, IDC_SND26ROM), 0x07);
					break;

				case IDC_SND26DEF:
					snd26 = 0xd1;
					snd26set(hWnd, snd26);
					InvalidateRect(GetDlgItem(hWnd, IDC_SND26JMP), NULL, TRUE);
					break;

				case IDC_SND26JMP:
					snd26cmdjmp(hWnd);
					break;
			}
			break;

		case WM_NOTIFY:
			if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) {
				if (np2cfg.snd26opt != snd26) {
					np2cfg.snd26opt = snd26;
					sysmng_update(SYS_UPDATECFG);
				}
				return(TRUE);
			}
			break;

		case WM_DRAWITEM:
			if (LOWORD(wp) == IDC_SND26JMP) {
				dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC,
												dipswbmp_getsnd26(snd26));
			}
			break;
	}
	return(FALSE);
}
Exemplo n.º 26
0
static void dlgupdate(void) {

	UINT		update;
	UINT		val;
const OEMCHAR	*str;

	update = 0;
	if (menudlg_getval(DID_CLOCK1)) {
		val = PCBASECLOCK20;
	}
	else {
		val = PCBASECLOCK25;
	}
	if (np2cfg.baseclock != val) {
		np2cfg.baseclock = val;
		update |= SYS_UPDATECFG | SYS_UPDATECLOCK;
	}
	val = menudlg_getval(DID_MULTIPLE);
	if (val < 1) {
		val = 1;
	}
	else if (val > 32) {
		val = 32;
	}
	if (np2cfg.multiple != val) {
		np2cfg.multiple = val;
		update |= SYS_UPDATECFG | SYS_UPDATECLOCK;
	}

	if (menudlg_getval(DID_RATE11)) {
		val = 11025;
	}
	else if (menudlg_getval(DID_RATE44)) {
		val = 44100;
	}
	else {
		val = 22050;
	}
	if (np2cfg.samplingrate != (UINT16)val) {
		np2cfg.samplingrate = (UINT16)val;
		update |= SYS_UPDATECFG | SYS_UPDATERATE;
		soundrenewal = 1;
	}

	if (menudlg_getval(DID_MODELVM)) {
		str = str_VM;
	}
	else if (menudlg_getval(DID_MODELEPSON)) {
		str = str_EPSON;
	}
	else {
		str = str_VX;
	}
	if (milstr_cmp(np2cfg.model, str)) {
		milstr_ncpy(np2cfg.model, str, NELEMENTS(np2cfg.model));
		update |= SYS_UPDATECFG;
	}

	if (menudlg_getval(DID_RATE11)) {
		val = 11025;
	}
	else if (menudlg_getval(DID_RATE44)) {
		val = 44100;
	}
	else {
		val = 22050;
	}
	if (np2cfg.samplingrate != (UINT16)val) {
		np2cfg.samplingrate = (UINT16)val;
		update |= SYS_UPDATECFG | SYS_UPDATERATE;
		soundrenewal = 1;
	}
	val = menudlg_getval(DID_BUFFER);
	if (val < 100) {
		val = 100;
	}
	else if (val > 1000) {
		val = 1000;
	}
	if (np2cfg.delayms != (UINT16)val) {
		np2cfg.delayms = (UINT16)val;
		update |= SYS_UPDATECFG | SYS_UPDATESBUF;
		soundrenewal = 1;
	}

	val = menudlg_getval(DID_RESUME);
	if (np2oscfg.resume != (UINT8)val) {
		np2oscfg.resume = (UINT8)val;
		update |= SYS_UPDATEOSCFG;
	}
	sysmng_update(update);
}
Exemplo n.º 27
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);
}
Exemplo n.º 28
0
static void setwindowsize(HWND hWnd, int width, int height) {

	RECT	workrc;
	int		scx;
	int		scy;
	UINT	cnt;
	RECT	rectwindow;
	RECT	rectclient;
	int		cx;
	int		cy;
	UINT	update;

	SystemParametersInfo(SPI_GETWORKAREA, 0, &workrc, 0);
	scx = GetSystemMetrics(SM_CXSCREEN);
	scy = GetSystemMetrics(SM_CYSCREEN);

	cnt = 2;
	do {
		GetWindowRect(hWnd, &rectwindow);
		GetClientRect(hWnd, &rectclient);
		cx = width;
		cx += np2oscfg.paddingx * 2;
		cx += rectwindow.right - rectwindow.left;
		cx -= rectclient.right - rectclient.left;
		cy = height;
		cy += np2oscfg.paddingy * 2;
		cy += rectwindow.bottom - rectwindow.top;
		cy -= rectclient.bottom - rectclient.top;

		update = 0;
		if (scx < cx) {
			np2oscfg.winx = (scx - cx) / 2;
			update |= SYS_UPDATEOSCFG;
		}
		else {
			if ((np2oscfg.winx + cx) > workrc.right) {
				np2oscfg.winx = workrc.right - cx;
				update |= SYS_UPDATEOSCFG;
			}
			if (np2oscfg.winx < workrc.left) {
				np2oscfg.winx = workrc.left;
				update |= SYS_UPDATEOSCFG;
			}
		}
		if (scy < cy) {
			np2oscfg.winy = (scy - cy) / 2;
			update |= SYS_UPDATEOSCFG;
		}
		else {
			if ((np2oscfg.winy + cy) > workrc.bottom) {
				np2oscfg.winy = workrc.bottom - cy;
				update |= SYS_UPDATEOSCFG;
			}
			if (np2oscfg.winy < workrc.top) {
				np2oscfg.winy = workrc.top;
				update |= SYS_UPDATEOSCFG;
			}
		}
		sysmng_update(update);
		MoveWindow(hWnd, np2oscfg.winx, np2oscfg.winy, cx, cy, TRUE);
	} while(--cnt);
}
Exemplo n.º 29
0
static void
ok_button_clicked(GtkButton *b, gpointer d)
{
	const gchar *bufp = gtk_entry_get_text(GTK_ENTRY(buffer_entry));
	const gchar *base = gtk_entry_get_text(GTK_ENTRY(baseclock_entry));
	const gchar *multp = gtk_entry_get_text(GTK_ENTRY(clockmult_entry));
#if defined(SUPPORT_RESUME)
	gint resume = GTK_TOGGLE_BUTTON(resume_checkbutton)->active;
#endif
#if defined(GCC_CPU_ARCH_IA32)
	gint disablemmx = GTK_TOGGLE_BUTTON(disablemmx_checkbutton)->active;
#endif
	guint bufsize;
	guint mult;
	UINT renewal = 0;
	int i;

	if (strcmp(base, "1.9968MHz") == 0) {
		if (np2cfg.baseclock != PCBASECLOCK20) {
			np2cfg.baseclock = PCBASECLOCK20;
			renewal |= SYS_UPDATECFG|SYS_UPDATECLOCK;
		}
	} else {
		if (np2cfg.baseclock != PCBASECLOCK25) {
			np2cfg.baseclock = PCBASECLOCK25;
			renewal |= SYS_UPDATECFG|SYS_UPDATECLOCK;
		}
	}

	mult = milstr_solveINT(multp);
	switch (mult) {
	case 1: case 2: case 4: case 5: case 6: case 8: case 10: case 12:
	case 16: case 20:
		if (mult != np2cfg.multiple) {
			np2cfg.multiple = mult;
			renewal |= SYS_UPDATECFG|SYS_UPDATECLOCK;
		}
		break;
	}

	for (i = 0; i < NELEMENTS(architecture); i++) {
		if (strcmp(arch, architecture[i].arch) == 0) {
			milstr_ncpy(np2cfg.model, arch, sizeof(np2cfg.model));
			renewal |= SYS_UPDATECFG;
			break;
		}
	}
	if (i == NELEMENTS(architecture)) {
		milstr_ncpy(np2cfg.model, "VX", sizeof(np2cfg.model));
		renewal |= SYS_UPDATECFG;
	}

	switch (rate) {
	case 11025:
	case 22050:
	case 44100:
		if (rate != np2cfg.samplingrate) {
			np2cfg.samplingrate = rate;
			renewal |= SYS_UPDATECFG|SYS_UPDATERATE;
			soundrenewal = 1;
		}
		break;
	}

	bufsize = milstr_solveINT(bufp);
	if (bufsize < 20)
		bufsize = 20;
	else if (bufsize > 1000)
		bufsize = 1000;
	if (np2cfg.delayms != bufsize) {
		np2cfg.delayms = bufsize;
		renewal |= SYS_UPDATECFG|SYS_UPDATESBUF;
		soundrenewal = 1;
	}

#if defined(GCC_CPU_ARCH_IA32)
	if (!(mmxflag & MMXFLAG_NOTSUPPORT)) {
		disablemmx = disablemmx ? MMXFLAG_DISABLE : 0;
		if (np2oscfg.disablemmx != disablemmx) {
			np2oscfg.disablemmx = disablemmx;
			mmxflag &= ~MMXFLAG_DISABLE;
			mmxflag |= disablemmx;
			renewal |= SYS_UPDATEOSCFG;
		}
	}
#endif

#if defined(SUPPORT_RESUME)
	if (np2oscfg.resume != resume) {
		np2oscfg.resume = resume;
		renewal |= SYS_UPDATEOSCFG;
	}
#endif

	if (renewal) {
		sysmng_update(renewal);
	}

	gtk_widget_destroy((GtkWidget *)d);
}
Exemplo n.º 30
0
LRESULT CALLBACK ClndDialogProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {

    TCHAR	work[32];
    UINT8	b;
    int		i;
    HWND	subwnd;

    switch (msg) {
    case WM_INITDIALOG:
        // 時間をセット。
        calendar_getvir(cbuf);
        set_cal2dlg(hWnd, cbuf);
        if (np2cfg.calendar) {
            vircalendar(hWnd, FALSE);
            subwnd = GetDlgItem(hWnd, IDC_CLNDREAL);
        }
        else {
            vircalendar(hWnd, TRUE);
            subwnd = GetDlgItem(hWnd, IDC_CLNDVIR);
        }
        SendMessage(subwnd, BM_SETCHECK, TRUE, 0);
        SetFocus(subwnd);
        return(FALSE);

    case WM_COMMAND:
        switch(LOWORD(wp)) {
        case IDOK:
            b = (UINT8)GetDlgItemCheck(hWnd, IDC_CLNDREAL);
            if (np2cfg.calendar != b) {
                np2cfg.calendar = b;
                sysmng_update(SYS_UPDATECFG);
            }
            for (i=0; i<6; i++) {
                GetDlgItemText(hWnd, vircal[i].res,
                               work, NELEMENTS(work));
                b = getbcd(work, 2);
                if ((b >= vircal[i].min) && (b <= vircal[i].max)) {
                    if (i == 1) {
                        b = ((b & 0x10) * 10) + (b << 4);
                    }
                    cbuf[i] = b;
                }
            }
            calendar_set(cbuf);
            EndDialog(hWnd, IDOK);
            break;

        case IDCANCEL:
            EndDialog(hWnd, IDCANCEL);
            break;

        case IDC_CLNDVIR:
            vircalendar(hWnd, TRUE);
            return(FALSE);

        case IDC_CLNDREAL:
            vircalendar(hWnd, FALSE);
            return(FALSE);

        case IDC_SETNOW:
            calendar_getreal(cbuf);
            set_cal2dlg(hWnd, cbuf);
            return(FALSE);

        default:
            return(FALSE);
        }
        break;

    case WM_CLOSE:
        PostMessage(hWnd, WM_COMMAND, IDCANCEL, 0);
        break;

    default:
        return(FALSE);
    }
    return(TRUE);
}