Beispiel #1
0
void VERMOUTHCL midimod_unlock(MIDIMOD mod) {

	UINT	r;
	TONECFG	bank;

	if (!mod->lockcount) {
		return;
	}
	mod->lockcount--;
	if (mod->lockcount) {
		return;
	}

	r = 128;
	do {
		r--;
		inst_bankfree(mod, r);
	} while(r > 0);
	for (r=2; r<(MIDI_BANKS*2); r++) {
		bank = mod->tonecfg[r];
		if (bank) {
			_MFREE(bank);
		}
	}
	listarray_destroy(mod->namelist);
	listarray_destroy(mod->pathtbl);
	_MFREE(mod);
}
Beispiel #2
0
void menusys_destroy(void) {

	MENUSYS	*sys;

	sys = &menusys;
	wndclose(sys, 0);
	if (sys->res) {
		listarray_destroy(sys->res);
	}
}
Beispiel #3
0
VEXTERN MIDIMOD VEXPORT midimod_create(UINT samprate) {

	UINT	size;
	MIDIMOD	ret;
	BRESULT	r;

	size = sizeof(_MIDIMOD);
	size += sizeof(INSTRUMENT) * 128 * 2;
	size += sizeof(_TONECFG) * 128 * 2;
	ret = (MIDIMOD)_MALLOC(size, "MIDIMOD");
	if (ret == NULL) {
		goto mmcre_err1;
	}
	ZeroMemory(ret, size);
	ret->samprate = samprate;
	ret->tone[0] = (INSTRUMENT *)(ret + 1);
	ret->tone[1] = ret->tone[0] + 128;
	ret->tonecfg[0] = (TONECFG)(ret->tone[1] + 128);
	ret->tonecfg[1] = ret->tonecfg[0] + 128;
	ret->pathtbl = listarray_new(sizeof(_PATHLIST), 16);
	pathadd(ret, NULL);
	pathadd(ret, file_getcd(str_null));
	ret->namelist = listarray_new(MAX_NAME, 128);
	r = cfgfile_load(ret, file_timiditycfg, 0);
#if defined(TIMIDITY_CFGFILE)
	if (r != SUCCESS) {
		r = cfgfile_load(ret, TIMIDITY_CFGFILE, 0);
	}
#endif
	if (r != SUCCESS) {
		goto mmcre_err2;
	}
	midimod_lock(ret);
	return(ret);

mmcre_err2:
	listarray_destroy(ret->namelist);
	listarray_destroy(ret->pathtbl);
	_MFREE(ret);

mmcre_err1:
	return(NULL);
}
Beispiel #4
0
void midimod_destroy(MIDIMOD hdl) {

	UINT	r;
	TONECFG	bank;

	if (hdl) {
		r = 128;
		do {
			r--;
			inst_bankfree(hdl, r);
		} while(r > 0);
		for (r=2; r<(MIDI_BANKS*2); r++) {
			bank = hdl->tonecfg[r];
			if (bank) {
				_MFREE(bank);
			}
		}
		listarray_destroy(hdl->namelist);
		listarray_destroy(hdl->pathtbl);
		_MFREE(hdl);
	}
}
Beispiel #5
0
static int dlgcmd(int msg, MENUID id, long param) {

	switch(msg) {
		case DLGMSG_CREATE:
			dlginit();
			break;

		case DLGMSG_COMMAND:
			switch(id) {
				case DID_OK:
					if (dlgupdate()) {
						menubase_close();
					}
					break;

				case DID_CANCEL:
					menubase_close();
					break;

				case DID_PARENT:
					file_cutname(filesel.path);
					file_cutseparator(filesel.path);
					dlgsetlist();
					menudlg_settext(DID_FILE, NULL);
					break;

				case DID_FLIST:
					if (param) {
						return(dlgcmd(DLGMSG_COMMAND, DID_OK, 0));
					}
					else {
						dlgflist();
					}
					break;
			}
			break;

		case DLGMSG_CLOSE:
			menubase_close();
			break;

		case DLGMSG_DESTROY:
			listarray_destroy(filesel.flist);
			filesel.flist = NULL;
			break;
	}
	(void)param;
	return(0);
}
Beispiel #6
0
void gamecore_destroy(void) {

	if (gamecore.initialized) {
#if 0
		if (gamecore.sys.type & GAME_DRS) {
			savedrs_syswrite();
		}
#endif
		gamecfg_save();
	}
	gamecore_reset();
	cddamng_stop(0);
	scr_term();
	textdisp_multireset();
	textctrl_trash(&gamecore.textdraw);
	vramdraw_destroy();
	textwin_destroy();
	anime_alltrush();
	listarray_destroy(gamecore.drssys.cgflag);
	listarray_destroy(gamecore.cfglist);
	archive_destory();

	gamedef_destroy();
}
Beispiel #7
0
static void dlgsetlist(void) {

	LISTARRAY	flist;
	FLISTH		flh;
	FLINFO		fli;
	BOOL		append;
	FLIST		fl;
	ITEMEXPRM	prm;

	menudlg_itemreset(DID_FLIST);
	menudlg_settext(DID_FOLDER, file_getname(filesel.path));
	listarray_destroy(filesel.flist);
	flist = listarray_new(sizeof(_FLIST), 64);
	filesel.flist = flist;
	filesel.fbase = NULL;
	flh = file_list1st(filesel.path, &fli);
	if (flh != FLISTH_INVALID) {
		do {
			append = FALSE;
			if (fli.attr & 0x10) {
				append = TRUE;
			}
			else if (!(fli.attr & 0x08)) {
				append = checkext(fli.path, filesel.ext);
			}
			if (append) {
				if (fappend(flist, &fli) != SUCCESS) {
					break;
				}
			}
		} while(file_listnext(flh, &fli,filesel.path) == SUCCESS);
		file_listclose(flh);
	}
	prm.pos = 0;
	fl = filesel.fbase;
	while(fl) {
		menudlg_itemappend(DID_FLIST, NULL);
		prm.icon = (fl->isdir)?MICON_FOLDER:MICON_FILE;
		prm.str = fl->name;
		menudlg_itemsetex(DID_FLIST, &prm);
		fl = fl->next;
		prm.pos++;
	}
}