diff src/xs_sidplay1.cc @ 467:9dafc55c4270

Beginnings of vfs portability.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 25 Jan 2007 03:46:02 +0000
parents 9e683fb666ba
children fa95d942f226
line wrap: on
line diff
--- a/src/xs_sidplay1.cc	Thu Jan 25 03:44:01 2007 +0000
+++ b/src/xs_sidplay1.cc	Thu Jan 25 03:46:02 2007 +0000
@@ -44,21 +44,31 @@
 extern "C" {
 
 
+/* Return song information
+ */
+#define	TFUNCTION	xs_sidplay1_getinfo
+#define	TFUNCTION2	xs_sidplay1_updateinfo
+#define	TTUNEINFO	sidTuneInfo
+#define	TTUNE		sidTune
+#define TENGINE		t_xs_sidplay1
+#include "xs_sidplay.h"
+
+
 /* Check if we can play the given file
  */
-gboolean xs_sidplay1_isourfile(gchar * pcFilename)
+gboolean xs_sidplay1_isourfile(t_xs_file *f)
 {
-	sidTune *testTune = new sidTune(pcFilename);
-
-	if (!testTune) return FALSE;
-
-	if (!testTune->getStatus()) {
-		delete testTune;
+	gchar tmpBuf[4];
+	
+	if (!f) return FALSE;
+	
+	if (xs_fread(tmpBuf, sizeof(gchar), 4, f) != 4)
 		return FALSE;
-	}
-
-	delete testTune;
-	return TRUE;
+	
+	if (!strncmp(tmpBuf, "PSID", 4))
+		return TRUE;
+	else
+		return FALSE;
 }
 
 
@@ -327,13 +337,5 @@
 }
 
 
-/* Return song information
- */
-#define TFUNCTION	xs_sidplay1_getinfo
-#define TFUNCTION2	xs_sidplay1_updateinfo
-#define TTUNEINFO	sidTuneInfo
-#define TTUNE		sidTune
-#include "xs_sidplay.h"
-
-}				/* extern "C" */
-#endif				/* HAVE_SIDPLAY1 */
+}	/* extern "C" */
+#endif	/* HAVE_SIDPLAY1 */