04-16-2012, 05:12 AM | #1 |
(offline)
Posts: 2,907
Karma: 6736094
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
|
JBPatch
Version 4.0.0 (2013-04-13)
For instance, here are images showing the hyphenation (animated), the dictionaries patch (animated), the progress bar, and the cover view: ...and here are a few screenshots of the JBPatch User Interface: Description: JBPatch (Java Bytecode Patch) is a framework which allows to replace/modify Kindle functionality, without having to physically modify the files present on the device. Patches are pluggable, meaning that everybody can create modifications, and you can install as many (or as few) as you want. This can only modify Java-based functionality, but that covers 100% of the UI of Kindle 1 - 4, and still about 75% of Kindle 5 (Kindle Touch / Paperwhite). Patches are generally expected to be rather small, and to modify very specific aspects. However, they can in principle be arbitrarily complex -- everything is possible! So far, only patches for Kindle Touch and Paperwhite have been released. The general approach should work on other models though. If you find this interesting, and could test it on other devices, you're more than welcome to try it out, and to comment here. (UPDATE: thanks to arikfunke, a bare-bones JBPatch now works on the K3!) Requirements:
Downloads / Source Code: Download the file attached to this post to get the latest release version, and install as described in the contained README file. Source code is available from here. Localizations: JBPatch is completely localizable, but the download only includes english translations. Translations for other languages can be downloaded from here. Those files are updated hourly if changes to the translations are detected. More information is available in the Wiki. The abovementioned page only contains downloads for languages that are officially supported on the Kindle Touch. Links to "unofficial" language packs can be found below:
GUI Launcher Integration (KT): If you wish to access JBPatch from the GUI Launcher, you can use this file. This is not required, just an optional feature. New Patches: As said, this is a pluggable mechanism, and you can enable as many patches as you want. Patches can be developed by everyone, but some reverse engineering skills are required. Here are some HOWTOs which walk you through the process of creating a patch: simple, more complex. Note that these are referring to a previous version of JBPatch. For newer versions, slightly more effort is required to accommodate for the UI requirements (but not for the actual patching itself). Documentation / Contributions: The primary source of documentation is now this Wiki page. The intention of that page is to consolidate the information contained in this thread in an organized and easily-accessible manner. In other words: everybody is more than welcome to modify the Wiki page and to improve its usefulness, by adding or clarifying topics, or by contributing new patches and localizations. The Wiki page and this thread are meant to complement each other: think of the thread as the place where ongoing topics are discussed, while the Wiki page serves as a "one-stop-shop" for information. IMO, this merges the best of both worlds: cutting-edge, but sometimes "chaotic" discussions in the forums (chaotic in the sense that information tends to get lost, or difficult to find, as the discussion progresses), plus easily-accessible information on the Wiki. Of course, you are welcome to propagate important changes in the Wiki to this thread, and vice-versa. Version History and Release Announcements: Spoiler:
Installation/Update Notes:
Other Notes:
Spoiler:
If you like JBPatch: I sincerely hope that you find JBPatch useful. If you like the enhancements that it offers to your Kindle experience, you are more than welcome to donate a little something... but don't give your money to me. Please donate for a much more important cause, namely: for a Literacy project in Laos. You will make not only me happy. Thank you! Make sure to download the correct file for your device!
Last edited by ixtab; 09-21-2013 at 03:04 PM. |
04-16-2012, 05:14 AM | #2 |
(offline)
Posts: 2,907
Karma: 6736094
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
|
So I have come up with something that I'm pretty excited about.
Note that this is NOT ready for prime time yet (consider it alpha at most), so installation is manual. I have only tested this on Kindle Touch 5.1.0 (because that's the only device I have around). For the time being, if you have a different version or model, you won't see any effect, so don't even bother to install it. But if you are on 5.1.0 and are curious, then:
Then, go to Menu > Settings, Menu > Legal and be prepared for a surprise There is also Menu > Settings, Menu > Device Info to check out. And finally, try to enable TTS on a non-english (or TTS-disabled) book (and then go back to device info). Oh, and there's /tmp/kpatcher.log as well. This is somewhat of a logical follow-up to this older post, but it is MUCH more powerful. In fact, with this approach, we can modify every single class in the framework, without having to overwrite Amazon's files or distributing copyrighted binary files. Yeeehaaa! Note: As said, the "demo" works on KT 5.1.0 only. However, the general approach is suitable for all models (in fact, maybe even more for older models than for the Touch, because on older models the entire UI is in Java, which is not the case on KT). Update: attachment removed. See first post for the newest version. Last edited by ixtab; 04-29-2012 at 05:48 PM. |
Advert | |
|
04-16-2012, 06:14 AM | #3 |
Addict
Posts: 396
Karma: 33660
Join Date: Jul 2011
Device: Kindle 3, Kindle 4, Kindle PW, Nexus7 3G
|
Amazing, could not resist to check immediatelly. How the f... do you do all this stuff?
|
04-16-2012, 07:17 AM | #4 | |
(offline)
Posts: 2,907
Karma: 6736094
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
|
Quote:
Still, I would never have been able to do this without the truely excellent serp bytecode manipulation framework. In fact, I had used it for the first time for the localization, so without that, maybe this wouldn't even have crossed my mind. So you see, it's all a continuous process BTW, it's astonishing with how little code (and relatively little effort, actually) this works. All of this together is only around 400 lines of code for now, and it's amazingly elegant (I think). You can simply decompile the code and you'll see In short, the way that it works is by injecting a ClassLoader in the hierarchy as early as possible, which can then intercept all class load requests. And instead of loading classes normally, it can modify them (using the mentioned serp library) before they are loaded. This means that as little or as many changes as you want can be made. For example, the actual "TTS enabling" patch changes exactly one opcode, and consists of 7 lines of code in total. Note that this is not fully dynamic, because classes cannot be redefined at runtime, but only once at load time. This is a limitation of the underlying JVM itself. Still, we can essentially arbitrarily change all classes without needing to touch a single original file. (Well, yeah, one. The configuration file ) Last edited by ixtab; 04-16-2012 at 07:24 AM. Reason: typo |
|
04-16-2012, 12:57 PM | #5 |
(offline)
Posts: 2,907
Karma: 6736094
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
|
Short update:
I uploaded the source code a while ago (see first post). In the mean time, here is another version, which is closer to what I intend this to be. Individual patches can now be enabled/disabled by simply copying or removing files rom a folder. The files more or less reflect my idea of where this should be going, but there's certainly more to do. Oh, and I renamed it from kpatcher to jbpatcher ("Java Bytecode Patcher" instead of "Kindle Patcher", because the approach is not specific to the Kindle). So yes, entirely remove the previous stuff and install this one instead... If you have any comments, let me know. Update: attachment removed. See first post for the newest version. Last edited by ixtab; 04-29-2012 at 05:48 PM. |
Advert | |
|
04-16-2012, 01:19 PM | #6 |
Addict
Posts: 396
Karma: 33660
Join Date: Jul 2011
Device: Kindle 3, Kindle 4, Kindle PW, Nexus7 3G
|
Installed latest version, now i have "Your Kindle needs repair screen" ... (Ihr Kindle muss repariert werden) :-(
|
04-16-2012, 01:45 PM | #7 |
Addict
Posts: 396
Karma: 33660
Join Date: Jul 2011
Device: Kindle 3, Kindle 4, Kindle PW, Nexus7 3G
|
I am in diags mode, what is the command to enter getting out of this f...ing "repair" mode please?
update: diags, but actually can not access via WinSCP ... done, diags, ssh, so anyboby telling me the command pls, already reading in the 25th post ... Last edited by diba; 04-16-2012 at 01:52 PM. |
04-16-2012, 01:50 PM | #8 |
(offline)
Posts: 2,907
Karma: 6736094
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
|
Hmmm... I can't reproduce that. I just retried with the exact same files that I posted here....
But I do get something interesting as well when rebooting, namely /mnt/us/jbpatcher not being found. Could it really be that the framework is starting even before all filesystems are correctly mounted?! |
04-16-2012, 01:54 PM | #9 |
Addict
Posts: 396
Karma: 33660
Join Date: Jul 2011
Device: Kindle 3, Kindle 4, Kindle PW, Nexus7 3G
|
deleted
Last edited by diba; 04-17-2012 at 01:46 PM. |
04-16-2012, 01:57 PM | #10 |
Addict
Posts: 396
Karma: 33660
Join Date: Jul 2011
Device: Kindle 3, Kindle 4, Kindle PW, Nexus7 3G
|
deleted
Last edited by diba; 04-17-2012 at 01:42 AM. |
04-16-2012, 01:58 PM | #11 |
(offline)
Posts: 2,907
Karma: 6736094
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
|
Hehe... no. I have actually never managed to get my Kindle into that state.
Still, just search for "repair" on https://wiki.mobileread.com/wiki/Kindle_Touch_Hacking ... That looks like what you are looking for. |
04-16-2012, 01:59 PM | #12 |
(offline)
Posts: 2,907
Karma: 6736094
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
|
|
04-16-2012, 02:01 PM | #13 |
Addict
Posts: 396
Karma: 33660
Join Date: Jul 2011
Device: Kindle 3, Kindle 4, Kindle PW, Nexus7 3G
|
Can I just do it by entering this command or is it necessary to do it via the runme? As said I am in diagnostic and have ssh access.
|
04-16-2012, 02:06 PM | #14 |
(offline)
Posts: 2,907
Karma: 6736094
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
|
You can of course do it from diags, as long as you delete the right file on the right partition.
On the bright side... you have SSH control, so you can do things interactively.... |
04-16-2012, 02:18 PM | #15 |
Addict
Posts: 396
Karma: 33660
Join Date: Jul 2011
Device: Kindle 3, Kindle 4, Kindle PW, Nexus7 3G
|
so if I delete the /var/local/upstart/lab126_gui.restarts the KT should be ready to restart?
|
Tags |
jbpatch, kindle touch hacks |
|