View Single Post
Old 01-04-2015, 05:41 AM   #102
GeoffR
Wizard
GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.
 
GeoffR's Avatar
 
Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
patch32lsb v0.10 testing

I've updated the patch32lsb program from v0.7 to v0.10 to add these new features:

1. New keyword base_address = ADDRESS.

This allows the various replace_* keywords to use an address relative to ADDRESS. e.g. replace_string = OFFSET, OLD_STRING, NEW_STRING will replace the string at ADDRESS+OFFSET. (if not specified, then it defaults to base_address = 0, in which case OFFSET will just be an absolute address, as in previous versions.)

2. New keyword find_base_address = STRING

This searches for STRING and if it is found, and is unique, then base_address is set to point to the beginning of STRING. This allows patches which modify a unique constant string (such as the `Custom reading footer style` patch) to be applied without the address being specified, which means they don't need to be edited to work with different firmware versions (as long as the unique string is the same in the different versions.)

3. New keyword find_xor8_mask = STRING

This searches for a unique 8-bit xor mask for the unique string STRING. This allows the xor8 encoding for the patch to be set without specifying it explicitly with the encode_xor8 keyword. When used before the find_base_address keyword, this means that patches which modify a unique constant string (such as the `Custom reading footer style` patch) can be applied without the need to know either the address or xor encryption used.

4. New escape character: '\0' is now recognised as a synonym for `\x00`


Edit: Updated to version 0.10 which has a much more efficient implementation of find_xor8_mask. Windows and Linux executables should run at about the same speed as memmem() is no longer used.

The find_xor_mask function isn't actually needed at the moment because Kobo have not encrypted the strings we patch, but you can test it by uncommenting the #find_xor8_mask line and check the messages to see that it finds the xor mask value 00.

Edit2: The complete patch package for firmware 3.12.0 using the new version patch32lsb v0.10 is attached, which includes the patches from post #1 and the extra patches in post #2.
Attached Files
File Type: zip patch_kobo_3120v010.zip (473.1 KB, 342 views)

Last edited by GeoffR; 01-18-2015 at 11:25 PM. Reason: Updated patch_kobo_3120v010.zip with new `Fix kepub side bearing font cut-off bug` patch
GeoffR is offline   Reply With Quote