2003/11/16 08:28:10
[org.ibex.core.git] / src / org / xwt / translators / MSPack.java
index 2ad52d2..3275bb9 100644 (file)
@@ -14,7 +14,7 @@ public class MSPack {
         
     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;
@@ -58,7 +58,7 @@ public class MSPack {
                 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");
         }
@@ -66,7 +66,9 @@ public class MSPack {
     
     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);