Пример #1
0
static BOOL inireadcb(void *arg, const char *para,
										const char *key, const char *data) {

const INITBL	*p;

	if (arg == NULL) {
		return(FAILURE);
	}
	if (milstr_cmp(para, ((INIARG)arg)->title)) {
		return(SUCCESS);
	}
	p = ((INIARG)arg)->tbl;
	while(p < ((INIARG)arg)->tblterm) {
		if (!milstr_cmp(key, p->item)) {
			switch(p->itemtype) {
				case INITYPE_STR:
					milstr_ncpy((char *)p->value, data, p->size);
					break;

				case INITYPE_BOOL:
					*((BYTE *)p->value) = (!milstr_cmp(data, str_true))?1:0;
					break;

				case INITYPE_BYTEARG:
					inirdarg8((BYTE *)p->value, p->size, data);
					break;

				case INITYPE_SINT8:
				case INITYPE_UINT8:
					*((BYTE *)p->value) = (BYTE)milstr_solveINT(data);
					break;

				case INITYPE_SINT16:
				case INITYPE_UINT16:
					*((UINT16 *)p->value) = (UINT16)milstr_solveINT(data);
					break;

				case INITYPE_SINT32:
				case INITYPE_UINT32:
					*((UINT32 *)p->value) = (UINT32)milstr_solveINT(data);
					break;

				case INITYPE_HEX8:
					*((BYTE *)p->value) = (BYTE)milstr_solveHEX(data);
					break;

				case INITYPE_HEX16:
					*((UINT16 *)p->value) = (UINT16)milstr_solveHEX(data);
					break;

				case INITYPE_HEX32:
					*((UINT32 *)p->value) = (UINT32)milstr_solveHEX(data);
					break;
			}
		}
		p++;
	}
	return(SUCCESS);
}
Пример #2
0
BRESULT fdd_set(REG8 drv, const OEMCHAR *fname, UINT ftype, int ro) {

	FDDFILE		fdd;
	UINT		fddtype;
const OEMCHAR	*p;
	BRESULT		r;

	if (drv >= MAX_FDDFILE) {
		return(FAILURE);
	}
	fddtype = ftype;
	if (fddtype == FTYPE_NONE) {
		p = file_getext(fname);
		if ((!milstr_cmp(p, str_d88)) || (!milstr_cmp(p, str_88d)) ||
			(!milstr_cmp(p, str_d98)) || (!milstr_cmp(p, str_98d))) {
			fddtype = FTYPE_D88;
		}
		else if (!milstr_cmp(p, str_fdi)) {
			fddtype = FTYPE_FDI;
		}
		else {
			fddtype = FTYPE_BETA;
		}
	}
	fdd = fddfile + drv;
	switch(fddtype) {
		case FTYPE_FDI:
			r = fddxdf_setfdi(fdd, fname, ro);
			if (r == SUCCESS) {
				break;
			}
			/* FALLTHROUGH */

		case FTYPE_BETA:
			r = fddxdf_set(fdd, fname, ro);
			break;

		case FTYPE_D88:
			r = fddd88_set(fdd, fname, ro);
			break;

		default:
			r = FAILURE;
	}
	if (r == SUCCESS) {
		file_cpyname(fdd->fname, fname, NELEMENTS(fdd->fname));
		fdd->ftype = ftype;
		fdd->ro = ro;
	}
	return(FAILURE);
}
Пример #3
0
static void dlginit(void) {

	MENUID	id;

	menudlg_appends(res_cfg, NELEMENTS(res_cfg));
	if (np2cfg.baseclock < ((PCBASECLOCK25 + PCBASECLOCK20) / 2)) {
		id = DID_CLOCK1;
	}
	else {
		id = DID_CLOCK2;
	}
	menudlg_setval(id, 1);
	menudlg_setval(DID_MULTIPLE, np2cfg.multiple);

	if (!milstr_cmp(np2cfg.model, str_VM)) {
		id = DID_MODELVM;
	}
	else if (!milstr_cmp(np2cfg.model, str_EPSON)) {
		id = DID_MODELEPSON;
	}
	else {
		id = DID_MODELVX;
	}
	menudlg_setval(id, 1);

	if (np2cfg.samplingrate < ((11025 + 22050) / 2)) {
		id = DID_RATE11;
	}
	else if (np2cfg.samplingrate < ((22050 + 44100) / 2)) {
		id = DID_RATE22;
	}
	else {
		id = DID_RATE44;
	}
	menudlg_setval(id, 1);
	menudlg_setval(DID_BUFFER, np2cfg.delayms);

	menudlg_setval(DID_RESUME, np2oscfg.resume);

	setmulstr();
	setclockstr();
	setbufstr();

#if defined(DISABLE_SOUND)
	menudlg_setenable(DID_RATE11, FALSE);
	menudlg_setenable(DID_RATE22, FALSE);
	menudlg_setenable(DID_RATE44, FALSE);
	menudlg_setenable(DID_BUFFER, FALSE);
#endif
}
Пример #4
0
static void
inirdinterp(const char *src, INITBL *ini)
{

	if (!milstr_cmp(src, "NEAREST")) {
		*(UINT8 *)ini->value = INTERP_NEAREST;
	} else if (!milstr_cmp(src, "TILES")) {
		*(UINT8 *)ini->value = INTERP_TILES;
	} else if (!milstr_cmp(src, "HYPER")) {
		*(UINT8 *)ini->value = INTERP_HYPER;
	} else {
		*(UINT8 *)ini->value = INTERP_BILINEAR;
	}
}
Пример #5
0
static BRESULT opencue(SXSIDEV sxsi, const OEMCHAR *fname) {

	_CDTRK		trk[99];
	OEMCHAR		path[MAX_PATH];
	UINT		idx;
	UINT8		curtrk;
	UINT		curtype;
	TEXTFILEH	tfh;
	OEMCHAR		buf[512];
	OEMCHAR		*argv[8];
	int			argc;

	ZeroMemory(trk, sizeof(trk));
	path[0] = '\0';
	idx = 0;
	curtrk = 1;
	curtype = 0x14;
	tfh = textfile_open(fname, 0x800);
	if (tfh == NULL) {
		return(FAILURE);
	}
	while(textfile_read(tfh, buf, NELEMENTS(buf)) == SUCCESS) {
		argc = milstr_getarg(buf, argv, NELEMENTS(argv));
		if ((argc >= 3) && (!milstr_cmp(argv[0], str_file))) {
			file_cpyname(path, fname, NELEMENTS(path));
			file_cutname(path);
			file_catname(path, argv[1], NELEMENTS(path));
		}
		else if ((argc >= 3) && (!milstr_cmp(argv[0], str_track))) {
			curtrk = (UINT8)milstr_solveINT(argv[1]);
			if (!milstr_cmp(argv[2], str_mode1)) {
				curtype = 0x14;
			}
			else if (!milstr_cmp(argv[2], str_audio)) {
				curtype = 0x10;
			}
		}
		else if ((argc >= 3) && (!milstr_cmp(argv[0], str_index))) {
			if (idx < NELEMENTS(trk)) {
				trk[idx].type = curtype;
				trk[idx].track = curtrk;
				trk[idx].pos = getpos(argv[2]);
				idx++;
			}
		}
	}
	textfile_close(tfh);
	return(openimg(sxsi, path, trk, idx));
}
Пример #6
0
/**
 * キーボード設定を読み込む
 * @param[in] lpString 文字列
 * @param[out] ini 設定テーブル
 */
static void inirdkb(LPCTSTR lpString, const PFTBL* ini)
{
	if ((!milstr_extendcmp(lpString, TEXT("PC98"))) || (!milstr_cmp(lpString, TEXT("98"))))
	{
		*(static_cast<UINT8*>(ini->value)) = KEY_PC98;
	}
	else if ((!milstr_extendcmp(lpString, TEXT("DOS"))) || (!milstr_cmp(lpString, TEXT("PCAT"))) || (!milstr_cmp(lpString, TEXT("AT"))))
	{
		*(static_cast<UINT8*>(ini->value)) = KEY_KEY106;
	}
	else if ((!milstr_extendcmp(lpString, TEXT("KEY101"))) || (!milstr_cmp(lpString, TEXT("101"))))
	{
		*(static_cast<UINT8*>(ini->value)) = KEY_KEY101;
	}
}
Пример #7
0
static void inirdkb(const OEMCHAR *src, const PFTBL *ini) {

	if ((!milstr_extendcmp(src, OEMTEXT("PC98"))) ||
		(!milstr_cmp(src, OEMTEXT("98")))) {
		*(UINT8 *)ini->value = KEY_PC98;
	}
	else if ((!milstr_extendcmp(src, OEMTEXT("DOS"))) ||
			(!milstr_cmp(src, OEMTEXT("PCAT"))) ||
			(!milstr_cmp(src, OEMTEXT("AT")))) {
		*(UINT8 *)ini->value = KEY_KEY106;
	}
	else if ((!milstr_extendcmp(src, OEMTEXT("KEY101"))) ||
			(!milstr_cmp(src, OEMTEXT("101")))) {
		*(UINT8 *)ini->value = KEY_KEY101;
	}
}
Пример #8
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);
}
Пример #9
0
static void cfgcreate(HWND hWnd) {

	TCHAR	work[32];
	UINT	val;

	SETLISTSTR(hWnd, IDC_BASECLOCK, basecstr);
	if (np2cfg.baseclock < AVE(PCBASECLOCK25, PCBASECLOCK20)) {
		val = 0;
	}
	else {
		val = 1;
	}
	SendDlgItemMessage(hWnd, IDC_BASECLOCK, CB_SETCURSEL, val, 0);
	SETLISTUINT32(hWnd, IDC_MULTIPLE, mulval);
	wsprintf(work, str_u, np2cfg.multiple);
	SetDlgItemText(hWnd, IDC_MULTIPLE, work);

	if (!milstr_cmp(np2cfg.model, str_VM)) {
		val = IDC_MODELVM;
	}
	else if (!milstr_cmp(np2cfg.model, str_EPSON)) {
		val = IDC_MODELEPSON;
	}
	else {
		val = IDC_MODELVX;
	}
	SetDlgItemCheck(hWnd, val, TRUE);

	if (np2cfg.samplingrate < AVE(11025, 22050)) {
		val = IDC_RATE11;
	}
	else if (np2cfg.samplingrate < AVE(22050, 44100)) {
		val = IDC_RATE22;
	}
	else {
		val = IDC_RATE44;
	}
	SetDlgItemCheck(hWnd, val, TRUE);
	wsprintf(work, str_u, np2cfg.delayms);
	SetDlgItemText(hWnd, IDC_SOUNDBUF, work);

	setclock(hWnd, 0);
	SetFocus(GetDlgItem(hWnd, IDC_BASECLOCK));
}
Пример #10
0
static BRESULT getmidiinid(const OEMCHAR *midiin, UINT *ret) {

	UINT		num;
	UINT		i;
	MIDIINCAPS	moc;

	num = midiInGetNumDevs();
	for (i=0; i<num; i++) {
		if ((midiInGetDevCaps(i, &moc, sizeof(moc)) == MMSYSERR_NOERROR) &&
			(!milstr_cmp(midiin, moc.szPname))) {
			*ret = i;
			return(SUCCESS);
		}
	}
	if (!milstr_cmp(midiin, cmmidi_midimapper)) {
		*ret = MIDI_MAPPER;
		return(SUCCESS);
	}
	return(FAILURE);
}
Пример #11
0
static void
inirdkb(const char *src, INITBL *ini)
{

	if ((!milstr_extendcmp(src, "DOS"))
	 || (!milstr_cmp(src, "JIS"))
	 || (!milstr_cmp(src, "106"))
	 || (!milstr_cmp(src, "JP"))
	 || (!milstr_cmp(src, "PCAT"))
	 || (!milstr_cmp(src, "AT"))) {
		*(UINT8 *)ini->value = KEY_KEY106;
	} else if ((!milstr_extendcmp(src, "KEY101"))
	        || (!milstr_cmp(src, "ASCII"))
	        || (!milstr_cmp(src, "EN"))
	        || (!milstr_cmp(src, "US"))
	        || (!milstr_cmp(src, "101"))) {
		*(UINT8 *)ini->value = KEY_KEY101;
	}
}
Пример #12
0
static int
getmidiout(const char *midiout)
{
	int hmidiout = -1;

	if (midiout && midiout[0] != '\0') {
		if ((!milstr_cmp(midiout, cmmidi_midiout_device))
		 && (np2oscfg.MIDIDEV[0][0] != '\0')) {
			hmidiout = open(np2oscfg.MIDIDEV[0], O_WRONLY | O_NONBLOCK);
			if (hmidiout < 0) {
				perror("getmidiout");
			}
		}
	}
	return hmidiout;
}
Пример #13
0
static int
getmidiin(const char *midiin)
{
	int hmidiin = -1;

	if (midiin && midiin[0] != '\0') {
		if ((!milstr_cmp(midiin, cmmidi_midiin_device))
		 && (np2oscfg.MIDIDEV[1][0] != '\0')) {
			hmidiin = open(np2oscfg.MIDIDEV[1], O_RDONLY | O_NONBLOCK);
			if (hmidiin < 0) {
				perror("getmidiin");
			}
		}
	}
	return hmidiin;
}
Пример #14
0
COMMNG cmmidi_create(const OEMCHAR *midiout, const OEMCHAR *midiin,
													const OEMCHAR *module) {

	UINT		opened;
	UINT		id;
	void		(*shortout)(CMMIDI self, UINT32 msg);
	void		(*longout)(CMMIDI self, const UINT8 *msg, UINT leng);
	HMIDIFNOUT	out;
	HMIDIIN		hmidiin = NULL;
	COMMNG		ret;
	CMMIDI		midi;

	opened = 0;
	ZeroMemory(&out, sizeof(out));
	shortout = midi_ncshort;
	longout = midi_nclong;
	if (getmidioutid(midiout, &id) == SUCCESS) {
		if (midiOutOpen(&out.win32.hmidiout, id, 0, 0, CALLBACK_NULL)
														== MMSYSERR_NOERROR) {
			midiOutReset(out.win32.hmidiout);
			shortout = midi_win32short;
			longout = midi_win32long;
			opened |= CMMIDI_MIDIOUT;
		}
	}
	if (getmidiinid(midiin, &id) == SUCCESS) {
		if (midiInOpen(&hmidiin, id, (DWORD)g_hWndMain, 0, CALLBACK_WINDOW)
														== MMSYSERR_NOERROR) {
			midiInReset(hmidiin);
			opened |= CMMIDI_MIDIIN;
		}
	}
#if defined(VERMOUTH_LIB)
	else if (!milstr_cmp(midiout, cmmidi_vermouth)) {
		out.vermouth = midiout_create(vermouth_module, 512);
		if (out.vermouth != NULL) {
			shortout = midi_vermouthshort;
			longout = midi_vermouthlong;
			opened |= CMMIDI_VERMOUTH;
		}
	}
#endif
#if defined(MT32SOUND_DLL)
	else if (!milstr_cmp(midiout, cmmidi_mt32sound)) {
		if (mt32sound_open() == SUCCESS) {
			shortout = midi_mt32short;
			longout = midi_mt32long;
			opened |= CMMIDI_MT32SOUND;
		}
	}
#endif
	if (!opened) {
		goto cmcre_err1;
	}
	ret = (COMMNG)_MALLOC(sizeof(_COMMNG) + sizeof(_CMMIDI), "MIDI");
	if (ret == NULL) {
		goto cmcre_err2;
	}
	ret->connect = COMCONNECT_MIDI;
	ret->read = midiread;
	ret->write = midiwrite;
	ret->getstat = midigetstat;
	ret->msg = midimsg;
	ret->release = midirelease;
	midi = (CMMIDI)(ret + 1);
	ZeroMemory(midi, sizeof(_CMMIDI));
	midi->opened = opened;
	midi->shortout = shortout;
	midi->longout = longout;
	midi->out = out;
	midi->midictrl = MIDICTRL_READY;
#if 1
	midi->hmidiin = hmidiin;
	if (opened & CMMIDI_MIDIIN) {
		if (midiinhdlreg(midi, hmidiin) == SUCCESS) {
			midi->opened |= CMMIDI_MIDIINSTART;
			midi->hmidiinhdr.lpData = (char *)midi->midiinbuf;
			midi->hmidiinhdr.dwBufferLength = MIDI_BUFFER;
			midiInPrepareHeader(hmidiin, &midi->hmidiinhdr, sizeof(MIDIHDR));
			midiInAddBuffer(hmidiin, &midi->hmidiinhdr, sizeof(MIDIHDR));
			midiInStart(hmidiin);
		}
	}
#endif
#if defined(VERMOUTH_LIB)
	if (opened & CMMIDI_VERMOUTH) {
		sound_streamregist((void *)out.vermouth, (SOUNDCB)vermouth_getpcm);
	}
#endif
#if defined(MT32SOUND_DLL)
	if (opened & CMMIDI_MT32SOUND) {
		sound_streamregist(NULL, (SOUNDCB)mt32_getpcm);
	}
#endif
//	midi->midisyscnt = 0;
//	midi->mpos = 0;

	midi->midilast = 0x80;
//	midi->midiexcvwait = 0;
	midi->midimodule = (UINT8)module2number(module);
	FillMemory(midi->mch, sizeof(midi->mch), 0xff);
	return(ret);

cmcre_err2:
	if (opened & CMMIDI_MIDIOUT) {
		midiOutReset(out.win32.hmidiout);
		midiOutClose(out.win32.hmidiout);
	}
#if defined(VERMOUTH_LIB)
	if (opened & CMMIDI_VERMOUTH) {
		midiout_destroy(out.vermouth);
	}
#endif
#if defined(MT32SOUND_DLL)
	if (opened & CMMIDI_MT32SOUND) {
		mt32sound_close();
	}
#endif

cmcre_err1:
	return(NULL);
}
Пример #15
0
void ini_read(const OEMCHAR *path, const OEMCHAR *title,
											const PFTBL *tbl, UINT count) {

const PFTBL	*p;
const PFTBL	*pterm;
	OEMCHAR	work[512];
	UINT32	val;

	p = tbl;
	pterm = tbl + count;
	while(p < pterm) {
		switch(p->itemtype & PFTYPE_MASK) {
			case PFTYPE_STR:
				GetPrivateProfileString(title, p->item, (OEMCHAR *)p->value,
											(OEMCHAR *)p->value, p->arg, path);
				break;

			case PFTYPE_BOOL:
				GetPrivateProfileString(title, p->item,
									(*((UINT8 *)p->value))?str_true:str_false,
												work, NELEMENTS(work), path);
				*((UINT8 *)p->value) = (!milstr_cmp(work, str_true))?1:0;
				break;

			case PFTYPE_BITMAP:
				GetPrivateProfileString(title, p->item,
					(bitmapget((UINT8 *)p->value, p->arg))?str_true:str_false,
												work, NELEMENTS(work), path);
				bitmapset((UINT8 *)p->value, p->arg,
										(milstr_cmp(work, str_true) == 0));
				break;

			case PFTYPE_BIN:
				GetPrivateProfileString(title, p->item, str_null,
												work, NELEMENTS(work), path);
				binset((UINT8 *)p->value, p->arg, work);
				break;

			case PFTYPE_SINT8:
			case PFTYPE_UINT8:
				val = (UINT8)GetPrivateProfileInt(title, p->item,
												*(UINT8 *)p->value, path);
				*(UINT8 *)p->value = (UINT8)val;
				break;

			case PFTYPE_SINT16:
			case PFTYPE_UINT16:
				val = (UINT16)GetPrivateProfileInt(title, p->item,
												*(UINT16 *)p->value, path);
				*(UINT16 *)p->value = (UINT16)val;
				break;

			case PFTYPE_SINT32:
			case PFTYPE_UINT32:
				val = (UINT32)GetPrivateProfileInt(title, p->item,
												*(UINT32 *)p->value, path);
				*(UINT32 *)p->value = (UINT32)val;
				break;

			case PFTYPE_HEX8:
				OEMSPRINTF(work, str_x, *(UINT8 *)p->value),
				GetPrivateProfileString(title, p->item, work,
												work, NELEMENTS(work), path);
				val = (UINT8)milstr_solveHEX(work);
				*(UINT8 *)p->value = (UINT8)val;
				break;

			case PFTYPE_HEX16:
				OEMSPRINTF(work, str_x, *(UINT16 *)p->value),
				GetPrivateProfileString(title, p->item, work,
												work, NELEMENTS(work), path);
				val = (UINT16)milstr_solveHEX(work);
				*(UINT16 *)p->value = (UINT16)val;
				break;

			case PFTYPE_HEX32:
				OEMSPRINTF(work, str_x, *(UINT32 *)p->value),
				GetPrivateProfileString(title, p->item, work,
												work, NELEMENTS(work), path);
				val = (UINT32)milstr_solveHEX(work);
				*(UINT32 *)p->value = (UINT32)val;
				break;

			case PFTYPE_ARGS16:
				GetPrivateProfileString(title, p->item, str_null,
												work, NELEMENTS(work), path);
				inirdargs16(work, p);
				break;

			case PFTYPE_BYTE3:
				GetPrivateProfileString(title, p->item, str_null,
												work, NELEMENTS(work), path);
				inirdbyte3(work, p);
				break;

			case PFTYPE_KB:
				GetPrivateProfileString(title, p->item, str_null,
												work, NELEMENTS(work), path);
				inirdkb(work, p);
				break;
		}
		p++;
	}
}
Пример #16
0
static void cfgupdate(HWND hWnd) {

	UINT	update;
	TCHAR	work[32];
	UINT	val;
const TCHAR	*str;

	update = 0;
	GetDlgItemText(hWnd, IDC_BASECLOCK, work, NELEMENTS(work));
	if (work[0] == '1') {
		val = PCBASECLOCK20;
	}
	else {
		val = PCBASECLOCK25;
	}
	if (np2cfg.baseclock != val) {
		np2cfg.baseclock = val;
		update |= SYS_UPDATECFG | SYS_UPDATECLOCK;
	}

	GetDlgItemText(hWnd, IDC_MULTIPLE, work, NELEMENTS(work));
	val = (UINT)milstr_solveINT(work);
	if (val < 1) {
		val = 1;
	}
	else if (val > 32) {
		val = 32;
	}
	if (np2cfg.multiple != val) {
		np2cfg.multiple = val;
		update |= SYS_UPDATECFG | SYS_UPDATECLOCK;
	}

	if (GetDlgItemCheck(hWnd, IDC_MODELVM)) {
		str = str_VM;
	}
	else if (GetDlgItemCheck(hWnd, IDC_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 (GetDlgItemCheck(hWnd, IDC_RATE11)) {
		val = 11025;
	}
	else if (GetDlgItemCheck(hWnd, IDC_RATE22)) {
		val = 22050;
	}
	else {
		val = 44100;
	}
	if (np2cfg.samplingrate != (UINT16)val) {
		np2cfg.samplingrate = (UINT16)val;
		update |= SYS_UPDATECFG | SYS_UPDATERATE;
		soundrenewal = 1;
	}

	GetDlgItemText(hWnd, IDC_SOUNDBUF, work, NELEMENTS(work));
	val = (UINT)milstr_solveINT(work);
	if (val < 40) {
		val = 40;
	}
	else if (val > 1000) {
		val = 1000;
	}
	if (np2cfg.delayms != (UINT16)val) {
		np2cfg.delayms = (UINT16)val;
		update |= SYS_UPDATECFG | SYS_UPDATESBUF;
		soundrenewal = 1;
	}

	sysmng_update(update);
}
Пример #17
0
CCFILEH ccfile_open(const char *fname) {
  
	CCFILEH ret;
	CCFILEH cc;
	CCFILEH stc;
	int fd;

	ret = NULL;
	stc = NULL;
	cc = fh;

	for (int i=0; i<DATACACHES; ++i) {
		if (!milstr_cmp(cc->name, fname)) {
			ret = cc;
			break;
		}
		cc++;
	}

	if (ret == NULL) {

		stc = (CCFILEH)&fh[stc_index++];
		stc_index &= (DATACACHES-1);
	}

	if ((ret == NULL) && (stc != NULL)) {

		fd = open(fname,O_RDONLY);
		if (fd < 0) {
			goto cc_err1;
		}
		stc->size = file_size(fd);

		file_cpyname(stc->name, fname, MAX_PATH);

		if (stc->size > DATACACHESIZE) {
			goto cc_err2;
		}

		soundmng_stop();
	  
		long pos = 0;
		unsigned int size = stc->size;
		unsigned int len = size/256;

    
		ZeroMemory(stc->ptr, DATACACHESIZE);

		int n = 0;
		while (size > 0) {
			int r = pread(fd, stc->ptr + pos, len, pos);
			display_progress(n, 256);
			++n;
			pos += r;
			size -= r;
		}

		soundmng_play();
    
		close(fd);

		uLong adler;
		adler = adler32(0L, Z_NULL, 0);
		stc->id = adler32(adler, stc->ptr, stc->size);

		loadSaveDatafromVmu(stc->id);

		patchSaveData(stc->id, stc->ptr);

		ret = stc;
	}
  
	ret->pos = 0;
  
	return ret;
  
cc_err2:
	close(fd);
  
cc_err1:
	return NULL;
}
Пример #18
0
int SDL_main(int argc, char **argv) {

	int		pos;
	char	*p;
	int		id;

	pos = 1;
	while(pos < argc) {
		p = argv[pos++];
		if ((!milstr_cmp(p, "-h")) || (!milstr_cmp(p, "--help"))) {
			usage(argv[0]);
			goto np2main_err1;
		}
		else {
			printf("error command: %s\n", p);
			goto np2main_err1;
		}
	}

	dosio_init();
	file_setcd(datadir);
	initload();

	TRACEINIT();

	if (fontmng_init() != SUCCESS) {
		goto np2main_err2;
	}
	inputmng_init();
	keystat_initialize();

	if (sysmenu_create() != SUCCESS) {
		goto np2main_err3;
	}

	mousemng_initialize();

	scrnmng_initialize();
	if (scrnmng_create(FULLSCREEN_WIDTH, FULLSCREEN_HEIGHT) != SUCCESS) {
		goto np2main_err4;
	}

	sdlkbd_initialize();  // this must be after SDL_VIDEO initialized

	soundmng_initialize();
	commng_initialize();
	sysmng_initialize();
	taskmng_initialize();
	pccore_init();
	S98_init();

	mousemng_hidecursor();
	scrndraw_redraw();
	pccore_reset();

	if (np2oscfg.resume) {
		id = flagload(str_sav, str_resume, FALSE);
		if (id == DID_CANCEL) {
			goto np2main_err5;
		}
	}

	while(taskmng_isavail()) {
		taskmng_rol();
		if (np2oscfg.NOWAIT) {
			pccore_exec(framecnt == 0);
			if (np2oscfg.DRAW_SKIP) {			// nowait frame skip
				framecnt++;
				if (framecnt >= np2oscfg.DRAW_SKIP) {
					processwait(0);
				}
			}
			else {							// nowait auto skip
				framecnt = 1;
				if (timing_getcount()) {
					processwait(0);
				}
			}
		}
		else if (np2oscfg.DRAW_SKIP) {		// frame skip
			if (framecnt < np2oscfg.DRAW_SKIP) {
				pccore_exec(framecnt == 0);
				framecnt++;
			}
			else {
				processwait(np2oscfg.DRAW_SKIP);
			}
		}
		else {								// auto skip
			if (!waitcnt) {
				UINT cnt;
				pccore_exec(framecnt == 0);
				framecnt++;
				cnt = timing_getcount();
				if (framecnt > cnt) {
					waitcnt = framecnt;
					if (framemax > 1) {
						framemax--;
					}
				}
				else if (framecnt >= framemax) {
					if (framemax < 12) {
						framemax++;
					}
					if (cnt >= 12) {
						timing_reset();
					}
					else {
						timing_setcount(cnt - framecnt);
					}
					framereset(0);
				}
			}
			else {
				processwait(waitcnt);
				waitcnt = framecnt;
			}
		}
	}

	pccore_cfgupdate();
	if (np2oscfg.resume) {
		flagsave(str_sav);
	}
	else {
		flagdelete(str_sav);
	}
	pccore_term();
	S98_trash();
	soundmng_deinitialize();

	if (sys_updates	& (SYS_UPDATECFG | SYS_UPDATEOSCFG)) {
		initsave();
	}

	scrnmng_destroy();
	sysmenu_destroy();
	TRACETERM();
	SDL_Quit();
	dosio_term();
	return(SUCCESS);

np2main_err5:
	pccore_term();
	S98_trash();
	soundmng_deinitialize();

np2main_err4:
	scrnmng_destroy();

np2main_err3:
	sysmenu_destroy();

np2main_err2:
	TRACETERM();
	SDL_Quit();
	dosio_term();

np2main_err1:
	return(FAILURE);
}
Пример #19
0
static BRESULT
inireadcb(void *arg, const char *para, const char *key, const char *data)
{
	char work[512];
	INITBL *p;
	BOOL rv;

	if (arg == NULL) {
		return(FAILURE);
	}
	if (milstr_cmp(para, ((INIARG)arg)->title)) {
		return(SUCCESS);
	}
	p = ((INIARG)arg)->tbl;
	while (p < ((INIARG)arg)->tblterm) {
		if (!milstr_cmp(key, p->item)) {
			rv = TRUE;
			switch (p->itemtype & INITYPE_MASK) {
			case INITYPE_STR:
				milstr_ncpy((char *)p->value, data, p->arg);
				break;

			case INITYPE_BOOL:
				*((UINT8 *)p->value) = (!milstr_cmp(data, str_true))?1:0;
				break;

			case INITYPE_BITMAP:
				inisetbmp((UINT8 *)p->value, p->arg, milstr_cmp(data, str_true) == 0);
				break;

			case INITYPE_ARGS16:
				milstr_ncpy(work, data, 512);
				inirdargs16(work, p);
				break;

			case INITYPE_ARGH8:
				milstr_ncpy(work, data, 512);
				inirdargh8(work, p);
				break;

			case INITYPE_SINT8:
			case INITYPE_UINT8:
				*((UINT8 *)p->value) = (UINT8)milstr_solveINT(data);
				break;

			case INITYPE_SINT16:
			case INITYPE_UINT16:
				*((UINT16 *)p->value) = (UINT16)milstr_solveINT(data);
				break;

			case INITYPE_SINT32:
			case INITYPE_UINT32:
				*((UINT32 *)p->value) = (UINT32)milstr_solveINT(data);
				break;

			case INITYPE_HEX8:
				*((UINT8 *)p->value) = (UINT8)milstr_solveHEX(data);
				break;

			case INITYPE_HEX16:
				*((UINT16 *)p->value) = (UINT16)milstr_solveHEX(data);
				break;

			case INITYPE_HEX32:
				*((UINT32 *)p->value) = (UINT32)milstr_solveHEX(data);
				break;

			case INITYPE_BYTE3:
				milstr_ncpy(work, data, 512);
				inirdbyte3(work, p);
				break;

			case INITYPE_KB:
				milstr_ncpy(work, data, 512);
				inirdkb(work, p);
				break;

			case INITYPE_SNDDRV:
				milstr_ncpy(work, data, 512);
				inirdsnddrv(work, p);
				break;

			case INITYPE_INTERP:
				milstr_ncpy(work, data, 512);
				inirdinterp(work, p);
				break;

			default:
				rv = FALSE;
				break;
			}
			if (rv) {
				update_iniread_flag(p);
			}
		}
		p++;
	}
	return (SUCCESS);
}
Пример #20
0
COMMNG
cmmidi_create(const char *midiout, const char *midiin, const char *module)
{
	COMMNG ret;
	CMMIDI midi;
	void (*outfn)(CMMIDI midi, UINT32 msg, UINT cnt);
	int hmidiout;
	int hmidiin;
#if defined(VERMOUTH_LIB)
	MIDIHDL vermouth = NULL;
#endif
	int opened = 0;

	/* MIDI-IN */
	hmidiin = getmidiin(midiin);
	if (hmidiin >= 0) {
		opened |= CMMIDI_MIDIIN;
	}

	/* MIDI-OUT */
	outfn = midiout_none;
	hmidiout = getmidiout(midiout);
	if (hmidiout >= 0) {
		outfn = midiout_device;
		opened |= CMMIDI_MIDIOUT;
	}
#if defined(VERMOUTH_LIB)
	else if (!milstr_cmp(midiout, cmmidi_vermouth)) {
		vermouth = midiout_create(vermouth_module, 512);
		if (vermouth != NULL) {
			outfn = midiout_vermouth;
			opened |= CMMIDI_VERMOUTH;
		}
	}
#endif
	if (!opened) {
		goto cmcre_err1;
	}
	ret = (COMMNG)_MALLOC(sizeof(_COMMNG) + sizeof(_CMMIDI), "MIDI");
	if (ret == NULL) {
		goto cmcre_err2;
	}
	ret->connect = COMCONNECT_MIDI;
	ret->read = midiread;
	ret->write = midiwrite;
	ret->getstat = midigetstat;
	ret->msg = midimsg;
	ret->release = midirelease;

	midi = (CMMIDI)(ret + 1);
	ZeroMemory(midi, sizeof(_CMMIDI));
	midi->opened = opened;
	midi->outfn = outfn;
	midi->midictrl = MIDICTRL_READY;
	midi->hmidiout = hmidiout;
	if (opened & CMMIDI_MIDIOUT) {
		gettimeofday(&midi->hmidiout_nextstart, NULL);
	}
#if defined(VERMOUTH_LIB)
	midi->vermouth = vermouth;
	if (opened & CMMIDI_VERMOUTH) {
		sound_streamregist((void *)vermouth, (SOUNDCB)vermouth_getpcm);
	}
#endif
	midi->midilast = 0x80;
	midi->midimodule = (UINT8)module2number(module);
	FillMemory(midi->mch, sizeof(midi->mch), 0xff);
	return ret;

cmcre_err2:
	if (opened & CMMIDI_MIDIIN) {
		if (hmidiin >= 0) {
			close(hmidiin);
		}
	}
	if (opened & CMMIDI_MIDIOUT) {
		if (hmidiout >= 0) {
			close(hmidiout);
		}
	}
#if defined(VERMOUTH_LIB)
	if (opened & CMMIDI_VERMOUTH) {
		midiout_destroy(vermouth);
	}
#endif
cmcre_err1:
	return NULL;
}
Пример #21
0
//	CUEシート読み込み
BRESULT opencue(SXSIDEV sxsi, const OEMCHAR *fname) {

	_CDTRK		trk[99];
	OEMCHAR		path[MAX_PATH];
	UINT		index;
	UINT8		curtrk;
	UINT		curtype;
	TEXTFILEH	tfh;
	OEMCHAR		buf_mode[10];
	OEMCHAR		buf[512];
	OEMCHAR		*argv[8];
	int			argc;
//	--------
	UINT16		curssize;
	UINT32		curpos0;
	UINT32		curpregap;

	ZeroMemory(trk, sizeof(trk));
	path[0] = '\0';
	index = 0;
	curtrk = 1;
	curtype = 0x14;
//	--------
	curpos0 = 0;
	curpregap = 0;
//	--------

	tfh = textfile_open(fname, 0x800);
	if (tfh == NULL) {
		goto opencue_err2;
	}
	while (textfile_read(tfh, buf, NELEMENTS(buf)) == SUCCESS) {
		argc = milstr_getarg(buf, argv, NELEMENTS(argv));
		if ((argc >= 3) && (!milstr_cmp(argv[0], str_file))) {				//	FILE
			if (!milstr_cmp(argv[argc-1], str_binary) && path[0] == '\0') {	//		BINARY
				file_cpyname(path, fname, NELEMENTS(path));
				file_cutname(path);
				file_catname(path, argv[1], NELEMENTS(path));
			}
		}
		else if ((argc >= 3) && (!milstr_cmp(argv[0], str_track))) {		//	TRACK
			curtrk = (UINT8)milstr_solveINT(argv[1]);
			milstr_ncpy(buf_mode, argv[2], NELEMENTS(str_mode1));
			if (!milstr_cmp(buf_mode, str_mode1)) {							//		MODE1/????
				curtype = 0x14;
				curssize = (UINT16)milstr_solveINT(argv[2] + 6);
			}
			else if (!milstr_cmp(buf_mode, str_mode2)) {					//		MODE2/????
				curtype = 0x14;
				curssize = (UINT16)milstr_solveINT(argv[2] + 6);
			}
			else if (!milstr_cmp(argv[2], str_audio)) {						//		AUDIO
				curtype = 0x10;
				curssize = 2352;
			}
		}
		else if ((argc >= 2) && (!milstr_cmp(argv[0], str_pregap))) {		//	PREGAP
			curpregap = getpos(argv[1]);
		}
		else if ((argc >= 3) && (!milstr_cmp(argv[0], str_index))) {		//	INDEX ??
			if (index < NELEMENTS(trk)) {
				if ((UINT8)milstr_solveINT(argv[1]) == 0) {					//	INDEX 00
					curpos0 = getpos(argv[2]);
					continue;
				}
				if ((UINT8)milstr_solveINT(argv[1]) != 1) {					//	INDEX 01以外
					continue;
				}

				trk[index].adr_ctl			= curtype;
				trk[index].point			= curtrk;
				trk[index].pos				= getpos(argv[2]);
				trk[index].pos0				= (curpos0 == 0) ? trk[index].pos : curpos0;

				trk[index].sector_size		= curssize;

				trk[index].pregap_sectors	= curpregap + (trk[index].pos - trk[index].pos0);

				trk[index].img_pregap_sec	= (trk[index].pos0 == 0) ? trk[index].pos : trk[index].pos0;
				trk[index].img_start_sec	= trk[index].pos;

//				trk[index].pregap_sector	= trk[index].start_sector - trk[index].pregap_sectors;

				index++;
				curpregap = 0;
				curpos0 = 0;
			}
		}
	}

	if (index == 0) {
		goto opencue_err1;
	}

	set_secread(sxsi, trk, index);
	sxsi->totals = -1;

	textfile_close(tfh);

	return(setsxsidev(sxsi, path, trk, index));

opencue_err1:
	textfile_close(tfh);

opencue_err2:
	return(FAILURE);
}
Пример #22
0
static void cfgupdate(HWND hWnd)
{
	UINT		update;
	TCHAR		work[32];
	UINT		val;
const OEMCHAR	*str;

	update = 0;

	val = dlgs_getcbcur(hWnd, IDC_BASECLOCK, PCBASECLOCK20);
	if (np2cfg.baseclock != val)
	{
		np2cfg.baseclock = val;
		update |= SYS_UPDATECFG | SYS_UPDATECLOCK;
	}

	GetDlgItemText(hWnd, IDC_MULTIPLE, work, sizeof(work));
	val = (UINT)miltchar_solveINT(work);
	if (val < 1) {
		val = 1;
	}
	else if (val > 32) {
		val = 32;
	}
	if (np2cfg.multiple != val) {
		np2cfg.multiple = val;
		update |= SYS_UPDATECFG | SYS_UPDATECLOCK;
	}

	if (GetDlgItemCheck(hWnd, IDC_MODELVM)) {
		str = str_VM;
	}
	else if (GetDlgItemCheck(hWnd, IDC_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 (GetDlgItemCheck(hWnd, IDC_RATE11)) {
		val = 11025;
	}
	else if (GetDlgItemCheck(hWnd, IDC_RATE22)) {
		val = 22050;
	}
	else {
		val = 44100;
	}
	if (np2cfg.samplingrate != (UINT16)val) {
		np2cfg.samplingrate = (UINT16)val;
		update |= SYS_UPDATECFG | SYS_UPDATERATE;
		soundrenewal = 1;
	}

	GetDlgItemText(hWnd, IDC_SOUNDBUF, work, NELEMENTS(work));
	val = (UINT)miltchar_solveINT(work);
	if (val < 40) {
		val = 40;
	}
	else if (val > 1000) {
		val = 1000;
	}
	if (np2cfg.delayms != (UINT16)val) {
		np2cfg.delayms = (UINT16)val;
		update |= SYS_UPDATECFG | SYS_UPDATESBUF;
		soundrenewal = 1;
	}

	val = GetDlgItemCheck(hWnd, IDC_ALLOWRESIZE);
	if (np2oscfg.thickframe != (UINT8)val) {
		np2oscfg.thickframe = (UINT8)val;
		update |= SYS_UPDATEOSCFG;
	}

#if !defined(_WIN64)
	if (!(mmxflag & MMXFLAG_NOTSUPPORT))
	{
		val = GetDlgItemCheck(hWnd, IDC_DISABLEMMX);
		if (np2oscfg.disablemmx != (UINT8)val)
		{
			np2oscfg.disablemmx = (UINT8)val;
			mmxflag &= ~MMXFLAG_DISABLE;
			mmxflag |= (val)?MMXFLAG_DISABLE:0;
			update |= SYS_UPDATEOSCFG;
		}
	}
#endif

	val = GetDlgItemCheck(hWnd, IDC_COMFIRM);
	if (np2oscfg.comfirm != (UINT8)val)
	{
		np2oscfg.comfirm = (UINT8)val;
		update |= SYS_UPDATEOSCFG;
	}

	val = GetDlgItemCheck(hWnd, IDC_RESUME);
	if (np2oscfg.resume != (UINT8)val)
	{
		np2oscfg.resume = (UINT8)val;
		update |= SYS_UPDATEOSCFG;
	}
	sysmng_update(update);
}
Пример #23
0
/**
 * 設定読み出し
 * @param[in] lpPath パス
 * @param[in] lpTitle タイトル
 * @param[in] lpTable 設定テーブル
 * @param[in] nCount 設定テーブル アイテム数
 */
void ini_read(LPCTSTR lpPath, LPCTSTR lpTitle, const PFTBL* lpTable, UINT nCount)
{
	const PFTBL* p = lpTable;
	const PFTBL* pTerminate = p + nCount;
	while (p < pTerminate)
	{
		TCHAR szWork[512];
		UINT32 val;
		switch (p->itemtype & PFTYPE_MASK)
		{
			case PFTYPE_STR:
				GetPrivateProfileString(lpTitle, p->item, static_cast<LPCTSTR>(p->value), static_cast<LPTSTR>(p->value), p->arg, lpPath);
				break;

			case PFTYPE_BOOL:
				GetPrivateProfileString(lpTitle, p->item,
									(*(static_cast<const UINT8*>(p->value))) ? str_true : str_false,
									szWork, NELEMENTS(szWork), lpPath);
				*(static_cast<UINT8*>(p->value)) = (!milstr_cmp(szWork, str_true)) ? 1 : 0;
				break;

			case PFTYPE_BITMAP:
				GetPrivateProfileString(lpTitle, p->item,
									(bitmapget(p->value, p->arg)) ? str_true : str_false,
									szWork, _countof(szWork), lpPath);
				bitmapset(p->value, p->arg, (milstr_cmp(szWork, str_true) == 0));
				break;

			case PFTYPE_BIN:
				GetPrivateProfileString(lpTitle, p->item, str_null, szWork, _countof(szWork), lpPath);
				binset(p->value, p->arg, szWork);
				break;

			case PFTYPE_SINT8:
			case PFTYPE_UINT8:
				val = GetPrivateProfileInt(lpTitle, p->item, *(static_cast<const UINT8*>(p->value)), lpPath);
				*(static_cast<UINT8*>(p->value)) = static_cast<UINT8>(val);
				break;

			case PFTYPE_SINT16:
			case PFTYPE_UINT16:
				val = GetPrivateProfileInt(lpTitle, p->item, *(static_cast<const UINT16*>(p->value)), lpPath);
				*(static_cast<UINT16*>(p->value)) = static_cast<UINT16>(val);
				break;

			case PFTYPE_SINT32:
			case PFTYPE_UINT32:
				val = GetPrivateProfileInt(lpTitle, p->item, *(static_cast<const UINT32*>(p->value)), lpPath);
				*(static_cast<UINT32*>(p->value)) = static_cast<UINT32>(val);
				break;

			case PFTYPE_HEX8:
				wsprintf(szWork, str_x, *(static_cast<const UINT8*>(p->value)));
				GetPrivateProfileString(lpTitle, p->item, szWork, szWork, _countof(szWork), lpPath);
				*(static_cast<UINT8*>(p->value)) = static_cast<UINT8>(milstr_solveHEX(szWork));
				break;

			case PFTYPE_HEX16:
				wsprintf(szWork, str_x, *(static_cast<const UINT16*>(p->value)));
				GetPrivateProfileString(lpTitle, p->item, szWork, szWork, _countof(szWork), lpPath);
				*(static_cast<UINT16*>(p->value)) = static_cast<UINT16>(milstr_solveHEX(szWork));
				break;

			case PFTYPE_HEX32:
				wsprintf(szWork, str_x, *(static_cast<const UINT32*>(p->value)));
				GetPrivateProfileString(lpTitle, p->item, szWork, szWork, _countof(szWork), lpPath);
				*(static_cast<UINT32*>(p->value)) = static_cast<UINT32>(milstr_solveHEX(szWork));
				break;

			case PFTYPE_ARGS16:
				GetPrivateProfileString(lpTitle, p->item, str_null, szWork, _countof(szWork), lpPath);
				inirdargs16(szWork, p);
				break;

			case PFTYPE_BYTE3:
				GetPrivateProfileString(lpTitle, p->item, str_null, szWork, _countof(szWork), lpPath);
				inirdbyte3(szWork, p);
				break;

			case PFTYPE_KB:
				GetPrivateProfileString(lpTitle, p->item, str_null, szWork, _countof(szWork), lpPath);
				inirdkb(szWork, p);
				break;
		}
		p++;
	}
}
Пример #24
0
static void cfgcreate(HWND hWnd) {

	TCHAR	work[32];
	UINT	val;

	dlgs_setcbitem(hWnd, IDC_BASECLOCK, cpBase, NELEMENTS(cpBase));
	if (np2cfg.baseclock < AVE(PCBASECLOCK25, PCBASECLOCK20))
	{
		val = PCBASECLOCK20;
	}
	else
	{
		val = PCBASECLOCK25;
	}
	dlgs_setcbcur(hWnd, IDC_BASECLOCK, val);

	SETLISTUINT32(hWnd, IDC_MULTIPLE, mulval);
	wsprintf(work, tchar_u, np2cfg.multiple);
	SetDlgItemText(hWnd, IDC_MULTIPLE, work);

	if (!milstr_cmp(np2cfg.model, str_VM))
	{
		val = IDC_MODELVM;
	}
	else if (!milstr_cmp(np2cfg.model, str_EPSON))
	{
		val = IDC_MODELEPSON;
	}
	else
	{
		val = IDC_MODELVX;
	}
	SetDlgItemCheck(hWnd, val, TRUE);

	if (np2cfg.samplingrate < AVE(11025, 22050))
	{
		val = IDC_RATE11;
	}
	else if (np2cfg.samplingrate < AVE(22050, 44100))
	{
		val = IDC_RATE22;
	}
	else
	{
		val = IDC_RATE44;
	}
	SetDlgItemCheck(hWnd, val, TRUE);
	wsprintf(work, tchar_u, np2cfg.delayms);
	SetDlgItemText(hWnd, IDC_SOUNDBUF, work);

	SetDlgItemCheck(hWnd, IDC_ALLOWRESIZE, np2oscfg.thickframe);
#if !defined(_WIN64)
	if (mmxflag & MMXFLAG_NOTSUPPORT)
	{
		EnableWindow(GetDlgItem(hWnd, IDC_DISABLEMMX), FALSE);
		SetDlgItemCheck(hWnd, IDC_DISABLEMMX, TRUE);
	}
	else
	{
		SetDlgItemCheck(hWnd, IDC_DISABLEMMX, np2oscfg.disablemmx);
	}
#endif
	SetDlgItemCheck(hWnd, IDC_COMFIRM, np2oscfg.comfirm);
	SetDlgItemCheck(hWnd, IDC_RESUME, np2oscfg.resume);
	setclock(hWnd, 0);
	SetFocus(GetDlgItem(hWnd, IDC_BASECLOCK));
}
Пример #25
0
static int GetFileExt(char* filename) {

    char*	p;
    char*	n;
    int		ftype;
    
    p = file_getext((char *)filename);
    n = file_getname((char *)filename);
    if ((!milstr_cmp(p, str_d88)) || (!milstr_cmp(p, str_d98))) {
			ftype = FTYPE_D88;
		}
    else if ((!milstr_cmp(p, str_ini))) {
			ftype = FTYPE_INI;
		}
    else if ((!milstr_cmp(p, str_bmp))) {
			ftype = FTYPE_BMP;
		}
    else if ((!milstr_cmp(p, str_thd))) {
			ftype = FTYPE_THD;
		}
    else if ((!milstr_cmp(p, str_nhd))) {
			ftype = FTYPE_NHD;
		}
    else if ((!milstr_cmp(p, str_hdi))) {
			ftype = FTYPE_HDI;
		}
    else if ((!milstr_cmp(p, str_hdd))) {
			ftype = FTYPE_HDD;
		}
    else if ((!milstr_cmp(p, str_fdi))) {
			ftype = FTYPE_FDI;
		}
    else if ((!milstr_cmp(p, "xdf")) || (!milstr_cmp(p, "dup")) || (!milstr_cmp(p, "hdm"))) {
        ftype = FTYPE_BETA;
    }
	else if (
        (!file_cmpname(n, v98fontname))	||
        (!file_cmpname(n, pc88ankname))	||
		(!file_cmpname(n, pc88knj1name))||
		(!file_cmpname(n, pc88knj2name))||
        (!file_cmpname(n, fm7ankname))	||
		(!file_cmpname(n, fm7knjname))	||
        (!file_cmpname(n, x1ank1name)) 	||
		(!file_cmpname(n, x1ank2name))	||
		(!file_cmpname(n, x1knjname))	||
        (!file_cmpname(n, x68kfontname))) {
        ftype = FTYPE_SMIL;
	}
    else {
        ftype = FTYPE_NONE;
    }
    return(ftype);
}
Пример #26
0
static void VERMOUTHCL settone(MIDIMOD mod, int bank, int argc,
															OEMCHAR *argv[]) {

	int		val;
	TONECFG	tone;
	OEMCHAR	*name;
	int		i;
	OEMCHAR	*key;
	OEMCHAR	*data;
	UINT8	flag;

	if ((bank < 0) || (bank >= (MIDI_BANKS * 2)) || (argc < 2) ||
		(cfggetval(argv[0], &val) != SUCCESS) || (val < 0) || (val >= 128)) {
		return;
	}
	tone = mod->tonecfg[bank];
	if (tone == NULL) {
		tone = (TONECFG)_MALLOC(sizeof(_TONECFG) * 128, "tone cfg");
		if (tone == NULL) {
			return;
		}
		mod->tonecfg[bank] = tone;
		ZeroMemory(tone, sizeof(_TONECFG) * 128);
	}
	tone += val;
	name = tone->name;
	if (name == NULL) {
		name = (OEMCHAR *)listarray_append(mod->namelist, NULL);
		tone->name = name;
	}
	if (name) {
		name[0] = '\0';
		file_catname(name, argv[1], MAX_NAME);		// separator change!
	}
	flag = TONECFG_EXIST;
	tone->amp = TONECFG_AUTOAMP;
	tone->pan = TONECFG_VARIABLE;

	if (!(bank & 1)) {					// for tone
		tone->note = TONECFG_VARIABLE;
	}
	else {								// for drums
		flag |= TONECFG_NOLOOP | TONECFG_NOENV;
		tone->note = (UINT8)val;
	}

	for (i=2; i<argc; i++) {
		key = argv[i];
		data = seachr(key, '=');
		if (data == NULL) {
			continue;
		}
		*data++ = '\0';
		if (!milstr_cmp(key, str_amp)) {
			if (cfggetval(data, &val) == SUCCESS) {
				if (val < 0) {
					val = 0;
				}
				else if (val > CFG_MAXAMP) {
					val = CFG_MAXAMP;
				}
				tone->amp = val;
			}
		}
		else if (!milstr_cmp(key, str_keep)) {
			if (!milstr_cmp(data, str_env)) {
				flag &= ~TONECFG_NOENV;
				flag |= TONECFG_KEEPENV;
			}
			else if (!milstr_cmp(data, str_loop)) {
				flag &= ~TONECFG_NOLOOP;
			}
		}
		else if (!milstr_cmp(key, str_note)) {
			if ((cfggetval(data, &val) == SUCCESS) &&
				(val >= 0) && (val < 128)) {
				tone->note = (UINT8)val;
			}
		}
		else if (!milstr_cmp(key, str_pan)) {
			if (!milstr_cmp(data, str_left)) {
				val = 0;
			}
			else if (!milstr_cmp(data, str_center)) {
				val = 64;
			}
			else if (!milstr_cmp(data, str_right)) {
				val = 127;
			}
			else if (cfggetval(data, &val) == SUCCESS) {
				if (val < -100) {
					val = -100;
				}
				else if (val > 100) {
					val = 100;
				}
				val = val + 100;
				val *= 127;
				val += 100;
				val /= 200;
			}
			else {
				continue;
			}
			tone->pan = (UINT8)val;
		}
		else if (!milstr_cmp(key, str_strip)) {
			if (!milstr_cmp(data, str_env)) {
				flag &= ~TONECFG_KEEPENV;
				flag |= TONECFG_NOENV;
			}
			else if (!milstr_cmp(data, str_loop)) {
				flag |= TONECFG_NOLOOP;
			}
			else if (!milstr_cmp(data, str_tail)) {
				flag |= TONECFG_NOTAIL;
			}
		}
	}
	tone->flag = flag;
}
Пример #27
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);
}
Пример #28
0
static BRESULT VERMOUTHCL cfgfile_load(MIDIMOD mod, const OEMCHAR *filename,
																int depth) {

	TEXTFILEH	tfh;
	OEMCHAR		buf[1024];
	int			bank;
	int			i;
	int			argc;
	OEMCHAR		*argv[16];
	int			val;
	UINT		cfg;

	bank = -1;

	if ((depth >= 16) ||
		(midimod_getfile(mod, filename, buf, NELEMENTS(buf)) != SUCCESS)) {
		goto cfl_err;
	}
// TRACEOUT(("open: %s", buf));
	tfh = textfile_open(buf, 0x1000);
	if (tfh == NULL) {
		goto cfl_err;
	}
	while(textfile_read(tfh, buf, NELEMENTS(buf)) == SUCCESS) {
		argc = cfggetarg(buf, argv, NELEMENTS(argv));
		if (argc < 2) {
			continue;
		}
		cfg = 0;
		while(cfg < NELEMENTS(cfgstr)) {
			if (!milstr_cmp(argv[0], cfgstr[cfg])) {
				break;
			}
			cfg++;
		}
		switch(cfg) {
			case CFG_DIR:
				for (i=1; i<argc; i++) {
					pathaddex(mod, argv[i]);
				}
				break;

			case CFG_SOURCE:
				for (i=1; i<argc; i++) {
					depth++;
					cfgfile_load(mod, argv[i], depth);
					depth--;
				}
				break;

			case CFG_DEFAULT:
				break;

			case CFG_BANK:
			case CFG_DRUM:
				if ((cfggetval(argv[1], &val) == SUCCESS) &&
					(val >= 0) && (val < 128)) {
					val <<= 1;
					if (cfg == CFG_DRUM) {
						val++;
					}
					bank = val;
				}
				break;

			default:
				settone(mod, bank, argc, argv);
				break;
		}
	}
	textfile_close(tfh);
	return(SUCCESS);

cfl_err:
	return(FAILURE);
}