Sunday, May 11, 2008

JavaGear Android Port

I've started to port JavaGear to Google's Android platform. The results are good, although it runs seriously slowly in the emulator. Based on the J2ME version, it will presumably run faster on an actual device.

There will be updates to the existing mobile version of JavaGear in due course. I'm hoping to add Lightgun support for touchscreen handsets.

There's still some debugging on the Android version to be done in the meantime, and I've got to merge the Android code into the main source tree, as it's forked at the moment.


Rich said...


I found your site when I was looking for Java-based emulators to port to Android. I was digging through your code ready to port when I looked through your blog and saw you had already started.

I'm probably going to try porting a GameBoy emu soon, do you have any tips/advice about porting from Java to Android? Maybe you could even write a tutorial about how your ported JavaGear to Android and what imports need to be changed and what needs to be modified (the awt stuff is probably the trickiest, right?)

Anyway, let me know please!
miserlou .aaattt. gmail doot com

yt said...

Just dropped you an e-mail :)

Stepan Korshakov said...

I have G1 and I ported your JavaGear to it ;)
And I can say that on device it runs slow as it runs in emulator(
Please, let me know about your developings!

koshakov.stepan .att. gmail ..dott.. com

yt said...

Hopefully some of the newer G1 devices will be faster :)

Stepan Korshakov said...

Are you know about G1?
Next year doesn't appear any device more powerful than G1...

I can explain you why it works too slow.
Reason is Android's realisation of switch operator it is optimised for small switch blocks, not for such big switches.
So no one emulator works with good speed, for example JavaGear works normaly at SonyErricson k550i, witch habe 200mhz processor... so G1 have 528Mhz processor...

yt said...

I know, back in the dark ages, some J2SE based emulators used an approach whereby instead of using a giant 'switch' statement they used a separate Runnable class for each opcode.

The Java issues can be frustrating. Even with JavaGear it can run better on some underpowered handsets that are 3 years old, and not perform well on the latest Nokia N95... ;)

The Sony phones also do some kind of precompilation of the code first time you run the app I think, which helps a lot.

Stepan Korshakov said...

Hello again)
I modified your program for using separate classes for each opcode, but emulator begin work slowly...

Any ideas where i could try to optimize JavaGear?

yt said...

drop me an e-mail at the address on and we can discuss further :)