01-14-2024, 02:28 PM | #1 |
Guru
Posts: 973
Karma: 2209358
Join Date: Nov 2011
Location: London, UK
Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3
|
New format themes
Has anyone got any "new format" themes which don't work with the old "pbres.exe" or "viewer.exe" tools?
I'm curious what's different in the format. |
01-14-2024, 04:39 PM | #2 |
Connoisseur
Posts: 78
Karma: 7126
Join Date: May 2023
Device: PocketBook Era
|
I could never get pbres to completely decompile the Lines.pbt file on my Era. At first it was due to pbres having a file size limitation for the bmps. After I changed that size all images came out black
|
Advert | |
|
01-15-2024, 04:51 AM | #3 |
Guru
Posts: 973
Karma: 2209358
Join Date: Nov 2011
Location: London, UK
Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3
|
Can you share (in case there are other files with the same name) that Lines.pbt on this thread, or via PM? I'd like to take a look at it.
|
01-15-2024, 08:23 PM | #4 |
Connoisseur
Posts: 78
Karma: 7126
Join Date: May 2023
Device: PocketBook Era
|
Here is a zip folder of what I was working on including the Lines.pbt
|
01-16-2024, 04:31 AM | #5 |
Guru
Posts: 973
Karma: 2209358
Join Date: Nov 2011
Location: London, UK
Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3
|
Thanks - I tried using a copy of https://github.com/Enyby compiled on my Mac, though it works for several pbt files, but on yours it seg faults after writing a few black images...
The pbres binary in the SDK doesn't seem to have an option to extract all the resources at once. You can extract one at a time but they're still in their internal "res" format (well, file(1) says "PDP-11 separate I&D executable" but that seems unlikely) and not BMP. The SDK pbres has an "unpack_resource" function which (decompiled) seems to uncompress the data and write that as an unchanged blob to disk; Enyby's code for "pbres -u" does the same (and gives identical output) but Enyby's "pbres -d" code tries to convert it to a BMP. So I wonder if the internal res format has changed? Your file is still a v1 theme BTW. Last edited by chrisridd; 01-16-2024 at 04:42 AM. |
Advert | |
|
01-16-2024, 08:27 AM | #6 |
Guru
Posts: 973
Karma: 2209358
Join Date: Nov 2011
Location: London, UK
Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3
|
A few more thoughts.
First, Enyby's pbres and yuryfdr's xpbres (both are on GitHub) both support adding TTF fonts as resources, however they both assume when dumping resources that every resource is a graphic. That's a bug, though I guess TTF resources are unusual. The SDK's "pbres" will convert BMP files into new-style graphic resources, so it seems like it would be possible to construct a few known BMP images and use the SDK's "pbres -t" and then the SDK's "pbres -u" to reverse engineer the new-style graphic resource format. If you disassemble the SDK's pbres bmp2res() it looks rather complicated |
01-16-2024, 10:08 AM | #7 |
Connoisseur
Posts: 78
Karma: 7126
Join Date: May 2023
Device: PocketBook Era
|
The seg fault is the bmp variable file size. You need to change it to a larger number. I can't remember which line it was. I'll take a look again
Take a look at this thread I made a while back. The icons I believe are still BMP format. This thread was about creating custom icons https://www.mobileread.com/forums/sh...d.php?t=355521 Last edited by jrw174; 01-16-2024 at 10:10 AM. |
01-16-2024, 01:41 PM | #8 |
Guru
Posts: 973
Karma: 2209358
Join Date: Nov 2011
Location: London, UK
Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3
|
In this case it isn't the file size that's the problem. "pbres -l Line.pbt" starts like this:
Code:
resource size compressed -------------------------------------------- <theme.cfg> 137293 22902 AppStore:4 19036 3245 CardLogo:4 67832 33882 GooglePlay:4 20456 3688 about:4 12328 602 activate_account_on_eink:4 49736 493 activate_account_on_smartphone:4 49736 989 add_to_cloud:4 12328 584 adjustments:4 12328 182 adjustments_inv:4 12328 756 adobe_activation_layout:4 11360 1162 |
05-09-2024, 03:04 AM | #9 |
Guru
Posts: 973
Karma: 2209358
Join Date: Nov 2011
Location: London, UK
Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3
|
I'm resurrecting this thread, because I've managed to figure out by brute force how to convert the images inside a theme file (an ibitmap resource) back into an image.
First I created 65536 BMP files, each with 256 different pixels. (In other words 256 x 256 x 256 colours across all files.) I then used pbres from the current (6.5?) SDK to build test theme files with all of those BMPs. (256 themes, so each had 65536 image resources). I used enyby's pbres tool to unpack (-u) each resource from each test theme. BTW the SDK pbres, enyby's pbres and yuryfdr's xpbres all unpack resources identically. I could then map every encoded byte (pixel) from every unpacked bitmap into its original color from the BMPs. Obviously each encoded byte will map to multiple RGB pixels because 24 into 8 just doesn't work. So I computed an average RGB value for each encoded byte. (Summed the squares of each colour, divided by the number of colours) So I now essentially have a colour palette, mapping a resource pixel into RGB. I told you it was brute force! It would be nice to figure out the exact bit shifting/manipulation that the SDK pbres actually does. I'm attaching 3 PNGs from my Inkpad Color 3's Line.pbt file. The "USB" one looks pretty good to me. The "tr" one has quite a lot of colour "artifacts", so possibly that colour averaging step needs some work. The "wwrook" looks a bit odd too, but if you look at the actual resource there are strange pixels dotted over the image. |
05-09-2024, 03:58 AM | #10 |
Guru
Posts: 973
Karma: 2209358
Join Date: Nov 2011
Location: London, UK
Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3
|
Here's the palette using that colour averaging method BTW.
Remember you get raw resource files using "pbres -u theme.pbt name". The resource file format for ibitmaps is: 2 bytes: little-endian width 2 bytes: little-endian height + transparency flag (0x8000) 2 bytes: little-endian bytes per pixel (eg 8) 2 bytes: little-endian bytes per scanline A scanline is a row of pixels, with possibly extra padding on the right. After the header you get the scanline for y=0, then the scanline for y=1, etc etc. Lines are encoded in top to bottom order. After all the scanlines, if the transparency flag is set it seems there are some extra bytes. I haven't investigated how to interpret these. |
05-09-2024, 10:45 AM | #11 |
0000000000101010
Posts: 5,739
Karma: 11482159
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
|
Nice work. And yes, that really was a brute force attempt!
Hopefully this will open the door for some future theming. |
05-09-2024, 11:32 AM | #12 | |
Sorry for my English
Posts: 464
Karma: 3009898
Join Date: Aug 2018
Location: France.Besancon
Device: KOBO.PocketBook.ONYX
|
Quote:
Could you create a script for restart (factory reset) for the Pocketbook device? Or at least what shell command would I use to achieve this? FW 6.8.* The point is that on one device (inkpad4) the lower part of the touch screen has stopped working (about one or two centimeters from the bottom edge), so I cannot restore the device via the menu, because when I enter "Restart" I have to click on the "OK" box, which it's just in the zone where the touch screen doesn't work. I read somewhere that the touch screen can be reinstalled by preflashing some file, do you happen to have more information on how to restore the code for the touch screen? ""At the same time, I am almost sure that the screen is not damaged, because I see in SHELL that when I touch the part that does not respond, I see information being written in the console, so I assume that a re-flash could solve the situation "". After installing the PB version, the situation changed, even with the help of Downgrade, so I would still like to try a factory reset if it doesn't improve anything for me. Thank you for understanding. THX Last edited by Michal Jancik; 05-09-2024 at 03:52 PM. |
|
05-09-2024, 04:03 PM | #13 | |
Guru
Posts: 973
Karma: 2209358
Join Date: Nov 2011
Location: London, UK
Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3
|
Quote:
A file containing a line for every RGB value is 534MB. I think I'll try and figure out how many values for each channel (eg red) result in different packed bytes. If anyone's smarter at this stuff than me (not hard!) and wants to collaborate, send me a PM. |
|
05-11-2024, 01:56 AM | #14 | |
0000000000101010
Posts: 5,739
Karma: 11482159
Join Date: Mar 2023
Location: An island off the coast of Ireland
Device: PB632 [HD3]
|
Quote:
I've created a simple binary and launcher that I think should force a factory reset. I couldn't test though, as I didn't want to risk wiping my own device. I've attached a zip with the files, unpack to /mnt/ext1/applications, reboot then try. I'll PM you the password. Last edited by neil_swann80; 05-13-2024 at 03:13 PM. |
|
05-12-2024, 01:26 PM | #15 |
Sorry for my English
Posts: 464
Karma: 3009898
Join Date: Aug 2018
Location: France.Besancon
Device: KOBO.PocketBook.ONYX
|
Thank you very much, the recovery app works. But you were right that restoring probably wouldn't solve my problem.
|
Tags |
themes |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Content How many of you are using Kindle Themes? | sydmalicious | Amazon Kindle | 26 | 07-26-2021 08:09 AM |
Themes | thiago.eec | Editor | 6 | 11-26-2018 01:28 AM |
New Leaf Themes! Themes! Themes! | issybird | Book Clubs | 143 | 08-23-2018 08:08 PM |
Themes? | ldrover | Marvin | 5 | 11-09-2013 08:04 AM |
360 Themes etc | MorganM | PocketBook | 14 | 09-29-2011 11:10 PM |