Esempio n. 1
0
void driveclick_init (void)
{
	int v, vv;
	TCHAR tmp[MAX_DPATH];
#ifdef FSUAE
	write_log("driveclick_init\n");
#endif

	driveclick_fdrawcmd_detect ();
	driveclick_close();
	vv = 0;
	for (int i = 0; i < 4; i++) {
		struct floppyslot *fs = &currprefs.floppyslots[i];
		for (int j = 0; j < CLICK_TRACKS; j++)  {
			drvs[i][DS_CLICK].indexes[j] = 0;
			drvs[i][DS_CLICK].lengths[j] = 0;
		}
		if (fs->dfxclick) {
			v = 0;
			if (fs->dfxclick > 0) {
				switch(fs->dfxclick)
				{
				case 1:
					if (driveclick_loadresource (drvs[i], fs->dfxclick))
						v = 3;
					for (int j = 0; j < CLICK_TRACKS; j++)
						drvs[i][DS_CLICK].lengths[j] = drvs[i][DS_CLICK].len;
					wave_initialized = 1;
					break;
				default:
					if (driveclick_fdrawcmd_open (fs->dfxclick - 2))
						v = 1;
					break;
				}
			} else if (fs->dfxclick == -1) {
				TCHAR path2[MAX_DPATH];
				wave_initialized = 1;
				for (int j = 0; j < CLICK_TRACKS; j++)
					drvs[i][DS_CLICK].lengths[j] = drvs[i][DS_CLICK].len;
				get_plugin_path (path2, sizeof path2 / sizeof (TCHAR), _T("floppysounds"));
				_stprintf (tmp, _T("%sdrive_click_%s"),
					path2, fs->dfxclickexternal);
				v = loadsample (tmp, &drvs[i][DS_CLICK]);
				if (v)
					processclicks (&drvs[i][DS_CLICK]);
				_stprintf (tmp, _T("%sdrive_spin_%s"),
					path2, fs->dfxclickexternal);
				v += loadsample (tmp, &drvs[i][DS_SPIN]);
				_stprintf (tmp, _T("%sdrive_spinnd_%s"),
					path2, fs->dfxclickexternal);
				v += loadsample (tmp, &drvs[i][DS_SPINND]);
				_stprintf (tmp, _T("%sdrive_startup_%s"),
					path2, fs->dfxclickexternal);
				v += loadsample (tmp, &drvs[i][DS_START]);
				_stprintf (tmp, _T("%sdrive_snatch_%s"),
					path2, fs->dfxclickexternal);
				v += loadsample (tmp, &drvs[i][DS_SNATCH]);
			}
			if (v == 0) {
				for (int j = 0; j < DS_END; j++)
					freesample (&drvs[i][j]);
				fs->dfxclick = changed_prefs.floppyslots[i].dfxclick = 0;
			} else {
				vv++;
			}
			for (int j = 0; j < DS_END; j++)
				drvs[i][j].len <<= DS_SHIFT;
			drvs[i][DS_CLICK].pos = drvs[i][DS_CLICK].len;
			drvs[i][DS_SNATCH].pos = drvs[i][DS_SNATCH].len;
		}
	}
	if (vv > 0) {
		click_initialized = 1;
	}
	driveclick_reset();
}
Esempio n. 2
0
void driveclick_init (void)
{
    int v, vv, i, j;
	TCHAR tmp[MAX_DPATH];

	driveclick_fdrawcmd_detect ();
    driveclick_free ();
    vv = 0;
    for (i = 0; i < 4; i++) {
		for (j = 0; j < CLICK_TRACKS; j++)  {
		    drvs[i][DS_CLICK].indexes[j] = 0;
		    drvs[i][DS_CLICK].lengths[j] = 0;
		}
		if (currprefs.dfxclick[i]) {
		    if (currprefs.dfxclick[i] > 0) {
				v = 0;
				switch(currprefs.dfxclick[i])
				{
			    case 1:
				    if (driveclick_loadresource (drvs[i], currprefs.dfxclick[i]))
						v = 3;
				    for (j = 0; j < CLICK_TRACKS; j++)
						drvs[i][DS_CLICK].lengths[j] = drvs[i][DS_CLICK].len;
					wave_initialized = 1;
				    break;
			    default:
				    if (driveclick_fdrawcmd_open (currprefs.dfxclick[i] - 2))
						v = 1;
				    break;
				}
		    } else if (currprefs.dfxclick[i] == -1) {
				TCHAR path2[MAX_DPATH];
				wave_initialized = 1;
				for (j = 0; j < CLICK_TRACKS; j++)
				    drvs[i][DS_CLICK].lengths[j] = drvs[i][DS_CLICK].len;
//				_stprintf (tmp, "%splugins%cfloppysounds%c", "./", FSDB_DIR_SEPARATOR, FSDB_DIR_SEPARATOR, FSDB_DIR_SEPARATOR);
//		if (my_existsdir (tmp))
//					_tcscpy (path2, tmp);
//		else
					_stprintf (path2, "%suae_data%c", "./", FSDB_DIR_SEPARATOR);
				_stprintf (tmp, "%sdrive_click_LOUD%s",
			    path2, currprefs.dfxclickexternal[i]);
				v = loadsample (tmp, &drvs[i][DS_CLICK]);
				if (v)
				    processclicks (&drvs[i][DS_CLICK]);
				_stprintf (tmp, "%sdrive_spin_LOUD%s",
					path2, currprefs.dfxclickexternal[i]);
				v += loadsample (tmp, &drvs[i][DS_SPIN]);
				_stprintf (tmp, "%sdrive_spinnd_LOUD%s",
					path2, currprefs.dfxclickexternal[i]);
				v += loadsample (tmp, &drvs[i][DS_SPINND]);
				_stprintf (tmp, "%sdrive_startup_LOUD%s",
					path2, currprefs.dfxclickexternal[i]);
				v += loadsample (tmp, &drvs[i][DS_START]);
				_stprintf (tmp, "%sdrive_snatch_LOUD%s",
					path2, currprefs.dfxclickexternal[i]);
				v += loadsample (tmp, &drvs[i][DS_SNATCH]);
		    }
		    if (v == 0) {
				int j;
				for (j = 0; j < DS_END; j++)
				    freesample (&drvs[i][j]);
				currprefs.dfxclick[i] = changed_prefs.dfxclick[i] = 0;
		    } else {
				vv++;
		    }
		    for (j = 0; j < DS_END; j++)
				drvs[i][j].len <<= DS_SHIFT;
		    drvs[i][DS_CLICK].pos = drvs[i][DS_CLICK].len;
		    drvs[i][DS_SNATCH].pos = drvs[i][DS_SNATCH].len;
		}
    }
    if (vv > 0) {
		driveclick_reset ();
		click_initialized = 1;
    }
}