public static class MSPackException extends IOException { public MSPackException(String s) { super(s); } }
- private static synchronized byte[] getImage() {
+ private static synchronized byte[] getImage() throws IOException {
if (image == null)
image = InputStreamToByteArray.convert(Main.builtin.getInputStream("libmspack.mips"));
return image;
System.out.println("" + fileNames[i]);
vm.copyin(vm.memRead(addr+4),data[i],length);
}
- } catch(VM.EmulationException e) {
+ } catch(Exception e) {
e.printStackTrace();
throw new MSPackException("mspack.mips crashed");
}
public String[] getFileNames() { return fileNames; }
public int[] getLengths() { return lengths; }
- public InputStream getInputStream(int index) { return new ByteArrayInputStream(data[index]); }
+ public InputStream getInputStream(int index) {
+ return new KnownLength.KnownLengthInputStream(new ByteArrayInputStream(data[index]), data[index].length);
+ }
public InputStream getInputStream(String fileName) {
for(int i=0;i<fileNames.length;i++) {
if(fileName.equalsIgnoreCase(fileNames[i])) return getInputStream(i);