@Override public boolean load(FileSource fs) { tagMap = PSFFile.getTags(fs.getData(), (int) fs.getLength()); if (tagMap == null) { return false; } String libName = tagMap.get("_lib"); FileSource lib_fs = null; if (libName != null) { lib_fs = fs.getRelative(libName); lib_fs.getFile(); lib_fs.close(); } songRef = N_load(fs.getFile().getPath()); return (songRef != 0); }
@Override public boolean load(FileSource fs) { // currentTune = 0; if (!libraryLoaded) { System.loadLibrary("vice"); if (unzipper != null) { while (!unzipper.checkJob("vice.zip")) { try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); return false; } } unzipper = null; } N_setDataDir(new File(dataDir, "VICE").getAbsolutePath()); for (Entry<Integer, Integer> e : optMap.entrySet()) { N_setOption(e.getKey(), e.getValue()); } optMap.clear(); libraryLoaded = true; } final String error; // try { // File file = File.createTempFile("tmp-XXXXX", "sid"); // FileOutputStream fo = new FileOutputStream(file); // fo.write(fs.getContents()); // fo.close(); error = N_loadFile(fs.getFile().getAbsolutePath()); // file.delete(); // } // catch (IOException ie) { // throw new RuntimeException(ie); // } if (error != null) { Log.i(TAG, "Native code error: " + error); return false; } fs.close(); return true; }