diff src/xs_sidplayfp.cpp @ 991:34259889b2b1 dev-0_9_1

Add support for libSIDPlay-FP v1.1.x.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 11 Oct 2013 14:37:20 +0300
parents 9bd29db2d1bf
children fca16a15145e
line wrap: on
line diff
--- a/src/xs_sidplayfp.cpp	Fri Oct 11 13:47:41 2013 +0300
+++ b/src/xs_sidplayfp.cpp	Fri Oct 11 14:37:20 2013 +0300
@@ -29,7 +29,7 @@
 #include "xs_config.h"
 
 
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
 #  include <sidplayfp/SidTune.h>
 #  include <sidplayfp/sidplayfp.h>
 #  include <sidplayfp/event.h>
@@ -45,7 +45,7 @@
 
 class XSSIDPlayFP {
 public:
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
     sidplayfp emu;
     SidConfig config;
 #else
@@ -91,7 +91,7 @@
 
 /* Return song information
  */
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
 #define sid2_mono              SidConfig::MONO
 #define sid2_stereo            SidConfig::STEREO
 
@@ -253,7 +253,7 @@
     switch (xs_cfg.clockSpeed)
     {
         case XS_CLOCK_NTSC:
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
             engine->config.defaultC64Model = SID2_CLOCK_NTSC;
 #else
             engine->config.clockDefault = SID2_CLOCK_NTSC;
@@ -262,7 +262,7 @@
 
         default:
         case XS_CLOCK_PAL:
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
 #else
             engine->config.defaultC64Model = SID2_CLOCK_PAL;
 #endif
@@ -273,7 +273,7 @@
 
     /* Configure rest of the emulation */
 
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
     engine->config.forceC64Model   = xs_cfg.forceSpeed;
     engine->config.defaultSidModel = xs_cfg.mos8580 ? SID2_MOS8580 : SID2_MOS6581;
     XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (engine->emu.info()).maxsids());
@@ -294,7 +294,7 @@
         case XS_BLD_RESID:
             {
                 ReSIDBuilder *rs = new ReSIDBuilder("ReSID builder");
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
                 if (rs && rs->getStatus())
                 {
                     engine->config.sidEmulation = rs;
@@ -321,7 +321,7 @@
         case XS_BLD_RESID_FP:
             {
                 ReSIDfpBuilder *rs = new ReSIDfpBuilder("ReSID builder FP!");
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
                 if (rs && rs->getStatus())
                 {
                     engine->config.sidEmulation = rs;
@@ -349,7 +349,7 @@
             {
                 HardSIDBuilder *hs = new HardSIDBuilder("HardSID builder (FP)");
                 engine->config.sidEmulation = (sidbuilder *) hs;
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
                 if (hs && hs->getStatus())
                 {
                     hs->create((engine->emu.info()).maxsids());
@@ -380,7 +380,7 @@
 
     // Setup filter
     engine->config.sidEmulation->filter(xs_cfg.emulateFilters);
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
     if (!engine->config.sidEmulation->getStatus())
 #else
     if (!*(engine->config.sidEmulation))
@@ -392,7 +392,7 @@
 
     XSDEBUG("%s\n", engine->config.sidEmulation->credits());
 
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
     engine->emu.setRoms(xs_rom_imagedata[0], xs_rom_imagedata[1], xs_rom_imagedata[2]);
 #endif
 
@@ -403,7 +403,7 @@
 
     engine->tune.read(buf, bufSize);
     
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
     if (!engine->tune.getStatus())
 #else
     if (!engine->tune)
@@ -484,7 +484,17 @@
 
     /* Get general tune information */
     {
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V11)
+    const SidTuneInfo *info = tune->getInfo();
+
+    res = xs_tuneinfo_new(filename,
+        info->songs(), info->startSong(),
+        info->infoString(0), info->infoString(1), info->infoString(2),
+        info->loadAddr(), info->initAddr(), info->playAddr(),
+        info->dataFileLen(), info->formatString(),
+        info->sidModel(1), info->sidModel(2)
+        );
+#elif defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
     const SidTuneInfo *info = tune->getInfo();
 
     res = xs_tuneinfo_new(filename,
@@ -528,14 +538,19 @@
 
     engine = (XSSIDPlayFP *) state->internal;
 
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
     if (!engine->tune.getStatus())
         return FALSE;
 
     const SidTuneInfo *info = engine->tune.getInfo();
 
+#if defined(HAVE_SIDPLAYFP_V11)
+    state->tuneInfo->sidModel1 = info->sidModel(1);
+    state->tuneInfo->sidModel2 = info->sidModel(2);
+#else
     state->tuneInfo->sidModel1 = info->sidModel1();
     state->tuneInfo->sidModel2 = info->sidModel2();
+#endif
 
     if (state->currSong > 0 && state->currSong <= state->tuneInfo->nsubTunes)
     {