diff 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 diff
--- a/src/xs_sidplay.h	Wed May 31 22:52:00 2006 +0000
+++ b/src/xs_sidplay.h	Thu Jun 01 02:18:02 2006 +0000
@@ -1,16 +1,12 @@
-/*
- * Here comes the really ugly code...
- * Get all SID-tune information (for all sub-tunes)
- * including name, length, etc.
+/* 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_sldb_node *tuneLength = NULL;
 	t_xs_tuneinfo *pResult;
 	TTUNEINFO tuneInfo;
 	TTUNE *testTune;
 	gboolean haveInfo = TRUE;
-	gint i;
 
 	/* Check if the tune exists and is readable */
 	if ((testTune = new TTUNE(pcFilename)) == NULL)
@@ -30,37 +26,12 @@
 	haveInfo = TRUE;
 #endif
 
-	/* Get length information (NOTE: Do not free this!) */
-	tuneLength = xs_songlen_get(pcFilename);
-
 	/* 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);
-
-	if (!pResult) {
-		delete testTune;
-		return NULL;
-	}
-
-	/* Get information for subtunes */
-	for (i = 0; i < pResult->nsubTunes; i++) {
-		/* Make the title */
-		if (haveInfo) {
-			pResult->subTunes[i].tuneTitle =
-			    xs_make_titlestring(pcFilename, i + 1, pResult->nsubTunes, tuneInfo.sidModel,
-						tuneInfo.formatString, tuneInfo.infoString[0],
-						tuneInfo.infoString[1], tuneInfo.infoString[2]);
-		} else
-			pResult->subTunes[i].tuneTitle = g_strdup(pcFilename);
-
-		/* Get song length */
-		if (tuneLength && (i < tuneLength->nLengths))
-			pResult->subTunes[i].tuneLength = tuneLength->sLengths[i];
-		else
-			pResult->subTunes[i].tuneLength = -1;
-	}
+		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;