![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
Hacking the Mobipocket Reader
I don't like the font resizer of Mobipocket Reader on iLiad because I want more sophiscated size change. Sometimes, I just want the font size increase (or decrease) a little bit larger (or smaller).
Afer peeking into "mobipocket.jar", I found the place to modify: In "cl.class" (it's java bytecode, a java-decompiler is required to turn it back to source code), the available font size is set to "5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32". To me, 5 and 6 are too small, and 28 and 32 are too large, so I want to set it to "7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 24". It's been two years since I wrote my last java program for iLiad. All development environment is cleared, so I have to rebuild it. Hope I still remember how to re-setup it again. Because mobipocket reader is not open source code, posting any of its source code may get me into trouble. If anybody is interested in the mod, maybe I can provide the difference between original and modded .class files. Added: It does work. Here is some note on creating the mod: 1. Copy "mobipocket.jar" in dir "/home/intent" and unpack it in a Linux desktop. My Windows XP does not accept "a.class" and "A.class" in the same dir, so I have to unpack it in Linux. ".jar" is actually ".zip" format. 2. Use a java decompiler to decompile "cl.class" back to source code. It can be done in Linux or Windows XP. 3. In "cl.java", find some line with "5,6,7,....28,32" and modify it to fit your need. 4. Copy the modified source code, "cl.java" to the dir that "mobipocket.jar" is unpacked. Remove the original "cl.class" in that dir. 5. In that dir, execute "javac -source 1.3 -target 1.3 cl.java", and then a new "cl.class" will be generated. I am using jdk1.6 of Sun. 6. Repack all files in that dir back to "mobipocket.jar" and replace the original "mobipocket.jar". Last edited by ericshliao; 12-26-2009 at 08:46 AM. |
![]() |
![]() |
![]() |
#2 |
GuteBook/Mobi2IMP Creator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
|
I like the tone of this thread!
And I like your distaste for too small or too large a font size as well as the fact that you are considering hacking that mobipocket.jar. ![]() This is one of the reasons I got an iLiad, so that I could hack it a bit. While I don't know how to program in java, I can become a quick study with some help from this community. ![]() Here's a partial peak at that decompiled cl.class: Code:
/* cl - Decompiled by JCavaj * Visit http://www.bysoft.se/sureshot/jcavaj/ */ import java.awt.Font; public final class cl { public static final int[] kk = { 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32 }; public static int[] kl = null; public final cn a(String string, int i, boolean bool, boolean bool_0_, boolean bool_1_) { return new cn(new Font(string, (bool ? 1 : 0) + (bool_0_ ? 2 : 0), i), bool_1_); } public final String do() { return "Monospaced"; } ... Now what else could be hacked? Originally I tried to hack into the java system-wide defaults/parameters in the file "system.properties" within the "/home/intent/rofs_target.bin" to "activate" the proxy server settings within Mobipocket reader, but it had no effect. I wanted the Mobipocket Reader to access the internet from hyperlinks embedded within .prc ebooks. The "system.parameters" is a config file and the network related parameters used by the tao-group's java implementation on the iLiad follow: (it looks almost ready to "use", but it's commented out) ![]() Code:
#---- network related Properties ---- # mime Types net.mimeDecoder=uk.co.tao.net.www.SimpleMime # Only used if the mime decoder is 'uk.co.tao.net.www.SimpleMime' net.simpleMimeFile=/uk/co/tao/net/www/SimpleMime.txt # list of package prefixes for class names to use for URL stream handlers java.protocol.handler.pkgs=uk.co.tao.net.www.protocol # list of package prefixes for class names to use for content handlers (URL.getContent()) java.content.handler.pkgs=uk.co.tao.net.www.content # proxy setting # warning: the default value for http.proxySet is true for compatibility with 1.1 # which does not define this key. # Also, some third party http protocol handler implementations only use the 1.1 # keys so setting http.proxyset to false may not work if an invalid host is # in http.proxyHost http.proxySet=false # the host doing the proxying #http.proxyHost=proxyhost # the port listening to proxy request on that host. # Default value is 80 but proxies are often installed at 8080 #http.proxyPort=8080 # list of hosts to access directly via http (pipe separated list) #http.nonProxyHosts=nphost1|nphost2|nphost3 # for http connection caching, the maximum connections to cache http.maxConnections = 5 # for http connection caching, the default connection timeout in seconds http.defaultConnectionTimeout = 15 Last edited by nrapallo; 12-25-2009 at 10:28 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
Nrapallo,
I am not sure if proxy setting is relevant to the concerned issue. I think even if proxy not enabled for JVM, as long as Tao's JVM has http connection related implementation, it should be do-able to modify Mobipocket Reader to download target hyperlink and open it as normal local .prc files. A simple java program can verify if http connection available for Tao's JVM. The hard part is to add proper code to Mobipocket Reader. It's so hard to read the scrambled source code. |
![]() |
![]() |
![]() |
#4 | ||
GuteBook/Mobi2IMP Creator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
|
Quote:
![]() Quote:
![]() |
||
![]() |
![]() |
![]() |
#5 |
GuteBook/Mobi2IMP Creator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
|
Let's see what else, within that mobipocket.jar (system v2.12), looks interesting:
be.class - file-types supported Code:
public final Vector ck() { String[] strings = { ".prc", ".pdb", ".mobi", ".txt", ".htm", ".html" }; return a(hF, strings); } Code:
private void W() { cw = null; cx = null; aQ[] var_aQs; if (ac.aw().as().Z() && ((var_aQs = cu.dW.cQ()) != null && var_aQs.length != 0)) { System.out.println("find the guide icons,guide items number:" + var_aQs.length); for (int i = 0; i < var_aQs.length; i++) { System.out.println("GuideItem:name=[" + var_aQs[i].gz + "],title=[" + var_aQs[i].A + "]"); if (var_aQs[i].gz.equalsIgnoreCase("toc") || var_aQs[i].A.equalsIgnoreCase("Table of Contents")) cw = var_aQs[i]; if (var_aQs[i].gz.equalsIgnoreCase("start") || var_aQs[i].gz.equalsIgnoreCase("other.ms-firstpage") || var_aQs[i].A.toUpperCase().startsWith("START READING") || var_aQs[i].A.toUpperCase().startsWith("BEGIN READING")) cx = var_aQs[i]; } } } Code:
public final void p() { if (hD == null) { hD = new bz(hE.getGraphics(), "test", bv.il, null); ap = new L("words list", new Dimension(704, 560), new Point(32, 32), new w()); ap.ai(); aq = new bc(null, "/com/irex/mobipocket/resources/btn_start_search.png", true, hE, new Dimension(102, 44), new Point(634, 610)); aq.q(2); as = new bm(X.getString("Search String: "), new Dimension(588, 44), new Point(32, 610)); as.q(2); as.ai(); at = (new cA ((X.getString ("Enter the first characters of a word and click on the search button")), new Dimension(704, 12), new Point(32, 662))); ... Code:
public static boolean ah() { Properties properties = new Properties(); try { properties.load(new FileInputStream("mobi.properties")); } catch (Exception exception) { Exception exception_24_; (exception_24_ = exception).printStackTrace(); return false; } dq = properties.getProperty("reader_default_font"); if (dq == null) dq = "Sans"; String string; if ((string = properties.getProperty("baseclass_res_reader")) == null) { System.out.println ("can't find the key [baseclass_res_reader] in property file:mobi.properties"); return false; } ... Code:
private boolean b(cB var_cB) { if ((b = var_cB.m((short) 59)) != -1) { ai = 3; return true; } if ((gg = var_cB.n((short) 97)) != null) { String string; if ((string = gg.toLowerCase()).startsWith("http")) { ai = 1; return true; } if (string.length() > 0 && string.charAt(0) == '$') { ai = 30; return true; } if (string.startsWith("oeb:livebook")) { ai = 12; return true; } } I'm really looking forward to finding the HTML "table" processing code within one of those classes so that I can attempt to CORRECT a bug when internal hyperlinks are within a table i.e like a 'Table of Contents' in many Gutenberg ebooks. In this mobipocket java reader, those hyperlinks DO NOT work and since there is no reason that they shouldn't work, this may be my Number One hacking priority... ![]() ![]() |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
Quote:
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help Hacking Pandigital Reader | Marcy | More E-Book Readers | 8 | 07-29-2010 09:47 AM |
The Register on hacking the Sony Reader | M0zza | News | 9 | 08-11-2009 06:12 PM |
Mobipocket-like reader? | emerika | Reading and Management | 4 | 08-21-2008 01:18 PM |
Mobipocket Reader 5.0 now out | morituri | Reading and Management | 4 | 11-20-2005 04:58 PM |
Mobipocket Reader 4.8 and Mobipocket eNews Creator | Mobipocket | Reading and Management | 1 | 01-29-2004 08:03 AM |