diff src/xs_sidplay2.cc @ 527:fe8b41abd923

Now everything necessary should be using the VFS functions.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 20 Feb 2007 18:09:04 +0000
parents fa95d942f226
children 0170ab0c98e6
line wrap: on
line diff
--- a/src/xs_sidplay2.cc	Tue Feb 20 16:53:05 2007 +0000
+++ b/src/xs_sidplay2.cc	Tue Feb 20 18:09:04 2007 +0000
@@ -43,6 +43,8 @@
 	sidbuilder *currBuilder;
 	sid2_config_t currConfig;
 	SidTune *currTune;
+	guint8 *buf;
+	size_t bufSize;
 } t_xs_sidplay2;
 
 
@@ -411,16 +413,18 @@
 {
 	t_xs_sidplay2 *myEngine;
 	assert(myStatus);
+	myStatus->isInitialized = FALSE;
 
 	myEngine = (t_xs_sidplay2 *) myStatus->sidEngine;
 	if (!myEngine) return FALSE;
-	
-	myStatus->isInitialized = FALSE;
 
 	/* Try to get the tune */
 	if (!pcFilename) return FALSE;
 
-	if (!myEngine->currTune->load(pcFilename))
+	if (xs_fload_buffer(pcFilename, &(myEngine->buf), &(myEngine->bufSize)) != 0)
+		return FALSE;
+	
+	if (!myEngine->currTune->read(myEngine->buf, myEngine->bufSize))
 		return FALSE;
 
 	return TRUE;
@@ -431,11 +435,15 @@
  */
 void xs_sidplay2_delete(t_xs_status * myStatus)
 {
+	t_xs_sidplay2 *myEngine;
 	assert(myStatus);
 
-	/* With the current scheme of handling sidtune-loading,
-	 * we don't do anything here.
-	 */
+	myEngine = (t_xs_sidplay2 *) myStatus->sidEngine;
+	if (!myEngine) return;
+	
+	g_free(myEngine->buf);
+	myEngine->buf = NULL;
+	myEngine->bufSize = 0;
 }