Mercurial > audlegacy-plugins
diff src/adplug/core/adtrack.cxx @ 703:cae46214b8bf trunk
[svn] - rework AdPlug to use VFS properly
see http://sacredspiral.co.uk/~nenolod/adplug-vfs-ng.diff for a diff.
author | nenolod |
---|---|
date | Fri, 23 Feb 2007 20:23:34 -0800 |
parents | 3da1b8942b8b |
children | 4709ce4e209e |
line wrap: on
line diff
--- a/src/adplug/core/adtrack.cxx Thu Feb 22 07:19:39 2007 -0800 +++ b/src/adplug/core/adtrack.cxx Fri Feb 23 20:23:34 2007 -0800 @@ -42,15 +42,16 @@ return new CadtrackLoader(newopl); } -bool CadtrackLoader::load(const std::string &filename, const CFileProvider &fp) +bool CadtrackLoader::load(VFSFile *fd, const CFileProvider &fp) { - binistream *f = fp.open(filename); if(!f) return false; + binistream *f = fp.open(fd); if(!f) return false; binistream *instf; char note[2]; unsigned short rwp; unsigned char chp, octave, pnote = 0; int i,j; AdTrackInst myinst; + std::string filename(fd->uri); // file validation if(!fp.extension(filename, ".sng") || fp.filesize(f) != 36000) @@ -61,8 +62,10 @@ instfilename += ".ins"; AdPlug_LogWrite("CadtrackLoader::load(,\"%s\"): Checking for \"%s\"...\n", filename.c_str(), instfilename.c_str()); - instf = fp.open(instfilename); - if(!instf || fp.filesize(instf) != 468) { fp.close(f); return false; } + + VFSFile *instfd = vfs_fopen(instfilename.c_str(), "rb"); + instf = fp.open(instfd); + if(!instf || fp.filesize(instf) != 468) { fp.close(f); vfs_fclose(instfd); return false; } // give CmodPlayer a hint on what we're up to realloc_patterns(1,1000,9); realloc_instruments(9); realloc_order(1);