Example #1
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;
  }
Example #2
0
  @Override
  public boolean loadInfo(FileSource fs) {
    tagMap = PSFFile.getTags(fs.getData(), (int) fs.getLength());

    if (tagMap == null) {
      return false;
    }

    infoMap.put(INFO_TITLE, tagMap.get("title"));
    infoMap.put(INFO_GAME, tagMap.get("game"));
    infoMap.put(INFO_COPYRIGHT, tagMap.get("copyright"));
    infoMap.put(INFO_LENGTH, tagMap.get("length"));
    infoMap.put(INFO_AUTHOR, tagMap.get("artist"));
    infoMap.put(INFO_YEAR, tagMap.get("year"));
    return true;
  }
Example #3
0
  @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);
  }
Example #4
0
 @Override
 public boolean canHandle(FileSource fs) {
   extension = fs.getExt().toUpperCase();
   return fs.getExt().equals("2SF") || fs.getExt().equals("MINI2SF");
 }