View Single Post
Old 10-05-2017, 07:43 AM   #4
oren64
I need a chapter break
oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.
 
oren64's Avatar
 
Posts: 4,042
Karma: 56058267
Join Date: Mar 2015
Location: Israel
Device: Kobo Glo
Create patches form CSS string.

This is a easy way to make patches from CSS string.

From firmware 4.x a lot of code moved from libnickel.so.1.0.0 to nickel have been compressed to CSS string.

Tools:
CSS styles modifications inside nickel (Python 2 needed). By pipcat
makepatch program preferable makepatch-0.02.zip file, By GeoffR


Instructions:
  1. Download thepatch-nickel-css-v02.zip and extract as folder in your PC. Windows users can extract the files extract.bat and patch.bat from "bat files for windows.zip" to that folder.
  2. Open the file css_streams.py change the line
    Code:
    pos += 4 + len_stream
    to
    Code:
    pos += 3 + len_stream
    That way it can find all CSS streams contained in nickel (Thanks to jackie_w).
  3. Download the Firmware that you what to make patches from (See here) Extrcat the nickel file from the Kobo firmware kobo-update-4.x.xxxx.zip\koboroot.tgz\usr\local\kobo\nickel, to the folder.
  4. Execute python extract.py it will make "nickel-extracted.css" file with streams (Windows file extract.bat for easy access). For example in 4.6.9660 there 158 stream with 99 compressed.
    Click image for larger version

Name:	T1.PNG
Views:	535
Size:	41.3 KB
ID:	159309
  5. Open the file nickel-extracted.css and select witch stream you want to modify, In this method we work on only one stream at a time.
    for example I will show how I made the patch `New home screen increasing cover size` for firmware 4.6.9660. I select the stream 106 and copy it to the file nickel-modified.css, make sure file is empty before.
    Spoiler:
    Code:
    /* found: 106 (zlib) pos: 4c2e69 */ #mainContainer[qApp_deviceIsTrilogy=true] { qproperty-leftMargin: 26; qproperty-rightMargin: 26; qproperty-topMargin: 96; qproperty-bottomMargin: 26; qproperty-spacing: 10; } #mainContainer[qApp_deviceIsPhoenix=true] { qproperty-leftMargin: 36; qproperty-rightMargin: 36; qproperty-topMargin: 126; qproperty-bottomMargin: 36; qproperty-spacing: 14; } #mainContainer[qApp_deviceIsDragon=true] { qproperty-leftMargin: 50; qproperty-rightMargin: 50; qproperty-topMargin: 170; qproperty-bottomMargin: 50; qproperty-spacing: 20; } #mainContainer[qApp_deviceIsDaylight=true] { qproperty-leftMargin: 65; qproperty-rightMargin: 65; qproperty-topMargin: 220; qproperty-bottomMargin: 65; qproperty-spacing: 26; } #row1[qApp_deviceIsTrilogy=true], #row2[qApp_deviceIsTrilogy=true] { max-height: 280px; min-height: 280px; } #row1[qApp_deviceIsPhoenix=true], #row2[qApp_deviceIsPhoenix=true] { max-height: 346px; min-height: 346px; } #row1[qApp_deviceIsDragon=true], #row2[qApp_deviceIsDragon=true] { max-height: 488px; min-height: 488px; } #row1[qApp_deviceIsDaylight=true], #row2[qApp_deviceIsDaylight=true] { max-height: 634px; min-height: 634px; } [qApp_isFontScaleLarge=true] #row1[qApp_deviceIsTrilogy=true] { max-height: 392px; min-height: 392px; } [qApp_isFontScaleLarge=true] #row1[qApp_deviceIsPhoenix=true] { max-height: 484px; min-height: 484px; } [qApp_isFontScaleLarge=true] #row1[qApp_deviceIsDragon=true] { max-height: 683px; min-height: 683px; } [qApp_isFontScaleLarge=true] #row1[qApp_deviceIsDaylight=true] { max-height: 887px; min-height: 887px; } [qApp_isFontScaleLarge=true] #row2[qApp_deviceIsTrilogy=true] { max-height: 112px; min-height: 112px; } [qApp_isFontScaleLarge=true] #row2[qApp_deviceIsPhoenix=true] { max-height: 138px; min-height: 138px; } [qApp_isFontScaleLarge=true] #row2[qApp_deviceIsDragon=true] { max-height: 195px; min-height: 195px; } [qApp_isFontScaleLarge=true] #row2[qApp_deviceIsDaylight=true] { max-height: 253px; min-height: 253px; } [qApp_isFontScaleLarge=true] #row1col2 { qproperty-visible: false; }

  6. I edit the stream in nickel-modified.css file by reduces the left and right margin and save the file.
    Spoiler:
    Code:
    /* found: 106 (zlib) pos: 4c2e69 */ #mainContainer[qApp_deviceIsTrilogy=true] { qproperty-leftMargin: 10; qproperty-rightMargin: 10; qproperty-topMargin: 96; qproperty-bottomMargin: 26; qproperty-spacing: 10; } #mainContainer[qApp_deviceIsPhoenix=true] { qproperty-leftMargin: 12; qproperty-rightMargin: 12; qproperty-topMargin: 126; qproperty-bottomMargin: 36; qproperty-spacing: 14; } #mainContainer[qApp_deviceIsDragon=true] { qproperty-leftMargin: 16; qproperty-rightMargin: 16; qproperty-topMargin: 170; qproperty-bottomMargin: 50; qproperty-spacing: 20; } #mainContainer[qApp_deviceIsDaylight=true] { qproperty-leftMargin: 20; qproperty-rightMargin: 20; qproperty-topMargin: 220; qproperty-bottomMargin: 65; qproperty-spacing: 26; } #row1[qApp_deviceIsTrilogy=true], #row2[qApp_deviceIsTrilogy=true] { max-height: 280px; min-height: 280px; } #row1[qApp_deviceIsPhoenix=true], #row2[qApp_deviceIsPhoenix=true] { max-height: 346px; min-height: 346px; } #row1[qApp_deviceIsDragon=true], #row2[qApp_deviceIsDragon=true] { max-height: 488px; min-height: 488px; } #row1[qApp_deviceIsDaylight=true], #row2[qApp_deviceIsDaylight=true] { max-height: 634px; min-height: 634px; } [qApp_isFontScaleLarge=true] #row1[qApp_deviceIsTrilogy=true] { max-height: 392px; min-height: 392px; } [qApp_isFontScaleLarge=true] #row1[qApp_deviceIsPhoenix=true] { max-height: 484px; min-height: 484px; } [qApp_isFontScaleLarge=true] #row1[qApp_deviceIsDragon=true] { max-height: 683px; min-height: 683px; } [qApp_isFontScaleLarge=true] #row1[qApp_deviceIsDaylight=true] { max-height: 887px; min-height: 887px; } [qApp_isFontScaleLarge=true] #row2[qApp_deviceIsTrilogy=true] { max-height: 112px; min-height: 112px; } [qApp_isFontScaleLarge=true] #row2[qApp_deviceIsPhoenix=true] { max-height: 138px; min-height: 138px; } [qApp_isFontScaleLarge=true] #row2[qApp_deviceIsDragon=true] { max-height: 195px; min-height: 195px; } [qApp_isFontScaleLarge=true] #row2[qApp_deviceIsDaylight=true] { max-height: 253px; min-height: 253px; } [qApp_isFontScaleLarge=true] #row1col2 { qproperty-visible: false; }

  7. I execute python patch.py (Windows file patch.bat for easy access). It will generate a new nickel file with the changes I made in the name "nickel-modif".
    Click image for larger version

Name:	t2.PNG
Views:	490
Size:	36.8 KB
ID:	159310
  8. Download makepatch-0.02.zip and extract as folder in your PC. Windows users can extract the file makepa32.bat from "bat files for windows.zip" to that folder.
  9. I copy the files "nickel" and "nickel-modif" to that folder. Execute the file makepa32 (nickel=oldfile, nickel-modif=newfile). (Windows file makepa32.bat for easy access).
    It will create patch `New home screen increasing cover size`.
    Click image for larger version

Name:	T3.PNG
Views:	858
Size:	139.7 KB
ID:	159311
    To copy the patch in windows, right click frame > Edit > Mark, mark the patch, press enter to copy.
  10. The patch is ready, copy the patch to file nickel.patch.

To make a patch from the same nickel file repeat steps 5-10.
Attached Files
File Type: zip bat files for windows .zip (502 Bytes, 347 views)

Last edited by oren64; 03-20-2018 at 07:08 AM.
oren64 is offline   Reply With Quote