Exemplo n.º 1
0
static void dlgupdate(void) {

	UINT	update;
	BOOL	renewal;
	UINT	val;
	UINT8	value[6];

	update = 0;
	renewal = FALSE;
	val = menudlg_getval(DID_SKIPLINE);
	if (np2cfg.skipline != (UINT8)val) {
		np2cfg.skipline = (UINT8)val;
		renewal = TRUE;
	}
	val = menudlg_getval(DID_SKIPLIGHT);
	if (val > 255) {
		val = 255;
	}
	if (np2cfg.skiplight != (UINT16)val) {
		np2cfg.skiplight = (UINT16)val;
		renewal = TRUE;
	}
	if (renewal) {
		pal_makeskiptable();
	}
	val = menudlg_getval(DID_LCD) + (menudlg_getval(DID_LCDX) << 1);
	if (np2cfg.LCD_MODE != (UINT8)val) {
		np2cfg.LCD_MODE = (UINT8)val;
		pal_makelcdpal();
		renewal = TRUE;
	}
	if (renewal) {
		scrndraw_redraw();
		update |= SYS_UPDATECFG;
	}

	val = menudlg_getval(DID_GDC72020);
	if (np2cfg.uPD72020 != (UINT8)val) {
		np2cfg.uPD72020 = (UINT8)val;
		update |= SYS_UPDATECFG;
		gdc_restorekacmode();
		gdcs.grphdisp |= GDCSCRN_ALLDRAW2;
	}
	for (val=0; (val<3) && (!menudlg_getval(gdcchip[val])); val++) { }
	if (np2cfg.grcg != (UINT8)val) {
		np2cfg.grcg = (UINT8)val;
		update |= SYS_UPDATECFG;
		gdcs.grphdisp |= GDCSCRN_ALLDRAW2;
	}
	val = menudlg_getval(DID_PC980124);
	if (np2cfg.color16 != (UINT8)val) {
		np2cfg.color16 = (UINT8)val;
		update |= SYS_UPDATECFG;
	}

	ZeroMemory(value, sizeof(value));
	value[0] = (UINT8)menudlg_getval(DID_TRAMWAIT);
	if (value[0]) {
		value[1] = 1;
	}
	value[2] = (UINT8)menudlg_getval(DID_VRAMWAIT);
	if (value[2]) {
		value[3] = 1;
	}
	value[4] = (UINT8)menudlg_getval(DID_GRCGWAIT);
	if (value[4]) {
		value[5] = 1;
	}
	for (val=0; val<6; val++) {
		if (np2cfg.wait[val] != value[val]) {
			np2cfg.wait[val] = value[val];
			update |= SYS_UPDATECFG;
		}
	}
	val = menudlg_getval(DID_REALPAL);
	if (np2cfg.realpal != (UINT8)val) {
		np2cfg.realpal = (UINT8)val;
		update |= SYS_UPDATECFG;
	}
	sysmng_update(update);
}
Exemplo n.º 2
0
static void
ok_button_clicked(GtkButton *b, gpointer d)
{
	/* Video */
	gint video_lcd;
	gint video_lcdrev;
	gint video_skipline;
	guint video_skipline_ratio;

	/* Chip */
	gint chip_color16;

	/* Timing */
	guint timing_waitclock[NELEMENTS(timing_waitclock_str)];
	guint timing_realpal;

	/* common */
	BOOL renewal;
	int i;

	/* Video tab */
	video_lcd = GTK_TOGGLE_BUTTON(video_lcd_checkbutton)->active;
	video_lcdrev = GTK_TOGGLE_BUTTON(video_lcd_reverse_checkbutton)->active;
	video_skipline = GTK_TOGGLE_BUTTON(video_skipline_checkbutton)->active;
	video_skipline_ratio = (guint)GTK_ADJUSTMENT(video_skipline_ratio_adj)->value;

	renewal = FALSE;
	if (np2cfg.skipline != video_skipline) {
		np2cfg.skipline = video_skipline;
		renewal = TRUE;
	}
	if (np2cfg.skiplight != video_skipline_ratio) {
		np2cfg.skiplight = video_skipline_ratio;
		renewal = TRUE;
	}
	if (renewal) {
		pal_makeskiptable();
	}
	if (video_lcd) {
		video_lcd |= video_lcdrev ? 2 : 0;
	}
	if (np2cfg.LCD_MODE != video_lcd) {
		np2cfg.LCD_MODE |= video_lcd;
		pal_makelcdpal();
		renewal = TRUE;
	}

	if (renewal) {
		sysmng_update(SYS_UPDATECFG);
		scrndraw_redraw();
	}

	/* Chip tab */
	chip_color16 = GTK_TOGGLE_BUTTON(chip_enable_color16_checkbutton)->active;

	renewal = FALSE;
	if (np2cfg.uPD72020 != chip_uPD72020) {
		np2cfg.uPD72020 = chip_uPD72020;
		gdc_restorekacmode();
		gdcs.grphdisp |= GDCSCRN_ALLDRAW2;
		renewal = TRUE;
	}
	if ((np2cfg.grcg & 3) != chip_gc_kind) {
		np2cfg.grcg = (np2cfg.grcg & ~3) | chip_gc_kind;
		gdcs.grphdisp |= GDCSCRN_ALLDRAW2;
		renewal = TRUE;
	}
	if (np2cfg.color16 != chip_color16) {
		np2cfg.color16 = chip_color16;
		renewal = TRUE;
	}

	if (renewal) {
		sysmng_update(SYS_UPDATECFG);
	}

	/* Timing tab */
	timing_realpal = ((guint)GTK_ADJUSTMENT(timing_realpal_adj)->value) + 32;

	renewal = FALSE;
	for (i =  0; i < NELEMENTS(timing_waitclock_str); i++) {
		timing_waitclock[i] = (guint)GTK_ADJUSTMENT(timing_waitclock_adj[i])->value;
		if (np2cfg.wait[i * 2] != timing_waitclock[i]) {
			np2cfg.wait[i * 2] = timing_waitclock[i];
			np2cfg.wait[i * 2 + 1] = 1;
			renewal = TRUE;
		}
	}
	if (np2cfg.realpal != timing_realpal) {
		np2cfg.realpal = timing_realpal;
		renewal = TRUE;
	}

	if (renewal) {
		sysmng_update(SYS_UPDATECFG);
	}

	gtk_widget_destroy((GtkWidget *)d);
}
Exemplo n.º 3
0
void dialog_scropt(void) {

	DialogPtr		hDlg;
	ControlHandle	chipbtn[2];
	ControlHandle	grcgbtn[4];
	ControlHandle	lcdbtn[2];
	ControlHandle	skipbtn;
	ControlHandle	c16btn;
	UINT			chip;
	UINT			grcg;
	UINT			color16;
	UINT			lcd;
	UINT			skipline;
	UINT			val;
	char			work[32];
	Str255			workstr;
	int				done;
	short			item;
	UINT			update;
	UINT			renewal;
	BYTE			waitval[6];

	hDlg = GetNewDialog(IDD_SCREENOPT, NULL, (WindowPtr)-1);
	if (!hDlg) {
		return;
	}
	chipbtn[0] = (ControlHandle)GetDlgItem(hDlg, IDC_GDC7220);
	chipbtn[1] = (ControlHandle)GetDlgItem(hDlg, IDC_GDC72020);

	grcgbtn[0] = (ControlHandle)GetDlgItem(hDlg, IDC_GRCGNON);
	grcgbtn[1] = (ControlHandle)GetDlgItem(hDlg, IDC_GRCG);
	grcgbtn[2] = (ControlHandle)GetDlgItem(hDlg, IDC_GRCG2);
	grcgbtn[3] = (ControlHandle)GetDlgItem(hDlg, IDC_EGC);

	c16btn = (ControlHandle)GetDlgItem(hDlg, IDC_PC980124);

	lcdbtn[0] = (ControlHandle)GetDlgItem(hDlg, IDC_LCD);
	lcdbtn[1] = (ControlHandle)GetDlgItem(hDlg, IDC_LCDX);
	skipbtn = (ControlHandle)GetDlgItem(hDlg, IDC_SKIPLINE);

	chip = (np2cfg.uPD72020)?1:0;
	setchip(chipbtn, chip);
	grcg = np2cfg.grcg & 3;
	setgrcg(grcgbtn, grcg);
	color16 = (np2cfg.color16)?1:0;
	SetControlValue(c16btn, color16);

	val = np2cfg.wait[0];
	if (val > 32) {
		val = 32;
	}
	SPRINTF(work, str_u, val);
	mkstr255(workstr, work);
	SetDialogItemText(GetDlgItem(hDlg, IDC_TRAMWAIT), workstr);
	val = np2cfg.wait[2];
	if (val > 32) {
		val = 32;
	}
	SPRINTF(work, str_u, val);
	mkstr255(workstr, work);
	SetDialogItemText(GetDlgItem(hDlg, IDC_VRAMWAIT), workstr);
	val = np2cfg.wait[4];
	if (val > 32) {
		val = 32;
	}
	SPRINTF(work, str_u, val);
	mkstr255(workstr, work);
	SetDialogItemText(GetDlgItem(hDlg, IDC_GRCGWAIT), workstr);
	val = np2cfg.realpal;
	if (val > 64) {
		val = 64;
	}
	SPRINTF(work, str_d, val - 32);
	mkstr255(workstr, work);
	SetDialogItemText(GetDlgItem(hDlg, IDC_REALPAL), workstr);

	lcd = np2cfg.LCD_MODE & 3;
	SetControlValue(lcdbtn[0], lcd & 1);
	SetControlValue(lcdbtn[1], (lcd & 2) >> 1);
	skipline = (np2cfg.skipline)?1:0;
	SetControlValue(skipbtn, skipline);
	SPRINTF(work, str_u, np2cfg.skiplight);
	mkstr255(workstr, work);
	SetDialogItemText(GetDlgItem(hDlg, IDC_SKIPLIGHT), workstr);

	SetDialogDefaultItem(hDlg, IDOK);
	SetDialogCancelItem(hDlg, IDCANCEL);

	done = 0;
	while(!done) {
		ModalDialog(NULL, &item);
		switch(item) {
			case IDOK:
				update = 0;
				if (np2cfg.uPD72020 != chip) {
					np2cfg.uPD72020 = chip;
					update |= SYS_UPDATECFG;
					gdc_restorekacmode();
					gdcs.grphdisp |= GDCSCRN_ALLDRAW2;
				}
				if (np2cfg.grcg != grcg) {
					np2cfg.grcg = grcg;
					update |= SYS_UPDATECFG;
					gdcs.grphdisp |= GDCSCRN_ALLDRAW2;
				}
				if (np2cfg.color16 != color16) {
					np2cfg.color16 = color16;
					update |= SYS_UPDATECFG;
				}

				GetDialogItemText(GetDlgItem(hDlg, IDC_TRAMWAIT), workstr);
				mkcstr(work, sizeof(work), workstr);
				val = milstr_solveINT(work);
				if (val > 32) {
					val = 32;
				}
				waitval[0] = val;
				waitval[1] = (val)?1:0;
				GetDialogItemText(GetDlgItem(hDlg, IDC_VRAMWAIT), workstr);
				mkcstr(work, sizeof(work), workstr);
				val = milstr_solveINT(work);
				if (val > 32) {
					val = 32;
				}
				waitval[2] = val;
				waitval[3] = (val)?1:0;
				GetDialogItemText(GetDlgItem(hDlg, IDC_GRCGWAIT), workstr);
				mkcstr(work, sizeof(work), workstr);
				val = milstr_solveINT(work);
				if (val > 32) {
					val = 32;
				}
				waitval[4] = val;
				waitval[5] = (val)?1:0;
				if (memcmp(np2cfg.wait, waitval, 6)) {
					CopyMemory(np2cfg.wait, waitval, 6);
					update |= SYS_UPDATECFG;
				}
				GetDialogItemText(GetDlgItem(hDlg, IDC_REALPAL), workstr);
				mkcstr(work, sizeof(work), workstr);
				val = milstr_solveINT(work) + 32;
				if (val > 64) {
					val = 64;
				}
				if (np2cfg.realpal != val) {
					np2cfg.realpal = val;
					update |= SYS_UPDATECFG;
				}

				renewal = 0;
				if (np2cfg.skipline != skipline) {
					np2cfg.skipline = skipline;
					renewal = 1;
				}
				GetDialogItemText(GetDlgItem(hDlg, IDC_SKIPLIGHT), workstr);
				mkcstr(work, sizeof(work), workstr);
				val = milstr_solveINT(work);
				if (val > 255) {
					val = 255;
				}
				if (np2cfg.skiplight != val) {
					np2cfg.skiplight = val;
					renewal = 1;
				}
				if (renewal) {
					pal_makeskiptable();
				}
				if (np2cfg.LCD_MODE != lcd) {
					np2cfg.LCD_MODE = lcd;
					pal_makelcdpal();
					renewal = 1;
				}
				if (renewal) {
					update |= SYS_UPDATECFG;
					scrndraw_redraw();
				}

				sysmng_update(update);
				done = IDOK;
				break;

			case IDCANCEL:
				done = IDCANCEL;
				break;

			case IDC_LCD:
				lcd ^= 1;
				SetControlValue(lcdbtn[0], lcd & 1);
				break;

			case IDC_LCDX:
				lcd ^= 2;
				SetControlValue(lcdbtn[1], (lcd & 2) >> 1);
				break;

			case IDC_SKIPLINE:
				skipline ^= 1;
				SetControlValue(skipbtn, skipline);
				break;

			case IDC_GDC7220:
				chip = 0;
				setchip(chipbtn, chip);
				break;

			case IDC_GDC72020:
				chip = 1;
				setchip(chipbtn, chip);
				break;

			case IDC_GRCGNON:
				grcg = 0;
				setgrcg(grcgbtn, grcg);
				break;

			case IDC_GRCG:
				grcg = 1;
				setgrcg(grcgbtn, grcg);
				break;

			case IDC_GRCG2:
				grcg = 2;
				setgrcg(grcgbtn, grcg);
				break;

			case IDC_EGC:
				grcg = 3;
				setgrcg(grcgbtn, grcg);
				break;

			case IDC_PC980124:
				color16 ^= 1;
				SetControlValue(c16btn, color16);
				break;
		}
	}
	DisposeDialog(hDlg);
}
Exemplo n.º 4
0
static LRESULT CALLBACK Scropt1DlgProc(HWND hWnd, UINT msg,
													WPARAM wp, LPARAM lp) {
	TCHAR	work[32];
	UINT16	ret;
	UINT8	b;
	int		renewal;

	switch(msg) {
		case WM_INITDIALOG:
			SetDlgItemCheck(hWnd, IDC_LCD, np2cfg.LCD_MODE & 1);
			EnableWindow(GetDlgItem(hWnd, IDC_LCDX), np2cfg.LCD_MODE & 1);
			SetDlgItemCheck(hWnd, IDC_LCDX, np2cfg.LCD_MODE & 2);

			SetDlgItemCheck(hWnd, IDC_SKIPLINE, np2cfg.skipline);
			SendDlgItemMessage(hWnd, IDC_SKIPLIGHT, TBM_SETRANGE, TRUE,
											MAKELONG(0, 255));
			SendDlgItemMessage(hWnd, IDC_SKIPLIGHT, TBM_SETPOS, TRUE,
											np2cfg.skiplight);
			wsprintf(work, str_d, np2cfg.skiplight);
			SetDlgItemText(hWnd, IDC_LIGHTSTR, work);
			return(TRUE);

		case WM_COMMAND:
			switch(LOWORD(wp)) {
				case IDC_LCD:
					EnableWindow(GetDlgItem(hWnd, IDC_LCDX),
											GetDlgItemCheck(hWnd, IDC_LCD));
					break;
			}
			break;

		case WM_HSCROLL:
			switch(GetDlgCtrlID((HWND)lp)) {
				case IDC_SKIPLIGHT:
					ret = (UINT16)SendDlgItemMessage(hWnd, IDC_SKIPLIGHT,
													TBM_GETPOS, 0, 0);
					wsprintf(work, str_d, ret);
					SetDlgItemText(hWnd, IDC_LIGHTSTR, work);
					break;
			}
			break;

		case WM_NOTIFY:
			if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) {
				renewal = 0;
				b = GetDlgItemCheck(hWnd, IDC_SKIPLINE);
				if (np2cfg.skipline != b) {
					np2cfg.skipline = b;
					renewal = 1;
				}
				ret = (UINT16)SendDlgItemMessage(hWnd, IDC_SKIPLIGHT,
															TBM_GETPOS, 0, 0);
				if (ret > 255) {
					ret = 255;
				}
				if (np2cfg.skiplight != ret) {
					np2cfg.skiplight = ret;
					renewal = 1;
				}
				if (renewal) {
					pal_makeskiptable();
				}
				b = GetDlgItemCheck(hWnd, IDC_LCD) |
					(GetDlgItemCheck(hWnd, IDC_LCDX) << 1);
				if (np2cfg.LCD_MODE != b) {
					np2cfg.LCD_MODE = b;
					pal_makelcdpal();
					renewal = 1;
				}
				if (renewal) {
					scrndraw_redraw();
					sysmng_update(SYS_UPDATECFG);
				}
				return(TRUE);
			}
			break;
	}
	return(FALSE);
}