view src/xs_sidplay.h @ 402:f997b79a7251

More work on merging of improved STIL/SLDB handling code with completely dynamic memory allocation.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 01 Jun 2006 02:18:02 +0000
parents 684d09ff564b
children 7f694e5a1493
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;
	gboolean haveInfo = TRUE;

	/* 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
	haveInfo = testTune->getInfo(tuneInfo);
#endif
#ifdef _XS_SIDPLAY2_H
	testTune->getInfo(tuneInfo);
	haveInfo = TRUE;
#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);

	delete testTune;

	return pResult;
}

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