diff options
author | Max Kellermann <max@musicpd.org> | 2018-08-14 19:01:22 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-08-14 19:02:37 +0200 |
commit | f6b3a8872398650a6ba32145eb9d59cf637bf9b7 (patch) | |
tree | e3abbc0b2b5de211576280b91e53714b435847d7 /src/decoder | |
parent | c46483a4ab2fe0f206473f4907ec35044d18c30a (diff) | |
parent | 82e8913c052b9cdb42fb549a9f00daa95fe43976 (diff) |
Merge branch 'master' of git://github.com/skidoo23/MPD
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/plugins/SidplayDecoderPlugin.cxx | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/decoder/plugins/SidplayDecoderPlugin.cxx b/src/decoder/plugins/SidplayDecoderPlugin.cxx index 663360dc1..ce154399f 100644 --- a/src/decoder/plugins/SidplayDecoderPlugin.cxx +++ b/src/decoder/plugins/SidplayDecoderPlugin.cxx @@ -1,5 +1,5 @@ /* - * Copyright 2003-2017 The Music Player Daemon Project + * Copyright 2003-2018 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -25,6 +25,10 @@ #include "song/DetachedSong.hxx" #include "fs/Path.hxx" #include "fs/AllocatedPath.hxx" +#ifdef HAVE_SIDPLAYFP +#include "fs/io/FileReader.cxx" +#include "util/RuntimeError.hxx" +#endif #include "util/Macros.hxx" #include "util/StringFormat.hxx" #include "util/Domain.hxx" @@ -65,6 +69,21 @@ static unsigned default_songlength; static bool filter_setting; +#ifdef HAVE_SIDPLAYFP +static constexpr unsigned rom_size = 8192; +static uint8_t *kernal, *basic = nullptr; + +static void loadRom(const Path rom_path, uint8_t *dump) +{ + FileReader romDump(rom_path); + if (romDump.Read(dump, rom_size) != rom_size) + { + throw FormatRuntimeError + ("Could not load rom dump '%s'", rom_path.c_str()); + } +} +#endif + static SidDatabase * sidplay_load_songlength_db(const Path path) { @@ -100,6 +119,24 @@ sidplay_init(const ConfigBlock &block) filter_setting = block.GetBlockValue("filter", true); +#ifdef HAVE_SIDPLAYFP + /* read kernal rom dump file */ + const auto kernal_path = block.GetPath("kernal"); + if (!kernal_path.IsNull()) + { + kernal = new uint8_t[rom_size]; + loadRom(kernal_path, kernal); + } + + /* read basic rom dump file */ + const auto basic_path = block.GetPath("basic"); + if (!basic_path.IsNull()) + { + basic = new uint8_t[rom_size]; + loadRom(basic_path, basic); + } +#endif + return true; } @@ -107,6 +144,11 @@ static void sidplay_finish() noexcept { delete songlength_database; + +#ifdef HAVE_SIDPLAYFP + delete[] basic; + delete[] kernal; +#endif } struct SidplayContainerPath { @@ -202,6 +244,8 @@ sidplay_file_decode(DecoderClient &client, Path path_fs) #ifdef HAVE_SIDPLAYFP sidplayfp player; + + player.setRoms(kernal, basic, nullptr); #else sidplay2 player; #endif |