![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 968
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. |
![]() |
![]() |
![]() |
#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 | |
|
![]() |
#3 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 968
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.
|
![]() |
![]() |
![]() |
#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
|
![]() |
![]() |
![]() |
#5 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 968
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 ![]() 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 03:42 AM. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 968
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 ![]() |
![]() |
![]() |
![]() |
#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 09:10 AM. |
![]() |
![]() |
![]() |
#8 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 968
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 |
![]() |
![]() |
![]() |
#9 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 968
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. |
![]() |
![]() |
![]() |
#10 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 968
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. |
![]() |
![]() |
![]() |
#11 |
0000000000101010
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,664
Karma: 11226897
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. |
![]() |
![]() |
![]() |
#12 | |
Sorry for my English
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 458
Karma: 3009894
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 02:52 PM. |
|
![]() |
![]() |
![]() |
#13 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 968
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. |
|
![]() |
![]() |
![]() |
#14 | |
0000000000101010
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,664
Karma: 11226897
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 02:13 PM. |
|
![]() |
![]() |
![]() |
#15 |
Sorry for my English
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 458
Karma: 3009894
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 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Content How many of you are using Kindle Themes? | sydmalicious | Amazon Kindle | 26 | 07-26-2021 07:09 AM |
Themes | thiago.eec | Editor | 6 | 11-26-2018 12:28 AM |
New Leaf Themes! Themes! Themes! | issybird | Book Clubs | 143 | 08-23-2018 07:08 PM |
Themes? | ldrover | Marvin | 5 | 11-09-2013 07:04 AM |
360 Themes etc | MorganM | PocketBook | 14 | 09-29-2011 10:10 PM |