Happy New Year 2017 to all of you.

Sidplay plugin together with libsidplayfp is not able to play tunes which require rom images. Such as MUSICIANS/W/Welle_Erdball/Monoton_und_Minimal.sid from High Voltage Sid Collection. I would like to introduce some new configuration parameters like "kernal", "basic" and "chargen". Code refers to libsidplayfp documentation.

--- SidplayDecoderPlugin.cxx.old    2016-11-24 15:16:54.476000000 +0100
+++ SidplayDecoderPlugin.cxx    2017-01-02 19:07:44.416000000 +0100
@@ -40,6 +40,7 @@
 #include <sidplayfp/builders/resid.h>
 #include <sidplayfp/builders/residfp.h>
 #include <sidplayfp/SidDatabase.h>
+#include <fstream>
 #else
 #include <sidplay/sidplay2.h>
 #include <sidplay/builders/resid.h>
@@ -61,6 +62,27 @@
 
 static bool filter_setting;
 
+static const char* kernal_path;
+static const char* basic_path;
+static const char* chargen_path;
+
+/*
+ * Load ROM dump from file.
+ * Allocate the buffer if file exists, otherwise return 0.
+ */
+static char* loadRom(const char* path, size_t romSize)
+{
+    char* buffer = 0;
+    std::ifstream rom(path, std::ios::binary);
+    if (rom.good())
+    {
+        buffer = new char[romSize];
+        rom.read(buffer, romSize);
+    }
+    rom.close();
+    return buffer;
+}
+
 static SidDatabase *
 sidplay_load_songlength_db(const Path path)
 {
@@ -96,6 +118,9 @@
 
     filter_setting = block.GetBlockValue("filter", true);
 
+    kernal_path = block.GetBlockValue("kernal");
+    basic_path = block.GetBlockValue("basic");
+    chargen_path = block.GetBlockValue("chargen");
     return true;
 }
 
@@ -198,6 +223,18 @@
 
 #ifdef HAVE_SIDPLAYFP
     sidplayfp player;
+
+    /* Load ROM files */
+    char *kernal = loadRom(kernal_path, 8192);
+    char *basic = loadRom(basic_path, 8192);
+    char *chargen = loadRom(chargen_path, 4096);
+
+    player.setRoms((const uint8_t*)kernal, (const uint8_t*)basic,
+        (const uint8_t*)chargen);
+
+    delete [] kernal;
+    delete [] basic;
+    delete [] chargen;
 #else
     sidplay2 player;
 #endif

_______________________________________________
mpd-devel mailing list
mpd-devel@musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel

Reply via email to