changeset 460:9e683fb666ba

Updates
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 24 Jan 2007 22:10:00 +0000
parents 023fed5602f3
children a1224c1f8670
files src/xs_sidplay.h src/xs_sidplay1.cc src/xs_sidplay2.cc
diffstat 3 files changed, 32 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/xs_sidplay.h	Wed Jan 24 22:08:02 2007 +0000
+++ b/src/xs_sidplay.h	Wed Jan 24 22:10:00 2007 +0000
@@ -1,7 +1,7 @@
 /* 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 *TFUNCTION(gchar *pcFilename)
 {
 	t_xs_tuneinfo *pResult;
 	TTUNEINFO tuneInfo;
@@ -37,11 +37,18 @@
 }
 
 
-t_xs_tuneinfo *TFUNCTION2(t_xs_status * myStatus)
+gboolean TFUNCTION2(t_xs_status *myStatus)
 {
-	t_xs_tuneinfo *pResult;
 	TTUNEINFO tuneInfo;
-	TTUNE *testTune;
+#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
@@ -51,22 +58,23 @@
 	tuneInfo = testTune->getInfo();
 #endif
 
+	if (!tuneInfo)
+		return FALSE;
+	
+	
 	/* Allocate tuneinfo structure */
-	pResult = xs_tuneinfo_new(pcFilename,
+	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);
 
-	delete testTune;
-
-	return pResult;
+	return TRUE;
 }
 
-
-
 /* Undefine these */
 #undef TFUNCTION
+#undef TFUNCTION2
 #undef TTUNEINFO
 #undef TTUNE
--- a/src/xs_sidplay1.cc	Wed Jan 24 22:08:02 2007 +0000
+++ b/src/xs_sidplay1.cc	Wed Jan 24 22:10:00 2007 +0000
@@ -24,8 +24,8 @@
 
 #ifdef HAVE_SIDPLAY1
 
+#include <stdio.h>
 #include "xs_sidplay1.h"
-#include <stdio.h>
 #include "xs_config.h"
 
 #include <sidplay/player.h>
@@ -289,7 +289,7 @@
 
 /* Load a given SID-tune file
  */
-gboolean xs_sidplay1_loadsid(t_xs_status * myStatus, gchar * pcFilename)
+gboolean xs_sidplay1_load(t_xs_status * myStatus, gchar * pcFilename)
 {
 	t_xs_sidplay1 *myEngine;
 	sidTune *newTune;
@@ -312,7 +312,7 @@
 
 /* Delete INTERNAL information
  */
-void xs_sidplay1_deletesid(t_xs_status * myStatus)
+void xs_sidplay1_delete(t_xs_status * myStatus)
 {
 	t_xs_sidplay1 *myEngine;
 	assert(myStatus);
@@ -329,7 +329,8 @@
 
 /* Return song information
  */
-#define TFUNCTION	xs_sidplay1_getsidinfo
+#define TFUNCTION	xs_sidplay1_getinfo
+#define TFUNCTION2	xs_sidplay1_updateinfo
 #define TTUNEINFO	sidTuneInfo
 #define TTUNE		sidTune
 #include "xs_sidplay.h"
--- a/src/xs_sidplay2.cc	Wed Jan 24 22:08:02 2007 +0000
+++ b/src/xs_sidplay2.cc	Wed Jan 24 22:10:00 2007 +0000
@@ -24,8 +24,8 @@
 
 #ifdef HAVE_SIDPLAY2
 
+#include <stdio.h>
 #include "xs_sidplay2.h"
-#include <stdio.h>
 #include "xs_config.h"
 #include "xs_support.h"
 
@@ -53,7 +53,7 @@
 
 /* Check if we can play the given file
  */
-gboolean xs_sidplay2_isourfile(gchar * pcFilename)
+gboolean xs_sidplay2_isourfile(gchar *pcFilename)
 {
 	SidTune *testTune = new SidTune(pcFilename);
 
@@ -69,10 +69,9 @@
 }
 
 
-
 /* Initialize SIDPlay2
  */
-gboolean xs_sidplay2_init(t_xs_status * myStatus)
+gboolean xs_sidplay2_init(t_xs_ t_xs_status * myStatus)
 {
 	gint tmpFreq;
 	t_xs_sidplay2 *myEngine;
@@ -376,7 +375,7 @@
 		return FALSE;
 	}
 	
-	myEngine->isInitialized = TRUE;
+	myStatus->isInitialized = TRUE;
 
 	return TRUE;
 }
@@ -398,7 +397,7 @@
 
 /* Load a given SID-tune file
  */
-gboolean xs_sidplay2_loadsid(t_xs_status * myStatus, gchar * pcFilename)
+gboolean xs_sidplay2_load(t_xs_status * myStatus, gchar * pcFilename)
 {
 	t_xs_sidplay2 *myEngine;
 	assert(myStatus);
@@ -406,7 +405,7 @@
 	myEngine = (t_xs_sidplay2 *) myStatus->sidEngine;
 	if (!myEngine) return FALSE;
 	
-	myEngine->isInitialized = FALSE;
+	myStatus->isInitialized = FALSE;
 
 	/* Try to get the tune */
 	if (!pcFilename) return FALSE;
@@ -420,7 +419,7 @@
 
 /* Delete INTERNAL information
  */
-void xs_sidplay2_deletesid(t_xs_status * myStatus)
+void xs_sidplay2_delete(t_xs_status * myStatus)
 {
 	assert(myStatus);
 
@@ -430,7 +429,8 @@
 
 /* Return song information
  */
-#define TFUNCTION	xs_sidplay2_getsidinfo
+#define TFUNCTION	xs_sidplay2_getinfo
+#define TFUNCTION2	xs_sidplay2_updateinfo
 #define TTUNEINFO	SidTuneInfo
 #define TTUNE		SidTune
 #include "xs_sidplay.h"