view src/xs_sidplay.h @ 460:9e683fb666ba

Updates
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 24 Jan 2007 22:10:00 +0000
parents f277dad3180f
children 6963982fcbb6
line wrap: on
line source

/* Here comes the really ugly code... Get all SID-tune information
 * for all sub-tunes, including name, length, etc.
 */
t_xs_tuneinfo *TFUNCTION(gchar *pcFilename)
{
	t_xs_tuneinfo *pResult;
	TTUNEINFO tuneInfo;
	TTUNE *testTune;

	/* Check if the tune exists and is readable */
	if ((testTune = new TTUNE(pcFilename)) == NULL)
		return NULL;

	if (!testTune->getStatus()) {
		delete testTune;
		return NULL;
	}

	/* Get general tune information */
#ifdef _XS_SIDPLAY1_H
	testTune->getInfo(tuneInfo);
#endif
#ifdef _XS_SIDPLAY2_H
	tuneInfo = testTune->getInfo();
#endif

	/* Allocate tuneinfo structure */
	pResult = xs_tuneinfo_new(pcFilename,
		tuneInfo.songs, tuneInfo.startSong,
		tuneInfo.infoString[0], tuneInfo.infoString[1], tuneInfo.infoString[2],
		tuneInfo.loadAddr, tuneInfo.initAddr, tuneInfo.playAddr,
		tuneInfo.dataFileLen, tuneInfo.formatString, -1, -1, -1);

	delete testTune;

	return pResult;
}


gboolean TFUNCTION2(t_xs_status *myStatus)
{
	TTUNEINFO tuneInfo;
#ifdef _XS_SIDPLAY1_H
	t_xs_sidplay1 *myEngine;
#endif
#ifdef _XS_SIDPLAY2_H
	t_xs_sidplay2 *myEngine;
#endif

	if (!myStatus || !myStatus->tuneInfo)
		return FALSE;

	/* Get general tune information */
#ifdef _XS_SIDPLAY1_H
	testTune->getInfo(tuneInfo);
#endif
#ifdef _XS_SIDPLAY2_H
	tuneInfo = testTune->getInfo();
#endif

	if (!tuneInfo)
		return FALSE;
	
	
	/* Allocate tuneinfo structure */
	pResult = xs_tuneinfo_new(->pcFilename,
		tuneInfo.songs, tuneInfo.startSong,
		tuneInfo.infoString[0], tuneInfo.infoString[1], tuneInfo.infoString[2],
		tuneInfo.loadAddr, tuneInfo.initAddr, tuneInfo.playAddr,
		tuneInfo.dataFileLen, tuneInfo.formatString,
		tuneInfo.sidModel, tuneInfo.songSpeed, tuneInfo.clockSpeed);

	return TRUE;
}

/* Undefine these */
#undef TFUNCTION
#undef TFUNCTION2
#undef TTUNEINFO
#undef TTUNE