1 package org.xwt.translators;
5 import java.util.zip.*;
11 private static org.xwt.mips.Interpreter vm = null;
13 public static synchronized void unpack(InputStream theCabFile) {
16 InputStream bis = Platform.getBuiltinInputStream();
17 ZipInputStream zis = new ZipInputStream(bis);
18 for(ZipEntry ze = zis.getNextEntry(); ze != null && !ze.getName().equals("libmspack.mips"); ze = zis.getNextEntry()) { }
19 byte[] image = InputStreamToByteArray.convert(zis);
20 vm = new org.xwt.mips.Interpreter(image);
21 vm.start(new String[]{ "libmspack.mips" });
25 int CAB_RESERVED = 256*1024;
26 int baseAddr = vm.sbrk(CAB_RESERVED);
28 byte[] cabstream = InputStreamToByteArray.convert(theCabFile);
29 vm.copyout(cabstream, baseAddr, cabstream.length);
30 vm.setUserInfo(0, baseAddr);
31 vm.setUserInfo(1, cabstream.length);
34 // FIXME: do more stuff here
36 } catch (Exception e) {
37 Log.log(MSPack.class, e);