зеркало из https://github.com/mozilla/pluotsorbet.git
Fix get class info.
This commit is contained in:
Родитель
d49c18ff56
Коммит
c6ea0a6287
|
@ -147,13 +147,13 @@ Instrument.enter["com/sun/midp/ssl/SSLStreamConnection.<init>.(Ljava/lang/String
|
|||
|
||||
Instrument.enter["com/sun/midp/ssl/Out.write.(I)V"] = function(caller, callee) {
|
||||
var _this = caller.stack.read(3);
|
||||
var connection = _this.class.getField("I.ssc.Lcom/sun/midp/ssl/SSLStreamConnection;").get(_this);
|
||||
var connection = _this.klass.classInfo.getField("I.ssc.Lcom/sun/midp/ssl/SSLStreamConnection;").get(_this);
|
||||
connection.logBuffer += String.fromCharCode(callee.stack.read(1));
|
||||
};
|
||||
|
||||
Instrument.enter["com/sun/midp/ssl/Out.write.([BII)V"] = function(caller, callee) {
|
||||
var len = caller.stack.read(1), off = caller.stack.read(2), b = caller.stack.read(3), _this = caller.stack.read(4);
|
||||
var connection = _this.class.getField("I.ssc.Lcom/sun/midp/ssl/SSLStreamConnection;").get(_this);
|
||||
var connection = _this.klass.classInfo.getField("I.ssc.Lcom/sun/midp/ssl/SSLStreamConnection;").get(_this);
|
||||
var range = b.subarray(off, off + len);
|
||||
for (var i = 0; i < range.length; i++) {
|
||||
connection.logBuffer += String.fromCharCode(range[i] & 0xff);
|
||||
|
@ -165,13 +165,13 @@ Instrument.exit["com/sun/midp/ssl/In.read.()I"] = function(caller, callee) {
|
|||
// stack differs depending on whether or not In.read threw an exception.
|
||||
var _this = caller.stack[2];
|
||||
|
||||
var connection = _this.class.getField("I.ssc.Lcom/sun/midp/ssl/SSLStreamConnection;").get(_this);
|
||||
var connection = _this.klass.classInfo.getField("I.ssc.Lcom/sun/midp/ssl/SSLStreamConnection;").get(_this);
|
||||
connection.logBuffer += String.fromCharCode(callee.stack.read(1));
|
||||
};
|
||||
|
||||
Instrument.exit["com/sun/midp/ssl/In.read.([BII)I"] = function(caller, callee) {
|
||||
var len = caller.stack.read(4), off = caller.stack.read(5), b = caller.stack.read(6), _this = caller.stack.read(7);
|
||||
var connection = _this.class.getField("I.ssc.Lcom/sun/midp/ssl/SSLStreamConnection;").get(_this);
|
||||
var connection = _this.klass.classInfo.getField("I.ssc.Lcom/sun/midp/ssl/SSLStreamConnection;").get(_this);
|
||||
var range = b.subarray(off, off + len);
|
||||
for (var i = 0; i < range.length; i++) {
|
||||
connection.logBuffer += String.fromCharCode(range[i] & 0xff);
|
||||
|
|
|
@ -210,7 +210,7 @@ Native.create("com/sun/midp/rms/RecordStoreSharedDBHeader.getHeaderRefCount0.(I)
|
|||
});
|
||||
|
||||
Native.create("com/sun/midp/rms/RecordStoreSharedDBHeader.cleanup0.()V", function() {
|
||||
var lookupId = this.class.getField("I.lookupId.I").get(this);
|
||||
var lookupId = this.klass.classInfo.getField("I.lookupId.I").get(this);
|
||||
if (MIDP.RecordStoreCache[lookupId] &&
|
||||
--MIDP.RecordStoreCache[lookupId].refCount <= 0) {
|
||||
// Set to null instead of removing from array to maintain
|
||||
|
|
106
midp/gfx.js
106
midp/gfx.js
|
@ -124,8 +124,8 @@
|
|||
}
|
||||
|
||||
function setImageData(imageData, width, height, data) {
|
||||
imageData.class.getField("I.width.I").set(imageData, width);
|
||||
imageData.class.getField("I.height.I").set(imageData, height);
|
||||
imageData.klass.classInfo.getField("I.width.I").set(imageData, width);
|
||||
imageData.klass.classInfo.getField("I.height.I").set(imageData, height);
|
||||
imageData.nativeImageData = data;
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@
|
|||
context.drawImage(dataSource.nativeImageData, x, y, width, height, 0, 0, width, height);
|
||||
|
||||
setImageData(dataDest, width, height, context);
|
||||
dataDest.class.getField("I.isMutable.Z").set(dataDest, isMutable);
|
||||
dataDest.klass.classInfo.getField("I.isMutable.Z").set(dataDest, isMutable);
|
||||
});
|
||||
|
||||
Native.create("javax/microedition/lcdui/ImageDataFactory.createMutableImageData.(Ljavax/microedition/lcdui/ImageData;II)V",
|
||||
|
@ -206,14 +206,14 @@
|
|||
});
|
||||
|
||||
Native.create("com/nokia/mid/ui/DirectUtils.makeMutable.(Ljavax/microedition/lcdui/Image;)V", function(image) {
|
||||
var imageData = image.class.getField("I.imageData.Ljavax/microedition/lcdui/ImageData;").get(image);
|
||||
imageData.class.getField("I.isMutable.Z").set(imageData, 1);
|
||||
var imageData = image.klass.classInfo.getField("I.imageData.Ljavax/microedition/lcdui/ImageData;").get(image);
|
||||
imageData.klass.classInfo.getField("I.isMutable.Z").set(imageData, 1);
|
||||
});
|
||||
|
||||
Native.create("com/nokia/mid/ui/DirectUtils.setPixels.(Ljavax/microedition/lcdui/Image;I)V", function(image, argb) {
|
||||
var width = image.class.getField("I.width.I").get(image);
|
||||
var height = image.class.getField("I.height.I").get(image);
|
||||
var imageData = image.class.getField("I.imageData.Ljavax/microedition/lcdui/ImageData;").get(image);
|
||||
var width = image.klass.classInfo.getField("I.width.I").get(image);
|
||||
var height = image.klass.classInfo.getField("I.height.I").get(image);
|
||||
var imageData = image.klass.classInfo.getField("I.imageData.Ljavax/microedition/lcdui/ImageData;").get(image);
|
||||
|
||||
var ctx = createContext2d(width, height);
|
||||
setImageData(imageData, width, height, ctx);
|
||||
|
@ -268,8 +268,8 @@
|
|||
else
|
||||
face = "Arial, Helvetica, sans-serif";
|
||||
|
||||
this.class.getField("I.baseline.I").set(this, (size/2)|0);
|
||||
this.class.getField("I.height.I").set(this, (size * 1.3)|0);
|
||||
this.klass.classInfo.getField("I.baseline.I").set(this, (size/2)|0);
|
||||
this.klass.classInfo.getField("I.height.I").set(this, (size * 1.3)|0);
|
||||
this.css = style + " " + size + "pt " + face;
|
||||
});
|
||||
|
||||
|
@ -298,26 +298,26 @@
|
|||
var BASELINE = 64;
|
||||
|
||||
function withGraphics(g, cb) {
|
||||
var img = g.class.getField("I.img.Ljavax/microedition/lcdui/Image;").get(g),
|
||||
var img = g.klass.classInfo.getField("I.img.Ljavax/microedition/lcdui/Image;").get(g),
|
||||
c = null;
|
||||
|
||||
if (img === null) {
|
||||
c = MIDP.Context2D;
|
||||
} else {
|
||||
var imgData = img.class.getField("I.imageData.Ljavax/microedition/lcdui/ImageData;").get(img),
|
||||
var imgData = img.klass.classInfo.getField("I.imageData.Ljavax/microedition/lcdui/ImageData;").get(img),
|
||||
c = imgData.nativeImageData;
|
||||
}
|
||||
cb(c);
|
||||
}
|
||||
|
||||
function withClip(g, c, x, y, cb) {
|
||||
var clipX1 = g.class.getField("I.clipX1.S").get(g),
|
||||
clipY1 = g.class.getField("I.clipY1.S").get(g),
|
||||
clipX2 = g.class.getField("I.clipX2.S").get(g),
|
||||
clipY2 = g.class.getField("I.clipY2.S").get(g),
|
||||
clipped = g.class.getField("I.clipped.Z").get(g),
|
||||
transX = g.class.getField("I.transX.I").get(g),
|
||||
transY = g.class.getField("I.transY.I").get(g);
|
||||
var clipX1 = g.klass.classInfo.getField("I.clipX1.S").get(g),
|
||||
clipY1 = g.klass.classInfo.getField("I.clipY1.S").get(g),
|
||||
clipX2 = g.klass.classInfo.getField("I.clipX2.S").get(g),
|
||||
clipY2 = g.klass.classInfo.getField("I.clipY2.S").get(g),
|
||||
clipped = g.klass.classInfo.getField("I.clipped.Z").get(g),
|
||||
transX = g.klass.classInfo.getField("I.transX.I").get(g),
|
||||
transY = g.klass.classInfo.getField("I.transY.I").get(g);
|
||||
c.save();
|
||||
if (clipped) {
|
||||
c.beginPath();
|
||||
|
@ -350,7 +350,7 @@
|
|||
|
||||
function withTextAnchor(g, c, anchor, x, y, str, cb) {
|
||||
withClip(g, c, x, y, function(x, y) {
|
||||
var w = withFont(g.class.getField("I.currentFont.Ljavax/microedition/lcdui/Font;").get(g), c, str);
|
||||
var w = withFont(g.klass.classInfo.getField("I.currentFont.Ljavax/microedition/lcdui/Font;").get(g), c, str);
|
||||
c.textAlign = "left";
|
||||
c.textBaseline = "top";
|
||||
if (anchor & RIGHT)
|
||||
|
@ -376,7 +376,7 @@
|
|||
};
|
||||
|
||||
function withPixel(g, c, cb) {
|
||||
var pixel = g.class.getField("I.pixel.I").get(g);
|
||||
var pixel = g.klass.classInfo.getField("I.pixel.I").get(g);
|
||||
c.save();
|
||||
c.fillStyle = c.strokeStyle = abgrIntToCSS(pixel);
|
||||
cb();
|
||||
|
@ -438,7 +438,7 @@
|
|||
* incorrectly, although we should actually figure out why that's happening.
|
||||
*/
|
||||
function withOpaquePixel(g, c, cb) {
|
||||
var pixel = g.class.getField("I.pixel.I").get(g);
|
||||
var pixel = g.klass.classInfo.getField("I.pixel.I").get(g);
|
||||
c.save();
|
||||
var b = (pixel >> 16) & 0xff;
|
||||
var g = (pixel >> 8) & 0xff;
|
||||
|
@ -458,7 +458,7 @@
|
|||
}
|
||||
|
||||
function renderImage(graphics, image, x, y, anchor) {
|
||||
var texture = image.class.getField("I.imageData.Ljavax/microedition/lcdui/ImageData;").get(image).nativeImageData;
|
||||
var texture = image.klass.classInfo.getField("I.imageData.Ljavax/microedition/lcdui/ImageData;").get(image).nativeImageData;
|
||||
|
||||
if (!texture) {
|
||||
console.warn("Graphics.render: image missing native data");
|
||||
|
@ -482,48 +482,48 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var transX = g.class.getField("I.transX.I");
|
||||
var transY = g.class.getField("I.transY.I");
|
||||
var transX = g.klass.classInfo.getField("I.transX.I");
|
||||
var transY = g.klass.classInfo.getField("I.transY.I");
|
||||
|
||||
transX.set(g, transX.get(g) + x);
|
||||
transY.set(g, transY.get(g) + y);
|
||||
|
||||
// Top Border
|
||||
var iW = image[1].class.getField("I.width.I").get(image[1]);
|
||||
var iW = image[1].klass.classInfo.getField("I.width.I").get(image[1]);
|
||||
renderImage(g, image[0], 0, 0, LEFT | TOP);
|
||||
w -= image[2].class.getField("I.width.I").get(image[2]);
|
||||
for (var i = image[0].class.getField("I.width.I").get(image[0]); i < w; i += iW) {
|
||||
w -= image[2].klass.classInfo.getField("I.width.I").get(image[2]);
|
||||
for (var i = image[0].klass.classInfo.getField("I.width.I").get(image[0]); i < w; i += iW) {
|
||||
renderImage(g, image[1], i, 0, LEFT | TOP);
|
||||
}
|
||||
w += image[2].class.getField("I.width.I").get(image[2]);
|
||||
w += image[2].klass.classInfo.getField("I.width.I").get(image[2]);
|
||||
renderImage(g, image[2], w, 0, RIGHT | TOP);
|
||||
|
||||
// Tile middle rows
|
||||
if (image[4] != null) {
|
||||
iW = image[4].class.getField("I.width.I").get(image[4]);
|
||||
iW = image[4].klass.classInfo.getField("I.width.I").get(image[4]);
|
||||
}
|
||||
var iH = image[3].class.getField("I.height.I").get(image[3]);
|
||||
h -= image[6].class.getField("I.height.I").get(image[6]);
|
||||
w -= image[5].class.getField("I.width.I").get(image[5]);
|
||||
for (var i = image[0].class.getField("I.height.I").get(image[0]); i <= h; i += iH) {
|
||||
var iH = image[3].klass.classInfo.getField("I.height.I").get(image[3]);
|
||||
h -= image[6].klass.classInfo.getField("I.height.I").get(image[6]);
|
||||
w -= image[5].klass.classInfo.getField("I.width.I").get(image[5]);
|
||||
for (var i = image[0].klass.classInfo.getField("I.height.I").get(image[0]); i <= h; i += iH) {
|
||||
renderImage(g, image[3], 0, i, LEFT | TOP);
|
||||
for (var j = image[3].class.getField("I.width.I").get(image[3]); j <= w; j += iW) {
|
||||
for (var j = image[3].klass.classInfo.getField("I.width.I").get(image[3]); j <= w; j += iW) {
|
||||
renderImage(g, image[4], j, i, LEFT | TOP);
|
||||
}
|
||||
renderImage(g, image[5], w + image[5].class.getField("I.width.I").get(image[5]), i,
|
||||
renderImage(g, image[5], w + image[5].klass.classInfo.getField("I.width.I").get(image[5]), i,
|
||||
RIGHT | TOP);
|
||||
}
|
||||
w += image[5].class.getField("I.width.I").get(image[5]);
|
||||
h += image[6].class.getField("I.height.I").get(image[6]);
|
||||
w += image[5].klass.classInfo.getField("I.width.I").get(image[5]);
|
||||
h += image[6].klass.classInfo.getField("I.height.I").get(image[6]);
|
||||
|
||||
// Bottom border
|
||||
iW = image[7].class.getField("I.width.I").get(image[7]);
|
||||
iW = image[7].klass.classInfo.getField("I.width.I").get(image[7]);
|
||||
renderImage(g, image[6], 0, h, LEFT | BOTTOM);
|
||||
w -= image[8].class.getField("I.width.I").get(image[8]);
|
||||
for (var i = image[6].class.getField("I.width.I").get(image[6]); i < w; i += iW) {
|
||||
w -= image[8].klass.classInfo.getField("I.width.I").get(image[8]);
|
||||
for (var i = image[6].klass.classInfo.getField("I.width.I").get(image[6]); i < w; i += iW) {
|
||||
renderImage(g, image[7], i, h, LEFT | BOTTOM);
|
||||
}
|
||||
w += image[8].class.getField("I.width.I").get(image[8]);
|
||||
w += image[8].klass.classInfo.getField("I.width.I").get(image[8]);
|
||||
renderImage(g, image[8], w, h, RIGHT | BOTTOM);
|
||||
|
||||
transX.set(g, transX.get(g) - x);
|
||||
|
@ -539,19 +539,19 @@
|
|||
});
|
||||
|
||||
Native.create("com/nokia/mid/ui/DirectGraphicsImp.setARGBColor.(I)V", function(rgba) {
|
||||
var g = this.class.getField("I.graphics.Ljavax/microedition/lcdui/Graphics;").get(this);
|
||||
var g = this.klass.classInfo.getField("I.graphics.Ljavax/microedition/lcdui/Graphics;").get(this);
|
||||
var red = (rgba >> 16) & 0xff;
|
||||
var green = (rgba >> 8) & 0xff;
|
||||
var blue = rgba & 0xff;
|
||||
g.class.getField("I.pixel.I").set(g, swapRB(rgba));
|
||||
g.class.getField("I.rgbColor.I").set(g, rgba & 0x00ffffff);
|
||||
g.klass.classInfo.getField("I.pixel.I").set(g, swapRB(rgba));
|
||||
g.klass.classInfo.getField("I.rgbColor.I").set(g, rgba & 0x00ffffff);
|
||||
// Conversion matches Graphics#grayVal(int, int, int).
|
||||
g.class.getField("I.gray.I").set(g, (red * 76 + green * 150 + blue * 29) >> 8);
|
||||
g.klass.classInfo.getField("I.gray.I").set(g, (red * 76 + green * 150 + blue * 29) >> 8);
|
||||
});
|
||||
|
||||
Native.create("com/nokia/mid/ui/DirectGraphicsImp.getAlphaComponent.()I", function() {
|
||||
var g = this.class.getField("I.graphics.Ljavax/microedition/lcdui/Graphics;").get(this);
|
||||
var pixel = g.class.getField("I.pixel.I").get(g);
|
||||
var g = this.klass.classInfo.getField("I.graphics.Ljavax/microedition/lcdui/Graphics;").get(this);
|
||||
var pixel = g.klass.classInfo.getField("I.pixel.I").get(g);
|
||||
return (pixel >> 24) & 0xff;
|
||||
});
|
||||
|
||||
|
@ -581,9 +581,9 @@
|
|||
throw new JavaException("java/lang/IllegalArgumentException", "Format unsupported");
|
||||
}
|
||||
|
||||
var graphics = this.class.getField("I.graphics.Ljavax/microedition/lcdui/Graphics;").get(this);
|
||||
var image = graphics.class.getField("I.img.Ljavax/microedition/lcdui/Image;").get(graphics);
|
||||
var imageData = image.class.getField("I.imageData.Ljavax/microedition/lcdui/ImageData;").get(image);
|
||||
var graphics = this.klass.classInfo.getField("I.graphics.Ljavax/microedition/lcdui/Graphics;").get(this);
|
||||
var image = graphics.klass.classInfo.getField("I.img.Ljavax/microedition/lcdui/Image;").get(graphics);
|
||||
var imageData = image.klass.classInfo.getField("I.imageData.Ljavax/microedition/lcdui/ImageData;").get(image);
|
||||
|
||||
contextToRgbData(convertNativeImageData(imageData), pixels, offset, scanlength, x, y, width, height, converterFunc);
|
||||
});
|
||||
|
@ -607,7 +607,7 @@
|
|||
throw new JavaException("java/lang/IllegalArgumentException", "Format unsupported");
|
||||
}
|
||||
|
||||
var graphics = this.class.getField("I.graphics.Ljavax/microedition/lcdui/Graphics;").get(this);
|
||||
var graphics = this.klass.classInfo.getField("I.graphics.Ljavax/microedition/lcdui/Graphics;").get(this);
|
||||
|
||||
var context = createContext2d(width, height);
|
||||
rgbDataToContext(context, pixels, offset, scanlength, converterFunc);
|
||||
|
@ -809,7 +809,7 @@
|
|||
throw new JavaException("java/lang/NullPointerException", "src image is null");
|
||||
}
|
||||
|
||||
var imgData = image.class.getField("I.imageData.Ljavax/microedition/lcdui/ImageData;").get(image),
|
||||
var imgData = image.klass.classInfo.getField("I.imageData.Ljavax/microedition/lcdui/ImageData;").get(image),
|
||||
texture = imgData.nativeImageData;
|
||||
|
||||
if (texture instanceof CanvasRenderingContext2D) {
|
||||
|
|
20
midp/midp.js
20
midp/midp.js
|
@ -235,12 +235,12 @@ Native.create("com/sun/midp/main/CldcPlatformRequest.dispatchPlatformRequest.(Lj
|
|||
|
||||
Native.create("com/sun/midp/main/CommandState.restoreCommandState.(Lcom/sun/midp/main/CommandState;)V", function(state) {
|
||||
var suiteId = (MIDP.midletClassName === "internal") ? -1 : 1;
|
||||
state.class.getField("I.suiteId.I").set(state, suiteId);
|
||||
state.class.getField("I.midletClassName.Ljava/lang/String;").set(state, util.newString(MIDP.midletClassName));
|
||||
state.klass.classInfo.getField("I.suiteId.I").set(state, suiteId);
|
||||
state.klass.classInfo.getField("I.midletClassName.Ljava/lang/String;").set(state, util.newString(MIDP.midletClassName));
|
||||
var args = urlParams.args;
|
||||
state.class.getField("I.arg0.Ljava/lang/String;").set(state, util.newString((args.length > 0) ? args[0] : ""));
|
||||
state.class.getField("I.arg1.Ljava/lang/String;").set(state, util.newString((args.length > 1) ? args[1] : ""));
|
||||
state.class.getField("I.arg2.Ljava/lang/String;").set(state, util.newString((args.length > 2) ? args[2] : ""));
|
||||
state.klass.classInfo.getField("I.arg0.Ljava/lang/String;").set(state, util.newString((args.length > 0) ? args[0] : ""));
|
||||
state.klass.classInfo.getField("I.arg1.Ljava/lang/String;").set(state, util.newString((args.length > 1) ? args[1] : ""));
|
||||
state.klass.classInfo.getField("I.arg2.Ljava/lang/String;").set(state, util.newString((args.length > 2) ? args[2] : ""));
|
||||
});
|
||||
|
||||
MIDP.domainTBL = [
|
||||
|
@ -690,7 +690,7 @@ Native.create("com/sun/midp/midletsuite/MIDletSuiteImpl.unlockMIDletSuite.(I)V",
|
|||
});
|
||||
|
||||
Native.create("com/sun/midp/midletsuite/SuiteSettings.load.()V", function() {
|
||||
this.class.getField("I.pushInterruptSetting.B").set(this, 1);
|
||||
this.klass.classInfo.getField("I.pushInterruptSetting.B").set(this, 1);
|
||||
console.warn("com/sun/midp/midletsuite/SuiteSettings.load.()V incomplete");
|
||||
});
|
||||
|
||||
|
@ -701,7 +701,7 @@ Native.create("com/sun/midp/midletsuite/SuiteSettings.save0.(IBI[B)V", function(
|
|||
|
||||
Native.create("com/sun/midp/midletsuite/InstallInfo.load.()V", function() {
|
||||
// The MIDlet has to be trusted for opening SSL connections using port 443.
|
||||
this.class.getField("I.trusted.Z").set(this, 1);
|
||||
this.klass.classInfo.getField("I.trusted.Z").set(this, 1);
|
||||
console.warn("com/sun/midp/midletsuite/InstallInfo.load.()V incomplete");
|
||||
});
|
||||
|
||||
|
@ -819,7 +819,7 @@ MIDP.waitingNativeEventQueue = {};
|
|||
|
||||
MIDP.copyEvent = function(obj, isolateId) {
|
||||
var e = MIDP.nativeEventQueues[isolateId].shift();
|
||||
obj.class.getField("I.type.I").set(obj, e.type);
|
||||
obj.klass.classInfo.getField("I.type.I").set(obj, e.type);
|
||||
obj.class.fields.forEach(function(field) {
|
||||
field.set(obj, e[field.name]);
|
||||
});
|
||||
|
@ -832,7 +832,7 @@ MIDP.deliverWaitForNativeEventResult = function(resolve, nativeEvent, isolateId)
|
|||
}
|
||||
|
||||
MIDP.sendEvent = function(obj, isolateId) {
|
||||
var e = { type: obj.class.getField("I.type.I").get(obj) };
|
||||
var e = { type: obj.klass.classInfo.getField("I.type.I").get(obj) };
|
||||
obj.class.fields.forEach(function(field) {
|
||||
e[field.name] = field.get(obj);
|
||||
});
|
||||
|
@ -972,7 +972,7 @@ Native.create("javax/microedition/lcdui/Display.drawTrustedIcon0.(IZ)V", functio
|
|||
|
||||
Native.create("com/sun/midp/events/EventQueue.sendShutdownEvent.()V", function(ctx) {
|
||||
var obj = util.newObject(CLASSES.getClass("com/sun/midp/events/NativeEvent"));
|
||||
obj.class.getField("I.type.I").set(obj, MIDP.EVENT_QUEUE_SHUTDOWN);
|
||||
obj.klass.classInfo.getField("I.type.I").set(obj, MIDP.EVENT_QUEUE_SHUTDOWN);
|
||||
MIDP.sendEvent(obj, ctx.runtime.isolate.id);
|
||||
});
|
||||
|
||||
|
|
|
@ -154,9 +154,9 @@ Native.create("com/sun/j2me/pim/PIMProxy.getFields0.(I[Lcom/sun/j2me/pim/PIMFiel
|
|||
console.warn("PIMProxy.getFields0.(I[Lcom/sun/j2me/pim/PIMFieldDescriptor;I)V incomplete");
|
||||
|
||||
PIM.supportedFields.forEach(function(field, i) {
|
||||
desc[i].class.getField("I.field.I").set(desc[i], field.field);
|
||||
desc[i].class.getField("I.dataType.I").set(desc[i], field.dataType);
|
||||
desc[i].class.getField("I.maxValues.I").set(desc[i], field.maxValues);
|
||||
desc[i].klass.classInfo.getField("I.field.I").set(desc[i], field.field);
|
||||
desc[i].klass.classInfo.getField("I.dataType.I").set(desc[i], field.dataType);
|
||||
desc[i].klass.classInfo.getField("I.maxValues.I").set(desc[i], field.maxValues);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
10
midp/sms.js
10
midp/sms.js
|
@ -98,11 +98,11 @@ function(port, msid, handle, smsPacket) {
|
|||
address[i] = addr.charCodeAt(i);
|
||||
}
|
||||
|
||||
smsPacket.class.getField("I.message.[B").set(smsPacket, message);
|
||||
smsPacket.class.getField("I.address.[B").set(smsPacket, address);
|
||||
smsPacket.class.getField("I.port.I").set(smsPacket, port);
|
||||
smsPacket.class.getField("I.sentAt.J").set(smsPacket, Long.fromNumber(Date.now()));
|
||||
smsPacket.class.getField("I.messageType.I").set(smsPacket, 0); // GSM_TEXT
|
||||
smsPacket.klass.classInfo.getField("I.message.[B").set(smsPacket, message);
|
||||
smsPacket.klass.classInfo.getField("I.address.[B").set(smsPacket, address);
|
||||
smsPacket.klass.classInfo.getField("I.port.I").set(smsPacket, port);
|
||||
smsPacket.klass.classInfo.getField("I.sentAt.J").set(smsPacket, Long.fromNumber(Date.now()));
|
||||
smsPacket.klass.classInfo.getField("I.messageType.I").set(smsPacket, 0); // GSM_TEXT
|
||||
|
||||
return text.length;
|
||||
}
|
||||
|
|
|
@ -473,7 +473,7 @@ Native.create("java/lang/Thread.start0.()V", function(ctx) {
|
|||
throw new JavaException("java/lang/IllegalThreadStateException");
|
||||
this.alive = true;
|
||||
this.pid = util.id();
|
||||
var run = CLASSES.getMethod(this.class, "I.run.()V");
|
||||
var run = CLASSES.getMethod(this.klass.classInfo, "I.run.()V");
|
||||
// Create a context for the thread and start it.
|
||||
var ctx = new Context(ctx.runtime);
|
||||
ctx.thread = this;
|
||||
|
@ -482,7 +482,7 @@ Native.create("java/lang/Thread.start0.()V", function(ctx) {
|
|||
name: "ThreadStart0Synthetic",
|
||||
signature: "()V",
|
||||
classInfo: {
|
||||
className: this.class.className,
|
||||
className: this.klass.classInfo.className,
|
||||
vmc: {},
|
||||
vfc: {},
|
||||
constant_pool: [
|
||||
|
|
16
override.js
16
override.js
|
@ -158,35 +158,35 @@ Override.create("java/io/ByteArrayOutputStream.write.([BII)V", function(b, off,
|
|||
return;
|
||||
}
|
||||
|
||||
var count = this.class.getField("I.count.I").get(this);
|
||||
var buf = this.class.getField("I.buf.[B").get(this);
|
||||
var count = this.klass.classInfo.getField("I.count.I").get(this);
|
||||
var buf = this.klass.classInfo.getField("I.buf.[B").get(this);
|
||||
|
||||
var newcount = count + len;
|
||||
if (newcount > buf.length) {
|
||||
var newbuf = J2ME.newByteArray(Math.max(buf.length << 1, newcount));
|
||||
newbuf.set(buf);
|
||||
buf = newbuf;
|
||||
this.class.getField("I.buf.[B").set(this, buf);
|
||||
this.klass.classInfo.getField("I.buf.[B").set(this, buf);
|
||||
}
|
||||
|
||||
buf.set(b.subarray(off, off + len), count);
|
||||
this.class.getField("I.count.I").set(this, newcount);
|
||||
this.klass.classInfo.getField("I.count.I").set(this, newcount);
|
||||
});
|
||||
|
||||
Override.create("java/io/ByteArrayOutputStream.write.(I)V", function(value) {
|
||||
var count = this.class.getField("I.count.I").get(this);
|
||||
var buf = this.class.getField("I.buf.[B").get(this);
|
||||
var count = this.klass.classInfo.getField("I.count.I").get(this);
|
||||
var buf = this.klass.classInfo.getField("I.buf.[B").get(this);
|
||||
|
||||
var newcount = count + 1;
|
||||
if (newcount > buf.length) {
|
||||
var newbuf = J2ME.newByteArray(Math.max(buf.length << 1, newcount));
|
||||
newbuf.set(buf);
|
||||
buf = newbuf;
|
||||
this.class.getField("I.buf.[B").set(this, buf);
|
||||
this.klass.classInfo.getField("I.buf.[B").set(this, buf);
|
||||
}
|
||||
|
||||
buf[count] = value;
|
||||
this.class.getField("I.count.I").set(this, newcount);
|
||||
this.klass.classInfo.getField("I.count.I").set(this, newcount);
|
||||
});
|
||||
|
||||
Override.create("java/io/ByteArrayInputStream.<init>.([B)V", function(buf) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче