Thread: Kobo Patcher
View Single Post
Old 12-08-2013, 01:31 PM   #591
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 46,873
Karma: 169716272
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by GeoffR View Post
I mean the replacement string is not terminated by a null character. Would the two LF's be enough to tell the CSS interpreter to stop processing the rest of the string? I don't think so, as the original footer string is structured like

ReadingFooter { ... }\n\n ReadingFooter[deviceCodeName="dragon"] { ... }\n\n

which I think means that the first clause is applied to all devices, then the second is read but only applied for AuraHD devices. So if the replacement string was the right length to overwrite the first clause but leave the second intact, and there was no terminating null to end the string, then the second clause from the original string would still be applied to AuraHD devices, possibly overriding the first clause.

Edit: I added code to my own program to test, if I terminate the replacement string with a null then I get binary output that differs from what kpg.exe produces, but if I don't terminate the string then I get output identical to kpg.exe.
When I looked at the original Kobo code, it is terminated with a } followed by a null character. I tried adding \x00 to the end of the replacement string I'm using to add a null terminator and it didn't make any difference in what I saw on my Aura HD with the original MZ replacement string. One member sent me a couple of attempted changes which didn't work despite looking okay. I fiddled with changing what was in the replacement string to change it's length and found some odd things happening which did not happen when the null was added. It appears that if the replacement string has the right length to leave a valid looking css style after it, the rest of the original string will be processed.

As an example, here's a setup I was sent that didn't work until a \x00 was added:
Code:
Original string:
ReadingFooter {\n\tmin-height: 70px;\n\tmax-height: 70px;\n\tqproperty-footerMargin: 40;\n}\n\n
Replacement string:
* {\n\tmin-height: 50px;\n\tmax-height: 50px;\n\tfont-size: 34px;\n\tfont-family: Amasis\n}\n\n
Regards,
David

Last edited by DNSB; 12-08-2013 at 01:43 PM.
DNSB is offline   Reply With Quote