diff options
author | waker <wakeroid@gmail.com> | 2011-02-01 20:14:39 +0100 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2011-02-01 20:14:39 +0100 |
commit | cb26c00e37ad876f2d3f0f5704e323bf6d47ec48 (patch) | |
tree | 183991f6867b98a1518d0698f80c87a2492facaa /plugins | |
parent | 3beb907821ef4788e1daefa756185e7eec317230 (diff) |
added vfs support to sid plugin
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/sid/csid.cpp | 6 | ||||
-rw-r--r-- | plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTune.cpp | 13 |
2 files changed, 10 insertions, 9 deletions
diff --git a/plugins/sid/csid.cpp b/plugins/sid/csid.cpp index 80236854..6583761e 100644 --- a/plugins/sid/csid.cpp +++ b/plugins/sid/csid.cpp @@ -53,7 +53,7 @@ extern DB_decoder_t sid_plugin; //#define trace(...) { fprintf(stderr, __VA_ARGS__); } #define trace(fmt,...) -static DB_functions_t *deadbeef; +DB_functions_t *deadbeef; #define min(x,y) ((x)<(y)?(x):(y)) #define max(x,y) ((x)>(y)?(x):(y)) @@ -302,11 +302,11 @@ csid_init (DB_fileinfo_t *_info, DB_playItem_t *it) { // libsidplay crashes if file doesn't exist // so i have to check it here - FILE *fp = fopen (it->fname, "rb"); + DB_FILE *fp = deadbeef->fopen (it->fname); if (!fp ){ return -1; } - fclose (fp); + deadbeef->fclose (fp); info->sidplay = new sidplay2; info->resid = new ReSIDBuilder ("wtf"); diff --git a/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTune.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTune.cpp index 4dfba1d7..fdbd64e1 100644 --- a/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTune.cpp +++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTune.cpp @@ -25,6 +25,7 @@ #include "sidendian.h" #include "PP20.h" #include <stdio.h> +#include "../../../../../../../deadbeef.h" #ifdef HAVE_EXCEPTIONS # include <new> @@ -32,6 +33,8 @@ #include <string.h> #include <limits.h> +extern DB_functions_t *deadbeef; + #if defined(HAVE_IOS_OPENMODE) typedef std::ios::openmode openmode; #else @@ -252,7 +255,7 @@ bool SidTune::loadFile(const char* fileName, Buffer_sidtt<const uint_least8_t>& Buffer_sidtt<uint_least8_t> fileBuf; uint_least32_t fileLen = 0; - FILE *fp = fopen (fileName, "rb"); + DB_FILE *fp = deadbeef->fopen (fileName); if (!fp) { @@ -261,9 +264,7 @@ bool SidTune::loadFile(const char* fileName, Buffer_sidtt<const uint_least8_t>& } else { - fseek (fp, 0, SEEK_END); - fileLen = ftell (fp); - rewind (fp); + fileLen = deadbeef->fgetlength(fp); #ifdef HAVE_EXCEPTIONS if ( !fileBuf.assign(new(std::nothrow) uint_least8_t[fileLen],fileLen) ) #else @@ -274,7 +275,7 @@ bool SidTune::loadFile(const char* fileName, Buffer_sidtt<const uint_least8_t>& return false; } uint_least32_t restFileLen = fileLen; - int res = fread((char*)fileBuf.get()+(fileLen-restFileLen),1,restFileLen,fp); + int res = deadbeef->fread((char*)fileBuf.get()+(fileLen-restFileLen),1,restFileLen,fp); if ( res != restFileLen ) { info.statusString = SidTune::txt_cantLoadFile; @@ -285,7 +286,7 @@ bool SidTune::loadFile(const char* fileName, Buffer_sidtt<const uint_least8_t>& info.statusString = SidTune::txt_noErrors; } } - fclose(fp); + deadbeef->fclose(fp); if ( fileLen==0 ) { info.statusString = SidTune::txt_empty; |