From: megacz Date: Fri, 30 Jan 2004 07:38:31 +0000 (+0000) Subject: 2003/09/28 00:43:30 X-Git-Tag: RC3~522 X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=commitdiff_plain;h=a071a56b6d9c9d38b85d23cc3eb287435322d0cc 2003/09/28 00:43:30 darcs-hash:20040130073831-2ba56-7240518c18064ccc06efc1f67a1c4be095866f1f.gz --- diff --git a/src/org/xwt/Glyph.java b/src/org/xwt/Glyph.java index 6840f65..e998845 100644 --- a/src/org/xwt/Glyph.java +++ b/src/org/xwt/Glyph.java @@ -20,8 +20,8 @@ public class Glyph { if (ret != null) return ret; // FEATURE: be smarter here - if (c < 256) Font.renderGlyphs(res, pointsize, 0, 255, glyphCache); - else Font.renderGlyphs(res, pointsize, (int)c, (int)c, glyphCache); + if (c < 256) Freetype.renderGlyphs(res, pointsize, 0, 255, glyphCache); + else Freetype.renderGlyphs(res, pointsize, (int)c, (int)c, glyphCache); ret = (Glyph)glyphCache.get(res, new Integer((((int)c) << 16) | pointsize)); if (ret != null) return ret; diff --git a/src/org/xwt/translators/Font.java b/src/org/xwt/translators/Freetype.java similarity index 96% rename from src/org/xwt/translators/Font.java rename to src/org/xwt/translators/Freetype.java index de71002..ccb3004 100644 --- a/src/org/xwt/translators/Font.java +++ b/src/org/xwt/translators/Freetype.java @@ -6,9 +6,9 @@ import java.util.zip.*; // FEATURE: use streams, not memoryfont's // FEATURE: kerning pairs -public class Font { +public class Freetype { - Font() { } + Freetype() { } private static org.xwt.mips.Interpreter vm = null; @@ -67,7 +67,7 @@ public class Font { glyphCache.put(res, new Integer((g << 16) | pointsize), glyph); } } catch (Exception e) { - Log.log(Font.class, e); + Log.log(Freetype.class, e); } } } diff --git a/src/org/xwt/translators/MSPack.c b/src/org/xwt/translators/MSPack.c new file mode 100644 index 0000000..42bafcf --- /dev/null +++ b/src/org/xwt/translators/MSPack.c @@ -0,0 +1,16 @@ +// Copyright 2003 Adam Megacz, see the COPYING file for licensing [GPL] + +/* NOTE: _user_info is defined in crt0.c. It points to a 4096 byte + block of memory that contains 1024 32-bit values that can be set + with the setUserInfo() method of MIPSEmu. + + The VM will pause after initialization. When unpaused, it expects + that: + + FIXME + +*/ + +int main(int argc, char** argv) { + // FIXME: do some cool stuff here +} diff --git a/src/org/xwt/translators/MSPack.java b/src/org/xwt/translators/MSPack.java new file mode 100644 index 0000000..00316de --- /dev/null +++ b/src/org/xwt/translators/MSPack.java @@ -0,0 +1,40 @@ +package org.xwt.translators; +import org.xwt.*; +import org.xwt.util.*; +import java.io.*; +import java.util.zip.*; + +public class MSPack { + + MSPack() { } + + private static org.xwt.mips.Interpreter vm = null; + + public static synchronized void unpack(InputStream theCabFile) { + try { + if (vm == null) { + InputStream bis = Platform.getBuiltinInputStream(); + ZipInputStream zis = new ZipInputStream(bis); + for(ZipEntry ze = zis.getNextEntry(); ze != null && !ze.getName().equals("libmspack.mips"); ze = zis.getNextEntry()) { } + byte[] image = InputStreamToByteArray.convert(zis); + vm = new org.xwt.mips.Interpreter(image); + vm.start(new String[]{ "libmspack.mips" }); + vm.execute(); + } + + int CAB_RESERVED = 256*1024; + int baseAddr = vm.sbrk(CAB_RESERVED); + + byte[] cabstream = InputStreamToByteArray.convert(theCabFile); + vm.copyout(cabstream, baseAddr, cabstream.length); + vm.setUserInfo(0, baseAddr); + vm.setUserInfo(1, cabstream.length); + + vm.execute(); + // FIXME: do more stuff here + + } catch (Exception e) { + Log.log(MSPack.class, e); + } + } +}